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

Fix Darwin availability bits for command payloads: #29468

Merged
merged 1 commit into from
Sep 29, 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
Expand Up @@ -116,6 +116,18 @@ NS_ASSUME_NONNULL_BEGIN
{{#*inline "oldNameImpl"}}

@implementation MTR{{cluster}}Cluster{{command}}Params
{{#zcl_command_arguments}}
{{#if (isSupported ../cluster command=../command commandField=(asStructPropertyName label))}}
@dynamic {{asStructPropertyName label}};
{{/if}}
{{/zcl_command_arguments}}

{{#if (isStrEqual source "client")}}
@dynamic timedInvokeTimeoutMs;
@dynamic serverSideProcessingTimeout;
{{else if (wasIntroducedBeforeRelease "First major API revamp" cluster command=command)}}
@dynamic timedInvokeTimeoutMs;
{{/if}}
@end
{{/inline}}
{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}}
Expand Down
30 changes: 22 additions & 8 deletions src/darwin/Framework/CHIP/templates/MTRCommandPayloadsObjc.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ NS_ASSUME_NONNULL_BEGIN
{{#*inline "completeDecl"}}
{{#if (isSupported cluster command=command isForCommandPayload=true)}}

{{availability cluster command=command isForCommandPayload=true deprecationMessage="This command has been removed"}}
@interface MTR{{cluster}}Cluster{{command}}Params : NSObject <NSCopying>
{{availability cluster command=command isForCommandPayload=true deprecationMessage=deprecationMessage}}
@interface MTR{{cluster}}Cluster{{command}}Params : {{base}}
{{#zcl_command_arguments}}

{{#if (isSupported ../cluster command=../command commandField=(asStructPropertyName label))}}
{{> struct_field_decl cluster=parent.parent.name type=type label=label}} {{availability ../cluster command=../command commandField=(asStructPropertyName label) deprecationMessage=(concat "The " (asStructPropertyName label) " field will be removed")}};
{{/if}}
{{#*inline "oldNameFieldDecl"}}

{{#if (isSupported ../cluster command=../command commandField=commandField)}}
{{> struct_field_decl cluster=parent.parent.name type=type label=commandField}} {{availability ../cluster command=../command commandField=commandField deprecationMessage=(concat "Please use " (asStructPropertyName label))}};
{{/if}}
{{/inline}}
{{#if (and includeRenamedProperties
(hasOldName ../cluster command=../command commandField=(asStructPropertyName label)))}}
Expand Down Expand Up @@ -68,7 +72,8 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, copy, nullable) NSNumber * timedInvokeTimeoutMs {{availability "" api="Timed Invoke for server to client commands" deprecationMessage="Timed invoke does not make sense for server to client commands"}};
{{/if}}
{{#if (isStrEqual source "server")}}
{{#if (and (isStrEqual source "server")
includeInitWithResponseValue)}}

/**
* Initialize an MTR{{cluster}}Cluster{{command}}Params with a response-value dictionary
Expand All @@ -88,15 +93,21 @@ NS_ASSUME_NONNULL_BEGIN
{{/inline}}
{{#*inline "oldNameDecl"}}

{{availability cluster command=command deprecationMessage=(concat "Please use MTR" (asUpperCamelCase parent.name preserveAcronyms=true) "Cluster" (asUpperCamelCase name preserveAcronyms=true) "Params")}}
@interface MTR{{cluster}}Cluster{{command}}Params : MTR{{asUpperCamelCase parent.name preserveAcronyms=true}}Cluster{{asUpperCamelCase name}}Params
@end
{{> completeDecl cluster=cluster
command=command
includeRenamedProperties=true
deprecationMessage=(concat "Please use MTR" (asUpperCamelCase parent.name preserveAcronyms=true) "Cluster" (asUpperCamelCase name preserveAcronyms=true) "Params")
base=(concat "MTR" (asUpperCamelCase parent.name preserveAcronyms=true) "Cluster" (asUpperCamelCase name preserveAcronyms=true) "Params")
includeInitWithResponseValue=false}}

{{/inline}}
{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}}
{{> completeDecl cluster=(asUpperCamelCase parent.name preserveAcronyms=true)
command=(asUpperCamelCase name preserveAcronyms=true)
includeRenamedProperties=false}}
includeRenamedProperties=false
deprecationMessage="This command has been removed"
base="NSObject <NSCopying>"
includeInitWithResponseValue=true}}
{{#if (or (not (isStrEqual (asUpperCamelCase parent.name preserveAcronyms=true) (compatClusterNameRemapping parent.name)))
(not (isStrEqual (asUpperCamelCase name preserveAcronyms=true) (compatCommandNameRemapping parent.name name))))}}
{{> oldNameDecl cluster=(compatClusterNameRemapping parent.name)
Expand All @@ -123,7 +134,10 @@ NS_ASSUME_NONNULL_BEGIN
{{else}}
{{> completeDecl cluster=(compatClusterNameRemapping parent.name)
command=(compatCommandNameRemapping parent.name name)
includeRenamedProperties=true}}
includeRenamedProperties=true
deprecationMessage="This command has been removed"
base="NSObject <NSCopying>"
includeInitWithResponseValue=true}}
{{/if}}
{{/zcl_commands}}
{{/zcl_clusters}}
Expand Down
16 changes: 16 additions & 0 deletions src/darwin/Framework/CHIP/templates/availability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6331,6 +6331,13 @@
commands:
BasicInformation:
- MfgSpecificPing
command fields:
# Cases where the cluster/command got renamed and the fields got
# renamed, so the old command name never had the new fields.
OtaSoftwareUpdateProvider:
QueryImage:
- vendorID
- productID
enums:
# DoorLockUserStatus (non-spec) and UserStatusEnum (from the spec) end
# up with the same enum name (MTRDoorLockUserStatus), so just remove
Expand Down Expand Up @@ -7577,6 +7584,15 @@
- release: "Future"
versions: "future"
introduced:
command payloads:
TimeSynchronization:
- SetUTCTime
command fields:
TimeSynchronization:
SetUTCTime:
- utcTime
- granularity
- timeSource
enum values:
OnOff:
DelayedAllOffEffectVariantEnum:
Expand Down
Loading