fix(zigbee): Return on error in zigbee handlers · espressif/arduino-esp32@99448db (original) (raw)

`@@ -29,9 +29,11 @@ static esp_err_t zb_action_handler(esp_zb_core_action_callback_id_t callback_id,

`

29

29

`static esp_err_t zb_attribute_set_handler(const esp_zb_zcl_set_attr_value_message_t *message) {

`

30

30

`if (!message) {

`

31

31

`log_e("Empty message");

`

``

32

`+

return ESP_FAIL;

`

32

33

` }

`

33

34

`if (message->info.status != ESP_ZB_ZCL_STATUS_SUCCESS) {

`

34

35

`log_e("Received message: error status(%d)", message->info.status);

`

``

36

`+

return ESP_ERR_INVALID_ARG;

`

35

37

` }

`

36

38

``

37

39

`log_v(

`

`@@ -55,9 +57,11 @@ static esp_err_t zb_attribute_set_handler(const esp_zb_zcl_set_attr_value_messag

`

55

57

`static esp_err_t zb_attribute_reporting_handler(const esp_zb_zcl_report_attr_message_t *message) {

`

56

58

`if (!message) {

`

57

59

`log_e("Empty message");

`

``

60

`+

return ESP_FAIL;

`

58

61

` }

`

59

62

`if (message->status != ESP_ZB_ZCL_STATUS_SUCCESS) {

`

60

63

`log_e("Received message: error status(%d)", message->status);

`

``

64

`+

return ESP_ERR_INVALID_ARG;

`

61

65

` }

`

62

66

`log_v(

`

63

67

`"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

`

75

79

`static esp_err_t zb_cmd_read_attr_resp_handler(const esp_zb_zcl_cmd_read_attr_resp_message_t *message) {

`

76

80

`if (!message) {

`

77

81

`log_e("Empty message");

`

``

82

`+

return ESP_FAIL;

`

78

83

` }

`

79

84

`if (message->info.status != ESP_ZB_ZCL_STATUS_SUCCESS) {

`

80

85

`log_e("Received message: error status(%d)", message->info.status);

`

``

86

`+

return ESP_ERR_INVALID_ARG;

`

81

87

` }

`

82

88

`log_v(

`

83

89

`"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

`

109

115

`static esp_err_t zb_configure_report_resp_handler(const esp_zb_zcl_cmd_config_report_resp_message_t *message) {

`

110

116

`if (!message) {

`

111

117

`log_e("Empty message");

`

``

118

`+

return ESP_FAIL;

`

112

119

` }

`

113

120

`if (message->info.status != ESP_ZB_ZCL_STATUS_SUCCESS) {

`

114

121

`log_e("Received message: error status(%d)", message->info.status);

`

``

122

`+

return ESP_ERR_INVALID_ARG;

`

115

123

` }

`

116

124

`esp_zb_zcl_config_report_resp_variable_t *variable = message->variables;

`

117

125

`while (variable) {

`

`@@ -127,9 +135,11 @@ static esp_err_t zb_configure_report_resp_handler(const esp_zb_zcl_cmd_config_re

`

127

135

`static esp_err_t zb_cmd_default_resp_handler(const esp_zb_zcl_cmd_default_resp_message_t *message) {

`

128

136

`if (!message) {

`

129

137

`log_e("Empty message");

`

``

138

`+

return ESP_FAIL;

`

130

139

` }

`

131

140

`if (message->info.status != ESP_ZB_ZCL_STATUS_SUCCESS) {

`

132

141

`log_e("Received message: error status(%d)", message->info.status);

`

``

142

`+

return ESP_ERR_INVALID_ARG;

`

133

143

` }

`

134

144

`log_v(

`

135

145

`"Received default response: from address(0x%x), src_endpoint(%d) to dst_endpoint(%d), cluster(0x%x) with status 0x%x",

`