Skip to content

Commit 573b746

Browse files
committed
Merge branch 'add_bounds_for_thermostat_user_interface_configuration_cluster' into 'main'
components/esp-matter:add bounds for thermostat user interface configuration cluster See merge request app-frameworks/esp-matter!962
2 parents a2c6111 + 345a51d commit 573b746

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

components/esp_matter/esp_matter_attribute_bounds.cpp

+34
Original file line numberDiff line numberDiff line change
@@ -665,5 +665,39 @@ void add_bounds_cb(cluster_t *cluster)
665665

666666
} /* thermostat */
667667

668+
namespace thermostat_user_interface_configuration {
669+
670+
void add_bounds_cb(cluster_t *cluster)
671+
{
672+
VerifyOrReturn(cluster != nullptr, ESP_LOGE(TAG, "Cluster is NULL. Add bounds Failed!!"));
673+
attribute_t *current_attribute = esp_matter::attribute::get_first(cluster);
674+
VerifyOrReturn(current_attribute != nullptr, ESP_LOGE(TAG, "Attribute is NULL."));
675+
while(current_attribute) {
676+
switch(esp_matter::attribute::get_id(current_attribute)) {
677+
678+
case ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id: {
679+
uint8_t min = 0, max = 1;
680+
esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max));
681+
break;
682+
}
683+
case ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id: {
684+
uint8_t min = 0, max = 5;
685+
esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max));
686+
break;
687+
}
688+
case ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id: {
689+
uint8_t min = 0, max = 1;
690+
esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max));
691+
break;
692+
}
693+
default:
694+
break;
695+
}
696+
current_attribute = esp_matter::attribute::get_next(current_attribute);
697+
}
698+
}
699+
700+
} /* thermostat_user_interface_configuration */
701+
668702
} /* cluster */
669703
} /* esp_matter */

components/esp_matter/esp_matter_attribute_bounds.h

+4
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,9 @@ namespace thermostat {
4646
void add_bounds_cb(cluster_t *cluster);
4747
} /* thermostat */
4848

49+
namespace thermostat_user_interface_configuration {
50+
void add_bounds_cb(cluster_t *cluster);
51+
} /* thermostat_user_interface_configuration */
52+
4953
} /* cluster */
5054
} /* esp_matter */

components/esp_matter/esp_matter_cluster.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
12971297
}
12981298

12991299
if (flags & CLUSTER_FLAG_SERVER) {
1300+
set_add_bounds_callback(cluster, thermostat_user_interface_configuration::add_bounds_cb);
13001301
add_function_list(cluster, function_list, function_flags);
13011302

13021303
/* Attributes managed internally */

0 commit comments

Comments
 (0)