diff --git a/examples/chip-tool/commands/clusters/Commands.h b/examples/chip-tool/commands/clusters/Commands.h index 6a46d8de90b320..7f2bb1adeb538b 100644 --- a/examples/chip-tool/commands/clusters/Commands.h +++ b/examples/chip-tool/commands/clusters/Commands.h @@ -425,6 +425,7 @@ constexpr uint16_t kTempMeasurementClusterId = 0x0402; |------------------------------------------------------------------------------| | Commands: | | | * GoToPercent | 0x00 | +| * Stop | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | | * MovingState | 0x0001 | @@ -460,6 +461,27 @@ class BarrierControlGoToPercent : public ModelCommand uint8_t mPercentOpen; }; +/* + * Command Stop + */ +class BarrierControlStop : public ModelCommand +{ +public: + BarrierControlStop() : ModelCommand("stop", kBarrierControlClusterId, 0x01) {} + + uint16_t EncodeCommand(PacketBuffer * buffer, uint16_t bufferSize, uint8_t endPointId) override + { + return encodeBarrierControlClusterStopCommand(buffer->Start(), bufferSize, endPointId); + } + + // Global Response: DefaultResponse + bool HandleGlobalResponse(uint8_t commandId, uint8_t * message, uint16_t messageLen) const override + { + DefaultResponse response; + return response.HandleCommandResponse(commandId, message, messageLen); + } +}; + /* * Attribute MovingState */ @@ -5062,9 +5084,9 @@ void registerClusterBarrierControl(Commands & commands) const char * clusterName = "BarrierControl"; commands_list clusterCommands = { - make_unique(), make_unique(), - make_unique(), make_unique(), - make_unique(), + make_unique(), make_unique(), + make_unique(), make_unique(), + make_unique(), make_unique(), }; commands.Register(clusterName, clusterCommands); diff --git a/src/app/chip-zcl-zpro-codec-api.h b/src/app/chip-zcl-zpro-codec-api.h index 80ebdf9b7326ea..6c0f0287c830d8 100644 --- a/src/app/chip-zcl-zpro-codec-api.h +++ b/src/app/chip-zcl-zpro-codec-api.h @@ -50,6 +50,7 @@ extern "C" { |------------------------------------------------------------------------------| | Commands: | | | * GoToPercent | 0x00 | +| * Stop | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | | * MovingState | 0x0001 | @@ -65,6 +66,12 @@ extern "C" { uint16_t encodeBarrierControlClusterGoToPercentCommand(uint8_t * buffer, uint16_t buf_length, uint8_t destination_endpoint, uint8_t percentOpen); +/** + * @brief + * Encode an stop command for BarrierControl server into buffer including the APS frame + */ +uint16_t encodeBarrierControlClusterStopCommand(uint8_t * buffer, uint16_t buf_length, uint8_t destination_endpoint); + /** * @brief * Encode a read command for the moving-state attribute for server into buffer including the APS frame diff --git a/src/app/encoder.cpp b/src/app/encoder.cpp index b3a4f985407612..d54901ca8bc410 100644 --- a/src/app/encoder.cpp +++ b/src/app/encoder.cpp @@ -211,6 +211,7 @@ uint16_t encodeReadAttributesCommand(uint8_t * buffer, uint16_t buf_length, uint |------------------------------------------------------------------------------| | Commands: | | | * GoToPercent | 0x00 | +| * Stop | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | | * MovingState | 0x0001 | @@ -231,6 +232,16 @@ uint16_t encodeBarrierControlClusterGoToPercentCommand(uint8_t * buffer, uint16_ COMMAND_FOOTER(kName); } +/* + * Command Stop + */ +uint16_t encodeBarrierControlClusterStopCommand(uint8_t * buffer, uint16_t buf_length, uint8_t destination_endpoint) +{ + const char * kName = "BarrierControlStop"; + COMMAND_HEADER(kName, BARRIER_CONTROL_CLUSTER_ID, 0x01); + COMMAND_FOOTER(kName); +} + /* * Attribute MovingState */