Skip to content

Commit

Permalink
Add largeMessage property support to Commands based on the quality se…
Browse files Browse the repository at this point in the history
…tting in xml.

* Expose a bool-returning method 'CommandIsLarge' via the cluster-objects zap template.
* Set the largeMessage=true for the 'CaptureSnapshot' command in
  AVStreamMgmt cluster xml.
  • Loading branch information
pidarped committed Oct 31, 2024
1 parent c0071eb commit a8a3720
Show file tree
Hide file tree
Showing 7 changed files with 613 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ DataModel::CommandEntry CommandEntryFrom(const ConcreteClusterPath & clusterPath
entry.info.flags.Set(DataModel::CommandQualityFlags::kFabricScoped,
CommandIsFabricScoped(clusterPath.mClusterId, clusterCommandId));

entry.info.flags.Set(DataModel::CommandQualityFlags::kLargeMessage, CommandHasLargePayload(clusterPath.mClusterId, clusterCommandId));
return entry;
}

Expand Down
2 changes: 2 additions & 0 deletions src/app/data-model-provider/MetadataTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ struct AttributeEntry
static const AttributeEntry kInvalid;
};

// Bitmask values for different Command qualities.
enum class CommandQualityFlags : uint32_t
{
kFabricScoped = 0x0001,
kTimed = 0x0002, // `T` quality on commands
kLargeMessage = 0x0004, // `L` quality on commands
};

struct CommandInfo
Expand Down
27 changes: 27 additions & 0 deletions src/app/zap-templates/templates/app/cluster-objects-src.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -261,5 +261,32 @@ bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand)
return false;
}

bool CommandHasLargePayload(ClusterId aCluster, CommandId aCommand)
{
switch (aCluster)
{
{{#zcl_clusters}}
{{#zcl_commands}}
{{#first}}
case Clusters::{{asUpperCamelCase parent.name}}::Id:
{
switch (aCommand) {
{{/first}}
{{#if isLargeMessage}}
case Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::Id:
return true;
{{/if}}
{{#last}}
default:
return false;
}
}
{{/last}}
{{/zcl_commands}}
{{/zcl_clusters}}
}
return false;
}

} // namespace app
} // namespace chip
1 change: 1 addition & 0 deletions src/app/zap-templates/templates/app/cluster-objects.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ public:

bool CommandNeedsTimedInvoke(ClusterId aCluster, CommandId aCommand);
bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand);
bool CommandHasLargePayload(ClusterId aCluster, CommandId aCommand);

} // namespace app
} // namespace chip
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,15 @@ Git: 0.9-fall2024-411-g9835b5cd7

<command code="0x0B" source="client" name="CaptureSnapshot" optional="true">
<description>This command SHALL return a Snapshot from the camera.</description>
<quality largeMessage="true"/>
<access op="invoke" privilege="manage"/>
<arg id="0" name="SnapshotStreamID" type="int16u"/>
<arg id="1" name="RequestedResolution" type="VideoResolutionStruct"/>
</command>

<command code="0x0C" source="server" name="CaptureSnapshotResponse" optional="true" disableDefaultResponse="true">
<description>This command SHALL be sent by the device in response to the CaptureSnapshot command, carrying the requested snapshot.</description>
<quality largeMessage="true"/>
<arg id="0" name="Data" type="octet_string"/>
<arg id="1" name="ImageCodec" type="ImageCodecEnum" min="0x00" max="0x00"/>
<arg id="2" name="Resolution" type="VideoResolutionStruct"/>
Expand Down
Loading

0 comments on commit a8a3720

Please sign in to comment.