mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
esp_matter: Change all IDs to their correct data types.
This commit is contained in:
@@ -246,9 +246,9 @@ static void *attribute_callback_priv_data = NULL;
|
||||
static esp_err_t console_handler(int argc, char **argv)
|
||||
{
|
||||
if (argc == 5 && strncmp(argv[0], "set", sizeof("set")) == 0) {
|
||||
int endpoint_id = strtol((const char *)&argv[1][2], NULL, 16);
|
||||
int cluster_id = strtol((const char *)&argv[2][2], NULL, 16);
|
||||
int attribute_id = strtol((const char *)&argv[3][2], NULL, 16);
|
||||
uint16_t endpoint_id = strtol((const char *)&argv[1][2], NULL, 16);
|
||||
uint32_t cluster_id = strtol((const char *)&argv[2][2], NULL, 16);
|
||||
uint32_t attribute_id = strtol((const char *)&argv[3][2], NULL, 16);
|
||||
|
||||
/* Get type from matter_attribute */
|
||||
const EmberAfAttributeMetadata *matter_attribute = emberAfLocateAttributeMetadata(endpoint_id, cluster_id,
|
||||
@@ -300,9 +300,9 @@ static esp_err_t console_handler(int argc, char **argv)
|
||||
}
|
||||
update(endpoint_id, cluster_id, attribute_id, &val);
|
||||
} else if (argc == 4 && strncmp(argv[0], "get", sizeof("get")) == 0) {
|
||||
int endpoint_id = strtol((const char *)&argv[1][2], NULL, 16);
|
||||
int cluster_id = strtol((const char *)&argv[2][2], NULL, 16);
|
||||
int attribute_id = strtol((const char *)&argv[3][2], NULL, 16);
|
||||
uint16_t endpoint_id = strtol((const char *)&argv[1][2], NULL, 16);
|
||||
uint32_t cluster_id = strtol((const char *)&argv[2][2], NULL, 16);
|
||||
uint32_t attribute_id = strtol((const char *)&argv[3][2], NULL, 16);
|
||||
|
||||
/* Get type from matter_attribute */
|
||||
const EmberAfAttributeMetadata *matter_attribute = emberAfLocateAttributeMetadata(endpoint_id, cluster_id,
|
||||
@@ -405,8 +405,8 @@ esp_err_t set_callback(callback_t callback, void *priv_data)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t execute_callback(callback_type_t type, int endpoint_id, int cluster_id, int attribute_id,
|
||||
esp_matter_attr_val_t *val)
|
||||
static esp_err_t execute_callback(callback_type_t type, uint16_t endpoint_id, uint32_t cluster_id,
|
||||
uint32_t attribute_id, esp_matter_attr_val_t *val)
|
||||
{
|
||||
if (attribute_callback) {
|
||||
return attribute_callback(type, endpoint_id, cluster_id, attribute_id, val, attribute_callback_priv_data);
|
||||
@@ -414,8 +414,8 @@ static esp_err_t execute_callback(callback_type_t type, int endpoint_id, int clu
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t execute_override_callback(attribute_t *attribute, callback_type_t type, int endpoint_id,
|
||||
int cluster_id, int attribute_id, esp_matter_attr_val_t *val)
|
||||
static esp_err_t execute_override_callback(attribute_t *attribute, callback_type_t type, uint16_t endpoint_id,
|
||||
uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val)
|
||||
{
|
||||
callback_t override_callback = attribute::get_override_callback(attribute);
|
||||
if (override_callback) {
|
||||
@@ -816,7 +816,7 @@ static esp_err_t get_attr_val_from_data(esp_matter_attr_val_t *val, EmberAfAttri
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
void val_print(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val)
|
||||
void val_print(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val)
|
||||
{
|
||||
if (val->type == ESP_MATTER_VAL_TYPE_BOOLEAN) {
|
||||
ESP_LOGI(TAG, "********** Endpoint 0x%04X's Cluster 0x%04X's Attribute 0x%04X is %d **********", endpoint_id,
|
||||
@@ -851,7 +851,8 @@ void val_print(int endpoint_id, int cluster_id, int attribute_id, esp_matter_att
|
||||
}
|
||||
}
|
||||
|
||||
esp_err_t get_val_raw(int endpoint_id, int cluster_id, int attribute_id, uint8_t *value, uint16_t attribute_size)
|
||||
esp_err_t get_val_raw(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, uint8_t *value,
|
||||
uint16_t attribute_size)
|
||||
{
|
||||
/* Take lock if not already taken */
|
||||
lock::status_t lock_status = lock::chip_stack_lock(portMAX_DELAY);
|
||||
@@ -874,7 +875,7 @@ esp_err_t get_val_raw(int endpoint_id, int cluster_id, int attribute_id, uint8_t
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val)
|
||||
esp_err_t update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val)
|
||||
{
|
||||
/* Take lock if not already taken */
|
||||
lock::status_t lock_status = lock::chip_stack_lock(portMAX_DELAY);
|
||||
@@ -925,9 +926,9 @@ esp_err_t update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_a
|
||||
Status MatterPreAttributeChangeCallback(const chip::app::ConcreteAttributePath &path, uint8_t mask, uint8_t type,
|
||||
uint16_t size, uint8_t *value)
|
||||
{
|
||||
int endpoint_id = path.mEndpointId;
|
||||
int cluster_id = path.mClusterId;
|
||||
int attribute_id = path.mAttributeId;
|
||||
uint16_t endpoint_id = path.mEndpointId;
|
||||
uint32_t cluster_id = path.mClusterId;
|
||||
uint32_t attribute_id = path.mAttributeId;
|
||||
esp_matter_attr_val_t val = esp_matter_invalid(NULL);
|
||||
attribute::get_attr_val_from_data(&val, type, size, value);
|
||||
|
||||
@@ -945,9 +946,9 @@ Status MatterPreAttributeChangeCallback(const chip::app::ConcreteAttributePath &
|
||||
void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &path, uint8_t mask, uint8_t type,
|
||||
uint16_t size, uint8_t *value)
|
||||
{
|
||||
int endpoint_id = path.mEndpointId;
|
||||
int cluster_id = path.mClusterId;
|
||||
int attribute_id = path.mAttributeId;
|
||||
uint16_t endpoint_id = path.mEndpointId;
|
||||
uint32_t cluster_id = path.mClusterId;
|
||||
uint32_t attribute_id = path.mAttributeId;
|
||||
esp_matter_attr_val_t val = esp_matter_invalid(NULL);
|
||||
attribute::get_attr_val_from_data(&val, type, size, value);
|
||||
|
||||
@@ -960,7 +961,7 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint_id, Clust
|
||||
uint16_t max_read_length)
|
||||
{
|
||||
/* Get value */
|
||||
int attribute_id = matter_attribute->attributeId;
|
||||
uint32_t attribute_id = matter_attribute->attributeId;
|
||||
node_t *node = node::get();
|
||||
if (!node) {
|
||||
return EMBER_ZCL_STATUS_FAILURE;
|
||||
@@ -1002,7 +1003,7 @@ EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint_id, Clus
|
||||
const EmberAfAttributeMetadata *matter_attribute, uint8_t *buffer)
|
||||
{
|
||||
/* Get value */
|
||||
int attribute_id = matter_attribute->attributeId;
|
||||
uint32_t attribute_id = matter_attribute->attributeId;
|
||||
node_t *node = node::get();
|
||||
if (!node) {
|
||||
return EMBER_ZCL_STATUS_FAILURE;
|
||||
|
||||
@@ -197,7 +197,7 @@ typedef enum callback_type {
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
typedef esp_err_t (*callback_t)(callback_type_t type, int endpoint_id, int cluster_id, int attribute_id,
|
||||
typedef esp_err_t (*callback_t)(callback_type_t type, uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
|
||||
esp_matter_attr_val_t *val, void *priv_data);
|
||||
|
||||
/** Set attribute callback
|
||||
@@ -228,7 +228,7 @@ esp_err_t set_callback(callback_t callback, void *priv_data);
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val);
|
||||
esp_err_t update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
|
||||
/** Attribute value print
|
||||
*
|
||||
@@ -239,7 +239,7 @@ esp_err_t update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_a
|
||||
* @param[in] attribute_id Attribute ID of the attribute.
|
||||
* @param[in] val Pointer to `esp_matter_attr_val_t`. Appropriate elements should be used as per the value type.
|
||||
*/
|
||||
void val_print(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val);
|
||||
void val_print(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
|
||||
|
||||
} /* attribute */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -43,7 +43,7 @@ esp_err_t set_command_callback(command_callback_t callback, void *priv_data)
|
||||
}
|
||||
|
||||
/** TODO: Change g_remote_endpoint_id to something better. */
|
||||
int g_remote_endpoint_id = kInvalidEndpointId;
|
||||
uint16_t g_remote_endpoint_id = kInvalidEndpointId;
|
||||
void esp_matter_new_connection_success_callback(void *context, OperationalDeviceProxy *peer_device)
|
||||
{
|
||||
ESP_LOGI(TAG, "New connection success");
|
||||
@@ -57,7 +57,7 @@ void esp_matter_new_connection_failure_callback(void *context, PeerId peerId, CH
|
||||
ESP_LOGI(TAG, "New connection failure");
|
||||
}
|
||||
|
||||
esp_err_t connect(int fabric_index, int node_id, int remote_endpoint_id)
|
||||
esp_err_t connect(uint8_t fabric_index, uint64_t node_id, uint16_t remote_endpoint_id)
|
||||
{
|
||||
/* Get info */
|
||||
FabricInfo *fabric_info = chip::Server::GetInstance().GetFabricTable().FindFabricWithIndex(fabric_index);
|
||||
@@ -95,7 +95,7 @@ static void esp_matter_command_client_binding_callback(const EmberBindingTableEn
|
||||
}
|
||||
}
|
||||
|
||||
esp_err_t cluster_update(int endpoint_id, int cluster_id)
|
||||
esp_err_t cluster_update(uint16_t endpoint_id, uint32_t cluster_id)
|
||||
{
|
||||
chip::BindingManager::GetInstance().NotifyBoundClusterChanged(endpoint_id, cluster_id, NULL);
|
||||
return ESP_OK;
|
||||
@@ -143,7 +143,7 @@ static void send_command_failure_callback(void *context, CHIP_ERROR error)
|
||||
namespace on_off {
|
||||
namespace command {
|
||||
|
||||
esp_err_t send_on(peer_device_t *remote_device, int remote_endpoint_id)
|
||||
esp_err_t send_on(peer_device_t *remote_device, uint16_t remote_endpoint_id)
|
||||
{
|
||||
chip::Controller::OnOffCluster cluster;
|
||||
OnOff::Commands::On::Type command_data;
|
||||
@@ -153,7 +153,7 @@ esp_err_t send_on(peer_device_t *remote_device, int remote_endpoint_id)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t send_off(peer_device_t *remote_device, int remote_endpoint_id)
|
||||
esp_err_t send_off(peer_device_t *remote_device, uint16_t remote_endpoint_id)
|
||||
{
|
||||
chip::Controller::OnOffCluster cluster;
|
||||
OnOff::Commands::Off::Type command_data;
|
||||
@@ -163,7 +163,7 @@ esp_err_t send_off(peer_device_t *remote_device, int remote_endpoint_id)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t send_toggle(peer_device_t *remote_device, int remote_endpoint_id)
|
||||
esp_err_t send_toggle(peer_device_t *remote_device, uint16_t remote_endpoint_id)
|
||||
{
|
||||
chip::Controller::OnOffCluster cluster;
|
||||
OnOff::Commands::Toggle::Type command_data;
|
||||
@@ -179,7 +179,7 @@ esp_err_t send_toggle(peer_device_t *remote_device, int remote_endpoint_id)
|
||||
namespace level_control {
|
||||
namespace command {
|
||||
|
||||
esp_err_t send_move(peer_device_t *remote_device, int remote_endpoint_id, uint8_t move_mode, uint8_t rate,
|
||||
esp_err_t send_move(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)
|
||||
{
|
||||
chip::Controller::LevelControlCluster cluster;
|
||||
@@ -194,7 +194,7 @@ esp_err_t send_move(peer_device_t *remote_device, int remote_endpoint_id, uint8_
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t send_move_to_level(peer_device_t *remote_device, int remote_endpoint_id, uint8_t level,
|
||||
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)
|
||||
{
|
||||
chip::Controller::LevelControlCluster cluster;
|
||||
@@ -209,7 +209,7 @@ esp_err_t send_move_to_level(peer_device_t *remote_device, int remote_endpoint_i
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t send_move_to_level_with_on_off(peer_device_t *remote_device, int remote_endpoint_id, uint8_t level,
|
||||
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)
|
||||
{
|
||||
chip::Controller::LevelControlCluster cluster;
|
||||
@@ -222,7 +222,8 @@ esp_err_t send_move_to_level_with_on_off(peer_device_t *remote_device, int remot
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t send_move_with_on_off(peer_device_t *remote_device, int remote_endpoint_id, uint8_t move_mode, uint8_t rate)
|
||||
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)
|
||||
{
|
||||
chip::Controller::LevelControlCluster cluster;
|
||||
LevelControl::Commands::MoveWithOnOff::Type command_data;
|
||||
@@ -234,7 +235,7 @@ esp_err_t send_move_with_on_off(peer_device_t *remote_device, int remote_endpoin
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t send_step(peer_device_t *remote_device, int remote_endpoint_id, uint8_t step_mode, uint8_t step_size,
|
||||
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)
|
||||
{
|
||||
chip::Controller::LevelControlCluster cluster;
|
||||
@@ -250,7 +251,7 @@ esp_err_t send_step(peer_device_t *remote_device, int remote_endpoint_id, uint8_
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t send_step_with_on_off(peer_device_t *remote_device, int remote_endpoint_id, uint8_t step_mode,
|
||||
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)
|
||||
{
|
||||
chip::Controller::LevelControlCluster cluster;
|
||||
@@ -264,7 +265,8 @@ esp_err_t send_step_with_on_off(peer_device_t *remote_device, int remote_endpoin
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t send_stop(peer_device_t *remote_device, int remote_endpoint_id, uint8_t option_mask, uint8_t option_override)
|
||||
esp_err_t send_stop(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t option_mask,
|
||||
uint8_t option_override)
|
||||
{
|
||||
chip::Controller::LevelControlCluster cluster;
|
||||
LevelControl::Commands::Stop::Type command_data;
|
||||
@@ -276,7 +278,7 @@ esp_err_t send_stop(peer_device_t *remote_device, int remote_endpoint_id, uint8_
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t send_stop_with_on_off(peer_device_t *remote_device, int remote_endpoint_id)
|
||||
esp_err_t send_stop_with_on_off(peer_device_t *remote_device, uint16_t remote_endpoint_id)
|
||||
{
|
||||
chip::Controller::LevelControlCluster cluster;
|
||||
LevelControl::Commands::Stop::Type command_data;
|
||||
@@ -292,7 +294,7 @@ esp_err_t send_stop_with_on_off(peer_device_t *remote_device, int remote_endpoin
|
||||
namespace color_control {
|
||||
namespace command {
|
||||
|
||||
esp_err_t send_move_hue(peer_device_t *remote_device, int remote_endpoint_id, uint8_t move_mode, uint8_t rate,
|
||||
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)
|
||||
{
|
||||
chip::Controller::ColorControlCluster cluster;
|
||||
@@ -307,8 +309,8 @@ esp_err_t send_move_hue(peer_device_t *remote_device, int remote_endpoint_id, ui
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t send_move_saturation(peer_device_t *remote_device, int 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)
|
||||
{
|
||||
chip::Controller::ColorControlCluster cluster;
|
||||
ColorControl::Commands::MoveSaturation::Type command_data;
|
||||
@@ -322,7 +324,7 @@ esp_err_t send_move_saturation(peer_device_t *remote_device, int remote_endpoint
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t send_move_to_hue(peer_device_t *remote_device, int remote_endpoint_id, uint8_t hue, uint8_t direction,
|
||||
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)
|
||||
{
|
||||
chip::Controller::ColorControlCluster cluster;
|
||||
@@ -338,7 +340,7 @@ esp_err_t send_move_to_hue(peer_device_t *remote_device, int remote_endpoint_id,
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t send_move_to_hue_and_saturation(peer_device_t *remote_device, int remote_endpoint_id, uint8_t hue,
|
||||
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)
|
||||
{
|
||||
@@ -355,7 +357,7 @@ esp_err_t send_move_to_hue_and_saturation(peer_device_t *remote_device, int remo
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t send_move_to_saturation(peer_device_t *remote_device, int remote_endpoint_id, uint8_t saturation,
|
||||
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)
|
||||
{
|
||||
chip::Controller::ColorControlCluster cluster;
|
||||
@@ -370,7 +372,7 @@ esp_err_t send_move_to_saturation(peer_device_t *remote_device, int remote_endpo
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t send_step_hue(peer_device_t *remote_device, int remote_endpoint_id, uint8_t step_mode, uint8_t step_size,
|
||||
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)
|
||||
{
|
||||
chip::Controller::ColorControlCluster cluster;
|
||||
@@ -386,7 +388,7 @@ esp_err_t send_step_hue(peer_device_t *remote_device, int remote_endpoint_id, ui
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t send_step_saturation(peer_device_t *remote_device, int remote_endpoint_id, uint8_t step_mode,
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -28,46 +28,49 @@ using client::peer_device_t;
|
||||
|
||||
namespace on_off {
|
||||
namespace command {
|
||||
esp_err_t send_off(peer_device_t *remote_device, int remote_endpoint_id);
|
||||
esp_err_t send_on(peer_device_t *remote_device, int remote_endpoint_id);
|
||||
esp_err_t send_toggle(peer_device_t *remote_device, int remote_endpoint_id);
|
||||
esp_err_t send_off(peer_device_t *remote_device, uint16_t remote_endpoint_id);
|
||||
esp_err_t send_on(peer_device_t *remote_device, uint16_t remote_endpoint_id);
|
||||
esp_err_t send_toggle(peer_device_t *remote_device, uint16_t remote_endpoint_id);
|
||||
} /* command */
|
||||
} /* on_off */
|
||||
|
||||
namespace level_control {
|
||||
namespace command {
|
||||
esp_err_t send_move(peer_device_t *remote_device, int remote_endpoint_id, uint8_t move_mode, uint8_t rate,
|
||||
esp_err_t send_move(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_to_level(peer_device_t *remote_device, int remote_endpoint_id, uint8_t level,
|
||||
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);
|
||||
esp_err_t send_move_to_level_with_on_off(peer_device_t *remote_device, int remote_endpoint_id, uint8_t level,
|
||||
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);
|
||||
esp_err_t send_move_with_on_off(peer_device_t *remote_device, int remote_endpoint_id, uint8_t move_mode, uint8_t rate);
|
||||
esp_err_t send_step(peer_device_t *remote_device, int remote_endpoint_id, uint8_t step_mode, uint8_t step_size,
|
||||
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);
|
||||
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);
|
||||
esp_err_t send_step_with_on_off(peer_device_t *remote_device, int remote_endpoint_id, uint8_t step_mode,
|
||||
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);
|
||||
esp_err_t send_stop(peer_device_t *remote_device, int remote_endpoint_id, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t send_stop_with_on_off(peer_device_t *remote_device, int remote_endpoint_id);
|
||||
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);
|
||||
} /* command */
|
||||
} /* level_control */
|
||||
|
||||
namespace color_control {
|
||||
namespace command {
|
||||
esp_err_t send_move_hue(peer_device_t *remote_device, int remote_endpoint_id, uint8_t move_mode, uint8_t rate,
|
||||
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, int remote_endpoint_id, uint8_t move_mode, uint8_t rate,
|
||||
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);
|
||||
esp_err_t send_move_to_hue(peer_device_t *remote_device, int remote_endpoint_id, uint8_t hue, uint8_t direction,
|
||||
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, int remote_endpoint_id, uint8_t hue,
|
||||
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);
|
||||
esp_err_t send_move_to_saturation(peer_device_t *remote_device, int remote_endpoint_id, uint8_t saturation,
|
||||
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);
|
||||
esp_err_t send_step_hue(peer_device_t *remote_device, int remote_endpoint_id, uint8_t step_mode, uint8_t step_size,
|
||||
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);
|
||||
esp_err_t send_step_saturation(peer_device_t *remote_device, int remote_endpoint_id, uint8_t step_mode,
|
||||
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);
|
||||
} /* command */
|
||||
|
||||
@@ -35,9 +35,9 @@ namespace command {
|
||||
|
||||
void DispatchSingleClusterCommandCommon(const ConcreteCommandPath &command_path, TLVReader &tlv_data, void *opaque_ptr)
|
||||
{
|
||||
int endpoint_id = command_path.mEndpointId;
|
||||
int cluster_id = command_path.mClusterId;
|
||||
int command_id = command_path.mCommandId;
|
||||
uint16_t endpoint_id = command_path.mEndpointId;
|
||||
uint32_t cluster_id = command_path.mClusterId;
|
||||
uint32_t command_id = command_path.mCommandId;
|
||||
ESP_LOGI(TAG, "Received command 0x%04X for enpoint 0x%04X's cluster 0x%08X", command_id, endpoint_id, cluster_id);
|
||||
|
||||
node_t *node = node::get();
|
||||
|
||||
@@ -32,7 +32,9 @@
|
||||
|
||||
using chip::CommandId;
|
||||
using chip::DataVersion;
|
||||
using chip::kInvalidAttributeId;
|
||||
using chip::kInvalidCommandId;
|
||||
using chip::kInvalidClusterId;
|
||||
using chip::kInvalidEndpointId;
|
||||
using chip::Credentials::SetDeviceAttestationCredentialsProvider;
|
||||
using chip::Credentials::Examples::GetExampleDACProvider;
|
||||
@@ -58,9 +60,9 @@ chip::DeviceLayer::ESP32FactoryDataProvider factory_data_provider;
|
||||
} // namespace
|
||||
|
||||
typedef struct _attribute {
|
||||
int attribute_id;
|
||||
int cluster_id;
|
||||
int endpoint_id;
|
||||
uint32_t attribute_id;
|
||||
uint32_t cluster_id;
|
||||
uint16_t endpoint_id;
|
||||
uint16_t flags;
|
||||
esp_matter_attr_val_t val;
|
||||
esp_matter_attr_bounds_t *bounds;
|
||||
@@ -71,15 +73,15 @@ typedef struct _attribute {
|
||||
} _attribute_t;
|
||||
|
||||
typedef struct _command {
|
||||
int command_id;
|
||||
uint32_t command_id;
|
||||
uint16_t flags;
|
||||
command::callback_t callback;
|
||||
struct _command *next;
|
||||
} _command_t;
|
||||
|
||||
typedef struct _cluster {
|
||||
int cluster_id;
|
||||
int endpoint_id;
|
||||
uint32_t cluster_id;
|
||||
uint16_t endpoint_id;
|
||||
uint16_t flags;
|
||||
const cluster::function_generic_t *function_list;
|
||||
cluster::plugin_server_init_callback_t plugin_server_init_callback;
|
||||
@@ -90,8 +92,8 @@ typedef struct _cluster {
|
||||
} _cluster_t;
|
||||
|
||||
typedef struct _endpoint {
|
||||
int endpoint_id;
|
||||
int device_type_id;
|
||||
uint16_t endpoint_id;
|
||||
uint32_t device_type_id;
|
||||
uint16_t flags;
|
||||
_cluster_t *cluster_list;
|
||||
EmberAfEndpointType *endpoint_type;
|
||||
@@ -102,7 +104,7 @@ typedef struct _endpoint {
|
||||
|
||||
typedef struct _node {
|
||||
_endpoint_t *endpoint_list;
|
||||
int current_endpoint_id;
|
||||
uint16_t current_endpoint_id;
|
||||
} _node_t;
|
||||
|
||||
namespace cluster {
|
||||
@@ -250,7 +252,7 @@ namespace endpoint {
|
||||
|
||||
static int get_next_index()
|
||||
{
|
||||
int endpoint_id = 0;
|
||||
uint16_t endpoint_id = 0;
|
||||
for (int index = 0; index < MAX_ENDPOINT_COUNT; index++) {
|
||||
endpoint_id = emberAfEndpointFromIndex(index);
|
||||
if (endpoint_id == kInvalidEndpointId) {
|
||||
@@ -729,7 +731,7 @@ esp_err_t factory_reset()
|
||||
/* ESP Matter data model is used. Erase all the data that we have added in nvs. */
|
||||
endpoint_t *endpoint = endpoint::get_first(node);
|
||||
while (endpoint) {
|
||||
int endpoint_id = endpoint::get_id(endpoint);
|
||||
uint16_t endpoint_id = endpoint::get_id(endpoint);
|
||||
char nvs_namespace[16] = {0};
|
||||
snprintf(nvs_namespace, 16, "endpoint_%X", endpoint_id); /* endpoint_id */
|
||||
|
||||
@@ -757,7 +759,7 @@ esp_err_t factory_reset()
|
||||
}
|
||||
|
||||
namespace attribute {
|
||||
attribute_t *create(cluster_t *cluster, int attribute_id, uint8_t flags, esp_matter_attr_val_t val)
|
||||
attribute_t *create(cluster_t *cluster, uint32_t attribute_id, uint8_t flags, esp_matter_attr_val_t val)
|
||||
{
|
||||
/* Find */
|
||||
if (!cluster) {
|
||||
@@ -839,7 +841,7 @@ static esp_err_t destroy(attribute_t *attribute)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
attribute_t *get(cluster_t *cluster, int attribute_id)
|
||||
attribute_t *get(cluster_t *cluster, uint32_t attribute_id)
|
||||
{
|
||||
if (!cluster) {
|
||||
ESP_LOGE(TAG, "Cluster cannot be NULL");
|
||||
@@ -876,11 +878,11 @@ attribute_t *get_next(attribute_t *attribute)
|
||||
return (attribute_t *)current_attribute->next;
|
||||
}
|
||||
|
||||
int get_id(attribute_t *attribute)
|
||||
uint32_t get_id(attribute_t *attribute)
|
||||
{
|
||||
if (!attribute) {
|
||||
ESP_LOGE(TAG, "Attribute cannot be NULL");
|
||||
return -1;
|
||||
return kInvalidAttributeId;
|
||||
}
|
||||
_attribute_t *current_attribute = (_attribute_t *)attribute;
|
||||
return current_attribute->attribute_id;
|
||||
@@ -1022,9 +1024,9 @@ esp_err_t store_val_in_nvs(attribute_t *attribute)
|
||||
_attribute_t *current_attribute = (_attribute_t *)attribute;
|
||||
|
||||
/* Get keys */
|
||||
int attribute_id = current_attribute->attribute_id;
|
||||
int cluster_id = current_attribute->cluster_id;
|
||||
int endpoint_id = current_attribute->endpoint_id;
|
||||
uint32_t attribute_id = current_attribute->attribute_id;
|
||||
uint32_t cluster_id = current_attribute->cluster_id;
|
||||
uint16_t endpoint_id = current_attribute->endpoint_id;
|
||||
char nvs_namespace[16] = {0};
|
||||
char attribute_key[16] = {0};
|
||||
snprintf(nvs_namespace, 16, "endpoint_%X", endpoint_id); /* endpoint_id */
|
||||
@@ -1062,9 +1064,9 @@ esp_err_t get_val_from_nvs(attribute_t *attribute, esp_matter_attr_val_t *val)
|
||||
_attribute_t *current_attribute = (_attribute_t *)attribute;
|
||||
|
||||
/* Get keys */
|
||||
int attribute_id = current_attribute->attribute_id;
|
||||
int cluster_id = current_attribute->cluster_id;
|
||||
int endpoint_id = current_attribute->endpoint_id;
|
||||
uint32_t attribute_id = current_attribute->attribute_id;
|
||||
uint32_t cluster_id = current_attribute->cluster_id;
|
||||
uint16_t endpoint_id = current_attribute->endpoint_id;
|
||||
char nvs_namespace[16] = {0};
|
||||
char attribute_key[16] = {0};
|
||||
snprintf(nvs_namespace, 16, "endpoint_%X", endpoint_id); /* endpoint_id */
|
||||
@@ -1103,7 +1105,7 @@ esp_err_t get_val_from_nvs(attribute_t *attribute, esp_matter_attr_val_t *val)
|
||||
} /* attribute */
|
||||
|
||||
namespace command {
|
||||
command_t *create(cluster_t *cluster, int command_id, uint8_t flags, callback_t callback)
|
||||
command_t *create(cluster_t *cluster, uint32_t command_id, uint8_t flags, callback_t callback)
|
||||
{
|
||||
/* Find */
|
||||
if (!cluster) {
|
||||
@@ -1153,7 +1155,7 @@ static esp_err_t destroy(command_t *command)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
command_t *get(cluster_t *cluster, int command_id)
|
||||
command_t *get(cluster_t *cluster, uint32_t command_id)
|
||||
{
|
||||
if (!cluster) {
|
||||
ESP_LOGE(TAG, "Cluster cannot be NULL");
|
||||
@@ -1190,11 +1192,11 @@ command_t *get_next(command_t *command)
|
||||
return (command_t *)current_command->next;
|
||||
}
|
||||
|
||||
int get_id(command_t *command)
|
||||
uint32_t get_id(command_t *command)
|
||||
{
|
||||
if (!command) {
|
||||
ESP_LOGE(TAG, "Command cannot be NULL");
|
||||
return -1;
|
||||
return kInvalidCommandId;
|
||||
}
|
||||
_command_t *current_command = (_command_t *)command;
|
||||
return current_command->command_id;
|
||||
@@ -1224,7 +1226,7 @@ uint16_t get_flags(command_t *command)
|
||||
|
||||
namespace cluster {
|
||||
|
||||
cluster_t *create(endpoint_t *endpoint, int cluster_id, uint8_t flags)
|
||||
cluster_t *create(endpoint_t *endpoint, uint32_t cluster_id, uint8_t flags)
|
||||
{
|
||||
/* Find */
|
||||
if (!endpoint) {
|
||||
@@ -1290,7 +1292,7 @@ static esp_err_t destroy(cluster_t *cluster)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
cluster_t *get(endpoint_t *endpoint, int cluster_id)
|
||||
cluster_t *get(endpoint_t *endpoint, uint32_t cluster_id)
|
||||
{
|
||||
if (!endpoint) {
|
||||
ESP_LOGE(TAG, "Endpoint cannot be NULL");
|
||||
@@ -1327,11 +1329,11 @@ cluster_t *get_next(cluster_t *cluster)
|
||||
return (cluster_t *)current_cluster->next;
|
||||
}
|
||||
|
||||
int get_id(cluster_t *cluster)
|
||||
uint32_t get_id(cluster_t *cluster)
|
||||
{
|
||||
if (!cluster) {
|
||||
ESP_LOGE(TAG, "Cluster cannot be NULL");
|
||||
return -1;
|
||||
return kInvalidClusterId;
|
||||
}
|
||||
_cluster_t *current_cluster = (_cluster_t *)cluster;
|
||||
return current_cluster->cluster_id;
|
||||
@@ -1482,7 +1484,7 @@ esp_err_t destroy(node_t *node, endpoint_t *endpoint)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
endpoint_t *get(node_t *node, int endpoint_id)
|
||||
endpoint_t *get(node_t *node, uint16_t endpoint_id)
|
||||
{
|
||||
if (!node) {
|
||||
ESP_LOGE(TAG, "Node cannot be NULL");
|
||||
@@ -1519,17 +1521,17 @@ endpoint_t *get_next(endpoint_t *endpoint)
|
||||
return (endpoint_t *)current_endpoint->next;
|
||||
}
|
||||
|
||||
int get_id(endpoint_t *endpoint)
|
||||
uint16_t get_id(endpoint_t *endpoint)
|
||||
{
|
||||
if (!endpoint) {
|
||||
ESP_LOGE(TAG, "Endpoint cannot be NULL");
|
||||
return -1;
|
||||
return kInvalidEndpointId;
|
||||
}
|
||||
_endpoint_t *current_endpoint = (_endpoint_t *)endpoint;
|
||||
return current_endpoint->endpoint_id;
|
||||
}
|
||||
|
||||
esp_err_t set_device_type_id(endpoint_t *endpoint, int device_type_id)
|
||||
esp_err_t set_device_type_id(endpoint_t *endpoint, uint32_t device_type_id)
|
||||
{
|
||||
if (!endpoint) {
|
||||
ESP_LOGE(TAG, "Endpoint cannot be NULL");
|
||||
@@ -1540,15 +1542,14 @@ esp_err_t set_device_type_id(endpoint_t *endpoint, int device_type_id)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
int get_device_type_id(endpoint_t *endpoint)
|
||||
uint32_t get_device_type_id(endpoint_t *endpoint)
|
||||
{
|
||||
if (!endpoint) {
|
||||
ESP_LOGE(TAG, "Endpoint cannot be NULL");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
return 0xFFFF'FFFF;
|
||||
}
|
||||
_endpoint_t *current_endpoint = (_endpoint_t *)endpoint;
|
||||
int device_type_id = current_endpoint->device_type_id;
|
||||
return device_type_id;
|
||||
return current_endpoint->device_type_id;
|
||||
}
|
||||
|
||||
} /* endpoint */
|
||||
|
||||
@@ -159,7 +159,7 @@ esp_err_t destroy(node_t *node, endpoint_t *endpoint);
|
||||
* @return Endpoint handle on success.
|
||||
* @return NULL in case of failure.
|
||||
*/
|
||||
endpoint_t *get(node_t *node, int endpoint_id);
|
||||
endpoint_t *get(node_t *node, uint16_t endpoint_id);
|
||||
|
||||
/** Get first endpoint
|
||||
*
|
||||
@@ -190,9 +190,9 @@ endpoint_t *get_next(endpoint_t *endpoint);
|
||||
* @param[in] endpoint Endpoint handle.
|
||||
*
|
||||
* @return Endpoint ID on success.
|
||||
* @return -1 in case of failure.
|
||||
* @return Invalid Endpoint ID (0xFFFF) in case of failure.
|
||||
*/
|
||||
int get_id(endpoint_t *endpoint);
|
||||
uint16_t get_id(endpoint_t *endpoint);
|
||||
|
||||
/** Set device type ID
|
||||
*
|
||||
@@ -204,7 +204,7 @@ int get_id(endpoint_t *endpoint);
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t set_device_type_id(endpoint_t *endpoint, int device_type_id);
|
||||
esp_err_t set_device_type_id(endpoint_t *endpoint, uint32_t device_type_id);
|
||||
|
||||
/** Get device type ID
|
||||
*
|
||||
@@ -213,9 +213,9 @@ esp_err_t set_device_type_id(endpoint_t *endpoint, int device_type_id);
|
||||
* @param[in] endpoint Endpoint handle.
|
||||
*
|
||||
* @return device type ID on success.
|
||||
* @return 0xFFFF in case of failure or if the device type ID was not set.
|
||||
* @return 0xFFFF'FFFF in case of failure or if the device type ID was not set.
|
||||
*/
|
||||
int get_device_type_id(endpoint_t *endpoint);
|
||||
uint32_t get_device_type_id(endpoint_t *endpoint);
|
||||
|
||||
/** Enable endpoint
|
||||
*
|
||||
@@ -266,7 +266,7 @@ typedef void (*function_generic_t)();
|
||||
* @return Cluster handle on success.
|
||||
* @return NULL in case of failure.
|
||||
*/
|
||||
cluster_t *create(endpoint_t *endpoint, int cluster_id, uint8_t flags);
|
||||
cluster_t *create(endpoint_t *endpoint, uint32_t cluster_id, uint8_t flags);
|
||||
|
||||
/** Get cluster
|
||||
*
|
||||
@@ -278,7 +278,7 @@ cluster_t *create(endpoint_t *endpoint, int cluster_id, uint8_t flags);
|
||||
* @return Cluster handle on success.
|
||||
* @return NULL in case of failure.
|
||||
*/
|
||||
cluster_t *get(endpoint_t *endpoint, int cluster_id);
|
||||
cluster_t *get(endpoint_t *endpoint, uint32_t cluster_id);
|
||||
|
||||
/** Get first cluster
|
||||
*
|
||||
@@ -309,9 +309,9 @@ cluster_t *get_next(cluster_t *cluster);
|
||||
* @param[in] cluster Cluster handle.
|
||||
*
|
||||
* @return Cluster ID on success.
|
||||
* @return -1 in case of failure.
|
||||
* @return Invalid CLuster ID (0xFFFF'FFFF) in case of failure.
|
||||
*/
|
||||
int get_id(cluster_t *cluster);
|
||||
uint32_t get_id(cluster_t *cluster);
|
||||
|
||||
/** Set cluster plugin server init callback
|
||||
*
|
||||
@@ -395,7 +395,7 @@ namespace attribute {
|
||||
* @return Attribute handle on success.
|
||||
* @return NULL in case of failure.
|
||||
*/
|
||||
attribute_t *create(cluster_t *cluster, int attribute_id, uint8_t flags, esp_matter_attr_val_t val);
|
||||
attribute_t *create(cluster_t *cluster, uint32_t attribute_id, uint8_t flags, esp_matter_attr_val_t val);
|
||||
|
||||
/** Get attribute
|
||||
*
|
||||
@@ -407,7 +407,7 @@ attribute_t *create(cluster_t *cluster, int attribute_id, uint8_t flags, esp_mat
|
||||
* @return Attribute handle on success.
|
||||
* @return NULL in case of failure.
|
||||
*/
|
||||
attribute_t *get(cluster_t *cluster, int attribute_id);
|
||||
attribute_t *get(cluster_t *cluster, uint32_t attribute_id);
|
||||
|
||||
/** Get first attribute
|
||||
*
|
||||
@@ -438,9 +438,9 @@ attribute_t *get_next(attribute_t *attribute);
|
||||
* @param[in] attribute Attribute handle.
|
||||
*
|
||||
* @return Attribute ID on success.
|
||||
* @return -1 in case of failure.
|
||||
* @return Invalid Attribute ID (0xFFFF'FFFF) in case of failure.
|
||||
*/
|
||||
int get_id(attribute_t *attribute);
|
||||
uint32_t get_id(attribute_t *attribute);
|
||||
|
||||
/** Set attribute val
|
||||
*
|
||||
@@ -481,7 +481,8 @@ esp_err_t get_val(attribute_t *attribute, esp_matter_attr_val_t *val);
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t get_val_raw(int endpoint_id, int cluster_id, int attribute_id, uint8_t *value, uint16_t attribute_size);
|
||||
esp_err_t get_val_raw(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, uint8_t *value,
|
||||
uint16_t attribute_size);
|
||||
|
||||
/** Add attribute bounds
|
||||
*
|
||||
@@ -602,7 +603,7 @@ typedef esp_err_t (*callback_t)(const ConcreteCommandPath &command_path, TLVRead
|
||||
* @return Command handle on success.
|
||||
* @return NULL in case of failure.
|
||||
*/
|
||||
command_t *create(cluster_t *cluster, int command_id, uint8_t flags, callback_t callback);
|
||||
command_t *create(cluster_t *cluster, uint32_t command_id, uint8_t flags, callback_t callback);
|
||||
|
||||
/** Get command
|
||||
*
|
||||
@@ -614,7 +615,7 @@ command_t *create(cluster_t *cluster, int command_id, uint8_t flags, callback_t
|
||||
* @return Command handle on success.
|
||||
* @return NULL in case of failure.
|
||||
*/
|
||||
command_t *get(cluster_t *cluster, int command_id);
|
||||
command_t *get(cluster_t *cluster, uint32_t command_id);
|
||||
|
||||
/** Get first command
|
||||
*
|
||||
@@ -645,9 +646,9 @@ command_t *get_next(command_t *command);
|
||||
* @param[in] command Command handle.
|
||||
*
|
||||
* @return Command ID on success.
|
||||
* @return -1 in case of failure.
|
||||
* @return Invalid Command ID (0xFFFF'FFFF) in case of failure.
|
||||
*/
|
||||
int get_id(command_t *command);
|
||||
uint32_t get_id(command_t *command);
|
||||
|
||||
/** Get command callback
|
||||
*
|
||||
@@ -688,7 +689,7 @@ typedef chip::DeviceProxy peer_device_t;
|
||||
* @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, int remote_endpoint_id, void *priv_data);
|
||||
typedef void (*command_callback_t)(peer_device_t *peer_device, uint16_t remote_endpoint_id, void *priv_data);
|
||||
|
||||
/** Initialize binding
|
||||
*
|
||||
@@ -715,7 +716,7 @@ void binding_manager_init();
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t connect(int fabric_index, int node_id, int remote_endpoint_id);
|
||||
esp_err_t connect(uint8_t fabric_index, uint64_t node_id, uint16_t remote_endpoint_id);
|
||||
|
||||
/** Set command send callback
|
||||
*
|
||||
@@ -742,7 +743,7 @@ esp_err_t set_command_callback(command_callback_t callback, void *priv_data);
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t cluster_update(int endpoint_id, int cluster_id);
|
||||
esp_err_t cluster_update(uint16_t endpoint_id, uint32_t cluster_id);
|
||||
|
||||
} /* client */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -36,7 +36,7 @@ using namespace cluster;
|
||||
|
||||
namespace endpoint {
|
||||
namespace root_node {
|
||||
int get_device_type_id()
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_ROOT_NODE_DEVICE_TYPE_ID;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
} /* root_node */
|
||||
|
||||
namespace on_off_light {
|
||||
int get_device_type_id()
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_ON_OFF_LIGHT_DEVICE_TYPE_ID;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
} /* on_off_light */
|
||||
|
||||
namespace dimmable_light {
|
||||
int get_device_type_id()
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_DIMMABLE_LIGHT_DEVICE_TYPE_ID;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
} /* dimmable_light */
|
||||
|
||||
namespace color_dimmable_light {
|
||||
int get_device_type_id()
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_COLOR_DIMMABLE_LIGHT_DEVICE_TYPE_ID;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
} /* color_dimmable_light */
|
||||
|
||||
namespace on_off_switch {
|
||||
int get_device_type_id()
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_ON_OFF_SWITCH_DEVICE_TYPE_ID;
|
||||
}
|
||||
@@ -178,7 +178,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
} /* on_off_switch */
|
||||
|
||||
namespace fan {
|
||||
int get_device_type_id()
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_FAN_DEVICE_TYPE_ID;
|
||||
}
|
||||
@@ -202,7 +202,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
} /* fan */
|
||||
|
||||
namespace thermostat {
|
||||
int get_device_type_id()
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_THERMOSTAT_DEVICE_TYPE_ID;
|
||||
}
|
||||
@@ -228,14 +228,14 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
} /* thermostat */
|
||||
|
||||
namespace bridge {
|
||||
int get_device_type_id()
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_BRIDGE_DEVICE_TYPE_ID;
|
||||
}
|
||||
} /* bridge */
|
||||
|
||||
namespace bridged_node {
|
||||
int get_device_type_id()
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_BRIDGED_NODE_DEVICE_TYPE_ID;
|
||||
}
|
||||
@@ -260,7 +260,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
} /* bridged_node */
|
||||
|
||||
namespace door_lock {
|
||||
int get_device_type_id()
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_DOOR_LOCK_DEVICE_TYPE_ID;
|
||||
}
|
||||
@@ -285,7 +285,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
} /* door_lock */
|
||||
|
||||
namespace temperature_sensor {
|
||||
int get_device_type_id()
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_ID;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ typedef struct config {
|
||||
operational_credentials::config_t operational_credentials;
|
||||
} config_t;
|
||||
|
||||
int get_device_type_id();
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* root_node */
|
||||
|
||||
@@ -55,7 +55,7 @@ typedef struct config {
|
||||
basic::config_t basic;
|
||||
} config_t;
|
||||
|
||||
int get_device_type_id();
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* on_off_light */
|
||||
|
||||
@@ -69,7 +69,7 @@ typedef struct config {
|
||||
basic::config_t basic;
|
||||
} config_t;
|
||||
|
||||
int get_device_type_id();
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* dimmable_light */
|
||||
|
||||
@@ -84,7 +84,7 @@ typedef struct config {
|
||||
color_control::config_t color_control;
|
||||
} config_t;
|
||||
|
||||
int get_device_type_id();
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* color_dimmable_light */
|
||||
|
||||
@@ -98,7 +98,7 @@ typedef struct config {
|
||||
binding::config_t binding;
|
||||
} config_t;
|
||||
|
||||
int get_device_type_id();
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* on_off_switch */
|
||||
|
||||
@@ -109,7 +109,7 @@ typedef struct config {
|
||||
fan_control::config_t fan_control;
|
||||
} config_t;
|
||||
|
||||
int get_device_type_id();
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* fan */
|
||||
|
||||
@@ -122,12 +122,12 @@ typedef struct config {
|
||||
cluster::thermostat::config_t thermostat;
|
||||
} config_t;
|
||||
|
||||
int get_device_type_id();
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* thermostat */
|
||||
|
||||
namespace bridge {
|
||||
int get_device_type_id();
|
||||
uint32_t get_device_type_id();
|
||||
} /* bridge */
|
||||
|
||||
namespace bridged_node {
|
||||
@@ -136,7 +136,7 @@ typedef struct config {
|
||||
fixed_label::config_t fixed_label;
|
||||
} config_t;
|
||||
|
||||
int get_device_type_id();
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* bridged_node */
|
||||
|
||||
@@ -147,7 +147,7 @@ typedef struct config {
|
||||
time_synchronization::config_t time_synchronization;
|
||||
} config_t;
|
||||
|
||||
int get_device_type_id();
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* door_lock */
|
||||
|
||||
@@ -158,7 +158,7 @@ typedef struct config {
|
||||
temperature_measurement::config_t temperature_measurement;
|
||||
} config_t;
|
||||
|
||||
int get_device_type_id();
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* temperature_sensor */
|
||||
} /* endpoint */
|
||||
|
||||
@@ -26,7 +26,7 @@ using namespace esp_matter;
|
||||
typedef struct esp_matter_bridge_device {
|
||||
node_t *node;
|
||||
endpoint_t *endpoint;
|
||||
int endpoint_id;
|
||||
uint16_t endpoint_id;
|
||||
} esp_matter_bridge_device_t;
|
||||
|
||||
esp_matter_bridge_device_t *esp_matter_bridge_create_device(node_t *node);
|
||||
|
||||
@@ -81,18 +81,18 @@ static void register_commands()
|
||||
|
||||
static esp_err_t status_attribute_update(bool status)
|
||||
{
|
||||
int endpoint_id = cluster::rainmaker::endpoint_id;
|
||||
int cluster_id = cluster::rainmaker::Id;
|
||||
int attribute_id = cluster::rainmaker::attribute::status::Id;
|
||||
uint16_t endpoint_id = cluster::rainmaker::endpoint_id;
|
||||
uint32_t cluster_id = cluster::rainmaker::Id;
|
||||
uint32_t attribute_id = cluster::rainmaker::attribute::status::Id;
|
||||
esp_matter_attr_val_t val = esp_matter_bool(status);
|
||||
return attribute::update(endpoint_id, cluster_id, attribute_id, &val);
|
||||
}
|
||||
|
||||
static esp_err_t node_id_attribute_update(char *node_id)
|
||||
{
|
||||
int endpoint_id = cluster::rainmaker::endpoint_id;
|
||||
int cluster_id = cluster::rainmaker::Id;
|
||||
int attribute_id = cluster::rainmaker::attribute::node_id::Id;
|
||||
uint16_t endpoint_id = cluster::rainmaker::endpoint_id;
|
||||
uint32_t cluster_id = cluster::rainmaker::Id;
|
||||
uint32_t attribute_id = cluster::rainmaker::attribute::node_id::Id;
|
||||
esp_matter_attr_val_t val = esp_matter_char_str(node_id, strlen(node_id));
|
||||
return attribute::update(endpoint_id, cluster_id, attribute_id, &val);
|
||||
}
|
||||
@@ -115,9 +115,9 @@ static void user_node_association_event_handler(void *arg, esp_event_base_t even
|
||||
static esp_err_t command_callback(const ConcreteCommandPath &command_path, TLVReader &tlv_data, void *opaque_ptr)
|
||||
{
|
||||
/* Get ids */
|
||||
int endpoint_id = command_path.mEndpointId;
|
||||
int cluster_id = command_path.mClusterId;
|
||||
int command_id = command_path.mCommandId;
|
||||
uint16_t endpoint_id = command_path.mEndpointId;
|
||||
uint32_t cluster_id = command_path.mClusterId;
|
||||
uint32_t command_id = command_path.mCommandId;
|
||||
|
||||
/* Return if this is not the rainmaker configuration command */
|
||||
if (endpoint_id != cluster::rainmaker::endpoint_id || cluster_id != cluster::rainmaker::Id ||
|
||||
|
||||
+24
-22
@@ -347,8 +347,8 @@ the terms like endpoints, clusters, etc. that are used in this section.
|
||||
|
||||
::
|
||||
|
||||
esp_err_t app_attribute_update_cb(callback_type_t type, int endpoint_id, int cluster_id, int attribute_id,
|
||||
esp_matter_attr_val_t *val, void *priv_data)
|
||||
esp_err_t app_attribute_update_cb(callback_type_t type, uint16_t endpoint_id, uint32_t cluster_id,
|
||||
uint32_t attribute_id, esp_matter_attr_val_t *val, void *priv_data)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
@@ -393,26 +393,28 @@ the terms like endpoints, clusters, etc. that are used in this section.
|
||||
|
||||
::
|
||||
|
||||
esp_err_t app_driver_attribute_update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val) {
|
||||
esp_err_t err = ESP_OK;
|
||||
if (endpoint_id == light_endpoint_id) {
|
||||
if (cluster_id == OnOff::Id) {
|
||||
if (attribute_id == OnOff::Attributes::OnOff::Id) {
|
||||
err = app_driver_light_set_power(val);
|
||||
}
|
||||
} else if (cluster_id == LevelControl::Id) {
|
||||
if (attribute_id == LevelControl::Attributes::CurrentLevel::Id) {
|
||||
err = app_driver_light_set_brightness(val);
|
||||
}
|
||||
} else if (cluster_id == ColorControl::Id) {
|
||||
if (attribute_id == ColorControl::Attributes::CurrentHue::Id) {
|
||||
err = app_driver_light_set_hue(val);
|
||||
} else if (attribute_id == ColorControl::Attributes::CurrentSaturation::Id) {
|
||||
err = app_driver_light_set_saturation(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
return err;
|
||||
esp_err_t app_driver_attribute_update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
|
||||
esp_matter_attr_val_t *val)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
if (endpoint_id == light_endpoint_id) {
|
||||
if (cluster_id == OnOff::Id) {
|
||||
if (attribute_id == OnOff::Attributes::OnOff::Id) {
|
||||
err = app_driver_light_set_power(val);
|
||||
}
|
||||
} else if (cluster_id == LevelControl::Id) {
|
||||
if (attribute_id == LevelControl::Attributes::CurrentLevel::Id) {
|
||||
err = app_driver_light_set_brightness(val);
|
||||
}
|
||||
} else if (cluster_id == ColorControl::Id) {
|
||||
if (attribute_id == ColorControl::Attributes::CurrentHue::Id) {
|
||||
err = app_driver_light_set_hue(val);
|
||||
} else if (attribute_id == ColorControl::Attributes::CurrentSaturation::Id) {
|
||||
err = app_driver_light_set_saturation(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
2.4.1.4 Matter Device Ready
|
||||
|
||||
@@ -46,7 +46,7 @@ app_zigbee_bridge_device_t *app_bridge_create_zigbee_device(node_t *node, uint8_
|
||||
return new_dev;
|
||||
}
|
||||
|
||||
uint16_t app_bridge_get_zigbee_shortaddr_by_matter_endpointid(int matter_endpointid)
|
||||
uint16_t app_bridge_get_zigbee_shortaddr_by_matter_endpointid(uint16_t matter_endpointid)
|
||||
{
|
||||
app_zigbee_bridge_device_t *current_dev = device_list;
|
||||
while (current_dev) {
|
||||
@@ -58,7 +58,7 @@ uint16_t app_bridge_get_zigbee_shortaddr_by_matter_endpointid(int matter_endpoin
|
||||
return 0xffff;
|
||||
}
|
||||
|
||||
int app_bridge_get_matter_endpointid_by_zigbee_shortaddr(uint16_t zigbee_shortaddr)
|
||||
uint16_t app_bridge_get_matter_endpointid_by_zigbee_shortaddr(uint16_t zigbee_shortaddr)
|
||||
{
|
||||
app_zigbee_bridge_device_t *current_dev = device_list;
|
||||
while (current_dev) {
|
||||
@@ -67,10 +67,10 @@ int app_bridge_get_matter_endpointid_by_zigbee_shortaddr(uint16_t zigbee_shortad
|
||||
}
|
||||
current_dev = current_dev->next;
|
||||
}
|
||||
return -1;
|
||||
return 0xFFFF;
|
||||
}
|
||||
|
||||
app_zigbee_bridge_device_t *app_bridge_get_zigbee_device_by_matter_endpointid(int matter_endpointid)
|
||||
app_zigbee_bridge_device_t *app_bridge_get_zigbee_device_by_matter_endpointid(uint16_t matter_endpointid)
|
||||
{
|
||||
app_zigbee_bridge_device_t *current_dev = device_list;
|
||||
while (current_dev) {
|
||||
|
||||
@@ -29,11 +29,11 @@ typedef struct app_zigbee_bridge_device {
|
||||
app_zigbee_bridge_device_t *app_bridge_create_zigbee_device(node_t *node, uint8_t zigbee_endpointid,
|
||||
uint16_t zigbee_shortaddr);
|
||||
|
||||
uint16_t app_bridge_get_zigbee_shortaddr_by_matter_endpointid(int matter_endpointid);
|
||||
uint16_t app_bridge_get_zigbee_shortaddr_by_matter_endpointid(uint16_t matter_endpointid);
|
||||
|
||||
int app_bridge_get_matter_endpointid_by_zigbee_shortaddr(uint16_t zigbee_shortaddr);
|
||||
uint16_t app_bridge_get_matter_endpointid_by_zigbee_shortaddr(uint16_t zigbee_shortaddr);
|
||||
|
||||
app_zigbee_bridge_device_t *app_bridge_get_zigbee_device_by_matter_endpointid(int matter_endpointid);
|
||||
app_zigbee_bridge_device_t *app_bridge_get_zigbee_device_by_matter_endpointid(uint16_t matter_endpointid);
|
||||
|
||||
app_zigbee_bridge_device_t *app_bridge_get_zigbee_device_by_zigbee_shortaddr(uint16_t zigbee_shortaddr);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
using namespace esp_matter;
|
||||
|
||||
static const char *TAG = "app_driver";
|
||||
extern int light_endpoint_id;
|
||||
extern uint16_t light_endpoint_id;
|
||||
|
||||
/* Do any conversions/remapping for the actual value here */
|
||||
static esp_err_t app_driver_light_set_power(esp_matter_attr_val_t *val)
|
||||
@@ -49,9 +49,9 @@ static esp_err_t app_driver_light_set_saturation(esp_matter_attr_val_t *val)
|
||||
static void app_driver_button_toggle_cb(void *arg)
|
||||
{
|
||||
ESP_LOGI(TAG, "Toggle button pressed");
|
||||
int endpoint_id = light_endpoint_id;
|
||||
int cluster_id = OnOff::Id;
|
||||
int attribute_id = OnOff::Attributes::OnOff::Id;
|
||||
uint16_t endpoint_id = light_endpoint_id;
|
||||
uint32_t cluster_id = OnOff::Id;
|
||||
uint32_t attribute_id = OnOff::Attributes::OnOff::Id;
|
||||
|
||||
node_t *node = node::get();
|
||||
endpoint_t *endpoint = endpoint::get(node, endpoint_id);
|
||||
@@ -64,7 +64,8 @@ static void app_driver_button_toggle_cb(void *arg)
|
||||
attribute::update(endpoint_id, cluster_id, attribute_id, &val);
|
||||
}
|
||||
|
||||
esp_err_t app_driver_attribute_update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val)
|
||||
esp_err_t app_driver_attribute_update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
|
||||
esp_matter_attr_val_t *val)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
if (endpoint_id == light_endpoint_id) {
|
||||
@@ -94,13 +95,13 @@ static esp_err_t app_driver_attribute_set_defaults()
|
||||
node_t *node = node::get();
|
||||
endpoint_t *endpoint = endpoint::get_first(node);
|
||||
while (endpoint) {
|
||||
int endpoint_id = endpoint::get_id(endpoint);
|
||||
uint16_t endpoint_id = endpoint::get_id(endpoint);
|
||||
cluster_t *cluster = cluster::get_first(endpoint);
|
||||
while (cluster) {
|
||||
int cluster_id = cluster::get_id(cluster);
|
||||
uint32_t cluster_id = cluster::get_id(cluster);
|
||||
attribute_t *attribute = attribute::get_first(cluster);
|
||||
while (attribute) {
|
||||
int attribute_id = attribute::get_id(attribute);
|
||||
uint32_t attribute_id = attribute::get_id(attribute);
|
||||
esp_matter_attr_val_t val = esp_matter_invalid(NULL);
|
||||
err |= attribute::get_val(attribute, &val);
|
||||
err |= app_driver_attribute_update(endpoint_id, cluster_id, attribute_id, &val);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <app_qrcode.h>
|
||||
|
||||
static const char *TAG = "app_main";
|
||||
int light_endpoint_id = 0;
|
||||
uint16_t light_endpoint_id = 0;
|
||||
|
||||
using namespace esp_matter;
|
||||
using namespace esp_matter::attribute;
|
||||
@@ -36,8 +36,8 @@ static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
|
||||
ESP_LOGI(TAG, "Current free heap: %zu", heap_caps_get_free_size(MALLOC_CAP_8BIT));
|
||||
}
|
||||
|
||||
static esp_err_t app_attribute_update_cb(callback_type_t type, int endpoint_id, int cluster_id, int attribute_id,
|
||||
esp_matter_attr_val_t *val, void *priv_data)
|
||||
static esp_err_t app_attribute_update_cb(callback_type_t type, uint16_t endpoint_id, uint32_t cluster_id,
|
||||
uint32_t attribute_id, esp_matter_attr_val_t *val, void *priv_data)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
|
||||
@@ -49,4 +49,5 @@ esp_err_t app_driver_init(void);
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t app_driver_attribute_update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val);
|
||||
esp_err_t app_driver_attribute_update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
|
||||
esp_matter_attr_val_t *val);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
using namespace esp_matter;
|
||||
|
||||
static const char *TAG = "app_driver";
|
||||
extern int light_endpoint_id;
|
||||
extern uint16_t light_endpoint_id;
|
||||
|
||||
/* Do any conversions/remapping for the actual value here */
|
||||
static esp_err_t app_driver_light_set_power(esp_matter_attr_val_t *val)
|
||||
@@ -49,9 +49,9 @@ static esp_err_t app_driver_light_set_saturation(esp_matter_attr_val_t *val)
|
||||
static void app_driver_button_toggle_cb(void *arg)
|
||||
{
|
||||
ESP_LOGI(TAG, "Toggle button pressed");
|
||||
int endpoint_id = light_endpoint_id;
|
||||
int cluster_id = OnOff::Id;
|
||||
int attribute_id = OnOff::Attributes::OnOff::Id;
|
||||
uint16_t endpoint_id = light_endpoint_id;
|
||||
uint32_t cluster_id = OnOff::Id;
|
||||
uint32_t attribute_id = OnOff::Attributes::OnOff::Id;
|
||||
|
||||
node_t *node = node::get();
|
||||
endpoint_t *endpoint = endpoint::get(node, endpoint_id);
|
||||
@@ -64,7 +64,8 @@ static void app_driver_button_toggle_cb(void *arg)
|
||||
attribute::update(endpoint_id, cluster_id, attribute_id, &val);
|
||||
}
|
||||
|
||||
esp_err_t app_driver_attribute_update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val)
|
||||
esp_err_t app_driver_attribute_update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
|
||||
esp_matter_attr_val_t *val)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
if (endpoint_id == light_endpoint_id) {
|
||||
@@ -94,13 +95,13 @@ static esp_err_t app_driver_attribute_set_defaults()
|
||||
node_t *node = node::get();
|
||||
endpoint_t *endpoint = endpoint::get_first(node);
|
||||
while (endpoint) {
|
||||
int endpoint_id = endpoint::get_id(endpoint);
|
||||
uint16_t endpoint_id = endpoint::get_id(endpoint);
|
||||
cluster_t *cluster = cluster::get_first(endpoint);
|
||||
while (cluster) {
|
||||
int cluster_id = cluster::get_id(cluster);
|
||||
uint32_t cluster_id = cluster::get_id(cluster);
|
||||
attribute_t *attribute = attribute::get_first(cluster);
|
||||
while (attribute) {
|
||||
int attribute_id = attribute::get_id(attribute);
|
||||
uint32_t attribute_id = attribute::get_id(attribute);
|
||||
esp_matter_attr_val_t val = esp_matter_invalid(NULL);
|
||||
err |= attribute::get_val(attribute, &val);
|
||||
err |= app_driver_attribute_update(endpoint_id, cluster_id, attribute_id, &val);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <app_rainmaker.h>
|
||||
|
||||
static const char *TAG = "app_main";
|
||||
int light_endpoint_id = 0;
|
||||
uint16_t light_endpoint_id = 0;
|
||||
|
||||
using namespace esp_matter;
|
||||
using namespace esp_matter::attribute;
|
||||
@@ -36,8 +36,8 @@ static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
|
||||
ESP_LOGI(TAG, "Current free heap: %zu", heap_caps_get_free_size(MALLOC_CAP_8BIT));
|
||||
}
|
||||
|
||||
static esp_err_t app_attribute_update_cb(callback_type_t type, int endpoint_id, int cluster_id, int attribute_id,
|
||||
esp_matter_attr_val_t *val, void *priv_data)
|
||||
static esp_err_t app_attribute_update_cb(callback_type_t type, uint16_t endpoint_id, uint32_t cluster_id,
|
||||
uint32_t attribute_id, esp_matter_attr_val_t *val, void *priv_data)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
|
||||
@@ -49,4 +49,5 @@ esp_err_t app_driver_init(void);
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t app_driver_attribute_update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val);
|
||||
esp_err_t app_driver_attribute_update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
|
||||
esp_matter_attr_val_t *val);
|
||||
|
||||
@@ -28,11 +28,12 @@
|
||||
using namespace esp_matter;
|
||||
|
||||
static const char *TAG = "app_rainmaker";
|
||||
extern int light_endpoint_id;
|
||||
extern uint16_t light_endpoint_id;
|
||||
|
||||
#define DEFAULT_LIGHT_NAME "Light"
|
||||
|
||||
static esp_rmaker_param_val_t app_rainmaker_get_rmaker_val(esp_matter_attr_val_t *val, int cluster_id, int attribute_id)
|
||||
static esp_rmaker_param_val_t app_rainmaker_get_rmaker_val(esp_matter_attr_val_t *val, uint32_t cluster_id,
|
||||
uint32_t attribute_id)
|
||||
{
|
||||
/* Attributes which need to be remapped */
|
||||
if (cluster_id == LevelControl::Id) {
|
||||
@@ -69,7 +70,8 @@ static esp_rmaker_param_val_t app_rainmaker_get_rmaker_val(esp_matter_attr_val_t
|
||||
return esp_rmaker_int(0);
|
||||
}
|
||||
|
||||
static esp_matter_attr_val_t app_rainmaker_get_matter_val(esp_rmaker_param_val_t *val, int cluster_id, int attribute_id)
|
||||
static esp_matter_attr_val_t app_rainmaker_get_matter_val(esp_rmaker_param_val_t *val, uint32_t cluster_id,
|
||||
uint32_t attribute_id)
|
||||
{
|
||||
/* Attributes which need to be remapped */
|
||||
if (cluster_id == LevelControl::Id) {
|
||||
@@ -100,7 +102,7 @@ static esp_matter_attr_val_t app_rainmaker_get_matter_val(esp_rmaker_param_val_t
|
||||
return esp_matter_int(0);
|
||||
}
|
||||
|
||||
static const char *app_rainmaker_get_device_name_from_id(int endpoint_id)
|
||||
static const char *app_rainmaker_get_device_name_from_id(uint32_t endpoint_id)
|
||||
{
|
||||
if (endpoint_id == light_endpoint_id) {
|
||||
return DEFAULT_LIGHT_NAME;
|
||||
@@ -108,7 +110,7 @@ static const char *app_rainmaker_get_device_name_from_id(int endpoint_id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *app_rainmaker_get_device_type_from_id(int device_type_id)
|
||||
static const char *app_rainmaker_get_device_type_from_id(uint32_t device_type_id)
|
||||
{
|
||||
if (device_type_id == endpoint::color_dimmable_light::get_device_type_id()) {
|
||||
return ESP_RMAKER_DEVICE_LIGHTBULB;
|
||||
@@ -116,15 +118,15 @@ static const char *app_rainmaker_get_device_type_from_id(int device_type_id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int app_rainmaker_get_endpoint_id_from_name(const char *device_name)
|
||||
static uint16_t app_rainmaker_get_endpoint_id_from_name(const char *device_name)
|
||||
{
|
||||
if (strcmp(device_name, DEFAULT_LIGHT_NAME) == 0) {
|
||||
return light_endpoint_id;
|
||||
}
|
||||
return 0;
|
||||
return 0xFFFF;
|
||||
}
|
||||
|
||||
static const char *app_rainmaker_get_param_name_from_id(int cluster_id, int attribute_id)
|
||||
static const char *app_rainmaker_get_param_name_from_id(uint32_t cluster_id, uint32_t attribute_id)
|
||||
{
|
||||
if (cluster_id == OnOff::Id) {
|
||||
if (attribute_id == OnOff::Attributes::OnOff::Id) {
|
||||
@@ -144,7 +146,7 @@ static const char *app_rainmaker_get_param_name_from_id(int cluster_id, int attr
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *app_rainmaker_get_param_type_from_id(int cluster_id, int attribute_id)
|
||||
static const char *app_rainmaker_get_param_type_from_id(uint32_t cluster_id, uint32_t attribute_id)
|
||||
{
|
||||
if (cluster_id == OnOff::Id) {
|
||||
if (attribute_id == OnOff::Attributes::OnOff::Id) {
|
||||
@@ -164,7 +166,7 @@ static const char *app_rainmaker_get_param_type_from_id(int cluster_id, int attr
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *app_rainmaker_get_param_ui_type_from_id(int cluster_id, int attribute_id)
|
||||
static const char *app_rainmaker_get_param_ui_type_from_id(uint32_t cluster_id, uint32_t attribute_id)
|
||||
{
|
||||
if (cluster_id == OnOff::Id) {
|
||||
if (attribute_id == OnOff::Attributes::OnOff::Id) {
|
||||
@@ -184,7 +186,8 @@ static const char *app_rainmaker_get_param_ui_type_from_id(int cluster_id, int a
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool app_rainmaker_get_param_bounds_from_id(int cluster_id, int attribute_id, int *min, int *max, int *step)
|
||||
static bool app_rainmaker_get_param_bounds_from_id(uint32_t cluster_id, uint32_t attribute_id, int *min, int *max,
|
||||
int *step)
|
||||
{
|
||||
if (cluster_id == LevelControl::Id) {
|
||||
if (attribute_id == LevelControl::Attributes::CurrentLevel::Id) {
|
||||
@@ -211,8 +214,8 @@ static bool app_rainmaker_get_param_bounds_from_id(int cluster_id, int attribute
|
||||
|
||||
static esp_err_t app_rainmaker_param_add_ui_type(esp_rmaker_param_t *param, cluster_t *cluster, attribute_t *attribute)
|
||||
{
|
||||
int cluster_id = cluster::get_id(cluster);
|
||||
int attribute_id = attribute::get_id(attribute);
|
||||
uint32_t cluster_id = cluster::get_id(cluster);
|
||||
uint32_t attribute_id = attribute::get_id(attribute);
|
||||
const char *ui_type = app_rainmaker_get_param_ui_type_from_id(cluster_id, attribute_id);
|
||||
if (!ui_type) {
|
||||
return ESP_OK;
|
||||
@@ -222,8 +225,8 @@ static esp_err_t app_rainmaker_param_add_ui_type(esp_rmaker_param_t *param, clus
|
||||
|
||||
static esp_err_t app_rainmaker_param_add_bounds(esp_rmaker_param_t *param, cluster_t *cluster, attribute_t *attribute)
|
||||
{
|
||||
int cluster_id = cluster::get_id(cluster);
|
||||
int attribute_id = attribute::get_id(attribute);
|
||||
uint32_t cluster_id = cluster::get_id(cluster);
|
||||
uint32_t attribute_id = attribute::get_id(attribute);
|
||||
esp_matter_attr_bounds_t *bounds = attribute::get_bounds(attribute);
|
||||
if (bounds) {
|
||||
esp_rmaker_param_val_t min_val = app_rainmaker_get_rmaker_val(&bounds->min, cluster_id, attribute_id);
|
||||
@@ -245,7 +248,7 @@ static esp_err_t app_rainmaker_param_add_bounds(esp_rmaker_param_t *param, clust
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static int app_rainmaker_get_cluster_id_from_name(const char *param_name)
|
||||
static uint32_t app_rainmaker_get_cluster_id_from_name(const char *param_name)
|
||||
{
|
||||
if (strcmp(param_name, ESP_RMAKER_DEF_POWER_NAME) == 0) {
|
||||
return OnOff::Id;
|
||||
@@ -259,7 +262,7 @@ static int app_rainmaker_get_cluster_id_from_name(const char *param_name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int app_rainmaker_get_attribute_id_from_name(const char *param_name)
|
||||
static uint32_t app_rainmaker_get_attribute_id_from_name(const char *param_name)
|
||||
{
|
||||
if (strcmp(param_name, ESP_RMAKER_DEF_POWER_NAME) == 0) {
|
||||
return OnOff::Attributes::OnOff::Id;
|
||||
@@ -273,7 +276,8 @@ static int app_rainmaker_get_attribute_id_from_name(const char *param_name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
esp_err_t app_rainmaker_attribute_update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val)
|
||||
esp_err_t app_rainmaker_attribute_update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
|
||||
esp_matter_attr_val_t *val)
|
||||
{
|
||||
const char *device_name = app_rainmaker_get_device_name_from_id(endpoint_id);
|
||||
const char *param_name = app_rainmaker_get_param_name_from_id(cluster_id, attribute_id);
|
||||
@@ -305,9 +309,9 @@ static esp_err_t write_cb(const esp_rmaker_device_t *device, const esp_rmaker_pa
|
||||
const char *device_name = esp_rmaker_device_get_name(device);
|
||||
const char *param_name = esp_rmaker_param_get_name(param);
|
||||
|
||||
int endpoint_id = app_rainmaker_get_endpoint_id_from_name(device_name);
|
||||
int cluster_id = app_rainmaker_get_cluster_id_from_name(param_name);
|
||||
int attribute_id = app_rainmaker_get_attribute_id_from_name(param_name);
|
||||
uint16_t endpoint_id = app_rainmaker_get_endpoint_id_from_name(device_name);
|
||||
uint32_t cluster_id = app_rainmaker_get_cluster_id_from_name(param_name);
|
||||
uint32_t attribute_id = app_rainmaker_get_attribute_id_from_name(param_name);
|
||||
esp_matter_attr_val_t matter_val = app_rainmaker_get_matter_val((esp_rmaker_param_val_t *)&val, cluster_id,
|
||||
attribute_id);
|
||||
|
||||
@@ -316,13 +320,13 @@ static esp_err_t write_cb(const esp_rmaker_device_t *device, const esp_rmaker_pa
|
||||
|
||||
static esp_rmaker_device_t *app_rainmaker_device_create(const esp_rmaker_node_t *node, endpoint_t *endpoint)
|
||||
{
|
||||
int endpoint_id = endpoint::get_id(endpoint);
|
||||
uint16_t endpoint_id = endpoint::get_id(endpoint);
|
||||
const char *device_name = app_rainmaker_get_device_name_from_id(endpoint_id);
|
||||
if (!device_name) {
|
||||
return NULL;
|
||||
}
|
||||
/* Add this device only if endpoint_id has been handled */
|
||||
int device_type_id = endpoint::get_device_type_id(endpoint);
|
||||
uint32_t device_type_id = endpoint::get_device_type_id(endpoint);
|
||||
const char *device_type = app_rainmaker_get_device_type_from_id(device_type_id);
|
||||
esp_rmaker_device_t *device = esp_rmaker_device_create(device_name, device_type, NULL);
|
||||
if (!device) {
|
||||
@@ -337,8 +341,8 @@ static esp_rmaker_device_t *app_rainmaker_device_create(const esp_rmaker_node_t
|
||||
static esp_rmaker_param_t *app_rainmaker_param_create(esp_rmaker_device_t *device, cluster_t *cluster,
|
||||
attribute_t *attribute)
|
||||
{
|
||||
int cluster_id = cluster::get_id(cluster);
|
||||
int attribute_id = attribute::get_id(attribute);
|
||||
uint32_t cluster_id = cluster::get_id(cluster);
|
||||
uint32_t attribute_id = attribute::get_id(attribute);
|
||||
const char *param_name = app_rainmaker_get_param_name_from_id(cluster_id, attribute_id);
|
||||
if (!param_name) {
|
||||
return NULL;
|
||||
|
||||
@@ -47,7 +47,8 @@ esp_err_t app_rainmaker_start(void);
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t app_rainmaker_attribute_update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val);
|
||||
esp_err_t app_rainmaker_attribute_update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
|
||||
esp_matter_attr_val_t *val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,9 +25,9 @@ using namespace esp_matter;
|
||||
using namespace esp_matter::cluster;
|
||||
|
||||
static const char *TAG = "app_driver";
|
||||
extern int switch_endpoint_id;
|
||||
static int g_cluster_id = kInvalidClusterId;
|
||||
static int g_command_id = kInvalidCommandId;
|
||||
extern uint16_t switch_endpoint_id;
|
||||
static uint32_t g_cluster_id = kInvalidClusterId;
|
||||
static uint32_t g_command_id = kInvalidCommandId;
|
||||
|
||||
static esp_err_t app_driver_bound_console_handler(int argc, char **argv)
|
||||
{
|
||||
@@ -37,9 +37,9 @@ static esp_err_t app_driver_bound_console_handler(int argc, char **argv)
|
||||
"\tinvoke: <endpoint_id> <cluster_id> <command_id>. "
|
||||
"Example: matter esp bound invoke 0x0001 0x0006 0x0002.\n");
|
||||
} else if (argc == 4 && strncmp(argv[0], "invoke", sizeof("invoke")) == 0) {
|
||||
int endpoint_id = strtol((const char *)&argv[1][2], NULL, 16);
|
||||
int cluster_id = strtol((const char *)&argv[2][2], NULL, 16);
|
||||
int command_id = strtol((const char *)&argv[3][2], NULL, 16);
|
||||
uint16_t endpoint_id = strtol((const char *)&argv[1][2], NULL, 16);
|
||||
uint32_t cluster_id = strtol((const char *)&argv[2][2], NULL, 16);
|
||||
uint32_t command_id = strtol((const char *)&argv[3][2], NULL, 16);
|
||||
|
||||
g_cluster_id = cluster_id;
|
||||
g_command_id = command_id;
|
||||
@@ -59,11 +59,11 @@ static esp_err_t app_driver_client_console_handler(int argc, char **argv)
|
||||
"\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) {
|
||||
int fabric_index = strtol((const char *)&argv[1][2], NULL, 16);
|
||||
int node_id = strtol((const char *)&argv[2][2], NULL, 16);
|
||||
int remote_endpoint_id = strtol((const char *)&argv[3][2], NULL, 16);
|
||||
int cluster_id = strtol((const char *)&argv[4][2], NULL, 16);
|
||||
int command_id = strtol((const char *)&argv[5][2], NULL, 16);
|
||||
uint8_t fabric_index = strtol((const char *)&argv[1][2], NULL, 16);
|
||||
uint64_t node_id = strtol((const char *)&argv[2][2], NULL, 16);
|
||||
uint16_t remote_endpoint_id = strtol((const char *)&argv[3][2], NULL, 16);
|
||||
uint32_t cluster_id = strtol((const char *)&argv[4][2], NULL, 16);
|
||||
uint32_t command_id = strtol((const char *)&argv[5][2], NULL, 16);
|
||||
|
||||
g_cluster_id = cluster_id;
|
||||
g_command_id = command_id;
|
||||
@@ -98,7 +98,8 @@ static void app_driver_register_commands()
|
||||
esp_matter_console_add_command(&client_command);
|
||||
}
|
||||
|
||||
void app_driver_client_command_callback(client::peer_device_t *peer_device, int remote_endpoint_id, void *priv_data)
|
||||
void app_driver_client_command_callback(client::peer_device_t *peer_device, uint16_t remote_endpoint_id,
|
||||
void *priv_data)
|
||||
{
|
||||
/** TODO: Find a better way to get the cluster_id and command_id.
|
||||
Once done, move the console commands to esp_matter_client. */
|
||||
@@ -116,16 +117,17 @@ void app_driver_client_command_callback(client::peer_device_t *peer_device, int
|
||||
static void app_driver_button_toggle_cb(void *arg)
|
||||
{
|
||||
ESP_LOGI(TAG, "Toggle button pressed");
|
||||
int endpoint_id = switch_endpoint_id;
|
||||
int cluster_id = OnOff::Id;
|
||||
int command_id = OnOff::Commands::Toggle::Id;
|
||||
uint16_t endpoint_id = switch_endpoint_id;
|
||||
uint32_t cluster_id = OnOff::Id;
|
||||
uint32_t command_id = OnOff::Commands::Toggle::Id;
|
||||
|
||||
g_cluster_id = cluster_id;
|
||||
g_command_id = command_id;
|
||||
client::cluster_update(endpoint_id, cluster_id);
|
||||
}
|
||||
|
||||
esp_err_t app_driver_attribute_update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val)
|
||||
esp_err_t app_driver_attribute_update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
|
||||
esp_matter_attr_val_t *val)
|
||||
{
|
||||
/* Nothing to do here */
|
||||
return ESP_OK;
|
||||
@@ -138,13 +140,13 @@ static esp_err_t app_driver_attribute_set_defaults()
|
||||
node_t *node = node::get();
|
||||
endpoint_t *endpoint = endpoint::get_first(node);
|
||||
while (endpoint) {
|
||||
int endpoint_id = endpoint::get_id(endpoint);
|
||||
uint16_t endpoint_id = endpoint::get_id(endpoint);
|
||||
cluster_t *cluster = cluster::get_first(endpoint);
|
||||
while (cluster) {
|
||||
int cluster_id = cluster::get_id(cluster);
|
||||
uint32_t cluster_id = cluster::get_id(cluster);
|
||||
attribute_t *attribute = attribute::get_first(cluster);
|
||||
while (attribute) {
|
||||
int attribute_id = attribute::get_id(attribute);
|
||||
uint32_t attribute_id = attribute::get_id(attribute);
|
||||
esp_matter_attr_val_t val = esp_matter_invalid(NULL);
|
||||
err |= attribute::get_val(attribute, &val);
|
||||
err |= app_driver_attribute_update(endpoint_id, cluster_id, attribute_id, &val);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <app_qrcode.h>
|
||||
|
||||
static const char *TAG = "app_main";
|
||||
int switch_endpoint_id = 0;
|
||||
uint16_t switch_endpoint_id = 0;
|
||||
|
||||
using namespace esp_matter;
|
||||
using namespace esp_matter::attribute;
|
||||
@@ -36,8 +36,8 @@ static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
|
||||
ESP_LOGI(TAG, "Current free heap: %zu", heap_caps_get_free_size(MALLOC_CAP_8BIT));
|
||||
}
|
||||
|
||||
static esp_err_t app_attribute_update_cb(callback_type_t type, int endpoint_id, int cluster_id, int attribute_id,
|
||||
esp_matter_attr_val_t *val, void *priv_data)
|
||||
static esp_err_t app_attribute_update_cb(callback_type_t type, uint16_t endpoint_id, uint32_t cluster_id,
|
||||
uint32_t attribute_id, esp_matter_attr_val_t *val, void *priv_data)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
|
||||
@@ -33,4 +33,5 @@ esp_err_t app_driver_init(void);
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t app_driver_attribute_update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val);
|
||||
esp_err_t app_driver_attribute_update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
|
||||
esp_matter_attr_val_t *val);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
using namespace esp_matter;
|
||||
|
||||
static const char *TAG = "app_driver";
|
||||
extern int light_endpoint_id;
|
||||
extern uint16_t light_endpoint_id;
|
||||
|
||||
/* Do any conversions/remapping for the actual value here */
|
||||
static esp_err_t app_driver_light_set_power(esp_matter_attr_val_t *val)
|
||||
@@ -49,9 +49,9 @@ static esp_err_t app_driver_light_set_saturation(esp_matter_attr_val_t *val)
|
||||
static void app_driver_button_toggle_cb(void *arg)
|
||||
{
|
||||
ESP_LOGI(TAG, "Toggle button pressed");
|
||||
int endpoint_id = light_endpoint_id;
|
||||
int cluster_id = OnOff::Id;
|
||||
int attribute_id = OnOff::Attributes::OnOff::Id;
|
||||
uint16_t endpoint_id = light_endpoint_id;
|
||||
uint32_t cluster_id = OnOff::Id;
|
||||
uint32_t attribute_id = OnOff::Attributes::OnOff::Id;
|
||||
|
||||
uint8_t value;
|
||||
attribute::get_val_raw(endpoint_id, cluster_id, attribute_id, &value, sizeof(uint8_t));
|
||||
@@ -60,7 +60,8 @@ static void app_driver_button_toggle_cb(void *arg)
|
||||
attribute::update(endpoint_id, cluster_id, attribute_id, &val);
|
||||
}
|
||||
|
||||
esp_err_t app_driver_attribute_update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val)
|
||||
esp_err_t app_driver_attribute_update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
|
||||
esp_matter_attr_val_t *val)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
if (endpoint_id == light_endpoint_id) {
|
||||
@@ -90,9 +91,9 @@ esp_err_t app_driver_attribute_set_defaults()
|
||||
/* Get the default value (current value) from matter submodule and update the app_driver */
|
||||
esp_err_t err = ESP_OK;
|
||||
uint8_t value;
|
||||
int endpoint_id = 0;
|
||||
int cluster_id = 0;
|
||||
int attribute_id = 0;
|
||||
uint16_t endpoint_id = 0;
|
||||
uint32_t cluster_id = 0;
|
||||
uint32_t attribute_id = 0;
|
||||
esp_matter_attr_val_t val = esp_matter_invalid(NULL);
|
||||
|
||||
endpoint_id = light_endpoint_id;
|
||||
|
||||
@@ -21,7 +21,7 @@ using namespace esp_matter;
|
||||
using namespace esp_matter::attribute;
|
||||
|
||||
static const char *TAG = "app_main";
|
||||
int light_endpoint_id = 0;
|
||||
uint16_t light_endpoint_id = 0;
|
||||
|
||||
static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
|
||||
{
|
||||
@@ -34,8 +34,8 @@ static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
|
||||
ESP_LOGI(TAG, "Current free heap: %zu", heap_caps_get_free_size(MALLOC_CAP_8BIT));
|
||||
}
|
||||
|
||||
static esp_err_t app_attribute_update_cb(callback_type_t type, int endpoint_id, int cluster_id, int attribute_id,
|
||||
esp_matter_attr_val_t *val, void *priv_data)
|
||||
static esp_err_t app_attribute_update_cb(callback_type_t type, uint16_t endpoint_id, uint32_t cluster_id,
|
||||
uint32_t attribute_id, esp_matter_attr_val_t *val, void *priv_data)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
|
||||
@@ -43,7 +43,8 @@ esp_err_t app_driver_init(void);
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t app_driver_attribute_update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val);
|
||||
esp_err_t app_driver_attribute_update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
|
||||
esp_matter_attr_val_t *val);
|
||||
|
||||
/** Set driver defaults
|
||||
*
|
||||
|
||||
@@ -34,8 +34,8 @@ static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg)
|
||||
ESP_LOGI(TAG, "Current free heap: %zu", heap_caps_get_free_size(MALLOC_CAP_8BIT));
|
||||
}
|
||||
|
||||
static esp_err_t app_attribute_update_cb(callback_type_t type, int endpoint_id, int cluster_id, int attribute_id,
|
||||
esp_matter_attr_val_t *val, void *priv_data)
|
||||
static esp_err_t app_attribute_update_cb(callback_type_t type, uint16_t endpoint_id, uint32_t cluster_id,
|
||||
uint32_t attribute_id, esp_matter_attr_val_t *val, void *priv_data)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
|
||||
@@ -120,7 +120,8 @@ void zigbee_bridge_send_off(zb_uint8_t buf, zb_uint16_t zigbee_shortaddr)
|
||||
ZB_ZCL_CMD_ON_OFF_OFF_ID, NULL);
|
||||
}
|
||||
|
||||
esp_err_t zigbee_bridge_attribute_update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val)
|
||||
esp_err_t zigbee_bridge_attribute_update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
|
||||
esp_matter_attr_val_t *val)
|
||||
{
|
||||
app_zigbee_bridge_device_t *zigbee_device = app_bridge_get_zigbee_device_by_matter_endpointid(endpoint_id);
|
||||
if (zigbee_device && zigbee_device->dev && zigbee_device->dev->endpoint) {
|
||||
|
||||
@@ -23,7 +23,8 @@ void zigbee_bridge_match_bridged_onoff_light(zb_bufid_t bufid);
|
||||
|
||||
void zigbee_bridge_match_bridged_onoff_light_timeout(zb_bufid_t bufid);
|
||||
|
||||
esp_err_t zigbee_bridge_attribute_update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t *val);
|
||||
esp_err_t zigbee_bridge_attribute_update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
|
||||
esp_matter_attr_val_t *val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user