added attribute_read_done_cb for read command in esp_matter_controller component

This commit is contained in:
Sayon Deep
2023-11-23 22:37:49 +05:30
parent 695c893d58
commit 42ee6b551e
3 changed files with 14 additions and 3 deletions
@@ -160,6 +160,10 @@ void read_command::OnDeallocatePaths(chip::app::ReadPrepareParams &&aReadPrepare
void read_command::OnDone(ReadClient *apReadClient)
{
ESP_LOGI(TAG, "read done");
if (attribute_data_ondone_cb) {
attribute_data_ondone_cb();
}
chip::Platform::Delete(apReadClient);
chip::Platform::Delete(this);
}
@@ -167,7 +171,7 @@ void read_command::OnDone(ReadClient *apReadClient)
esp_err_t send_read_attr_command(uint64_t node_id, uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id)
{
read_command *cmd = chip::Platform::New<read_command>(node_id, endpoint_id, cluster_id, attribute_id,
READ_ATTRIBUTE, nullptr, nullptr);
READ_ATTRIBUTE, nullptr, nullptr,nullptr);
if (!cmd) {
ESP_LOGE(TAG, "Failed to alloc memory for read_command");
return ESP_ERR_NO_MEM;
@@ -179,7 +183,7 @@ esp_err_t send_read_attr_command(uint64_t node_id, uint16_t endpoint_id, uint32_
esp_err_t send_read_event_command(uint64_t node_id, uint16_t endpoint_id, uint32_t cluster_id, uint32_t event_id)
{
read_command *cmd =
chip::Platform::New<read_command>(node_id, endpoint_id, cluster_id, event_id, READ_EVENT, nullptr, nullptr);
chip::Platform::New<read_command>(node_id, endpoint_id, cluster_id, event_id, READ_EVENT, nullptr,nullptr, nullptr);
if (!cmd) {
ESP_LOGE(TAG, "Failed to alloc memory for read_command");
return ESP_ERR_NO_MEM;