Skip to content

Commit

Permalink
Update Matter.framework API per API review decisions. (#24680)
Browse files Browse the repository at this point in the history
* Update Matter.framework API per API review decisions.

* Regenerate generated files for API changes.

* Update versioons in availability.yaml.

This should fix MTR_NEWLY_* to have the right versions in generated code.

* Regenerate generated code for version update.

* Update MTR_NEWLY_* to have the right versions in non-generated code.

This commit was generated by running the following commands:

    git sed MTR_NEWLY_AVAILABLE 'API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4))' -- src/darwin/Framework/CHIP
    git sed 'MTR_NEWLY_DEPRECATED("\([^"]*\)")' 'API_DEPRECATED("\1", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4))' -- src/darwin/Framework/CHIP/
    git restore src/darwin/Framework/CHIP/Matter.h

and then running restyle.

* Manually fix up MTR_NEWLY_DEPRECATED instances that the regexp missed.

* Address review comments.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Aug 23, 2023
1 parent 5d9b5a8 commit 3731379
Show file tree
Hide file tree
Showing 58 changed files with 28,013 additions and 22,432 deletions.
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()]];
}

// 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

0 comments on commit 3731379

Please sign in to comment.