[v1.3]components/esp-matter:add endpoint list attr for power source cluster

This commit is contained in:
liyashuai
2024-12-03 17:54:39 +08:00
parent 6d33b7d0cc
commit a3e709ebdf
3 changed files with 15 additions and 3 deletions
@@ -4217,6 +4217,15 @@ attribute_t *create_active_bat_charge_faults(cluster_t *cluster, uint8_t * value
return esp_matter::attribute::create(cluster, PowerSource::Attributes::ActiveBatChargeFaults::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count));
}
attribute_t *create_endpoint_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count)
{
if (count > k_max_endpoint_count) {
ESP_LOGE(TAG, "Could not create attribute, list out of bound");
return NULL;
}
return esp_matter::attribute::create(cluster, PowerSource::Attributes::EndpointList::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count));
}
} /* attribute */
} /* power_source */
@@ -911,6 +911,7 @@ constexpr uint8_t k_max_fault_count = 8;
constexpr uint8_t k_max_designation_count = 20;
constexpr uint8_t k_max_charge_faults_count = 16;
constexpr uint8_t k_max_bat_replacement_description_length = 60;
constexpr uint8_t k_max_endpoint_count = 16;
namespace attribute {
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_
attribute_t *create_bat_functional_while_charging(cluster_t *cluster, bool value);
attribute_t *create_bat_charging_current(cluster_t *cluster, nullable<uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max);
attribute_t *create_active_bat_charge_faults(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count);
attribute_t *create_endpoint_list(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count);
} /* attribute */
} /* power_source */
+4 -3
View File
@@ -1007,6 +1007,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
attribute::create_status(cluster, config->status);
attribute::create_order(cluster, config->order, 0x00, 0xFF);
attribute::create_description(cluster, config->description, strlen(config->description));
attribute::create_endpoint_list(cluster, NULL, 0, 0);
} else {
ESP_LOGE(TAG, "Config is NULL. Cannot add some attributes.");
}
@@ -2889,7 +2890,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
}
}
/* Features */
if (features & feature::visual::get_id()) {
feature::visual::add(cluster, &(config->visual));
@@ -3728,7 +3729,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
feature::dynamic_power_flow::add(cluster);
}
}
return cluster;
}
} /* power_topology */
@@ -4085,7 +4086,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
(features & feature::forecast_adjustment::get_id()) ||
(features & feature::constraint_based_adjustment::get_id())) &&
!(features & feature::power_forecast_reporting::get_id())) {
feature::state_forecast_reporting::add(cluster);
}
}