Skip to content

Commit

Permalink
Added constructors for cluster config structures with const members
Browse files Browse the repository at this point in the history
  • Loading branch information
Diegorro98 committed Apr 6, 2023
1 parent bafc378 commit ffb9a55
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 7 additions & 2 deletions components/esp_matter/esp_matter_cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ typedef struct config {
const uint8_t end_product_type;
uint8_t mode;
feature::lift::config_t lift;
config() : cluster_revision(5), type(0), config_status(0), operational_status(0), end_product_type(0), mode(0) {}
config(uint8_t end_product_type = 0) : cluster_revision(5), type(0), config_status(0), operational_status(0), end_product_type(end_product_type), mode(0) {}
} config_t;

cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features);
Expand Down Expand Up @@ -447,7 +447,12 @@ typedef struct config {
nullable<int16_t> capacity;
// Pump Settings Attributes
uint8_t operation_mode;
config() : cluster_revision(3), max_pressure(), max_speed(), max_flow(), effective_operation_mode(0), effective_control_mode(0), capacity(), operation_mode(0) {}
config(
nullable<int16_t> max_pressure = nullable<int16_t>(),
nullable<uint16_t> max_speed = nullable<uint16_t>(),
nullable<uint16_t> max_flow = nullable<uint16_t>()
) : cluster_revision(3), max_pressure(max_pressure), max_speed(max_speed), max_flow(max_flow),
effective_operation_mode(0), effective_control_mode(0), capacity(), operation_mode(0) {}
} config_t;

cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
Expand Down
6 changes: 6 additions & 0 deletions components/esp_matter/esp_matter_endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ typedef struct config {
cluster::groups::config_t groups;
cluster::scenes::config_t scenes;
cluster::window_covering::config_t window_covering;
config(uint8_t end_product_type = 0) : window_covering(end_product_type) {}
} config_t;

uint32_t get_device_type_id();
Expand Down Expand Up @@ -389,6 +390,11 @@ typedef struct config {
cluster::identify::config_t identify;
cluster::on_off::config_t on_off;
cluster::pump_configuration_and_control::config_t pump_configuration_and_control;
config(
nullable<int16_t> max_pressure = nullable<int16_t>(),
nullable<uint16_t> max_speed = nullable<uint16_t>(),
nullable<uint16_t> max_flow = nullable<uint16_t>()
): pump_configuration_and_control(max_pressure, max_speed, max_flow) {}
} config_t;

uint32_t get_device_type_id();
Expand Down

0 comments on commit ffb9a55

Please sign in to comment.