From 0685068c260bdd296f2c112b4265ac9c2018bc21 Mon Sep 17 00:00:00 2001 From: Chirag Atal Date: Thu, 7 Apr 2022 12:45:25 +0530 Subject: [PATCH] esp_matter: Using namespaces for IDs instead of using macros from submodule examples: Similar changes esp_matter_rainmaker: Adding rainmaker namespace and similar IDs instead of macros. --- components/esp_matter/esp_matter.h | 6 +- .../esp_matter/esp_matter_attribute.cpp | 263 +++++++++-------- components/esp_matter/esp_matter_client.cpp | 54 ++-- components/esp_matter/esp_matter_cluster.cpp | 58 ++-- components/esp_matter/esp_matter_command.cpp | 269 ++++++++---------- components/esp_matter/esp_matter_endpoint.cpp | 3 +- components/esp_matter/esp_matter_feature.cpp | 2 +- .../esp_matter_rainmaker.cpp | 107 ++++--- .../esp_matter_rainmaker.h | 10 +- examples/bridge_zigbee/main/app_main.cpp | 4 +- examples/bridge_zigbee/main/zigbee_bridge.cpp | 4 +- examples/light/main/app_driver.cpp | 14 +- examples/rainmaker_light/main/app_driver.cpp | 14 +- .../rainmaker_light/main/app_rainmaker.cpp | 92 +++--- examples/switch/main/app_driver.cpp | 8 +- examples/zap_light/main/app_driver.cpp | 30 +- 16 files changed, 468 insertions(+), 470 deletions(-) diff --git a/components/esp_matter/esp_matter.h b/components/esp_matter/esp_matter.h index 59a17bd12..e20180f2b 100644 --- a/components/esp_matter/esp_matter.h +++ b/components/esp_matter/esp_matter.h @@ -30,13 +30,11 @@ application. #include #include -#include -#include -#include - #include #include +using namespace chip::app::Clusters; + namespace esp_matter { /** Endpoint flags */ diff --git a/components/esp_matter/esp_matter_attribute.cpp b/components/esp_matter/esp_matter_attribute.cpp index e924ef184..579a88435 100644 --- a/components/esp_matter/esp_matter_attribute.cpp +++ b/components/esp_matter/esp_matter_attribute.cpp @@ -24,13 +24,13 @@ namespace attribute { attribute_t *create_cluster_revision(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_CLUSTER_REVISION_SERVER_ATTRIBUTE_ID, - ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); + return esp_matter::attribute::create(cluster, Globals::Attributes::ClusterRevision::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_uint16(value)); } attribute_t *create_feature_map(cluster_t *cluster, uint32_t value) { - return esp_matter::attribute::create(cluster, ZCL_FEATURE_MAP_SERVER_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Globals::Attributes::FeatureMap::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value)); } @@ -42,25 +42,25 @@ namespace attribute { attribute_t *create_device_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_DEVICE_LIST_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Descriptor::Attributes::DeviceList::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); } attribute_t *create_server_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_SERVER_LIST_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Descriptor::Attributes::ServerList::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); } attribute_t *create_client_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_CLIENT_LIST_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Descriptor::Attributes::ClientList::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); } attribute_t *create_parts_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_PARTS_LIST_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Descriptor::Attributes::PartsList::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); } @@ -72,13 +72,13 @@ namespace attribute { attribute_t *create_acl(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_ACL_ATTRIBUTE_ID, ATTRIBUTE_FLAG_WRITABLE, + return esp_matter::attribute::create(cluster, AccessControl::Attributes::Acl::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_array(value, length, count)); } attribute_t *create_extension(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_EXTENSION_ATTRIBUTE_ID, ATTRIBUTE_FLAG_WRITABLE, + return esp_matter::attribute::create(cluster, AccessControl::Attributes::Extension::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_array(value, length, count)); } @@ -90,68 +90,68 @@ namespace attribute { attribute_t *create_data_model_revision(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_DATA_MODEL_REVISION_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Basic::Attributes::DataModelRevision::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); } attribute_t *create_vendor_name(cluster_t *cluster, char *value, uint16_t length) { - return esp_matter::attribute::create(cluster, ZCL_VENDOR_NAME_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Basic::Attributes::VendorName::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length)); } attribute_t *create_vendor_id(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_VENDOR_ID_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Basic::Attributes::VendorID::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); } attribute_t *create_product_name(cluster_t *cluster, char *value, uint16_t length) { - return esp_matter::attribute::create(cluster, ZCL_PRODUCT_NAME_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Basic::Attributes::ProductName::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length)); } attribute_t *create_product_id(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_PRODUCT_ID_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Basic::Attributes::ProductID::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); } attribute_t *create_node_label(cluster_t *cluster, char *value, uint16_t length) { - return esp_matter::attribute::create(cluster, ZCL_NODE_LABEL_ATTRIBUTE_ID, ATTRIBUTE_FLAG_WRITABLE, + return esp_matter::attribute::create(cluster, Basic::Attributes::NodeLabel::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_char_str(value, length)); } attribute_t *create_location(cluster_t *cluster, char *value, uint16_t length) { - return esp_matter::attribute::create(cluster, ZCL_LOCATION_ATTRIBUTE_ID, ATTRIBUTE_FLAG_WRITABLE, + return esp_matter::attribute::create(cluster, Basic::Attributes::Location::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_char_str(value, length)); } attribute_t *create_hardware_version(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_HARDWARE_VERSION_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Basic::Attributes::HardwareVersion::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); } attribute_t *create_hardware_version_string(cluster_t *cluster, char *value, uint16_t length) { - return esp_matter::attribute::create(cluster, ZCL_HARDWARE_VERSION_STRING_ATTRIBUTE_ID, - ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length)); + return esp_matter::attribute::create(cluster, Basic::Attributes::HardwareVersionString::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_char_str(value, length)); } attribute_t *create_software_version(cluster_t *cluster, uint32_t value) { - return esp_matter::attribute::create(cluster, ZCL_SOFTWARE_VERSION_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Basic::Attributes::SoftwareVersion::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); } attribute_t *create_software_version_string(cluster_t *cluster, char *value, uint16_t length) { - return esp_matter::attribute::create(cluster, ZCL_SOFTWARE_VERSION_STRING_ATTRIBUTE_ID, - ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length)); + return esp_matter::attribute::create(cluster, Basic::Attributes::SoftwareVersionString::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_char_str(value, length)); } } /* attribute */ @@ -162,7 +162,7 @@ namespace attribute { attribute_t *create_binding(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_BINDING_LIST_ATTRIBUTE_ID, ATTRIBUTE_FLAG_WRITABLE, + return esp_matter::attribute::create(cluster, Binding::Attributes::Binding::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_array(value, length, count)); } @@ -174,25 +174,25 @@ namespace attribute { attribute_t *create_default_ota_providers(cluster_t *cluster, uint8_t *value, uint16_t length) { - return esp_matter::attribute::create(cluster, ZCL_DEFAULT_OTA_PROVIDERS_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, OtaSoftwareUpdateRequestor::Attributes::DefaultOtaProviders::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_octet_str(value, length)); } attribute_t *create_update_possible(cluster_t *cluster, bool value) { - return esp_matter::attribute::create(cluster, ZCL_UPDATE_POSSIBLE_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_bool(value)); + return esp_matter::attribute::create(cluster, OtaSoftwareUpdateRequestor::Attributes::UpdatePossible::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); } attribute_t *create_update_state(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_UPDATE_STATE_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_enum8(value)); + return esp_matter::attribute::create(cluster, OtaSoftwareUpdateRequestor::Attributes::UpdateState::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); } attribute_t *create_update_state_progress(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_UPDATE_STATE_PROGRESS_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, OtaSoftwareUpdateRequestor::Attributes::UpdateStateProgress::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } @@ -204,26 +204,26 @@ namespace attribute { attribute_t *create_breadcrumb(cluster_t *cluster, uint64_t value) { - return esp_matter::attribute::create(cluster, ZCL_BREADCRUMB_ATTRIBUTE_ID, ATTRIBUTE_FLAG_WRITABLE, - esp_matter_uint64(value)); + return esp_matter::attribute::create(cluster, GeneralCommissioning::Attributes::Breadcrumb::Id, + ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint64(value)); } attribute_t *create_basic_commissioning_info(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_BASICCOMMISSIONINGINFO_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, GeneralCommissioning::Attributes::BasicCommissioningInfo::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); } attribute_t *create_regulatory_config(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_REGULATORYCONFIG_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_enum8(value)); + return esp_matter::attribute::create(cluster, GeneralCommissioning::Attributes::RegulatoryConfig::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); } attribute_t *create_location_capability(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_LOCATIONCAPABILITY_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_enum8(value)); + return esp_matter::attribute::create(cluster, GeneralCommissioning::Attributes::LocationCapability::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); } } /* attribute */ @@ -234,49 +234,49 @@ namespace attribute { attribute_t *create_max_networks(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_MAX_NETWORKS_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_uint8(value)); + return esp_matter::attribute::create(cluster, NetworkCommissioning::Attributes::MaxNetworks::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } attribute_t *create_networks(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_NETWORKS_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, NetworkCommissioning::Attributes::Networks::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); } attribute_t *create_scan_max_time_seconds(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_SCAN_MAX_TIME_SECONDS_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, NetworkCommissioning::Attributes::ScanMaxTimeSeconds::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } attribute_t *create_connect_max_time_seconds(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_CONNECT_MAX_TIME_SECONDS_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, NetworkCommissioning::Attributes::ConnectMaxTimeSeconds::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } attribute_t *create_interface_enabled(cluster_t *cluster, bool value) { - return esp_matter::attribute::create(cluster, ZCL_INTERFACE_ENABLED_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, NetworkCommissioning::Attributes::InterfaceEnabled::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bool(value)); } attribute_t *create_last_networking_status(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_LAST_NETWORKING_STATUS_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, NetworkCommissioning::Attributes::LastNetworkingStatus::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); } attribute_t *create_last_network_id(cluster_t *cluster, uint8_t *value, uint16_t length) { - return esp_matter::attribute::create(cluster, ZCL_LAST_NETWORK_ID_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_octet_str(value, length)); + return esp_matter::attribute::create(cluster, NetworkCommissioning::Attributes::LastNetworkID::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_octet_str(value, length)); } attribute_t *create_last_connect_error_value(cluster_t *cluster, uint32_t value) { - return esp_matter::attribute::create(cluster, ZCL_LAST_CONNECT_ERROR_VALUE_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, NetworkCommissioning::Attributes::LastConnectErrorValue::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); } @@ -288,13 +288,13 @@ namespace attribute { attribute_t *create_network_interfaces(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_NETWORK_INTERFACES_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_array(value, length, count)); + return esp_matter::attribute::create(cluster, GeneralDiagnostics::Attributes::NetworkInterfaces::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); } attribute_t *create_reboot_count(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_REBOOT_COUNT_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, GeneralDiagnostics::Attributes::RebootCount::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); } @@ -306,20 +306,20 @@ namespace attribute { attribute_t *create_window_status(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_WINDOW_STATUS_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_uint8(value)); + return esp_matter::attribute::create(cluster, AdministratorCommissioning::Attributes::WindowStatus::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } attribute_t *create_admin_fabric_index(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_ADMIN_FABRIC_INDEX_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_uint16(value)); + return esp_matter::attribute::create(cluster, AdministratorCommissioning::Attributes::AdminFabricIndex::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); } attribute_t *create_admin_vendor_id(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_ADMIN_VENDOR_ID_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_uint16(value)); + return esp_matter::attribute::create(cluster, AdministratorCommissioning::Attributes::AdminVendorId::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); } } /* attribute */ @@ -330,38 +330,38 @@ namespace attribute { attribute_t *create_nocs(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_NOCS_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, OperationalCredentials::Attributes::NOCs::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); } attribute_t *create_fabrics(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_FABRICS_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, OperationalCredentials::Attributes::Fabrics::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); } attribute_t *create_supported_fabrics(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_SUPPORTED_FABRICS_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_uint8(value)); + return esp_matter::attribute::create(cluster, OperationalCredentials::Attributes::SupportedFabrics::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } attribute_t *create_commissioned_fabrics(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_COMMISSIONED_FABRICS_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_uint8(value)); + return esp_matter::attribute::create(cluster, OperationalCredentials::Attributes::CommissionedFabrics::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } attribute_t *create_trusted_root_certificates(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_TRUSTED_ROOTS_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_array(value, length, count)); + return esp_matter::attribute::create(cluster, OperationalCredentials::Attributes::TrustedRootCertificates::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); } attribute_t *create_current_fabric_index(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_CURRENT_FABRIC_INDEX_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_uint8(value)); + return esp_matter::attribute::create(cluster, OperationalCredentials::Attributes::CurrentFabricIndex::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } } /* attribute */ @@ -372,25 +372,25 @@ namespace attribute { attribute_t *create_group_key_map(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_GROUP_KEY_MAP_ATTRIBUTE_ID, ATTRIBUTE_FLAG_WRITABLE, - esp_matter_array(value, length, count)); + return esp_matter::attribute::create(cluster, GroupKeyManagement::Attributes::GroupKeyMap::Id, + ATTRIBUTE_FLAG_WRITABLE, esp_matter_array(value, length, count)); } attribute_t *create_group_table(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_GROUP_TABLE_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, GroupKeyManagement::Attributes::GroupTable::Id, ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count)); } attribute_t *create_max_groups_per_fabric(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_MAX_GROUPS_PER_FABRIC_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, GroupKeyManagement::Attributes::MaxGroupsPerFabric::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); } attribute_t *create_max_group_keys_per_fabric(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_MAX_GROUP_KEYS_PER_FABRIC_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, GroupKeyManagement::Attributes::MaxGroupKeysPerFabric::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); } @@ -402,9 +402,8 @@ namespace attribute { attribute_t *create_identify_time(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max) { - attribute_t *attribute = esp_matter::attribute::create(cluster, ZCL_IDENTIFY_TIME_ATTRIBUTE_ID, - ATTRIBUTE_FLAG_WRITABLE, - esp_matter_uint16(value)); + attribute_t *attribute = esp_matter::attribute::create(cluster, Identify::Attributes::IdentifyTime::Id, + ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value)); if (!attribute) { ESP_LOGE(TAG, "Could not create attribute"); return NULL; @@ -415,7 +414,7 @@ attribute_t *create_identify_time(cluster_t *cluster, uint16_t value, uint16_t m attribute_t *create_identify_type(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_IDENTIFY_TYPE_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Identify::Attributes::IdentifyType::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } @@ -427,7 +426,7 @@ namespace attribute { attribute_t *create_group_name_support(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_GROUP_NAME_SUPPORT_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Groups::Attributes::NameSupport::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value)); } @@ -439,31 +438,31 @@ namespace attribute { attribute_t *create_scene_count(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_SCENE_COUNT_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Scenes::Attributes::SceneCount::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } attribute_t *create_current_scene(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_CURRENT_SCENE_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Scenes::Attributes::CurrentScene::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } attribute_t *create_current_group(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_CURRENT_GROUP_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Scenes::Attributes::CurrentGroup::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); } attribute_t *create_scene_valid(cluster_t *cluster, bool value) { - return esp_matter::attribute::create(cluster, ZCL_SCENE_VALID_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Scenes::Attributes::SceneValid::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); } attribute_t *create_scene_name_support(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_SCENE_NAME_SUPPORT_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Scenes::Attributes::NameSupport::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap8(value)); } @@ -475,31 +474,31 @@ namespace attribute { attribute_t *create_on_off(cluster_t *cluster, bool value) { - return esp_matter::attribute::create(cluster, ZCL_ON_OFF_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, OnOff::Attributes::OnOff::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); } attribute_t *create_global_scene_control(cluster_t *cluster, bool value) { - return esp_matter::attribute::create(cluster, ZCL_GLOBAL_SCENE_CONTROL_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, OnOff::Attributes::GlobalSceneControl::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); } attribute_t *create_on_time(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_ON_TIME_ATTRIBUTE_ID, ATTRIBUTE_FLAG_WRITABLE, + return esp_matter::attribute::create(cluster, OnOff::Attributes::OnTime::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value)); } attribute_t *create_off_wait_time(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_OFF_WAIT_TIME_ATTRIBUTE_ID, ATTRIBUTE_FLAG_WRITABLE, + return esp_matter::attribute::create(cluster, OnOff::Attributes::OffWaitTime::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value)); } attribute_t *create_start_up_on_off(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_START_UP_ON_OFF_ATTRIBUTE_ID, ATTRIBUTE_FLAG_WRITABLE, + return esp_matter::attribute::create(cluster, OnOff::Attributes::StartUpOnOff::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); } @@ -511,21 +510,20 @@ namespace attribute { attribute_t *create_current_level(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_CURRENT_LEVEL_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, LevelControl::Attributes::CurrentLevel::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } attribute_t *create_on_level(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_ON_LEVEL_ATTRIBUTE_ID, ATTRIBUTE_FLAG_WRITABLE, + return esp_matter::attribute::create(cluster, LevelControl::Attributes::OnLevel::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value)); } attribute_t *create_options(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max) { - attribute_t *attribute = esp_matter::attribute::create(cluster, ZCL_OPTIONS_ATTRIBUTE_ID, - ATTRIBUTE_FLAG_WRITABLE, - esp_matter_bitmap8(value)); + attribute_t *attribute = esp_matter::attribute::create(cluster, LevelControl::Attributes::Options::Id, + ATTRIBUTE_FLAG_WRITABLE, esp_matter_bitmap8(value)); if (!attribute) { ESP_LOGE(TAG, "Could not create attribute"); return NULL; @@ -536,25 +534,25 @@ attribute_t *create_options(cluster_t *cluster, uint8_t value, uint8_t min, uint attribute_t *create_remaining_time(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_REMAINING_TIME_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, LevelControl::Attributes::RemainingTime::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); } attribute_t *create_min_level(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_MINIMUM_LEVEL_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, LevelControl::Attributes::MinLevel::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } attribute_t *create_max_level(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_MAXIMUM_LEVEL_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, LevelControl::Attributes::MaxLevel::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } attribute_t *create_start_up_current_level(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_START_UP_CURRENT_LEVEL_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, LevelControl::Attributes::StartUpCurrentLevel::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value)); } @@ -566,38 +564,38 @@ namespace attribute { attribute_t *create_current_hue(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID, - ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + return esp_matter::attribute::create(cluster, ColorControl::Attributes::CurrentHue::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_uint8(value)); } attribute_t *create_current_saturation(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID, - ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); + return esp_matter::attribute::create(cluster, ColorControl::Attributes::CurrentSaturation::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_uint8(value)); } attribute_t *create_color_mode(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_COLOR_CONTROL_COLOR_MODE_ATTRIBUTE_ID, - ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorMode::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_enum8(value)); } attribute_t *create_color_control_options(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_COLOR_CONTROL_OPTIONS_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorControlOptions::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bitmap8(value)); } attribute_t *create_enhanced_color_mode(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_COLOR_CONTROL_ENHANCED_COLOR_MODE_ATTRIBUTE_ID, - ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + return esp_matter::attribute::create(cluster, ColorControl::Attributes::EnhancedColorMode::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_enum8(value)); } attribute_t *create_color_capabilities(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_COLOR_CONTROL_COLOR_CAPABILITIES_ATTRIBUTE_ID, - ATTRIBUTE_FLAG_NONE, esp_matter_bitmap16(value)); + return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorCapabilities::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_bitmap16(value)); } } /* attribute */ @@ -608,14 +606,14 @@ namespace attribute { attribute_t *create_fan_mode(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_FAN_CONTROL_FAN_MODE_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, FanControl::Attributes::FanMode::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); } attribute_t *create_fan_mode_sequence(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_FAN_CONTROL_FAN_MODE_SEQUENCE_ATTRIBUTE_ID, - ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + return esp_matter::attribute::create(cluster, FanControl::Attributes::FanModeSequence::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_enum8(value)); } } /* attribute */ @@ -626,27 +624,27 @@ namespace attribute { attribute_t *create_local_temperature(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_LOCAL_TEMPERATURE_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Thermostat::Attributes::LocalTemperature::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); } attribute_t *create_occupied_cooling_setpoint(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_OCCUPIED_COOLING_SETPOINT_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, Thermostat::Attributes::OccupiedCoolingSetpoint::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value)); } attribute_t *create_occupied_heating_setpoint(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_OCCUPIED_HEATING_SETPOINT_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, Thermostat::Attributes::OccupiedHeatingSetpoint::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value)); } attribute_t *create_control_sequence_of_operation(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max) { - attribute_t *attribute = esp_matter::attribute::create(cluster, ZCL_CONTROL_SEQUENCE_OF_OPERATION_ATTRIBUTE_ID, - ATTRIBUTE_FLAG_WRITABLE, - esp_matter_enum8(value)); + attribute_t *attribute = esp_matter::attribute::create(cluster, + Thermostat::Attributes::ControlSequenceOfOperation::Id, + ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); if (!attribute) { ESP_LOGE(TAG, "Could not create attribute"); return NULL; @@ -657,9 +655,8 @@ attribute_t *create_control_sequence_of_operation(cluster_t *cluster, uint8_t va attribute_t *create_system_mode(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max) { - attribute_t *attribute = esp_matter::attribute::create(cluster, ZCL_SYSTEM_MODE_ATTRIBUTE_ID, - ATTRIBUTE_FLAG_WRITABLE, - esp_matter_enum8(value)); + attribute_t *attribute = esp_matter::attribute::create(cluster, Thermostat::Attributes::SystemMode::Id, + ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); if (!attribute) { ESP_LOGE(TAG, "Could not create attribute"); return NULL; @@ -676,31 +673,31 @@ namespace attribute { attribute_t *create_lock_state(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_LOCK_STATE_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, DoorLock::Attributes::LockState::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); } attribute_t *create_lock_type(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_LOCK_TYPE_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, DoorLock::Attributes::LockType::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); } attribute_t *create_actuator_enabled(cluster_t *cluster, bool value) { - return esp_matter::attribute::create(cluster, ZCL_ACTUATOR_ENABLED_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, DoorLock::Attributes::ActuatorEnabled::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); } attribute_t *create_auto_relock_time(cluster_t *cluster, uint32_t value) { - return esp_matter::attribute::create(cluster, ZCL_AUTO_RELOCK_TIME_ATTRIBUTE_ID, ATTRIBUTE_FLAG_WRITABLE, + return esp_matter::attribute::create(cluster, DoorLock::Attributes::AutoRelockTime::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_bitmap32(value)); } attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max) { - attribute_t *attribute = esp_matter::attribute::create(cluster, ZCL_OPERATING_MODE_ATTRIBUTE_ID, + attribute_t *attribute = esp_matter::attribute::create(cluster, DoorLock::Attributes::OperatingMode::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); if (!attribute) { ESP_LOGE(TAG, "Could not create attribute"); @@ -712,7 +709,7 @@ attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value, uint8_t mi attribute_t *create_supported_operating_modes(cluster_t *cluster, uint16_t value) { - return esp_matter::attribute::create(cluster, ZCL_SUPPORTED_OPERATING_MODES_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, DoorLock::Attributes::SupportedOperatingModes::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap16(value)); } @@ -724,13 +721,13 @@ namespace attribute { attribute_t *create_bridged_device_basic_node_label(cluster_t *cluster, char *value, uint16_t length) { - return esp_matter::attribute::create(cluster, ZCL_NODE_LABEL_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, BridgedDeviceBasic::Attributes::NodeLabel::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length)); } attribute_t *create_reachable(cluster_t *cluster, bool value) { - return esp_matter::attribute::create(cluster, ZCL_REACHABLE_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, BridgedDeviceBasic::Attributes::Reachable::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); } @@ -742,7 +739,7 @@ namespace attribute { attribute_t *create_label_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) { - return esp_matter::attribute::create(cluster, ZCL_LABEL_LIST_ATTRIBUTE_ID, ATTRIBUTE_FLAG_WRITABLE, + return esp_matter::attribute::create(cluster, FixedLabel::Attributes::LabelList::Id, ATTRIBUTE_FLAG_WRITABLE, esp_matter_array(value, length, count)); } @@ -754,19 +751,19 @@ namespace attribute { attribute_t *create_number_of_positions(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_NUMBER_OF_POSITIONS_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Switch::Attributes::NumberOfPositions::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } attribute_t *create_current_position(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_CURRENT_POSITION_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Switch::Attributes::CurrentPosition::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } attribute_t *create_multi_press_max(cluster_t *cluster, uint8_t value) { - return esp_matter::attribute::create(cluster, ZCL_MULTI_PRESS_MAX_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + return esp_matter::attribute::create(cluster, Switch::Attributes::MultiPressMax::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); } @@ -778,19 +775,19 @@ namespace attribute { attribute_t *create_temperature_measured_value(cluster_t *cluster, int16_t value) { - return esp_matter::attribute::create(cluster, ZCL_TEMP_MEASURED_VALUE_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_int16(value)); + return esp_matter::attribute::create(cluster, TemperatureMeasurement::Attributes::MeasuredValue::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_int16(value)); } attribute_t *create_temperature_min_measured_value(cluster_t *cluster, int16_t value) { - return esp_matter::attribute::create(cluster, ZCL_TEMP_MIN_MEASURED_VALUE_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, TemperatureMeasurement::Attributes::MinMeasuredValue::Id, ATTRIBUTE_FLAG_NONE, esp_matter_int16(value)); } attribute_t *create_temperature_max_measured_value(cluster_t *cluster, int16_t value) { - return esp_matter::attribute::create(cluster, ZCL_TEMP_MAX_MEASURED_VALUE_ATTRIBUTE_ID, + return esp_matter::attribute::create(cluster, TemperatureMeasurement::Attributes::MaxMeasuredValue::Id, ATTRIBUTE_FLAG_NONE, esp_matter_int16(value)); } diff --git a/components/esp_matter/esp_matter_client.cpp b/components/esp_matter/esp_matter_client.cpp index 9f5606212..b4d9d57c8 100644 --- a/components/esp_matter/esp_matter_client.cpp +++ b/components/esp_matter/esp_matter_client.cpp @@ -142,7 +142,7 @@ namespace command { esp_err_t send_on(peer_device_t *remote_device, int remote_endpoint_id) { chip::Controller::OnOffCluster cluster; - chip::app::Clusters::OnOff::Commands::On::Type command_data; + OnOff::Commands::On::Type command_data; cluster.Associate(remote_device, remote_endpoint_id); cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback); @@ -152,7 +152,7 @@ esp_err_t send_on(peer_device_t *remote_device, int remote_endpoint_id) esp_err_t send_off(peer_device_t *remote_device, int remote_endpoint_id) { chip::Controller::OnOffCluster cluster; - chip::app::Clusters::OnOff::Commands::Off::Type command_data; + OnOff::Commands::Off::Type command_data; cluster.Associate(remote_device, remote_endpoint_id); cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback); @@ -162,7 +162,7 @@ esp_err_t send_off(peer_device_t *remote_device, int remote_endpoint_id) esp_err_t send_toggle(peer_device_t *remote_device, int remote_endpoint_id) { chip::Controller::OnOffCluster cluster; - chip::app::Clusters::OnOff::Commands::Toggle::Type command_data; + OnOff::Commands::Toggle::Type command_data; cluster.Associate(remote_device, remote_endpoint_id); cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback); @@ -179,8 +179,8 @@ esp_err_t send_move(peer_device_t *remote_device, int remote_endpoint_id, uint8_ uint8_t option_mask, uint8_t option_override) { chip::Controller::LevelControlCluster cluster; - chip::app::Clusters::LevelControl::Commands::Move::Type command_data; - command_data.moveMode = (chip::app::Clusters::LevelControl::MoveMode)move_mode; + LevelControl::Commands::Move::Type command_data; + command_data.moveMode = (LevelControl::MoveMode)move_mode; command_data.rate = rate; command_data.optionMask = option_mask; command_data.optionOverride = option_override; @@ -194,7 +194,7 @@ esp_err_t send_move_to_level(peer_device_t *remote_device, int remote_endpoint_i uint16_t transition_time, uint8_t option_mask, uint8_t option_override) { chip::Controller::LevelControlCluster cluster; - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type command_data; + LevelControl::Commands::MoveToLevel::Type command_data; command_data.level = level; command_data.transitionTime = transition_time; command_data.optionMask = option_mask; @@ -209,7 +209,7 @@ esp_err_t send_move_to_level_with_on_off(peer_device_t *remote_device, int remot uint16_t transition_time) { chip::Controller::LevelControlCluster cluster; - chip::app::Clusters::LevelControl::Commands::MoveToLevelWithOnOff::Type command_data; + LevelControl::Commands::MoveToLevelWithOnOff::Type command_data; command_data.level = level; command_data.transitionTime = transition_time; @@ -221,8 +221,8 @@ esp_err_t send_move_to_level_with_on_off(peer_device_t *remote_device, int remot esp_err_t send_move_with_on_off(peer_device_t *remote_device, int remote_endpoint_id, uint8_t move_mode, uint8_t rate) { chip::Controller::LevelControlCluster cluster; - chip::app::Clusters::LevelControl::Commands::MoveWithOnOff::Type command_data; - command_data.moveMode = (chip::app::Clusters::LevelControl::MoveMode)move_mode; + LevelControl::Commands::MoveWithOnOff::Type command_data; + command_data.moveMode = (LevelControl::MoveMode)move_mode; command_data.rate = rate; cluster.Associate(remote_device, remote_endpoint_id); @@ -234,8 +234,8 @@ esp_err_t send_step(peer_device_t *remote_device, int remote_endpoint_id, uint8_ uint16_t transition_time, uint8_t option_mask, uint8_t option_override) { chip::Controller::LevelControlCluster cluster; - chip::app::Clusters::LevelControl::Commands::Step::Type command_data; - command_data.stepMode = (chip::app::Clusters::LevelControl::StepMode)step_mode; + LevelControl::Commands::Step::Type command_data; + command_data.stepMode = (LevelControl::StepMode)step_mode; command_data.stepSize = step_size; command_data.transitionTime = transition_time; command_data.optionMask = option_mask; @@ -250,8 +250,8 @@ esp_err_t send_step_with_on_off(peer_device_t *remote_device, int remote_endpoin uint8_t step_size, uint16_t transition_time) { chip::Controller::LevelControlCluster cluster; - chip::app::Clusters::LevelControl::Commands::StepWithOnOff::Type command_data; - command_data.stepMode = (chip::app::Clusters::LevelControl::StepMode)step_mode; + LevelControl::Commands::StepWithOnOff::Type command_data; + command_data.stepMode = (LevelControl::StepMode)step_mode; command_data.stepSize = step_size; command_data.transitionTime = transition_time; @@ -263,7 +263,7 @@ esp_err_t send_step_with_on_off(peer_device_t *remote_device, int remote_endpoin esp_err_t send_stop(peer_device_t *remote_device, int remote_endpoint_id, uint8_t option_mask, uint8_t option_override) { chip::Controller::LevelControlCluster cluster; - chip::app::Clusters::LevelControl::Commands::Stop::Type command_data; + LevelControl::Commands::Stop::Type command_data; command_data.optionMask = option_mask; command_data.optionOverride = option_override; @@ -275,7 +275,7 @@ esp_err_t send_stop(peer_device_t *remote_device, int remote_endpoint_id, uint8_ esp_err_t send_stop_with_on_off(peer_device_t *remote_device, int remote_endpoint_id) { chip::Controller::LevelControlCluster cluster; - chip::app::Clusters::LevelControl::Commands::Stop::Type command_data; + LevelControl::Commands::Stop::Type command_data; cluster.Associate(remote_device, remote_endpoint_id); cluster.InvokeCommand(command_data, NULL, send_command_success_callback, send_command_failure_callback); @@ -292,8 +292,8 @@ esp_err_t send_move_hue(peer_device_t *remote_device, int remote_endpoint_id, ui uint8_t option_mask, uint8_t option_override) { chip::Controller::ColorControlCluster cluster; - chip::app::Clusters::ColorControl::Commands::MoveHue::Type command_data; - command_data.moveMode = (chip::app::Clusters::ColorControl::HueMoveMode)move_mode; + ColorControl::Commands::MoveHue::Type command_data; + command_data.moveMode = (ColorControl::HueMoveMode)move_mode; command_data.rate = rate; command_data.optionsMask = option_mask; command_data.optionsOverride = option_override; @@ -307,8 +307,8 @@ esp_err_t send_move_saturation(peer_device_t *remote_device, int remote_endpoint uint8_t option_mask, uint8_t option_override) { chip::Controller::ColorControlCluster cluster; - chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type command_data; - command_data.moveMode = (chip::app::Clusters::ColorControl::SaturationMoveMode)move_mode; + ColorControl::Commands::MoveSaturation::Type command_data; + command_data.moveMode = (ColorControl::SaturationMoveMode)move_mode; command_data.rate = rate; command_data.optionsMask = option_mask; command_data.optionsOverride = option_override; @@ -322,9 +322,9 @@ esp_err_t send_move_to_hue(peer_device_t *remote_device, int remote_endpoint_id, uint16_t transition_time, uint8_t option_mask, uint8_t option_override) { chip::Controller::ColorControlCluster cluster; - chip::app::Clusters::ColorControl::Commands::MoveToHue::Type command_data; + ColorControl::Commands::MoveToHue::Type command_data; command_data.hue = hue; - command_data.direction = (chip::app::Clusters::ColorControl::HueDirection)direction; + command_data.direction = (ColorControl::HueDirection)direction; command_data.transitionTime = transition_time; command_data.optionsMask = option_mask; command_data.optionsOverride = option_override; @@ -339,7 +339,7 @@ esp_err_t send_move_to_hue_and_saturation(peer_device_t *remote_device, int remo uint8_t option_override) { chip::Controller::ColorControlCluster cluster; - chip::app::Clusters::ColorControl::Commands::MoveToHueAndSaturation::Type command_data; + ColorControl::Commands::MoveToHueAndSaturation::Type command_data; command_data.hue = hue; command_data.saturation = saturation; command_data.transitionTime = transition_time; @@ -355,7 +355,7 @@ esp_err_t send_move_to_saturation(peer_device_t *remote_device, int remote_endpo uint16_t transition_time, uint8_t option_mask, uint8_t option_override) { chip::Controller::ColorControlCluster cluster; - chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type command_data; + ColorControl::Commands::MoveToSaturation::Type command_data; command_data.saturation = saturation; command_data.transitionTime = transition_time; command_data.optionsMask = option_mask; @@ -370,8 +370,8 @@ esp_err_t send_step_hue(peer_device_t *remote_device, int remote_endpoint_id, ui uint16_t transition_time, uint8_t option_mask, uint8_t option_override) { chip::Controller::ColorControlCluster cluster; - chip::app::Clusters::ColorControl::Commands::StepHue::Type command_data; - command_data.stepMode = (chip::app::Clusters::ColorControl::HueStepMode)step_mode; + ColorControl::Commands::StepHue::Type command_data; + command_data.stepMode = (ColorControl::HueStepMode)step_mode; command_data.stepSize = step_size; command_data.transitionTime = transition_time; command_data.optionsMask = option_mask; @@ -387,8 +387,8 @@ esp_err_t send_step_saturation(peer_device_t *remote_device, int remote_endpoint uint8_t option_override) { chip::Controller::ColorControlCluster cluster; - chip::app::Clusters::ColorControl::Commands::StepSaturation::Type command_data; - command_data.stepMode = (chip::app::Clusters::ColorControl::SaturationStepMode)step_mode; + ColorControl::Commands::StepSaturation::Type command_data; + command_data.stepMode = (ColorControl::SaturationStepMode)step_mode; command_data.stepSize = step_size; command_data.transitionTime = transition_time; command_data.optionsMask = option_mask; diff --git a/components/esp_matter/esp_matter_cluster.cpp b/components/esp_matter/esp_matter_cluster.cpp index 89c6fdf25..26e8a270b 100644 --- a/components/esp_matter/esp_matter_cluster.cpp +++ b/components/esp_matter/esp_matter_cluster.cpp @@ -19,11 +19,8 @@ #include #include -#include #include #include -#include -#include static const char *TAG = "esp_matter_cluster"; @@ -60,7 +57,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_DESCRIPTOR_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, Descriptor::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -91,7 +88,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_ACCESS_CONTROL_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, AccessControl::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -120,7 +117,7 @@ const int function_flags = CLUSTER_FLAG_INIT_FUNCTION; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_BASIC_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, Basic::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -160,7 +157,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_BINDING_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, Binding::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -193,7 +190,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_OTA_PROVIDER_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, OtaSoftwareUpdateProvider::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -227,7 +224,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_OTA_REQUESTOR_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, OtaSoftwareUpdateRequestor::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -263,7 +260,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_GENERAL_COMMISSIONING_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, GeneralCommissioning::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -304,7 +301,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_NETWORK_COMMISSIONING_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, NetworkCommissioning::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -353,7 +350,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_GENERAL_DIAGNOSTICS_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, GeneralDiagnostics::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -384,7 +381,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_ADMINISTRATOR_COMMISSIONING_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, AdministratorCommissioning::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -421,7 +418,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, OperationalCredentials::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -471,7 +468,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_GROUP_KEY_MANAGEMENT_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, GroupKeyManagement::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -513,7 +510,7 @@ const int function_flags = CLUSTER_FLAG_INIT_FUNCTION | CLUSTER_FLAG_ATTRIBUTE_C cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_IDENTIFY_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, Identify::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -549,7 +546,7 @@ const int function_flags = CLUSTER_FLAG_INIT_FUNCTION; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_GROUPS_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, Groups::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -591,7 +588,7 @@ const int function_flags = CLUSTER_FLAG_INIT_FUNCTION; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_SCENES_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, Scenes::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -640,7 +637,7 @@ const int function_flags = CLUSTER_FLAG_INIT_FUNCTION; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features) { - cluster_t *cluster = cluster::create(endpoint, ZCL_ON_OFF_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, OnOff::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -680,7 +677,7 @@ const int function_flags = CLUSTER_FLAG_INIT_FUNCTION; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features) { - cluster_t *cluster = cluster::create(endpoint, ZCL_LEVEL_CONTROL_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, LevelControl::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -730,7 +727,7 @@ const int function_flags = CLUSTER_FLAG_INIT_FUNCTION; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features) { - cluster_t *cluster = cluster::create(endpoint, ZCL_COLOR_CONTROL_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, ColorControl::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -766,7 +763,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_FAN_CONTROL_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, FanControl::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -803,7 +800,7 @@ const int function_flags = CLUSTER_FLAG_INIT_FUNCTION; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_THERMOSTAT_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, Thermostat::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -837,12 +834,11 @@ const function_generic_t function_list[] = { (function_generic_t)MatterDoorLockClusterServerAttributeChangedCallback, (function_generic_t)MatterDoorLockClusterServerPreAttributeChangedCallback, }; -const int function_flags = CLUSTER_FLAG_ATTRIBUTE_CHANGED_FUNCTION | - CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION; +const int function_flags = CLUSTER_FLAG_ATTRIBUTE_CHANGED_FUNCTION | CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_DOOR_LOCK_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, DoorLock::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -879,7 +875,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_TIME_SYNCHRONIZATION_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, TimeSynchronization::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -906,7 +902,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_BRIDGED_DEVICE_BASIC_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, BridgedDeviceBasic::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -932,7 +928,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_FIXED_LABEL_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, FixedLabel::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -962,7 +958,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_SWITCH_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, Switch::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; @@ -992,7 +988,7 @@ const int function_flags = CLUSTER_FLAG_NONE; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = cluster::create(endpoint, ZCL_TEMP_MEASUREMENT_CLUSTER_ID, flags); + cluster_t *cluster = cluster::create(endpoint, TemperatureMeasurement::Id, flags); if (!cluster) { ESP_LOGE(TAG, "Could not create cluster"); return NULL; diff --git a/components/esp_matter/esp_matter_command.cpp b/components/esp_matter/esp_matter_command.cpp index e1f0570bc..5e2fe7035 100644 --- a/components/esp_matter/esp_matter_command.cpp +++ b/components/esp_matter/esp_matter_command.cpp @@ -871,38 +871,38 @@ namespace command { command_t *create_key_set_write(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_KEY_SET_WRITE_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_key_set_write); + return esp_matter::command::create(cluster, GroupKeyManagement::Commands::KeySetWrite::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_key_set_write); } command_t *create_key_set_read(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_KEY_SET_READ_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_key_set_read); + return esp_matter::command::create(cluster, GroupKeyManagement::Commands::KeySetRead::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_key_set_read); } command_t *create_key_set_remove(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_KEY_SET_REMOVE_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_key_set_remove); + return esp_matter::command::create(cluster, GroupKeyManagement::Commands::KeySetRemove::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_key_set_remove); } command_t *create_key_set_read_all_indices(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_KEY_SET_READ_ALL_INDICES_COMMAND_ID, + return esp_matter::command::create(cluster, GroupKeyManagement::Commands::KeySetReadAllIndices::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_key_set_read_all_indices); } command_t *create_key_set_read_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_KEY_SET_READ_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, GroupKeyManagement::Commands::KeySetReadResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } command_t *create_key_set_read_all_indices_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_KEY_SET_READ_ALL_INDICES_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } @@ -914,39 +914,39 @@ namespace command { command_t *create_arm_fail_safe(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ARM_FAIL_SAFE_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_arm_fail_safe); + return esp_matter::command::create(cluster, GeneralCommissioning::Commands::ArmFailSafe::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_arm_fail_safe); } command_t *create_set_regulatory_config(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_SET_REGULATORY_CONFIG_COMMAND_ID, + return esp_matter::command::create(cluster, GeneralCommissioning::Commands::SetRegulatoryConfig::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_set_regulatory_config); } command_t *create_commissioning_complete(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_COMMISSIONING_COMPLETE_COMMAND_ID, + return esp_matter::command::create(cluster, GeneralCommissioning::Commands::CommissioningComplete::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_commissioning_complete); } command_t *create_arm_fail_safe_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ARM_FAIL_SAFE_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, GeneralCommissioning::Commands::ArmFailSafeResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } command_t *create_set_regulatory_config_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_SET_REGULATORY_CONFIG_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, GeneralCommissioning::Commands::SetRegulatoryConfigResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } command_t *create_commissioning_complete_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_COMMISSIONING_COMPLETE_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, GeneralCommissioning::Commands::CommissioningCompleteResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } @@ -958,59 +958,57 @@ namespace command { command_t *create_scan_networks(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_SCAN_NETWORKS_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_scan_networks); + return esp_matter::command::create(cluster, NetworkCommissioning::Commands::ScanNetworks::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_scan_networks); } command_t *create_add_or_update_wifi_network(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ADD_OR_UPDATE_WI_FI_NETWORK_COMMAND_ID, + return esp_matter::command::create(cluster, NetworkCommissioning::Commands::AddOrUpdateWiFiNetwork::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_add_or_update_wifi_network); } command_t *create_add_or_update_thread_network(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ADD_OR_UPDATE_THREAD_NETWORK_COMMAND_ID, + return esp_matter::command::create(cluster, NetworkCommissioning::Commands::AddOrUpdateThreadNetwork::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_add_or_update_thread_network); } command_t *create_remove_network(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_REMOVE_NETWORK_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_remove_network); + return esp_matter::command::create(cluster, NetworkCommissioning::Commands::RemoveNetwork::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_remove_network); } command_t *create_connect_network(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_CONNECT_NETWORK_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_connect_network); + return esp_matter::command::create(cluster, NetworkCommissioning::Commands::ConnectNetwork::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_connect_network); } command_t *create_reorder_network(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_REORDER_NETWORK_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_reorder_network); + return esp_matter::command::create(cluster, NetworkCommissioning::Commands::ReorderNetwork::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_reorder_network); } command_t *create_scan_networks_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_SCAN_NETWORKS_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, NetworkCommissioning::Commands::ScanNetworksResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } command_t *create_network_config_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_NETWORK_CONFIG_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, NetworkCommissioning::Commands::NetworkConfigResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } command_t *create_connect_network_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_CONNECT_NETWORK_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, NetworkCommissioning::Commands::ConnectNetworkResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } @@ -1022,23 +1020,22 @@ namespace command { command_t *create_open_commissioning_window(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_OPEN_COMMISSIONING_WINDOW_COMMAND_ID, + return esp_matter::command::create(cluster, AdministratorCommissioning::Commands::OpenCommissioningWindow::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_open_commissioning_window); } command_t *create_open_basic_commissioning_window(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_OPEN_BASIC_COMMISSIONING_WINDOW_COMMAND_ID, + return esp_matter::command::create(cluster, AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_open_basic_commissioning_window); } command_t *create_revoke_commissioning(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_REVOKE_COMMISSIONING_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_revoke_commissioning); + return esp_matter::command::create(cluster, AdministratorCommissioning::Commands::RevokeCommissioning::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_revoke_commissioning); } } /* command */ @@ -1049,85 +1046,83 @@ namespace command { command_t *create_attestation_request(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ATTESTATION_REQUEST_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_attestation_request); + return esp_matter::command::create(cluster, OperationalCredentials::Commands::AttestationRequest::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_attestation_request); } command_t *create_certificate_chain_request(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_CERTIFICATE_CHAIN_REQUEST_COMMAND_ID, + return esp_matter::command::create(cluster, OperationalCredentials::Commands::CertificateChainRequest::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_certificate_chain_request); } command_t *create_csr_request(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_CSR_REQUEST_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_csr_request); + return esp_matter::command::create(cluster, OperationalCredentials::Commands::CSRRequest::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_csr_request); } command_t *create_add_noc(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ADD_NOC_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_add_noc); + return esp_matter::command::create(cluster, OperationalCredentials::Commands::AddNOC::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_add_noc); } command_t *create_update_noc(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_UPDATE_NOC_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_update_noc); + return esp_matter::command::create(cluster, OperationalCredentials::Commands::UpdateNOC::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_update_noc); } command_t *create_update_fabric_label(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_UPDATE_FABRIC_LABEL_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_update_fabric_label); + return esp_matter::command::create(cluster, OperationalCredentials::Commands::UpdateFabricLabel::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_update_fabric_label); } command_t *create_remove_fabric(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_REMOVE_FABRIC_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_remove_fabric); + return esp_matter::command::create(cluster, OperationalCredentials::Commands::RemoveFabric::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_remove_fabric); } command_t *create_add_trusted_root_certificate(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ADD_TRUSTED_ROOT_CERTIFICATE_COMMAND_ID, + return esp_matter::command::create(cluster, OperationalCredentials::Commands::AddTrustedRootCertificate::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_add_trusted_root_certificate); } command_t *create_remove_trusted_root_certificate(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_REMOVE_TRUSTED_ROOT_CERTIFICATE_COMMAND_ID, + return esp_matter::command::create(cluster, OperationalCredentials::Commands::RemoveTrustedRootCertificate::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_remove_trusted_root_certificate); } command_t *create_attestation_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ATTESTATION_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, OperationalCredentials::Commands::AttestationResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } command_t *create_certificate_chain_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_CERTIFICATE_CHAIN_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, OperationalCredentials::Commands::CertificateChainResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } command_t *create_csr_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_CSR_RESPONSE_COMMAND_ID, COMMAND_FLAG_SERVER_GENERATED, - NULL); + return esp_matter::command::create(cluster, OperationalCredentials::Commands::CSRResponse::Id, + COMMAND_FLAG_SERVER_GENERATED, NULL); } command_t *create_noc_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_NOC_RESPONSE_COMMAND_ID, COMMAND_FLAG_SERVER_GENERATED, - NULL); + return esp_matter::command::create(cluster, OperationalCredentials::Commands::NOCResponse::Id, + COMMAND_FLAG_SERVER_GENERATED, NULL); } } /* command */ @@ -1138,33 +1133,32 @@ namespace command { command_t *create_query_image(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_QUERY_IMAGE_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_query_image); + return esp_matter::command::create(cluster, OtaSoftwareUpdateProvider::Commands::QueryImage::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_query_image); } command_t *create_apply_update_request(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_APPLY_UPDATE_REQUEST_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_apply_update_request); + return esp_matter::command::create(cluster, OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_apply_update_request); } command_t *create_notify_update_applied(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_NOTIFY_UPDATE_APPLIED_COMMAND_ID, + return esp_matter::command::create(cluster, OtaSoftwareUpdateProvider::Commands::NotifyUpdateApplied::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_notify_update_applied); } command_t *create_query_image_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_QUERY_IMAGE_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, OtaSoftwareUpdateProvider::Commands::QueryImageResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } command_t *create_apply_update_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_APPLY_UPDATE_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, OtaSoftwareUpdateProvider::Commands::ApplyUpdateResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } @@ -1176,7 +1170,7 @@ namespace command { command_t *create_announce_ota_provider(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ANNOUNCE_OTA_PROVIDER_COMMAND_ID, + return esp_matter::command::create(cluster, OtaSoftwareUpdateRequestor::Commands::AnnounceOtaProvider::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_announce_ota_provider); } @@ -1189,19 +1183,19 @@ namespace command { command_t *create_identify(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_IDENTIFY_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, Identify::Commands::Identify::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_identify); } command_t *create_identify_query(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_IDENTIFY_QUERY_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, Identify::Commands::IdentifyQuery::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_identify_query); } command_t *create_identify_query_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_IDENTIFY_QUERY_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, Identify::Commands::IdentifyQueryResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } @@ -1213,64 +1207,62 @@ namespace command { command_t *create_add_group(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ADD_GROUP_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, Groups::Commands::AddGroup::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_add_group); } command_t *create_view_group(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_VIEW_GROUP_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, Groups::Commands::ViewGroup::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_view_group); } command_t *create_get_group_membership(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_GET_GROUP_MEMBERSHIP_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, Groups::Commands::GetGroupMembership::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_get_group_membership); } command_t *create_remove_group(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_REMOVE_GROUP_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, Groups::Commands::RemoveGroup::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_remove_group); } command_t *create_remove_all_groups(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_REMOVE_ALL_GROUPS_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, Groups::Commands::RemoveAllGroups::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_remove_all_groups); } command_t *create_add_group_if_identifying(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ADD_GROUP_IF_IDENTIFYING_COMMAND_ID, + return esp_matter::command::create(cluster, Groups::Commands::AddGroupIfIdentifying::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_add_group_if_identifying); } command_t *create_add_group_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ADD_GROUP_RESPONSE_COMMAND_ID, - COMMAND_FLAG_SERVER_GENERATED, NULL); + return esp_matter::command::create(cluster, Groups::Commands::AddGroupResponse::Id, COMMAND_FLAG_SERVER_GENERATED, + NULL); } command_t *create_view_group_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_VIEW_GROUP_RESPONSE_COMMAND_ID, - COMMAND_FLAG_SERVER_GENERATED, NULL); + return esp_matter::command::create(cluster, Groups::Commands::ViewGroupResponse::Id, COMMAND_FLAG_SERVER_GENERATED, + NULL); } command_t *create_get_group_membership_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_GET_GROUP_MEMBERSHIP_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, Groups::Commands::GetGroupMembershipResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } command_t *create_remove_group_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_REMOVE_GROUP_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, Groups::Commands::RemoveGroupResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } @@ -1282,81 +1274,79 @@ namespace command { command_t *create_add_scene(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ADD_SCENE_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, Scenes::Commands::AddScene::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_add_scene); } command_t *create_view_scene(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_VIEW_SCENE_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, Scenes::Commands::ViewScene::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_view_scene); } command_t *create_remove_scene(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_REMOVE_SCENE_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, Scenes::Commands::RemoveScene::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_remove_scene); } command_t *create_remove_all_scenes(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_REMOVE_ALL_SCENES_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, Scenes::Commands::RemoveAllScenes::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_remove_all_scenes); } command_t *create_store_scene(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_STORE_SCENE_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, Scenes::Commands::StoreScene::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_store_scene); } command_t *create_recall_scene(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_RECALL_SCENE_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, Scenes::Commands::RecallScene::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_recall_scene); } command_t *create_get_scene_membership(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_GET_SCENE_MEMBERSHIP_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, Scenes::Commands::GetSceneMembership::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_get_scene_membership); } command_t *create_add_scene_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ADD_SCENE_RESPONSE_COMMAND_ID, - COMMAND_FLAG_SERVER_GENERATED, NULL); + return esp_matter::command::create(cluster, Scenes::Commands::AddSceneResponse::Id, COMMAND_FLAG_SERVER_GENERATED, + NULL); } command_t *create_view_scene_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_VIEW_SCENE_RESPONSE_COMMAND_ID, - COMMAND_FLAG_SERVER_GENERATED, NULL); + return esp_matter::command::create(cluster, Scenes::Commands::ViewSceneResponse::Id, COMMAND_FLAG_SERVER_GENERATED, + NULL); } command_t *create_remove_scene_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_REMOVE_SCENE_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, Scenes::Commands::RemoveSceneResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } command_t *create_remove_all_scenes_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_REMOVE_ALL_SCENES_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, Scenes::Commands::RemoveAllScenesResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } command_t *create_store_scene_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_STORE_SCENE_RESPONSE_COMMAND_ID, - COMMAND_FLAG_SERVER_GENERATED, NULL); + return esp_matter::command::create(cluster, Scenes::Commands::StoreSceneResponse::Id, COMMAND_FLAG_SERVER_GENERATED, + NULL); } command_t *create_get_scene_membership_response(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_GET_SCENE_MEMBERSHIP_RESPONSE_COMMAND_ID, + return esp_matter::command::create(cluster, Scenes::Commands::GetSceneMembershipResponse::Id, COMMAND_FLAG_SERVER_GENERATED, NULL); } @@ -1368,40 +1358,38 @@ namespace command { command_t *create_off(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_OFF_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, OnOff::Commands::Off::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_off); } command_t *create_on(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ON_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, OnOff::Commands::On::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_on); } command_t *create_toggle(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_TOGGLE_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, OnOff::Commands::Toggle::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_toggle); } command_t *create_off_with_effect(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_OFF_WITH_EFFECT_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, OnOff::Commands::OffWithEffect::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_off_with_effect); } command_t *create_on_with_recall_global_scene(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ON_WITH_RECALL_GLOBAL_SCENE_COMMAND_ID, + return esp_matter::command::create(cluster, OnOff::Commands::OnWithRecallGlobalScene::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_on_with_recall_global_scene); } command_t *create_on_with_timed_off(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_ON_WITH_TIMED_OFF_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, OnOff::Commands::OnWithTimedOff::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_on_with_timed_off); } @@ -1413,54 +1401,51 @@ namespace command { command_t *create_move_to_level(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_MOVE_TO_LEVEL_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, LevelControl::Commands::MoveToLevel::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_move_to_level); } command_t *create_move(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_MOVE_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, LevelControl::Commands::Move::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_move); } command_t *create_step(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_STEP_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, LevelControl::Commands::Step::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_step); } command_t *create_stop(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_STOP_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, LevelControl::Commands::Stop::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_stop); } command_t *create_move_to_level_with_on_off(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_MOVE_TO_LEVEL_WITH_ON_OFF_COMMAND_ID, + return esp_matter::command::create(cluster, LevelControl::Commands::MoveToLevelWithOnOff::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_move_to_level_with_on_off); } command_t *create_move_with_on_off(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_MOVE_WITH_ON_OFF_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_move_with_on_off); + return esp_matter::command::create(cluster, LevelControl::Commands::MoveWithOnOff::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_move_with_on_off); } command_t *create_step_with_on_off(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_STEP_WITH_ON_OFF_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_step_with_on_off); + return esp_matter::command::create(cluster, LevelControl::Commands::StepWithOnOff::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_step_with_on_off); } command_t *create_stop_with_on_off(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_STOP_WITH_ON_OFF_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_stop_with_on_off); + return esp_matter::command::create(cluster, LevelControl::Commands::StopWithOnOff::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_stop_with_on_off); } } /* command */ @@ -1471,53 +1456,50 @@ namespace command { command_t *create_move_to_hue(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_MOVE_TO_HUE_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, ColorControl::Commands::MoveToHue::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_move_to_hue); } command_t *create_move_hue(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_MOVE_HUE_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, ColorControl::Commands::MoveHue::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_move_hue); } command_t *create_step_hue(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_STEP_HUE_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, ColorControl::Commands::StepHue::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_step_hue); } command_t *create_move_to_saturation(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_MOVE_TO_SATURATION_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_move_to_saturation); + return esp_matter::command::create(cluster, ColorControl::Commands::MoveToSaturation::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_move_to_saturation); } command_t *create_move_saturation(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_MOVE_SATURATION_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_move_saturation); + return esp_matter::command::create(cluster, ColorControl::Commands::MoveSaturation::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_move_saturation); } command_t *create_step_saturation(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_STEP_SATURATION_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_step_saturation); + return esp_matter::command::create(cluster, ColorControl::Commands::StepSaturation::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_step_saturation); } command_t *create_move_to_hue_and_saturation(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_MOVE_TO_HUE_AND_SATURATION_COMMAND_ID, + return esp_matter::command::create(cluster, ColorControl::Commands::MoveToHueAndSaturation::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_move_to_hue_and_saturation); } command_t *create_stop_move_step(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_STOP_MOVE_STEP_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, ColorControl::Commands::StopMoveStep::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_stop_move_step); } @@ -1529,9 +1511,8 @@ namespace command { command_t *create_setpoint_raise_lower(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_SETPOINT_RAISE_LOWER_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED, - esp_matter_command_callback_setpoint_raise_lower); + return esp_matter::command::create(cluster, Thermostat::Commands::SetpointRaiseLower::Id, + COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_setpoint_raise_lower); } } /* command */ @@ -1542,13 +1523,13 @@ namespace command { command_t *create_lock_door(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_LOCK_DOOR_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, DoorLock::Commands::LockDoor::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_lock_door); } command_t *create_unlock_door(cluster_t *cluster) { - return esp_matter::command::create(cluster, ZCL_UNLOCK_DOOR_COMMAND_ID, COMMAND_FLAG_CLIENT_GENERATED, + return esp_matter::command::create(cluster, DoorLock::Commands::UnlockDoor::Id, COMMAND_FLAG_CLIENT_GENERATED, esp_matter_command_callback_unlock_door); } diff --git a/components/esp_matter/esp_matter_endpoint.cpp b/components/esp_matter/esp_matter_endpoint.cpp index 003142750..5e189db7f 100644 --- a/components/esp_matter/esp_matter_endpoint.cpp +++ b/components/esp_matter/esp_matter_endpoint.cpp @@ -57,8 +57,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags) general_commissioning::create(endpoint, &(config->general_commissioning), CLUSTER_FLAG_SERVER); network_commissioning::create(endpoint, &(config->network_commissioning), CLUSTER_FLAG_SERVER); general_diagnostics::create(endpoint, &(config->general_diagnostics), CLUSTER_FLAG_SERVER); - 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); group_key_management::create(endpoint, CLUSTER_FLAG_SERVER); diff --git a/components/esp_matter/esp_matter_feature.cpp b/components/esp_matter/esp_matter_feature.cpp index b040e895a..6ebae9367 100644 --- a/components/esp_matter/esp_matter_feature.cpp +++ b/components/esp_matter/esp_matter_feature.cpp @@ -31,7 +31,7 @@ static esp_err_t update_feature_map(cluster_t *cluster, uint32_t value) } /* Get the attribute */ - attribute_t *attribute = attribute::get(cluster, ZCL_FEATURE_MAP_SERVER_ATTRIBUTE_ID); + attribute_t *attribute = attribute::get(cluster, Globals::Attributes::FeatureMap::Id); /* Create the attribute with the new value if it does not exist */ if (!attribute) { diff --git a/components/esp_matter_rainmaker/esp_matter_rainmaker.cpp b/components/esp_matter_rainmaker/esp_matter_rainmaker.cpp index ccd20381f..797dde8f0 100644 --- a/components/esp_matter_rainmaker/esp_matter_rainmaker.cpp +++ b/components/esp_matter_rainmaker/esp_matter_rainmaker.cpp @@ -21,11 +21,40 @@ #include #include -using namespace esp_matter; +#define ESP_MATTER_RAINMAKER_COMMAND_LIMIT 5 /* This command can be called 5 times per reboot */ +#define ESP_MATTER_RAINMAKER_MAX_DATA_LEN 40 static const char *TAG = "esp_matter_rainmaker"; -static esp_err_t esp_matter_rainmaker_console_handler(int argc, char **argv) +namespace esp_matter { + +namespace cluster { +namespace rainmaker { +static constexpr chip::EndpointId endpoint_id = 0x00000000; /* Same as root node endpoint. This will always be + endpoint_id 0. */ +static constexpr chip::ClusterId Id = 0x131B0000; /* 0x131B == manufacturer code */ + +namespace attribute { +namespace status { +static constexpr chip::AttributeId Id = 0x00000000; +} /* status */ +namespace node_id { +static constexpr chip::AttributeId Id = 0x00000001; +} /* node_id */ +} /* attribute */ + +namespace command { +namespace configuration { +static constexpr chip::CommandId Id = 0x00000000; +} /* configuration */ +} /* command */ + +} /* rainmaker */ +} /* cluster */ + +namespace rainmaker { + +static esp_err_t console_handler(int argc, char **argv) { if (argc == 3 && strncmp(argv[0], "add-user", sizeof("add-user")) == 0) { printf("%s: Starting user-node mapping\n", TAG); @@ -39,40 +68,31 @@ static esp_err_t esp_matter_rainmaker_console_handler(int argc, char **argv) return ESP_OK; } -static void esp_matter_rainmaker_register_commands() +static void register_commands() { esp_matter_console_command_t command = { .name = "rainmaker", .description = "Initiate ESP RainMaker User-Node mapping from the node. " "Usage: matter esp rainmaker add-user ", - .handler = esp_matter_rainmaker_console_handler, + .handler = console_handler, }; esp_matter_console_add_command(&command); } -#define ESP_MATTER_RAINMAKER_ENDPOINT_ID 0x0 /* Same as root node endpoint. This will always be endpoint_id 0. */ -#define ESP_MATTER_RAINMAKER_CLUSTER_ID 0x131B0000 /* 0x131B == manufacturer code */ -#define ESP_MATTER_RAINMAKER_STATUS_ATTRIBUTE_ID 0x0 -#define ESP_MATTER_RAINMAKER_NODE_ID_ATTRIBUTE_ID 0x1 -#define ESP_MATTER_RAINMAKER_CONFIGURATION_COMMAND_ID 0x0 -#define ESP_MATTER_RAINMAKER_CLUSTER_REVISION 1 -#define ESP_MATTER_RAINMAKER_COMMAND_LIMIT 5 /* This command can be called 5 times per reboot */ -#define ESP_MATTER_RAINMAKER_MAX_DATA_LEN 40 - -static esp_err_t rainmaker_status_attribute_update(bool status) +static esp_err_t status_attribute_update(bool status) { - int endpoint_id = ESP_MATTER_RAINMAKER_ENDPOINT_ID; - int cluster_id = ESP_MATTER_RAINMAKER_CLUSTER_ID; - int attribute_id = ESP_MATTER_RAINMAKER_STATUS_ATTRIBUTE_ID; + int endpoint_id = cluster::rainmaker::endpoint_id; + int cluster_id = cluster::rainmaker::Id; + int attribute_id = cluster::rainmaker::attribute::status::Id; esp_matter_attr_val_t val = esp_matter_bool(status); return attribute::update(endpoint_id, cluster_id, attribute_id, &val); } -static esp_err_t app_rainmaker_node_id_attribute_update(char *node_id) +static esp_err_t node_id_attribute_update(char *node_id) { - int endpoint_id = ESP_MATTER_RAINMAKER_ENDPOINT_ID; - int cluster_id = ESP_MATTER_RAINMAKER_CLUSTER_ID; - int attribute_id = ESP_MATTER_RAINMAKER_NODE_ID_ATTRIBUTE_ID; + int endpoint_id = cluster::rainmaker::endpoint_id; + int cluster_id = cluster::rainmaker::Id; + int attribute_id = cluster::rainmaker::attribute::node_id::Id; esp_matter_attr_val_t val = esp_matter_char_str(node_id, strlen(node_id)); return attribute::update(endpoint_id, cluster_id, attribute_id, &val); } @@ -84,16 +104,15 @@ static void user_node_association_event_handler(void *arg, esp_event_base_t even if (event_base == RMAKER_EVENT) { if (event_id == RMAKER_EVENT_USER_NODE_MAPPING_DONE) { ESP_LOGI(TAG, "User node association complete. Updating the status attribute."); - rainmaker_status_attribute_update(true); + status_attribute_update(true); } else if (event_id == RMAKER_EVENT_USER_NODE_MAPPING_RESET) { ESP_LOGI(TAG, "User node association reset. Updating the status attribute."); - rainmaker_status_attribute_update(false); + status_attribute_update(false); } } } -static esp_err_t esp_matter_rainmaker_command_callback(const ConcreteCommandPath &command_path, TLVReader &tlv_data, - void *opaque_ptr) +static esp_err_t command_callback(const ConcreteCommandPath &command_path, TLVReader &tlv_data, void *opaque_ptr) { /* Get ids */ int endpoint_id = command_path.mEndpointId; @@ -101,8 +120,8 @@ static esp_err_t esp_matter_rainmaker_command_callback(const ConcreteCommandPath int command_id = command_path.mCommandId; /* Return if this is not the rainmaker configuration command */ - if (endpoint_id != ESP_MATTER_RAINMAKER_ENDPOINT_ID || cluster_id != ESP_MATTER_RAINMAKER_CLUSTER_ID || - command_id != ESP_MATTER_RAINMAKER_CONFIGURATION_COMMAND_ID) { + if (endpoint_id != cluster::rainmaker::endpoint_id || cluster_id != cluster::rainmaker::Id || + command_id != cluster::rainmaker::command::configuration::Id) { ESP_LOGE(TAG, "Got rainmaker command callback for some other command. This should not happen."); return ESP_FAIL; } @@ -160,47 +179,46 @@ static esp_err_t esp_matter_rainmaker_command_callback(const ConcreteCommandPath return ESP_OK; } -static esp_err_t rainmaker_custom_cluster_create() +static esp_err_t custom_cluster_create() { /* Get the endpoint */ node_t *node = node::get(); - endpoint_t *endpoint = endpoint::get(node, ESP_MATTER_RAINMAKER_ENDPOINT_ID); + endpoint_t *endpoint = endpoint::get(node, cluster::rainmaker::endpoint_id); /* Create custom rainmaker cluster */ - cluster_t *cluster = cluster::create(endpoint, ESP_MATTER_RAINMAKER_CLUSTER_ID, CLUSTER_FLAG_SERVER); - attribute::create(cluster, ZCL_CLUSTER_REVISION_SERVER_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, - esp_matter_uint16(ESP_MATTER_RAINMAKER_CLUSTER_REVISION)); + cluster_t *cluster = esp_matter::cluster::create(endpoint, cluster::rainmaker::Id, CLUSTER_FLAG_SERVER); + attribute::create(cluster, Globals::Attributes::ClusterRevision::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_uint16(1)); /* Create custom status attribute */ /* Update the value of the attribute after esp_rmaker_node_init() is done */ - attribute::create(cluster, ESP_MATTER_RAINMAKER_STATUS_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + attribute::create(cluster, cluster::rainmaker::attribute::status::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(false)); /* Create custom node_id attribute */ /* Update the value of the attribute after esp_rmaker_node_init() is done */ char node_id[32] = {0}; - attribute::create(cluster, ESP_MATTER_RAINMAKER_NODE_ID_ATTRIBUTE_ID, ATTRIBUTE_FLAG_NONE, + attribute::create(cluster, cluster::rainmaker::attribute::node_id::Id, ATTRIBUTE_FLAG_NONE, esp_matter_char_str(node_id, sizeof(node_id))); /* Create custom configuration command */ - command::create(cluster, ESP_MATTER_RAINMAKER_CONFIGURATION_COMMAND_ID, - COMMAND_FLAG_CLIENT_GENERATED | COMMAND_FLAG_CUSTOM, - esp_matter_rainmaker_command_callback); + command::create(cluster, cluster::rainmaker::command::configuration::Id, + COMMAND_FLAG_CLIENT_GENERATED | COMMAND_FLAG_CUSTOM, command_callback); return ESP_OK; } -esp_err_t esp_matter_rainmaker_init() +esp_err_t init() { /* Add custom rainmaker cluster */ - esp_matter_rainmaker_register_commands(); - return rainmaker_custom_cluster_create(); + register_commands(); + return custom_cluster_create(); } -esp_err_t esp_matter_rainmaker_start() +esp_err_t start() { /* Check user node association */ if (esp_rmaker_user_node_mapping_get_state() == ESP_RMAKER_USER_MAPPING_DONE) { - rainmaker_status_attribute_update(true); + status_attribute_update(true); } /* Register an event handler and update the state later */ @@ -210,6 +228,9 @@ esp_err_t esp_matter_rainmaker_start() &user_node_association_event_handler, NULL); /* Update node_id */ - app_rainmaker_node_id_attribute_update(esp_rmaker_get_node_id()); + node_id_attribute_update(esp_rmaker_get_node_id()); return ESP_OK; } + +} /* rainmaker */ +} /* esp_matter */ diff --git a/components/esp_matter_rainmaker/esp_matter_rainmaker.h b/components/esp_matter_rainmaker/esp_matter_rainmaker.h index 979ee715f..1d3e5fa1a 100644 --- a/components/esp_matter_rainmaker/esp_matter_rainmaker.h +++ b/components/esp_matter_rainmaker/esp_matter_rainmaker.h @@ -17,6 +17,9 @@ #include #include +namespace esp_matter { +namespace rainmaker { + /** Initialize ESP Matter RainMaker * * This adds the custom RainMaker cluster which is used for RainMaker User Node Association. @@ -26,7 +29,7 @@ * @return ESP_OK on success. * @return error in case of failure. */ -esp_err_t esp_matter_rainmaker_init(void); +esp_err_t init(void); /** Start ESP Matter RainMaker * @@ -36,4 +39,7 @@ esp_err_t esp_matter_rainmaker_init(void); * @return ESP_OK on success. * @return error in case of failure. */ -esp_err_t esp_matter_rainmaker_start(void); +esp_err_t start(void); + +} /* rainmaker */ +} /* esp_matter */ diff --git a/examples/bridge_zigbee/main/app_main.cpp b/examples/bridge_zigbee/main/app_main.cpp index 39ecadb9a..0a256a8b3 100644 --- a/examples/bridge_zigbee/main/app_main.cpp +++ b/examples/bridge_zigbee/main/app_main.cpp @@ -34,8 +34,8 @@ static void app_event_cb(const ChipDeviceEvent *event, intptr_t arg) ESP_LOGI(TAG, "Current free heap: %zu", heap_caps_get_free_size(MALLOC_CAP_8BIT)); } -static esp_err_t app_attribute_update_cb(callback_type_t type, int endpoint_id, int cluster_id, - int attribute_id, esp_matter_attr_val_t *val, void *priv_data) +static esp_err_t app_attribute_update_cb(callback_type_t type, int endpoint_id, int cluster_id, int attribute_id, + esp_matter_attr_val_t *val, void *priv_data) { esp_err_t err = ESP_OK; diff --git a/examples/bridge_zigbee/main/zigbee_bridge.cpp b/examples/bridge_zigbee/main/zigbee_bridge.cpp index 68a08b332..0561bb51a 100644 --- a/examples/bridge_zigbee/main/zigbee_bridge.cpp +++ b/examples/bridge_zigbee/main/zigbee_bridge.cpp @@ -123,8 +123,8 @@ esp_err_t zigbee_bridge_attribute_update(int endpoint_id, int cluster_id, int at { app_bridge_zigbee_device_t *zigbee_device = app_bridge_get_zigbee_device_by_matter_endpointid(endpoint_id); if (zigbee_device && zigbee_device->dev && zigbee_device->dev->endpoint) { - if (cluster_id == ZCL_ON_OFF_CLUSTER_ID) { - if (attribute_id == ZCL_ON_OFF_ATTRIBUTE_ID) { + if (cluster_id == OnOff::Id) { + if (attribute_id == OnOff::Attributes::OnOff::Id) { zb_buf_get_out_delayed_ext((val->val.b ? zigbee_bridge_send_on : zigbee_bridge_send_off), zigbee_device->zigbee_shortaddr, 0); } diff --git a/examples/light/main/app_driver.cpp b/examples/light/main/app_driver.cpp index 925c7c0e1..34c17310d 100644 --- a/examples/light/main/app_driver.cpp +++ b/examples/light/main/app_driver.cpp @@ -49,18 +49,18 @@ esp_err_t app_driver_attribute_update(int endpoint_id, int cluster_id, int attri { esp_err_t err = ESP_OK; if (endpoint_id == light_endpoint_id) { - if (cluster_id == ZCL_ON_OFF_CLUSTER_ID) { - if (attribute_id == ZCL_ON_OFF_ATTRIBUTE_ID) { + if (cluster_id == OnOff::Id) { + if (attribute_id == OnOff::Attributes::OnOff::Id) { err = app_driver_light_set_power(val); } - } else if (cluster_id == ZCL_LEVEL_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_CURRENT_LEVEL_ATTRIBUTE_ID) { + } else if (cluster_id == LevelControl::Id) { + if (attribute_id == LevelControl::Attributes::CurrentLevel::Id) { err = app_driver_light_set_brightness(val); } - } else if (cluster_id == ZCL_COLOR_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID) { + } else if (cluster_id == ColorControl::Id) { + if (attribute_id == ColorControl::Attributes::CurrentHue::Id) { err = app_driver_light_set_hue(val); - } else if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID) { + } else if (attribute_id == ColorControl::Attributes::CurrentSaturation::Id) { err = app_driver_light_set_saturation(val); } } diff --git a/examples/rainmaker_light/main/app_driver.cpp b/examples/rainmaker_light/main/app_driver.cpp index 925c7c0e1..34c17310d 100644 --- a/examples/rainmaker_light/main/app_driver.cpp +++ b/examples/rainmaker_light/main/app_driver.cpp @@ -49,18 +49,18 @@ esp_err_t app_driver_attribute_update(int endpoint_id, int cluster_id, int attri { esp_err_t err = ESP_OK; if (endpoint_id == light_endpoint_id) { - if (cluster_id == ZCL_ON_OFF_CLUSTER_ID) { - if (attribute_id == ZCL_ON_OFF_ATTRIBUTE_ID) { + if (cluster_id == OnOff::Id) { + if (attribute_id == OnOff::Attributes::OnOff::Id) { err = app_driver_light_set_power(val); } - } else if (cluster_id == ZCL_LEVEL_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_CURRENT_LEVEL_ATTRIBUTE_ID) { + } else if (cluster_id == LevelControl::Id) { + if (attribute_id == LevelControl::Attributes::CurrentLevel::Id) { err = app_driver_light_set_brightness(val); } - } else if (cluster_id == ZCL_COLOR_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID) { + } else if (cluster_id == ColorControl::Id) { + if (attribute_id == ColorControl::Attributes::CurrentHue::Id) { err = app_driver_light_set_hue(val); - } else if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID) { + } else if (attribute_id == ColorControl::Attributes::CurrentSaturation::Id) { err = app_driver_light_set_saturation(val); } } diff --git a/examples/rainmaker_light/main/app_rainmaker.cpp b/examples/rainmaker_light/main/app_rainmaker.cpp index bc8db5dd4..6a4d2ca59 100644 --- a/examples/rainmaker_light/main/app_rainmaker.cpp +++ b/examples/rainmaker_light/main/app_rainmaker.cpp @@ -35,16 +35,16 @@ extern int light_endpoint_id; static esp_rmaker_param_val_t app_rainmaker_get_rmaker_val(esp_matter_attr_val_t *val, int cluster_id, int attribute_id) { /* Attributes which need to be remapped */ - if (cluster_id == ZCL_LEVEL_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_CURRENT_LEVEL_ATTRIBUTE_ID) { + if (cluster_id == LevelControl::Id) { + if (attribute_id == LevelControl::Attributes::CurrentLevel::Id) { int value = REMAP_TO_RANGE(val->val.u8, MATTER_BRIGHTNESS, STANDARD_BRIGHTNESS); return esp_rmaker_int(value); } - } else if (cluster_id == ZCL_COLOR_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID) { + } else if (cluster_id == ColorControl::Id) { + if (attribute_id == ColorControl::Attributes::CurrentHue::Id) { int value = REMAP_TO_RANGE(val->val.u8, MATTER_HUE, STANDARD_HUE); return esp_rmaker_int(value); - } else if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID) { + } else if (attribute_id == ColorControl::Attributes::CurrentSaturation::Id) { int value = REMAP_TO_RANGE(val->val.u8, MATTER_SATURATION, STANDARD_SATURATION); return esp_rmaker_int(value); } @@ -72,16 +72,16 @@ static esp_rmaker_param_val_t app_rainmaker_get_rmaker_val(esp_matter_attr_val_t static esp_matter_attr_val_t app_rainmaker_get_matter_val(esp_rmaker_param_val_t *val, int cluster_id, int attribute_id) { /* Attributes which need to be remapped */ - if (cluster_id == ZCL_LEVEL_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_CURRENT_LEVEL_ATTRIBUTE_ID) { + if (cluster_id == LevelControl::Id) { + if (attribute_id == LevelControl::Attributes::CurrentLevel::Id) { uint8_t value = REMAP_TO_RANGE(val->val.i, STANDARD_BRIGHTNESS, MATTER_BRIGHTNESS); return esp_matter_uint8(value); } - } else if (cluster_id == ZCL_COLOR_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID) { + } else if (cluster_id == ColorControl::Id) { + if (attribute_id == ColorControl::Attributes::CurrentHue::Id) { uint8_t value = REMAP_TO_RANGE(val->val.i, STANDARD_HUE, MATTER_HUE); return esp_matter_uint8(value); - } else if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID) { + } else if (attribute_id == ColorControl::Attributes::CurrentSaturation::Id) { uint8_t value = REMAP_TO_RANGE(val->val.i, STANDARD_SATURATION, MATTER_SATURATION); return esp_matter_uint8(value); } @@ -126,18 +126,18 @@ static int app_rainmaker_get_endpoint_id_from_name(const char *device_name) static const char *app_rainmaker_get_param_name_from_id(int cluster_id, int attribute_id) { - if (cluster_id == ZCL_ON_OFF_CLUSTER_ID) { - if (attribute_id == ZCL_ON_OFF_ATTRIBUTE_ID) { + if (cluster_id == OnOff::Id) { + if (attribute_id == OnOff::Attributes::OnOff::Id) { return ESP_RMAKER_DEF_POWER_NAME; } - } else if (cluster_id == ZCL_LEVEL_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_CURRENT_LEVEL_ATTRIBUTE_ID) { + } else if (cluster_id == LevelControl::Id) { + if (attribute_id == LevelControl::Attributes::CurrentLevel::Id) { return ESP_RMAKER_DEF_BRIGHTNESS_NAME; } - } else if (cluster_id == ZCL_COLOR_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID) { + } else if (cluster_id == ColorControl::Id) { + if (attribute_id == ColorControl::Attributes::CurrentHue::Id) { return ESP_RMAKER_DEF_HUE_NAME; - } else if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID) { + } else if (attribute_id == ColorControl::Attributes::CurrentSaturation::Id) { return ESP_RMAKER_DEF_SATURATION_NAME; } } @@ -146,18 +146,18 @@ static const char *app_rainmaker_get_param_name_from_id(int cluster_id, int attr static const char *app_rainmaker_get_param_type_from_id(int cluster_id, int attribute_id) { - if (cluster_id == ZCL_ON_OFF_CLUSTER_ID) { - if (attribute_id == ZCL_ON_OFF_ATTRIBUTE_ID) { + if (cluster_id == OnOff::Id) { + if (attribute_id == OnOff::Attributes::OnOff::Id) { return ESP_RMAKER_PARAM_POWER; } - } else if (cluster_id == ZCL_LEVEL_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_CURRENT_LEVEL_ATTRIBUTE_ID) { + } else if (cluster_id == LevelControl::Id) { + if (attribute_id == LevelControl::Attributes::CurrentLevel::Id) { return ESP_RMAKER_PARAM_BRIGHTNESS; } - } else if (cluster_id == ZCL_COLOR_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID) { + } else if (cluster_id == ColorControl::Id) { + if (attribute_id == ColorControl::Attributes::CurrentHue::Id) { return ESP_RMAKER_PARAM_HUE; - } else if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID) { + } else if (attribute_id == ColorControl::Attributes::CurrentSaturation::Id) { return ESP_RMAKER_PARAM_SATURATION; } } @@ -166,18 +166,18 @@ static const char *app_rainmaker_get_param_type_from_id(int cluster_id, int attr static const char *app_rainmaker_get_param_ui_type_from_id(int cluster_id, int attribute_id) { - if (cluster_id == ZCL_ON_OFF_CLUSTER_ID) { - if (attribute_id == ZCL_ON_OFF_ATTRIBUTE_ID) { + if (cluster_id == OnOff::Id) { + if (attribute_id == OnOff::Attributes::OnOff::Id) { return ESP_RMAKER_UI_TOGGLE; } - } else if (cluster_id == ZCL_LEVEL_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_CURRENT_LEVEL_ATTRIBUTE_ID) { + } else if (cluster_id == LevelControl::Id) { + if (attribute_id == LevelControl::Attributes::CurrentLevel::Id) { return ESP_RMAKER_UI_SLIDER; } - } else if (cluster_id == ZCL_COLOR_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID) { + } else if (cluster_id == ColorControl::Id) { + if (attribute_id == ColorControl::Attributes::CurrentHue::Id) { return ESP_RMAKER_UI_HUE_SLIDER; - } else if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID) { + } else if (attribute_id == ColorControl::Attributes::CurrentSaturation::Id) { return ESP_RMAKER_UI_SLIDER; } } @@ -186,20 +186,20 @@ static const char *app_rainmaker_get_param_ui_type_from_id(int cluster_id, int a static bool app_rainmaker_get_param_bounds_from_id(int cluster_id, int attribute_id, int *min, int *max, int *step) { - if (cluster_id == ZCL_LEVEL_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_CURRENT_LEVEL_ATTRIBUTE_ID) { + if (cluster_id == LevelControl::Id) { + if (attribute_id == LevelControl::Attributes::CurrentLevel::Id) { *min = 0; *max = STANDARD_BRIGHTNESS; *step = 1; return true; } - } else if (cluster_id == ZCL_COLOR_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID) { + } else if (cluster_id == ColorControl::Id) { + if (attribute_id == ColorControl::Attributes::CurrentHue::Id) { *min = 0; *max = STANDARD_HUE; *step = 1; return true; - } else if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID) { + } else if (attribute_id == ColorControl::Attributes::CurrentSaturation::Id) { *min = 0; *max = STANDARD_SATURATION; *step = 1; @@ -248,13 +248,13 @@ static esp_err_t app_rainmaker_param_add_bounds(esp_rmaker_param_t *param, clust static int app_rainmaker_get_cluster_id_from_name(const char *param_name) { if (strcmp(param_name, ESP_RMAKER_DEF_POWER_NAME) == 0) { - return ZCL_ON_OFF_CLUSTER_ID; + return OnOff::Id; } else if (strcmp(param_name, ESP_RMAKER_DEF_BRIGHTNESS_NAME) == 0) { - return ZCL_LEVEL_CONTROL_CLUSTER_ID; + return LevelControl::Id; } else if (strcmp(param_name, ESP_RMAKER_DEF_HUE_NAME) == 0) { - return ZCL_COLOR_CONTROL_CLUSTER_ID; + return ColorControl::Id; } else if (strcmp(param_name, ESP_RMAKER_DEF_SATURATION_NAME) == 0) { - return ZCL_COLOR_CONTROL_CLUSTER_ID; + return ColorControl::Id; } return 0; } @@ -262,13 +262,13 @@ static int app_rainmaker_get_cluster_id_from_name(const char *param_name) static int app_rainmaker_get_attribute_id_from_name(const char *param_name) { if (strcmp(param_name, ESP_RMAKER_DEF_POWER_NAME) == 0) { - return ZCL_ON_OFF_ATTRIBUTE_ID; + return OnOff::Attributes::OnOff::Id; } else if (strcmp(param_name, ESP_RMAKER_DEF_BRIGHTNESS_NAME) == 0) { - return ZCL_CURRENT_LEVEL_ATTRIBUTE_ID; + return LevelControl::Attributes::CurrentLevel::Id; } else if (strcmp(param_name, ESP_RMAKER_DEF_HUE_NAME) == 0) { - return ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID; + return ColorControl::Attributes::CurrentHue::Id; } else if (strcmp(param_name, ESP_RMAKER_DEF_SATURATION_NAME) == 0) { - return ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID; + return ColorControl::Attributes::CurrentSaturation::Id; } return 0; } @@ -391,7 +391,7 @@ static void app_rainmaker_data_model_create() esp_err_t app_rainmaker_init() { /* Add custom rainmaker cluster */ - return esp_matter_rainmaker_init(); + return rainmaker::init(); } esp_err_t app_rainmaker_start() @@ -429,7 +429,7 @@ esp_err_t app_rainmaker_start() esp_rmaker_schedule_enable(); /* Start the ESP RainMaker Agent */ - esp_matter_rainmaker_start(); + rainmaker::start(); esp_rmaker_start(); return ESP_OK; } diff --git a/examples/switch/main/app_driver.cpp b/examples/switch/main/app_driver.cpp index c00280805..52b28b806 100644 --- a/examples/switch/main/app_driver.cpp +++ b/examples/switch/main/app_driver.cpp @@ -77,12 +77,12 @@ void app_driver_client_command_callback(client::peer_device_t *peer_device, int { /** TODO: Find a better way to get the cluster_id and command_id. Once done, move the console commands to esp_matter_client. */ - if (g_cluster_id == ZCL_ON_OFF_CLUSTER_ID) { - if (g_command_id == ZCL_OFF_COMMAND_ID) { + if (g_cluster_id == OnOff::Id) { + if (g_command_id == OnOff::Commands::Off::Id) { on_off::command::send_off(peer_device, remote_endpoint_id); - } else if (g_command_id == ZCL_ON_COMMAND_ID) { + } else if (g_command_id == OnOff::Commands::On::Id) { on_off::command::send_on(peer_device, remote_endpoint_id); - } else if (g_command_id == ZCL_TOGGLE_COMMAND_ID) { + } else if (g_command_id == OnOff::Commands::Toggle::Id) { on_off::command::send_toggle(peer_device, remote_endpoint_id); } } diff --git a/examples/zap_light/main/app_driver.cpp b/examples/zap_light/main/app_driver.cpp index d4884e1e2..ad68e6f58 100644 --- a/examples/zap_light/main/app_driver.cpp +++ b/examples/zap_light/main/app_driver.cpp @@ -49,18 +49,18 @@ esp_err_t app_driver_attribute_update(int endpoint_id, int cluster_id, int attri { esp_err_t err = ESP_OK; if (endpoint_id == light_endpoint_id) { - if (cluster_id == ZCL_ON_OFF_CLUSTER_ID) { - if (attribute_id == ZCL_ON_OFF_ATTRIBUTE_ID) { + if (cluster_id == OnOff::Id) { + if (attribute_id == OnOff::Attributes::OnOff::Id) { err = app_driver_light_set_power(val); } - } else if (cluster_id == ZCL_LEVEL_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_CURRENT_LEVEL_ATTRIBUTE_ID) { + } else if (cluster_id == LevelControl::Id) { + if (attribute_id == LevelControl::Attributes::CurrentLevel::Id) { err = app_driver_light_set_brightness(val); } - } else if (cluster_id == ZCL_COLOR_CONTROL_CLUSTER_ID) { - if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID) { + } else if (cluster_id == ColorControl::Id) { + if (attribute_id == ColorControl::Attributes::CurrentHue::Id) { err = app_driver_light_set_hue(val); - } else if (attribute_id == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID) { + } else if (attribute_id == ColorControl::Attributes::CurrentSaturation::Id) { err = app_driver_light_set_saturation(val); } } @@ -81,29 +81,29 @@ esp_err_t app_driver_attribute_set_defaults() esp_matter_attr_val_t val = esp_matter_invalid(NULL); endpoint_id = light_endpoint_id; - cluster_id = ZCL_ON_OFF_CLUSTER_ID; - attribute_id = ZCL_ON_OFF_ATTRIBUTE_ID; + cluster_id = OnOff::Id; + attribute_id = OnOff::Attributes::OnOff::Id; attribute::get_val_raw(endpoint_id, cluster_id, attribute_id, &value, sizeof(uint8_t)); val = esp_matter_bool(value); err |= app_driver_attribute_update(endpoint_id, cluster_id, attribute_id, &val); endpoint_id = light_endpoint_id; - cluster_id = ZCL_LEVEL_CONTROL_CLUSTER_ID; - attribute_id = ZCL_CURRENT_LEVEL_ATTRIBUTE_ID; + cluster_id = LevelControl::Id; + attribute_id = LevelControl::Attributes::CurrentLevel::Id; attribute::get_val_raw(endpoint_id, cluster_id, attribute_id, &value, sizeof(uint8_t)); val = esp_matter_uint8(value); err |= app_driver_attribute_update(endpoint_id, cluster_id, attribute_id, &val); endpoint_id = light_endpoint_id; - cluster_id = ZCL_COLOR_CONTROL_CLUSTER_ID; - attribute_id = ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID; + cluster_id = ColorControl::Id; + attribute_id = ColorControl::Attributes::CurrentHue::Id; attribute::get_val_raw(endpoint_id, cluster_id, attribute_id, &value, sizeof(uint8_t)); val = esp_matter_uint8(value); err |= app_driver_attribute_update(endpoint_id, cluster_id, attribute_id, &val); endpoint_id = light_endpoint_id; - cluster_id = ZCL_COLOR_CONTROL_CLUSTER_ID; - attribute_id = ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID; + cluster_id = ColorControl::Id; + attribute_id = ColorControl::Attributes::CurrentSaturation::Id; attribute::get_val_raw(endpoint_id, cluster_id, attribute_id, &value, sizeof(uint8_t)); val = esp_matter_uint8(value); err |= app_driver_attribute_update(endpoint_id, cluster_id, attribute_id, &val);