Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Matter.framework API per API review decisions. #24680

Merged
merged 7 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Project CHIP Authors
* Copyright (c) 2022-2023 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -134,7 +134,7 @@ class SubscribeAttribute : public ModelCommand {
params.replaceExistingSubscriptions = !mKeepSubscriptions.Value();
}
if (mAutoResubscribe.HasValue()) {
params.resubscribeIfLost = mAutoResubscribe.Value();
params.resubscribeAutomatically = mAutoResubscribe.Value();
}

[device subscribeToAttributesWithEndpointID:[NSNumber numberWithUnsignedShort:endpointId]
Expand Down Expand Up @@ -218,7 +218,7 @@ class SubscribeEvent : public ModelCommand {

MTRSubscribeParams * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)];
if (mEventNumber.HasValue()) {
params.minimumEventNumber = [NSNumber numberWithUnsignedLongLong:mEventNumber.Value()];
params.minEventNumber = [NSNumber numberWithUnsignedLongLong:mEventNumber.Value()];
}
if (mKeepSubscriptions.HasValue()) {
params.replaceExistingSubscriptions = !mKeepSubscriptions.Value();
Expand All @@ -227,7 +227,7 @@ class SubscribeEvent : public ModelCommand {
params.reportEventsUrgently = mIsUrgent.Value();
}
if (mAutoResubscribe.HasValue()) {
params.resubscribeIfLost = mAutoResubscribe.Value();
params.resubscribeAutomatically = mAutoResubscribe.Value();
}

if (strcmp(GetName(), "subscribe-event-by-id") == 0) {
Expand Down Expand Up @@ -330,7 +330,7 @@ class ReadEvent : public ModelCommand {
params.filterByFabric = mFabricFiltered.Value();
}
if (mEventNumber.HasValue()) {
params.minimumEventNumber = [NSNumber numberWithUnsignedLongLong:mEventNumber.Value()];
params.minEventNumber = [NSNumber numberWithUnsignedLongLong:mEventNumber.Value()];
}

[device
Expand Down
6 changes: 3 additions & 3 deletions examples/darwin-framework-tool/commands/pairing/Commands.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Project CHIP Authors
* Copyright (c) 2022-2023 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -22,7 +22,7 @@

#include "OpenCommissioningWindowCommand.h"
#include "PairingCommandBridge.h"
#include "PrepareCommissioningCommand.h"
#include "PreWarmCommissioningCommand.h"

class PairCode : public PairingCommandBridge
{
Expand Down Expand Up @@ -72,7 +72,7 @@ void registerCommandsPairing(Commands & commands)
make_unique<PairBleThread>(),
make_unique<Unpair>(),
make_unique<OpenCommissioningWindowCommand>(),
make_unique<PrepareCommissioningCommand>(),
make_unique<PreWarmCommissioningCommand>(),
};

commands.Register(clusterName, clusterCommands);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Project CHIP Authors
* Copyright (c) 2022-2023 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -23,10 +23,10 @@

#import "MTRError_Utils.h"

class PrepareCommissioningCommand : public CHIPCommandBridge {
class PreWarmCommissioningCommand : public CHIPCommandBridge {
public:
PrepareCommissioningCommand()
: CHIPCommandBridge("prepare-commissioning")
PreWarmCommissioningCommand()
: CHIPCommandBridge("pre-warm-commissioning")
{
}

Expand All @@ -35,12 +35,7 @@ class PrepareCommissioningCommand : public CHIPCommandBridge {
CHIP_ERROR RunCommand() override
{
auto * controller = CurrentCommissioner();
NSError * error;
if (![controller prepareCommissioningSession:&error]) {
auto err = MTRErrorToCHIPErrorCode(error);
SetCommandExitStatus(err);
return err;
}
[controller preWarmCommissioningSession];

// In interactive mode, we don't want to block the UI until the end of `GetWaitDuration`. So returns early.
if (IsInteractive()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2022 Project CHIP Authors
* Copyright (c) 2022-2023 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,8 +38,7 @@
return nil;
}

NSError * error;
return [MTROTAHeader headerFromData:[NSData dataWithBytes:buffer.data() length:buffer.size()] error:&error];
return [[MTROTAHeader alloc] initWithData:[NSData dataWithBytes:buffer.data() length:buffer.size()]];
bzbarsky-apple marked this conversation as resolved.
Show resolved Hide resolved
}

// Parses the JSON filepath and extracts DeviceSoftwareVersionModel parameters
Expand Down
2 changes: 1 addition & 1 deletion examples/darwin-framework-tool/templates/commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public:
params.filterByFabric = mFabricFiltered.Value();
}
if (mAutoResubscribe.HasValue()) {
params.resubscribeIfLost = mAutoResubscribe.Value();
params.resubscribeAutomatically = mAutoResubscribe.Value();
}
[cluster subscribe{{>attribute}}WithParams:params
subscriptionEstablished:^(){ mSubscriptionEstablished=YES; }
Expand Down
4 changes: 2 additions & 2 deletions src/darwin/Framework/CHIP/MTRBaseClusterUtils.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Project CHIP Authors
* Copyright (c) 2022-2023 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -202,7 +202,7 @@ CHIP_ERROR MTRStartSubscribeInteraction(BridgeType * _Nonnull bridge, MTRSubscri
VerifyOrReturnError(readClient != nullptr, CHIP_ERROR_NO_MEMORY);

CHIP_ERROR err;
if (params.resubscribeIfLost) {
if (params.resubscribeAutomatically) {
readPaths.release();

err = readClient->SendAutoResubscribeRequest(std::move(readPrepareParams));
Expand Down
Loading