1
1
{{#if header}}
2
- class CHIP{{> @partial-block}}Bridge : public CHIPCallbackBridge<{{> @partial-block}}>
2
+ {{#*inline "callbackType"}}{{#if (isStrEqual partial-type "Command")}}CHIP{{> @partial-block}}Type{{else}}{{> @partial-block}}{{/if}}{{/inline}}
3
+ class CHIP{{> @partial-block}}Bridge : public CHIPCallbackBridge<{{>callbackType}}>
3
4
{
4
5
public:
5
6
CHIP{{> @partial-block}}Bridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, bool keepAlive = false)
6
- : CHIPCallbackBridge<{{> @partial-block }}>(queue, handler, action, OnSuccessFn, keepAlive)
7
+ : CHIPCallbackBridge<{{>callbackType }}>(queue, handler, action, OnSuccessFn, keepAlive)
7
8
{};
8
9
9
10
static void OnSuccessFn(void * context
10
11
{{#if (isStrEqual partial-type "Command")}}
11
- {{#chip_cluster_response_arguments}}, {{asUnderlyingZclType type}} {{asSymbol label}}{{/chip_cluster_response_arguments}}
12
+ , const chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::DecodableType & data
12
13
{{else if (isStrEqual partial-type "List")}}
13
14
, {{zapTypeToDecodableClusterObjectType type ns=parent.name isArgument=true}} list
14
15
{{else if partial-type}}
@@ -20,7 +21,7 @@ public:
20
21
{{else}}
21
22
void CHIP{{> @partial-block}}Bridge::OnSuccessFn(void * context
22
23
{{#if (isStrEqual partial-type "Command")}}
23
- {{#chip_cluster_response_arguments}}, {{asUnderlyingZclType type}} {{asSymbol label}}{{/chip_cluster_response_arguments}}
24
+ , const chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::DecodableType & data
24
25
{{else if (isStrEqual partial-type "List")}}
25
26
, {{zapTypeToDecodableClusterObjectType type ns=parent.name isArgument=true}} list
26
27
{{else if partial-type}}
@@ -30,20 +31,8 @@ void CHIP{{> @partial-block}}Bridge::OnSuccessFn(void * context
30
31
)
31
32
{
32
33
{{#if (isStrEqual partial-type "Command")}}
33
- DispatchSuccess(context, @{
34
- {{#chip_cluster_response_arguments}}
35
- {{#if isArray}}
36
- // {{asSymbol label}} : {{asUnderlyingZclType type}}
37
- // Conversion from this type to Objc is not properly implemented yet
38
- {{else if (isOctetString type)}}
39
- @"{{asSymbol label}}" : [NSData dataWithBytes:{{asSymbol label}}.data() length:{{asSymbol label}}.size()],
40
- {{else if (isCharString type)}}
41
- @"{{asSymbol label}}" : [[NSString alloc] initWithBytes:{{asSymbol label}}.data() length:{{asSymbol label}}.size() encoding:NSUTF8StringEncoding],
42
- {{else}}
43
- @"{{asSymbol label}}" : [NSNumber numberWith{{asObjectiveCNumberType label type false}}:{{asSymbol label}}],
44
- {{/if}}
45
- {{/chip_cluster_response_arguments}}
46
- });
34
+ {{>decode_response}}
35
+ DispatchSuccess(context, response);
47
36
{{else if (isStrEqual partial-type "List")}}
48
37
id array = [[NSMutableArray alloc] init];
49
38
auto iter = list.begin();
0 commit comments