Skip to content

Commit

Permalink
Add data version to framework and chip-tool-darwin. (#18174)
Browse files Browse the repository at this point in the history
* Update CHIP FW with data version param and chip-tool-darwin

* Generated code
  • Loading branch information
krypton36 authored and pull[bot] committed Aug 26, 2023
1 parent 2c162ff commit 1660834
Show file tree
Hide file tree
Showing 4 changed files with 231 additions and 0 deletions.
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);
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

0 comments on commit 1660834

Please sign in to comment.