Skip to content

Commit

Permalink
Addressed comments by bzbarsky-apple part2 unlinked availability.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
pgregorr-amazon committed Mar 21, 2024
1 parent dfa5477 commit 7242c92
Show file tree
Hide file tree
Showing 12 changed files with 1 addition and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
#import <Foundation/Foundation.h>

{{#zcl_clusters}}
{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}}
{{#if (isInConfigList name "MatterCastingClusters")}}

// {{asUpperCamelCase name}} cluster attributes:

{{#zcl_attributes_server removeKeys='isOptional'}}
{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}}
@implementation MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Attribute
- (void)read:(void * _Nullable)context
completion:(void (^_Nonnull __strong)(void * _Nullable, id _Nullable __strong before, id _Nullable __strong after, NSError * _Nullable __strong error))completion
Expand Down Expand Up @@ -67,8 +65,6 @@
}
@end

{{/if}}
{{/zcl_attributes_server}}
{{/if}}
{{/if}}
{{/zcl_clusters}}
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,16 @@
#define MCAttributeObjects_h

{{#zcl_clusters}}
{{#if (isSupported (asUpperCamelCase name))}}
{{#if (isInConfigList name "MatterCastingClusters")}}

// {{asUpperCamelCase name}} cluster attributes:

{{#zcl_attributes_server}}
{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}}
@interface MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Attribute : MCAttribute <{{asObjectiveCClass type ../name structTypePrefix="MC"}} *>
@end

{{/if}}
{{/zcl_attributes_server}}
{{/if}}
{{/if}}
{{/zcl_clusters}}

#endif /* MCAttributeObjects_h */
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#import <Foundation/Foundation.h>

{{#zcl_clusters}}
{{#if (isSupported (asUpperCamelCase name))}}
{{#if (isInConfigList name "MatterCastingClusters")}}

// {{asUpperCamelCase name}} cluster:
Expand All @@ -24,30 +23,25 @@

{{#zcl_commands}}
{{#if (is_str_equal source 'client')}}
{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}}

- (id){{asMethodName name}}Command
{
void * cppCommand = self.cppCluster->GetCommand(chip::app::Clusters::{{asUpperCamelCase ../name}}::Commands::{{asUpperCamelCase name}}::Id);
return cppCommand != nil ? [[MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Command alloc] initWithCppCommand:cppCommand] : nil;
}

{{/if}}
{{/if}}
{{/zcl_commands}}

// {{asUpperCamelCase name}} cluster attributes:
{{#zcl_attributes_server}}
{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}}

- (id){{asMethodName name}}Attribute
{
void * cppAttribute = self.cppCluster->GetAttribute(chip::app::Clusters::{{asUpperCamelCase ../name}}::Attributes::{{asUpperCamelCase name}}::Id);
return cppAttribute != nil ? [[MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Attribute alloc] initWithCppAttribute:cppAttribute] : nil;
}
{{/if}}
{{/zcl_attributes_server}}
@end
{{/if}}
{{/if}}
{{/zcl_clusters}}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#define MCClusterObjects_h

{{#zcl_clusters}}
{{#if (isSupported (asUpperCamelCase name))}}
{{#if (isInConfigList name "MatterCastingClusters")}}

// {{asUpperCamelCase name}} cluster:
Expand All @@ -20,29 +19,24 @@

{{#zcl_commands}}
{{#if (is_str_equal source 'client')}}
{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}}

/**
* @brief Returns non-nil pointer to MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Command if supported, nil otherwise.
*/
- (MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Command * _Nullable){{asMethodName name}}Command;
{{/if}}
{{/if}}
{{/zcl_commands}}

// {{asUpperCamelCase name}} cluster attributes:
{{#zcl_attributes_server}}
{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}}

/**
* @brief Returns non-nil pointer to MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Attribute if supported, nil otherwise.
*/
- (MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Attribute * _Nullable){{asMethodName name}}Attribute;
{{/if}}
{{/zcl_attributes_server}}
@end
{{/if}}
{{/if}}
{{/zcl_clusters}}

#endif /* MCClusterObjects_h */
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@
@end

{{#zcl_clusters}}
{{#if (isSupported (asUpperCamelCase name))}}
{{#if (isInConfigList name "MatterCastingClusters")}}

// {{asUpperCamelCase name}} cluster:

{{#zcl_commands}}
{{#if (is_str_equal source 'client')}}
{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}}
@implementation MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Command
- (void)invoke:(id)request
context:(void * _Nullable)context
Expand Down Expand Up @@ -80,9 +78,7 @@
}
@end

{{/if}}
{{/if}}
{{/zcl_commands}}
{{/if}}
{{/if}}
{{/zcl_clusters}}
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,17 @@
@end

{{#zcl_clusters}}
{{#if (isSupported (asUpperCamelCase name))}}
{{#if (isInConfigList name "MatterCastingClusters")}}

// {{asUpperCamelCase name}} cluster:

{{#zcl_commands}}
{{#if (is_str_equal source 'client')}}
{{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true))}}
@interface MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Command : MCCommand <MC{{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase name}}Params *, {{>command_response_type command=.}} *>
@end

{{/if}}
{{/if}}
{{/zcl_commands}}
{{/if}}
{{/if}}
{{/zcl_clusters}}
#endif /* MCCommandObjects_h */
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
#import "../NSStringSpanConversion.h"

#include <app/data-model/Decode.h>
#include <lib/core/TLV.h>
#include <app/data-model/ListLargeSystemExtensions.h>
#include <lib/support/CodeUtils.h>
#include <system/TLVPacketBufferBackingStore.h>

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -42,7 +39,6 @@ NS_ASSUME_NONNULL_BEGIN
{{#zcl_commands}}

{{#*inline "completeImpl"}}
{{#if (isSupported cluster command=command isForCommandPayload=true)}}
@implementation MC{{cluster}}Cluster{{command}}Params
- (instancetype)init
{
Expand All @@ -51,9 +47,6 @@ NS_ASSUME_NONNULL_BEGIN

{{>init_struct_member label=label type=type cluster=parent.parent.name}}
{{/zcl_command_arguments}}
{{#if (or (isStrEqual source "client")
(wasIntroducedBeforeRelease "First major API revamp" (compatClusterNameRemapping parent.name) command=(compatCommandNameRemapping parent.name name)))}}
{{/if}}
{{#if (isStrEqual source "client")}}
{{/if}}
}
Expand All @@ -76,13 +69,6 @@ NS_ASSUME_NONNULL_BEGIN
NSString *descriptionString = [NSString stringWithFormat:@"<%@: {{#zcl_command_arguments}}{{asStructPropertyName label}}:%@; {{/zcl_command_arguments}}>", NSStringFromClass([self class]) {{#zcl_command_arguments}},{{#if isArray}}_{{asStructPropertyName label}}{{else if (isOctetString type)}}[_{{asStructPropertyName label}} base64EncodedStringWithOptions:0]{{else}}_{{asStructPropertyName label}}{{/if}}{{/zcl_command_arguments}}];
return descriptionString;
}
{{#zcl_command_arguments}}
{{#if (and includeRenamedProperties
(hasOldName ../cluster command=../command commandField=(asStructPropertyName label)))}}

{{> renamed_struct_field_impl cluster=parent.parent.name type=type newName=label oldName=(oldName ../cluster command=../command commandField=(asStructPropertyName label))}}
{{/if}}
{{/zcl_command_arguments}}

{{#if (isStrEqual source "client")}}

Expand Down Expand Up @@ -128,23 +114,11 @@ NS_ASSUME_NONNULL_BEGIN
}
{{/if}}
@end
{{/if}}
{{/inline}}

{{#if (isSupported (asUpperCamelCase parent.name preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true) isForCommandPayload=true)}}
{{> completeImpl cluster=(asUpperCamelCase parent.name preserveAcronyms=true)
command=(asUpperCamelCase name preserveAcronyms=true)
includeRenamedProperties=false}}

{{#if (or (not (isStrEqual (asUpperCamelCase parent.name preserveAcronyms=true) (compatClusterNameRemapping parent.name)))
(not (isStrEqual (asUpperCamelCase name preserveAcronyms=true) (compatCommandNameRemapping parent.name name))))}}
{{/if}}

{{else}}
{{> completeImpl cluster=(compatClusterNameRemapping parent.name)
command=(compatCommandNameRemapping parent.name name)
includeRenamedProperties=true}}
{{/if}}
{{/zcl_commands}}
{{/if}}
{{/zcl_clusters}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,22 @@ NS_ASSUME_NONNULL_BEGIN
// {{asUpperCamelCase name}} cluster:
{{#zcl_commands}}
{{#*inline "completeDecl"}}
{{#if (isSupported cluster command=command isForCommandPayload=true)}}

@interface MC{{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}};
{{/if}}
{{#*inline "oldNameFieldDecl"}}
{{#if (isSupported ../cluster command=../command commandField=commandField)}}
{{> struct_field_decl cluster=parent.parent.name type=type label=commandField}};
{{/if}}
{{/inline}}
{{/zcl_command_arguments}}
@end
{{/if}}
{{/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
deprecationMessage="This command has been removed"
base="MCAbstractPayload"
includeInitWithResponseValue=true}}
{{/if}}
{{/zcl_commands}}
{{/if}}
{{/zcl_clusters}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
{{#if_is_struct type}}
{{target}} = [{{asObjectiveCClass type cluster forceNotList=true structTypePrefix="MC"}} new];
{{#zcl_struct_items_by_struct_and_cluster_name type cluster}}
{{#if (isSupported (asUpperCamelCase ../cluster preserveAcronyms=true) struct=(asUpperCamelCase ../type preserveAcronyms=true) structField=(asStructPropertyName label))}}
{{>decode_value target=(concat ../target "." (asStructPropertyName label)) source=(concat ../source "." (asLowerCamelCase label)) cluster=../cluster errorCode=../errorCode depth=(incrementDepth ../depth) }}
{{/if}}
{{/zcl_struct_items_by_struct_and_cluster_name}}
{{else}}
{{#if_is_strongly_typed_chip_enum type}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@
{{else}}
{{#if_is_struct type}}
{{#zcl_struct_items_by_struct_and_cluster_name type cluster}}
{{#if (isSupported (asUpperCamelCase ../cluster preserveAcronyms=true) struct=(asUpperCamelCase ../type preserveAcronyms=true) structField=(asStructPropertyName label))}}
{{>encode_value target=(concat ../target "." (asLowerCamelCase label)) source=(concat ../source "." (asStructPropertyName label)) cluster=../cluster errorCode=../errorCode depth=(incrementDepth ../depth)}}
{{/if}}
{{/zcl_struct_items_by_struct_and_cluster_name}}
{{else}}
{{#if_is_strongly_typed_chip_enum type}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"darwin/Framework/CHIP/templates/helper.js"
],
"resources": {
"availability-data": "../../../../../../src/darwin/Framework/CHIP/templates/availability.yaml",
"config-data": "config-data.yaml"
},
"override": "../../../../../../src/app/zap-templates/common/override.js",
Expand Down Expand Up @@ -87,4 +86,4 @@
"output": "examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/zap-generated/MCCommandPayloads.mm"
}
]
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7242c92

Please sign in to comment.