Merge branch 'feature/add-level-color-group-commands' into 'main'

esp-matter: add group send command and cli

See merge request app-frameworks/esp-matter!208
This commit is contained in:
Shu Chen
2022-11-09 10:10:21 +08:00
5 changed files with 834 additions and 39 deletions
+239 -3
View File
@@ -60,7 +60,7 @@ void esp_matter_connection_success_callback(void *context, ExchangeManager & exc
// Only unicast binding needs to establish the connection
if (client_command_callback) {
OperationalDeviceProxy device(&exchangeMgr, sessionHandle);
client_command_callback(&device, cmd_handle->endpoint_id, cmd_handle, command_callback_priv_data);
client_command_callback(&device, cmd_handle, command_callback_priv_data);
}
chip::Platform::Delete(cmd_handle);
}
@@ -92,6 +92,20 @@ esp_err_t connect(uint8_t fabric_index, uint64_t node_id, command_handle_t *cmd_
return ESP_OK;
}
esp_err_t group_command_send(uint8_t fabric_index, command_handle_t *cmd_handle)
{
if (!cmd_handle) {
ESP_LOGE(TAG, "command handle is null");
return ESP_ERR_NO_MEM;
}
if (client_group_command_callback) {
client_group_command_callback(fabric_index, cmd_handle, command_callback_priv_data);
}
return ESP_OK;
}
static void esp_matter_command_client_binding_callback(const EmberBindingTableEntry &binding, OperationalDeviceProxy *peer_device,
void *context)
{
@@ -102,11 +116,13 @@ static void esp_matter_command_client_binding_callback(const EmberBindingTableEn
}
if (binding.type == EMBER_UNICAST_BINDING && !cmd_handle->is_group && peer_device) {
if (client_command_callback) {
client_command_callback(peer_device, binding.remote, cmd_handle, command_callback_priv_data);
cmd_handle->endpoint_id = binding.remote;
client_command_callback(peer_device, cmd_handle, command_callback_priv_data);
}
} else if (binding.type == EMBER_MULTICAST_BINDING && cmd_handle->is_group && !peer_device) {
if (client_group_command_callback) {
client_group_command_callback(binding.fabricIndex, binding.groupId, cmd_handle, command_callback_priv_data);
cmd_handle->group_id = binding.groupId;
client_group_command_callback(binding.fabricIndex, cmd_handle, command_callback_priv_data);
}
}
}
@@ -253,6 +269,21 @@ esp_err_t send_move(peer_device_t *remote_device, uint16_t remote_endpoint_id, u
return ESP_OK;
}
esp_err_t group_send_move(uint8_t fabric_index, uint16_t group_id, uint8_t move_mode, uint8_t rate,
uint8_t option_mask, uint8_t option_override)
{
LevelControl::Commands::Move::Type command_data;
command_data.moveMode = (LevelControl::MoveMode)move_mode;
command_data.rate.SetNonNull(rate);
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
return ESP_OK;
}
esp_err_t send_move_to_level(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t level,
uint16_t transition_time, uint8_t option_mask, uint8_t option_override)
{
@@ -267,6 +298,21 @@ esp_err_t send_move_to_level(peer_device_t *remote_device, uint16_t remote_endpo
return ESP_OK;
}
esp_err_t group_send_move_to_level(uint8_t fabric_index, uint16_t group_id, uint8_t level,
uint16_t transition_time, uint8_t option_mask, uint8_t option_override)
{
LevelControl::Commands::MoveToLevel::Type command_data;
command_data.level = level;
command_data.transitionTime.SetNonNull(transition_time);
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
return ESP_OK;
}
esp_err_t send_move_to_level_with_on_off(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t level,
uint16_t transition_time)
{
@@ -279,6 +325,19 @@ esp_err_t send_move_to_level_with_on_off(peer_device_t *remote_device, uint16_t
return ESP_OK;
}
esp_err_t group_send_move_to_level_with_on_off(uint8_t fabric_index, uint16_t group_id, uint8_t level,
uint16_t transition_time)
{
LevelControl::Commands::MoveToLevelWithOnOff::Type command_data;
command_data.level = level;
command_data.transitionTime.SetNonNull(transition_time);
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
return ESP_OK;
}
esp_err_t send_move_with_on_off(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t move_mode,
uint8_t rate)
{
@@ -291,6 +350,19 @@ esp_err_t send_move_with_on_off(peer_device_t *remote_device, uint16_t remote_en
return ESP_OK;
}
esp_err_t group_send_move_with_on_off(uint8_t fabric_index, uint16_t group_id, uint8_t move_mode,
uint8_t rate)
{
LevelControl::Commands::MoveWithOnOff::Type command_data;
command_data.moveMode = (LevelControl::MoveMode)move_mode;
command_data.rate.SetNonNull(rate);
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
return ESP_OK;
}
esp_err_t send_step(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t step_mode, uint8_t step_size,
uint16_t transition_time, uint8_t option_mask, uint8_t option_override)
{
@@ -306,6 +378,22 @@ esp_err_t send_step(peer_device_t *remote_device, uint16_t remote_endpoint_id, u
return ESP_OK;
}
esp_err_t group_send_step(uint8_t fabric_index, uint16_t group_id, uint8_t step_mode, uint8_t step_size,
uint16_t transition_time, uint8_t option_mask, uint8_t option_override)
{
LevelControl::Commands::Step::Type command_data;
command_data.stepMode = (LevelControl::StepMode)step_mode;
command_data.stepSize = step_size;
command_data.transitionTime.SetNonNull(transition_time);
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
return ESP_OK;
}
esp_err_t send_step_with_on_off(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t step_mode,
uint8_t step_size, uint16_t transition_time)
{
@@ -319,6 +407,20 @@ esp_err_t send_step_with_on_off(peer_device_t *remote_device, uint16_t remote_en
return ESP_OK;
}
esp_err_t group_send_step_with_on_off(uint8_t fabric_index, uint16_t group_id, uint8_t step_mode,
uint8_t step_size, uint16_t transition_time)
{
LevelControl::Commands::StepWithOnOff::Type command_data;
command_data.stepMode = (LevelControl::StepMode)step_mode;
command_data.stepSize = step_size;
command_data.transitionTime.SetNonNull(transition_time);
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
return ESP_OK;
}
esp_err_t send_stop(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t option_mask,
uint8_t option_override)
{
@@ -331,6 +433,19 @@ esp_err_t send_stop(peer_device_t *remote_device, uint16_t remote_endpoint_id, u
return ESP_OK;
}
esp_err_t group_send_stop(uint8_t fabric_index, uint16_t group_id, uint8_t option_mask,
uint8_t option_override)
{
LevelControl::Commands::Stop::Type command_data;
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
return ESP_OK;
}
esp_err_t send_stop_with_on_off(peer_device_t *remote_device, uint16_t remote_endpoint_id)
{
LevelControl::Commands::Stop::Type command_data;
@@ -340,6 +455,16 @@ esp_err_t send_stop_with_on_off(peer_device_t *remote_device, uint16_t remote_en
return ESP_OK;
}
esp_err_t group_send_stop_with_on_off(uint8_t fabric_index, uint16_t group_id)
{
LevelControl::Commands::Stop::Type command_data;
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
return ESP_OK;
}
} /* command */
} /* level_control */
@@ -360,6 +485,21 @@ esp_err_t send_move_hue(peer_device_t *remote_device, uint16_t remote_endpoint_i
return ESP_OK;
}
esp_err_t group_send_move_hue(uint8_t fabric_index, uint16_t group_id, uint8_t move_mode, uint8_t rate, uint8_t option_mask,
uint8_t option_override)
{
ColorControl::Commands::MoveHue::Type command_data;
command_data.moveMode = (ColorControl::HueMoveMode)move_mode;
command_data.rate = rate;
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
return ESP_OK;
}
esp_err_t send_move_saturation(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t move_mode,
uint8_t rate, uint8_t option_mask, uint8_t option_override)
{
@@ -374,6 +514,21 @@ esp_err_t send_move_saturation(peer_device_t *remote_device, uint16_t remote_end
return ESP_OK;
}
esp_err_t group_send_move_saturation(uint8_t fabric_index, uint16_t group_id, uint8_t move_mode,
uint8_t rate, uint8_t option_mask, uint8_t option_override)
{
ColorControl::Commands::MoveSaturation::Type command_data;
command_data.moveMode = (ColorControl::SaturationMoveMode)move_mode;
command_data.rate = rate;
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
return ESP_OK;
}
esp_err_t send_move_to_hue(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t hue, uint8_t direction,
uint16_t transition_time, uint8_t option_mask, uint8_t option_override)
{
@@ -389,6 +544,22 @@ esp_err_t send_move_to_hue(peer_device_t *remote_device, uint16_t remote_endpoin
return ESP_OK;
}
esp_err_t group_send_move_to_hue(uint8_t fabric_index, uint16_t group_id, uint8_t hue, uint8_t direction, uint16_t transition_time,
uint8_t option_mask, uint8_t option_override)
{
ColorControl::Commands::MoveToHue::Type command_data;
command_data.hue = hue;
command_data.direction = (ColorControl::HueDirection)direction;
command_data.transitionTime = transition_time;
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
return ESP_OK;
}
esp_err_t send_move_to_hue_and_saturation(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t hue,
uint8_t saturation, uint16_t transition_time, uint8_t option_mask,
uint8_t option_override)
@@ -405,6 +576,23 @@ esp_err_t send_move_to_hue_and_saturation(peer_device_t *remote_device, uint16_t
return ESP_OK;
}
esp_err_t group_send_move_to_hue_and_saturation(uint8_t fabric_index, uint16_t group_id, uint8_t hue,
uint8_t saturation, uint16_t transition_time, uint8_t option_mask,
uint8_t option_override)
{
ColorControl::Commands::MoveToHueAndSaturation::Type command_data;
command_data.hue = hue;
command_data.saturation = saturation;
command_data.transitionTime = transition_time;
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
return ESP_OK;
}
esp_err_t send_move_to_saturation(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t saturation,
uint16_t transition_time, uint8_t option_mask, uint8_t option_override)
{
@@ -419,6 +607,21 @@ esp_err_t send_move_to_saturation(peer_device_t *remote_device, uint16_t remote_
return ESP_OK;
}
esp_err_t group_send_move_to_saturation(uint8_t fabric_index, uint16_t group_id, uint8_t saturation,
uint16_t transition_time, uint8_t option_mask, uint8_t option_override)
{
ColorControl::Commands::MoveToSaturation::Type command_data;
command_data.saturation = saturation;
command_data.transitionTime = transition_time;
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
return ESP_OK;
}
esp_err_t send_step_hue(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t step_mode, uint8_t step_size,
uint16_t transition_time, uint8_t option_mask, uint8_t option_override)
{
@@ -434,6 +637,22 @@ esp_err_t send_step_hue(peer_device_t *remote_device, uint16_t remote_endpoint_i
return ESP_OK;
}
esp_err_t group_send_step_hue(uint8_t fabric_index, uint16_t group_id, uint8_t step_mode, uint8_t step_size,
uint16_t transition_time, uint8_t option_mask, uint8_t option_override)
{
ColorControl::Commands::StepHue::Type command_data;
command_data.stepMode = (ColorControl::HueStepMode)step_mode;
command_data.stepSize = step_size;
command_data.transitionTime = transition_time;
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
return ESP_OK;
}
esp_err_t send_step_saturation(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t step_mode,
uint8_t step_size, uint16_t transition_time, uint8_t option_mask,
uint8_t option_override)
@@ -450,6 +669,23 @@ esp_err_t send_step_saturation(peer_device_t *remote_device, uint16_t remote_end
return ESP_OK;
}
esp_err_t group_send_step_saturation(uint8_t fabric_index, uint16_t group_id, uint8_t step_mode,
uint8_t step_size, uint16_t transition_time, uint8_t option_mask,
uint8_t option_override)
{
ColorControl::Commands::StepSaturation::Type command_data;
command_data.stepMode = (ColorControl::SaturationStepMode)step_mode;
command_data.stepSize = step_size;
command_data.transitionTime = transition_time;
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
return ESP_OK;
}
} /* command */
} /* color_control */
+32
View File
@@ -54,6 +54,21 @@ esp_err_t send_step_with_on_off(peer_device_t *remote_device, uint16_t remote_en
esp_err_t send_stop(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t option_mask,
uint8_t option_override);
esp_err_t send_stop_with_on_off(peer_device_t *remote_device, uint16_t remote_endpoint_id);
esp_err_t group_send_move(uint8_t fabric_index, uint16_t group_id, uint8_t move_mode, uint8_t rate,
uint8_t option_mask, uint8_t option_override);
esp_err_t group_send_move_to_level(uint8_t fabric_index, uint16_t group_id, uint8_t level,
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
esp_err_t group_send_move_to_level_with_on_off(uint8_t fabric_index, uint16_t group_id, uint8_t level,
uint16_t transition_time);
esp_err_t group_send_move_with_on_off(uint8_t fabric_index, uint16_t group_id, uint8_t move_mode,
uint8_t rate);
esp_err_t group_send_step(uint8_t fabric_index, uint16_t group_id, uint8_t step_mode, uint8_t step_size,
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
esp_err_t group_send_step_with_on_off(uint8_t fabric_index, uint16_t group_id, uint8_t step_mode,
uint8_t step_size, uint16_t transition_time);
esp_err_t group_send_stop(uint8_t fabric_index, uint16_t group_id, uint8_t option_mask,
uint8_t option_override);
esp_err_t group_send_stop_with_on_off(uint8_t fabric_index, uint16_t group_id);
} /* command */
} /* level_control */
@@ -76,6 +91,23 @@ esp_err_t send_step_hue(peer_device_t *remote_device, uint16_t remote_endpoint_i
esp_err_t send_step_saturation(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t step_mode,
uint8_t step_size, uint16_t transition_time, uint8_t option_mask,
uint8_t option_override);
esp_err_t group_send_move_hue(uint8_t fabric_index, uint16_t group_id, uint8_t move_mode, uint8_t rate, uint8_t option_mask,
uint8_t option_override);
esp_err_t group_send_move_saturation(uint8_t fabric_index, uint16_t group_id, uint8_t move_mode,
uint8_t rate, uint8_t option_mask, uint8_t option_override);
esp_err_t group_send_move_to_hue(uint8_t fabric_index, uint16_t group_id, uint8_t hue, uint8_t direction, uint16_t transition_time,
uint8_t option_mask, uint8_t option_override);
esp_err_t group_send_move_to_hue_and_saturation(uint8_t fabric_index, uint16_t group_id, uint8_t hue,
uint8_t saturation, uint16_t transition_time, uint8_t option_mask,
uint8_t option_override);
esp_err_t group_send_move_to_saturation(uint8_t fabric_index, uint16_t group_id, uint8_t saturation,
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
esp_err_t group_send_step_hue(uint8_t fabric_index, uint16_t group_id, uint8_t step_mode, uint8_t step_size,
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
esp_err_t group_send_step_saturation(uint8_t fabric_index, uint16_t group_id, uint8_t step_mode,
uint8_t step_size, uint16_t transition_time, uint8_t option_mask,
uint8_t option_override);
} /* command */
} /* color_control */
+27 -8
View File
@@ -710,15 +710,25 @@ namespace client {
*/
typedef struct command_handle {
uint16_t endpoint_id;
union {
uint16_t endpoint_id;
uint16_t group_id;
};
uint32_t cluster_id;
uint32_t command_id;
void *command_data { NULL };
bool is_group;
command_handle() : endpoint_id(chip::kInvalidEndpointId), cluster_id(chip::kInvalidClusterId),
command_id(chip::kInvalidCommandId), command_data(NULL), is_group(false) {}
command_handle(struct command_handle* cmd) : endpoint_id(cmd->endpoint_id), cluster_id(cmd->cluster_id),
command_id(cmd->command_id), command_data(cmd->command_data), is_group(cmd->is_group) {}
command_handle(struct command_handle* cmd) : cluster_id(cmd->cluster_id), command_id(cmd->command_id),
command_data(cmd->command_data), is_group(cmd->is_group)
{
if (cmd->is_group) {
this->group_id = cmd->group_id;
} else {
this->endpoint_id = cmd->endpoint_id;
}
}
} command_handle_t;
/** Peer device handle */
@@ -730,25 +740,22 @@ typedef chip::DeviceProxy peer_device_t;
* send_command APIs can then be called from the callback.
*
* @param[in] peer_device Peer device handle. This can be passed to the send_command APIs.
* @param[in] remote_endpoint_id Endpoint ID of the other device. This can be passed to the send_command APIs.
* @param[in] cmd_handle Command handle used by `connect()` or `cluster_update()`.
* @param[in] priv_data (Optional) Private data associated with the callback. This will be passed to callback. It
* should stay allocated throughout the lifetime of the device.
*/
typedef void (*command_callback_t)(peer_device_t *peer_device, uint16_t remote_endpoint_id, command_handle_t *cmd_handle,
void *priv_data);
typedef void (*command_callback_t)(peer_device_t *peer_device, command_handle_t *cmd_handle, void *priv_data);
/** Group command send callback
*
* This callback will be called when `cluster_update()` is called and the group command is triggered for binding cluster.
*
* @param[in] fabric_index The index of the fabric that the group command is sent to.
* @param[in] group_id The group_id that the group command is sent to.
* @param[in] cmd_handle Command handle used by `cluster_update()`.
* @param[in] priv_data (Optional) Private data associated with the callback. This will be passed to callback. It
* should stay allocated throughout the lifetime of the device.
*/
typedef void (*group_command_callback_t)(uint8_t fabric_index, uint16_t group_id, command_handle_t *cmd_handle, void *priv_data);
typedef void (*group_command_callback_t)(uint8_t fabric_index, command_handle_t *cmd_handle, void *priv_data);
/** Initialize binding
*
@@ -777,6 +784,18 @@ void binding_manager_init();
*/
esp_err_t connect(uint8_t fabric_index, uint64_t node_id, command_handle_t *cmd_handle);
/** group_command_send
*
* on the same fabric to send a group command.
*
* @param[in] fabric_index Fabric index.
* @param[in] cmd_handle Command to be sent to the group.
*
* @return ESP_OK on success.
* @return error in case of failure.
*/
esp_err_t group_command_send(uint8_t fabric_index, command_handle_t *cmd_handle);
/** Set command send callback
*
* Set the common command send callback and the group command send callback. The common callback will be called
+84 -2
View File
@@ -70,10 +70,72 @@ Update the switch's binding attribute to add the entry of group in the binding t
Switch specific console commands:
- Send command to the specified device on the specified cluster:
(The IDs are in hex):
```
matter esp client invoke <fabric_index> <remote_node_id> <remote_endpoint_id> <cluster_id> <command_id> <parameters>
```
- Example: Off:
```
matter esp client invoke 0x1 0x1234 0x1 0x6 0x0
```
- Example: On:
```
matter esp client invoke 0x1 0x1234 0x1 0x6 0x1
```
- Example: Toggle:
```
matter esp client invoke 0x1 0x1234 0x1 0x6 0x2
```
- Example: Move To Level 0x50:
```
matter esp client invoke 0x1 0x1234 0x1 0x8 0x0 0x50 0x0 0x0 0x0
```
- Example: Move To Hue 0x50:
```
matter esp client invoke 0x1 0x1234 0x1 0x300 0x0 0x50 0x0 0x0 0x0 0x0
```
- Send command to the specified group on the specified cluster:
(The IDs are in hex):
```
matter esp client invoke-group <fabric_index> <group_id> <cluster_id> <command_id> <parameters>
```
- Example: Off:
```
matter esp client invoke-group 0x1 0x101 0x6 0x0
```
- Example: On:
```
matter esp client invoke-group 0x1 0x101 0x6 0x1
```
- Example: Toggle:
```
matter esp client invoke-group 0x1 0x101 0x6 0x2
```
- Example: Move To Level 0x50:
```
matter esp client invoke-group 0x1 0x101 0x8 0x0 0x50 0x0 0x0 0x0
```
- Example: Move To Hue 0x50:
```
matter esp client invoke-group 0x1 0x101 0x300 0x0 0x50 0x0 0x0 0x0 0x0
```
- Send command to all the bound devices on the specified cluster:
(The IDs are in hex):
```
matter esp bound invoke <local_endpoint_id> <cluster_id> <command_id>
matter esp bound invoke <local_endpoint_id> <cluster_id> <command_id> <parameters>
```
- Example: Off:
@@ -91,10 +153,20 @@ Switch specific console commands:
matter esp bound invoke 0x1 0x6 0x2
```
- Example: Move To Level 0x50:
```
matter esp bound invoke 0x1 0x8 0x0 0x50 0x0 0x0 0x0
```
- Example: Move To Hue 0x50:
```
matter esp bound invoke 0x1 0x300 0x0 0x50 0x0 0x0 0x0 0x0
```
- Send command to all the bound groups on the specified cluster:
(The IDs are in hex):
```
matter esp bound invoke-group <local_endpoint_id> <cluster_id> <command_id>
matter esp bound invoke-group <local_endpoint_id> <cluster_id> <command_id> <parameters>
```
- Example: Off:
@@ -112,6 +184,16 @@ Switch specific console commands:
matter esp bound invoke-group 0x1 0x6 0x2
```
- Example: Move To Level 0x50:
```
matter esp bound invoke-group 0x1 0x8 0x0 0x50 0x0 0x0 0x0
```
- Example: Move To Hue 0x50:
```
matter esp bound invoke-group 0x1 0x300 0x0 0x50 0x0 0x0 0x0 0x0
```
## 3. Device Performance
### 3.1 Memory usage
+452 -26
View File
@@ -29,36 +29,66 @@ static const char *TAG = "app_driver";
extern uint16_t switch_endpoint_id;
#if CONFIG_ENABLE_CHIP_SHELL
static char console_buffer[101] = {0};
static esp_err_t app_driver_bound_console_handler(int argc, char **argv)
{
if (argc == 1 && strncmp(argv[0], "help", sizeof("help")) == 0) {
printf("Bound commands:\n"
"\thelp: Print help\n"
"\tinvoke: <local_endpoint_id> <cluster_id> <command_id>. "
"Example: matter esp bound invoke 0x0001 0x0006 0x0002.\n"
"\tinvoke-group: <local_endpoint_id> <cluster_id> <command_id>. "
"Example: matter esp bound invoke-group 0x0001 0x0006 0x0002.\n");
} else if (argc == 4 && strncmp(argv[0], "invoke", sizeof("invoke")) == 0) {
"\tinvoke: <local_endpoint_id> <cluster_id> <command_id> parameters ... \n"
"\t\tExample: matter esp bound invoke 0x0001 0x0008 0x0000 0x50 0x0 0x1 0x1.\n"
"\tinvoke-group: <local_endpoint_id> <cluster_id> <command_id> parameters ...\n"
"\t\tExample: matter esp bound invoke-group 0x0001 0x0008 0x0000 0x50 0x0 0x1 0x1.\n");
} else if (argc >= 4 && strncmp(argv[0], "invoke", sizeof("invoke")) == 0) {
client::command_handle_t cmd_handle;
uint16_t local_endpoint_id = strtol((const char *)&argv[1][2], NULL, 16);
cmd_handle.cluster_id = strtol((const char *)&argv[2][2], NULL, 16);
cmd_handle.command_id = strtol((const char *)&argv[3][2], NULL, 16);
cmd_handle.is_group = false;
if (argc > 4) {
console_buffer[0] = argc - 4;
for (int i = 0; i < (argc - 4); i++) {
if ((argv[4+i][0] != '0') || (argv[4+i][1] != 'x') || (strlen((const char*)&argv[4+i][2]) > 10)) {
ESP_LOGE(TAG, "Incorrect arguments. Check help for more details.");
return ESP_ERR_INVALID_ARG;
}
strcpy((console_buffer + 1 + 10*i), &argv[4+i][2]);
}
cmd_handle.command_data = console_buffer;
}
client::cluster_update(local_endpoint_id, &cmd_handle);
} else if (argc == 4 && strncmp(argv[0], "invoke-group", sizeof("invoke-group")) == 0) {
} else if (argc >= 4 && strncmp(argv[0], "invoke-group", sizeof("invoke-group")) == 0) {
client::command_handle_t cmd_handle;
uint16_t local_endpoint_id = strtol((const char *)&argv[1][2], NULL, 16);
cmd_handle.cluster_id = strtol((const char *)&argv[2][2], NULL, 16);
cmd_handle.command_id = strtol((const char *)&argv[3][2], NULL, 16);
cmd_handle.is_group = true;
if (argc > 4) {
console_buffer[0] = argc - 4;
for (int i = 0; i < (argc - 4); i++) {
if ((argv[4+i][0] != '0') || (argv[4+i][1] != 'x') || (strlen((const char*)&argv[4+i][2]) > 10)) {
ESP_LOGE(TAG, "Incorrect arguments. Check help for more details.");
return ESP_ERR_INVALID_ARG;
}
strcpy((console_buffer + 1 + 10*i), &argv[4+i][2]);
}
cmd_handle.command_data = console_buffer;
}
client::cluster_update(local_endpoint_id, &cmd_handle);
}
else {
ESP_LOGE(TAG, "Incorrect arguments. Check help for more details.");
return ESP_ERR_INVALID_ARG;
}
console_buffer[0] = 0;
return ESP_OK;
}
@@ -67,21 +97,62 @@ static esp_err_t app_driver_client_console_handler(int argc, char **argv)
if (argc == 1 && strncmp(argv[0], "help", sizeof("help")) == 0) {
printf("Client commands:\n"
"\thelp: Print help\n"
"\tinvoke: <fabric_index> <remote_node_id> <remote_endpoint_id> <cluster_id> <command_id>. "
"Example: matter esp client invoke 0x0001 0xBC5C01 0x0001 0x0006 0x0002.\n");
} else if (argc == 6 && strncmp(argv[0], "invoke", sizeof("invoke")) == 0) {
"\tinvoke: <fabric_index> <remote_node_id> <remote_endpoint_id> <cluster_id> <command_id> parameters ... \n"
"\t\tExample: matter esp client invoke 0x0001 0xBC5C01 0x0001 0x0008 0x0000 0x50 0x0 0x1 0x1.\n"
"\tinvoke-group: <fabric_index> <group_id> <cluster_id> <command_id> parameters ... \n"
"\t\tExample: matter esp client invoke-group 0x0001 0x257 0x0008 0x0000 0x50 0x0 0x1 0x1.\n");
} else if (argc >= 6 && strncmp(argv[0], "invoke", sizeof("invoke")) == 0) {
client::command_handle_t cmd_handle;
uint8_t fabric_index = strtol((const char *)&argv[1][2], NULL, 16);
uint64_t node_id = strtol((const char *)&argv[2][2], NULL, 16);
cmd_handle.endpoint_id = strtol((const char *)&argv[3][2], NULL, 16);
cmd_handle.cluster_id = strtol((const char *)&argv[4][2], NULL, 16);
cmd_handle.command_id = strtol((const char *)&argv[5][2], NULL, 16);
cmd_handle.is_group = false;
if (argc > 6) {
console_buffer[0] = argc - 6;
for (int i = 0; i < (argc - 6); i++) {
if ((argv[6+i][0] != '0') || (argv[6+i][1] != 'x') || (strlen((const char*)&argv[6+i][2]) > 10)) {
ESP_LOGE(TAG, "Incorrect arguments. Check help for more details.");
return ESP_ERR_INVALID_ARG;
}
strcpy((console_buffer + 1 + 10*i), &argv[6+i][2]);
}
cmd_handle.command_data = console_buffer;
}
client::connect(fabric_index, node_id, &cmd_handle);
} else {
} else if (argc >= 5 && strncmp(argv[0], "invoke-group", sizeof("invoke-group")) == 0) {
client::command_handle_t cmd_handle;
uint8_t fabric_index = strtol((const char *)&argv[1][2], NULL, 16);
cmd_handle.group_id = strtol((const char *)&argv[2][2], NULL, 16);
cmd_handle.cluster_id = strtol((const char *)&argv[3][2], NULL, 16);
cmd_handle.command_id = strtol((const char *)&argv[4][2], NULL, 16);
cmd_handle.is_group = true;
if (argc > 5) {
console_buffer[0] = argc - 5;
for (int i = 0; i < (argc - 5); i++) {
if ((argv[5+i][0] != '0') || (argv[5+i][1] != 'x') || (strlen((const char*)&argv[5+i][2]) > 10)) {
ESP_LOGE(TAG, "Incorrect arguments. Check help for more details.");
return ESP_ERR_INVALID_ARG;
}
strcpy((console_buffer + 1 + 10*i), &argv[5+i][2]);
}
cmd_handle.command_data = console_buffer;
}
client::group_command_send(fabric_index, &cmd_handle);
}else {
ESP_LOGE(TAG, "Incorrect arguments. Check help for more details.");
return ESP_ERR_INVALID_ARG;
}
console_buffer[0] = 0;
return ESP_OK;
}
@@ -109,30 +180,385 @@ static void app_driver_register_commands()
}
#endif // CONFIG_ENABLE_CHIP_SHELL
void app_driver_client_command_callback(client::peer_device_t *peer_device, uint16_t remote_endpoint_id,
client::command_handle_t *cmd_handle, void *priv_data)
void app_driver_client_command_callback(client::peer_device_t *peer_device, client::command_handle_t *cmd_handle,
void *priv_data)
{
if (cmd_handle->cluster_id == OnOff::Id) {
if (cmd_handle->command_id == OnOff::Commands::Off::Id) {
on_off::command::send_off(peer_device, remote_endpoint_id);
} else if (cmd_handle->command_id == OnOff::Commands::On::Id) {
on_off::command::send_on(peer_device, remote_endpoint_id);
} else if (cmd_handle->command_id == OnOff::Commands::Toggle::Id) {
on_off::command::send_toggle(peer_device, remote_endpoint_id);
switch(cmd_handle->command_id) {
case OnOff::Commands::Off::Id:
{
on_off::command::send_off(peer_device, cmd_handle->endpoint_id);
break;
};
case OnOff::Commands::On::Id:
{
on_off::command::send_on(peer_device, cmd_handle->endpoint_id);
break;
};
case OnOff::Commands::Toggle::Id:
{
on_off::command::send_toggle(peer_device, cmd_handle->endpoint_id);
break;
};
default:
break;
}
} else if (cmd_handle->cluster_id == LevelControl::Id) {
switch(cmd_handle->command_id) {
case LevelControl::Commands::Move::Id:
{
if (((char*)cmd_handle->command_data)[0] != 4) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
level_control::command::send_move(peer_device, cmd_handle->endpoint_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16));
break;
};
case LevelControl::Commands::MoveToLevel::Id:
{
if (((char*)cmd_handle->command_data)[0] != 4) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
level_control::command::send_move_to_level(peer_device, cmd_handle->endpoint_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16));
break;
};
case LevelControl::Commands::Step::Id:
{
if (((char*)cmd_handle->command_data)[0] != 5) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
level_control::command::send_step(peer_device, cmd_handle->endpoint_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 41, NULL, 16));
break;
};
case LevelControl::Commands::Stop::Id:
{
if (((char*)cmd_handle->command_data)[0] != 2) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
level_control::command::send_stop(peer_device, cmd_handle->endpoint_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16));
break;
};
case LevelControl::Commands::MoveWithOnOff::Id:
{
if (((char*)cmd_handle->command_data)[0] != 2) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
level_control::command::send_move_with_on_off(peer_device, cmd_handle->endpoint_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16));
break;
};
case LevelControl::Commands::MoveToLevelWithOnOff::Id:
{
if (((char*)cmd_handle->command_data)[0] != 2) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
level_control::command::send_move_to_level_with_on_off(peer_device, cmd_handle->endpoint_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16));
break;
};
case LevelControl::Commands::StepWithOnOff::Id:
{
if (((char*)cmd_handle->command_data)[0] != 3) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
level_control::command::send_step_with_on_off(peer_device, cmd_handle->endpoint_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16));
break;
};
case LevelControl::Commands::StopWithOnOff::Id:
{
level_control::command::send_stop_with_on_off(peer_device, cmd_handle->endpoint_id);
break;
};
default:
break;
}
} else if (cmd_handle->cluster_id == ColorControl::Id) {
switch(cmd_handle->command_id) {
case ColorControl::Commands::MoveHue::Id:
{
if (((char*)cmd_handle->command_data)[0] != 4) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
color_control::command::send_move_hue(peer_device, cmd_handle->endpoint_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16));
break;
};
case ColorControl::Commands::MoveToHue::Id:
{
if (((char*)cmd_handle->command_data)[0] != 5) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
color_control::command::send_move_to_hue(peer_device, cmd_handle->endpoint_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 41, NULL, 16));
break;
};
case ColorControl::Commands::StepHue::Id:
{
if (((char*)cmd_handle->command_data)[0] != 5) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
color_control::command::send_step_hue(peer_device, cmd_handle->endpoint_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 41, NULL, 16));
break;
};
case ColorControl::Commands::MoveSaturation::Id:
{
if (((char*)cmd_handle->command_data)[0] != 4) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
color_control::command::send_move_saturation(peer_device, cmd_handle->endpoint_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16));
break;
};
case ColorControl::Commands::MoveToSaturation::Id:
{
if (((char*)cmd_handle->command_data)[0] != 4) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
color_control::command::send_move_to_saturation(peer_device, cmd_handle->endpoint_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16));
break;
};
case ColorControl::Commands::StepSaturation::Id:
{
if (((char*)cmd_handle->command_data)[0] != 5) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
color_control::command::send_step_saturation(peer_device, cmd_handle->endpoint_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 41, NULL, 16));
break;
};
case ColorControl::Commands::MoveToHueAndSaturation::Id:
{
if (((char*)cmd_handle->command_data)[0] != 5) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
color_control::command::send_move_to_hue_and_saturation(peer_device, cmd_handle->endpoint_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 41, NULL, 16));
break;
};
default:
ESP_LOGE(TAG, "Unsupported command");
break;
}
}
}
void app_driver_client_group_command_callback(uint8_t fabric_index, uint16_t group_id,
client::command_handle_t *cmd_handle, void *priv_data)
void app_driver_client_group_command_callback(uint8_t fabric_index, client::command_handle_t *cmd_handle, void *priv_data)
{
if (cmd_handle->cluster_id == OnOff::Id) {
if (cmd_handle->command_id == OnOff::Commands::Off::Id) {
on_off::command::group_send_off(fabric_index, group_id);
} else if (cmd_handle->command_id == OnOff::Commands::On::Id) {
on_off::command::group_send_on(fabric_index, group_id);
} else if (cmd_handle->command_id == OnOff::Commands::Toggle::Id) {
on_off::command::group_send_toggle(fabric_index, group_id);
switch(cmd_handle->command_id) {
case OnOff::Commands::Off::Id:
{
on_off::command::group_send_off(fabric_index, cmd_handle->group_id);
break;
};
case OnOff::Commands::On::Id:
{
on_off::command::group_send_on(fabric_index, cmd_handle->group_id);
break;
};
case OnOff::Commands::Toggle::Id:
{
on_off::command::group_send_toggle(fabric_index, cmd_handle->group_id);
break;
};
default:
break;
}
} else if (cmd_handle->cluster_id == LevelControl::Id) {
switch(cmd_handle->command_id) {
case LevelControl::Commands::Move::Id:
{
if (((char*)cmd_handle->command_data)[0] != 4) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
level_control::command::group_send_move(fabric_index, cmd_handle->group_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16));
break;
};
case LevelControl::Commands::MoveToLevel::Id:
{
if (((char*)cmd_handle->command_data)[0] != 4) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
level_control::command::group_send_move_to_level(fabric_index, cmd_handle->group_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16));
break;
};
case LevelControl::Commands::Step::Id:
{
if (((char*)cmd_handle->command_data)[0] != 5) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
level_control::command::group_send_step(fabric_index, cmd_handle->group_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 41, NULL, 16));
break;
};
case LevelControl::Commands::Stop::Id:
{
if (((char*)cmd_handle->command_data)[0] != 2) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
level_control::command::group_send_stop(fabric_index, cmd_handle->group_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16));
break;
};
case LevelControl::Commands::MoveWithOnOff::Id:
{
if (((char*)cmd_handle->command_data)[0] != 2) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
level_control::command::group_send_move_with_on_off(fabric_index, cmd_handle->group_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16));
break;
};
case LevelControl::Commands::MoveToLevelWithOnOff::Id:
{
if (((char*)cmd_handle->command_data)[0] != 2) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
level_control::command::group_send_move_to_level_with_on_off(fabric_index, cmd_handle->group_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16));
break;
};
case LevelControl::Commands::StepWithOnOff::Id:
{
if (((char*)cmd_handle->command_data)[0] != 3) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
level_control::command::group_send_step_with_on_off(fabric_index, cmd_handle->group_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16));
break;
};
case LevelControl::Commands::StopWithOnOff::Id:
{
level_control::command::group_send_stop_with_on_off(fabric_index, cmd_handle->group_id);
break;
};
default:
break;
}
} else if (cmd_handle->cluster_id == ColorControl::Id) {
switch(cmd_handle->command_id) {
case ColorControl::Commands::MoveHue::Id:
{
if (((char*)cmd_handle->command_data)[0] != 4) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
color_control::command::group_send_move_hue(fabric_index, cmd_handle->group_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16));
break;
};
case ColorControl::Commands::MoveToHue::Id:
{
if (((char*)cmd_handle->command_data)[0] != 5) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
color_control::command::group_send_move_to_hue(fabric_index, cmd_handle->group_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 41, NULL, 16));
break;
};
case ColorControl::Commands::StepHue::Id:
{
if (((char*)cmd_handle->command_data)[0] != 5) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
color_control::command::group_send_step_hue(fabric_index, cmd_handle->group_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 41, NULL, 16));
break;
};
case ColorControl::Commands::MoveSaturation::Id:
{
if (((char*)cmd_handle->command_data)[0] != 4) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
color_control::command::group_send_move_saturation(fabric_index, cmd_handle->group_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16));
break;
};
case ColorControl::Commands::MoveToSaturation::Id:
{
if (((char*)cmd_handle->command_data)[0] != 4) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
color_control::command::group_send_move_to_saturation(fabric_index, cmd_handle->group_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16));
break;
};
case ColorControl::Commands::StepSaturation::Id:
{
if (((char*)cmd_handle->command_data)[0] != 5) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
color_control::command::group_send_step_saturation(fabric_index, cmd_handle->group_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 41, NULL, 16));
break;
};
case ColorControl::Commands::MoveToHueAndSaturation::Id:
{
if (((char*)cmd_handle->command_data)[0] != 5) {
ESP_LOGE(TAG, "Number of parameters error");
return;
}
color_control::command::group_send_move_to_hue_and_saturation(fabric_index, cmd_handle->group_id, strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 11, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 21, NULL, 16),
strtol((const char *)(cmd_handle->command_data) + 31, NULL, 16), strtol((const char *)(cmd_handle->command_data) + 41, NULL, 16));
break;
};
default:
ESP_LOGE(TAG, "Unsupported command");
break;
}
}
}