Skip to content

Commit a55745c

Browse files
components/esp-matter: Fixed conformance according to IDM-10.2 test case results.
1 parent cc1a4f3 commit a55745c

7 files changed

+351
-8
lines changed

components/esp_matter/esp_matter_cluster.cpp

+99-1
Original file line numberDiff line numberDiff line change
@@ -2021,6 +2021,25 @@ const function_generic_t function_list[] = {
20212021
};
20222022
const int function_flags = CLUSTER_FLAG_INIT_FUNCTION;
20232023

2024+
static bool check_feature_map(uint32_t features) {
2025+
if((features & feature::other::get_id()) == feature::other::get_id())
2026+
return true;
2027+
if((features & feature::passive_infrared::get_id()) == feature::passive_infrared::get_id())
2028+
return true;
2029+
if((features & feature::ultrasonic::get_id()) == feature::ultrasonic::get_id())
2030+
return true;
2031+
if((features & feature::physical_contact::get_id()) == feature::physical_contact::get_id())
2032+
return true;
2033+
if((features & feature::active_infrared::get_id()) == feature::active_infrared::get_id())
2034+
return true;
2035+
if((features & feature::radar::get_id()) == feature::radar::get_id())
2036+
return true;
2037+
if((features & feature::rf_sensing::get_id()) == feature::rf_sensing::get_id())
2038+
return true;
2039+
if((features & feature::vision::get_id()) == feature::vision::get_id())
2040+
return true;
2041+
return false;
2042+
}
20242043
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
20252044
{
20262045
cluster_t *cluster = cluster::create(endpoint, OccupancySensing::Id, flags);
@@ -2049,6 +2068,34 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
20492068
create_default_binding_cluster(endpoint);
20502069
}
20512070

2071+
if(config != nullptr && check_feature_map(config->features)) {
2072+
if (config->features & feature::other::get_id()) {
2073+
feature::other::add(cluster);
2074+
}
2075+
if (config->features & feature::passive_infrared::get_id()) {
2076+
feature::passive_infrared::add(cluster);
2077+
}
2078+
if (config->features & feature::ultrasonic::get_id()) {
2079+
feature::ultrasonic::add(cluster);
2080+
}
2081+
if (config->features & feature::physical_contact::get_id()) {
2082+
feature::physical_contact::add(cluster);
2083+
}
2084+
if (config->features & feature::active_infrared::get_id()) {
2085+
feature::active_infrared::add(cluster);
2086+
}
2087+
if (config->features & feature::radar::get_id()) {
2088+
feature::radar::add(cluster);
2089+
}
2090+
if (config->features & feature::rf_sensing::get_id()) {
2091+
feature::rf_sensing::add(cluster);
2092+
}
2093+
if (config->features & feature::vision::get_id()) {
2094+
feature::vision::add(cluster);
2095+
}
2096+
} else {
2097+
ESP_LOGE(TAG, "Config is NULL or mandatory features are missing.");
2098+
}
20522099
return cluster;
20532100
}
20542101
} /* occupancy_sensing */
@@ -2324,6 +2371,20 @@ const function_generic_t function_list[] = {
23242371
const int function_flags =
23252372
CLUSTER_FLAG_INIT_FUNCTION | CLUSTER_FLAG_ATTRIBUTE_CHANGED_FUNCTION | CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION;
23262373

2374+
static bool check_feature_map(uint32_t features) {
2375+
if ((features & feature::constant_pressure::get_id()) == feature::constant_pressure::get_id())
2376+
return true;
2377+
if ((features & feature::compensated_pressure::get_id()) == feature::compensated_pressure::get_id())
2378+
return true;
2379+
if ((features & feature::constant_flow::get_id()) == feature::constant_flow::get_id())
2380+
return true;
2381+
if ((features & feature::constant_speed::get_id()) == feature::constant_speed::get_id())
2382+
return true;
2383+
if ((features & feature::constant_temperature::get_id()) == feature::constant_temperature::get_id())
2384+
return true;
2385+
return false;
2386+
}
2387+
23272388
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
23282389
{
23292390
cluster_t *cluster = cluster::create(endpoint, PumpConfigurationAndControl::Id, flags);
@@ -2355,6 +2416,31 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
23552416
create_default_binding_cluster(endpoint);
23562417
}
23572418

2419+
if(config != nullptr && check_feature_map(config->features)) {
2420+
if (config->features & feature::constant_pressure::get_id()) {
2421+
feature::constant_pressure::add(cluster, &config->constant_pressure);
2422+
}
2423+
if (config->features & feature::compensated_pressure::get_id()) {
2424+
feature::compensated_pressure::add(cluster, &config->compensated_pressure);
2425+
}
2426+
if (config->features & feature::constant_flow::get_id()) {
2427+
feature::constant_flow::add(cluster, &config->constant_flow);
2428+
}
2429+
if (config->features & feature::constant_speed::get_id()) {
2430+
feature::constant_speed::add(cluster, &config->constant_speed);
2431+
}
2432+
if (config->features & feature::constant_temperature::get_id()) {
2433+
feature::constant_temperature::add(cluster, &config->constant_temperature);
2434+
}
2435+
if (config->features & feature::automatic::get_id()) {
2436+
feature::automatic::add(cluster);
2437+
}
2438+
if (config->features & feature::local_operation::get_id()) {
2439+
feature::local_operation::add(cluster);
2440+
}
2441+
} else {
2442+
ESP_LOGE(TAG, "Config is NULL or mandatory features are missing.");
2443+
}
23582444
return cluster;
23592445
}
23602446
} /* pump_configuration_and_control */
@@ -2561,6 +2647,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
25612647

