Skip to content

Commit 5ee8d62

Browse files
committed
Merge branch 'bugfix/descriptor' into 'main'
components/esp-matter: Add features as parameter in descriptor cluster create() API. See merge request app-frameworks/esp-matter!963
2 parents 7e54123 + a51c114 commit 5ee8d62

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

components/esp_matter/esp_matter_cluster.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
140140
global::attribute::create_cluster_revision(cluster, cluster_revision);
141141
}
142142

143+
/* Features */
144+
if (config != NULL && config->features & feature::taglist::get_id()) {
145+
feature::taglist::add(cluster);
146+
}
147+
143148
return cluster;
144149
}
145150
} /* descriptor */

components/esp_matter/esp_matter_cluster.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ typedef struct config {
6565
} /* common */
6666

6767
namespace descriptor {
68-
using config_t = common::config_t;
68+
typedef struct config {
69+
uint32_t features;
70+
config() : features(0) {}
71+
} config_t;
6972
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
7073
} /* descriptor */
7174

components/esp_matter/esp_matter_endpoint.cpp

+1-9
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,6 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
132132
return err;
133133
}
134134

135-
cluster_t *cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER);
136-
if (!cluster) {
137-
return ESP_ERR_INVALID_STATE;
138-
}
139135
cluster_t *cluster_p = cluster::ota_provider::create(endpoint, NULL, CLUSTER_FLAG_CLIENT);
140136
cluster_t *cluster_r = cluster::ota_requestor::create(endpoint, &(config->ota_requestor), CLUSTER_FLAG_SERVER);
141137
if (!cluster_p || !cluster_r) {
@@ -181,11 +177,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
181177
return err;
182178
}
183179

184-
cluster_t *cluster = descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER);
185-
if (!cluster) {
186-
return ESP_ERR_INVALID_STATE;
187-
}
188-
cluster = cluster::ota_provider::create(endpoint, &(config->ota_provider), CLUSTER_FLAG_SERVER);
180+
cluster_t *cluster = cluster::ota_provider::create(endpoint, &(config->ota_provider), CLUSTER_FLAG_SERVER);
189181
if (!cluster) {
190182
return ESP_FAIL;
191183
}

0 commit comments

Comments
 (0)