-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Darwin] Use InvokeCommand instead of CHIPClusters.cpp for commands (#…
…11628) * Use InvokeCommand instead of CHIPClusters.cpp for commands * Update gen code
- Loading branch information
1 parent
e5c09e4
commit 4b7cd59
Showing
11 changed files
with
2,399 additions
and
914 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/darwin/Framework/CHIP/templates/partials/decode_response.zapt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
id response = @{ | ||
{{#chip_cluster_response_arguments}} | ||
@"{{asSymbol label}}": {{#if isOptional}}data.{{asLowerCamelCase label}}.HasValue() == false ? [NSNull null] : {{#if isNullable}}data.{{asLowerCamelCase label}}.Value().IsNull() ? [NSNull null] : {{/if}}{{/if}} | ||
{{~#*inline "item"}}data.{{asLowerCamelCase name}}{{#if isOptional}}.Value(){{/if}}{{#if isNullable}}.Value(){{/if}}{{/inline}} | ||
{{#if isArray}} | ||
[NSNull null], /* Array - Conversion from this type to Objc is not properly implemented yet */ | ||
{{else if (isOctetString type)}} | ||
[NSData dataWithBytes:{{>item}}.data() length:{{>item}}.size()], | ||
{{else if (isCharString type)}} | ||
[[NSString alloc] initWithBytes:{{>item}}.data() length:{{>item}}.size() encoding:NSUTF8StringEncoding], | ||
{{else}} | ||
[NSNumber numberWith{{asObjectiveCNumberType label type false}}:{{>item}}], | ||
{{/if}} | ||
{{/chip_cluster_response_arguments}} | ||
}; |
24 changes: 24 additions & 0 deletions
24
src/darwin/Framework/CHIP/templates/partials/encode_command.zapt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::Type request; | ||
{{#chip_cluster_command_arguments}} | ||
{{#*inline "value"}} | ||
{{! TODO Implement complex types parsing in order to properly set the request parameters }} | ||
{{#if isArray}} | ||
{{zapTypeToEncodableClusterObjectType type ns=parent.parent.name}}(); | ||
{{else if isStruct}} | ||
{{zapTypeToEncodableClusterObjectType type ns=parent.parent.name}}(); | ||
{{else if (isOctetString type)}} | ||
[self asByteSpan:{{asLowerCamelCase label}}] | ||
{{else if (isCharString type)}} | ||
[self asCharSpan:{{asLowerCamelCase label}}] | ||
{{else if isBitmap}} | ||
static_cast<decltype(request.{{asLowerCamelCase label}})>({{asLowerCamelCase label}}) | ||
{{else}} | ||
{{#if_chip_enum type}} | ||
static_cast<decltype(request.{{asLowerCamelCase label}})>({{asLowerCamelCase label}}) | ||
{{else}} | ||
{{asLowerCamelCase label}} | ||
{{/if_chip_enum}} | ||
{{/if}} | ||
{{/inline}} | ||
request.{{asLowerCamelCase label}} = {{#if isOptional}}{{zapTypeToEncodableClusterObjectType type ns=parent.parent.name}}({{/if}}{{#if isNullable}}chip::app::DataModel::Nullable<{{chipType}}>({{/if}}{{>value}}{{#if isNullable}}){{/if}}{{#if isOptional}}){{/if}}; | ||
{{/chip_cluster_command_arguments}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.