25622648
/* Commands */
25632649
mode_base::command::create_change_to_mode(cluster);
2650+
mode_base::command::create_change_to_mode_response(cluster);
25642651

25652652
return cluster;
25662653
}
@@ -2598,6 +2685,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
25982685

25992686
/* Commands */
26002687
mode_base::command::create_change_to_mode(cluster);
2688+
mode_base::command::create_change_to_mode_response(cluster);
26012689

26022690
return cluster;
26032691
}
@@ -2634,6 +2722,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
26342722

26352723
/* Commands */
26362724
mode_base::command::create_change_to_mode(cluster);
2725+
mode_base::command::create_change_to_mode_response(cluster);
26372726

26382727
return cluster;
26392728
}
@@ -2726,6 +2815,12 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
27262815
/* Attributes managed internally */
27272816
global::attribute::create_feature_map(cluster, 0);
27282817

2818+
operational_state::attribute::create_phase_list(cluster, NULL, 0, 0);
2819+
operational_state::attribute::create_current_phase(cluster, 0);
2820+
operational_state::attribute::create_operational_state_list(cluster, NULL, 0, 0);
2821+
operational_state::attribute::create_operational_state(cluster, 0);
2822+
operational_state::attribute::create_operational_error(cluster, 0);
2823+
27292824
/* Attributes not managed internally */
27302825
global::attribute::create_cluster_revision(cluster, cluster_revision);
27312826
}
@@ -2947,6 +3042,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
29473042

29483043
/* Commands */
29493044
mode_base::command::create_change_to_mode(cluster);
3045+
mode_base::command::create_change_to_mode_response(cluster);
29503046

29513047
return cluster;
29523048
}
@@ -3150,6 +3246,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
31503246
}
31513247

31523248
/* Commands */
3249+
mode_base::command::create_change_to_mode_response(cluster);
31533250
mode_base::command::create_change_to_mode(cluster);
31543251

31553252
return cluster;
@@ -3363,7 +3460,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
33633460
global::attribute::create_cluster_revision(cluster, cluster_revision);
33643461
attribute::create_heater_types(cluster, config->heater_types);
33653462
attribute::create_heat_demand(cluster, config->heat_demand);
3366-
attribute::create_tank_volume(cluster, config->tank_volume);
3463+
attribute::create_boost_state(cluster, config->boost_state);
33673464
}
33683465

