@@ -60,7 +60,7 @@ bool ZigbeeEP::setManufacturerAndModel(const char *name, const char *model) {
6060 log_e (" Failed to set manufacturer: 0x%x: %s" , ret_name, esp_err_to_name (ret_name));
6161 }
6262 esp_err_t ret_model = esp_zb_basic_cluster_add_attr (basic_cluster, ESP_ZB_ZCL_ATTR_BASIC_MODEL_IDENTIFIER_ID, (void *)zb_model);
63- if (ret_model != ESP_OK) {
63+ if (ret_model != ESP_OK) {
6464 log_e (" Failed to set model: 0x%x: %s" , ret_model, esp_err_to_name (ret_model));
6565 }
6666 delete[] zb_name;
@@ -112,7 +112,7 @@ bool ZigbeeEP::setBatteryPercentage(uint8_t percentage) {
112112 false
113113 );
114114 esp_zb_lock_release ();
115- if (ret != ESP_ZB_ZCL_STATUS_SUCCESS) {
115+ if (ret != ESP_ZB_ZCL_STATUS_SUCCESS) {
116116 log_e (" Failed to set battery percentage: 0x%x: %s" , ret, esp_zb_zcl_status_to_name (ret));
117117 return false ;
118118 }
@@ -133,7 +133,7 @@ bool ZigbeeEP::reportBatteryPercentage() {
133133 esp_zb_lock_acquire (portMAX_DELAY);
134134 esp_err_t ret = esp_zb_zcl_report_attr_cmd_req (&report_attr_cmd);
135135 esp_zb_lock_release ();
136- if (ret != ESP_OK) {
136+ if (ret != ESP_OK) {
137137 log_e (" Failed to report battery percentage: 0x%x: %s" , ret, esp_err_to_name (ret));
138138 return false ;
139139 }
@@ -321,7 +321,7 @@ bool ZigbeeEP::setTime(tm time) {
321321 esp_zb_lock_acquire (portMAX_DELAY);
322322 ret = esp_zb_zcl_set_attribute_val (_endpoint, ESP_ZB_ZCL_CLUSTER_ID_TIME, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_TIME_TIME_ID, &utc_time, false );
323323 esp_zb_lock_release ();
324- if (ret != ESP_ZB_ZCL_STATUS_SUCCESS) {
324+ if (ret != ESP_ZB_ZCL_STATUS_SUCCESS) {
325325 log_e (" Failed to set time: 0x%x: %s" , ret, esp_zb_zcl_status_to_name (ret));
326326 return false ;
327327 }
@@ -332,9 +332,10 @@ bool ZigbeeEP::setTimezone(int32_t gmt_offset) {
332332 esp_zb_zcl_status_t ret = ESP_ZB_ZCL_STATUS_SUCCESS;
333333 log_d (" Setting timezone to %d" , gmt_offset);
334334 esp_zb_lock_acquire (portMAX_DELAY);
335- ret = esp_zb_zcl_set_attribute_val (_endpoint, ESP_ZB_ZCL_CLUSTER_ID_TIME, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_TIME_TIME_ZONE_ID, &gmt_offset, false );
335+ ret =
336+ esp_zb_zcl_set_attribute_val (_endpoint, ESP_ZB_ZCL_CLUSTER_ID_TIME, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_TIME_TIME_ZONE_ID, &gmt_offset, false );
336337 esp_zb_lock_release ();
337- if (ret != ESP_ZB_ZCL_STATUS_SUCCESS) {
338+ if (ret != ESP_ZB_ZCL_STATUS_SUCCESS) {
338339 log_e (" Failed to set timezone: 0x%x: %s" , ret, esp_zb_zcl_status_to_name (ret));
339340 return false ;
340341 }
@@ -528,76 +529,42 @@ void ZigbeeEP::requestOTAUpdate() {
528529 esp_zb_lock_release ();
529530}
530531
531- const char * ZigbeeEP::esp_zb_zcl_status_to_name (esp_zb_zcl_status_t status) {
532+ const char * ZigbeeEP::esp_zb_zcl_status_to_name (esp_zb_zcl_status_t status) {
532533 switch (status) {
533- case ESP_ZB_ZCL_STATUS_SUCCESS:
534- return " Success" ;
535- case ESP_ZB_ZCL_STATUS_FAIL:
536- return " Fail" ;
537- case ESP_ZB_ZCL_STATUS_NOT_AUTHORIZED:
538- return " Not authorized" ;
539- case ESP_ZB_ZCL_STATUS_MALFORMED_CMD:
540- return " Malformed command" ;
541- case ESP_ZB_ZCL_STATUS_UNSUP_CLUST_CMD:
542- return " Unsupported cluster command" ;
543- case ESP_ZB_ZCL_STATUS_UNSUP_GEN_CMD:
544- return " Unsupported general command" ;
545- case ESP_ZB_ZCL_STATUS_UNSUP_MANUF_CLUST_CMD:
546- return " Unsupported manufacturer cluster command" ;
547- case ESP_ZB_ZCL_STATUS_UNSUP_MANUF_GEN_CMD:
548- return " Unsupported manufacturer general command" ;
549- case ESP_ZB_ZCL_STATUS_INVALID_FIELD:
550- return " Invalid field" ;
551- case ESP_ZB_ZCL_STATUS_UNSUP_ATTRIB:
552- return " Unsupported attribute" ;
553- case ESP_ZB_ZCL_STATUS_INVALID_VALUE:
554- return " Invalid value" ;
555- case ESP_ZB_ZCL_STATUS_READ_ONLY:
556- return " Read only" ;
557- case ESP_ZB_ZCL_STATUS_INSUFF_SPACE:
558- return " Insufficient space" ;
559- case ESP_ZB_ZCL_STATUS_DUPE_EXISTS:
560- return " Duplicate exists" ;
561- case ESP_ZB_ZCL_STATUS_NOT_FOUND:
562- return " Not found" ;
563- case ESP_ZB_ZCL_STATUS_UNREPORTABLE_ATTRIB:
564- return " Unreportable attribute" ;
565- case ESP_ZB_ZCL_STATUS_INVALID_TYPE:
566- return " Invalid type" ;
567- case ESP_ZB_ZCL_STATUS_WRITE_ONLY:
568- return " Write only" ;
569- case ESP_ZB_ZCL_STATUS_INCONSISTENT:
570- return " Inconsistent" ;
571- case ESP_ZB_ZCL_STATUS_ACTION_DENIED:
572- return " Action denied" ;
573- case ESP_ZB_ZCL_STATUS_TIMEOUT:
574- return " Timeout" ;
575- case ESP_ZB_ZCL_STATUS_ABORT:
576- return " Abort" ;
577- case ESP_ZB_ZCL_STATUS_INVALID_IMAGE:
578- return " Invalid OTA upgrade image" ;
579- case ESP_ZB_ZCL_STATUS_WAIT_FOR_DATA:
580- return " Server does not have data block available yet" ;
581- case ESP_ZB_ZCL_STATUS_NO_IMAGE_AVAILABLE:
582- return " No image available" ;
583- case ESP_ZB_ZCL_STATUS_REQUIRE_MORE_IMAGE:
584- return " Require more image" ;
585- case ESP_ZB_ZCL_STATUS_NOTIFICATION_PENDING:
586- return " Notification pending" ;
587- case ESP_ZB_ZCL_STATUS_HW_FAIL:
588- return " Hardware failure" ;
589- case ESP_ZB_ZCL_STATUS_SW_FAIL:
590- return " Software failure" ;
591- case ESP_ZB_ZCL_STATUS_CALIB_ERR:
592- return " Calibration error" ;
593- case ESP_ZB_ZCL_STATUS_UNSUP_CLUST:
594- return " Cluster is not found on the target endpoint" ;
595- case ESP_ZB_ZCL_STATUS_LIMIT_REACHED:
596- return " Limit reached" ;
597- default :
598- return " Unknown status" ;
534+ case ESP_ZB_ZCL_STATUS_SUCCESS: return " Success" ;
535+ case ESP_ZB_ZCL_STATUS_FAIL: return " Fail" ;
536+ case ESP_ZB_ZCL_STATUS_NOT_AUTHORIZED: return " Not authorized" ;
537+ case ESP_ZB_ZCL_STATUS_MALFORMED_CMD: return " Malformed command" ;
538+ case ESP_ZB_ZCL_STATUS_UNSUP_CLUST_CMD: return " Unsupported cluster command" ;
539+ case ESP_ZB_ZCL_STATUS_UNSUP_GEN_CMD: return " Unsupported general command" ;
540+ case ESP_ZB_ZCL_STATUS_UNSUP_MANUF_CLUST_CMD: return " Unsupported manufacturer cluster command" ;
541+ case ESP_ZB_ZCL_STATUS_UNSUP_MANUF_GEN_CMD: return " Unsupported manufacturer general command" ;
542+ case ESP_ZB_ZCL_STATUS_INVALID_FIELD: return " Invalid field" ;
543+ case ESP_ZB_ZCL_STATUS_UNSUP_ATTRIB: return " Unsupported attribute" ;
544+ case ESP_ZB_ZCL_STATUS_INVALID_VALUE: return " Invalid value" ;
545+ case ESP_ZB_ZCL_STATUS_READ_ONLY: return " Read only" ;
546+ case ESP_ZB_ZCL_STATUS_INSUFF_SPACE: return " Insufficient space" ;
547+ case ESP_ZB_ZCL_STATUS_DUPE_EXISTS: return " Duplicate exists" ;
548+ case ESP_ZB_ZCL_STATUS_NOT_FOUND: return " Not found" ;
549+ case ESP_ZB_ZCL_STATUS_UNREPORTABLE_ATTRIB: return " Unreportable attribute" ;
550+ case ESP_ZB_ZCL_STATUS_INVALID_TYPE: return " Invalid type" ;
551+ case ESP_ZB_ZCL_STATUS_WRITE_ONLY: return " Write only" ;
552+ case ESP_ZB_ZCL_STATUS_INCONSISTENT: return " Inconsistent" ;
553+ case ESP_ZB_ZCL_STATUS_ACTION_DENIED: return " Action denied" ;
554+ case ESP_ZB_ZCL_STATUS_TIMEOUT: return " Timeout" ;
555+ case ESP_ZB_ZCL_STATUS_ABORT: return " Abort" ;
556+ case ESP_ZB_ZCL_STATUS_INVALID_IMAGE: return " Invalid OTA upgrade image" ;
557+ case ESP_ZB_ZCL_STATUS_WAIT_FOR_DATA: return " Server does not have data block available yet" ;
558+ case ESP_ZB_ZCL_STATUS_NO_IMAGE_AVAILABLE: return " No image available" ;
559+ case ESP_ZB_ZCL_STATUS_REQUIRE_MORE_IMAGE: return " Require more image" ;
560+ case ESP_ZB_ZCL_STATUS_NOTIFICATION_PENDING: return " Notification pending" ;
561+ case ESP_ZB_ZCL_STATUS_HW_FAIL: return " Hardware failure" ;
562+ case ESP_ZB_ZCL_STATUS_SW_FAIL: return " Software failure" ;
563+ case ESP_ZB_ZCL_STATUS_CALIB_ERR: return " Calibration error" ;
564+ case ESP_ZB_ZCL_STATUS_UNSUP_CLUST: return " Cluster is not found on the target endpoint" ;
565+ case ESP_ZB_ZCL_STATUS_LIMIT_REACHED: return " Limit reached" ;
566+ default : return " Unknown status" ;
599567 }
600568}
601569
602-
603570#endif // CONFIG_ZB_ENABLED
0 commit comments