mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 11:03:05 +00:00
update for matter 1.1 sve
Fixes after reboot issues, INVALID attribute val type was set, failing to read attribute. Commissioner was reading attribute val by stripping first byte. Unable to update attribute val. Closes : https://github.com/espressif/esp-matter/issues/148
This commit is contained in:
@@ -27,9 +27,7 @@ set(SRC_DIRS_LIST "."
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/general-commissioning-server"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/general-diagnostics-server"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/group-key-mgmt-server"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/groups-client"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/groups-server"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/identify-client"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/identify-server"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/keypad-input-server"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/level-control"
|
||||
@@ -49,7 +47,6 @@ set(SRC_DIRS_LIST "."
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/pump-configuration-and-control-client"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/pump-configuration-and-control-server"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/scenes"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/scenes-client"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/software-diagnostics-server"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/switch-server"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/target-navigator-server"
|
||||
|
||||
@@ -55,13 +55,6 @@ typedef enum cluster_flags {
|
||||
CLUSTER_FLAG_INIT_FUNCTION = CLUSTER_MASK_INIT_FUNCTION, /* 0x01 */
|
||||
/** The cluster has an attribute changed function (function_flag) */
|
||||
CLUSTER_FLAG_ATTRIBUTE_CHANGED_FUNCTION = CLUSTER_MASK_ATTRIBUTE_CHANGED_FUNCTION, /* 0x02 */
|
||||
/** The cluster has a default response function (function_flag) */
|
||||
CLUSTER_FLAG_DEFAULT_RESPONSE_FUNCTION = CLUSTER_MASK_DEFAULT_RESPONSE_FUNCTION, /* 0x04 */
|
||||
/** The cluster has a message sent function (function_flag) */
|
||||
CLUSTER_FLAG_MESSAGE_SENT_FUNCTION = CLUSTER_MASK_MESSAGE_SENT_FUNCTION, /* 0x08 */
|
||||
/** The cluster has a manufacturer specific attribute changed function (function_flag) */
|
||||
CLUSTER_FLAG_MANUFACTURER_SPECIFIC_ATTRIBUTE_CHANGED_FUNCTION =
|
||||
CLUSTER_MASK_MANUFACTURER_SPECIFIC_ATTRIBUTE_CHANGED_FUNCTION, /* 0x10 */
|
||||
/** The cluster has a pre attribute changed function (function_flag) */
|
||||
CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION = CLUSTER_MASK_PRE_ATTRIBUTE_CHANGED_FUNCTION, /* 0x20 */
|
||||
/** The cluster is a server cluster */
|
||||
|
||||
@@ -1645,7 +1645,7 @@ esp_err_t get_val_raw(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attrib
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
EmberAfStatus status = emberAfReadServerAttribute(endpoint_id, cluster_id, attribute_id, value, attribute_size);
|
||||
EmberAfStatus status = emberAfReadAttribute(endpoint_id, cluster_id, attribute_id, value, attribute_size);
|
||||
if (status != EMBER_ZCL_STATUS_SUCCESS) {
|
||||
ESP_LOGE(TAG, "Error getting raw value from matter: 0x%x", status);
|
||||
if (lock_status == lock::SUCCESS) {
|
||||
@@ -1687,7 +1687,7 @@ esp_err_t update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_i
|
||||
/* Update matter */
|
||||
EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
|
||||
if (emberAfContainsServer(endpoint_id, cluster_id)) {
|
||||
status = emberAfWriteServerAttribute(endpoint_id, cluster_id, attribute_id, value, attribute_type);
|
||||
status = emberAfWriteAttribute(endpoint_id, cluster_id, attribute_id, value, attribute_type);
|
||||
if (status != EMBER_ZCL_STATUS_SUCCESS) {
|
||||
ESP_LOGE(TAG, "Error updating attribute to matter: 0x%X", status);
|
||||
free(value);
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <app-common/zap-generated/callback.h>
|
||||
#include <app/InteractionModelEngine.h>
|
||||
#include <app/util/af.h>
|
||||
#include <app/util/ember-compatibility-functions.h>
|
||||
|
||||
using namespace chip::app::Clusters;
|
||||
using chip::app::CommandHandler;
|
||||
@@ -56,8 +55,8 @@ void DispatchSingleClusterCommandCommon(const ConcreteCommandPath &command_path,
|
||||
}
|
||||
int flags = get_flags(command);
|
||||
if (flags & COMMAND_FLAG_CUSTOM) {
|
||||
EmberAfStatus status = (err == ESP_OK) ? EMBER_ZCL_STATUS_SUCCESS : EMBER_ZCL_STATUS_FAILURE;
|
||||
emberAfSendImmediateDefaultResponse(status);
|
||||
CommandHandler *command_handler = (CommandHandler *)opaque_ptr;
|
||||
command_handler->AddStatus(command_path, (err == ESP_OK) ? (chip::Protocols::InteractionModel::Status::Success) : (chip::Protocols::InteractionModel::Status::Failure));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,11 +69,7 @@ namespace app {
|
||||
void DispatchSingleClusterCommand(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
|
||||
CommandHandler *command_obj)
|
||||
{
|
||||
Compatibility::SetupEmberAfCommandHandler(command_obj, command_path);
|
||||
|
||||
esp_matter::command::DispatchSingleClusterCommandCommon(command_path, tlv_data, command_obj);
|
||||
|
||||
Compatibility::ResetEmberAfObjects();
|
||||
}
|
||||
|
||||
} /* namespace app */
|
||||
@@ -1377,7 +1372,7 @@ namespace command {
|
||||
|
||||
command_t *create_test_event_trigger(cluster_t *cluster)
|
||||
{
|
||||
return esp_matter::command::create(cluster, GeneralDiagnostics::Commands::TestEventTrigger::Id, COMMAND_FLAG_ACCEPTED,
|
||||
return esp_matter::command::create(cluster, GeneralDiagnostics::Commands::TestEventTrigger::Id, COMMAND_FLAG_ACCEPTED,
|
||||
esp_matter_command_callback_test_event_trigger);
|
||||
}
|
||||
|
||||
|
||||
@@ -990,6 +990,17 @@ attribute_t *create(cluster_t *cluster, uint32_t attribute_id, uint8_t flags, es
|
||||
attribute->endpoint_id = current_cluster->endpoint_id;
|
||||
attribute->flags = flags;
|
||||
attribute->flags |= ATTRIBUTE_FLAG_EXTERNAL_STORAGE;
|
||||
|
||||
// After reboot, string and array are treated as Invalid. So need to store val.type and size of attribute value.
|
||||
attribute->val.type = val.type;
|
||||
if (val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING ||
|
||||
val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING ||
|
||||
val.type == ESP_MATTER_VAL_TYPE_ARRAY) {
|
||||
attribute->val.val.a.s = val.val.a.s;
|
||||
attribute->val.val.a.n = val.val.a.n;
|
||||
attribute->val.val.a.t = val.val.a.t;
|
||||
}
|
||||
|
||||
if (attribute->flags & ATTRIBUTE_FLAG_NONVOLATILE) {
|
||||
esp_matter_attr_val_t val_nvs = esp_matter_invalid(NULL);
|
||||
esp_err_t err = get_val_from_nvs((attribute_t *)attribute, &val_nvs);
|
||||
@@ -1109,6 +1120,7 @@ esp_err_t set_val(attribute_t *attribute, esp_matter_attr_val_t *val)
|
||||
/* Free old buf */
|
||||
if (current_attribute->val.val.a.b) {
|
||||
free(current_attribute->val.val.a.b);
|
||||
current_attribute->val.val.a.b = NULL;
|
||||
}
|
||||
if (val->val.a.s > 0) {
|
||||
/* Alloc new buf */
|
||||
@@ -1119,13 +1131,17 @@ esp_err_t set_val(attribute_t *attribute, esp_matter_attr_val_t *val)
|
||||
}
|
||||
/* Copy to new buf and assign */
|
||||
memcpy(new_buf, val->val.a.b, val->val.a.s);
|
||||
val->val.a.b = new_buf;
|
||||
current_attribute->val.val.a.b = new_buf;
|
||||
current_attribute->val.val.a.s = val->val.a.s;
|
||||
current_attribute->val.val.a.n = val->val.a.n;
|
||||
current_attribute->val.val.a.t = val->val.a.t;
|
||||
} else {
|
||||
ESP_LOGD(TAG, "Set val called with string with size 0");
|
||||
val->val.a.b = NULL;
|
||||
}
|
||||
} else {
|
||||
memcpy((void *)¤t_attribute->val, (void *)val, sizeof(esp_matter_attr_val_t));
|
||||
}
|
||||
memcpy((void *)¤t_attribute->val, (void *)val, sizeof(esp_matter_attr_val_t));
|
||||
|
||||
if (current_attribute->flags & ATTRIBUTE_FLAG_NONVOLATILE) {
|
||||
store_val_in_nvs(attribute);
|
||||
}
|
||||
|
||||
@@ -32,15 +32,11 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
|
||||
(void)clusterId;
|
||||
}
|
||||
|
||||
void __attribute__((weak)) emberAfAddToCurrentAppTasksCallback(EmberAfApplicationTask tasks) {}
|
||||
|
||||
void __attribute__((weak)) emberAfRemoveFromCurrentAppTasksCallback(EmberAfApplicationTask tasks) {}
|
||||
|
||||
EmberAfAttributeWritePermission __attribute__((weak))
|
||||
emberAfAllowNetworkWriteAttributeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId,uint8_t * value,
|
||||
emberAfAllowNetworkWriteAttributeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId,uint8_t * value,
|
||||
uint8_t type)
|
||||
{
|
||||
return EMBER_ZCL_ATTRIBUTE_WRITE_PERMISSION_ALLOW_WRITE_NORMAL; // Default
|
||||
return EmberAfAttributeWritePermission::AllowWriteNormal; // Default
|
||||
}
|
||||
|
||||
bool __attribute__((weak)) emberAfAttributeReadAccessCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId)
|
||||
@@ -58,36 +54,13 @@ bool __attribute__((weak)) emberAfDefaultResponseCallback(ClusterId clusterId, C
|
||||
return false;
|
||||
}
|
||||
|
||||
bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberStatus * status)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool __attribute__((weak)) emberAfMessageSentCallback(const MessageSendDestination & destination, EmberApsFrame * apsFrame,
|
||||
uint16_t msgLen, uint8_t * message, EmberStatus status)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t __attribute__((weak)) emberAfGetCurrentTimeCallback()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool __attribute__((weak))
|
||||
emberAfGetEndpointInfoCallback(EndpointId endpoint, uint8_t * returnNetworkIndex, EmberAfEndpointInfoStruct * returnEndpointInfo)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void __attribute__((weak)) emberAfRegistrationAbortCallback() {}
|
||||
|
||||
EmberStatus __attribute__((weak))
|
||||
emberAfInterpanSendMessageCallback(EmberAfInterpanHeader * header, uint16_t messageLength, uint8_t * message)
|
||||
{
|
||||
return EMBER_LIBRARY_NOT_PRESENT;
|
||||
}
|
||||
|
||||
bool __attribute__((weak)) emberAfStartMoveCallback()
|
||||
{
|
||||
return false;
|
||||
|
||||
Submodule connectedhomeip/connectedhomeip updated: 7e69c66bb4...b89e83be43
@@ -13,6 +13,7 @@
|
||||
#include <device.h>
|
||||
#include <esp_matter.h>
|
||||
#include <led_driver.h>
|
||||
#include <app_reset.h>
|
||||
|
||||
#include <app_priv.h>
|
||||
|
||||
@@ -159,5 +160,6 @@ app_driver_handle_t app_driver_button_init()
|
||||
button_config_t config = button_driver_get_config();
|
||||
button_handle_t handle = iot_button_create(&config);
|
||||
iot_button_register_cb(handle, BUTTON_PRESS_DOWN, app_driver_button_toggle_cb, NULL);
|
||||
app_reset_button_register(handle);
|
||||
return (app_driver_handle_t)handle;
|
||||
}
|
||||
|
||||
@@ -8,3 +8,4 @@ phy_init, data, phy, , 0x1000,
|
||||
ota_0, app, ota_0, 0x20000, 0x1E0000,
|
||||
ota_1, app, ota_1, 0x200000, 0x1E0000,
|
||||
fctry, data, nvs, 0x3E0000, 0x6000
|
||||
ot_storage,data, fat, , 0x6000,
|
||||
|
@@ -37,3 +37,8 @@ CONFIG_ESP_WIFI_SOFTAP_SUPPORT=n
|
||||
|
||||
# Disable DS Peripheral
|
||||
CONFIG_ESP_SECURE_CERT_DS_PERIPHERAL=n
|
||||
|
||||
CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER=y
|
||||
CONFIG_ENABLE_ESP32_DEVICE_INSTANCE_INFO_PROVIDER=y
|
||||
|
||||
CONFIG_FACTORY_PARTITION_DAC_PROVIDER=y
|
||||
|
||||
@@ -33,7 +33,7 @@ CONFIG_LWIP_IPV6_AUTOCONFIG=n
|
||||
|
||||
# Use a custom partition table
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_h2.csv"
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||
|
||||
# LwIP config for OpenThread
|
||||
CONFIG_LWIP_IPV6_NUM_ADDRESSES=8
|
||||
@@ -55,7 +55,7 @@ CONFIG_USE_MINIMAL_MDNS=n
|
||||
CONFIG_ENABLE_EXTENDED_DISCOVERY=y
|
||||
|
||||
# Enable OTA Requestor
|
||||
CONFIG_ENABLE_OTA_REQUESTOR=n
|
||||
CONFIG_ENABLE_OTA_REQUESTOR=y
|
||||
|
||||
# Disable STA and AP for ESP32H2
|
||||
CONFIG_ENABLE_WIFI_STATION=n
|
||||
@@ -68,3 +68,8 @@ CONFIG_BUTTON_LONG_PRESS_TIME_MS=5000
|
||||
# Enable chip shell
|
||||
CONFIG_ENABLE_CHIP_SHELL=y
|
||||
|
||||
CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER=y
|
||||
CONFIG_ENABLE_ESP32_DEVICE_INSTANCE_INFO_PROVIDER=y
|
||||
|
||||
CONFIG_FACTORY_PARTITION_DAC_PROVIDER=y
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ esp_matter_export_main() {
|
||||
export PATH=${PATH}:${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip/out/host
|
||||
|
||||
# export zap-cli path
|
||||
export export ZAP_INSTALL_PATH=${ESP_MATTER_PATH}/zap
|
||||
#export export ZAP_INSTALL_PATH=${ESP_MATTER_PATH}/zap
|
||||
}
|
||||
|
||||
esp_matter_export_main
|
||||
|
||||
Reference in New Issue
Block a user