Skip to content

Commit acc31fa

Browse files
committed
Merge branch 'add_endpoint_list_attribute_for_power_source_cluster_v1_3' into 'release/v1.3'
[v1.3]components/esp-matter:add endpoint list attr for power source cluster See merge request app-frameworks/esp-matter!967
2 parents 6d33b7d + a3e709e commit acc31fa

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

components/esp_matter/esp_matter_attribute.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -4217,6 +4217,15 @@ attribute_t *create_active_bat_charge_faults(cluster_t *cluster, uint8_t * value
42174217
return esp_matter::attribute::create(cluster, PowerSource::Attributes::ActiveBatChargeFaults::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count));
42184218
}
42194219

4220+
attribute_t *create_endpoint_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count)
4221+
{
4222+
if (count > k_max_endpoint_count) {
4223+
ESP_LOGE(TAG, "Could not create attribute, list out of bound");
4224+
return NULL;
4225+
}
4226+
return esp_matter::attribute::create(cluster, PowerSource::Attributes::EndpointList::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count));
4227+
}
4228+
42204229
} /* attribute */
42214230
} /* power_source */
42224231

components/esp_matter/esp_matter_attribute.h

+2
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,7 @@ constexpr uint8_t k_max_fault_count = 8;
911911
constexpr uint8_t k_max_designation_count = 20;
912912
constexpr uint8_t k_max_charge_faults_count = 16;
913913
constexpr uint8_t k_max_bat_replacement_description_length = 60;
914+
constexpr uint8_t k_max_endpoint_count = 16;
914915

915916
namespace attribute {
916917
attribute_t *create_status(cluster_t *cluster, uint8_t value);
@@ -944,6 +945,7 @@ attribute_t *create_bat_time_to_full_charge(cluster_t *cluster, nullable<uint32_
944945
attribute_t *create_bat_functional_while_charging(cluster_t *cluster, bool value);
945946
attribute_t *create_bat_charging_current(cluster_t *cluster, nullable<uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max);
946947
attribute_t *create_active_bat_charge_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count);
948+
attribute_t *create_endpoint_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count);
947949
} /* attribute */
948950
} /* power_source */
949951

components/esp_matter/esp_matter_cluster.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
10071007
attribute::create_status(cluster, config->status);
10081008
attribute::create_order(cluster, config->order, 0x00, 0xFF);
10091009
attribute::create_description(cluster, config->description, strlen(config->description));
1010+
attribute::create_endpoint_list(cluster, NULL, 0, 0);
10101011
} else {
10111012
ESP_LOGE(TAG, "Config is NULL. Cannot add some attributes.");
10121013
}
@@ -2889,7 +2890,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
28892890
}
28902891
}
28912892

2892-
2893+
28932894
/* Features */
28942895
if (features & feature::visual::get_id()) {
28952896
feature::visual::add(cluster, &(config->visual));
@@ -3728,7 +3729,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
37283729
feature::dynamic_power_flow::add(cluster);
37293730
}
37303731
}
3731-
3732+
37323733
return cluster;
37333734
}
37343735
} /* power_topology */
@@ -4085,7 +4086,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
40854086
(features & feature::forecast_adjustment::get_id()) ||
40864087
(features & feature::constraint_based_adjustment::get_id())) &&
40874088
!(features & feature::power_forecast_reporting::get_id())) {
4088-
4089+
40894090
feature::state_forecast_reporting::add(cluster);
40904091
}
40914092
}

0 commit comments

Comments
 (0)