mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Merge branch 'client/add_mandatory_commands' into 'main'
client: Add mandatory commands suppport for client clusters See merge request app-frameworks/esp-matter!264
This commit is contained in:
@@ -20,17 +20,17 @@
|
||||
#include <zap-generated/CHIPClusters.h>
|
||||
|
||||
using namespace chip::app::Clusters;
|
||||
using chip::BitMask;
|
||||
using chip::DeviceProxy;
|
||||
using chip::FabricInfo;
|
||||
using chip::kInvalidEndpointId;
|
||||
using chip::OperationalDeviceProxy;
|
||||
using chip::OperationalSessionSetup;
|
||||
using chip::SessionHandle;
|
||||
using chip::ScopedNodeId;
|
||||
using chip::Server;
|
||||
using chip::Messaging::ExchangeManager;
|
||||
using chip::SessionHandle;
|
||||
using chip::Callback::Callback;
|
||||
using chip::BitMask;
|
||||
using chip::Messaging::ExchangeManager;
|
||||
|
||||
static const char *TAG = "esp_matter_client";
|
||||
|
||||
@@ -50,7 +50,7 @@ esp_err_t set_command_callback(command_callback_t callback, group_command_callba
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
void esp_matter_connection_success_callback(void *context, ExchangeManager & exchangeMgr, SessionHandle & sessionHandle)
|
||||
void esp_matter_connection_success_callback(void *context, ExchangeManager &exchangeMgr, SessionHandle &sessionHandle)
|
||||
{
|
||||
command_handle_t *cmd_handle = static_cast<command_handle_t *>(context);
|
||||
if (!cmd_handle) {
|
||||
@@ -66,7 +66,7 @@ void esp_matter_connection_success_callback(void *context, ExchangeManager & exc
|
||||
chip::Platform::Delete(cmd_handle);
|
||||
}
|
||||
|
||||
void esp_matter_connection_failure_callback(void *context, const ScopedNodeId & peerId, CHIP_ERROR error)
|
||||
void esp_matter_connection_failure_callback(void *context, const ScopedNodeId &peerId, CHIP_ERROR error)
|
||||
{
|
||||
command_handle_t *cmd_handle = static_cast<command_handle_t *>(context);
|
||||
ESP_LOGI(TAG, "New connection failure");
|
||||
@@ -87,7 +87,7 @@ esp_err_t connect(uint8_t fabric_index, uint64_t node_id, command_handle_t *cmd_
|
||||
}
|
||||
success_callback.mContext = static_cast<void *>(context);
|
||||
failure_callback.mContext = static_cast<void *>(context);
|
||||
Server * server = &(chip::Server::GetInstance());
|
||||
Server *server = &(chip::Server::GetInstance());
|
||||
server->GetCASESessionManager()->FindOrEstablishSession(ScopedNodeId(node_id, fabric_index), &success_callback,
|
||||
&failure_callback);
|
||||
return ESP_OK;
|
||||
@@ -107,8 +107,8 @@ esp_err_t group_command_send(uint8_t fabric_index, command_handle_t *cmd_handle)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static void esp_matter_command_client_binding_callback(const EmberBindingTableEntry &binding, OperationalDeviceProxy *peer_device,
|
||||
void *context)
|
||||
static void esp_matter_command_client_binding_callback(const EmberBindingTableEntry &binding,
|
||||
OperationalDeviceProxy *peer_device, void *context)
|
||||
{
|
||||
command_handle_t *cmd_handle = static_cast<command_handle_t *>(context);
|
||||
if (!cmd_handle) {
|
||||
@@ -179,7 +179,7 @@ void binding_init()
|
||||
{
|
||||
initialize_binding_manager = true;
|
||||
}
|
||||
} /* client */
|
||||
} // namespace client
|
||||
|
||||
namespace cluster {
|
||||
using client::peer_device_t;
|
||||
@@ -201,7 +201,8 @@ esp_err_t send_on(peer_device_t *remote_device, uint16_t remote_endpoint_id)
|
||||
{
|
||||
OnOff::Commands::On::Type command_data;
|
||||
|
||||
chip::Controller::OnOffCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::OnOffCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -209,7 +210,7 @@ esp_err_t send_on(peer_device_t *remote_device, uint16_t remote_endpoint_id)
|
||||
esp_err_t group_send_on(uint8_t fabric_index, uint16_t group_id)
|
||||
{
|
||||
OnOff::Commands::On::Type command_data;
|
||||
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
chip::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
@@ -219,7 +220,8 @@ esp_err_t send_off(peer_device_t *remote_device, uint16_t remote_endpoint_id)
|
||||
{
|
||||
OnOff::Commands::Off::Type command_data;
|
||||
|
||||
chip::Controller::OnOffCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::OnOffCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -227,7 +229,7 @@ esp_err_t send_off(peer_device_t *remote_device, uint16_t remote_endpoint_id)
|
||||
esp_err_t group_send_off(uint8_t fabric_index, uint16_t group_id)
|
||||
{
|
||||
OnOff::Commands::Off::Type command_data;
|
||||
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
chip::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
@@ -237,7 +239,8 @@ esp_err_t send_toggle(peer_device_t *remote_device, uint16_t remote_endpoint_id)
|
||||
{
|
||||
OnOff::Commands::Toggle::Type command_data;
|
||||
|
||||
chip::Controller::OnOffCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::OnOffCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -245,14 +248,14 @@ esp_err_t send_toggle(peer_device_t *remote_device, uint16_t remote_endpoint_id)
|
||||
esp_err_t group_send_toggle(uint8_t fabric_index, uint16_t group_id)
|
||||
{
|
||||
OnOff::Commands::Toggle::Type command_data;
|
||||
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
chip::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
} /* command */
|
||||
} /* on_off */
|
||||
} // namespace command
|
||||
} // namespace on_off
|
||||
|
||||
namespace level_control {
|
||||
namespace command {
|
||||
@@ -266,13 +269,14 @@ esp_err_t send_move(peer_device_t *remote_device, uint16_t remote_endpoint_id, u
|
||||
command_data.optionsMask.SetRaw(option_mask);
|
||||
command_data.optionsOverride.SetRaw(option_override);
|
||||
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
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)
|
||||
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;
|
||||
@@ -280,7 +284,7 @@ esp_err_t group_send_move(uint8_t fabric_index, uint16_t group_id, uint8_t move_
|
||||
command_data.optionsMask.SetRaw(option_mask);
|
||||
command_data.optionsOverride.SetRaw(option_override);
|
||||
|
||||
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
chip::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
@@ -295,13 +299,14 @@ esp_err_t send_move_to_level(peer_device_t *remote_device, uint16_t remote_endpo
|
||||
command_data.optionsMask.SetRaw(option_mask);
|
||||
command_data.optionsOverride.SetRaw(option_override);
|
||||
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
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)
|
||||
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;
|
||||
@@ -309,7 +314,7 @@ esp_err_t group_send_move_to_level(uint8_t fabric_index, uint16_t group_id, uint
|
||||
command_data.optionsMask.SetRaw(option_mask);
|
||||
command_data.optionsOverride.SetRaw(option_override);
|
||||
|
||||
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
chip::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
@@ -322,19 +327,20 @@ esp_err_t send_move_to_level_with_on_off(peer_device_t *remote_device, uint16_t
|
||||
command_data.level = level;
|
||||
command_data.transitionTime.SetNonNull(transition_time);
|
||||
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
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)
|
||||
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::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
@@ -347,19 +353,19 @@ esp_err_t send_move_with_on_off(peer_device_t *remote_device, uint16_t remote_en
|
||||
command_data.moveMode = (LevelControl::MoveMode)move_mode;
|
||||
command_data.rate.SetNonNull(rate);
|
||||
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
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)
|
||||
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::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
@@ -375,13 +381,14 @@ esp_err_t send_step(peer_device_t *remote_device, uint16_t remote_endpoint_id, u
|
||||
command_data.optionsMask.SetRaw(option_mask);
|
||||
command_data.optionsOverride.SetRaw(option_override);
|
||||
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
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)
|
||||
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;
|
||||
@@ -390,7 +397,7 @@ esp_err_t group_send_step(uint8_t fabric_index, uint16_t group_id, uint8_t step_
|
||||
command_data.optionsMask.SetRaw(option_mask);
|
||||
command_data.optionsOverride.SetRaw(option_override);
|
||||
|
||||
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
chip::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
@@ -404,20 +411,21 @@ esp_err_t send_step_with_on_off(peer_device_t *remote_device, uint16_t remote_en
|
||||
command_data.stepSize = step_size;
|
||||
command_data.transitionTime.SetNonNull(transition_time);
|
||||
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
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)
|
||||
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::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
@@ -430,19 +438,19 @@ esp_err_t send_stop(peer_device_t *remote_device, uint16_t remote_endpoint_id, u
|
||||
command_data.optionsMask.SetRaw(option_mask);
|
||||
command_data.optionsOverride.SetRaw(option_override);
|
||||
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
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)
|
||||
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.SetRaw(option_mask);
|
||||
command_data.optionsOverride.SetRaw(option_override);
|
||||
|
||||
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
chip::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
@@ -452,7 +460,8 @@ esp_err_t send_stop_with_on_off(peer_device_t *remote_device, uint16_t remote_en
|
||||
{
|
||||
LevelControl::Commands::Stop::Type command_data;
|
||||
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::LevelControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -461,14 +470,14 @@ 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::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 */
|
||||
} // namespace command
|
||||
} // namespace level_control
|
||||
|
||||
namespace color_control {
|
||||
namespace command {
|
||||
@@ -482,13 +491,14 @@ esp_err_t send_move_hue(peer_device_t *remote_device, uint16_t remote_endpoint_i
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
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)
|
||||
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;
|
||||
@@ -496,7 +506,7 @@ esp_err_t group_send_move_hue(uint8_t fabric_index, uint16_t group_id, uint8_t m
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
chip::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
@@ -511,13 +521,14 @@ esp_err_t send_move_saturation(peer_device_t *remote_device, uint16_t remote_end
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
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)
|
||||
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;
|
||||
@@ -525,7 +536,7 @@ esp_err_t group_send_move_saturation(uint8_t fabric_index, uint16_t group_id, ui
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
chip::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
@@ -541,13 +552,14 @@ esp_err_t send_move_to_hue(peer_device_t *remote_device, uint16_t remote_endpoin
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
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)
|
||||
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;
|
||||
@@ -556,7 +568,7 @@ esp_err_t group_send_move_to_hue(uint8_t fabric_index, uint16_t group_id, uint8_
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
chip::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
@@ -573,14 +585,15 @@ esp_err_t send_move_to_hue_and_saturation(peer_device_t *remote_device, uint16_t
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
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)
|
||||
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;
|
||||
@@ -589,7 +602,7 @@ esp_err_t group_send_move_to_hue_and_saturation(uint8_t fabric_index, uint16_t g
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
chip::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
@@ -604,13 +617,14 @@ esp_err_t send_move_to_saturation(peer_device_t *remote_device, uint16_t remote_
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
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)
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override)
|
||||
{
|
||||
ColorControl::Commands::MoveToSaturation::Type command_data;
|
||||
command_data.saturation = saturation;
|
||||
@@ -618,7 +632,7 @@ esp_err_t group_send_move_to_saturation(uint8_t fabric_index, uint16_t group_id,
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
chip::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
@@ -634,13 +648,14 @@ esp_err_t send_step_hue(peer_device_t *remote_device, uint16_t remote_endpoint_i
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
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)
|
||||
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;
|
||||
@@ -649,7 +664,7 @@ esp_err_t group_send_step_hue(uint8_t fabric_index, uint16_t group_id, uint8_t s
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
chip::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
@@ -666,14 +681,14 @@ esp_err_t send_step_saturation(peer_device_t *remote_device, uint16_t remote_end
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(), remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
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)
|
||||
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;
|
||||
@@ -682,14 +697,273 @@ esp_err_t group_send_step_saturation(uint8_t fabric_index, uint16_t group_id, ui
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Messaging::ExchangeManager & exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
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 */
|
||||
esp_err_t send_move_to_color(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t color_x,
|
||||
uint16_t color_y, uint16_t transition_time, uint8_t option_mask, uint8_t option_override)
|
||||
{
|
||||
ColorControl::Commands::MoveToColor::Type command_data;
|
||||
command_data.colorX = color_x;
|
||||
command_data.colorY = color_y;
|
||||
command_data.transitionTime = transition_time;
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
} /* cluster */
|
||||
} /* esp_matter */
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t group_send_move_to_color(uint8_t fabric_index, uint16_t group_id, uint16_t color_x, uint16_t color_y,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override)
|
||||
{
|
||||
ColorControl::Commands::MoveToColor::Type command_data;
|
||||
command_data.colorX = color_x;
|
||||
command_data.colorY = color_y;
|
||||
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_color(peer_device_t *remote_device, uint16_t remote_endpoint_id, int16_t rate_x, int16_t rate_y,
|
||||
uint8_t option_mask, uint8_t option_override)
|
||||
{
|
||||
ColorControl::Commands::MoveColor::Type command_data;
|
||||
command_data.rateX = rate_x;
|
||||
command_data.rateY = rate_y;
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t group_send_move_color(uint8_t fabric_index, uint16_t group_id, int16_t rate_x, int16_t rate_y,
|
||||
uint8_t option_mask, uint8_t option_override)
|
||||
{
|
||||
ColorControl::Commands::MoveColor::Type command_data;
|
||||
command_data.rateX = rate_x;
|
||||
command_data.rateY = rate_y;
|
||||
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_color(peer_device_t *remote_device, uint16_t remote_endpoint_id, int16_t step_x, int16_t step_y,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override)
|
||||
{
|
||||
ColorControl::Commands::StepColor::Type command_data;
|
||||
command_data.stepX = step_x;
|
||||
command_data.stepY = step_y;
|
||||
command_data.transitionTime = transition_time;
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t group_send_step_color(uint8_t fabric_index, uint16_t group_id, int16_t step_x, int16_t step_y,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override)
|
||||
{
|
||||
ColorControl::Commands::StepColor::Type command_data;
|
||||
command_data.stepX = step_x;
|
||||
command_data.stepY = step_y;
|
||||
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_color_temperature(peer_device_t *remote_device, uint16_t remote_endpoint_id,
|
||||
uint16_t color_temperature_mireds, uint16_t transition_time,
|
||||
uint8_t option_mask, uint8_t option_override)
|
||||
{
|
||||
ColorControl::Commands::MoveToColorTemperature::Type command_data;
|
||||
command_data.colorTemperature = color_temperature_mireds;
|
||||
command_data.transitionTime = transition_time;
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t group_send_move_to_color_temperature(uint8_t fabric_index, uint16_t group_id,
|
||||
uint16_t color_temperature_mireds, uint16_t transition_time,
|
||||
uint8_t option_mask, uint8_t option_override)
|
||||
{
|
||||
ColorControl::Commands::MoveToColorTemperature::Type command_data;
|
||||
command_data.colorTemperature = color_temperature_mireds;
|
||||
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_stop_move_step(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t option_mask,
|
||||
uint8_t option_override)
|
||||
{
|
||||
ColorControl::Commands::StopMoveStep::Type command_data;
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t group_send_stop_move_step(uint8_t fabric_index, uint16_t group_id, uint8_t option_mask,
|
||||
uint8_t option_override)
|
||||
{
|
||||
ColorControl::Commands::StopMoveStep::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_move_color_temperature(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t move_mode,
|
||||
uint16_t rate, uint16_t color_temperature_minimum_mireds,
|
||||
uint16_t color_temperature_maximum_mireds, uint8_t option_mask,
|
||||
uint8_t option_override)
|
||||
{
|
||||
ColorControl::Commands::MoveColorTemperature::Type command_data;
|
||||
command_data.moveMode = static_cast<ColorControl::HueMoveMode>(move_mode);
|
||||
command_data.rate = rate;
|
||||
command_data.colorTemperatureMinimumMireds = color_temperature_minimum_mireds;
|
||||
command_data.colorTemperatureMaximumMireds = color_temperature_maximum_mireds;
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t group_send_move_color_temperature(uint8_t fabric_index, uint16_t group_id, uint8_t move_mode, uint16_t rate,
|
||||
uint16_t color_temperature_minimum_mireds,
|
||||
uint16_t color_temperature_maximum_mireds, uint8_t option_mask,
|
||||
uint8_t option_override)
|
||||
{
|
||||
ColorControl::Commands::MoveColorTemperature::Type command_data;
|
||||
command_data.moveMode = static_cast<ColorControl::HueMoveMode>(move_mode);
|
||||
command_data.rate = rate;
|
||||
command_data.colorTemperatureMinimumMireds = color_temperature_minimum_mireds;
|
||||
command_data.colorTemperatureMaximumMireds = color_temperature_maximum_mireds;
|
||||
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_color_temperature(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t step_mode,
|
||||
uint16_t step_size, uint16_t transition_time,
|
||||
uint16_t color_temperature_minimum_mireds,
|
||||
uint16_t color_temperature_maximum_mireds, uint8_t option_mask,
|
||||
uint8_t option_override)
|
||||
{
|
||||
ColorControl::Commands::StepColorTemperature::Type command_data;
|
||||
command_data.stepMode = static_cast<ColorControl::HueStepMode>(step_mode);
|
||||
command_data.stepSize = step_size;
|
||||
command_data.transitionTime = transition_time;
|
||||
command_data.colorTemperatureMinimumMireds = color_temperature_minimum_mireds;
|
||||
command_data.colorTemperatureMaximumMireds = color_temperature_maximum_mireds;
|
||||
command_data.optionsMask = option_mask;
|
||||
command_data.optionsOverride = option_override;
|
||||
|
||||
chip::Controller::ColorControlCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t group_send_step_color_temperature(uint8_t fabric_index, uint16_t group_id, uint8_t step_mode,
|
||||
uint16_t step_size, uint16_t transition_time,
|
||||
uint16_t color_temperature_minimum_mireds,
|
||||
uint16_t color_temperature_maximum_mireds, uint8_t option_mask,
|
||||
uint8_t option_override)
|
||||
{
|
||||
ColorControl::Commands::StepColorTemperature::Type command_data;
|
||||
command_data.stepMode = static_cast<ColorControl::HueStepMode>(step_mode);
|
||||
command_data.stepSize = step_size;
|
||||
command_data.transitionTime = transition_time;
|
||||
command_data.colorTemperatureMinimumMireds = color_temperature_minimum_mireds;
|
||||
command_data.colorTemperatureMaximumMireds = color_temperature_maximum_mireds;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
} // namespace command
|
||||
} // namespace color_control
|
||||
|
||||
namespace identify {
|
||||
namespace command {
|
||||
esp_err_t send_identify(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t identify_time)
|
||||
{
|
||||
Identify::Commands::Identify::Type command_data;
|
||||
command_data.identifyTime = identify_time;
|
||||
|
||||
chip::Controller::IdentifyCluster cluster(*remote_device->GetExchangeManager(),
|
||||
remote_device->GetSecureSession().Value(), remote_endpoint_id);
|
||||
cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t group_send_identify(uint8_t fabric_index, uint16_t group_id, uint16_t identify_time)
|
||||
{
|
||||
Identify::Commands::Identify::Type command_data;
|
||||
command_data.identifyTime = identify_time;
|
||||
|
||||
chip::Messaging::ExchangeManager &exchange_mgr = chip::Server::GetInstance().GetExchangeManager();
|
||||
|
||||
chip::Controller::InvokeGroupCommandRequest(&exchange_mgr, fabric_index, group_id, command_data);
|
||||
return ESP_OK;
|
||||
}
|
||||
} // namespace command
|
||||
} // namespace identify
|
||||
|
||||
} // namespace cluster
|
||||
} // namespace esp_matter
|
||||
|
||||
@@ -34,8 +34,8 @@ esp_err_t send_toggle(peer_device_t *remote_device, uint16_t remote_endpoint_id)
|
||||
esp_err_t group_send_off(uint8_t fabric_index, uint16_t group_id);
|
||||
esp_err_t group_send_on(uint8_t fabric_index, uint16_t group_id);
|
||||
esp_err_t group_send_toggle(uint8_t fabric_index, uint16_t group_id);
|
||||
} /* command */
|
||||
} /* on_off */
|
||||
} // namespace command
|
||||
} // namespace on_off
|
||||
|
||||
namespace level_control {
|
||||
namespace command {
|
||||
@@ -54,31 +54,28 @@ 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(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);
|
||||
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);
|
||||
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 */
|
||||
} // namespace command
|
||||
} // namespace level_control
|
||||
|
||||
namespace color_control {
|
||||
namespace command {
|
||||
esp_err_t send_move_hue(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);
|
||||
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);
|
||||
uint8_t rate, uint8_t option_mask, uint8_t option_override);
|
||||
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);
|
||||
esp_err_t send_move_to_hue_and_saturation(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t hue,
|
||||
@@ -91,25 +88,73 @@ 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 send_move_to_color(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t color_x,
|
||||
uint16_t color_y, uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t send_move_color(peer_device_t *remote_device, uint16_t remote_endpoint_id, int16_t rate_x, int16_t rate_y,
|
||||
uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t send_step_color(peer_device_t *remote_device, uint16_t remote_endpoint_id, int16_t step_x, int16_t step_y,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t send_move_to_color_temperature(peer_device_t *remote_device, uint16_t remote_endpoint_id,
|
||||
uint16_t color_temperature_mireds, uint16_t transition_time,
|
||||
uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t send_stop_move_step(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t option_mask,
|
||||
uint8_t option_override);
|
||||
esp_err_t send_move_color_temperature(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t move_mode,
|
||||
uint16_t rate, uint16_t color_temperature_minimum_mireds,
|
||||
uint16_t color_temperature_maximum_mireds, uint8_t option_mask,
|
||||
uint8_t option_override);
|
||||
esp_err_t send_step_color_temperature(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t step_mode,
|
||||
uint16_t step_size, uint16_t transition_time,
|
||||
uint16_t color_temperature_minimum_mireds,
|
||||
uint16_t color_temperature_maximum_mireds, 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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
esp_err_t group_send_move_to_color(uint8_t fabric_index, uint16_t group_id, uint16_t color_x, uint16_t color_y,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_move_color(uint8_t fabric_index, uint16_t group_id, int16_t rate_x, int16_t rate_y,
|
||||
uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_step_color(uint8_t fabric_index, uint16_t group_id, int16_t step_x, int16_t step_y,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_move_to_color_temperature(uint8_t fabric_index, uint16_t group_id,
|
||||
uint16_t color_temperature_mireds, uint16_t transition_time,
|
||||
uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_stop_move_step(uint8_t fabric_index, uint16_t group_id, uint8_t option_mask,
|
||||
uint8_t option_override);
|
||||
esp_err_t group_send_move_color_temperature(uint8_t fabric_index, uint16_t group_id, uint8_t move_mode, uint16_t rate,
|
||||
uint16_t color_temperature_minimum_mireds,
|
||||
uint16_t color_temperature_maximum_mireds, uint8_t option_mask,
|
||||
uint8_t option_override);
|
||||
esp_err_t group_send_step_color_temperature(uint8_t fabric_index, uint16_t group_id, uint8_t step_mode,
|
||||
uint16_t step_size, uint16_t transition_time,
|
||||
uint16_t color_temperature_minimum_mireds,
|
||||
uint16_t color_temperature_maximum_mireds, uint8_t option_mask,
|
||||
uint8_t option_override);
|
||||
|
||||
} /* command */
|
||||
} /* color_control */
|
||||
} // namespace command
|
||||
} // namespace color_control
|
||||
|
||||
} /* cluster */
|
||||
} /* esp_matter */
|
||||
namespace identify {
|
||||
namespace command {
|
||||
esp_err_t send_identify(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t identify_time);
|
||||
|
||||
esp_err_t group_send_identify(uint8_t fabric_index, uint16_t group_id, uint16_t identify_time);
|
||||
} // namespace command
|
||||
} // namespace identify
|
||||
|
||||
} // namespace cluster
|
||||
} // namespace esp_matter
|
||||
|
||||
@@ -91,14 +91,9 @@ Switch specific console commands:
|
||||
matter esp client invoke 0x1 0x5164 0x1 0x6 0x2
|
||||
```
|
||||
|
||||
- Example: Move To Level 0x50:
|
||||
- Example: Identify 0x78:
|
||||
```
|
||||
matter esp client invoke 0x1 0x5164 0x1 0x8 0x0 0x50 0x0 0x0 0x0
|
||||
```
|
||||
|
||||
- Example: Move To Hue 0x50:
|
||||
```
|
||||
matter esp client invoke 0x1 0x5164 0x1 0x300 0x0 0x50 0x0 0x0 0x0 0x0
|
||||
matter esp client invoke 0x1 0x5164 0x1 0x3 0x78
|
||||
```
|
||||
|
||||
- Send command to the specified group on the specified cluster:
|
||||
@@ -122,15 +117,11 @@ Switch specific console commands:
|
||||
matter esp client invoke-group 0x1 0x101 0x6 0x2
|
||||
|
||||
```
|
||||
- Example: Move To Level 0x50:
|
||||
- Example: Identify 0x78:
|
||||
```
|
||||
matter esp client invoke-group 0x1 0x101 0x8 0x0 0x50 0x0 0x0 0x0
|
||||
matter esp client invoke-group 0x1 0x101 0x3 0x78
|
||||
|
||||
```
|
||||
- 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):
|
||||
@@ -153,14 +144,9 @@ Switch specific console commands:
|
||||
matter esp bound invoke 0x1 0x6 0x2
|
||||
```
|
||||
|
||||
- Example: Move To Level 0x50:
|
||||
- Example: Identify 0x78:
|
||||
```
|
||||
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
|
||||
matter esp bound invoke 0x1 0x3 0x78
|
||||
```
|
||||
|
||||
- Send command to all the bound groups on the specified cluster:
|
||||
@@ -184,14 +170,9 @@ Switch specific console commands:
|
||||
matter esp bound invoke-group 0x1 0x6 0x2
|
||||
```
|
||||
|
||||
- Example: Move To Level 0x50:
|
||||
- Example: Identify 0x78:
|
||||
```
|
||||
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
|
||||
matter esp bound invoke-group 0x1 0x3 0x78
|
||||
```
|
||||
|
||||
## 3. Device Performance
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#include <esp_matter_console.h>
|
||||
#include <led_driver.h>
|
||||
|
||||
#include <app_reset.h>
|
||||
#include <app_priv.h>
|
||||
#include <app_reset.h>
|
||||
|
||||
using chip::kInvalidClusterId;
|
||||
static constexpr chip::CommandId kInvalidCommandId = 0xFFFF'FFFF;
|
||||
@@ -36,9 +36,9 @@ static esp_err_t app_driver_bound_console_handler(int argc, char **argv)
|
||||
printf("Bound commands:\n"
|
||||
"\thelp: Print help\n"
|
||||
"\tinvoke: <local_endpoint_id> <cluster_id> <command_id> parameters ... \n"
|
||||
"\t\tExample: matter esp bound invoke 0x0001 0x0008 0x0000 0x50 0x0 0x1 0x1.\n"
|
||||
"\t\tExample: matter esp bound invoke 0x0001 0x0003 0x0000 0x78.\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");
|
||||
"\t\tExample: matter esp bound invoke-group 0x0001 0x0003 0x0000 0x78.\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);
|
||||
@@ -47,16 +47,17 @@ static esp_err_t app_driver_bound_console_handler(int argc, char **argv)
|
||||
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)) {
|
||||
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]);
|
||||
}
|
||||
strcpy((console_buffer + 1 + 10 * i), &argv[4 + i][2]);
|
||||
}
|
||||
|
||||
cmd_handle.command_data = console_buffer;
|
||||
cmd_handle.command_data = console_buffer;
|
||||
}
|
||||
|
||||
client::cluster_update(local_endpoint_id, &cmd_handle);
|
||||
@@ -68,27 +69,25 @@ static esp_err_t app_driver_bound_console_handler(int argc, char **argv)
|
||||
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)) {
|
||||
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]);
|
||||
}
|
||||
strcpy((console_buffer + 1 + 10 * i), &argv[4 + i][2]);
|
||||
}
|
||||
|
||||
cmd_handle.command_data = console_buffer;
|
||||
cmd_handle.command_data = console_buffer;
|
||||
}
|
||||
|
||||
client::cluster_update(local_endpoint_id, &cmd_handle);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Incorrect arguments. Check help for more details.");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
console_buffer[0] = 0;
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@@ -97,10 +96,11 @@ 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> parameters ... \n"
|
||||
"\t\tExample: matter esp client invoke 0x0001 0xBC5C01 0x0001 0x0008 0x0000 0x50 0x0 0x1 0x1.\n"
|
||||
"\tinvoke: <fabric_index> <remote_node_id> <remote_endpoint_id> <cluster_id> <command_id> parameters "
|
||||
"... \n"
|
||||
"\t\tExample: matter esp client invoke 0x0001 0xBC5C01 0x0001 0x0003 0x0000 0x78.\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");
|
||||
"\t\tExample: matter esp client invoke-group 0x0001 0x257 0x0003 0x0000 0x78.\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);
|
||||
@@ -111,16 +111,17 @@ static esp_err_t app_driver_client_console_handler(int argc, char **argv)
|
||||
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)) {
|
||||
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]);
|
||||
}
|
||||
strcpy((console_buffer + 1 + 10 * i), &argv[6 + i][2]);
|
||||
}
|
||||
|
||||
cmd_handle.command_data = console_buffer;
|
||||
cmd_handle.command_data = console_buffer;
|
||||
}
|
||||
|
||||
client::connect(fabric_index, node_id, &cmd_handle);
|
||||
@@ -133,26 +134,25 @@ static esp_err_t app_driver_client_console_handler(int argc, char **argv)
|
||||
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)) {
|
||||
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]);
|
||||
}
|
||||
strcpy((console_buffer + 1 + 10 * i), &argv[5 + i][2]);
|
||||
}
|
||||
|
||||
cmd_handle.command_data = console_buffer;
|
||||
cmd_handle.command_data = console_buffer;
|
||||
}
|
||||
|
||||
client::group_command_send(fabric_index, &cmd_handle);
|
||||
}else {
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Incorrect arguments. Check help for more details.");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
console_buffer[0] = 0;
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@@ -181,385 +181,76 @@ static void app_driver_register_commands()
|
||||
#endif // CONFIG_ENABLE_CHIP_SHELL
|
||||
|
||||
void app_driver_client_command_callback(client::peer_device_t *peer_device, client::command_handle_t *cmd_handle,
|
||||
void *priv_data)
|
||||
void *priv_data)
|
||||
{
|
||||
// on_off light switch should support on_off cluster and identify cluster commands sending.
|
||||
if (cmd_handle->cluster_id == OnOff::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;
|
||||
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;
|
||||
} else if (cmd_handle->cluster_id == Identify::Id) {
|
||||
if (cmd_handle->command_id == Identify::Commands::Identify::Id) {
|
||||
if (((char *)cmd_handle->command_data)[0] != 1) {
|
||||
ESP_LOGE(TAG, "Number of parameters error");
|
||||
return;
|
||||
}
|
||||
identify::command::send_identify(peer_device, cmd_handle->endpoint_id,
|
||||
strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16));
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported command");
|
||||
}
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported cluster");
|
||||
}
|
||||
}
|
||||
|
||||
void app_driver_client_group_command_callback(uint8_t fabric_index, 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)
|
||||
{
|
||||
// on_off light switch should support on_off cluster and identify cluster commands sending.
|
||||
if (cmd_handle->cluster_id == OnOff::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;
|
||||
switch (cmd_handle->command_id) {
|
||||
case OnOff::Commands::Off::Id: {
|
||||
on_off::command::group_send_off(fabric_index, cmd_handle->group_id);
|
||||
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;
|
||||
case OnOff::Commands::On::Id: {
|
||||
on_off::command::group_send_on(fabric_index, cmd_handle->group_id);
|
||||
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;
|
||||
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 == Identify::Id) {
|
||||
if (cmd_handle->command_id == Identify::Commands::Identify::Id) {
|
||||
if (((char *)cmd_handle->command_data)[0] != 1) {
|
||||
ESP_LOGE(TAG, "Number of parameters error");
|
||||
return;
|
||||
}
|
||||
identify::command::group_send_identify(fabric_index, cmd_handle->group_id,
|
||||
strtol((const char *)(cmd_handle->command_data) + 1, NULL, 16));
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported command");
|
||||
}
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported cluster");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user