mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Merge branch 'fix/refactor-update-report-attribute-utils-1-4-2' into 'release/v1.4.2'
[v1.4.2] propagate error code from attribute update/report See merge request app-frameworks/esp-matter!1467
This commit is contained in:
+3
-2
@@ -745,9 +745,10 @@ check_typos:
|
||||
stage: check_typos
|
||||
script:
|
||||
- pip install codespell
|
||||
- git fetch origin main
|
||||
# Use target branch for MR pipelines, fallback to main for branch push pipelines
|
||||
- git fetch origin ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-main}
|
||||
- |
|
||||
FILES=$(git diff --name-only origin/main...HEAD)
|
||||
FILES=$(git diff --name-only origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-main}...HEAD)
|
||||
echo "change files: $FILES"
|
||||
if [ -n "$FILES" ]; then
|
||||
./tools/check_typos.sh $FILES
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
|
||||
// Copyright 2021-2026 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@@ -536,7 +536,7 @@ static esp_err_t console_set_handler(int argc, char **argv)
|
||||
attribute_id);
|
||||
VerifyOrReturnError(matter_attribute, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Matter attribute not found"));
|
||||
|
||||
/* Use the type to create the val and then update te attribute */
|
||||
/* Use the type to create the val and then update the attribute */
|
||||
esp_matter_val_type_t type = get_val_type_from_attribute_type(matter_attribute->attributeType);
|
||||
esp_matter_attr_val_t val = esp_matter_invalid(NULL);
|
||||
if (type == ESP_MATTER_VAL_TYPE_BOOLEAN) {
|
||||
@@ -2069,7 +2069,8 @@ esp_err_t update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_i
|
||||
}
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
get_data_from_attr_val(val, &attribute_type, &attribute_size, value);
|
||||
/* Ignore return value: identical call succeeded above with NULL value buffer */
|
||||
(void)get_data_from_attr_val(val, &attribute_type, &attribute_size, value);
|
||||
|
||||
/* Update matter */
|
||||
Status status = Status::Success;
|
||||
@@ -2112,7 +2113,15 @@ esp_err_t report(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_i
|
||||
|
||||
/* Update attribute */
|
||||
esp_matter_attr_val_t raw_val = esp_matter_invalid(NULL);
|
||||
attribute::get_val(attribute, &raw_val);
|
||||
esp_err_t err = attribute::get_val(attribute, &raw_val);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to get the attribute value for Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " err: %d",
|
||||
endpoint_id, cluster_id, attribute_id, err);
|
||||
if (lock_status == lock::SUCCESS) {
|
||||
lock::chip_stack_unlock();
|
||||
}
|
||||
return err;
|
||||
}
|
||||
if (val->type != raw_val.type) {
|
||||
ESP_LOGE(TAG, "Attribute type mismatch when trying to report Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32,
|
||||
endpoint_id, cluster_id, attribute_id);
|
||||
@@ -2121,7 +2130,15 @@ esp_err_t report(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_i
|
||||
}
|
||||
return ESP_FAIL;
|
||||
}
|
||||
attribute::set_val(attribute, val);
|
||||
err = attribute::set_val(attribute, val);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to set attribute value for Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " err: %d",
|
||||
endpoint_id, cluster_id, attribute_id, err);
|
||||
if (lock_status == lock::SUCCESS) {
|
||||
lock::chip_stack_unlock();
|
||||
}
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
/* Report attribute */
|
||||
MatterReportingAttributeChangeCallback(endpoint_id, cluster_id, attribute_id);
|
||||
|
||||
Reference in New Issue
Block a user