components/esp-matter: Move feature creation from cluster to endpoint.

This commit is contained in:
Rohit
2025-05-14 17:17:18 +05:30
parent 8027319b76
commit 807abe17a4
18 changed files with 437 additions and 958 deletions
+4 -1
View File
@@ -1,4 +1,4 @@
# 13-May-2025 # 10-June-2025
API Change. API Change.
Removed the `features` parameter from the `cluster::create()` API to make it consistent across all clusters. Removed the `features` parameter from the `cluster::create()` API to make it consistent across all clusters.
@@ -6,6 +6,9 @@ The new API signature is:
``` ```
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
``` ```
For clusters with `O.a/O.a+` features conformance, the `feature_flags` is available at cluster level.
For device types with `M` feature conformance of a cluster, the feature config is available at device type level.
For clusters with `O` feature conformance, feature should be added using `feature_name::add()` API in the application.
# 3-Feb-2024 # 3-Feb-2024
File diff suppressed because it is too large Load Diff
+31 -186
View File
@@ -71,10 +71,7 @@ typedef struct config {
} /* common */ } /* common */
namespace descriptor { namespace descriptor {
typedef struct config { using config_t = common::config_t;
uint32_t feature_flags;
config() : feature_flags(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* descriptor */ } /* descriptor */
@@ -84,10 +81,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* actions */ } /* actions */
namespace access_control { namespace access_control {
typedef struct config { using config_t = common::config_t;
uint32_t feature_flags;
config() : feature_flags(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* access_control */ } /* access_control */
@@ -124,11 +118,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace general_commissioning { namespace general_commissioning {
typedef struct config { typedef struct config {
uint64_t breadcrumb; uint64_t breadcrumb;
struct { config() : breadcrumb(0) {}
feature::terms_and_conditions::config_t terms_and_conditions;
} features;
uint32_t feature_flags;
config() : breadcrumb(0), feature_flags(0) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -160,21 +150,12 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* general_diagnostics */ } /* general_diagnostics */
namespace software_diagnostics { namespace software_diagnostics {
typedef struct config { using config_t = common::config_t;
uint32_t feature_flags;
struct {
feature::watermarks::config_t watermarks;
} features;
config() : feature_flags(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* software_diagnostics */ } /* software_diagnostics */
namespace administrator_commissioning { namespace administrator_commissioning {
typedef struct config { using config_t = common::config_t;
uint32_t feature_flags;
config() : feature_flags(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* administrator_commissioning */ } /* administrator_commissioning */
@@ -189,10 +170,7 @@ cluster_t *create(endpoint_t *endpoint, uint8_t flags);
} /* group_key_management */ } /* group_key_management */
namespace wifi_network_diagnostics { namespace wifi_network_diagnostics {
typedef struct config { using config_t = common::config_t;
uint32_t feature_flags;
config() : feature_flags(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* wifi_network_diagnostics */ } /* wifi_network_diagnostics */
@@ -202,49 +180,28 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* thread_network_diagnostics */ } /* thread_network_diagnostics */
namespace ethernet_network_diagnostics { namespace ethernet_network_diagnostics {
typedef struct config { using config_t = common::config_t;
struct {
feature::packet_counts::config_t packet_counts;
feature::error_counts::config_t error_counts;
} features;
uint32_t feature_flags;
config() : feature_flags(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* ethernet_network_diagnostics */ } /* ethernet_network_diagnostics */
namespace time_synchronization { namespace time_synchronization {
typedef struct config { typedef struct config {
struct {
feature::time_zone::config_t time_zone;
feature::ntp_client::config_t ntp_client;
feature::ntp_server::config_t ntp_server;
} features;
uint32_t feature_flags;
void *delegate; void *delegate;
config() : feature_flags(0), delegate(nullptr) {} config() : delegate(nullptr) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* time_synchronization */ } /* time_synchronization */
namespace unit_localization { namespace unit_localization {
typedef struct config { using config_t = common::config_t;
struct {
feature::temperature_unit::config_t temperature_unit;
} features;
uint32_t feature_flags;
config() : feature_flags(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* unit_localization */ } /* unit_localization */
namespace bridged_device_basic_information { namespace bridged_device_basic_information {
typedef struct config { typedef struct config {
bool reachable; bool reachable;
uint32_t feature_flags; config() : reachable(true) {}
config() : reachable(true), feature_flags(0) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -258,8 +215,6 @@ typedef struct config {
struct { struct {
feature::wired::config_t wired; feature::wired::config_t wired;
feature::battery::config_t battery; feature::battery::config_t battery;
feature::rechargeable::config_t rechargeable;
feature::replaceable::config_t replaceable;
} features; } features;
uint32_t feature_flags; uint32_t feature_flags;
config() : status(0), order(0), description{0}, feature_flags(0) {} config() : status(0), order(0), description{0}, feature_flags(0) {}
@@ -268,13 +223,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* power_source */ } /* power_source */
namespace icd_management { namespace icd_management {
typedef struct config { using config_t = common::config_t;
struct {
feature::user_active_mode_trigger::config_t user_active_mode_trigger;
} features;
uint32_t feature_flags;
config() : feature_flags(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* icd_management */ } /* icd_management */
@@ -307,8 +256,7 @@ uint8_t get_server_cluster_count();
namespace scenes_management { namespace scenes_management {
typedef struct config { typedef struct config {
uint16_t scene_table_size; uint16_t scene_table_size;
uint32_t feature_flags; config() : scene_table_size(16) {}
config() : scene_table_size(16), feature_flags(0) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -317,11 +265,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace on_off { namespace on_off {
typedef struct config { typedef struct config {
bool on_off; bool on_off;
struct { config() : on_off(false) {}
feature::lighting::config_t lighting;
} features;
uint32_t feature_flags;
config() : on_off(false), feature_flags(0) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -332,12 +276,7 @@ typedef struct config {
nullable<uint8_t> current_level; nullable<uint8_t> current_level;
nullable<uint8_t> on_level; nullable<uint8_t> on_level;
uint8_t options; uint8_t options;
struct { config() : current_level(), on_level(), options(0) {}
feature::lighting::config_t lighting;
feature::frequency::config_t frequency;
} features;
uint32_t feature_flags;
config() : current_level(), on_level(), options(0), feature_flags(0) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -350,16 +289,8 @@ typedef struct config {
uint8_t enhanced_color_mode; uint8_t enhanced_color_mode;
uint16_t color_capabilities; uint16_t color_capabilities;
nullable<uint8_t> number_of_primaries; nullable<uint8_t> number_of_primaries;
struct {
feature::hue_saturation::config_t hue_saturation;
feature::color_temperature::config_t color_temperature;
feature::xy::config_t xy;
feature::enhanced_hue::config_t enhanced_hue;
feature::color_loop::config_t color_loop;
} features;
uint32_t feature_flags;
config() : color_mode(1), color_control_options(0), enhanced_color_mode(1), config() : color_mode(1), color_control_options(0), enhanced_color_mode(1),
color_capabilities(0), number_of_primaries(0), feature_flags(0) {} color_capabilities(0), number_of_primaries(0) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -371,15 +302,8 @@ typedef struct config {
uint8_t fan_mode_sequence; uint8_t fan_mode_sequence;
nullable<uint8_t> percent_setting; nullable<uint8_t> percent_setting;
uint8_t percent_current; uint8_t percent_current;
struct {
feature::multi_speed::config_t multi_speed;
feature::rocking::config_t rocking;
feature::wind::config_t wind;
feature::airflow_direction::config_t airflow_direction;
} features;
uint32_t feature_flags;
void *delegate; void *delegate;
config() : fan_mode(0), fan_mode_sequence(2), percent_setting(0), percent_current(0), feature_flags(0), delegate(nullptr) {} config() : fan_mode(0), fan_mode_sequence(2), percent_setting(0), percent_current(0), delegate(nullptr) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -393,11 +317,7 @@ typedef struct config {
struct { struct {
feature::heating::config_t heating; feature::heating::config_t heating;
feature::cooling::config_t cooling; feature::cooling::config_t cooling;
feature::occupancy::config_t occupancy;
feature::setback::config_t setback;
feature::auto_mode::config_t auto_mode; feature::auto_mode::config_t auto_mode;
feature::local_temperature_not_exposed::config_t local_temperature_not_exposed;
feature::matter_schedule_configuration::config_t matter_schedule_configuration;
} features; } features;
uint32_t feature_flags; uint32_t feature_flags;
config() : local_temperature(), control_sequence_of_operation(4), system_mode(1), feature_flags(0) {} config() : local_temperature(), control_sequence_of_operation(4), system_mode(1), feature_flags(0) {}
@@ -417,22 +337,15 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* thermostat_user_interface_configuration */ } /* thermostat_user_interface_configuration */
namespace air_quality { namespace air_quality {
typedef struct config { using config_t = common::config_t;
uint32_t feature_flags;
config() : feature_flags(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* air_quality */ } /* air_quality */
namespace hepa_filter_monitoring { namespace hepa_filter_monitoring {
typedef struct config { typedef struct config {
struct {
feature::condition::config_t condition;
} features;
uint32_t feature_flags;
void *delegate; void *delegate;
config() : feature_flags(0), delegate(nullptr) {} config() : delegate(nullptr) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -440,12 +353,8 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace activated_carbon_filter_monitoring { namespace activated_carbon_filter_monitoring {
typedef struct config { typedef struct config {
struct {
feature::condition::config_t condition;
} features;
uint32_t feature_flags;
void *delegate; void *delegate;
config() : feature_flags(0), delegate(nullptr) {} config() : delegate(nullptr) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -457,8 +366,6 @@ typedef struct config {
struct { struct {
feature::numeric_measurement::config_t numeric_measurement; feature::numeric_measurement::config_t numeric_measurement;
feature::level_indication::config_t level_indication; feature::level_indication::config_t level_indication;
feature::peak_measurement::config_t peak_measurement;
feature::average_measurement::config_t average_measurement;
} features; } features;
uint32_t feature_flags; uint32_t feature_flags;
config() : measurement_medium(0), feature_flags(0) {} config() : measurement_medium(0), feature_flags(0) {}
@@ -473,8 +380,6 @@ typedef struct config {
struct { struct {
feature::numeric_measurement::config_t numeric_measurement; feature::numeric_measurement::config_t numeric_measurement;
feature::level_indication::config_t level_indication; feature::level_indication::config_t level_indication;
feature::peak_measurement::config_t peak_measurement;
feature::average_measurement::config_t average_measurement;
} features; } features;
uint32_t feature_flags; uint32_t feature_flags;
config() : measurement_medium(0), feature_flags(0) {} config() : measurement_medium(0), feature_flags(0) {}
@@ -489,8 +394,6 @@ typedef struct config {
struct { struct {
feature::numeric_measurement::config_t numeric_measurement; feature::numeric_measurement::config_t numeric_measurement;
feature::level_indication::config_t level_indication; feature::level_indication::config_t level_indication;
feature::peak_measurement::config_t peak_measurement;
feature::average_measurement::config_t average_measurement;
} features; } features;
uint32_t feature_flags; uint32_t feature_flags;
config() : measurement_medium(0), feature_flags(0) {} config() : measurement_medium(0), feature_flags(0) {}
@@ -505,8 +408,6 @@ typedef struct config {
struct { struct {
feature::numeric_measurement::config_t numeric_measurement; feature::numeric_measurement::config_t numeric_measurement;
feature::level_indication::config_t level_indication; feature::level_indication::config_t level_indication;
feature::peak_measurement::config_t peak_measurement;
feature::average_measurement::config_t average_measurement;
} features; } features;
uint32_t feature_flags; uint32_t feature_flags;
config() : measurement_medium(0), feature_flags(0) {} config() : measurement_medium(0), feature_flags(0) {}
@@ -521,8 +422,6 @@ typedef struct config {
struct { struct {
feature::numeric_measurement::config_t numeric_measurement; feature::numeric_measurement::config_t numeric_measurement;
feature::level_indication::config_t level_indication; feature::level_indication::config_t level_indication;
feature::peak_measurement::config_t peak_measurement;
feature::average_measurement::config_t average_measurement;
} features; } features;
uint32_t feature_flags; uint32_t feature_flags;
config() : measurement_medium(0), feature_flags(0) {} config() : measurement_medium(0), feature_flags(0) {}
@@ -537,8 +436,6 @@ typedef struct config {
struct { struct {
feature::numeric_measurement::config_t numeric_measurement; feature::numeric_measurement::config_t numeric_measurement;
feature::level_indication::config_t level_indication; feature::level_indication::config_t level_indication;
feature::peak_measurement::config_t peak_measurement;
feature::average_measurement::config_t average_measurement;
} features; } features;
uint32_t feature_flags; uint32_t feature_flags;
config() : measurement_medium(0), feature_flags(0) {} config() : measurement_medium(0), feature_flags(0) {}
@@ -553,8 +450,6 @@ typedef struct config {
struct { struct {
feature::numeric_measurement::config_t numeric_measurement; feature::numeric_measurement::config_t numeric_measurement;
feature::level_indication::config_t level_indication; feature::level_indication::config_t level_indication;
feature::peak_measurement::config_t peak_measurement;
feature::average_measurement::config_t average_measurement;
} features; } features;
uint32_t feature_flags; uint32_t feature_flags;
config() : measurement_medium(0), feature_flags(0) {} config() : measurement_medium(0), feature_flags(0) {}
@@ -569,8 +464,6 @@ typedef struct config {
struct { struct {
feature::numeric_measurement::config_t numeric_measurement; feature::numeric_measurement::config_t numeric_measurement;
feature::level_indication::config_t level_indication; feature::level_indication::config_t level_indication;
feature::peak_measurement::config_t peak_measurement;
feature::average_measurement::config_t average_measurement;
} features; } features;
uint32_t feature_flags; uint32_t feature_flags;
config() : measurement_medium(0), feature_flags(0) {} config() : measurement_medium(0), feature_flags(0) {}
@@ -585,8 +478,6 @@ typedef struct config {
struct { struct {
feature::numeric_measurement::config_t numeric_measurement; feature::numeric_measurement::config_t numeric_measurement;
feature::level_indication::config_t level_indication; feature::level_indication::config_t level_indication;
feature::peak_measurement::config_t peak_measurement;
feature::average_measurement::config_t average_measurement;
} features; } features;
uint32_t feature_flags; uint32_t feature_flags;
config() : measurement_medium(0), feature_flags(0) {} config() : measurement_medium(0), feature_flags(0) {}
@@ -601,8 +492,6 @@ typedef struct config {
struct { struct {
feature::numeric_measurement::config_t numeric_measurement; feature::numeric_measurement::config_t numeric_measurement;
feature::level_indication::config_t level_indication; feature::level_indication::config_t level_indication;
feature::peak_measurement::config_t peak_measurement;
feature::average_measurement::config_t average_measurement;
} features; } features;
uint32_t feature_flags; uint32_t feature_flags;
config() : measurement_medium(0), feature_flags(0) {} config() : measurement_medium(0), feature_flags(0) {}
@@ -689,15 +578,8 @@ typedef struct config {
bool actuator_enabled; bool actuator_enabled;
uint8_t operating_mode; uint8_t operating_mode;
uint16_t supported_operating_modes; uint16_t supported_operating_modes;
struct {
feature::pin_credential::config_t pin_credential;
feature::rfid_credential::config_t rfid_credential;
feature::credential_over_the_air_access::config_t credential_over_the_air_access;
feature::user::config_t user;
} features;
uint32_t feature_flags;
void *delegate; void *delegate;
config() : lock_state(0), lock_type(0), actuator_enabled(0), operating_mode(0), supported_operating_modes(0xFFF6), feature_flags(0), delegate(nullptr) {} config() : lock_state(0), lock_type(0), actuator_enabled(0), operating_mode(0), supported_operating_modes(0xFFF6), delegate(nullptr) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -713,9 +595,6 @@ typedef struct config {
struct { struct {
feature::lift::config_t lift; feature::lift::config_t lift;
feature::tilt::config_t tilt; feature::tilt::config_t tilt;
feature::position_aware_lift::config_t position_aware_lift;
feature::absolute_position::config_t absolute_position;
feature::position_aware_tilt::config_t position_aware_tilt;
} features; } features;
uint32_t feature_flags; uint32_t feature_flags;
void *delegate; void *delegate;
@@ -729,9 +608,6 @@ namespace switch_cluster {
typedef struct config { typedef struct config {
uint8_t number_of_positions; uint8_t number_of_positions;
uint8_t current_position; uint8_t current_position;
struct {
feature::momentary_switch_multi_press::config_t momentary_switch_multi_press;
} features;
uint32_t feature_flags; uint32_t feature_flags;
config() : number_of_positions(2), current_position(0), feature_flags(0) {} config() : number_of_positions(2), current_position(0), feature_flags(0) {}
} config_t; } config_t;
@@ -785,15 +661,8 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace boolean_state_configuration { namespace boolean_state_configuration {
typedef struct config { typedef struct config {
struct {
feature::visual::config_t visual;
feature::audible::config_t audible;
feature::alarm_suppress::config_t alarm_suppress;
feature::sensitivity_level::config_t sensitivity_level;
} features;
uint32_t feature_flags;
void *delegate; void *delegate;
config() : feature_flags(0), delegate(nullptr) {} config() : delegate(nullptr) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -811,11 +680,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace time_format_localization { namespace time_format_localization {
typedef struct config { typedef struct config {
uint8_t hour_format; uint8_t hour_format;
struct { config() : hour_format(0) {}
feature::calendar_format::config_t calendar_format;
} features;
uint32_t feature_flags;
config() : hour_format(0), feature_flags(0) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -890,12 +755,8 @@ typedef struct config {
char mode_select_description[k_max_mode_select_description_length + 1]; char mode_select_description[k_max_mode_select_description_length + 1];
const nullable<uint16_t> standard_namespace; const nullable<uint16_t> standard_namespace;
uint8_t current_mode; uint8_t current_mode;
struct {
feature::on_off::config_t on_off;
} features;
uint32_t feature_flags;
void *delegate; void *delegate;
config() : mode_select_description{0}, standard_namespace(), current_mode(0), feature_flags(0), delegate(nullptr) {} config() : mode_select_description{0}, standard_namespace(), current_mode(0), delegate(nullptr) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -906,7 +767,6 @@ typedef struct config {
struct { struct {
feature::temperature_number::config_t temperature_number; feature::temperature_number::config_t temperature_number;
feature::temperature_level::config_t temperature_level; feature::temperature_level::config_t temperature_level;
feature::temperature_step::config_t temperature_step;
} features; } features;
uint32_t feature_flags; uint32_t feature_flags;
config() : feature_flags(0) {} config() : feature_flags(0) {}
@@ -983,9 +843,8 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace keypad_input { namespace keypad_input {
typedef struct config { typedef struct config {
uint32_t feature_flags;
void *delegate; void *delegate;
config() : feature_flags(0), delegate(nullptr) {} config() : delegate(nullptr) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -995,7 +854,7 @@ namespace power_topology {
typedef struct config { typedef struct config {
uint32_t feature_flags; uint32_t feature_flags;
void *delegate; void *delegate;
config() : feature_flags(0), delegate(nullptr) {} config() : feature_flags(0), delegate(nullptr) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -1033,9 +892,8 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace energy_evse { namespace energy_evse {
typedef struct config { typedef struct config {
uint32_t feature_flags;
void *delegate; void *delegate;
config() : feature_flags(0), delegate(nullptr) {} config() : delegate(nullptr) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -1047,13 +905,8 @@ typedef struct config {
nullable<uint32_t> default_open_duration; nullable<uint32_t> default_open_duration;
nullable<uint8_t> current_state; nullable<uint8_t> current_state;
nullable<uint8_t> target_state; nullable<uint8_t> target_state;
struct {
feature::time_sync::config_t time_sync;
feature::level::config_t level;
} features;
uint32_t feature_flags;
void *delegate; void *delegate;
config() : open_duration(), default_open_duration(), current_state(), target_state(), feature_flags(0), delegate(nullptr) {} config() : open_duration(), default_open_duration(), current_state(), target_state(), delegate(nullptr) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -1061,9 +914,8 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace device_energy_management { namespace device_energy_management {
typedef struct config { typedef struct config {
uint32_t feature_flags;
void *delegate; void *delegate;
config() : feature_flags(0), delegate(nullptr) {} config() : delegate(nullptr) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -1090,9 +942,8 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace thread_border_router_management { namespace thread_border_router_management {
typedef struct config { typedef struct config {
uint32_t feature_flags;
void *delegate; void *delegate;
config() : feature_flags(0), delegate(nullptr) {} config() : delegate(nullptr) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -1110,9 +961,8 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace service_area { namespace service_area {
typedef struct config { typedef struct config {
uint32_t feature_flags;
void *delegate; void *delegate;
config() : feature_flags(0), delegate(nullptr) {} config() : delegate(nullptr) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -1123,13 +973,8 @@ typedef struct config {
uint8_t heater_types; uint8_t heater_types;
uint8_t heat_demand; uint8_t heat_demand;
uint8_t boost_state; uint8_t boost_state;
struct {
feature::energy_management::config_t energy_management;
feature::tank_percent::config_t tank_percent;
} features;
uint32_t feature_flags;
void *delegate; void *delegate;
config() : heater_types(0), heat_demand(0), boost_state(0), feature_flags(0), delegate(nullptr) {} config() : heater_types(0), heat_demand(0), boost_state(0), delegate(nullptr) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
+1 -1
View File
@@ -1572,7 +1572,7 @@ cluster_t *create(endpoint_t *endpoint, uint32_t cluster_id, uint8_t flags)
return (cluster_t *)cluster; return (cluster_t *)cluster;
} }
static esp_err_t destroy(cluster_t *cluster) esp_err_t destroy(cluster_t *cluster)
{ {
VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL")); VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL"));
_cluster_t *current_cluster = (_cluster_t *)cluster; _cluster_t *current_cluster = (_cluster_t *)cluster;
+12
View File
@@ -429,6 +429,18 @@ typedef void (*function_generic_t)();
*/ */
cluster_t *create(endpoint_t *endpoint, uint32_t cluster_id, uint8_t flags); cluster_t *create(endpoint_t *endpoint, uint32_t cluster_id, uint8_t flags);
/** Destroy cluster
*
* This will destroy the cluster which has been created and added to the endpoint. It also destroys the associated
* attributes, commands and events.
*
* @param[in] cluster Cluster handle.
*
* @return ESP_OK on success.
* @return error in case of failure.
*/
esp_err_t destroy(cluster_t *cluster);
/** Get cluster /** Get cluster
* *
* Get the cluster present on the endpoint. * Get the cluster present on the endpoint.
+91 -82
View File
@@ -74,21 +74,18 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
administrator_commissioning::create(endpoint, &(config->administrator_commissioning), CLUSTER_FLAG_SERVER); administrator_commissioning::create(endpoint, &(config->administrator_commissioning), CLUSTER_FLAG_SERVER);
operational_credentials::create(endpoint, &(config->operational_credentials), CLUSTER_FLAG_SERVER); operational_credentials::create(endpoint, &(config->operational_credentials), CLUSTER_FLAG_SERVER);
group_key_management::create(endpoint, CLUSTER_FLAG_SERVER); group_key_management::create(endpoint, CLUSTER_FLAG_SERVER);
#if CHIP_CONFIG_ENABLE_ICD_SERVER #if CHIP_CONFIG_ENABLE_ICD_SERVER
if (icd::get_icd_server_enabled()) { if (icd::get_icd_server_enabled()) {
config->icd_management.feature_flags |= cluster_t *icd_management_cluster = icd_management::create(endpoint, &(config->icd_management), CLUSTER_FLAG_SERVER);
#if CHIP_CONFIG_ENABLE_ICD_LIT #if CHIP_CONFIG_ENABLE_ICD_LIT
icd_management::feature::long_idle_time_support::get_id() | icd_management::feature::long_idle_time_support::add(icd_management_cluster);
#if CHIP_CONFIG_ENABLE_ICD_CIP #if CHIP_CONFIG_ENABLE_ICD_CIP
icd_management::feature::check_in_protocol_support::get_id() | icd_management::feature::check_in_protocol_support::add(icd_management_cluster);
#endif // CHIP_CONFIG_ENABLE_ICD_CIP #endif // CHIP_CONFIG_ENABLE_ICD_CIP
#if CHIP_CONFIG_ENABLE_ICD_UAT #if CHIP_CONFIG_ENABLE_ICD_UAT
icd_management::feature::user_active_mode_trigger::get_id() | icd_management::feature::user_active_mode_trigger::add(icd_management_cluster);
#endif // CHIP_CONFIG_ENABLE_ICD_UAT #endif // CHIP_CONFIG_ENABLE_ICD_UAT
#endif // CHIP_CONFIG_ENABLE_ICD_LIT #endif // CHIP_CONFIG_ENABLE_ICD_LIT
0;
icd_management::create(endpoint, &(config->icd_management), CLUSTER_FLAG_SERVER);
} }
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER #endif // CHIP_CONFIG_ENABLE_ICD_SERVER
return ESP_OK; return ESP_OK;
@@ -223,8 +220,10 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
identify::command::create_trigger_effect(identify_cluster); identify::command::create_trigger_effect(identify_cluster);
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER);
config->on_off.feature_flags |= on_off::feature::lighting::get_id(); cluster_t *on_off_cluster = on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER);
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); on_off::feature::lighting::add(on_off_cluster, &(config->on_off_lighting));
on_off::command::create_on(on_off_cluster);
on_off::command::create_toggle(on_off_cluster);
return ESP_OK; return ESP_OK;
} }
@@ -255,11 +254,13 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
identify::command::create_trigger_effect(identify_cluster); identify::command::create_trigger_effect(identify_cluster);
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER);
config->on_off.feature_flags |= on_off::feature::lighting::get_id(); cluster_t *on_off_cluster = on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER);
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); on_off::feature::lighting::add(on_off_cluster, &(config->on_off_lighting));
// Set the mandatory feature flags in the config structure on_off::command::create_on(on_off_cluster);
config->level_control.feature_flags |= level_control::feature::on_off::get_id() | level_control::feature::lighting::get_id(); on_off::command::create_toggle(on_off_cluster);
level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER); cluster_t *level_control_cluster = level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER);
level_control::feature::on_off::add(level_control_cluster);
level_control::feature::lighting::add(level_control_cluster, &(config->level_control_lighting));
return ESP_OK; return ESP_OK;
} }
@@ -289,14 +290,16 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
identify::command::create_trigger_effect(identify_cluster); identify::command::create_trigger_effect(identify_cluster);
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER);
config->on_off.feature_flags |= on_off::feature::lighting::get_id(); cluster_t *on_off_cluster = on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER);
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); on_off::feature::lighting::add(on_off_cluster, &(config->on_off_lighting));
// Set the mandatory feature flags in the config structure on_off::command::create_on(on_off_cluster);
config->level_control.feature_flags |= level_control::feature::on_off::get_id() | level_control::feature::lighting::get_id(); on_off::command::create_toggle(on_off_cluster);
level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER); cluster_t *level_control_cluster = level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER);
// Set the mandatory feature flags in the config structure level_control::feature::on_off::add(level_control_cluster);
config->color_control.feature_flags |= color_control::feature::color_temperature::get_id(); level_control::feature::lighting::add(level_control_cluster, &(config->level_control_lighting));
color_control::create(endpoint, &(config->color_control), CLUSTER_FLAG_SERVER); cluster_t *color_control_cluster = color_control::create(endpoint, &(config->color_control), CLUSTER_FLAG_SERVER);
color_control::feature::color_temperature::add(color_control_cluster, &(config->color_control_color_temperature));
color_control::attribute::create_remaining_time(color_control_cluster, config->color_control_remaining_time);
return ESP_OK; return ESP_OK;
} }
@@ -326,14 +329,17 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
identify::command::create_trigger_effect(identify_cluster); identify::command::create_trigger_effect(identify_cluster);
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER);
config->on_off.feature_flags |= on_off::feature::lighting::get_id(); cluster_t *on_off_cluster = on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER);
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); on_off::feature::lighting::add(on_off_cluster, &(config->on_off_lighting));
// Set the mandatory feature flags in the config structure on_off::command::create_on(on_off_cluster);
config->level_control.feature_flags |= level_control::feature::on_off::get_id() | level_control::feature::lighting::get_id(); on_off::command::create_toggle(on_off_cluster);
level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER); cluster_t *level_control_cluster = level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER);
// Set the mandatory feature flags in the config structure level_control::feature::on_off::add(level_control_cluster);
config->color_control.feature_flags |= color_control::feature::color_temperature::get_id() | color_control::feature::xy::get_id(); level_control::feature::lighting::add(level_control_cluster, &(config->level_control_lighting));
color_control::create(endpoint, &(config->color_control), CLUSTER_FLAG_SERVER); cluster_t *color_control_cluster = color_control::create(endpoint, &(config->color_control), CLUSTER_FLAG_SERVER);
color_control::feature::color_temperature::add(color_control_cluster, &(config->color_control_color_temperature));
color_control::feature::xy::add(color_control_cluster, &(config->color_control_xy));
color_control::attribute::create_remaining_time(color_control_cluster, config->color_control_remaining_time);
return ESP_OK; return ESP_OK;
} }
} /* extended_color_light */ } /* extended_color_light */
@@ -496,8 +502,10 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
identify::command::create_trigger_effect(identify_cluster); identify::command::create_trigger_effect(identify_cluster);
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER);
config->on_off.feature_flags |= on_off::feature::lighting::get_id(); cluster_t *on_off_cluster = on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER);
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); on_off::feature::lighting::add(on_off_cluster, &(config->on_off_lighting));
on_off::command::create_on(on_off_cluster);
on_off::command::create_toggle(on_off_cluster);
return ESP_OK; return ESP_OK;
} }
@@ -527,10 +535,13 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
identify::command::create_trigger_effect(identify_cluster); identify::command::create_trigger_effect(identify_cluster);
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER);
config->on_off.feature_flags |= on_off::feature::lighting::get_id(); cluster_t *on_off_cluster = on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER);
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); on_off::feature::lighting::add(on_off_cluster, &(config->on_off_lighting));
config->level_control.feature_flags |= level_control::feature::on_off::get_id() | level_control::feature::lighting::get_id(); on_off::command::create_on(on_off_cluster);
level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER); on_off::command::create_toggle(on_off_cluster);
cluster_t *level_control_cluster = level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER);
level_control::feature::on_off::add(level_control_cluster);
level_control::feature::lighting::add(level_control_cluster, &(config->level_control_lighting));
return ESP_OK; return ESP_OK;
} }
@@ -588,7 +599,6 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER);
config->thermostat.feature_flags |= cluster::thermostat::feature::heating::get_id();
cluster::thermostat::create(endpoint, &(config->thermostat), CLUSTER_FLAG_SERVER); cluster::thermostat::create(endpoint, &(config->thermostat), CLUSTER_FLAG_SERVER);
return ESP_OK; return ESP_OK;
@@ -733,7 +743,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version());
VerifyOrReturnError(err == ESP_OK, err); VerifyOrReturnError(err == ESP_OK, err);
operational_state::create(endpoint, &(config->operational_state), CLUSTER_FLAG_SERVER); cluster_t *operational_state_cluster = operational_state::create(endpoint, &(config->operational_state), CLUSTER_FLAG_SERVER);
operational_state::event::create_operation_completion(operational_state_cluster);
return ESP_OK; return ESP_OK;
} }
@@ -760,7 +771,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version());
VerifyOrReturnError(err == ESP_OK, err); VerifyOrReturnError(err == ESP_OK, err);
operational_state::create(endpoint, &(config->operational_state), CLUSTER_FLAG_SERVER); cluster_t *operational_state_cluster = operational_state::create(endpoint, &(config->operational_state), CLUSTER_FLAG_SERVER);
operational_state::event::create_operation_completion(operational_state_cluster);
return ESP_OK; return ESP_OK;
} }
@@ -787,7 +799,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version());
VerifyOrReturnError(err == ESP_OK, err); VerifyOrReturnError(err == ESP_OK, err);
operational_state::create(endpoint, &(config->operational_state), CLUSTER_FLAG_SERVER); cluster_t *operational_state_cluster = operational_state::create(endpoint, &(config->operational_state), CLUSTER_FLAG_SERVER);
operational_state::event::create_operation_completion(operational_state_cluster);
return ESP_OK; return ESP_OK;
} }
@@ -1115,7 +1128,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
} }
} /* flow_sensor */ } /* flow_sensor */
namespace pump{ namespace pump {
uint32_t get_device_type_id() uint32_t get_device_type_id()
{ {
@@ -1138,14 +1151,16 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
VerifyOrReturnError(err == ESP_OK, err); VerifyOrReturnError(err == ESP_OK, err);
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); cluster_t *on_off_cluster = on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER);
on_off::command::create_on(on_off_cluster);
on_off::command::create_toggle(on_off_cluster);
pump_configuration_and_control::create(endpoint, &(config->pump_configuration_and_control), CLUSTER_FLAG_SERVER); pump_configuration_and_control::create(endpoint, &(config->pump_configuration_and_control), CLUSTER_FLAG_SERVER);
return ESP_OK; return ESP_OK;
} }
} /** pump **/ } /** pump **/
namespace pump_controller{ namespace pump_controller {
uint32_t get_device_type_id() uint32_t get_device_type_id()
{ {
@@ -1168,8 +1183,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
VerifyOrReturnError(err == ESP_OK, err); VerifyOrReturnError(err == ESP_OK, err);
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_CLIENT); on_off::create(endpoint, nullptr, CLUSTER_FLAG_CLIENT);
pump_configuration_and_control::create(endpoint, &(config->pump_configuration_and_control), CLUSTER_FLAG_CLIENT); pump_configuration_and_control::create(endpoint, nullptr, CLUSTER_FLAG_CLIENT);
binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER); binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER);
return ESP_OK; return ESP_OK;
@@ -1206,7 +1221,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
} }
} /** mode_select_device **/ } /** mode_select_device **/
namespace room_air_conditioner{ namespace room_air_conditioner {
uint32_t get_device_type_id() uint32_t get_device_type_id()
{ {
@@ -1230,8 +1245,10 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
VerifyOrReturnError(err == ESP_OK, err); VerifyOrReturnError(err == ESP_OK, err);
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
config->on_off.feature_flags |= on_off::feature::dead_front_behavior::get_id(); cluster_t *on_off_cluster = on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER);
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); on_off::feature::dead_front_behavior::add(on_off_cluster);
on_off::command::create_on(on_off_cluster);
on_off::command::create_toggle(on_off_cluster);
config->thermostat.feature_flags |= cluster::thermostat::feature::cooling::get_id(); config->thermostat.feature_flags |= cluster::thermostat::feature::cooling::get_id();
cluster::thermostat::create(endpoint, &(config->thermostat), CLUSTER_FLAG_SERVER); cluster::thermostat::create(endpoint, &(config->thermostat), CLUSTER_FLAG_SERVER);
@@ -1261,7 +1278,6 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version());
VerifyOrReturnError(err == ESP_OK, err); VerifyOrReturnError(err == ESP_OK, err);
config->temperature_control.feature_flags |= temperature_control::feature::temperature_number::get_id();
temperature_control::create(endpoint, &(config->temperature_control), CLUSTER_FLAG_SERVER); temperature_control::create(endpoint, &(config->temperature_control), CLUSTER_FLAG_SERVER);
return ESP_OK; return ESP_OK;
@@ -1321,7 +1337,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
} /** oven **/ } /** oven **/
namespace robotic_vacuum_cleaner{ namespace robotic_vacuum_cleaner {
uint32_t get_device_type_id() uint32_t get_device_type_id()
{ {
@@ -1345,7 +1361,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
rvc_run_mode::create(endpoint, &(config->rvc_run_mode), CLUSTER_FLAG_SERVER); rvc_run_mode::create(endpoint, &(config->rvc_run_mode), CLUSTER_FLAG_SERVER);
rvc_operational_state::create(endpoint, &(config->rvc_operational_state), CLUSTER_FLAG_SERVER); cluster_t *rvc_operational_state_cluster = rvc_operational_state::create(endpoint, &(config->rvc_operational_state), CLUSTER_FLAG_SERVER);
operational_state::event::create_operation_completion(rvc_operational_state_cluster);
return ESP_OK; return ESP_OK;
} }
@@ -1373,7 +1390,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
VerifyOrReturnError(err == ESP_OK, err); VerifyOrReturnError(err == ESP_OK, err);
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
boolean_state::create(endpoint, &(config->boolean_state), CLUSTER_FLAG_SERVER); cluster_t *cluster = boolean_state::create(endpoint, &(config->boolean_state), CLUSTER_FLAG_SERVER);
boolean_state::event::create_state_change(cluster);
return ESP_OK; return ESP_OK;
} }
@@ -1401,7 +1419,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
VerifyOrReturnError(err == ESP_OK, err); VerifyOrReturnError(err == ESP_OK, err);
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
boolean_state::create(endpoint, &(config->boolean_state), CLUSTER_FLAG_SERVER); cluster_t *cluster = boolean_state::create(endpoint, &(config->boolean_state), CLUSTER_FLAG_SERVER);
boolean_state::event::create_state_change(cluster);
return ESP_OK; return ESP_OK;
} }
@@ -1430,7 +1449,6 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
cluster_t *cluster = boolean_state::create(endpoint, &(config->boolean_state), CLUSTER_FLAG_SERVER); cluster_t *cluster = boolean_state::create(endpoint, &(config->boolean_state), CLUSTER_FLAG_SERVER);
boolean_state::event::create_state_change(cluster); boolean_state::event::create_state_change(cluster);
return ESP_OK; return ESP_OK;
} }
@@ -1457,12 +1475,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version());
VerifyOrReturnError(err == ESP_OK, err); VerifyOrReturnError(err == ESP_OK, err);
// Set the mandatory feature flags in the config structures
config->power_topology.feature_flags |= power_topology::feature::set_topology::get_id();
power_topology::create(endpoint, &(config->power_topology), CLUSTER_FLAG_SERVER); power_topology::create(endpoint, &(config->power_topology), CLUSTER_FLAG_SERVER);
config->electrical_power_measurement.feature_flags |= electrical_power_measurement::feature::direct_current::get_id()
| electrical_power_measurement::feature::alternating_current::get_id();
electrical_power_measurement::create(endpoint, &(config->electrical_power_measurement), CLUSTER_FLAG_SERVER); electrical_power_measurement::create(endpoint, &(config->electrical_power_measurement), CLUSTER_FLAG_SERVER);
return ESP_OK; return ESP_OK;
@@ -1490,6 +1504,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version());
VerifyOrReturnError(err == ESP_OK, err); VerifyOrReturnError(err == ESP_OK, err);
config->temperature_control.feature_flags = cluster::temperature_control::feature::temperature_level::get_id();
temperature_control::create(endpoint, &(config->temperature_control), CLUSTER_FLAG_SERVER); temperature_control::create(endpoint, &(config->temperature_control), CLUSTER_FLAG_SERVER);
return ESP_OK; return ESP_OK;
@@ -1517,8 +1532,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version());
VerifyOrReturnError(err == ESP_OK, err); VerifyOrReturnError(err == ESP_OK, err);
config->on_off.feature_flags |= on_off::feature::off_only::get_id(); cluster_t *cluster = on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER);
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); on_off::feature::off_only::add(cluster);
return ESP_OK; return ESP_OK;
} }
@@ -1576,6 +1591,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
cluster_t *cluster = operational_state::create(endpoint, &(config->operational_state), CLUSTER_FLAG_SERVER); cluster_t *cluster = operational_state::create(endpoint, &(config->operational_state), CLUSTER_FLAG_SERVER);
operational_state::attribute::create_countdown_time(cluster, 0); operational_state::attribute::create_countdown_time(cluster, 0);
operational_state::event::create_operation_completion(cluster);
microwave_oven_mode::create(endpoint, &(config->microwave_oven_mode), CLUSTER_FLAG_SERVER); microwave_oven_mode::create(endpoint, &(config->microwave_oven_mode), CLUSTER_FLAG_SERVER);
microwave_oven_control::create(endpoint, &(config->microwave_oven_control), CLUSTER_FLAG_SERVER); microwave_oven_control::create(endpoint, &(config->microwave_oven_control), CLUSTER_FLAG_SERVER);
@@ -1691,7 +1707,6 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
VerifyOrReturnError(err == ESP_OK, err); VerifyOrReturnError(err == ESP_OK, err);
thread_network_diagnostics::create(endpoint, &(config->thread_network_diagnostics), CLUSTER_FLAG_SERVER); thread_network_diagnostics::create(endpoint, &(config->thread_network_diagnostics), CLUSTER_FLAG_SERVER);
config->thread_border_router_management.feature_flags |= thread_border_router_management::feature::pan_change::get_id();
thread_border_router_management::create(endpoint, &(config->thread_border_router_management), CLUSTER_FLAG_SERVER); thread_border_router_management::create(endpoint, &(config->thread_border_router_management), CLUSTER_FLAG_SERVER);
return ESP_OK; return ESP_OK;
} }
@@ -1749,8 +1764,10 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
identify::command::create_trigger_effect(identify_cluster); identify::command::create_trigger_effect(identify_cluster);
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER);
config->on_off.feature_flags |= on_off::feature::lighting::get_id(); cluster_t *on_off_cluster = on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER);
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); on_off::feature::lighting::add(on_off_cluster, &(config->on_off_lighting));
on_off::command::create_on(on_off_cluster);
on_off::command::create_toggle(on_off_cluster);
return ESP_OK; return ESP_OK;
} }
@@ -1781,11 +1798,13 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
identify::command::create_trigger_effect(identify_cluster); identify::command::create_trigger_effect(identify_cluster);
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER); groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER);
config->on_off.feature_flags |= on_off::feature::lighting::get_id(); cluster_t *on_off_cluster = on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER);
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER); on_off::feature::lighting::add(on_off_cluster, &(config->on_off_lighting));
// Set the mandatory feature flags in the config structure on_off::command::create_on(on_off_cluster);
config->level_control.feature_flags |= level_control::feature::on_off::get_id() | level_control::feature::lighting::get_id(); on_off::command::create_toggle(on_off_cluster);
level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER); cluster_t *level_control_cluster = level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER);
level_control::feature::lighting::add(level_control_cluster, &(config->level_control_lighting));
level_control::feature::on_off::add(level_control_cluster);
return ESP_OK; return ESP_OK;
} }
@@ -1812,7 +1831,6 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version());
VerifyOrReturnError(err == ESP_OK, err); VerifyOrReturnError(err == ESP_OK, err);
config->thermostat.feature_flags |= cluster::thermostat::feature::heating::get_id();
cluster::thermostat::create(endpoint, &(config->thermostat), CLUSTER_FLAG_SERVER); cluster::thermostat::create(endpoint, &(config->thermostat), CLUSTER_FLAG_SERVER);
water_heater_management::create(endpoint, &(config->water_heater_management), CLUSTER_FLAG_SERVER); water_heater_management::create(endpoint, &(config->water_heater_management), CLUSTER_FLAG_SERVER);
water_heater_mode::create(endpoint, &(config->water_heater_mode), CLUSTER_FLAG_SERVER); water_heater_mode::create(endpoint, &(config->water_heater_mode), CLUSTER_FLAG_SERVER);
@@ -1845,13 +1863,10 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
cluster_t *descriptor_cluster = cluster::get(endpoint, Descriptor::Id); cluster_t *descriptor_cluster = cluster::get(endpoint, Descriptor::Id);
descriptor::feature::taglist::add(descriptor_cluster); descriptor::feature::taglist::add(descriptor_cluster);
config->power_source_device.power_source.feature_flags = power_source::feature::wired::get_id();
power_source_device::add(endpoint, &config->power_source_device); power_source_device::add(endpoint, &config->power_source_device);
cluster_t *power_source_cluster = cluster::get(endpoint, PowerSource::Id);
power_source::feature::wired::add(power_source_cluster, &config->power_source_device.power_source.features.wired);
electrical_sensor::add(endpoint, &config->electrical_sensor); electrical_sensor::add(endpoint, &config->electrical_sensor);
// Set the mandatory feature flags in the config structure
config->electrical_energy_measurement.feature_flags |= electrical_energy_measurement::feature::exported_energy::get_id() | electrical_energy_measurement::feature::cumulative_energy::get_id();
electrical_energy_measurement::create(endpoint, &(config->electrical_energy_measurement), CLUSTER_FLAG_SERVER); electrical_energy_measurement::create(endpoint, &(config->electrical_energy_measurement), CLUSTER_FLAG_SERVER);
cluster_t *elec_power_measurement_cluster = cluster::get(endpoint, ElectricalPowerMeasurement::Id); cluster_t *elec_power_measurement_cluster = cluster::get(endpoint, ElectricalPowerMeasurement::Id);
@@ -1888,11 +1903,10 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
cluster_t *descriptor_cluster = cluster::get(endpoint, Descriptor::Id); cluster_t *descriptor_cluster = cluster::get(endpoint, Descriptor::Id);
descriptor::feature::taglist::add(descriptor_cluster); descriptor::feature::taglist::add(descriptor_cluster);
config->power_source_device.power_source.feature_flags = power_source::feature::battery::get_id() | power_source::feature::wired::get_id();
power_source_device::add(endpoint, &config->power_source_device); power_source_device::add(endpoint, &config->power_source_device);
cluster_t *power_source_cluster = cluster::get(endpoint, PowerSource::Id); cluster_t *power_source_cluster = cluster::get(endpoint, PowerSource::Id);
power_source::feature::wired::add(power_source_cluster, &config->power_source_device.power_source.features.wired);
power_source::feature::battery::add(power_source_cluster, &config->power_source_device.power_source.features.battery);
power_source::attribute::create_bat_voltage(power_source_cluster, config->bat_voltage, 0x00, 0xFFFF); power_source::attribute::create_bat_voltage(power_source_cluster, config->bat_voltage, 0x00, 0xFFFF);
power_source::attribute::create_bat_percent_remaining(power_source_cluster, config->bat_percent_remaining, 0, 200); power_source::attribute::create_bat_percent_remaining(power_source_cluster, config->bat_percent_remaining, 0, 200);
@@ -1904,8 +1918,6 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
power_source::attribute::create_active_bat_charge_faults(power_source_cluster, NULL, 0, 0); power_source::attribute::create_active_bat_charge_faults(power_source_cluster, NULL, 0, 0);
electrical_sensor::add(endpoint, &config->electrical_sensor); electrical_sensor::add(endpoint, &config->electrical_sensor);
// Set the mandatory feature flags in the config structure
config->electrical_energy_measurement.feature_flags |= electrical_energy_measurement::feature::exported_energy::get_id() | electrical_energy_measurement::feature::cumulative_energy::get_id();
electrical_energy_measurement::create(endpoint, &(config->electrical_energy_measurement), CLUSTER_FLAG_SERVER); electrical_energy_measurement::create(endpoint, &(config->electrical_energy_measurement), CLUSTER_FLAG_SERVER);
cluster_t *elec_power_measurement_cluster = cluster::get(endpoint, ElectricalPowerMeasurement::Id); cluster_t *elec_power_measurement_cluster = cluster::get(endpoint, ElectricalPowerMeasurement::Id);
@@ -1945,11 +1957,10 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
cluster_t *descriptor_cluster = cluster::get(endpoint, Descriptor::Id); cluster_t *descriptor_cluster = cluster::get(endpoint, Descriptor::Id);
descriptor::feature::taglist::add(descriptor_cluster); descriptor::feature::taglist::add(descriptor_cluster);
config->power_source_device.power_source.feature_flags = power_source::feature::wired::get_id();
power_source_device::add(endpoint, &config->power_source_device); power_source_device::add(endpoint, &config->power_source_device);
cluster_t *power_source_cluster = cluster::get(endpoint, PowerSource::Id);
power_source::feature::wired::add(power_source_cluster, &config->power_source_device.power_source.features.wired);
config->electrical_sensor.electrical_power_measurement.feature_flags = electrical_power_measurement::feature::alternating_current::get_id();
electrical_sensor::add(endpoint, &config->electrical_sensor); electrical_sensor::add(endpoint, &config->electrical_sensor);
cluster_t *elec_power_measurement_cluster = cluster::get(endpoint, ElectricalPowerMeasurement::Id); cluster_t *elec_power_measurement_cluster = cluster::get(endpoint, ElectricalPowerMeasurement::Id);
@@ -1957,8 +1968,6 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
electrical_power_measurement::attribute::create_voltage(elec_power_measurement_cluster, config->voltage); electrical_power_measurement::attribute::create_voltage(elec_power_measurement_cluster, config->voltage);
electrical_power_measurement::attribute::create_active_current(elec_power_measurement_cluster, config->active_current); electrical_power_measurement::attribute::create_active_current(elec_power_measurement_cluster, config->active_current);
// Set the mandatory feature flags in the config structure
config->electrical_energy_measurement.feature_flags |= electrical_energy_measurement::feature::exported_energy::get_id() | electrical_energy_measurement::feature::cumulative_energy::get_id();
electrical_energy_measurement::create(endpoint, &(config->electrical_energy_measurement), CLUSTER_FLAG_SERVER); electrical_energy_measurement::create(endpoint, &(config->electrical_energy_measurement), CLUSTER_FLAG_SERVER);
device_energy_management::add(endpoint, &config->device_energy_management); device_energy_management::add(endpoint, &config->device_energy_management);
+16 -8
View File
@@ -14,6 +14,7 @@
#pragma once #pragma once
#include <esp_matter_feature.h>
#include <esp_matter_cluster.h> #include <esp_matter_cluster.h>
#include <esp_matter_core.h> #include <esp_matter_core.h>
#include <esp_matter_identify.h> #include <esp_matter_identify.h>
@@ -175,6 +176,7 @@ typedef struct : app_base_config {
typedef struct : app_with_group_config { typedef struct : app_with_group_config {
cluster::on_off::config_t on_off; cluster::on_off::config_t on_off;
cluster::on_off::feature::lighting::config_t on_off_lighting;
} on_off_config; } on_off_config;
typedef struct : app_with_group_config { typedef struct : app_with_group_config {
@@ -264,6 +266,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace dimmable_light { namespace dimmable_light {
typedef struct config : on_off_light::config_t { typedef struct config : on_off_light::config_t {
cluster::level_control::config_t level_control; cluster::level_control::config_t level_control;
cluster::level_control::feature::lighting::config_t level_control_lighting;
} config_t; } config_t;
uint32_t get_device_type_id(); uint32_t get_device_type_id();
@@ -275,6 +278,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace color_temperature_light { namespace color_temperature_light {
typedef struct config : dimmable_light::config_t { typedef struct config : dimmable_light::config_t {
cluster::color_control::config_t color_control; cluster::color_control::config_t color_control;
cluster::color_control::feature::color_temperature::config_t color_control_color_temperature;
uint16_t color_control_remaining_time;
config() : color_control_remaining_time(0) {}
} config_t; } config_t;
uint32_t get_device_type_id(); uint32_t get_device_type_id();
@@ -286,6 +292,10 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace extended_color_light { namespace extended_color_light {
typedef struct config : dimmable_light::config_t { typedef struct config : dimmable_light::config_t {
cluster::color_control::config_t color_control; cluster::color_control::config_t color_control;
cluster::color_control::feature::color_temperature::config_t color_control_color_temperature;
cluster::color_control::feature::xy::config_t color_control_xy;
uint16_t color_control_remaining_time;
config() : color_control_remaining_time(0) {}
} config_t; } config_t;
uint32_t get_device_type_id(); uint32_t get_device_type_id();
@@ -367,6 +377,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace dimmable_plugin_unit { namespace dimmable_plugin_unit {
typedef struct config : on_off_plugin_unit::config_t { typedef struct config : on_off_plugin_unit::config_t {
cluster::level_control::config_t level_control; cluster::level_control::config_t level_control;
cluster::level_control::feature::lighting::config_t level_control_lighting;
} config_t; } config_t;
uint32_t get_device_type_id(); uint32_t get_device_type_id();
@@ -633,7 +644,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_dat
esp_err_t add(endpoint_t *endpoint, config_t *config); esp_err_t add(endpoint_t *endpoint, config_t *config);
} /* flow_sensor */ } /* flow_sensor */
namespace pump{ namespace pump {
typedef struct config : app_base_config { typedef struct config : app_base_config {
cluster::on_off::config_t on_off; cluster::on_off::config_t on_off;
cluster::pump_configuration_and_control::config_t pump_configuration_and_control; cluster::pump_configuration_and_control::config_t pump_configuration_and_control;
@@ -657,8 +668,6 @@ typedef struct config : app_client_config {
config() { config() {
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
cluster::on_off::config_t on_off;
cluster::pump_configuration_and_control::config_t pump_configuration_and_control;
} config_t; } config_t;
uint32_t get_device_type_id(); uint32_t get_device_type_id();
@@ -679,7 +688,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_dat
esp_err_t add(endpoint_t *endpoint, config_t *config); esp_err_t add(endpoint_t *endpoint, config_t *config);
} /** mode_select_device **/ } /** mode_select_device **/
namespace room_air_conditioner{ namespace room_air_conditioner {
typedef struct config : app_base_config { typedef struct config : app_base_config {
config() { config() {
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
@@ -694,7 +703,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_dat
esp_err_t add(endpoint_t *endpoint, config_t *config); esp_err_t add(endpoint_t *endpoint, config_t *config);
} /** room air conditioner **/ } /** room air conditioner **/
namespace temperature_controlled_cabinet{ namespace temperature_controlled_cabinet {
typedef struct config { typedef struct config {
cluster::descriptor::config_t descriptor; cluster::descriptor::config_t descriptor;
cluster::temperature_control::config_t temperature_control; cluster::temperature_control::config_t temperature_control;
@@ -706,7 +715,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_dat
esp_err_t add(endpoint_t *endpoint, config_t *config); esp_err_t add(endpoint_t *endpoint, config_t *config);
} /** temperature_controlled_cabinet **/ } /** temperature_controlled_cabinet **/
namespace refrigerator{ namespace refrigerator {
typedef struct config { typedef struct config {
cluster::descriptor::config_t descriptor; cluster::descriptor::config_t descriptor;
} config_t; } config_t;
@@ -728,7 +737,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_dat
esp_err_t add(endpoint_t *endpoint, config_t *config); esp_err_t add(endpoint_t *endpoint, config_t *config);
} /** oven **/ } /** oven **/
namespace robotic_vacuum_cleaner{ namespace robotic_vacuum_cleaner {
typedef struct config : app_base_config { typedef struct config : app_base_config {
config() { config() {
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
@@ -913,7 +922,6 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
} /* secondary_network_interface */ } /* secondary_network_interface */
namespace mounted_on_off_control { namespace mounted_on_off_control {
typedef struct config : on_off_config { typedef struct config : on_off_config {
config() { config() {
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
@@ -173,27 +173,6 @@ esp_err_t add(cluster_t *cluster);
} /* scene_names */ } /* scene_names */
namespace explicit_feature {
uint32_t get_id();
esp_err_t add(cluster_t *cluster);
} /* explicit_feature */
namespace table_size {
uint32_t get_id();
esp_err_t add(cluster_t *cluster);
} /* table_size */
namespace fabric_scenes {
uint32_t get_id();
esp_err_t add(cluster_t *cluster);
} /* fabric_scenes*/
} /* feature */ } /* feature */
} /* scenes_management */ } /* scenes_management */
+25 -2
View File
@@ -796,8 +796,7 @@ Additional clusters can also be added to an endpoint. Examples:
:: ::
on_off::config_t on_off_config; on_off::config_t on_off_config;
on_off_config.feature_flags = on_off::feature::lighting::get_id(); cluster_t *cluster = on_off::create(endpoint, &on_off_config, CLUSTER_FLAG_SERVER);
cluster_t *cluster = on_off::create(endpoint, &on_off_config, CLUSTER_FLAG_SERVER, on_off::feature::lighting::get_id());
- temperature_measurement: - temperature_measurement:
@@ -811,6 +810,7 @@ Additional clusters can also be added to an endpoint. Examples:
:: ::
window_covering::config_t window_covering_config(static_cast<uint8_t>(chip::app::Clusters::WindowCovering::EndProductType::kTiltOnlyInteriorBlind)); window_covering::config_t window_covering_config(static_cast<uint8_t>(chip::app::Clusters::WindowCovering::EndProductType::kTiltOnlyInteriorBlind));
window_covering_config.feature_flags = window_covering::feature::lift::get_id();
cluster_t *cluster = window_covering::create(endpoint, &window_covering_config, CLUSTER_FLAG_SERVER); cluster_t *cluster = window_covering::create(endpoint, &window_covering_config, CLUSTER_FLAG_SERVER);
The ``window_covering`` ``config_t`` structure includes a constructor that allows specifying The ``window_covering`` ``config_t`` structure includes a constructor that allows specifying
@@ -822,6 +822,7 @@ Additional clusters can also be added to an endpoint. Examples:
:: ::
pump_configuration_and_control::config_t pump_configuration_and_control_config(1, 10, 20); pump_configuration_and_control::config_t pump_configuration_and_control_config(1, 10, 20);
pump_configuration_and_control_config..feature_flags = pump_configuration_and_control::feature::constant_pressure::get_id();
cluster_t *cluster = pump_configuration_and_control::create(endpoint, &pump_configuration_and_control_config, CLUSTER_FLAG_SERVER); cluster_t *cluster = pump_configuration_and_control::create(endpoint, &pump_configuration_and_control_config, CLUSTER_FLAG_SERVER);
The ``pump_configuration_and_control`` ``config_t`` structure includes a constructor that allows specifying The ``pump_configuration_and_control`` ``config_t`` structure includes a constructor that allows specifying
@@ -862,6 +863,28 @@ Examples:
2.5.2.4 Features 2.5.2.4 Features
^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
Mandatory features for a device type or endpoint can be configured at endpoint level.
- feature: lighting: On/Off cluster:
::
extended_color_light::config_t light_config;
light_config.on_off_lighting.start_up_on_off = nullptr;
endpoint_t *endpoint = extended_color_light::create(node, &light_config, ENDPOINT_FLAG_NONE, nullptr);
Few of some mandatory feature for a cluster (i.e. cluster having O.a/O.a+ feature conformance) can be configured at cluster level.
For example: Thermostat cluster has O.a+ conformance for Heating and Cooling features, that means at least one of them should be present on the thermostat cluster while creating it.
- feature: heating: Thermostat cluster:
::
thermostat::config_t thermostat_config;
thermostat_config.features.heating.occupied_heating_setpoint = 2200;
thermostat_config.feature_flags = thermostat::feature::heating::get_id();
cluster::thermostat::create(endpoint, &(config->thermostat_config), CLUSTER_FLAG_SERVER);
Optional features which are applicable to a cluster can also be added. Optional features which are applicable to a cluster can also be added.
- feature: taglist: Descriptor cluster: - feature: taglist: Descriptor cluster:
@@ -210,6 +210,7 @@ int create(uint8_t device_type_index)
} }
case ESP_MATTER_GENERIC_SWITCH: { case ESP_MATTER_GENERIC_SWITCH: {
esp_matter::endpoint::generic_switch::config_t generic_switch_config; esp_matter::endpoint::generic_switch::config_t generic_switch_config;
generic_switch_config.switch_cluster.feature_flags = cluster::switch_cluster::feature::latching_switch::get_id();
endpoint = esp_matter::endpoint::generic_switch::create(node, &generic_switch_config, ENDPOINT_FLAG_NONE, NULL); endpoint = esp_matter::endpoint::generic_switch::create(node, &generic_switch_config, ENDPOINT_FLAG_NONE, NULL);
break; break;
} }
@@ -257,6 +258,7 @@ int create(uint8_t device_type_index)
} }
case ESP_MATTER_THERMOSTAT: { case ESP_MATTER_THERMOSTAT: {
esp_matter::endpoint::thermostat::config_t thermostat_config; esp_matter::endpoint::thermostat::config_t thermostat_config;
thermostat_config.thermostat.feature_flags = cluster::thermostat::feature::auto_mode::get_id();
endpoint = esp_matter::endpoint::thermostat::create(node, &thermostat_config, ENDPOINT_FLAG_NONE, NULL); endpoint = esp_matter::endpoint::thermostat::create(node, &thermostat_config, ENDPOINT_FLAG_NONE, NULL);
break; break;
} }
@@ -282,9 +284,9 @@ int create(uint8_t device_type_index)
} }
case ESP_MATTER_WINDOW_COVERING_DEVICE: { case ESP_MATTER_WINDOW_COVERING_DEVICE: {
esp_matter::endpoint::window_covering_device::config_t window_covering_device_config; esp_matter::endpoint::window_covering_device::config_t window_covering_device_config;
window_covering_device_config.window_covering.feature_flags = cluster::window_covering::feature::lift::get_id();
endpoint = esp_matter::endpoint::window_covering_device::create(node, &window_covering_device_config, ENDPOINT_FLAG_NONE, NULL); endpoint = esp_matter::endpoint::window_covering_device::create(node, &window_covering_device_config, ENDPOINT_FLAG_NONE, NULL);
cluster_t *cluster = cluster::get(endpoint, chip::app::Clusters::WindowCovering::Id); cluster_t *cluster = cluster::get(endpoint, chip::app::Clusters::WindowCovering::Id);
cluster::window_covering::feature::lift::config_t lift;
cluster::window_covering::feature::position_aware_lift::config_t position_aware_lift; cluster::window_covering::feature::position_aware_lift::config_t position_aware_lift;
cluster::window_covering::feature::absolute_position::config_t absolute_position; cluster::window_covering::feature::absolute_position::config_t absolute_position;
@@ -294,7 +296,6 @@ int create(uint8_t device_type_index)
position_aware_lift.target_position_lift_percent_100ths = percentage_100ths; position_aware_lift.target_position_lift_percent_100ths = percentage_100ths;
position_aware_lift.current_position_lift_percent_100ths = percentage_100ths; position_aware_lift.current_position_lift_percent_100ths = percentage_100ths;
cluster::window_covering::feature::lift::add(cluster, &lift);
cluster::window_covering::feature::position_aware_lift::add(cluster, &position_aware_lift); cluster::window_covering::feature::position_aware_lift::add(cluster, &position_aware_lift);
cluster::window_covering::feature::absolute_position::add(cluster, &absolute_position); cluster::window_covering::feature::absolute_position::add(cluster, &absolute_position);
break; break;
@@ -348,11 +349,13 @@ int create(uint8_t device_type_index)
} }
case ESP_MATTER_RAC: { case ESP_MATTER_RAC: {
esp_matter::endpoint::room_air_conditioner::config_t room_air_conditioner_config; esp_matter::endpoint::room_air_conditioner::config_t room_air_conditioner_config;
room_air_conditioner_config.thermostat.feature_flags = cluster::thermostat::feature::cooling::get_id();
endpoint = esp_matter::endpoint::room_air_conditioner::create(node, &room_air_conditioner_config, ENDPOINT_FLAG_NONE, NULL); endpoint = esp_matter::endpoint::room_air_conditioner::create(node, &room_air_conditioner_config, ENDPOINT_FLAG_NONE, NULL);
break; break;
} }
case ESP_MATTER_TEMP_CTRL_CABINET: { case ESP_MATTER_TEMP_CTRL_CABINET: {
esp_matter::endpoint::temperature_controlled_cabinet::config_t temperature_controlled_cabinet_config; esp_matter::endpoint::temperature_controlled_cabinet::config_t temperature_controlled_cabinet_config;
temperature_controlled_cabinet_config.temperature_control.feature_flags = cluster::temperature_control::feature::temperature_number::get_id();
endpoint = esp_matter::endpoint::temperature_controlled_cabinet::create(node, &temperature_controlled_cabinet_config, ENDPOINT_FLAG_NONE, NULL); endpoint = esp_matter::endpoint::temperature_controlled_cabinet::create(node, &temperature_controlled_cabinet_config, ENDPOINT_FLAG_NONE, NULL);
break; break;
} }
@@ -361,6 +364,7 @@ int create(uint8_t device_type_index)
endpoint = esp_matter::endpoint::refrigerator::create(node, &refrigerator_config, ENDPOINT_FLAG_NONE, NULL); endpoint = esp_matter::endpoint::refrigerator::create(node, &refrigerator_config, ENDPOINT_FLAG_NONE, NULL);
esp_matter::endpoint::temperature_controlled_cabinet::config_t temperature_controlled_cabinet_config; esp_matter::endpoint::temperature_controlled_cabinet::config_t temperature_controlled_cabinet_config;
temperature_controlled_cabinet_config.temperature_control.feature_flags = cluster::temperature_control::feature::temperature_number::get_id();
esp_matter::endpoint_t *tcc_endpoint = esp_matter::endpoint::temperature_controlled_cabinet::create(node, &temperature_controlled_cabinet_config, ENDPOINT_FLAG_NONE, NULL); esp_matter::endpoint_t *tcc_endpoint = esp_matter::endpoint::temperature_controlled_cabinet::create(node, &temperature_controlled_cabinet_config, ENDPOINT_FLAG_NONE, NULL);
if (!tcc_endpoint) { if (!tcc_endpoint) {
@@ -368,9 +372,6 @@ int create(uint8_t device_type_index)
return 1; return 1;
} }
esp_matter::cluster_t *cluster = esp_matter::cluster::get(tcc_endpoint, chip::app::Clusters::TemperatureControl::Id);
cluster::temperature_control::feature::temperature_number::config_t temperature_number_config;
cluster::temperature_control::feature::temperature_number::add(cluster, &temperature_number_config);
break; break;
} }
case ESP_MATTER_OVEN: { case ESP_MATTER_OVEN: {
@@ -378,16 +379,13 @@ int create(uint8_t device_type_index)
endpoint = esp_matter::endpoint::oven::create(node, &oven_config, ENDPOINT_FLAG_NONE, NULL); endpoint = esp_matter::endpoint::oven::create(node, &oven_config, ENDPOINT_FLAG_NONE, NULL);
esp_matter::endpoint::temperature_controlled_cabinet::config_t temperature_controlled_cabinet_config; esp_matter::endpoint::temperature_controlled_cabinet::config_t temperature_controlled_cabinet_config;
temperature_controlled_cabinet_config.temperature_control.feature_flags = cluster::temperature_control::feature::temperature_number::get_id();
esp_matter::endpoint_t *tcc_endpoint = esp_matter::endpoint::temperature_controlled_cabinet::create(node, &temperature_controlled_cabinet_config, ENDPOINT_FLAG_NONE, NULL); esp_matter::endpoint_t *tcc_endpoint = esp_matter::endpoint::temperature_controlled_cabinet::create(node, &temperature_controlled_cabinet_config, ENDPOINT_FLAG_NONE, NULL);
if (!tcc_endpoint) { if (!tcc_endpoint) {
ESP_LOGE(TAG, "Matter create endpoint failed"); ESP_LOGE(TAG, "Matter create endpoint failed");
return 1; return 1;
} }
esp_matter::cluster_t *cluster = esp_matter::cluster::get(tcc_endpoint, chip::app::Clusters::TemperatureControl::Id);
cluster::temperature_control::feature::temperature_number::config_t temperature_number_config;
cluster::temperature_control::feature::temperature_number::add(cluster, &temperature_number_config);
break; break;
} }
case ESP_MATTER_AIR_PURIFIER: { case ESP_MATTER_AIR_PURIFIER: {
@@ -417,9 +415,11 @@ int create(uint8_t device_type_index)
} }
case ESP_MATTER_SMOKE_CO_ALARM: { case ESP_MATTER_SMOKE_CO_ALARM: {
esp_matter::endpoint::smoke_co_alarm::config_t smoke_co_alarm_config; esp_matter::endpoint::smoke_co_alarm::config_t smoke_co_alarm_config;
smoke_co_alarm_config.smoke_co_alarm.feature_flags = cluster::smoke_co_alarm::feature::smoke_alarm::get_id();
endpoint = esp_matter::endpoint::smoke_co_alarm::create(node, &smoke_co_alarm_config, ENDPOINT_FLAG_NONE, NULL); endpoint = esp_matter::endpoint::smoke_co_alarm::create(node, &smoke_co_alarm_config, ENDPOINT_FLAG_NONE, NULL);
esp_matter::endpoint::power_source_device::config_t power_source_config; esp_matter::endpoint::power_source_device::config_t power_source_config;
power_source_config.power_source.feature_flags = cluster::power_source::feature::wired::get_id();
esp_matter::endpoint_t *ps_endpoint = esp_matter::endpoint::power_source_device::create(node, &power_source_config, ENDPOINT_FLAG_NONE, NULL); esp_matter::endpoint_t *ps_endpoint = esp_matter::endpoint::power_source_device::create(node, &power_source_config, ENDPOINT_FLAG_NONE, NULL);
if (!ps_endpoint) { if (!ps_endpoint) {
@@ -440,6 +440,7 @@ int create(uint8_t device_type_index)
} }
case ESP_MATTER_POWER_SOURCE: { case ESP_MATTER_POWER_SOURCE: {
esp_matter::endpoint::power_source_device::config_t power_source_device_config; esp_matter::endpoint::power_source_device::config_t power_source_device_config;
power_source_device_config.power_source.feature_flags = esp_matter::cluster::power_source::feature::wired::get_id();
endpoint = esp_matter::endpoint::power_source_device::create(node, &power_source_device_config, ENDPOINT_FLAG_NONE, NULL); endpoint = esp_matter::endpoint::power_source_device::create(node, &power_source_device_config, ENDPOINT_FLAG_NONE, NULL);
break; break;
} }
@@ -450,6 +451,8 @@ int create(uint8_t device_type_index)
} }
case ESP_MATTER_ELECTRICAL_SENSOR: { case ESP_MATTER_ELECTRICAL_SENSOR: {
esp_matter::endpoint::electrical_sensor::config_t electrical_sensor_config; esp_matter::endpoint::electrical_sensor::config_t electrical_sensor_config;
electrical_sensor_config.power_topology.feature_flags = esp_matter::cluster::power_topology::feature::node_topology::get_id();
electrical_sensor_config.electrical_power_measurement.feature_flags = esp_matter::cluster::electrical_power_measurement::feature::direct_current::get_id();
endpoint = esp_matter::endpoint::electrical_sensor::create(node, &electrical_sensor_config, ENDPOINT_FLAG_NONE, NULL); endpoint = esp_matter::endpoint::electrical_sensor::create(node, &electrical_sensor_config, ENDPOINT_FLAG_NONE, NULL);
break; break;
} }
@@ -533,6 +536,7 @@ int create(uint8_t device_type_index)
} }
case ESP_MATTER_WATER_HEATER: { case ESP_MATTER_WATER_HEATER: {
esp_matter::endpoint::water_heater::config_t water_heater_config; esp_matter::endpoint::water_heater::config_t water_heater_config;
water_heater_config.thermostat.feature_flags = cluster::thermostat::feature::heating::get_id();
endpoint = esp_matter::endpoint::water_heater::create(node, &water_heater_config, ENDPOINT_FLAG_NONE, NULL); endpoint = esp_matter::endpoint::water_heater::create(node, &water_heater_config, ENDPOINT_FLAG_NONE, NULL);
break; break;
} }
@@ -150,16 +150,12 @@ extern "C" void app_main()
color_temperature_light::config_t light_config; color_temperature_light::config_t light_config;
light_config.on_off.on_off = DEFAULT_POWER; light_config.on_off.on_off = DEFAULT_POWER;
light_config.on_off.features.lighting.start_up_on_off = nullptr; light_config.on_off_lighting.start_up_on_off = nullptr;
light_config.level_control.current_level = DEFAULT_BRIGHTNESS; light_config.level_control.current_level = DEFAULT_BRIGHTNESS;
light_config.level_control.features.lighting.start_up_current_level = DEFAULT_BRIGHTNESS; light_config.level_control_lighting.start_up_current_level = DEFAULT_BRIGHTNESS;
light_config.color_control.color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature; light_config.color_control.color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature;
light_config.color_control.enhanced_color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature; light_config.color_control.enhanced_color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature;
light_config.color_control.features.color_temperature.startup_color_temperature_mireds = nullptr; light_config.color_control_color_temperature.startup_color_temperature_mireds = nullptr;
light_config.on_off.feature_flags = cluster::on_off::feature::lighting::get_id();
light_config.level_control.feature_flags = cluster::level_control::feature::lighting::get_id();
light_config.color_control.feature_flags = cluster::color_control::feature::color_temperature::get_id();
// endpoint handles can be used to add/modify clusters. // endpoint handles can be used to add/modify clusters.
endpoint_t *endpoint = color_temperature_light::create(node, &light_config, ENDPOINT_FLAG_NONE, light_handle); endpoint_t *endpoint = color_temperature_light::create(node, &light_config, ENDPOINT_FLAG_NONE, light_handle);
+1 -2
View File
@@ -307,8 +307,7 @@ extern "C" void app_main()
on_off_light::config_t light_config; on_off_light::config_t light_config;
light_config.on_off.on_off = DEFAULT_POWER; light_config.on_off.on_off = DEFAULT_POWER;
light_config.on_off.features.lighting.start_up_on_off = nullptr; light_config.on_off_lighting.start_up_on_off = nullptr;
light_config.on_off.feature_flags = cluster::on_off::feature::lighting::get_id();
endpoint_t *endpoint = on_off_light::create(node, &light_config, ENDPOINT_FLAG_NONE, NULL); endpoint_t *endpoint = on_off_light::create(node, &light_config, ENDPOINT_FLAG_NONE, NULL);
ABORT_APP_ON_FAILURE(endpoint != nullptr, ESP_LOGE(TAG, "Failed to create on off light endpoint")); ABORT_APP_ON_FAILURE(endpoint != nullptr, ESP_LOGE(TAG, "Failed to create on off light endpoint"));
+9 -5
View File
@@ -134,6 +134,15 @@ static esp_err_t create_button(struct gpio_button* button, node_t* node)
/* Create a new endpoint. */ /* Create a new endpoint. */
generic_switch::config_t switch_config; generic_switch::config_t switch_config;
switch_config.switch_cluster.feature_flags =
#if CONFIG_GENERIC_SWITCH_TYPE_LATCHING
cluster::switch_cluster::feature::latching_switch::get_id();
#endif
#if CONFIG_GENERIC_SWITCH_TYPE_MOMENTARY
cluster::switch_cluster::feature::momentary_switch::get_id();
#endif
endpoint_t *endpoint = generic_switch::create(node, &switch_config, ENDPOINT_FLAG_NONE, button_handle); endpoint_t *endpoint = generic_switch::create(node, &switch_config, ENDPOINT_FLAG_NONE, button_handle);
cluster_t* descriptor = cluster::get(endpoint,Descriptor::Id); cluster_t* descriptor = cluster::get(endpoint,Descriptor::Id);
@@ -173,12 +182,7 @@ static esp_err_t create_button(struct gpio_button* button, node_t* node)
/* Add additional features to the node */ /* Add additional features to the node */
cluster_t *cluster = cluster::get(endpoint, Switch::Id); cluster_t *cluster = cluster::get(endpoint, Switch::Id);
#if CONFIG_GENERIC_SWITCH_TYPE_LATCHING
cluster::switch_cluster::feature::latching_switch::add(cluster);
#endif
#if CONFIG_GENERIC_SWITCH_TYPE_MOMENTARY #if CONFIG_GENERIC_SWITCH_TYPE_MOMENTARY
cluster::switch_cluster::feature::momentary_switch::add(cluster);
cluster::switch_cluster::feature::action_switch::add(cluster); cluster::switch_cluster::feature::action_switch::add(cluster);
cluster::switch_cluster::feature::momentary_switch_multi_press::config_t msm; cluster::switch_cluster::feature::momentary_switch_multi_press::config_t msm;
msm.multi_press_max = 5; msm.multi_press_max = 5;
+3 -7
View File
@@ -191,17 +191,13 @@ extern "C" void app_main()
extended_color_light::config_t light_config; extended_color_light::config_t light_config;
light_config.on_off.on_off = DEFAULT_POWER; light_config.on_off.on_off = DEFAULT_POWER;
light_config.on_off.features.lighting.start_up_on_off = nullptr; light_config.on_off_lighting.start_up_on_off = nullptr;
light_config.level_control.current_level = DEFAULT_BRIGHTNESS; light_config.level_control.current_level = DEFAULT_BRIGHTNESS;
light_config.level_control.on_level = DEFAULT_BRIGHTNESS; light_config.level_control.on_level = DEFAULT_BRIGHTNESS;
light_config.level_control.features.lighting.start_up_current_level = DEFAULT_BRIGHTNESS; light_config.level_control_lighting.start_up_current_level = DEFAULT_BRIGHTNESS;
light_config.color_control.color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature; light_config.color_control.color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature;
light_config.color_control.enhanced_color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature; light_config.color_control.enhanced_color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature;
light_config.color_control.features.color_temperature.startup_color_temperature_mireds = nullptr; light_config.color_control_color_temperature.startup_color_temperature_mireds = nullptr;
light_config.on_off.feature_flags = cluster::on_off::feature::lighting::get_id();
light_config.level_control.feature_flags = cluster::level_control::feature::lighting::get_id();
light_config.color_control.feature_flags = cluster::color_control::feature::color_temperature::get_id() | cluster::color_control::feature::xy::get_id();
// endpoint handles can be used to add/modify clusters. // endpoint handles can be used to add/modify clusters.
endpoint_t *endpoint = extended_color_light::create(node, &light_config, ENDPOINT_FLAG_NONE, light_handle); endpoint_t *endpoint = extended_color_light::create(node, &light_config, ENDPOINT_FLAG_NONE, light_handle);
@@ -235,17 +235,13 @@ extern "C" void app_main()
extended_color_light::config_t light_config; extended_color_light::config_t light_config;
light_config.on_off.on_off = DEFAULT_POWER; light_config.on_off.on_off = DEFAULT_POWER;
light_config.on_off.features.lighting.start_up_on_off = nullptr; light_config.on_off_lighting.start_up_on_off = nullptr;
light_config.level_control.current_level = DEFAULT_BRIGHTNESS; light_config.level_control.current_level = DEFAULT_BRIGHTNESS;
light_config.level_control.on_level = DEFAULT_BRIGHTNESS; light_config.level_control.on_level = DEFAULT_BRIGHTNESS;
light_config.level_control.features.lighting.start_up_current_level = DEFAULT_BRIGHTNESS; light_config.level_control_lighting.start_up_current_level = DEFAULT_BRIGHTNESS;
light_config.color_control.color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature; light_config.color_control.color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature;
light_config.color_control.enhanced_color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature; light_config.color_control.enhanced_color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature;
light_config.color_control.features.color_temperature.startup_color_temperature_mireds = nullptr; light_config.color_control_color_temperature.startup_color_temperature_mireds = nullptr;
light_config.on_off.feature_flags = cluster::on_off::feature::lighting::get_id();
light_config.level_control.feature_flags = cluster::level_control::feature::lighting::get_id();
light_config.color_control.feature_flags = cluster::color_control::feature::color_temperature::get_id();
// endpoint handles can be used to add/modify clusters. // endpoint handles can be used to add/modify clusters.
endpoint_t *endpoint = extended_color_light::create(node, &light_config, ENDPOINT_FLAG_NONE, light_handle); endpoint_t *endpoint = extended_color_light::create(node, &light_config, ENDPOINT_FLAG_NONE, light_handle);
@@ -164,10 +164,10 @@ extern "C" void app_main()
extended_color_light::config_t light_config; extended_color_light::config_t light_config;
light_config.on_off.on_off = DEFAULT_POWER; light_config.on_off.on_off = DEFAULT_POWER;
light_config.on_off.lighting.start_up_on_off = nullptr; //light_config.on_off_lighting.start_up_on_off = nullptr;
light_config.level_control.current_level = DEFAULT_BRIGHTNESS; light_config.level_control.current_level = DEFAULT_BRIGHTNESS;
light_config.level_control.on_level = DEFAULT_BRIGHTNESS; light_config.level_control.on_level = DEFAULT_BRIGHTNESS;
light_config.level_control.lighting.start_up_current_level = DEFAULT_BRIGHTNESS; //light_config.level_control_lighting.start_up_current_level = DEFAULT_BRIGHTNESS;
light_config.color_control.color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature; light_config.color_control.color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature;
light_config.color_control.enhanced_color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature; light_config.color_control.enhanced_color_mode = (uint8_t)ColorControl::ColorMode::kColorTemperature;
light_config.color_control.color_temperature.startup_color_temperature_mireds = nullptr; light_config.color_control.color_temperature.startup_color_temperature_mireds = nullptr;
-6
View File
@@ -114,12 +114,6 @@ extern "C" void app_main()
endpoint_t *endpoint1 = temperature_controlled_cabinet::create(node, &temperature_controlled_cabinet_config, ENDPOINT_FLAG_NONE, NULL); endpoint_t *endpoint1 = temperature_controlled_cabinet::create(node, &temperature_controlled_cabinet_config, ENDPOINT_FLAG_NONE, NULL);
ABORT_APP_ON_FAILURE(endpoint1 != nullptr, ESP_LOGE(TAG, "Failed to create temperature controlled cabinet endpoint")); ABORT_APP_ON_FAILURE(endpoint1 != nullptr, ESP_LOGE(TAG, "Failed to create temperature controlled cabinet endpoint"));
esp_matter::cluster_t *cluster = esp_matter::cluster::get(endpoint1, chip::app::Clusters::TemperatureControl::Id);
// Atlest one of temperature_number and temperature_level feature is mandatory.
cluster::temperature_control::feature::temperature_number::config_t temperature_number_config;
cluster::temperature_control::feature::temperature_number::add(cluster, &temperature_number_config);
refrigerator_endpoint_id = endpoint::get_id(endpoint); refrigerator_endpoint_id = endpoint::get_id(endpoint);
ESP_LOGI(TAG, "Refrigerator created with endpoint_id %d", refrigerator_endpoint_id); ESP_LOGI(TAG, "Refrigerator created with endpoint_id %d", refrigerator_endpoint_id);
@@ -82,12 +82,13 @@ extern "C" void app_main()
} }
thread_border_router::config_t tbr_config; thread_border_router::config_t tbr_config;
tbr_config.thread_border_router_management.delegate = delegate; tbr_config.thread_border_router_management.delegate = delegate;
tbr_config.thread_border_router_management.feature_flags = cluster::thread_border_router_management::feature::pan_change::get_id();
endpoint_t *tbr_endpoint = thread_border_router::create(node, &tbr_config, ENDPOINT_FLAG_NONE, NULL); endpoint_t *tbr_endpoint = thread_border_router::create(node, &tbr_config, ENDPOINT_FLAG_NONE, NULL);
if (!node || !tbr_endpoint) { if (!node || !tbr_endpoint) {
ESP_LOGE(TAG, "Failed to create data model"); ESP_LOGE(TAG, "Failed to create data model");
return; return;
} }
cluster_t *tbr_cluster = cluster::get(tbr_endpoint, ThreadBorderRouterManagement::Id);
cluster::thread_border_router_management::feature::pan_change::add(tbr_cluster);
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD #if CHIP_DEVICE_CONFIG_ENABLE_THREAD
#if defined(CONFIG_OPENTHREAD_BORDER_ROUTER) && defined(CONFIG_AUTO_UPDATE_RCP) #if defined(CONFIG_OPENTHREAD_BORDER_ROUTER) && defined(CONFIG_AUTO_UPDATE_RCP)
esp_vfs_spiffs_conf_t rcp_fw_conf = { esp_vfs_spiffs_conf_t rcp_fw_conf = {