1 {{#if (zcl_command_arguments_count this.id)}}
2 CHIP_ERROR TLVError = CHIP_NO_ERROR;
3 {{#zcl_command_arguments}}
4 {{#if (isOctetString type)}}
5 chip::ByteSpan {{asSymbol label}};
6 {{else if (isString type)}}
7 const uint8_t * {{asSymbol label}};
9 {{asUnderlyingZclType type}} {{asSymbol label}};
11 {{/zcl_command_arguments}}
13 while ((TLVError = dataTlv.Next()) == CHIP_NO_ERROR)
15 switch (TLV::TagNumFromTag(dataTlv.GetTag()))
17 {{#zcl_command_arguments}}
19 {{#if (isOctetString type)}}
21 const uint8_t * data = nullptr;
22 TLVError = dataTlv.GetDataPtr(data);
23 {{asSymbol label}} = chip::ByteSpan(data, dataTlv.GetLength());
25 {{else if (isString type)}}
26 TLVError = dataTlv.GetDataPtr({{asSymbol label}});
28 // Just for compatibility, we will add array type support in IM later.
29 TLVError = dataTlv.GetDataPtr(const_cast<const uint8_t *&>({{asSymbol label}}));
31 TLVError = dataTlv.Get({{asSymbol label}});
34 {{/zcl_command_arguments}}
36 // Unsupported tag, ignore it.
37 ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
40 if (TLVError != CHIP_NO_ERROR)
42 ChipLogProgress(Zcl, "Failed to decode TLV data with tag %" PRIx32 ": %" PRId32, TLV::TagNumFromTag(dataTlv.GetTag()), TLVError);
46 // TODO(#5098) We should pass the Command Object and EndpointId to the cluster callbacks.
47 emberAf{{asCamelCased parent.name false}}Cluster{{asCamelCased name false}}Callback({{#zcl_command_arguments}}{{#if (isCharString type)}}const_cast<uint8_t*>({{asSymbol label}}){{else}}{{asSymbol label}}{{/if}}{{#unless (isLastElement index count)}}, {{/unless}}{{/zcl_command_arguments}});