33693466
if (features & feature::energy_management::get_id()) {
@@ -3414,6 +3511,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
34143511

34153512
/* Commands */
34163513
mode_base::command::create_change_to_mode(cluster);
3514+
mode_base::command::create_change_to_mode_response(cluster);
34173515

34183516
return cluster;
34193517
}

components/esp_matter/esp_matter_cluster.h

+13-5
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,9 @@ typedef struct config {
592592
uint8_t occupancy;
593593
uint8_t occupancy_sensor_type;
594594
uint8_t occupancy_sensor_type_bitmap;
595+
uint32_t features;
595596
config() : occupancy(0), occupancy_sensor_type(0),
596-
occupancy_sensor_type_bitmap(0) {}
597+
occupancy_sensor_type_bitmap(0), features(0) {}
597598
} config_t;
598599

599600
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -685,12 +686,18 @@ typedef struct config {
685686
nullable<int16_t> capacity;
686687
// Pump Settings Attributes
687688
uint8_t operation_mode;
689+
feature::constant_pressure::config_t constant_pressure;
690+
feature::compensated_pressure::config_t compensated_pressure;
691+
feature::constant_flow::config_t constant_flow;
692+
feature::constant_speed::config_t constant_speed;
693+
feature::constant_temperature::config_t constant_temperature;
694+
uint32_t features;
688695
config(
689696
nullable<int16_t> max_pressure = nullable<int16_t>(),
690697
nullable<uint16_t> max_speed = nullable<uint16_t>(),
691698
nullable<uint16_t> max_flow = nullable<uint16_t>()
692699
) : max_pressure(max_pressure), max_speed(max_speed), max_flow(max_flow),
693-
effective_operation_mode(0), effective_control_mode(0), capacity(), operation_mode(0) {}
700+
effective_operation_mode(0), effective_control_mode(0), capacity(), operation_mode(0), features(0) {}
694701
} config_t;
695702

696703
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -714,7 +721,8 @@ typedef struct config {
714721
feature::temperature_number::config_t temperature_number;
715722
feature::temperature_level::config_t temperature_level;
716723
feature::temperature_step::config_t temperature_step;
717-
// Empty config for API consistency
724+
uint32_t features;
725+
config() : features(0) {}
718726
} config_t;
719727

720728
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features);
@@ -915,11 +923,11 @@ namespace water_heater_management {
915923
typedef struct config {
916924
uint8_t heater_types;
917925
uint8_t heat_demand;
918-
uint8_t tank_volume;
926+
uint8_t boost_state;
919927
void *delegate;
920928
feature::energy_management::config_t energy_management;
921929
feature::tank_percent::config_t tank_percent;
922-
config() : heater_types(0), heat_demand(0), tank_volume(0), delegate(nullptr) {}
930+
config() : heater_types(0), heat_demand(0), boost_state(0), delegate(nullptr) {}
923931
} config_t;
924932

925933
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features);

components/esp_matter/esp_matter_command.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ command_t *create_reset_condition(cluster_t *cluster);
395395
namespace mode_base {
396396
namespace command {
397397
command_t *create_change_to_mode(cluster_t *cluster);
398-
command_t *create_change_to_mode_response(cluster_t *cluster, uint16_t command_id);
398+
command_t *create_change_to_mode_response(cluster_t *cluster);
399399
} /* command */
400400
} /* mode_base */
401401

components/esp_matter/esp_matter_endpoint.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
14151415
return err;
14161416
}
14171417

1418-
temperature_control::create(endpoint, &(config->temperature_control), CLUSTER_FLAG_SERVER, ESP_MATTER_NONE_FEATURE_ID);
1418+
temperature_control::create(endpoint, &(config->temperature_control), CLUSTER_FLAG_SERVER, temperature_control::feature::temperature_number::get_id());
14191419

14201420
return ESP_OK;
14211421
}

0 commit comments

Comments
 (0)