Skip to content

Commit e4433ad

Browse files
committed
Merge branch 'add_endpoint_list_attribute_for_power_source_cluster' into 'main'
components/esp-matter:add endpoint list attr for power source cluster See merge request app-frameworks/esp-matter!966
2 parents cc1a4f3 + 593726e commit e4433ad

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

components/esp_matter/esp_matter_attribute.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -3097,7 +3097,7 @@ attribute_t *create_number_of_credentials_supported_per_user(cluster_t *cluster,
30973097
attribute_t *create_language(cluster_t *cluster, const char * value, uint16_t length)
30983098
{
30993099
VerifyOrReturnValue(length <= k_max_language_length, NULL, ESP_LOGE(TAG, "Could not create attribute, string size out of bound"));
3100-
3100+
31013101
return esp_matter::attribute::create(cluster, DoorLock::Attributes::Language::Id, ATTRIBUTE_FLAG_WRITABLE,
31023102
esp_matter_char_str((char *)value, length), k_max_language_length);
31033103
}
@@ -4221,6 +4221,12 @@ attribute_t *create_active_bat_charge_faults(cluster_t *cluster, uint8_t * value
42214221
return esp_matter::attribute::create(cluster, PowerSource::Attributes::ActiveBatChargeFaults::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count));
42224222
}
42234223

4224+
attribute_t *create_endpoint_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count)
4225+
{
4226+
VerifyOrReturnValue(count <= k_max_endpoint_count, NULL, ESP_LOGE(TAG, "Could not create attribute, list out of bound"));
4227+
return esp_matter::attribute::create(cluster, PowerSource::Attributes::EndpointList::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count));
4228+
}
4229+
42244230
} /* attribute */
42254231
} /* power_source */
42264232

components/esp_matter/esp_matter_attribute.h

+2
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,7 @@ constexpr uint8_t k_max_fault_count = 8;
974974
constexpr uint8_t k_max_designation_count = 20;
975975
constexpr uint8_t k_max_charge_faults_count = 16;
976976
constexpr uint8_t k_max_bat_replacement_description_length = 60;
977+
constexpr uint8_t k_max_endpoint_count = 16;
977978

978979
namespace attribute {
979980
attribute_t *create_status(cluster_t *cluster, uint8_t value);
@@ -1007,6 +1008,7 @@ attribute_t *create_bat_time_to_full_charge(cluster_t *cluster, nullable<uint32_
10071008
attribute_t *create_bat_functional_while_charging(cluster_t *cluster, bool value);
10081009
attribute_t *create_bat_charging_current(cluster_t *cluster, nullable<uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max);
10091010
attribute_t *create_active_bat_charge_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count);
1011+
attribute_t *create_endpoint_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count);
10101012
} /* attribute */
10111013
} /* power_source */
10121014

components/esp_matter/esp_matter_cluster.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
122122
{
123123
cluster_t *cluster = cluster::create(endpoint, Descriptor::Id, flags);
124124
VerifyOrReturnValue(cluster, NULL, ESP_LOGE(TAG, "Could not create cluster. cluster_id: 0x%08" PRIX32, Descriptor::Id));
125-
125+
126126
if (flags & CLUSTER_FLAG_SERVER) {
127127
static const auto plugin_server_init_cb = CALL_ONCE(MatterDescriptorPluginServerInitCallback);
128128
set_plugin_server_init_callback(cluster, plugin_server_init_cb);
@@ -773,6 +773,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
773773
attribute::create_status(cluster, config->status);
774774
attribute::create_order(cluster, config->order, 0x00, 0xFF);
775775
attribute::create_description(cluster, config->description, strlen(config->description));
776+
attribute::create_endpoint_list(cluster, NULL, 0, 0);
776777
} else {
777778
ESP_LOGE(TAG, "Config is NULL. Cannot add some attributes.");
778779
}

0 commit comments

Comments
 (0)