Skip to content

Commit 9dded6d

Browse files
authored
fix(zigbee): Place default handler to the end
1 parent 5b51d68 commit 9dded6d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Diff for: libraries/Zigbee/src/ZigbeeHandlers.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static esp_err_t zb_configure_report_resp_handler(const esp_zb_zcl_cmd_config_re
134134
return ESP_OK;
135135
}
136136

137-
static esp_err_t zb_cmd_default_resp_handler(const esp_zb_zcl_cmd_default_resp_message_t *message) {
137+
static esp_err_t zb_cmd_ias_zone_status_change_handler(const esp_zb_zcl_ias_zone_status_change_notification_message_t *message) {
138138
if (!message) {
139139
log_e("Empty message");
140140
return ESP_FAIL;
@@ -144,13 +144,19 @@ static esp_err_t zb_cmd_default_resp_handler(const esp_zb_zcl_cmd_default_resp_m
144144
return ESP_ERR_INVALID_ARG;
145145
}
146146
log_v(
147-
"Received default response: from address(0x%x), src_endpoint(%d) to dst_endpoint(%d), cluster(0x%x) with status 0x%x",
148-
message->info.src_address.u.short_addr, message->info.src_endpoint, message->info.dst_endpoint, message->info.cluster, message->status_code
147+
"IAS Zone Status Notification: from address(0x%x) src endpoint(%d) to dst endpoint(%d) cluster(0x%x)", message->info.src_address.u.short_addr,
148+
message->info.src_endpoint, message->info.dst_endpoint, message->info.cluster
149149
);
150+
151+
for (std::list<ZigbeeEP *>::iterator it = Zigbee.ep_objects.begin(); it != Zigbee.ep_objects.end(); ++it) {
152+
if (message->info.dst_endpoint == (*it)->getEndpoint()) {
153+
(*it)->zbIASZoneStatusChangeNotification(message);
154+
}
155+
}
150156
return ESP_OK;
151157
}
152158

153-
static esp_err_t zb_cmd_ias_zone_status_change_handler(const esp_zb_zcl_ias_zone_status_change_notification_message_t *message) {
159+
static esp_err_t zb_cmd_default_resp_handler(const esp_zb_zcl_cmd_default_resp_message_t *message) {
154160
if (!message) {
155161
log_e("Empty message");
156162
return ESP_FAIL;
@@ -160,15 +166,9 @@ static esp_err_t zb_cmd_ias_zone_status_change_handler(const esp_zb_zcl_ias_zone
160166
return ESP_ERR_INVALID_ARG;
161167
}
162168
log_v(
163-
"IAS Zone Status Notification: from address(0x%x) src endpoint(%d) to dst endpoint(%d) cluster(0x%x)", message->info.src_address.u.short_addr,
164-
message->info.src_endpoint, message->info.dst_endpoint, message->info.cluster
169+
"Received default response: from address(0x%x), src_endpoint(%d) to dst_endpoint(%d), cluster(0x%x) with status 0x%x",
170+
message->info.src_address.u.short_addr, message->info.src_endpoint, message->info.dst_endpoint, message->info.cluster, message->status_code
165171
);
166-
167-
for (std::list<ZigbeeEP *>::iterator it = Zigbee.ep_objects.begin(); it != Zigbee.ep_objects.end(); ++it) {
168-
if (message->info.dst_endpoint == (*it)->getEndpoint()) {
169-
(*it)->zbIASZoneStatusChangeNotification(message);
170-
}
171-
}
172172
return ESP_OK;
173173
}
174174

0 commit comments

Comments
 (0)