Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update chip-tool zapt to align with src/app/zap-templates #5141

Merged
merged 1 commit into from
Mar 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion examples/chip-tool/templates/commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ static void OnInt16sAttributeResponse(void * context, int16_t value)
command->SetCommandExitStatus(true);
}

static void OnInt64uAttributeResponse(void * context, uint64_t value)
{
ChipLogProgress(chipTool, "Int64u attribute Response: %" PRIu64, value);

ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
command->SetCommandExitStatus(true);
}

{{#all_user_clusters}}
{{#if (isClient side) }}
{{#if (user_cluster_has_enabled_command name side)}}
Expand Down Expand Up @@ -117,7 +125,7 @@ public:

chip::Controller::{{asCamelCased parent.name false}}Cluster cluster;
cluster.Associate(device, endpointId);
return cluster.{{asCamelCased name false}}(onSuccessCallback->Cancel(), onFailureCallback->Cancel(){{#chip_server_cluster_command_arguments}}, {{#if (isByteString type)}} reinterpret_cast<uint8_t*>(m{{asCamelCased label false}}), static_cast<uint32_t>(strlen(m{{asCamelCased label false}})){{else}}m{{asCamelCased label false}}{{/if}}{{/chip_server_cluster_command_arguments}});
return cluster.{{asCamelCased name false}}(onSuccessCallback->Cancel(), onFailureCallback->Cancel(){{#chip_server_cluster_command_arguments}}, {{#if (isByteString type)}} reinterpret_cast<char*>(m{{asCamelCased label false}}){{else}}m{{asCamelCased label false}}{{/if}}{{/chip_server_cluster_command_arguments}});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bytes seem to be more correctly represented as uint8_t than char .

Should we not update the other way and enter a bug that 'using strlen for byte strings is not ok'?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The byte string bit is going to get fixed in #5122 to some extent, right? Though I guess #5122 (comment) is precisely about needing to change the member here to ByteSpan too.

And the rest of this looks like the PR I asked for in #5122 (comment) which I obviously approve of. ;)

}

private:
Expand Down