Skip to content

feat(matter): adds esp_matter:: namespace to attribute_t #10807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions libraries/Matter/src/MatterEndPoint.h
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ class MatterEndPoint {
}

// helper functions for attribute manipulation
attribute_t *getAttribute(uint32_t cluster_id, uint32_t attribute_id) {
esp_matter::attribute_t *getAttribute(uint32_t cluster_id, uint32_t attribute_id) {
if (endpoint_id == 0) {
log_e("Endpoint ID is not set");
return NULL;
@@ -53,7 +53,7 @@ class MatterEndPoint {
log_e("Cluster [%d] not found", cluster_id);
return NULL;
}
attribute_t *attribute = attribute::get(cluster, attribute_id);
esp_matter::attribute_t *attribute = attribute::get(cluster, attribute_id);
if (attribute == NULL) {
log_e("Attribute [%d] not found", attribute_id);
return NULL;
@@ -63,7 +63,7 @@ class MatterEndPoint {

// get the value of an attribute from its cluster id and attribute it
bool getAttributeVal(uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *attrVal) {
attribute_t *attribute = getAttribute(cluster_id, attribute_id);
esp_matter::attribute_t *attribute = getAttribute(cluster_id, attribute_id);
if (attribute == NULL) {
return false;
}
@@ -77,7 +77,7 @@ class MatterEndPoint {

// set the value of an attribute from its cluster id and attribute it
bool setAttributeVal(uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *attrVal) {
attribute_t *attribute = getAttribute(cluster_id, attribute_id);
esp_matter::attribute_t *attribute = getAttribute(cluster_id, attribute_id);
if (attribute == NULL) {
return false;
}
6 changes: 3 additions & 3 deletions libraries/Matter/src/MatterEndpoints/MatterColorLight.cpp
Original file line number Diff line number Diff line change
@@ -194,7 +194,7 @@ bool MatterColorLight::begin(bool initialState, espHsvColor_t _colorHSV) {

/* Mark deferred persistence for some attributes that might be changed rapidly */
cluster_t *level_control_cluster = cluster::get(endpoint, LevelControl::Id);
attribute_t *current_level_attribute = attribute::get(level_control_cluster, LevelControl::Attributes::CurrentLevel::Id);
esp_matter::attribute_t *current_level_attribute = attribute::get(level_control_cluster, LevelControl::Attributes::CurrentLevel::Id);
attribute::set_deferred_persistence(current_level_attribute);

started = true;
@@ -220,7 +220,7 @@ bool MatterColorLight::setOnOff(bool newState) {

endpoint_t *endpoint = endpoint::get(node::get(), endpoint_id);
cluster_t *cluster = cluster::get(endpoint, OnOff::Id);
attribute_t *attribute = attribute::get(cluster, OnOff::Attributes::OnOff::Id);
esp_matter::attribute_t *attribute = attribute::get(cluster, OnOff::Attributes::OnOff::Id);

esp_matter_attr_val_t val = esp_matter_invalid(NULL);
attribute::get_val(attribute, &val);
@@ -271,7 +271,7 @@ bool MatterColorLight::setColorHSV(espHsvColor_t _hsvColor) {
endpoint_t *endpoint = endpoint::get(node::get(), endpoint_id);
cluster_t *cluster = cluster::get(endpoint, ColorControl::Id);
// update hue
attribute_t *attribute = attribute::get(cluster, ColorControl::Attributes::CurrentHue::Id);
esp_matter::attribute_t *attribute = attribute::get(cluster, ColorControl::Attributes::CurrentHue::Id);
esp_matter_attr_val_t val = esp_matter_invalid(NULL);
attribute::get_val(attribute, &val);
if (val.val.u8 != colorHSV.h) {
Original file line number Diff line number Diff line change
@@ -122,11 +122,11 @@ bool MatterColorTemperatureLight::begin(bool initialState, uint8_t brightness, u

/* Mark deferred persistence for some attributes that might be changed rapidly */
cluster_t *level_control_cluster = cluster::get(endpoint, LevelControl::Id);
attribute_t *current_level_attribute = attribute::get(level_control_cluster, LevelControl::Attributes::CurrentLevel::Id);
esp_matter::attribute_t *current_level_attribute = attribute::get(level_control_cluster, LevelControl::Attributes::CurrentLevel::Id);
attribute::set_deferred_persistence(current_level_attribute);

cluster_t *color_control_cluster = cluster::get(endpoint, ColorControl::Id);
attribute_t *color_temp_attribute = attribute::get(color_control_cluster, ColorControl::Attributes::ColorTemperatureMireds::Id);
esp_matter::attribute_t *color_temp_attribute = attribute::get(color_control_cluster, ColorControl::Attributes::ColorTemperatureMireds::Id);
attribute::set_deferred_persistence(color_temp_attribute);

started = true;
@@ -152,7 +152,7 @@ bool MatterColorTemperatureLight::setOnOff(bool newState) {

endpoint_t *endpoint = endpoint::get(node::get(), endpoint_id);
cluster_t *cluster = cluster::get(endpoint, OnOff::Id);
attribute_t *attribute = attribute::get(cluster, OnOff::Attributes::OnOff::Id);
esp_matter::attribute_t *attribute = attribute::get(cluster, OnOff::Attributes::OnOff::Id);

esp_matter_attr_val_t val = esp_matter_invalid(NULL);
attribute::get_val(attribute, &val);
@@ -193,7 +193,7 @@ bool MatterColorTemperatureLight::setBrightness(uint8_t newBrightness) {

endpoint_t *endpoint = endpoint::get(node::get(), endpoint_id);
cluster_t *cluster = cluster::get(endpoint, LevelControl::Id);
attribute_t *attribute = attribute::get(cluster, LevelControl::Attributes::CurrentLevel::Id);
esp_matter::attribute_t *attribute = attribute::get(cluster, LevelControl::Attributes::CurrentLevel::Id);

esp_matter_attr_val_t val = esp_matter_invalid(NULL);
attribute::get_val(attribute, &val);
@@ -224,7 +224,7 @@ bool MatterColorTemperatureLight::setColorTemperature(uint16_t newTemperature) {

endpoint_t *endpoint = endpoint::get(node::get(), endpoint_id);
cluster_t *cluster = cluster::get(endpoint, ColorControl::Id);
attribute_t *attribute = attribute::get(cluster, ColorControl::Attributes::ColorTemperatureMireds::Id);
esp_matter::attribute_t *attribute = attribute::get(cluster, ColorControl::Attributes::ColorTemperatureMireds::Id);

esp_matter_attr_val_t val = esp_matter_invalid(NULL);
attribute::get_val(attribute, &val);
Original file line number Diff line number Diff line change
@@ -101,7 +101,7 @@ bool MatterDimmableLight::begin(bool initialState, uint8_t brightness) {

/* Mark deferred persistence for some attributes that might be changed rapidly */
cluster_t *level_control_cluster = cluster::get(endpoint, LevelControl::Id);
attribute_t *current_level_attribute = attribute::get(level_control_cluster, LevelControl::Attributes::CurrentLevel::Id);
esp_matter::attribute_t *current_level_attribute = attribute::get(level_control_cluster, LevelControl::Attributes::CurrentLevel::Id);
attribute::set_deferred_persistence(current_level_attribute);

started = true;
@@ -127,7 +127,7 @@ bool MatterDimmableLight::setOnOff(bool newState) {

endpoint_t *endpoint = endpoint::get(node::get(), endpoint_id);
cluster_t *cluster = cluster::get(endpoint, OnOff::Id);
attribute_t *attribute = attribute::get(cluster, OnOff::Attributes::OnOff::Id);
esp_matter::attribute_t *attribute = attribute::get(cluster, OnOff::Attributes::OnOff::Id);

esp_matter_attr_val_t val = esp_matter_invalid(NULL);
attribute::get_val(attribute, &val);
@@ -168,7 +168,7 @@ bool MatterDimmableLight::setBrightness(uint8_t newBrightness) {

endpoint_t *endpoint = endpoint::get(node::get(), endpoint_id);
cluster_t *cluster = cluster::get(endpoint, LevelControl::Id);
attribute_t *attribute = attribute::get(cluster, LevelControl::Attributes::CurrentLevel::Id);
esp_matter::attribute_t *attribute = attribute::get(cluster, LevelControl::Attributes::CurrentLevel::Id);

esp_matter_attr_val_t val = esp_matter_invalid(NULL);
attribute::get_val(attribute, &val);
Original file line number Diff line number Diff line change
@@ -214,7 +214,7 @@ bool MatterEnhancedColorLight::begin(bool initialState, espHsvColor_t _colorHSV,

/* Mark deferred persistence for some attributes that might be changed rapidly */
cluster_t *level_control_cluster = cluster::get(endpoint, LevelControl::Id);
attribute_t *current_level_attribute = attribute::get(level_control_cluster, LevelControl::Attributes::CurrentLevel::Id);
esp_matter::attribute_t *current_level_attribute = attribute::get(level_control_cluster, LevelControl::Attributes::CurrentLevel::Id);
attribute::set_deferred_persistence(current_level_attribute);

started = true;
@@ -240,7 +240,7 @@ bool MatterEnhancedColorLight::setOnOff(bool newState) {

endpoint_t *endpoint = endpoint::get(node::get(), endpoint_id);
cluster_t *cluster = cluster::get(endpoint, OnOff::Id);
attribute_t *attribute = attribute::get(cluster, OnOff::Attributes::OnOff::Id);
esp_matter::attribute_t *attribute = attribute::get(cluster, OnOff::Attributes::OnOff::Id);

esp_matter_attr_val_t val = esp_matter_invalid(NULL);
attribute::get_val(attribute, &val);
@@ -281,7 +281,7 @@ bool MatterEnhancedColorLight::setBrightness(uint8_t newBrightness) {

endpoint_t *endpoint = endpoint::get(node::get(), endpoint_id);
cluster_t *cluster = cluster::get(endpoint, LevelControl::Id);
attribute_t *attribute = attribute::get(cluster, LevelControl::Attributes::CurrentLevel::Id);
esp_matter::attribute_t *attribute = attribute::get(cluster, LevelControl::Attributes::CurrentLevel::Id);

esp_matter_attr_val_t val = esp_matter_invalid(NULL);
attribute::get_val(attribute, &val);
@@ -312,7 +312,7 @@ bool MatterEnhancedColorLight::setColorTemperature(uint16_t newTemperature) {

endpoint_t *endpoint = endpoint::get(node::get(), endpoint_id);
cluster_t *cluster = cluster::get(endpoint, ColorControl::Id);
attribute_t *attribute = attribute::get(cluster, ColorControl::Attributes::ColorTemperatureMireds::Id);
esp_matter::attribute_t *attribute = attribute::get(cluster, ColorControl::Attributes::ColorTemperatureMireds::Id);

esp_matter_attr_val_t val = esp_matter_invalid(NULL);
attribute::get_val(attribute, &val);
@@ -353,7 +353,7 @@ bool MatterEnhancedColorLight::setColorHSV(espHsvColor_t _hsvColor) {
endpoint_t *endpoint = endpoint::get(node::get(), endpoint_id);
cluster_t *cluster = cluster::get(endpoint, ColorControl::Id);
// update hue
attribute_t *attribute = attribute::get(cluster, ColorControl::Attributes::CurrentHue::Id);
esp_matter::attribute_t *attribute = attribute::get(cluster, ColorControl::Attributes::CurrentHue::Id);
esp_matter_attr_val_t val = esp_matter_invalid(NULL);
attribute::get_val(attribute, &val);
if (val.val.u8 != colorHSV.h) {
Original file line number Diff line number Diff line change
@@ -108,7 +108,7 @@ bool MatterOnOffLight::setOnOff(bool newState) {

endpoint_t *endpoint = endpoint::get(node::get(), endpoint_id);
cluster_t *cluster = cluster::get(endpoint, OnOff::Id);
attribute_t *attribute = attribute::get(cluster, OnOff::Attributes::OnOff::Id);
esp_matter::attribute_t *attribute = attribute::get(cluster, OnOff::Attributes::OnOff::Id);

esp_matter_attr_val_t val = esp_matter_invalid(NULL);
attribute::get_val(attribute, &val);