Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8143717

Browse files
fix(zigbee): Fixes in handlers, destructors and co2 sensor delta reporting (#10834)
* fix(zigbee): Fix co2 sensor delta in reporting * fix(zigbee): Declare default empty destructors * fix(zigbee): Return on error in zigbee handlers
1 parent 2f423af commit 8143717

17 files changed

+26
-17
lines changed

‎libraries/Zigbee/src/ZigbeeCore.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ ZigbeeCore::ZigbeeCore() {
2929
}
3030
}
3131
}
32-
ZigbeeCore::~ZigbeeCore() {}
3332

3433
//forward declaration
3534
static esp_err_t zb_action_handler(esp_zb_core_action_callback_id_t callback_id, const void *message);

‎libraries/Zigbee/src/ZigbeeCore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class ZigbeeCore {
8686

8787
public:
8888
ZigbeeCore();
89-
~ZigbeeCore();
89+
~ZigbeeCore() {}
9090

9191
std::list<ZigbeeEP *> ep_objects;
9292

‎libraries/Zigbee/src/ZigbeeEP.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ ZigbeeEP::ZigbeeEP(uint8_t endpoint) {
2727
}
2828
}
2929

30-
ZigbeeEP::~ZigbeeEP() {}
31-
3230
void ZigbeeEP::setVersion(uint8_t version) {
3331
_ep_config.app_device_version = version;
3432
}

