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

Add data version to framework and chip-tool-darwin. #18174

Merged
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class WriteAttribute : public ModelCommand {
WriteAttribute(const char * _Nonnull attributeName)
: ModelCommand("write")
{
AddArgument("data-version", 0, UINT32_MAX, &mDataVersion);
krypton36 marked this conversation as resolved.
Show resolved Hide resolved
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs);
}

Expand Down Expand Up @@ -104,6 +105,7 @@ class WriteAttribute : public ModelCommand {

protected:
chip::Optional<uint16_t> mTimedInteractionTimeoutMs;
chip::Optional<uint32_t> mDataVersion;

private:
chip::ClusterId mClusterId;
Expand Down
1 change: 1 addition & 0 deletions examples/chip-tool-darwin/templates/commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ public:
CHIP_ERROR __block chipError = CHIP_NO_ERROR;
CHIPWriteParams * params = [[CHIPWriteParams alloc] init];
params.timedWriteTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil;
params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil;
{{#if_chip_complex}}
{{asObjectiveCType type parent.name}} value;
{{>decodable_value target="value" source="mValue" cluster=parent.name errorCode="return err;" depth=0}}
Expand Down
8 changes: 8 additions & 0 deletions src/darwin/Framework/CHIP/CHIPCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (strong, nonatomic, nullable) NSNumber * timedWriteTimeoutMs;

/**
* Sets the data version for the Write Request for the interaction.
*
* If not nil, the write will only succeed if the current data version of
* the cluster matches the provided data version.
*/
@property (strong, nonatomic, nullable) NSNumber * dataVersion;

- (instancetype)init;
@end

Expand Down
Loading