diff --git a/libraries/Zigbee/src/ep/ZigbeeDimmableLight.cpp b/libraries/Zigbee/src/ep/ZigbeeDimmableLight.cpp index 40edc5f74ba..e39cd36844d 100644 --- a/libraries/Zigbee/src/ep/ZigbeeDimmableLight.cpp +++ b/libraries/Zigbee/src/ep/ZigbeeDimmableLight.cpp @@ -8,7 +8,7 @@ ZigbeeDimmableLight::ZigbeeDimmableLight(uint8_t endpoint) : ZigbeeEP(endpoint) { _device_id = ESP_ZB_HA_DIMMABLE_LIGHT_DEVICE_ID; - esp_zb_dimmable_light_cfg_t light_cfg = ESP_ZB_DEFAULT_DIMMABLE_LIGHT_CONFIG(); + zigbee_dimmable_light_cfg_t light_cfg = ZIGBEE_DEFAULT_DIMMABLE_LIGHT_CONFIG(); _cluster_list = esp_zb_dimmable_light_clusters_create(&light_cfg); _ep_config = {.endpoint = _endpoint, .app_profile_id = ESP_ZB_AF_HA_PROFILE_ID, .app_device_id = ESP_ZB_HA_DIMMABLE_LIGHT_DEVICE_ID, .app_device_version = 0}; @@ -98,7 +98,7 @@ void ZigbeeDimmableLight::setLightLevel(uint8_t level) setLight(_current_state, level); } -esp_zb_cluster_list_t *ZigbeeDimmableLight::esp_zb_dimmable_light_clusters_create(esp_zb_dimmable_light_cfg_t *light_cfg) +esp_zb_cluster_list_t *ZigbeeDimmableLight::esp_zb_dimmable_light_clusters_create(zigbee_dimmable_light_cfg_t *light_cfg) { esp_zb_attribute_list_t *esp_zb_basic_cluster = esp_zb_basic_cluster_create(&light_cfg->basic_cfg); esp_zb_attribute_list_t *esp_zb_identify_cluster = esp_zb_identify_cluster_create(&light_cfg->identify_cfg); diff --git a/libraries/Zigbee/src/ep/ZigbeeDimmableLight.h b/libraries/Zigbee/src/ep/ZigbeeDimmableLight.h index df0f4324cd2..7e16d11b93b 100644 --- a/libraries/Zigbee/src/ep/ZigbeeDimmableLight.h +++ b/libraries/Zigbee/src/ep/ZigbeeDimmableLight.h @@ -15,66 +15,62 @@ * * */ -typedef struct esp_zb_dimmable_light_cfg_s -{ +typedef struct zigbee_dimmable_light_cfg_s { esp_zb_basic_cluster_cfg_t basic_cfg; /*!< Basic cluster configuration, @ref esp_zb_basic_cluster_cfg_s */ esp_zb_identify_cluster_cfg_t identify_cfg; /*!< Identify cluster configuration, @ref esp_zb_identify_cluster_cfg_s */ esp_zb_groups_cluster_cfg_t groups_cfg; /*!< Groups cluster configuration, @ref esp_zb_groups_cluster_cfg_s */ esp_zb_scenes_cluster_cfg_t scenes_cfg; /*!< Scenes cluster configuration, @ref esp_zb_scenes_cluster_cfg_s */ esp_zb_on_off_cluster_cfg_t on_off_cfg; /*!< On off cluster configuration, @ref esp_zb_on_off_cluster_cfg_s */ esp_zb_level_cluster_cfg_t level_cfg; /*!< Level cluster configuration, @ref esp_zb_level_cluster_cfg_s */ -} esp_zb_dimmable_light_cfg_t; +} zigbee_dimmable_light_cfg_t; /** * @brief Zigbee HA standard dimmable light device default config value. * Added here as not supported by ESP Zigbee library. * */ -#define ESP_ZB_DEFAULT_DIMMABLE_LIGHT_CONFIG() \ - { \ - .basic_cfg = \ - { \ - .zcl_version = ESP_ZB_ZCL_BASIC_ZCL_VERSION_DEFAULT_VALUE, \ - .power_source = ESP_ZB_ZCL_BASIC_POWER_SOURCE_DEFAULT_VALUE, \ - }, \ - .identify_cfg = \ - { \ - .identify_time = ESP_ZB_ZCL_IDENTIFY_IDENTIFY_TIME_DEFAULT_VALUE, \ - }, \ - .groups_cfg = \ - { \ - .groups_name_support_id = ESP_ZB_ZCL_GROUPS_NAME_SUPPORT_DEFAULT_VALUE, \ - }, \ - .scenes_cfg = \ - { \ - .scenes_count = ESP_ZB_ZCL_SCENES_SCENE_COUNT_DEFAULT_VALUE, \ - .current_scene = ESP_ZB_ZCL_SCENES_CURRENT_SCENE_DEFAULT_VALUE, \ - .current_group = ESP_ZB_ZCL_SCENES_CURRENT_GROUP_DEFAULT_VALUE, \ - .scene_valid = ESP_ZB_ZCL_SCENES_SCENE_VALID_DEFAULT_VALUE, \ - .name_support = ESP_ZB_ZCL_SCENES_NAME_SUPPORT_DEFAULT_VALUE, \ - }, \ - .on_off_cfg = \ - { \ - .on_off = ESP_ZB_ZCL_ON_OFF_ON_OFF_DEFAULT_VALUE, \ - }, \ - .level_cfg = \ - { \ - .current_level = ESP_ZB_ZCL_LEVEL_CONTROL_CURRENT_LEVEL_DEFAULT_VALUE, \ - }, \ +#define ZIGBEE_DEFAULT_DIMMABLE_LIGHT_CONFIG() \ + { \ + .basic_cfg = \ + { \ + .zcl_version = ESP_ZB_ZCL_BASIC_ZCL_VERSION_DEFAULT_VALUE, \ + .power_source = ESP_ZB_ZCL_BASIC_POWER_SOURCE_DEFAULT_VALUE, \ + }, \ + .identify_cfg = \ + { \ + .identify_time = ESP_ZB_ZCL_IDENTIFY_IDENTIFY_TIME_DEFAULT_VALUE, \ + }, \ + .groups_cfg = \ + { \ + .groups_name_support_id = ESP_ZB_ZCL_GROUPS_NAME_SUPPORT_DEFAULT_VALUE, \ + }, \ + .scenes_cfg = \ + { \ + .scenes_count = ESP_ZB_ZCL_SCENES_SCENE_COUNT_DEFAULT_VALUE, \ + .current_scene = ESP_ZB_ZCL_SCENES_CURRENT_SCENE_DEFAULT_VALUE, \ + .current_group = ESP_ZB_ZCL_SCENES_CURRENT_GROUP_DEFAULT_VALUE, \ + .scene_valid = ESP_ZB_ZCL_SCENES_SCENE_VALID_DEFAULT_VALUE, \ + .name_support = ESP_ZB_ZCL_SCENES_NAME_SUPPORT_DEFAULT_VALUE, \ + }, \ + .on_off_cfg = \ + { \ + .on_off = ESP_ZB_ZCL_ON_OFF_ON_OFF_DEFAULT_VALUE, \ + }, \ + .level_cfg = \ + { \ + .current_level = ESP_ZB_ZCL_LEVEL_CONTROL_CURRENT_LEVEL_DEFAULT_VALUE, \ + }, \ } -class ZigbeeDimmableLight : public ZigbeeEP -{ +class ZigbeeDimmableLight : public ZigbeeEP { public: ZigbeeDimmableLight(uint8_t endpoint); ~ZigbeeDimmableLight(); - void onLightChange(void (*callback)(bool, uint8_t)) - { + void onLightChange(void (*callback)(bool, uint8_t)) { _on_light_change = callback; } - void restoreLight() - { + void restoreLight() { lightChanged(); } @@ -82,12 +78,10 @@ class ZigbeeDimmableLight : public ZigbeeEP void setLightLevel(uint8_t level); void setLight(bool state, uint8_t level); - bool getLightState() - { + bool getLightState() { return _current_state; } - uint8_t getLightLevel() - { + uint8_t getLightLevel() { return _current_level; } @@ -103,15 +97,15 @@ class ZigbeeDimmableLight : public ZigbeeEP * Added here as not supported by ESP Zigbee library. * * @note This contains basic, identify, groups, scenes, on-off, level, as server side. - * @param[in] light_cfg Configuration parameters for this cluster lists defined by @ref esp_zb_dimmable_light_cfg_t + * @param[in] light_cfg Configuration parameters for this cluster lists defined by @ref zigbee_dimmable_light_cfg_t * * @return Pointer to cluster list @ref esp_zb_cluster_list_s * */ - esp_zb_cluster_list_t *esp_zb_dimmable_light_clusters_create(esp_zb_dimmable_light_cfg_t *light_cfg); + esp_zb_cluster_list_t *esp_zb_dimmable_light_clusters_create(zigbee_dimmable_light_cfg_t *light_cfg); bool _current_state; uint8_t _current_level; }; -#endif // SOC_IEEE802154_SUPPORTED +#endif // SOC_IEEE802154_SUPPORTED