Merge branch 'feature/update_chip_submodule_2ac3ee7' into 'main'

update the matter SDK to the commit c38e915

See merge request app-frameworks/esp-matter!151
This commit is contained in:
Shu Chen
2022-06-27 16:39:02 +08:00
20 changed files with 42 additions and 138 deletions
-1
View File
@@ -29,7 +29,6 @@ set(SRC_DIRS_LIST "."
"${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/ias-zone-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"
+1 -2
View File
@@ -83,8 +83,7 @@ typedef enum attribute_flags {
have this flag enabled, as all of them are stored in the ESP Matter database. */
ATTRIBUTE_FLAG_EXTERNAL_STORAGE = ATTRIBUTE_MASK_EXTERNAL_STORAGE, /* 0x10 */
ATTRIBUTE_FLAG_SINGLETON = ATTRIBUTE_MASK_SINGLETON, /* 0x20 */
ATTRIBUTE_FLAG_CLIENT = ATTRIBUTE_MASK_CLIENT, /* 0x40 */
ATTRIBUTE_FLAG_NULLABLE = ATTRIBUTE_MASK_NULLABLE, /* 0x80 */
ATTRIBUTE_FLAG_NULLABLE = ATTRIBUTE_MASK_NULLABLE, /* 0x40 */
/** The attribute read and write are overridden. The attribute value will be fetched from and will be updated using
the override callback. The value of this attribute is not maintained internally. */
ATTRIBUTE_FLAG_OVERRIDE = ATTRIBUTE_FLAG_NULLABLE << 1, /* 0x100 */
@@ -730,7 +730,7 @@ attribute_t *create_color_mode(cluster_t *cluster, uint8_t value)
attribute_t *create_color_control_options(cluster_t *cluster, uint8_t value)
{
return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorControlOptions::Id,
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Options::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_bitmap8(value));
}
@@ -754,13 +754,13 @@ attribute_t *create_color_temperature_mireds(cluster_t *cluster, uint16_t value)
attribute_t *create_color_temp_physical_min_mireds(cluster_t *cluster, uint16_t value)
{
return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorTempPhysicalMin::Id,
return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorTempPhysicalMinMireds::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
}
attribute_t *create_color_temp_physical_max_mireds(cluster_t *cluster, uint16_t value)
{
return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorTempPhysicalMax::Id,
return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorTempPhysicalMaxMireds::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
}
@@ -252,7 +252,7 @@ static esp_err_t console_handler(int argc, char **argv)
/* Get type from matter_attribute */
const EmberAfAttributeMetadata *matter_attribute = emberAfLocateAttributeMetadata(endpoint_id, cluster_id,
attribute_id, CLUSTER_FLAG_SERVER);
attribute_id);
if (!matter_attribute) {
ESP_LOGE(TAG, "Matter attribute not found");
return ESP_ERR_INVALID_ARG;
@@ -306,7 +306,7 @@ static esp_err_t console_handler(int argc, char **argv)
/* Get type from matter_attribute */
const EmberAfAttributeMetadata *matter_attribute = emberAfLocateAttributeMetadata(endpoint_id, cluster_id,
attribute_id, CLUSTER_FLAG_SERVER);
attribute_id);
if (!matter_attribute) {
ESP_LOGE(TAG, "Matter attribute not found");
return ESP_ERR_INVALID_ARG;
@@ -924,7 +924,7 @@ esp_err_t update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_i
} /* attribute */
} /* esp_matter */
Status MatterPreAttributeChangeCallback(const chip::app::ConcreteAttributePath &path, uint8_t mask, uint8_t type,
Status MatterPreAttributeChangeCallback(const chip::app::ConcreteAttributePath &path, uint8_t type,
uint16_t size, uint8_t *value)
{
uint16_t endpoint_id = path.mEndpointId;
@@ -944,7 +944,7 @@ Status MatterPreAttributeChangeCallback(const chip::app::ConcreteAttributePath &
return Status::Success;
}
void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &path, uint8_t mask, uint8_t type,
void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &path, uint8_t type,
uint16_t size, uint8_t *value)
{
uint16_t endpoint_id = path.mEndpointId;
@@ -539,7 +539,6 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
command::create_update_fabric_label(cluster);
command::create_remove_fabric(cluster);
command::create_add_trusted_root_certificate(cluster);
command::create_remove_trusted_root_certificate(cluster);
return cluster;
}
@@ -718,8 +717,6 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
/* Commands */
command::create_identify(cluster);
command::create_identify_query(cluster);
command::create_identify_query_response(cluster);
command::create_trigger_effect(cluster);
return cluster;
@@ -362,18 +362,6 @@ static esp_err_t esp_matter_command_callback_add_trusted_root_certificate(const
return ESP_OK;
}
static esp_err_t esp_matter_command_callback_remove_trusted_root_certificate(const ConcreteCommandPath &command_path,
TLVReader &tlv_data, void *opaque_ptr)
{
chip::app::Clusters::OperationalCredentials::Commands::RemoveTrustedRootCertificate::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data);
if (error == CHIP_NO_ERROR) {
emberAfOperationalCredentialsClusterRemoveTrustedRootCertificateCallback((CommandHandler *)opaque_ptr,
command_path, command_data);
}
return ESP_OK;
}
static esp_err_t esp_matter_command_callback_query_image(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
void *opaque_ptr)
{
@@ -433,17 +421,6 @@ static esp_err_t esp_matter_command_callback_identify(const ConcreteCommandPath
return ESP_OK;
}
static esp_err_t esp_matter_command_callback_identify_query(const ConcreteCommandPath &command_path,
TLVReader &tlv_data, void *opaque_ptr)
{
chip::app::Clusters::Identify::Commands::IdentifyQuery::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data);
if (error == CHIP_NO_ERROR) {
emberAfIdentifyClusterIdentifyQueryCallback((CommandHandler *)opaque_ptr, command_path, command_data);
}
return ESP_OK;
}
static esp_err_t esp_matter_command_callback_trigger_effect(const ConcreteCommandPath &command_path,
TLVReader &tlv_data, void *opaque_ptr)
{
@@ -1167,13 +1144,6 @@ command_t *create_add_trusted_root_certificate(cluster_t *cluster)
COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_add_trusted_root_certificate);
}
command_t *create_remove_trusted_root_certificate(cluster_t *cluster)
{
return esp_matter::command::create(cluster, OperationalCredentials::Commands::RemoveTrustedRootCertificate::Id,
COMMAND_FLAG_ACCEPTED,
esp_matter_command_callback_remove_trusted_root_certificate);
}
command_t *create_attestation_response(cluster_t *cluster)
{
return esp_matter::command::create(cluster, OperationalCredentials::Commands::AttestationResponse::Id,
@@ -1258,18 +1228,6 @@ command_t *create_identify(cluster_t *cluster)
esp_matter_command_callback_identify);
}
command_t *create_identify_query(cluster_t *cluster)
{
return esp_matter::command::create(cluster, Identify::Commands::IdentifyQuery::Id, COMMAND_FLAG_ACCEPTED,
esp_matter_command_callback_identify_query);
}
command_t *create_identify_query_response(cluster_t *cluster)
{
return esp_matter::command::create(cluster, Identify::Commands::IdentifyQueryResponse::Id, COMMAND_FLAG_GENERATED,
NULL);
}
command_t *create_trigger_effect(cluster_t *cluster)
{
return esp_matter::command::create(cluster, Identify::Commands::TriggerEffect::Id, COMMAND_FLAG_ACCEPTED,
@@ -79,7 +79,6 @@ command_t *create_update_noc(cluster_t *cluster);
command_t *create_update_fabric_label(cluster_t *cluster);
command_t *create_remove_fabric(cluster_t *cluster);
command_t *create_add_trusted_root_certificate(cluster_t *cluster);
command_t *create_remove_trusted_root_certificate(cluster_t *cluster);
command_t *create_attestation_response(cluster_t *cluster);
command_t *create_certificate_chain_response(cluster_t *cluster);
command_t *create_csr_response(cluster_t *cluster);
@@ -106,8 +105,6 @@ command_t *create_announce_ota_provider(cluster_t *cluster);
namespace identify {
namespace command {
command_t *create_identify(cluster_t *cluster);
command_t *create_identify_query(cluster_t *cluster);
command_t *create_identify_query_response(cluster_t *cluster);
command_t *create_trigger_effect(cluster_t *cluster);
} /* command */
} /* identify */
+17 -52
View File
@@ -15,12 +15,14 @@
#include <esp_log.h>
#include <esp_matter_event.h>
#include <app/clusters/switch-server/switch-server.h>
#include <platform/DeviceControlServer.h>
static const char *TAG = "esp_matter_event";
using chip::DeviceLayer::DeviceControlServer;
using chip::DeviceLayer::SwitchDeviceControlDelegate;
using chip::EndpointId;
using namespace chip::app::Clusters;
namespace esp_matter {
namespace cluster {
@@ -172,82 +174,45 @@ esp_err_t send_turbine_operation()
namespace switch_cluster {
namespace event {
static SwitchDeviceControlDelegate *get_switch_delegate()
esp_err_t send_switch_latched(EndpointId endpoint, uint8_t new_position)
{
SwitchDeviceControlDelegate *delegate = DeviceControlServer::DeviceControlSvr().GetSwitchDelegate();
if (!delegate) {
ESP_LOGE(TAG, "No delegate registered to handle switch events");
}
return delegate;
}
esp_err_t send_switch_latched(uint8_t new_position)
{
SwitchDeviceControlDelegate *delegate = get_switch_delegate();
if (!delegate) {
return ESP_FAIL;
}
delegate->OnSwitchLatched(new_position);
SwitchServer::Instance().OnSwitchLatch(endpoint, new_position);
return ESP_OK;
}
esp_err_t send_initial_press(uint8_t new_position)
esp_err_t send_initial_press(EndpointId endpoint, uint8_t new_position)
{
SwitchDeviceControlDelegate *delegate = get_switch_delegate();
if (!delegate) {
return ESP_FAIL;
}
delegate->OnInitialPressed(new_position);
SwitchServer::Instance().OnInitialPress(endpoint, new_position);
return ESP_OK;
}
esp_err_t send_long_press(uint8_t new_position)
esp_err_t send_long_press(EndpointId endpoint, uint8_t new_position)
{
SwitchDeviceControlDelegate *delegate = get_switch_delegate();
if (!delegate) {
return ESP_FAIL;
}
delegate->OnLongPressed(new_position);
SwitchServer::Instance().OnLongPress(endpoint, new_position);
return ESP_OK;
}
esp_err_t send_short_release(uint8_t previous_position)
esp_err_t send_short_release(EndpointId endpoint, uint8_t previous_position)
{
SwitchDeviceControlDelegate *delegate = get_switch_delegate();
if (!delegate) {
return ESP_FAIL;
}
delegate->OnShortReleased(previous_position);
SwitchServer::Instance().OnShortRelease(endpoint, previous_position);
return ESP_OK;
}
esp_err_t send_long_release(uint8_t previous_position)
esp_err_t send_long_release(EndpointId endpoint, uint8_t previous_position)
{
SwitchDeviceControlDelegate *delegate = get_switch_delegate();
if (!delegate) {
return ESP_FAIL;
}
delegate->OnLongReleased(previous_position);
SwitchServer::Instance().OnLongRelease(endpoint, previous_position);
return ESP_OK;
}
esp_err_t send_multi_press_ongoing(uint8_t new_position, uint8_t count)
esp_err_t send_multi_press_ongoing(EndpointId endpoint, uint8_t new_position, uint8_t count)
{
SwitchDeviceControlDelegate *delegate = get_switch_delegate();
if (!delegate) {
return ESP_FAIL;
}
delegate->OnMultiPressOngoing(new_position, count);
SwitchServer::Instance().OnMultiPressOngoing(endpoint, new_position, count);
return ESP_OK;
}
esp_err_t send_multi_press_complete(uint8_t new_position, uint8_t count)
esp_err_t send_multi_press_complete(EndpointId endpoint, uint8_t new_position, uint8_t count)
{
SwitchDeviceControlDelegate *delegate = get_switch_delegate();
if (!delegate) {
return ESP_FAIL;
}
delegate->OnMultiPressComplete(new_position, count);
SwitchServer::Instance().OnMultiPressComplete(endpoint, new_position, count);
return ESP_OK;
}
@@ -37,8 +37,8 @@ void __attribute__((weak)) emberAfAddToCurrentAppTasksCallback(EmberAfApplicatio
void __attribute__((weak)) emberAfRemoveFromCurrentAppTasksCallback(EmberAfApplicationTask tasks) {}
EmberAfAttributeWritePermission __attribute__((weak))
emberAfAllowNetworkWriteAttributeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
uint8_t * value, uint8_t type)
emberAfAllowNetworkWriteAttributeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId,uint8_t * value,
uint8_t type)
{
return EMBER_ZCL_ATTRIBUTE_WRITE_PERMISSION_ALLOW_WRITE_NORMAL; // Default
}
@@ -186,5 +186,5 @@
#define EMBER_AF_WAKE_ON_LAN_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in wake on lan
#define EMBER_AF_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT (16) // used in window covering
#define EMBER_AF_PLUGIN_SCENES_TABLE_SIZE 3 // used in scenes // TODO: check this again
#define MATTER_SCENES_TABLE_SIZE 3 // used in scenes // TODO: check this again
@@ -73,6 +73,8 @@ static_library("ESP32_custom") {
"ConfigurationManagerImpl.h",
"ConnectivityManagerImpl.cpp",
"ConnectivityManagerImpl.h",
"DeviceInfoProviderImpl.cpp",
"DeviceInfoProviderImpl.h",
"DeviceNetworkProvisioningDelegateImpl.cpp",
"DeviceNetworkProvisioningDelegateImpl.h",
"DiagnosticDataProviderImpl.cpp",
@@ -0,0 +1 @@
../../../../connectedhomeip/connectedhomeip/src/platform/ESP32/DeviceInfoProviderImpl.cpp
@@ -0,0 +1 @@
../../../../connectedhomeip/connectedhomeip/src/platform/ESP32/DeviceInfoProviderImpl.h
@@ -328,7 +328,6 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
HandleConnectionError(event->CHIPoBLEConnectionError.ConId, event->CHIPoBLEConnectionError.Reason);
break;
case DeviceEventType::kFabricMembershipChange:
case DeviceEventType::kServiceProvisioningChange:
case DeviceEventType::kAccountPairingChange:
case DeviceEventType::kWiFiConnectivityChange:
+3 -2
View File
@@ -12,6 +12,7 @@
#include <esp_log.h>
#include <platform/CHIPDeviceLayer.h>
#include <platform/CommissionableDataProvider.h>
#include <platform/DeviceInstanceInfoProvider.h>
#include <setup_payload/ManualSetupPayloadGenerator.h>
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
#include <setup_payload/SetupPayload.h>
@@ -51,13 +52,13 @@ esp_err_t app_qrcode_get_payload(char **qrcode_text, char **short_manual_code_te
return ESP_FAIL;
}
err = ConfigurationMgr().GetVendorId(vendor_id);
err = GetDeviceInstanceInfoProvider()->GetVendorId(vendor_id);
if (err != CHIP_NO_ERROR) {
ESP_LOGE(TAG, "Couldn't get vendor_id: %s", ErrorStr(err));
return ESP_FAIL;
}
err = ConfigurationMgr().GetProductId(product_id);
err = GetDeviceInstanceInfoProvider()->GetProductId(product_id);
if (err != CHIP_NO_ERROR) {
ESP_LOGE(TAG, "Couldn't get product_id: %s", ErrorStr(err));
return ESP_FAIL;
@@ -70,6 +70,8 @@ static_library("ESP32_custom") {
"ConfigurationManagerImpl.h",
"ConnectivityManagerImpl.cpp",
"ConnectivityManagerImpl.h",
"DeviceInfoProviderImpl.cpp",
"DeviceInfoProviderImpl.h",
"DeviceNetworkProvisioningDelegateImpl.cpp",
"DeviceNetworkProvisioningDelegateImpl.h",
"DiagnosticDataProviderImpl.cpp",
@@ -124,7 +124,9 @@ static void app_driver_button_toggle_cb(void *arg)
g_cluster_id = cluster_id;
g_command_id = command_id;
lock::chip_stack_lock(portMAX_DELAY);
client::cluster_update(endpoint_id, cluster_id);
lock::chip_stack_unlock();
}
esp_err_t app_driver_attribute_update(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
@@ -510,15 +510,6 @@ void DispatchServerCommand(CommandHandler *apCommandObj,
}
break;
}
case Commands::IdentifyQuery::Id: {
Commands::IdentifyQuery::DecodableType commandData;
TLVError = DataModel::Decode(aDataTlv, commandData);
if (TLVError == CHIP_NO_ERROR) {
wasHandled = emberAfIdentifyClusterIdentifyQueryCallback(
apCommandObj, aCommandPath, commandData);
}
break;
}
default: {
// Unrecognized command ID, error status will apply.
apCommandObj->AddStatus(
@@ -880,16 +871,6 @@ void DispatchServerCommand(CommandHandler *apCommandObj,
}
break;
}
case Commands::RemoveTrustedRootCertificate::Id: {
Commands::RemoveTrustedRootCertificate::DecodableType commandData;
TLVError = DataModel::Decode(aDataTlv, commandData);
if (TLVError == CHIP_NO_ERROR) {
wasHandled =
emberAfOperationalCredentialsClusterRemoveTrustedRootCertificateCallback(
apCommandObj, aCommandPath, commandData);
}
break;
}
default: {
// Unrecognized command ID, error status will apply.
apCommandObj->AddStatus(
@@ -66,9 +66,9 @@
#define ZAP_MIN_MAX_DEFAULTS_INDEX(index) \
{ &minMaxDefaults[index] }
#define ZAP_EMPTY_DEFAULT() \
{ (uint16_t)0 }
{ (uint32_t)0 }
#define ZAP_SIMPLE_DEFAULT(x) \
{ (uint16_t) x }
{ (uint32_t) x }
// This is an array of EmberAfAttributeMinMaxValue structures.
#define GENERATED_MIN_MAX_DEFAULT_COUNT 2