Skip to content

Commit

Permalink
Add chip tool Darwin description to classes. (#18909)
Browse files Browse the repository at this point in the history
* Add descriptions to structures, classes and event.

* Generated code
  • Loading branch information
krypton36 authored Jun 2, 2022
1 parent d5bc7fc commit 50dc552
Show file tree
Hide file tree
Showing 4 changed files with 3,800 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ NS_ASSUME_NONNULL_BEGIN
}
return self;
}

- (NSString *)description
{
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;
}

@end
{{/zcl_commands}}
{{/zcl_clusters}}
Expand Down
14 changes: 14 additions & 0 deletions src/darwin/Framework/CHIP/templates/CHIPStructsObjc-src.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ NS_ASSUME_NONNULL_BEGIN
}
return self;
}

- (NSString *)description
{
NSString *descriptionString = [NSString stringWithFormat:@"<%@: {{#zcl_struct_items}}{{asStructPropertyName label}}:%@; {{/zcl_struct_items}}>", NSStringFromClass([self class]){{#zcl_struct_items}},{{#if isArray}}_{{asStructPropertyName label}}{{else if (isOctetString type)}}[_{{asStructPropertyName label}} base64EncodedStringWithOptions:0]{{else}}_{{asStructPropertyName label}}{{/if}}{{/zcl_struct_items}}];
return descriptionString;
}

@end

{{/zcl_structs}}
Expand All @@ -31,6 +38,13 @@ NS_ASSUME_NONNULL_BEGIN
}
return self;
}

- (NSString *)description
{
NSString *descriptionString = [NSString stringWithFormat:@"<%@: {{#zcl_event_fields}}{{asStructPropertyName name}}:%@; {{/zcl_event_fields}}>", NSStringFromClass([self class]){{#zcl_event_fields}},{{#if isArray}}_{{asStructPropertyName name}}{{else if (isOctetString type)}}[_{{asStructPropertyName label}} base64EncodedStringWithOptions:0]{{else}}_{{asStructPropertyName name}}{{/if}}{{/zcl_event_fields}}];
return descriptionString;
}

@end

{{/zcl_events}}
Expand Down
Loading

0 comments on commit 50dc552

Please sign in to comment.