‎libraries/Zigbee/src/ZigbeeEP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ typedef enum {
5555
class ZigbeeEP {
5656
public:
5757
ZigbeeEP(uint8_t endpoint = 10);
58-
~ZigbeeEP();
58+
~ZigbeeEP() {}
5959

6060
// Set ep config and cluster list
6161
void setEpConfig(esp_zb_endpoint_config_t ep_config, esp_zb_cluster_list_t *cluster_list) {

‎libraries/Zigbee/src/ZigbeeHandlers.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ static esp_err_t zb_action_handler(esp_zb_core_action_callback_id_t callback_id,
2929
static esp_err_t zb_attribute_set_handler(const esp_zb_zcl_set_attr_value_message_t *message) {
3030
if (!message) {
3131
log_e("Empty message");
32+
return ESP_FAIL;
3233
}
3334
if (message->info.status != ESP_ZB_ZCL_STATUS_SUCCESS) {
3435
log_e("Received message: error status(%d)", message->info.status);
36+
return ESP_ERR_INVALID_ARG;
3537
}
3638

3739
log_v(
@@ -55,9 +57,11 @@ static esp_err_t zb_attribute_set_handler(const esp_zb_zcl_set_attr_value_messag
5557
static esp_err_t zb_attribute_reporting_handler(const esp_zb_zcl_report_attr_message_t *message) {
5658
if (!message) {
5759
log_e("Empty message");
60+
return ESP_FAIL;
5861
}
5962
if (message->status != ESP_ZB_ZCL_STATUS_SUCCESS) {
6063
log_e("Received message: error status(%d)", message->status);
64+
return ESP_ERR_INVALID_ARG;
6165
}
6266
log_v(
6367
"Received report from address(0x%x) src endpoint(%d) to dst endpoint(%d) cluster(0x%x)", message->src_address.u.short_addr, message->src_endpoint,
@@ -75,9 +79,11 @@ static esp_err_t zb_attribute_reporting_handler(const esp_zb_zcl_report_attr_mes
7579
static esp_err_t zb_cmd_read_attr_resp_handler(const esp_zb_zcl_cmd_read_attr_resp_message_t *message) {
7680
if (!message) {
7781
log_e("Empty message");
82+
return ESP_FAIL;
7883
}
7984
if (message->info.status != ESP_ZB_ZCL_STATUS_SUCCESS) {
8085
log_e("Received message: error status(%d)", message->info.status);
86+
return ESP_ERR_INVALID_ARG;
8187
}
8288
log_v(
8389
"Read attribute response: from address(0x%x) src endpoint(%d) to dst endpoint(%d) cluster(0x%x)", message->info.src_address.u.short_addr,
@@ -109,9 +115,11 @@ static esp_err_t zb_cmd_read_attr_resp_handler(const esp_zb_zcl_cmd_read_attr_re
109115
static esp_err_t zb_configure_report_resp_handler(const esp_zb_zcl_cmd_config_report_resp_message_t *message) {
110116
if (!message) {
111117
log_e("Empty message");
118+
return ESP_FAIL;
112119
}
113120
if (message->info.status != ESP_ZB_ZCL_STATUS_SUCCESS) {
114121
log_e("Received message: error status(%d)", message->info.status);
122+
return ESP_ERR_INVALID_ARG;
115123
}
116124
esp_zb_zcl_config_report_resp_variable_t *variable = message->variables;
117125
while (variable) {
@@ -127,9 +135,11 @@ static esp_err_t zb_configure_report_resp_handler(const esp_zb_zcl_cmd_config_re
127135
static esp_err_t zb_cmd_default_resp_handler(const esp_zb_zcl_cmd_default_resp_message_t *message) {
128136
if (!message) {
129137
log_e("Empty message");
138+
return ESP_FAIL;
130139
}
131140
if (message->info.status != ESP_ZB_ZCL_STATUS_SUCCESS) {
132141
log_e("Received message: error status(%d)", message->info.status);
142+
return ESP_ERR_INVALID_ARG;
133143
}
134144
log_v(
135145
"Received default response: from address(0x%x), src_endpoint(%d) to dst_endpoint(%d), cluster(0x%x) with status 0x%x",

‎libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@ void ZigbeeCarbonDioxideSensor::setReporting(uint16_t min_interval, uint16_t max
5656
reporting_info.u.send_info.max_interval = max_interval;
5757
reporting_info.u.send_info.def_min_interval = min_interval;
5858
reporting_info.u.send_info.def_max_interval = max_interval;
59-
reporting_info.u.send_info.delta.u16 = delta;
6059
reporting_info.dst.profile_id = ESP_ZB_AF_HA_PROFILE_ID;
6160
reporting_info.manuf_code = ESP_ZB_ZCL_ATTR_NON_MANUFACTURER_SPECIFIC;
61+
float delta_f = delta / 1000000.0f;
62+
memcpy(&reporting_info.u.send_info.delta.s32, &delta_f, sizeof(float));
63+
6264
esp_zb_lock_acquire(portMAX_DELAY);
6365
esp_zb_zcl_update_reporting_info(&reporting_info);
6466
esp_zb_lock_release();

‎libraries/Zigbee/src/ep/ZigbeeCarbonDioxideSensor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ typedef struct zigbee_carbon_dioxide_sensor_cfg_s {
3939
class ZigbeeCarbonDioxideSensor : public ZigbeeEP {
4040
public:
4141
ZigbeeCarbonDioxideSensor(uint8_t endpoint);
42-
~ZigbeeCarbonDioxideSensor();
42+
~ZigbeeCarbonDioxideSensor() {}
4343

4444
// Set the carbon dioxide value in ppm
4545
void setCarbonDioxide(float carbon_dioxide);

‎libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class ZigbeeColorDimmableLight : public ZigbeeEP {
1313
public:
1414
ZigbeeColorDimmableLight(uint8_t endpoint);
15-
~ZigbeeColorDimmableLight();
15+
~ZigbeeColorDimmableLight() {}
1616

1717
void onLightChange(void (*callback)(bool, uint8_t, uint8_t, uint8_t, uint8_t)) {
1818
_on_light_change = callback;

‎libraries/Zigbee/src/ep/ZigbeeColorDimmerSwitch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class ZigbeeColorDimmerSwitch : public ZigbeeEP {
1313
public:
1414
ZigbeeColorDimmerSwitch(uint8_t endpoint);
15-
~ZigbeeColorDimmerSwitch();
15+
~ZigbeeColorDimmerSwitch() {}
1616

1717
// methods to control the color dimmable light
1818
void lightToggle();

‎libraries/Zigbee/src/ep/ZigbeeDimmableLight.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ typedef struct zigbee_dimmable_light_cfg_s {
6767
class ZigbeeDimmableLight : public ZigbeeEP {
6868
public:
6969
ZigbeeDimmableLight(uint8_t endpoint);
70-
~ZigbeeDimmableLight();
70+
~ZigbeeDimmableLight() {}
7171

7272
void onLightChange(void (*callback)(bool, uint8_t)) {
7373
_on_light_change = callback;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /