From 22ea07087d5112231a6c36eb398b55ef4697c474 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Thu, 15 Sep 2022 13:29:08 +0200 Subject: [PATCH] [Darwin] Update template to preserve acronyms (e.g ACL) in APIs --- .../commands/provider/OTAProviderDelegate.h | 18 +++++----- .../commands/provider/OTAProviderDelegate.mm | 24 +++++++------- .../provider/OTASoftwareUpdateInteractive.mm | 28 ++++++++-------- .../templates/commands.zapt | 33 ++++++++++--------- .../tests/partials/test_cluster.zapt | 20 ++++++----- .../certification/Test_TC_DGWIFI_2_1.yaml | 4 +-- .../Framework/CHIP/MTROTAProviderDelegate.h | 10 +++--- .../CHIP/MTROTAProviderDelegateBridge.h | 10 +++--- .../CHIP/MTROTAProviderDelegateBridge.mm | 24 +++++++------- .../CHIP/templates/MTRBaseClusters-src.zapt | 12 ++++--- .../CHIP/templates/MTRBaseClusters.zapt | 8 +++-- .../templates/MTRBaseClusters_internal.zapt | 2 +- .../CHIP/templates/MTRCallbackBridge-src.zapt | 12 +++---- .../templates/MTRCallbackBridge_internal.zapt | 24 +++++++------- .../CHIP/templates/MTRClusterConstants.zapt | 26 ++++++++++----- .../CHIP/templates/MTRClusters-src.zapt | 14 ++++---- .../Framework/CHIP/templates/MTRClusters.zapt | 8 +++-- .../CHIP/templates/MTRClusters_internal.zapt | 2 +- .../templates/MTRCommandPayloadsObjc-src.zapt | 4 +-- .../templates/MTRCommandPayloadsObjc.zapt | 2 +- .../MTREventTLVValueDecoder-src.zapt | 2 +- .../CHIP/templates/MTRStructsObjc-src.zapt | 8 ++--- .../CHIP/templates/MTRStructsObjc.zapt | 4 +-- .../templates/partials/MTRCallbackBridge.zapt | 2 +- .../attribute_data_callback_name.zapt | 10 +++--- .../partials/command_completion_type.zapt | 2 +- 26 files changed, 166 insertions(+), 147 deletions(-) diff --git a/examples/darwin-framework-tool/commands/provider/OTAProviderDelegate.h b/examples/darwin-framework-tool/commands/provider/OTAProviderDelegate.h index f213e064019572..40c02ecbad0eec 100644 --- a/examples/darwin-framework-tool/commands/provider/OTAProviderDelegate.h +++ b/examples/darwin-framework-tool/commands/provider/OTAProviderDelegate.h @@ -24,7 +24,7 @@ typedef NS_ENUM(uint8_t, UserConsentState) { OTAProviderUserUnknown = 0x03, }; -@interface DeviceSoftwareVersionModelData : MTROtaSoftwareUpdateProviderClusterQueryImageParams +@interface DeviceSoftwareVersionModelData : MTROTASoftwareUpdateProviderClusterQueryImageParams @property BOOL softwareVersionValid; @property (strong, nonatomic, nullable) NSNumber * cDVersionNumber; @property (strong, nonatomic, nullable) NSNumber * minApplicableSoftwareVersion; @@ -32,7 +32,7 @@ typedef NS_ENUM(uint8_t, UserConsentState) { @property (strong, nonatomic, nullable) NSString * otaURL; @end -@interface DeviceSoftwareVersionModel : MTROtaSoftwareUpdateProviderClusterQueryImageResponseParams +@interface DeviceSoftwareVersionModel : MTROTASoftwareUpdateProviderClusterQueryImageResponseParams @property (strong, nonatomic, nullable) DeviceSoftwareVersionModelData * deviceModelData; - (NSComparisonResult)CompareSoftwareVersions:(DeviceSoftwareVersionModel * _Nullable)otherObject; @end @@ -40,28 +40,28 @@ typedef NS_ENUM(uint8_t, UserConsentState) { @interface OTAProviderDelegate : NSObject - (void)handleQueryImageForNodeID:(NSNumber * _Nonnull)nodeID controller:(MTRDeviceController * _Nonnull)controller - params:(MTROtaSoftwareUpdateProviderClusterQueryImageParams * _Nonnull)params - completion:(void (^_Nonnull)(MTROtaSoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable data, + params:(MTROTASoftwareUpdateProviderClusterQueryImageParams * _Nonnull)params + completion:(void (^_Nonnull)(MTROTASoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable data, NSError * _Nullable error))completion; - (void)handleApplyUpdateRequestForNodeID:(NSNumber * _Nonnull)nodeID controller:(MTRDeviceController * _Nonnull)controller - params:(MTROtaSoftwareUpdateProviderClusterApplyUpdateRequestParams * _Nonnull)params + params:(MTROTASoftwareUpdateProviderClusterApplyUpdateRequestParams * _Nonnull)params completion: - (void (^_Nonnull)(MTROtaSoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable data, + (void (^_Nonnull)(MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable data, NSError * _Nullable error))completion; - (void)handleNotifyUpdateAppliedForNodeID:(NSNumber * _Nonnull)nodeID controller:(MTRDeviceController * _Nonnull)controller - params:(MTROtaSoftwareUpdateProviderClusterNotifyUpdateAppliedParams * _Nonnull)params + params:(MTROTASoftwareUpdateProviderClusterNotifyUpdateAppliedParams * _Nonnull)params completion:(MTRStatusCompletion _Nonnull)completion; @property (strong, nonatomic, nullable) NSArray * candidates; @property (strong, nonatomic, nullable) DeviceSoftwareVersionModel * selectedCandidate; @property (strong, nonatomic, nullable) NSNumber * nodeID; -@property (nonatomic, readwrite) MTROtaSoftwareUpdateProviderOTAQueryStatus queryImageStatus; +@property (nonatomic, readwrite) MTROTASoftwareUpdateProviderOTAQueryStatus queryImageStatus; @property (nonatomic, readwrite) UserConsentState userConsentState; -@property (nonatomic, readwrite) MTROtaSoftwareUpdateProviderOTAApplyUpdateAction action; +@property (nonatomic, readwrite) MTROTASoftwareUpdateProviderOTAApplyUpdateAction action; @property (nonatomic, readwrite, nullable) NSNumber * delayedActionTime; @property (nonatomic, readwrite, nullable) NSNumber * timedInvokeTimeoutMs; @property (nonatomic, readwrite, nullable) NSNumber * userConsentNeeded; diff --git a/examples/darwin-framework-tool/commands/provider/OTAProviderDelegate.mm b/examples/darwin-framework-tool/commands/provider/OTAProviderDelegate.mm index 50bb9086dc6801..68eef16bfc31fe 100644 --- a/examples/darwin-framework-tool/commands/provider/OTAProviderDelegate.mm +++ b/examples/darwin-framework-tool/commands/provider/OTAProviderDelegate.mm @@ -35,26 +35,26 @@ - (instancetype)init { if (self = [super init]) { _selectedCandidate = [[DeviceSoftwareVersionModel alloc] init]; - _action = MTROtaSoftwareUpdateProviderOTAApplyUpdateActionProceed; + _action = MTROTASoftwareUpdateProviderOTAApplyUpdateActionProceed; _userConsentState = OTAProviderUserUnknown; _delayedActionTime = nil; _timedInvokeTimeoutMs = nil; _userConsentNeeded = nil; - _queryImageStatus = MTROtaSoftwareUpdateProviderOTAQueryStatusNotAvailable; + _queryImageStatus = MTROTASoftwareUpdateProviderOTAQueryStatusNotAvailable; } return self; } - (void)handleQueryImageForNodeID:(NSNumber * _Nonnull)nodeID controller:(MTRDeviceController * _Nonnull)controller - params:(MTROtaSoftwareUpdateProviderClusterQueryImageParams * _Nonnull)params - completion:(void (^_Nonnull)(MTROtaSoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable data, + params:(MTROTASoftwareUpdateProviderClusterQueryImageParams * _Nonnull)params + completion:(void (^_Nonnull)(MTROTASoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable data, NSError * _Nullable error))completion { auto isBDXProtocolSupported = - [params.protocolsSupported containsObject:@(MTROtaSoftwareUpdateProviderOTADownloadProtocolBDXSynchronous)]; + [params.protocolsSupported containsObject:@(MTROTASoftwareUpdateProviderOTADownloadProtocolBDXSynchronous)]; if (!isBDXProtocolSupported) { - _selectedCandidate.status = @(MTROtaSoftwareUpdateProviderOTAQueryStatusDownloadProtocolNotSupported); + _selectedCandidate.status = @(MTROTASoftwareUpdateProviderOTAQueryStatusDownloadProtocolNotSupported); completion(_selectedCandidate, nil); return; } @@ -62,7 +62,7 @@ - (void)handleQueryImageForNodeID:(NSNumber * _Nonnull)nodeID auto hasCandidate = [self SelectOTACandidate:params.vendorId rPID:params.productId rSV:params.softwareVersion]; if (!hasCandidate) { NSLog(@"Unable to select OTA Image."); - _selectedCandidate.status = @(MTROtaSoftwareUpdateProviderOTAQueryStatusNotAvailable); + _selectedCandidate.status = @(MTROTASoftwareUpdateProviderOTAQueryStatusNotAvailable); completion(_selectedCandidate, nil); return; } @@ -80,13 +80,13 @@ - (void)handleQueryImageForNodeID:(NSNumber * _Nonnull)nodeID - (void)handleApplyUpdateRequestForNodeID:(NSNumber * _Nonnull)nodeID controller:(MTRDeviceController * _Nonnull)controller - params:(MTROtaSoftwareUpdateProviderClusterApplyUpdateRequestParams * _Nonnull)params + params:(MTROTASoftwareUpdateProviderClusterApplyUpdateRequestParams * _Nonnull)params completion: - (void (^_Nonnull)(MTROtaSoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable data, + (void (^_Nonnull)(MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable data, NSError * _Nullable error))completion { - MTROtaSoftwareUpdateProviderClusterApplyUpdateResponseParams * applyUpdateResponseParams = - [[MTROtaSoftwareUpdateProviderClusterApplyUpdateResponseParams alloc] init]; + MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams * applyUpdateResponseParams = + [[MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams alloc] init]; applyUpdateResponseParams.action = @(_action); if (_delayedActionTime) { applyUpdateResponseParams.delayedActionTime = _delayedActionTime; @@ -100,7 +100,7 @@ - (void)handleApplyUpdateRequestForNodeID:(NSNumber * _Nonnull)nodeID - (void)handleNotifyUpdateAppliedForNodeID:(NSNumber * _Nonnull)nodeID controller:(MTRDeviceController * _Nonnull)controller - params:(MTROtaSoftwareUpdateProviderClusterNotifyUpdateAppliedParams * _Nonnull)params + params:(MTROTASoftwareUpdateProviderClusterNotifyUpdateAppliedParams * _Nonnull)params completion:(MTRStatusCompletion _Nonnull)completion { completion(nil); diff --git a/examples/darwin-framework-tool/commands/provider/OTASoftwareUpdateInteractive.mm b/examples/darwin-framework-tool/commands/provider/OTASoftwareUpdateInteractive.mm index d73357e9323eef..6ec41eff9d9a5b 100644 --- a/examples/darwin-framework-tool/commands/provider/OTASoftwareUpdateInteractive.mm +++ b/examples/darwin-framework-tool/commands/provider/OTASoftwareUpdateInteractive.mm @@ -161,14 +161,14 @@ static bool ParseJsonFileAndPopulateCandidates( { CHIP_ERROR error = CHIP_NO_ERROR; if (action == 0) { - mOTADelegate.action = MTROtaSoftwareUpdateProviderOTAApplyUpdateActionProceed; - ChipLogDetail(chipTool, "Successfully set action to: MTROtaSoftwareUpdateProviderOTAApplyUpdateActionProceed"); + mOTADelegate.action = MTROTASoftwareUpdateProviderOTAApplyUpdateActionProceed; + ChipLogDetail(chipTool, "Successfully set action to: MTROTASoftwareUpdateProviderOTAApplyUpdateActionProceed"); } else if (action == 1) { - mOTADelegate.action = MTROtaSoftwareUpdateProviderOTAApplyUpdateActionAwaitNextAction; - ChipLogDetail(chipTool, "Successfully set action to: MTROtaSoftwareUpdateProviderOTAApplyUpdateActionAwaitNextAction"); + mOTADelegate.action = MTROTASoftwareUpdateProviderOTAApplyUpdateActionAwaitNextAction; + ChipLogDetail(chipTool, "Successfully set action to: MTROTASoftwareUpdateProviderOTAApplyUpdateActionAwaitNextAction"); } else if (action == 2) { - mOTADelegate.action = MTROtaSoftwareUpdateProviderOTAApplyUpdateActionDiscontinue; - ChipLogDetail(chipTool, "Successfully set action to: MTROtaSoftwareUpdateProviderOTAApplyUpdateActionDiscontinue"); + mOTADelegate.action = MTROTASoftwareUpdateProviderOTAApplyUpdateActionDiscontinue; + ChipLogDetail(chipTool, "Successfully set action to: MTROTASoftwareUpdateProviderOTAApplyUpdateActionDiscontinue"); } else { ChipLogError(chipTool, "Only accepts the following: 0 (Proceed), 1 (Await Next Action), 2 (Discontinue)"); error = CHIP_ERROR_INTERNAL; @@ -179,18 +179,18 @@ static bool ParseJsonFileAndPopulateCandidates( { CHIP_ERROR error = CHIP_NO_ERROR; if (status == 0) { - mOTADelegate.queryImageStatus = MTROtaSoftwareUpdateProviderOTAQueryStatusUpdateAvailable; - ChipLogDetail(chipTool, "Successfully set status to: MTROtaSoftwareUpdateProviderOTAQueryStatusUpdateAvailable"); + mOTADelegate.queryImageStatus = MTROTASoftwareUpdateProviderOTAQueryStatusUpdateAvailable; + ChipLogDetail(chipTool, "Successfully set status to: MTROTASoftwareUpdateProviderOTAQueryStatusUpdateAvailable"); } else if (status == 1) { - mOTADelegate.queryImageStatus = MTROtaSoftwareUpdateProviderOTAQueryStatusBusy; - ChipLogDetail(chipTool, "Successfully set status to: MTROtaSoftwareUpdateProviderOTAQueryStatusBusy"); + mOTADelegate.queryImageStatus = MTROTASoftwareUpdateProviderOTAQueryStatusBusy; + ChipLogDetail(chipTool, "Successfully set status to: MTROTASoftwareUpdateProviderOTAQueryStatusBusy"); } else if (status == 2) { - mOTADelegate.queryImageStatus = MTROtaSoftwareUpdateProviderOTAQueryStatusNotAvailable; - ChipLogDetail(chipTool, "Successfully set status to: MTROtaSoftwareUpdateProviderOTAQueryStatusNotAvailable"); + mOTADelegate.queryImageStatus = MTROTASoftwareUpdateProviderOTAQueryStatusNotAvailable; + ChipLogDetail(chipTool, "Successfully set status to: MTROTASoftwareUpdateProviderOTAQueryStatusNotAvailable"); } else if (status == 4) { - mOTADelegate.queryImageStatus = MTROtaSoftwareUpdateProviderOTAQueryStatusDownloadProtocolNotSupported; + mOTADelegate.queryImageStatus = MTROTASoftwareUpdateProviderOTAQueryStatusDownloadProtocolNotSupported; ChipLogDetail( - chipTool, "Successfully set status to: MTROtaSoftwareUpdateProviderOTAQueryStatusDownloadProtocolNotSupported"); + chipTool, "Successfully set status to: MTROTASoftwareUpdateProviderOTAQueryStatusDownloadProtocolNotSupported"); } else { ChipLogError(chipTool, "Only accepts the following: 0 (Available), 1 (Busy), 2 (Not Available), 3 (Not Supported)"); error = CHIP_ERROR_INTERNAL; diff --git a/examples/darwin-framework-tool/templates/commands.zapt b/examples/darwin-framework-tool/templates/commands.zapt index 87a559bba4accb..881660109af940 100644 --- a/examples/darwin-framework-tool/templates/commands.zapt +++ b/examples/darwin-framework-tool/templates/commands.zapt @@ -46,8 +46,8 @@ public: ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) command ({{asHex code 8}}) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - MTRBaseCluster{{asUpperCamelCase clusterName}} * cluster = [[MTRBaseCluster{{asUpperCamelCase clusterName}} alloc] initWithDevice:device endpoint:@(endpointId) queue:callbackQueue]; - __auto_type * params = [[MTR{{asUpperCamelCase clusterName}}Cluster{{asUpperCamelCase name}}Params alloc] init]; + __auto_type * cluster = [[MTRBaseCluster{{asUpperCamelCase clusterName preserveAcronyms=true}} alloc] initWithDevice:device endpoint:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTR{{asUpperCamelCase clusterName preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Params alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; {{#chip_cluster_command_arguments}} {{>decodable_value target=(concat "params." (asStructPropertyName label)) source=(concat "mRequest." (asLowerCamelCase label)) cluster=parent.clusterName type=type depth=0}} @@ -58,7 +58,7 @@ public: { [cluster {{asLowerCamelCase name}}WithParams:params completion: {{#if hasSpecificResponse}} - ^(MTR{{asUpperCamelCase clusterName}}Cluster{{asUpperCamelCase responseName}}Params * _Nullable values, NSError * _Nullable error) { + ^(MTR{{asUpperCamelCase clusterName preserveAcronyms=true}}Cluster{{asUpperCamelCase responseName}}Params * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); {{else}} ^(NSError * _Nullable error) { @@ -90,7 +90,8 @@ private: {{/chip_cluster_commands}} {{#chip_server_cluster_attributes}} -{{#*inline "attribute"}}Attribute{{asUpperCamelCase name}}{{/inline}} +{{#*inline "cluster"}}Cluster{{asUpperCamelCase parent.name preserveAcronyms=true}}{{/inline}} +{{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}} /* * Attribute {{asUpperCamelCase name}} @@ -111,23 +112,23 @@ public: ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) ReadAttribute ({{asHex code 8}}) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - MTRBaseCluster{{asUpperCamelCase parent.name}} * cluster = [[MTRBaseCluster{{asUpperCamelCase parent.name}} alloc] initWithDevice:device endpoint:@(endpointId) queue:callbackQueue]; + __auto_type * cluster = [[MTRBase{{>cluster}} alloc] initWithDevice:device endpoint:@(endpointId) queue:callbackQueue]; {{#if_is_fabric_scoped_struct type}} - MTRReadParams * params = [[MTRReadParams alloc] init]; + __auto_type * params = [[MTRReadParams alloc] init]; if (mFabricFiltered.HasValue()) { params.fabricFiltered = mFabricFiltered.Value(); } {{/if_is_fabric_scoped_struct}} - [cluster readAttribute{{asUpperCamelCase name}}With + [cluster read{{>attribute}}With {{~#if_is_fabric_scoped_struct type~}} Params:params completion: {{~else~}} Completion: {{~/if_is_fabric_scoped_struct~}} ^({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error) { - NSLog(@"{{asUpperCamelCase parent.name}}.{{asUpperCamelCase name}} response %@", [value description]); + NSLog(@"{{asUpperCamelCase parent.name preserveAcronyms=true}}.{{asUpperCamelCase name preserveAcronyms=true}} response %@", [value description]); if (error != nil) { - LogNSError("{{asUpperCamelCase parent.name}} {{asUpperCamelCase name}} read Error", error); + LogNSError("{{asUpperCamelCase parent.name preserveAcronyms=true}} {{asUpperCamelCase name preserveAcronyms=true}} read Error", error); } SetCommandExitStatus(error); }]; @@ -163,8 +164,8 @@ public: { ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) WriteAttribute ({{asHex code 8}}) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - MTRBaseCluster{{asUpperCamelCase parent.name}} * cluster = [[MTRBaseCluster{{asUpperCamelCase parent.name}} alloc] initWithDevice:device endpoint:@(endpointId) queue:callbackQueue]; - MTRWriteParams * params = [[MTRWriteParams alloc] init]; + __auto_type * cluster = [[MTRBase{{>cluster}} alloc] initWithDevice:device endpoint:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; {{#if_chip_complex}} @@ -178,9 +179,9 @@ public: {{asObjectiveCType type parent.name}} value = [NSNumber numberWith{{asObjectiveCNumberType "" type false}}:mValue]; {{/if_chip_complex}} - [cluster writeAttribute{{asUpperCamelCase name}}WithValue:value params:params completion:^(NSError * _Nullable error) { + [cluster write{{>attribute}}WithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { - LogNSError("{{asUpperCamelCase parent.name}} {{asUpperCamelCase name}} write Error", error); + LogNSError("{{asUpperCamelCase parent.name preserveAcronyms=true}} {{asUpperCamelCase name preserveAcronyms=true}} write Error", error); } SetCommandExitStatus(error); }]; @@ -217,8 +218,8 @@ public: { ChipLogProgress(chipTool, "Sending cluster ({{asHex parent.code 8}}) ReportAttribute ({{asHex code 8}}) on endpoint %u", endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); - MTRBaseCluster{{asUpperCamelCase parent.name}} * cluster = [[MTRBaseCluster{{asUpperCamelCase parent.name}} alloc] initWithDevice:device endpoint:@(endpointId) queue:callbackQueue]; - MTRSubscribeParams * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + __auto_type * cluster = [[MTRBase{{>cluster}} alloc] initWithDevice:device endpoint:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.keepPreviousSubscriptions = mKeepSubscriptions.Value(); } @@ -228,7 +229,7 @@ public: [cluster subscribe{{>attribute}}WithParams:params subscriptionEstablished:^(){ mSubscriptionEstablished=YES; } reportHandler:^({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error) { - NSLog(@"{{asUpperCamelCase parent.name}}.{{asUpperCamelCase name}} response %@", [value description]); + NSLog(@"{{asUpperCamelCase parent.name preserveAcronyms=true}}.{{asUpperCamelCase name preserveAcronyms=true}} response %@", [value description]); SetCommandExitStatus(error); }]; diff --git a/examples/darwin-framework-tool/templates/tests/partials/test_cluster.zapt b/examples/darwin-framework-tool/templates/tests/partials/test_cluster.zapt index 6670481e41d604..81521fe79f07fa 100644 --- a/examples/darwin-framework-tool/templates/tests/partials/test_cluster.zapt +++ b/examples/darwin-framework-tool/templates/tests/partials/test_cluster.zapt @@ -126,6 +126,8 @@ class {{filename}}: public TestCommandBridge {{#*inline "testCommand"}}Test{{asUpperCamelCase label}}_{{index}}{{/inline}} CHIP_ERROR {{>testCommand}}() { + {{#*inline "cluster"}}{{asUpperCamelCase cluster preserveAcronyms=true}}{{/inline}} + {{#*inline "attribute"}}{{asUpperCamelCase attribute preserveAcronyms=true}}{{/inline}} {{#if (isTestOnlyCluster cluster)}} {{asEncodableType}} value; {{#chip_tests_item_parameters}} @@ -134,19 +136,19 @@ class {{filename}}: public TestCommandBridge return {{command}}("{{identity}}", value); {{else}} MTRBaseDevice * device = GetDevice("{{identity}}"); - MTRBaseCluster{{asUpperCamelCase cluster}} * cluster = [[MTRBaseCluster{{asUpperCamelCase cluster}} alloc] initWithDevice:device endpoint:@({{endpoint}}) queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseCluster{{>cluster}} alloc] initWithDevice:device endpoint:@({{endpoint}}) queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); {{#if isCommand}} {{#if commandObject.arguments.length}} - __auto_type * params = [[MTR{{asUpperCamelCase cluster}}Cluster{{asUpperCamelCase command}}Params alloc] init]; + __auto_type * params = [[MTR{{>cluster}}Cluster{{asUpperCamelCase command preserveAcronyms=true}}Params alloc] init]; {{/if}} {{#chip_tests_item_parameters}} {{>test_value target=(concat "params." (asStructPropertyName label)) definedValue=definedValue cluster=parent.cluster depth=0}} {{/chip_tests_item_parameters}} [cluster {{asLowerCamelCase command}}With{{#if commandObject.arguments.length}}Params:params completion{{else}}Completion{{/if}}: {{#if commandObject.hasSpecificResponse}} - ^(MTR{{asUpperCamelCase cluster}}Cluster{{asUpperCamelCase commandObject.responseName}}Params * _Nullable values, NSError * _Nullable err) { + ^(MTR{{>cluster}}Cluster{{asUpperCamelCase commandObject.responseName}}Params * _Nullable values, NSError * _Nullable err) { {{else}} ^(NSError * _Nullable err) { {{/if}} @@ -154,9 +156,9 @@ class {{filename}}: public TestCommandBridge {{#chip_tests_item_parameters}} {{asObjectiveCBasicType type}} {{asLowerCamelCase name}}Argument = {{asTypedLiteral definedValue type}}; {{/chip_tests_item_parameters}} - MTRSubscribeParams * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(minIntervalArgument) maxInterval:@(maxIntervalArgument)]; - [cluster subscribeAttribute{{asUpperCamelCase attribute}}WithParams:params - subscriptionEstablished:^{ + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(minIntervalArgument) maxInterval:@(maxIntervalArgument)]; + [cluster subscribeAttribute{{>attribute}}WithParams:params + subscriptionEstablished:^{ VerifyOrReturn(testSendCluster{{parent.filename}}_{{waitForReport.index}}_{{asUpperCamelCase waitForReport.command}}_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); NextTest(); } @@ -165,10 +167,10 @@ class {{filename}}: public TestCommandBridge {{> subscribeDataCallback }} = ^({{asObjectiveCClass attributeObject.type cluster forceList=attributeObject.isArray}} * _Nullable value, NSError * _Nullable err) { {{else if isReadAttribute}} {{#if_is_fabric_scoped_struct attributeObject.type}} - MTRReadParams * params = [[MTRReadParams alloc] init]; + __auto_type * params = [[MTRReadParams alloc] init]; params.fabricFiltered = {{fabricFiltered}}; {{/if_is_fabric_scoped_struct}} - [cluster readAttribute{{asUpperCamelCase attribute}}With + [cluster readAttribute{{>attribute}}With {{~#if_is_fabric_scoped_struct attributeObject.type~}} Params:params completion: {{~else~}} @@ -180,7 +182,7 @@ class {{filename}}: public TestCommandBridge id {{asLowerCamelCase name}}Argument; {{>test_value target=(concat (asLowerCamelCase name) "Argument") definedValue=definedValue cluster=parent.cluster depth=0}} {{/chip_tests_item_parameters}} - [cluster writeAttribute{{asUpperCamelCase attribute}}WithValue:{{#chip_tests_item_parameters}}{{asLowerCamelCase name}}Argument{{/chip_tests_item_parameters}} completion:^(NSError * _Nullable err) { + [cluster writeAttribute{{>attribute}}WithValue:{{#chip_tests_item_parameters}}{{asLowerCamelCase name}}Argument{{/chip_tests_item_parameters}} completion:^(NSError * _Nullable err) { {{/if}} NSLog(@"{{label}} Error: %@", err); diff --git a/src/app/tests/suites/certification/Test_TC_DGWIFI_2_1.yaml b/src/app/tests/suites/certification/Test_TC_DGWIFI_2_1.yaml index 0267aa4127613f..cc97a60136e6d5 100644 --- a/src/app/tests/suites/certification/Test_TC_DGWIFI_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_DGWIFI_2_1.yaml @@ -35,7 +35,7 @@ tests: - label: "TH reads BSSID attribute from DUT" PICS: DGWIFI.S.A0000 command: "readAttribute" - attribute: "BSSID" + attribute: "bssid" response: constraints: type: octet_string @@ -72,7 +72,7 @@ tests: - label: "Reads RSSI attribute constraints" PICS: DGWIFI.S.A0004 command: "readAttribute" - attribute: "RSSI" + attribute: "rssi" response: constraints: type: int8s diff --git a/src/darwin/Framework/CHIP/MTROTAProviderDelegate.h b/src/darwin/Framework/CHIP/MTROTAProviderDelegate.h index 5f14fa0a5ac501..1b70e43e01be1a 100644 --- a/src/darwin/Framework/CHIP/MTROTAProviderDelegate.h +++ b/src/darwin/Framework/CHIP/MTROTAProviderDelegate.h @@ -21,10 +21,10 @@ NS_ASSUME_NONNULL_BEGIN typedef void (^MTRQueryImageCompletionHandler)( - MTROtaSoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable data, NSError * _Nullable error); + MTROTASoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable data, NSError * _Nullable error); typedef void (^MTRApplyUpdateRequestCompletionHandler)( - MTROtaSoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable data, NSError * _Nullable error); + MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable data, NSError * _Nullable error); typedef void (^MTRBDXQueryCompletionHandler)(NSData * _Nullable data, BOOL isEOF); @@ -46,7 +46,7 @@ typedef void (^MTRBDXQueryCompletionHandler)(NSData * _Nullable data, BOOL isEOF */ - (void)handleQueryImageForNodeID:(NSNumber *)nodeID controller:(MTRDeviceController *)controller - params:(MTROtaSoftwareUpdateProviderClusterQueryImageParams *)params + params:(MTROTASoftwareUpdateProviderClusterQueryImageParams *)params completion:(MTRQueryImageCompletionHandler)completion; /** @@ -60,7 +60,7 @@ typedef void (^MTRBDXQueryCompletionHandler)(NSData * _Nullable data, BOOL isEOF */ - (void)handleApplyUpdateRequestForNodeID:(NSNumber *)nodeID controller:(MTRDeviceController *)controller - params:(MTROtaSoftwareUpdateProviderClusterApplyUpdateRequestParams *)params + params:(MTROTASoftwareUpdateProviderClusterApplyUpdateRequestParams *)params completion:(MTRApplyUpdateRequestCompletionHandler)completion; /** @@ -73,7 +73,7 @@ typedef void (^MTRBDXQueryCompletionHandler)(NSData * _Nullable data, BOOL isEOF */ - (void)handleNotifyUpdateAppliedForNodeID:(NSNumber *)nodeID controller:(MTRDeviceController *)controller - params:(MTROtaSoftwareUpdateProviderClusterNotifyUpdateAppliedParams *)params + params:(MTROTASoftwareUpdateProviderClusterNotifyUpdateAppliedParams *)params completion:(MTRStatusCompletion)completion; /** diff --git a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.h b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.h index 97aa258dad2617..3c69407046e6fa 100644 --- a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.h +++ b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.h @@ -45,19 +45,19 @@ class MTROTAProviderDelegateBridge : public chip::app::Clusters::OTAProviderDele private: static CHIP_ERROR ConvertToQueryImageParams( const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::DecodableType & commandData, - MTROtaSoftwareUpdateProviderClusterQueryImageParams * commandParams); + MTROTASoftwareUpdateProviderClusterQueryImageParams * commandParams); static void ConvertFromQueryImageResponseParms( - const MTROtaSoftwareUpdateProviderClusterQueryImageResponseParams * responseParams, + const MTROTASoftwareUpdateProviderClusterQueryImageResponseParams * responseParams, chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImageResponse::Type & response); static void ConvertToApplyUpdateRequestParams( const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::DecodableType & commandData, - MTROtaSoftwareUpdateProviderClusterApplyUpdateRequestParams * commandParams); + MTROTASoftwareUpdateProviderClusterApplyUpdateRequestParams * commandParams); static void ConvertFromApplyUpdateRequestResponseParms( - const MTROtaSoftwareUpdateProviderClusterApplyUpdateResponseParams * responseParams, + const MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams * responseParams, chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateResponse::Type & response); static void ConvertToNotifyUpdateAppliedParams( const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::NotifyUpdateApplied::DecodableType & commandData, - MTROtaSoftwareUpdateProviderClusterNotifyUpdateAppliedParams * commandParams); + MTROTASoftwareUpdateProviderClusterNotifyUpdateAppliedParams * commandParams); _Nullable id mDelegate; dispatch_queue_t mWorkQueue; diff --git a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm index 6c7e668d3ed213..1f4eda27dd5f73 100644 --- a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm @@ -443,7 +443,7 @@ bool GetPeerNodeInfo(CommandHandler * commandHandler, const ConcreteCommandPath return; } - auto * commandParams = [[MTROtaSoftwareUpdateProviderClusterQueryImageParams alloc] init]; + auto * commandParams = [[MTROTASoftwareUpdateProviderClusterQueryImageParams alloc] init]; CHIP_ERROR err = ConvertToQueryImageParams(commandData, commandParams); if (err != CHIP_NO_ERROR) { commandObj->AddStatus(commandPath, Protocols::InteractionModel::Status::InvalidCommand); @@ -455,7 +455,7 @@ bool GetPeerNodeInfo(CommandHandler * commandHandler, const ConcreteCommandPath __block ConcreteCommandPath cachedCommandPath(commandPath.mEndpointId, commandPath.mClusterId, commandPath.mCommandId); auto completionHandler = ^( - MTROtaSoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable data, NSError * _Nullable error) { + MTROTASoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable data, NSError * _Nullable error) { dispatch_async(mWorkQueue, ^{ CommandHandler * handler = EnsureValidState(handle, cachedCommandPath, "QueryImage", data, error); VerifyOrReturn(handler != nullptr); @@ -466,9 +466,9 @@ bool GetPeerNodeInfo(CommandHandler * commandHandler, const ConcreteCommandPath Commands::QueryImageResponse::Type response; ConvertFromQueryImageResponseParms(data, response); - auto hasUpdate = [data.status isEqual:@(MTROtaSoftwareUpdateProviderOTAQueryStatusUpdateAvailable)]; + auto hasUpdate = [data.status isEqual:@(MTROTASoftwareUpdateProviderOTAQueryStatusUpdateAvailable)]; auto isBDXProtocolSupported = - [commandParams.protocolsSupported containsObject:@(MTROtaSoftwareUpdateProviderOTADownloadProtocolBDXSynchronous)]; + [commandParams.protocolsSupported containsObject:@(MTROTASoftwareUpdateProviderOTADownloadProtocolBDXSynchronous)]; if (hasUpdate && isBDXProtocolSupported) { auto fabricIndex = handler->GetSubjectDescriptor().fabricIndex; @@ -527,7 +527,7 @@ bool GetPeerNodeInfo(CommandHandler * commandHandler, const ConcreteCommandPath __block ConcreteCommandPath cachedCommandPath(commandPath.mEndpointId, commandPath.mClusterId, commandPath.mCommandId); auto completionHandler - = ^(MTROtaSoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable data, NSError * _Nullable error) { + = ^(MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable data, NSError * _Nullable error) { dispatch_async(mWorkQueue, ^{ CommandHandler * handler = EnsureValidState(handle, cachedCommandPath, "ApplyUpdateRequest", data, error); VerifyOrReturn(handler != nullptr); @@ -542,7 +542,7 @@ bool GetPeerNodeInfo(CommandHandler * commandHandler, const ConcreteCommandPath }); }; - auto * commandParams = [[MTROtaSoftwareUpdateProviderClusterApplyUpdateRequestParams alloc] init]; + auto * commandParams = [[MTROTASoftwareUpdateProviderClusterApplyUpdateRequestParams alloc] init]; ConvertToApplyUpdateRequestParams(commandData, commandParams); auto strongDelegate = mDelegate; @@ -577,7 +577,7 @@ bool GetPeerNodeInfo(CommandHandler * commandHandler, const ConcreteCommandPath }); }; - auto * commandParams = [[MTROtaSoftwareUpdateProviderClusterNotifyUpdateAppliedParams alloc] init]; + auto * commandParams = [[MTROTASoftwareUpdateProviderClusterNotifyUpdateAppliedParams alloc] init]; ConvertToNotifyUpdateAppliedParams(commandData, commandParams); auto strongDelegate = mDelegate; @@ -590,7 +590,7 @@ bool GetPeerNodeInfo(CommandHandler * commandHandler, const ConcreteCommandPath } CHIP_ERROR MTROTAProviderDelegateBridge::ConvertToQueryImageParams( - const Commands::QueryImage::DecodableType & commandData, MTROtaSoftwareUpdateProviderClusterQueryImageParams * commandParams) + const Commands::QueryImage::DecodableType & commandData, MTROTASoftwareUpdateProviderClusterQueryImageParams * commandParams) { commandParams.vendorId = [NSNumber numberWithUnsignedShort:commandData.vendorId]; commandParams.productId = [NSNumber numberWithUnsignedShort:commandData.productId]; @@ -623,7 +623,7 @@ bool GetPeerNodeInfo(CommandHandler * commandHandler, const ConcreteCommandPath } void MTROTAProviderDelegateBridge::ConvertFromQueryImageResponseParms( - const MTROtaSoftwareUpdateProviderClusterQueryImageResponseParams * responseParams, + const MTROTASoftwareUpdateProviderClusterQueryImageResponseParams * responseParams, Commands::QueryImageResponse::Type & response) { response.status = static_cast([responseParams.status intValue]); @@ -659,14 +659,14 @@ bool GetPeerNodeInfo(CommandHandler * commandHandler, const ConcreteCommandPath void MTROTAProviderDelegateBridge::ConvertToApplyUpdateRequestParams( const Commands::ApplyUpdateRequest::DecodableType & commandData, - MTROtaSoftwareUpdateProviderClusterApplyUpdateRequestParams * commandParams) + MTROTASoftwareUpdateProviderClusterApplyUpdateRequestParams * commandParams) { commandParams.updateToken = AsData(commandData.updateToken); commandParams.newVersion = [NSNumber numberWithUnsignedLong:commandData.newVersion]; } void MTROTAProviderDelegateBridge::ConvertFromApplyUpdateRequestResponseParms( - const MTROtaSoftwareUpdateProviderClusterApplyUpdateResponseParams * responseParams, + const MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams * responseParams, Commands::ApplyUpdateResponse::Type & response) { response.action = static_cast([responseParams.action intValue]); @@ -675,7 +675,7 @@ bool GetPeerNodeInfo(CommandHandler * commandHandler, const ConcreteCommandPath void MTROTAProviderDelegateBridge::ConvertToNotifyUpdateAppliedParams( const Commands::NotifyUpdateApplied::DecodableType & commandData, - MTROtaSoftwareUpdateProviderClusterNotifyUpdateAppliedParams * commandParams) + MTROTASoftwareUpdateProviderClusterNotifyUpdateAppliedParams * commandParams) { commandParams.updateToken = AsData(commandData.updateToken); commandParams.softwareVersion = [NSNumber numberWithUnsignedLong:commandData.softwareVersion]; diff --git a/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt b/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt index 59a2001c376d1d..1041aab7f36314 100644 --- a/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRBaseClusters-src.zapt @@ -23,7 +23,7 @@ using chip::SessionHandle; // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks): Linter is unable to locate the delete on these objects. {{#chip_client_clusters includeAll=true}} -@implementation MTRBaseCluster{{asUpperCamelCase name}} +@implementation MTRBaseCluster{{asUpperCamelCase name preserveAcronyms=true}} - (instancetype)initWithDevice:(MTRBaseDevice *)device endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue { @@ -41,14 +41,16 @@ using chip::SessionHandle; } {{#chip_cluster_commands}} -{{#*inline "callbackName"}}{{#if hasSpecificResponse}}{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase responseName}}{{else}}CommandSuccess{{/if}}{{/inline}} +{{#*inline "cluster"}}{{asUpperCamelCase parent.name preserveAcronyms=true}}{{/inline}} +{{#*inline "command"}}{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}} +{{#*inline "callbackName"}}{{#if hasSpecificResponse}}{{>cluster}}Cluster{{asUpperCamelCase responseName preserveAcronyms=true}}{{else}}CommandSuccess{{/if}}{{/inline}} {{#unless (hasArguments)}} - (void){{asLowerCamelCase name}}WithCompletion:({{>command_completion_type command=.}})completion { [self {{asLowerCamelCase name}}WithParams:nil completion:completion]; } {{/unless}} -- (void){{asLowerCamelCase name}}WithParams: (MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Params * {{#unless (commandHasRequiredField .)}}_Nullable{{/unless}})params completion:({{>command_completion_type command=.}})completion +- (void){{asLowerCamelCase name}}WithParams: (MTR{{>cluster}}Cluster{{>command}}Params * {{#unless (commandHasRequiredField .)}}_Nullable{{/unless}})params completion:({{>command_completion_type command=.}})completion { // Make a copy of params before we go async. params = [params copy]; @@ -103,7 +105,7 @@ using chip::SessionHandle; {{/chip_cluster_commands}} {{#chip_server_cluster_attributes}} -{{#*inline "attribute"}}Attribute{{asUpperCamelCase name}}{{/inline}} +{{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}} - (void)read{{>attribute}}With {{~#if_is_fabric_scoped_struct type~}} Params:(MTRReadParams * _Nullable)params completion: @@ -116,7 +118,7 @@ using chip::SessionHandle; // Make a copy of params before we go async. params = [params copy]; {{/if_is_fabric_scoped_struct~}} - new MTR{{>attribute_data_callback_name}}CallbackBridge(self.callbackQueue, + new MTR{{~>attribute_data_callback_name~}}CallbackBridge(self.callbackQueue, self.device, {{! This treats completion as taking an id for the data. This is not great from a type-safety perspective, of course. }} diff --git a/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt b/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt index 37b45a14c891e3..5db875e21cf4b3 100644 --- a/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt @@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN * * {{description}} */ -@interface MTRBaseCluster{{asUpperCamelCase name}} : MTRCluster +@interface MTRBaseCluster{{asUpperCamelCase name preserveAcronyms=true}} : MTRCluster - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpoint:(NSNumber *)endpoint @@ -30,14 +30,16 @@ NS_ASSUME_NONNULL_BEGIN * * {{description}} */ -- (void){{asLowerCamelCase name}}WithParams:(MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Params * {{#unless (commandHasRequiredField .)}}_Nullable{{/unless}})params completion:({{>command_completion_type command=.}})completion; +{{~#*inline "cluster"}}{{asUpperCamelCase parent.name preserveAcronyms=true}}{{/inline~}} +{{~#*inline "command"}}{{asUpperCamelCase name preserveAcronyms=true}}{{/inline~}} +- (void){{asLowerCamelCase name}}WithParams:(MTR{{>cluster}}Cluster{{>command}}Params * {{#unless (commandHasRequiredField .)}}_Nullable{{/unless}})params completion:({{>command_completion_type command=.}})completion; {{#unless (hasArguments)}} - (void){{asLowerCamelCase name}}WithCompletion:({{>command_completion_type command=.}})completion; {{/unless}} {{/chip_cluster_commands}} {{#chip_server_cluster_attributes}} -{{#*inline "attribute"}}Attribute{{asUpperCamelCase name}}{{/inline}} +{{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}} - (void)read{{>attribute}}With {{~#if_is_fabric_scoped_struct type~}} Params:(MTRReadParams * _Nullable)params completion: diff --git a/src/darwin/Framework/CHIP/templates/MTRBaseClusters_internal.zapt b/src/darwin/Framework/CHIP/templates/MTRBaseClusters_internal.zapt index b341bcfe62bff7..15fc82e76a062f 100644 --- a/src/darwin/Framework/CHIP/templates/MTRBaseClusters_internal.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRBaseClusters_internal.zapt @@ -9,7 +9,7 @@ {{#chip_client_clusters includeAll=true}} -@interface MTRBaseCluster{{asUpperCamelCase name}} () +@interface MTRBaseCluster{{asUpperCamelCase name preserveAcronyms=true}} () @property (nonatomic, strong, readonly) MTRBaseDevice * device; @property (nonatomic, assign, readonly) chip::EndpointId endpoint; @end diff --git a/src/darwin/Framework/CHIP/templates/MTRCallbackBridge-src.zapt b/src/darwin/Framework/CHIP/templates/MTRCallbackBridge-src.zapt index 178a1ec356ba20..7025741ede6586 100644 --- a/src/darwin/Framework/CHIP/templates/MTRCallbackBridge-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRCallbackBridge-src.zapt @@ -40,13 +40,13 @@ {{#chip_client_clusters includeAll=true}} {{#chip_server_cluster_attributes}} {{#if isArray}} -{{#>MTRCallbackBridge ns=parent.name }}{{asUpperCamelCase ../../name}}{{asUpperCamelCase ../name}}ListAttributeCallback{{/MTRCallbackBridge}} +{{#>MTRCallbackBridge ns=parent.name }}{{asUpperCamelCase ../../name preserveAcronyms=true}}{{asUpperCamelCase ../name preserveAcronyms=true}}ListAttributeCallback{{/MTRCallbackBridge}} {{else}} {{#if_is_struct type}} - {{#>MTRCallbackBridge ns=parent.name }}{{asUpperCamelCase ../../name}}{{asUpperCamelCase ../name}}StructAttributeCallback{{/MTRCallbackBridge}} + {{#>MTRCallbackBridge ns=parent.name }}{{asUpperCamelCase ../../name preserveAcronyms=true}}{{asUpperCamelCase ../name preserveAcronyms=true}}StructAttributeCallback{{/MTRCallbackBridge}} {{/if_is_struct}} {{#if_is_strongly_typed_bitmap type}} - {{#>MTRCallbackBridge ns=parent.name }}{{asUpperCamelCase ../../name}}{{asUpperCamelCase ../name}}AttributeCallback{{/MTRCallbackBridge}} + {{#>MTRCallbackBridge ns=parent.name }}{{asUpperCamelCase ../../name preserveAcronyms=true}}{{asUpperCamelCase ../name preserveAcronyms=true}}AttributeCallback{{/MTRCallbackBridge}} {{/if_is_strongly_typed_bitmap}} {{/if}} {{/chip_server_cluster_attributes}} @@ -54,13 +54,13 @@ {{#chip_client_clusters includeAll=true}} {{#chip_cluster_responses}} -{{#>MTRCallbackBridge partial-type="Command" }}{{asUpperCamelCase ../../name}}Cluster{{asUpperCamelCase ../name}}Callback{{/MTRCallbackBridge}} +{{#>MTRCallbackBridge partial-type="Command" }}{{asUpperCamelCase ../../name preserveAcronyms=true}}Cluster{{asUpperCamelCase ../name preserveAcronyms=true}}Callback{{/MTRCallbackBridge}} {{/chip_cluster_responses}} {{/chip_client_clusters}} {{#zcl_clusters}} {{#zcl_enums}} -{{#>MTRCallbackBridge type=(asType label) isNullable=false ns=parent.name}}{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}AttributeCallback{{/MTRCallbackBridge}} -{{#>MTRCallbackBridge type=(asType label) isNullable=true ns=parent.name}}Nullable{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}AttributeCallback{{/MTRCallbackBridge}} +{{#>MTRCallbackBridge type=(asType label) isNullable=false ns=parent.name}}{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}AttributeCallback{{/MTRCallbackBridge}} +{{#>MTRCallbackBridge type=(asType label) isNullable=true ns=parent.name}}Nullable{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}AttributeCallback{{/MTRCallbackBridge}} {{/zcl_enums}} {{/zcl_clusters}} diff --git a/src/darwin/Framework/CHIP/templates/MTRCallbackBridge_internal.zapt b/src/darwin/Framework/CHIP/templates/MTRCallbackBridge_internal.zapt index 84c1f5686d0722..ccddfc9fa88989 100644 --- a/src/darwin/Framework/CHIP/templates/MTRCallbackBridge_internal.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRCallbackBridge_internal.zapt @@ -16,27 +16,27 @@ typedef void (*NullableVendorIdAttributeCallback)(void *, const chip::app::DataM {{#chip_client_clusters includeAll=true}} {{#chip_cluster_responses}} -typedef void (*{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}CallbackType)(void *, const chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::DecodableType &); +typedef void (*{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}CallbackType)(void *, const chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::DecodableType &); {{/chip_cluster_responses}} {{/chip_client_clusters}} {{#zcl_clusters}} {{#zcl_enums}} -typedef void (*{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}AttributeCallback)(void *, chip::app::Clusters::{{asUpperCamelCase parent.name}}::{{asType label}}); -typedef void (*Nullable{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}AttributeCallback)(void *, const chip::app::DataModel::Nullable &); +typedef void (*{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}AttributeCallback)(void *, chip::app::Clusters::{{asUpperCamelCase parent.name}}::{{asType label}}); +typedef void (*Nullable{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}AttributeCallback)(void *, const chip::app::DataModel::Nullable &); {{/zcl_enums}} {{/zcl_clusters}} {{#chip_client_clusters includeAll=true}} {{#chip_server_cluster_attributes}} {{#if isArray}} -typedef void (*{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}ListAttributeCallback)(void * context, {{zapTypeToDecodableClusterObjectType type ns=parent.name isArgument=true}} data); +typedef void (*{{asUpperCamelCase parent.name preserveAcronyms=true}}{{asUpperCamelCase name preserveAcronyms=true}}ListAttributeCallback)(void * context, {{zapTypeToDecodableClusterObjectType type ns=parent.name isArgument=true}} data); {{else}} {{#if_is_struct type}} -typedef void (*{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}StructAttributeCallback)(void *, {{zapTypeToDecodableClusterObjectType type ns=parent.name isArgument=true forceNotOptional=true}}); +typedef void (*{{asUpperCamelCase parent.name preserveAcronyms=true}}{{asUpperCamelCase name preserveAcronyms=true}}StructAttributeCallback)(void *, {{zapTypeToDecodableClusterObjectType type ns=parent.name isArgument=true forceNotOptional=true}}); {{/if_is_struct}} {{#if_is_strongly_typed_bitmap type}} -typedef void (*{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCallback)(void *, {{zapTypeToDecodableClusterObjectType type ns=parent.name isArgument=true forceNotOptional=true}}); +typedef void (*{{asUpperCamelCase parent.name preserveAcronyms=true}}{{asUpperCamelCase name preserveAcronyms=true}}AttributeCallback)(void *, {{zapTypeToDecodableClusterObjectType type ns=parent.name isArgument=true forceNotOptional=true}}); {{/if_is_strongly_typed_bitmap}} {{/if}} {{/chip_server_cluster_attributes}} @@ -76,13 +76,13 @@ typedef void (*{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}Attribut {{#chip_client_clusters includeAll=true}} {{#chip_server_cluster_attributes}} {{#if isArray}} -{{#>MTRCallbackBridge header="1" ns=parent.name }}{{asUpperCamelCase ../../name}}{{asUpperCamelCase ../name}}ListAttributeCallback{{/MTRCallbackBridge}} +{{#>MTRCallbackBridge header="1" ns=parent.name }}{{asUpperCamelCase ../../name preserveAcronyms=true}}{{asUpperCamelCase ../name preserveAcronyms=true}}ListAttributeCallback{{/MTRCallbackBridge}} {{else}} {{#if_is_struct type}} - {{#>MTRCallbackBridge header="1" ns=parent.name }}{{asUpperCamelCase ../../name}}{{asUpperCamelCase ../name}}StructAttributeCallback{{/MTRCallbackBridge}} + {{#>MTRCallbackBridge header="1" ns=parent.name }}{{asUpperCamelCase ../../name preserveAcronyms=true}}{{asUpperCamelCase ../name preserveAcronyms=true}}StructAttributeCallback{{/MTRCallbackBridge}} {{/if_is_struct}} {{#if_is_strongly_typed_bitmap type}} - {{#>MTRCallbackBridge header="1" ns=parent.name }}{{asUpperCamelCase ../../name}}{{asUpperCamelCase ../name}}AttributeCallback{{/MTRCallbackBridge}} + {{#>MTRCallbackBridge header="1" ns=parent.name }}{{asUpperCamelCase ../../name preserveAcronyms=true}}{{asUpperCamelCase ../name preserveAcronyms=true}}AttributeCallback{{/MTRCallbackBridge}} {{/if_is_strongly_typed_bitmap}} {{/if}} {{/chip_server_cluster_attributes}} @@ -90,13 +90,13 @@ typedef void (*{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}Attribut {{#chip_client_clusters includeAll=true}} {{#chip_cluster_responses}} -{{#>MTRCallbackBridge header="1" partial-type="Command" }}{{asUpperCamelCase ../../name}}Cluster{{asUpperCamelCase ../name}}Callback{{/MTRCallbackBridge}} +{{#>MTRCallbackBridge header="1" partial-type="Command" }}{{asUpperCamelCase ../../name preserveAcronyms=true}}Cluster{{asUpperCamelCase ../name preserveAcronyms=true}}Callback{{/MTRCallbackBridge}} {{/chip_cluster_responses}} {{/chip_client_clusters}} {{#zcl_clusters}} {{#zcl_enums}} -{{#>MTRCallbackBridge header="1" type=(asType label) isNullable=false ns=parent.name}}{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}AttributeCallback{{/MTRCallbackBridge}} -{{#>MTRCallbackBridge header="1" type=(asType label) isNullable=true ns=parent.name}}Nullable{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}AttributeCallback{{/MTRCallbackBridge}} +{{#>MTRCallbackBridge header="1" type=(asType label) isNullable=false ns=parent.name}}{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}AttributeCallback{{/MTRCallbackBridge}} +{{#>MTRCallbackBridge header="1" type=(asType label) isNullable=true ns=parent.name}}Nullable{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}AttributeCallback{{/MTRCallbackBridge}} {{/zcl_enums}} {{/zcl_clusters}} diff --git a/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt b/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt index a975d6ffe4920b..8d37b94befd0f8 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt @@ -7,7 +7,8 @@ typedef NS_ENUM(uint32_t, MTRClusterIDType) { {{#zcl_clusters}} -MTRClusterIDType{{asUpperCamelCase label}}ID = {{asMEI manufacturerCode code}}, +{{~#*inline "cluster"}}{{asUpperCamelCase label preserveAcronyms=true}}{{/inline~}} +MTRClusterIDType{{>cluster}}ID = {{asMEI manufacturerCode code}}, {{/zcl_clusters}} }; @@ -16,20 +17,23 @@ MTRClusterIDType{{asUpperCamelCase label}}ID = {{asMEI manufacturerCode code}}, typedef NS_ENUM(uint32_t, MTRAttributeIDType) { // Global attributes {{#zcl_attributes_server}} +{{~#*inline "attribute"}}{{asUpperCamelCase label preserveAcronyms=true}}{{/inline~}} {{#unless clusterRef}} -MTRAttributeIDTypeGlobalAttribute{{asUpperCamelCase label}}ID = {{asMEI manufacturerCode code}}, +MTRAttributeIDTypeGlobalAttribute{{>attribute}}ID = {{asMEI manufacturerCode code}}, {{/unless}} {{/zcl_attributes_server}} {{#zcl_clusters}} {{#zcl_attributes_server}} +{{~#*inline "cluster"}}{{asUpperCamelCase parent.label preserveAcronyms=true}}{{/inline~}} +{{~#*inline "attribute"}}{{asUpperCamelCase label preserveAcronyms=true}}{{/inline~}} {{#first}} -// Cluster {{asUpperCamelCase parent.label}} attributes +// Cluster {{>cluster}} attributes {{/first}} {{#if clusterRef}} -MTRAttributeIDTypeCluster{{asUpperCamelCase parent.label}}Attribute{{asUpperCamelCase label}}ID = {{asMEI manufacturerCode code}}, +MTRAttributeIDTypeCluster{{>cluster}}Attribute{{>attribute}}ID = {{asMEI manufacturerCode code}}, {{else}} -MTRAttributeIDTypeCluster{{asUpperCamelCase parent.label}}Attribute{{asUpperCamelCase label}}ID = MTRAttributeIDTypeGlobalAttribute{{asUpperCamelCase label}}ID, +MTRAttributeIDTypeCluster{{>cluster}}Attribute{{>attribute}}ID = MTRAttributeIDTypeGlobalAttribute{{>attribute}}ID, {{/if}} {{#last}} @@ -43,10 +47,12 @@ MTRAttributeIDTypeCluster{{asUpperCamelCase parent.label}}Attribute{{asUpperCame typedef NS_ENUM(uint32_t, MTRCommandIDType) { {{#zcl_clusters}} {{#zcl_commands}} +{{~#*inline "cluster"}}{{asUpperCamelCase parent.label preserveAcronyms=true}}{{/inline~}} +{{~#*inline "command"}}{{asUpperCamelCase label preserveAcronyms=true}}{{/inline~}} {{#first}} -// Cluster {{asUpperCamelCase parent.label}} commands +// Cluster {{>cluster}} commands {{/first}} -MTRCommandIDTypeCluster{{asUpperCamelCase parent.label}}Command{{asUpperCamelCase label}}ID = {{asMEI manufacturerCode code}}, +MTRCommandIDTypeCluster{{>cluster}}Command{{>command}}ID = {{asMEI manufacturerCode code}}, {{#last}} {{/last}} @@ -59,10 +65,12 @@ MTRCommandIDTypeCluster{{asUpperCamelCase parent.label}}Command{{asUpperCamelCas typedef NS_ENUM(uint32_t, MTREventIDType) { {{#zcl_clusters}} {{#zcl_events}} +{{~#*inline "cluster"}}{{asUpperCamelCase parent.label preserveAcronyms=true}}{{/inline~}} +{{~#*inline "event"}}{{asUpperCamelCase name preserveAcronyms=true}}{{/inline~}} {{#first}} -// Cluster {{asUpperCamelCase parent.label}} events +// Cluster {{>cluster}} events {{/first}} -MTREventIDTypeCluster{{asUpperCamelCase parent.label}}Event{{asUpperCamelCase name}}ID = {{asMEI manufacturerCode code}}, +MTREventIDTypeCluster{{>cluster}}Event{{>event}}ID = {{asMEI manufacturerCode code}}, {{#last}} {{/last}} diff --git a/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt b/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt index 8479109869bd18..8042a6951c43af 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt @@ -25,7 +25,7 @@ using chip::SessionHandle; // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks): Linter is unable to locate the delete on these objects. {{#chip_client_clusters includeAll=true}} -@implementation MTRCluster{{asUpperCamelCase name}} +@implementation MTRCluster{{asUpperCamelCase name preserveAcronyms=true}} - (instancetype)initWithDevice:(MTRDevice *)device endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue { @@ -43,14 +43,15 @@ using chip::SessionHandle; } {{#chip_cluster_commands}} -{{#*inline "callbackName"}}{{#if hasSpecificResponse}}{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase responseName}}{{else}}CommandSuccess{{/if}}{{/inline}} +{{#*inline "cluster"}}{{asUpperCamelCase parent.name preserveAcronyms=true}}{{/inline}} +{{#*inline "callbackName"}}{{#if hasSpecificResponse}}{{>cluster}}Cluster{{asUpperCamelCase responseName preserveAcronyms=true}}{{else}}CommandSuccess{{/if}}{{/inline}} {{#unless (hasArguments)}} - (void){{asLowerCamelCase name}}WithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion { [self {{asLowerCamelCase name}}WithParams:nil expectedValues:expectedValues expectedValueInterval:expectedValueIntervalMs completion:completion]; } {{/unless}} -- (void){{asLowerCamelCase name}}WithParams: (MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Params * {{#unless (commandHasRequiredField .)}}_Nullable{{/unless}})params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion +- (void){{asLowerCamelCase name}}WithParams: (MTR{{>cluster}}Cluster{{asUpperCamelCase name}}Params * {{#unless (commandHasRequiredField .)}}_Nullable{{/unless}})params expectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion { // Make a copy of params before we go async. params = [params copy]; @@ -108,9 +109,10 @@ using chip::SessionHandle; {{/chip_cluster_commands}} {{#chip_server_cluster_attributes}} -{{#*inline "attribute"}}Attribute{{asUpperCamelCase name}}{{/inline}} +{{#*inline "cluster"}}{{asUpperCamelCase parent.name preserveAcronyms=true}}{{/inline}} +{{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}} - (NSDictionary *)read{{>attribute}}WithParams:(MTRReadParams * _Nullable)params { - return [self.device readAttributeWithEndpointID:@(_endpoint) clusterID:@(MTRClusterIDType{{asUpperCamelCase parent.name}}ID) attributeID:@(MTRAttributeIDTypeCluster{{asUpperCamelCase parent.name}}Attribute{{asUpperCamelCase name}}ID) params:params]; + return [self.device readAttributeWithEndpointID:@(_endpoint) clusterID:@(MTRClusterIDType{{>cluster}}ID) attributeID:@(MTRAttributeIDTypeCluster{{>cluster}}{{>attribute}}ID) params:params]; } {{#if isWritableAttribute}} @@ -128,7 +130,7 @@ using chip::SessionHandle; } {{/if}} - [self.device writeAttributeWithEndpointID:@(_endpoint) clusterID:@(MTRClusterIDType{{asUpperCamelCase parent.name}}ID) attributeID:@(MTRAttributeIDTypeCluster{{asUpperCamelCase parent.name}}Attribute{{asUpperCamelCase name}}ID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; + [self.device writeAttributeWithEndpointID:@(_endpoint) clusterID:@(MTRClusterIDType{{>cluster}}ID) attributeID:@(MTRAttributeIDTypeCluster{{>cluster}}{{>attribute}}ID) value:dataValueDictionary expectedValueInterval:expectedValueIntervalMs timedWriteTimeout:timedWriteTimeout]; } {{/if}} diff --git a/src/darwin/Framework/CHIP/templates/MTRClusters.zapt b/src/darwin/Framework/CHIP/templates/MTRClusters.zapt index 96c2bf30f62aac..df169038743b06 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClusters.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRClusters.zapt @@ -18,21 +18,23 @@ NS_ASSUME_NONNULL_BEGIN * Cluster {{name}} * {{description}} */ -@interface MTRCluster{{asUpperCamelCase name}} : MTRCluster +@interface MTRCluster{{asUpperCamelCase name preserveAcronyms=true}} : MTRCluster - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; {{#chip_cluster_commands}} -- (void){{asLowerCamelCase name}}WithParams:(MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Params * {{#unless (commandHasRequiredField .)}}_Nullable{{/unless}})params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion; +{{~#*inline "cluster"}}{{asUpperCamelCase parent.name preserveAcronyms=true}}{{/inline~}} +{{~#*inline "command"}}{{asUpperCamelCase name preserveAcronyms=true}}{{/inline~}} +- (void){{asLowerCamelCase name}}WithParams:(MTR{{>cluster}}Cluster{{>command}}Params * {{#unless (commandHasRequiredField .)}}_Nullable{{/unless}})params expectedValues:(NSArray *> * _Nullable)expectedDataValueDictionaries expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion; {{#unless (hasArguments)}} - (void){{asLowerCamelCase name}}WithExpectedValues:(NSArray *> *)expectedValues expectedValueInterval:(NSNumber *)expectedValueIntervalMs completion:({{>command_completion_type command=.}})completion; {{/unless}} {{/chip_cluster_commands}} {{#chip_server_cluster_attributes}} -{{#*inline "attribute"}}Attribute{{asUpperCamelCase name}}{{/inline}} +{{#*inline "attribute"}}Attribute{{asUpperCamelCase name preserveAcronyms=true}}{{/inline}} - (NSDictionary *)read{{>attribute}}WithParams:(MTRReadParams * _Nullable)params; {{#if isWritableAttribute}} - (void)write{{>attribute}}WithValue:(NSDictionary *)dataValueDictionary expectedValueInterval:(NSNumber *)expectedValueIntervalMs; diff --git a/src/darwin/Framework/CHIP/templates/MTRClusters_internal.zapt b/src/darwin/Framework/CHIP/templates/MTRClusters_internal.zapt index f809ff41b5666e..ccad7c4389101c 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClusters_internal.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRClusters_internal.zapt @@ -10,7 +10,7 @@ {{#chip_client_clusters includeAll=true}} -@interface MTRCluster{{asUpperCamelCase name}} () +@interface MTRCluster{{asUpperCamelCase name preserveAcronyms=true}} () @property (nonatomic, readonly) uint16_t endpoint; @property (nonatomic, readonly) MTRDevice *device; @end diff --git a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt index 94e7ffff02b86c..f2898ff87cd84e 100644 --- a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc-src.zapt @@ -6,7 +6,7 @@ NS_ASSUME_NONNULL_BEGIN {{#zcl_clusters}} {{#zcl_commands}} -@implementation MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Params +@implementation MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Params - (instancetype)init { if (self = [super init]) { @@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN - (id)copyWithZone:(NSZone * _Nullable)zone; { - auto other = [[MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Params alloc] init]; + auto other = [[MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Params alloc] init]; {{#zcl_command_arguments}} other.{{asStructPropertyName label}} = self.{{asStructPropertyName label}}; diff --git a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc.zapt b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc.zapt index 8b7e54e4db3435..d91dfccb117362 100644 --- a/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc.zapt @@ -7,7 +7,7 @@ NS_ASSUME_NONNULL_BEGIN {{#zcl_clusters}} {{#zcl_commands}} -@interface MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Params : NSObject +@interface MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Params : NSObject {{#zcl_command_arguments}} {{! Override the getter name because some of our properties start with things diff --git a/src/darwin/Framework/CHIP/templates/MTREventTLVValueDecoder-src.zapt b/src/darwin/Framework/CHIP/templates/MTREventTLVValueDecoder-src.zapt index 0d6b38c1a837b4..14a052bbe56d90 100644 --- a/src/darwin/Framework/CHIP/templates/MTREventTLVValueDecoder-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTREventTLVValueDecoder-src.zapt @@ -38,7 +38,7 @@ id MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVReader & aRead return nil; } - MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Event *value = [MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Event new]; + __auto_type *value = [MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Event new]; {{#zcl_event_fields}} do { diff --git a/src/darwin/Framework/CHIP/templates/MTRStructsObjc-src.zapt b/src/darwin/Framework/CHIP/templates/MTRStructsObjc-src.zapt index 123517520831b2..dee1570d909cc2 100644 --- a/src/darwin/Framework/CHIP/templates/MTRStructsObjc-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRStructsObjc-src.zapt @@ -6,7 +6,7 @@ NS_ASSUME_NONNULL_BEGIN {{#zcl_clusters}} {{#zcl_structs}} -@implementation MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}} +@implementation MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}} - (instancetype)init { if (self = [super init]) { @@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN - (id)copyWithZone:(NSZone * _Nullable)zone { - auto other = [[MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}} alloc] init]; + auto other = [[MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}} alloc] init]; {{#zcl_struct_items}} other.{{asStructPropertyName label}} = self.{{asStructPropertyName label}}; @@ -39,7 +39,7 @@ NS_ASSUME_NONNULL_BEGIN {{/zcl_structs}} {{#zcl_events}} -@implementation MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Event +@implementation MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Event - (instancetype)init { if (self = [super init]) { @@ -52,7 +52,7 @@ NS_ASSUME_NONNULL_BEGIN - (id)copyWithZone:(NSZone * _Nullable)zone { - auto other = [[MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Event alloc] init]; + auto other = [[MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Event alloc] init]; {{#zcl_event_fields}} other.{{asStructPropertyName name}} = self.{{asStructPropertyName name}}; diff --git a/src/darwin/Framework/CHIP/templates/MTRStructsObjc.zapt b/src/darwin/Framework/CHIP/templates/MTRStructsObjc.zapt index 9e131db8c50d77..8bbace9a6c815d 100644 --- a/src/darwin/Framework/CHIP/templates/MTRStructsObjc.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRStructsObjc.zapt @@ -6,7 +6,7 @@ NS_ASSUME_NONNULL_BEGIN {{#zcl_clusters}} {{#zcl_structs}} -@interface MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}} : NSObject +@interface MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}} : NSObject {{! Override the getter name because some of our properties start with things like "new" or "init" }} {{#zcl_struct_items}} @@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN {{/zcl_structs}} {{#zcl_events}} -@interface MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Event : NSObject +@interface MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Event : NSObject {{#zcl_event_fields}} @property (nonatomic, copy{{#unless (isStrEqual (asGetterName name) (asStructPropertyName name))}}, getter={{asGetterName name}}{{/unless}}) {{asObjectiveCType type parent.parent.name}} {{asStructPropertyName name}}; {{/zcl_event_fields}} diff --git a/src/darwin/Framework/CHIP/templates/partials/MTRCallbackBridge.zapt b/src/darwin/Framework/CHIP/templates/partials/MTRCallbackBridge.zapt index 40656f44ce3a0c..07706f2c1db8ef 100644 --- a/src/darwin/Framework/CHIP/templates/partials/MTRCallbackBridge.zapt +++ b/src/darwin/Framework/CHIP/templates/partials/MTRCallbackBridge.zapt @@ -84,7 +84,7 @@ void MTR{{> @partial-block}}Bridge::OnSuccessFn(void * context {{#if (isStrEqual partial-type "Status")}} DispatchSuccess(context, nil); {{else if (isStrEqual partial-type "Command")}} - auto * response = [MTR{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Params new]; + auto * response = [MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name preserveAcronyms=true}}Params new]; {{#chip_cluster_response_arguments}} { {{>decode_value target=(concat "response." (asStructPropertyName label)) source=(concat "data." (asLowerCamelCase label)) cluster=parent.parent.name errorCode="OnFailureFn(context, err); return;" depth=0}} diff --git a/src/darwin/Framework/CHIP/templates/partials/attribute_data_callback_name.zapt b/src/darwin/Framework/CHIP/templates/partials/attribute_data_callback_name.zapt index 385e4afb338ee9..28ec591edb7a44 100644 --- a/src/darwin/Framework/CHIP/templates/partials/attribute_data_callback_name.zapt +++ b/src/darwin/Framework/CHIP/templates/partials/attribute_data_callback_name.zapt @@ -1,22 +1,22 @@ {{~#if isArray~}} - {{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}List + {{asUpperCamelCase parent.name preserveAcronyms=true}}{{asUpperCamelCase name preserveAcronyms=true}}List {{~else~}} {{~#if_is_struct type~}} {{~! Structs are not used as types of attributes much, so it's less code to generate the callbacks on a per-attribute basis than a per-struct-type basis. ~}} - {{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}Struct + {{asUpperCamelCase parent.name preserveAcronyms=true}}{{asUpperCamelCase name preserveAcronyms=true}}Struct {{~else if_is_strongly_typed_bitmap type~}} - {{asUpperCamelCase parent.name}}{{asUpperCamelCase name}} + {{asUpperCamelCase parent.name preserveAcronyms=true}}{{asUpperCamelCase name preserveAcronyms=true}} {{~else~}} {{~#if isNullable}}Nullable{{/if~}} {{~#if (isStrEqual (asUpperCamelCase type) (asUpperCamelCase "vendor_id"))~}} VendorId {{~else if_is_strongly_typed_chip_enum type~}} - {{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase type}} + {{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase type preserveAcronyms=true}} {{~else~}} {{chipCallback.name}} {{~/if~}} {{~/if_is_struct~}} {{~/if~}} -Attribute \ No newline at end of file +Attribute{{~"remove_extra_spaces"~}} diff --git a/src/darwin/Framework/CHIP/templates/partials/command_completion_type.zapt b/src/darwin/Framework/CHIP/templates/partials/command_completion_type.zapt index 5e99dc53e9adc8..f50e91c2eba380 100644 --- a/src/darwin/Framework/CHIP/templates/partials/command_completion_type.zapt +++ b/src/darwin/Framework/CHIP/templates/partials/command_completion_type.zapt @@ -1,5 +1,5 @@ {{#if command.hasSpecificResponse}} -void (^)(MTR{{asUpperCamelCase command.parent.name}}Cluster{{asUpperCamelCase command.responseName}}Params * _Nullable data, NSError * _Nullable error) +void (^)(MTR{{asUpperCamelCase command.parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase command.responseName}}Params * _Nullable data, NSError * _Nullable error) {{else}} MTRStatusCompletion {{/if}}