mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
components/esp_matter: move air quality attribute storage to external
Storage of this attribute was moved from esp-matter to connectedhomeip during the v1.4.2 release by implementing the AAI in connectedhomeip. For most clusters, AAI registration occurs in the cluster-init callback, but for this Air Quality cluster, it is delegated to the application layer. So, in the esp-matter's workflow, no one registers the AAI. And, as this attribute is of primitive type, we can discard the ATTRIBUTE_FLAG_MANAGED_INTERNALLY flag and storage can be managed by esp-matter.
This commit is contained in:
@@ -2347,7 +2347,13 @@ namespace attribute {
|
||||
|
||||
attribute_t *create_air_quality(cluster_t *cluster, uint8_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, AirQuality::Attributes::AirQuality::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY,
|
||||
// Storage of this attribute was moved from esp-matter to connectedhomeip during the v1.4.2 release by
|
||||
// implementing the AAI in connectedhomeip.
|
||||
// For most clusters, AAI registration occurs in the cluster-init callback, but for this cluster,
|
||||
// it is delegated to the application layer. So, in the esp-matter's workflow, no one registers the AAI.
|
||||
// And, as this attribute is of primitive type, we can discard the ATTRIBUTE_FLAG_MANAGED_INTERNALLY flag
|
||||
// and storage can be managed by esp-matter.
|
||||
return esp_matter::attribute::create(cluster, AirQuality::Attributes::AirQuality::Id, ATTRIBUTE_FLAG_NONE,
|
||||
esp_matter_enum8(value));
|
||||
}
|
||||
|
||||
|
||||
@@ -1403,7 +1403,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
|
||||
/* Attributes managed internally */
|
||||
global::attribute::create_feature_map(cluster, 0);
|
||||
|
||||
attribute::create_air_quality(cluster, 0);
|
||||
attribute::create_air_quality(cluster, config->air_quality);
|
||||
|
||||
/* Attributes not managed internally */
|
||||
global::attribute::create_cluster_revision(cluster, cluster_revision);
|
||||
|
||||
@@ -354,7 +354,10 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
|
||||
} /* thermostat_user_interface_configuration */
|
||||
|
||||
namespace air_quality {
|
||||
using config_t = common::config_t;
|
||||
typedef struct config {
|
||||
uint8_t air_quality;
|
||||
config() : air_quality(0) {}
|
||||
} config_t;
|
||||
|
||||
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
|
||||
} /* air_quality */
|
||||
|
||||
Reference in New Issue
Block a user