-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[util] Create ByteSpan class for holding OCTET_STRING type values in ZCL encoder #5122
Conversation
d910804
to
93ab134
Compare
be0784a
to
724c3bb
Compare
5f40b73
to
e6f39e9
Compare
examples/all-clusters-app/all-clusters-common/gen/CHIPClustersObjc.h
Outdated
Show resolved
Hide resolved
e6f39e9
to
30bc91b
Compare
30bc91b
to
933b628
Compare
933b628
to
5f85798
Compare
5f85798
to
36581ad
Compare
examples/all-clusters-app/all-clusters-common/gen/CHIPClustersObjc.mm
Outdated
Show resolved
Hide resolved
@@ -117,7 +128,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)}} chip::ByteSpan(reinterpret_cast<uint8_t *>(m{{asCamelCased label false}}), strlen(m{{asCamelCased label false}})){{else}}m{{asCamelCased label false}}{{/if}}{{/chip_server_cluster_command_arguments}}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return cluster.{{asCamelCased name false}}(onSuccessCallback->Cancel(), onFailureCallback->Cancel(){{#chip_server_cluster_command_arguments}}, {{#if (isByteString type)}} chip::ByteSpan(reinterpret_cast<uint8_t *>(m{{asCamelCased label false}}), 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)}} chip::ByteSpan(chip::chip::Uint8::from_char(m{{asCamelCased label false}}), strlen(m{{asCamelCased label false}})){{else}}m{{asCamelCased label false}}{{/if}}{{/chip_server_cluster_command_arguments}}); |
I assume there will be a followup at some point to store a ByteSpan in the member, right?
@@ -378,8 +378,8 @@ NS_ASSUME_NONNULL_BEGIN | |||
timeoutMs:(uint32_t)timeoutMs | |||
completionHandler:(ResponseHandler)completionHandler; | |||
- (void)commissioningComplete:(ResponseHandler)completionHandler; | |||
- (void)setFabric:(char *)fabricId | |||
fabricSecret:(char *)fabricSecret | |||
- (void)setFabric:(NSString)fabricId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't compile, should be NSString *
examples/all-clusters-app/all-clusters-common/gen/CHIPClustersObjc.mm
Outdated
Show resolved
Hide resolved
1bec859
to
094f77f
Compare
094f77f
to
5a83a56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good with the NSByte typo fixed.
Updated title of this PR, will submit another PR for decoder / handler side. |
@msandstedt PTAL |
Problem
The ZCL codegen does not support OCTET_STRING for strings which is not expected to be non-null terminated. This is a critical issue for codegen on the encoder side, which cannot encode OCTET_STRING correctly.
Summary of Changes
This PR introduces the BytesData type for holding OCTET_STRING type in ZCL without the ownership of the data.
#4503