From 22f0648cb947fb38565d4792ac01757748abe25e Mon Sep 17 00:00:00 2001 From: WanqQixiang Date: Mon, 30 Dec 2024 16:04:58 +0800 Subject: [PATCH] esp-matter: update connectedhomeip submodule to 9b8fffe0bb --- .gitlab-ci.yml | 2 +- README.md | 2 +- components/esp_matter/CMakeLists.txt | 15 +- components/esp_matter/esp_matter_command.cpp | 63 +----- components/esp_matter/esp_matter_core.cpp | 30 ++- .../esp_matter_delegate_callbacks.cpp | 5 +- .../app/PluginApplicationCallbacks.h | 8 + .../zap_common/app/callback-stub.cpp | 40 ++++ .../zap_common/app/cluster-init-callback.cpp | 24 +++ .../zap_common/generate_zap_common_files.py | 11 +- .../zap_common/zap-generated/access.h | 180 ++++++++++++++++++ .../core/esp_matter_controller_client.cpp | 2 + .../src/esp_matter_ota_provider.cpp | 3 +- connectedhomeip/connectedhomeip | 2 +- .../platform/ESP32_custom/BLEManagerImpl.h | 2 +- .../platform/ESP32_custom/ESP32Utils.cpp | 10 +- .../ESP32_custom/PlatformManagerImpl.cpp | 3 +- .../ESP32_custom/nimble/BLEManagerImpl.cpp | 24 ++- .../ESP32_custom/platform_change.patch | 80 ++++---- examples/zap_light/main/CMakeLists.txt | 41 +--- 20 files changed, 376 insertions(+), 171 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 38fcaf0c6..a4b4e1102 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,7 @@ variables: IDF_CHECKOUT_REF: "v5.2.3" # This variable represents the short hash of the connectedhomeip submodule. # Note: Do change this short hash on submodule update MRs. - CHIP_SHORT_HASH: "43aa98c2d3" + CHIP_SHORT_HASH: "9b8fffe0bb" DOCKER_IMAGE_NAME: "espressif/chip-idf" .add_gitlab_ssh_key: &add_gitlab_ssh_key | diff --git a/README.md b/README.md index db7da241a..8466a664f 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ section in the ESP-Matter Programming Guide. ## Supported ESP-IDF and connectedhomeip versions -- This SDK currently works with commit [43aa98c2d3](https://github.com/project-chip/connectedhomeip/tree/43aa98c2d3) of connectedhomeip. +- This SDK currently works with commit [9b8fffe0bb](https://github.com/project-chip/connectedhomeip/tree/9b8fffe0bb) of connectedhomeip. - For Matter projects development with this SDK, it is recommended to utilize ESP-IDF [v5.2.3](https://github.com/espressif/esp-idf/tree/v5.2.3). ## Documentation diff --git a/components/esp_matter/CMakeLists.txt b/components/esp_matter/CMakeLists.txt index ef1d40126..916e5e800 100644 --- a/components/esp_matter/CMakeLists.txt +++ b/components/esp_matter/CMakeLists.txt @@ -4,7 +4,10 @@ set(SRC_DIRS_LIST "." "${MATTER_SDK_PATH}/zzz_generated/app-common/app-common/zap-generated/attributes" "${MATTER_SDK_PATH}/src/app/server" "${MATTER_SDK_PATH}/src/app/util" + "${MATTER_SDK_PATH}/src/app/util/persistence" "${MATTER_SDK_PATH}/src/app/reporting" + # TODO Use esp-matter data model and remove ember codes + "${MATTER_SDK_PATH}/src/data-model-providers/codegen" ) set(INCLUDE_DIRS_LIST "." @@ -48,10 +51,13 @@ idf_build_set_property(COMPILE_OPTIONS "-Wno-error=uninitialized;-Wno-error=mayb idf_build_set_property(COMPILE_OPTIONS "-Wno-error=array-bounds" APPEND) if (NOT CONFIG_ESP_MATTER_ENABLE_DATA_MODEL) - target_include_directories(${COMPONENT_LIB} PUBLIC "${CMAKE_BINARY_DIR}/gen/app-codegen/cpp-app" - "${CMAKE_BINARY_DIR}/gen/app-zapgen/zapgen/app-templates") + target_include_directories(${COMPONENT_LIB} PUBLIC "${CMAKE_BINARY_DIR}/gen/__idf_main-codegen/cpp-app" + "${CMAKE_BINARY_DIR}/gen/__idf_main-zapgen/zapgen/app-templates") endif() +target_sources(${COMPONENT_LIB} PRIVATE ${MATTER_SDK_PATH}/src/app/StorageDelegateWrapper.cpp + ${MATTER_SDK_PATH}/src/app/SafeAttributePersistenceProvider.cpp) + # For Xtensa chips, uint32_t was defined as 'unsigned' before v5.0, and after IDF v5.0 it is defined # as 'unsigned long', same as RISC-V. add this compile option to avoid format errors. # https://github.com/espressif/esp-idf/issues/6906#issuecomment-1207373706 @@ -61,11 +67,6 @@ endif() target_compile_options(${COMPONENT_LIB} PUBLIC "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=") -# TODO: remove this option after https://github.com/project-chip/connectedhomeip/pull/32287 merged -if (${IDF_VERSION_MAJOR} LESS 5) -idf_build_set_property(COMPILE_OPTIONS "-Wno-error=conversion;-Wno-conversion" APPEND) -endif() - # Time sync client feature depends on read client, disable it when read client is disabled. if (CONFIG_DISABLE_READ_CLIENT) target_compile_options(${COMPONENT_LIB} PUBLIC "-DTIME_SYNC_ENABLE_TSC_FEATURE=0") diff --git a/components/esp_matter/esp_matter_command.cpp b/components/esp_matter/esp_matter_command.cpp index c17beaa91..ac83df77a 100644 --- a/components/esp_matter/esp_matter_command.cpp +++ b/components/esp_matter/esp_matter_command.cpp @@ -135,53 +135,6 @@ static esp_err_t esp_matter_command_callback_key_set_read_all_indices(const Conc return ESP_OK; } -static esp_err_t esp_matter_command_callback_arm_fail_safe(const ConcreteCommandPath &command_path, TLVReader &tlv_data, - void *opaque_ptr) -{ - chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::DecodableType command_data; - CHIP_ERROR error = Decode(tlv_data, command_data); - if (error == CHIP_NO_ERROR) { - emberAfGeneralCommissioningClusterArmFailSafeCallback((CommandHandler *)opaque_ptr, command_path, command_data); - } - return ESP_OK; -} - -static esp_err_t esp_matter_command_callback_set_regulatory_config(const ConcreteCommandPath &command_path, - TLVReader &tlv_data, void *opaque_ptr) -{ - chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfig::DecodableType command_data; - CHIP_ERROR error = Decode(tlv_data, command_data); - if (error == CHIP_NO_ERROR) { - emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback((CommandHandler *)opaque_ptr, command_path, - command_data); - } - return ESP_OK; -} - -static esp_err_t esp_matter_command_callback_commissioning_complete(const ConcreteCommandPath &command_path, - TLVReader &tlv_data, void *opaque_ptr) -{ - chip::app::Clusters::GeneralCommissioning::Commands::CommissioningComplete::DecodableType command_data; - CHIP_ERROR error = Decode(tlv_data, command_data); - if (error == CHIP_NO_ERROR) { - emberAfGeneralCommissioningClusterCommissioningCompleteCallback((CommandHandler *)opaque_ptr, command_path, - command_data); - } - return ESP_OK; -} - -static esp_err_t esp_matter_command_callback_set_tc_acknowledgements(const ConcreteCommandPath &command_path, - TLVReader &tlv_data, void *opaque_ptr) -{ - chip::app::Clusters::GeneralCommissioning::Commands::SetTCAcknowledgements::DecodableType command_data; - CHIP_ERROR error = Decode(tlv_data, command_data); - if (error == CHIP_NO_ERROR) { - emberAfGeneralCommissioningClusterSetTCAcknowledgementsCallback((CommandHandler *)opaque_ptr, command_path, - command_data); - } - return ESP_OK; -} - static esp_err_t esp_matter_command_callback_open_commissioning_window(const ConcreteCommandPath &command_path, TLVReader &tlv_data, void *opaque_ptr) { @@ -1893,11 +1846,9 @@ namespace general_commissioning { namespace command { constexpr const command_entry_t accepted_command_list[] = { - {GeneralCommissioning::Commands::ArmFailSafe::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_arm_fail_safe}, - {GeneralCommissioning::Commands::SetRegulatoryConfig::Id, COMMAND_FLAG_ACCEPTED, - esp_matter_command_callback_set_regulatory_config}, - {GeneralCommissioning::Commands::CommissioningComplete::Id, COMMAND_FLAG_ACCEPTED, - esp_matter_command_callback_commissioning_complete}, + {GeneralCommissioning::Commands::ArmFailSafe::Id, COMMAND_FLAG_ACCEPTED, nullptr}, + {GeneralCommissioning::Commands::SetRegulatoryConfig::Id, COMMAND_FLAG_ACCEPTED, nullptr}, + {GeneralCommissioning::Commands::CommissioningComplete::Id, COMMAND_FLAG_ACCEPTED, nullptr}, }; constexpr const command_entry_t generated_command_list[] = { @@ -1909,19 +1860,19 @@ constexpr const command_entry_t generated_command_list[] = { command_t *create_arm_fail_safe(cluster_t *cluster) { return esp_matter::command::create(cluster, GeneralCommissioning::Commands::ArmFailSafe::Id, COMMAND_FLAG_ACCEPTED, - esp_matter_command_callback_arm_fail_safe); + nullptr); } command_t *create_set_regulatory_config(cluster_t *cluster) { return esp_matter::command::create(cluster, GeneralCommissioning::Commands::SetRegulatoryConfig::Id, - COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_regulatory_config); + COMMAND_FLAG_ACCEPTED, nullptr); } command_t *create_commissioning_complete(cluster_t *cluster) { return esp_matter::command::create(cluster, GeneralCommissioning::Commands::CommissioningComplete::Id, - COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_commissioning_complete); + COMMAND_FLAG_ACCEPTED, nullptr); } command_t *create_arm_fail_safe_response(cluster_t *cluster) @@ -1945,7 +1896,7 @@ command_t *create_commissioning_complete_response(cluster_t *cluster) command_t *create_set_tc_acknowledgements(cluster_t *cluster) { return esp_matter::command::create(cluster, GeneralCommissioning::Commands::SetTCAcknowledgements::Id, - COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_set_tc_acknowledgements); + COMMAND_FLAG_ACCEPTED, nullptr); } command_t *create_set_tc_acknowledgements_response(cluster_t *cluster) diff --git a/components/esp_matter/esp_matter_core.cpp b/components/esp_matter/esp_matter_core.cpp index 9f9babb6e..0a578a1f5 100644 --- a/components/esp_matter/esp_matter_core.cpp +++ b/components/esp_matter/esp_matter_core.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -719,6 +720,7 @@ static void esp_matter_chip_init_task(intptr_t context) initParams.InitializeStaticResourcesBeforeServerInit(); initParams.appDelegate = &s_app_delegate; + initParams.dataModelProvider = chip::app::CodegenDataModelProviderInstance(initParams.persistentStorageDelegate); #ifdef CONFIG_ESP_MATTER_ENABLE_DATA_MODEL // Group data provider injection for dynamic data model @@ -742,13 +744,24 @@ static void esp_matter_chip_init_task(intptr_t context) ESP_LOGE(TAG, "Failed to add fabric delegate, err:%" CHIP_ERROR_FORMAT, ret.Format()); } chip::Server::GetInstance().Init(initParams); - #if CHIP_DEVICE_CONFIG_ENABLE_THREAD +#ifdef CONFIG_ESP_MATTER_ENABLE_OPENTHREAD + VerifyOrReturn(ThreadStackMgr().InitThreadStack() == CHIP_NO_ERROR, ESP_LOGE(TAG, "Failed to initialize Thread stack")); +#if CHIP_CONFIG_ENABLE_ICD_SERVER + VerifyOrReturn(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice) == CHIP_NO_ERROR, ESP_LOGE(TAG, "Failed to set the Thread device type")); + +#elif CHIP_DEVICE_CONFIG_THREAD_FTD + VerifyOrReturn(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router) == CHIP_NO_ERROR, ESP_LOGE(TAG, "Failed to set the Thread device type")); +#else + VerifyOrReturn(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice) == CHIP_NO_ERROR, ESP_LOGE(TAG, "Failed to set the Thread device type")); +#endif + VerifyOrReturn(ThreadStackMgr().StartThreadTask() == CHIP_NO_ERROR, ESP_LOGE(TAG, "Failed to launch Thread task")); // If Thread is Provisioned, publish the dns service if (chip::DeviceLayer::ConnectivityMgr().IsThreadProvisioned() && (chip::Server::GetInstance().GetFabricTable().FabricCount() != 0)) { chip::app::DnssdServer::Instance().StartServer(); } +#endif // CONFIG_ESP_MATTER_ENABLE_OPENTHREAD #endif if (endpoint::enable_all() != ESP_OK) { ESP_LOGE(TAG, "Enable all endpoints failure"); @@ -816,21 +829,6 @@ static esp_err_t chip_init(event_callback_t callback, intptr_t callback_arg) if(callback) { PlatformMgr().AddEventHandler(callback, callback_arg); } -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#ifdef CONFIG_ESP_MATTER_ENABLE_OPENTHREAD - VerifyOrReturnError(ThreadStackMgr().InitThreadStack() == CHIP_NO_ERROR, ESP_FAIL, ESP_LOGE(TAG, "Failed to initialize Thread stack")); -#if CHIP_CONFIG_ENABLE_ICD_SERVER - VerifyOrReturnError(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice) == CHIP_NO_ERROR, ESP_FAIL, ESP_LOGE(TAG, "Failed to set the Thread device type")); - -#elif CHIP_DEVICE_CONFIG_THREAD_FTD - VerifyOrReturnError(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router) == CHIP_NO_ERROR, ESP_FAIL, ESP_LOGE(TAG, "Failed to set the Thread device type")); -#else - VerifyOrReturnError(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice) == CHIP_NO_ERROR, ESP_FAIL, ESP_LOGE(TAG, "Failed to set the Thread device type")); -#endif - VerifyOrReturnError(ThreadStackMgr().StartThreadTask() == CHIP_NO_ERROR, ESP_FAIL, ESP_LOGE(TAG, "Failed to launch Thread task")); -#endif // CONFIG_ESP_MATTER_ENABLE_OPENTHREAD -#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD - #if CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER // Add bounds to all attributes esp_matter::cluster::add_bounds_callback_common(); diff --git a/components/esp_matter/esp_matter_delegate_callbacks.cpp b/components/esp_matter/esp_matter_delegate_callbacks.cpp index 4607bfd1b..3cf4f817a 100644 --- a/components/esp_matter/esp_matter_delegate_callbacks.cpp +++ b/components/esp_matter/esp_matter_delegate_callbacks.cpp @@ -355,7 +355,10 @@ void CommissionerControlDelegateInitCB(void *delegate, uint16_t endpoint_id) return; } CommissionerControl::Delegate *commissioner_control_delegate = static_cast(delegate); - CommissionerControl::CommissionerControlServer::Instance().Init(*commissioner_control_delegate); + CommissionerControl::CommissionerControlServer *commissioner_control_instance = nullptr; + commissioner_control_instance = + new CommissionerControl::CommissionerControlServer(commissioner_control_delegate, endpoint_id, CommissionerControl::Id); + commissioner_control_instance->Init(); } } // namespace delegate_cb diff --git a/components/esp_matter/zap_common/app/PluginApplicationCallbacks.h b/components/esp_matter/zap_common/app/PluginApplicationCallbacks.h index e1a788e0a..f53724dc2 100644 --- a/components/esp_matter/zap_common/app/PluginApplicationCallbacks.h +++ b/components/esp_matter/zap_common/app/PluginApplicationCallbacks.h @@ -14,9 +14,12 @@ void MatterBindingPluginServerInitCallback(); void MatterBooleanStatePluginServerInitCallback(); void MatterBooleanStateConfigurationPluginServerInitCallback(); void MatterBridgedDeviceBasicInformationPluginServerInitCallback(); +void MatterCameraAvSettingsUserLevelManagementPluginServerInitCallback(); +void MatterCameraAvStreamManagementPluginServerInitCallback(); void MatterCarbonDioxideConcentrationMeasurementPluginServerInitCallback(); void MatterCarbonMonoxideConcentrationMeasurementPluginServerInitCallback(); void MatterChannelPluginServerInitCallback(); +void MatterChimePluginServerInitCallback(); void MatterColorControlPluginServerInitCallback(); void MatterCommissionerControlPluginServerInitCallback(); void MatterContentAppObserverPluginServerInitCallback(); @@ -85,6 +88,7 @@ void MatterProxyDiscoveryPluginServerInitCallback(); void MatterProxyValidPluginServerInitCallback(); void MatterPulseWidthModulationPluginServerInitCallback(); void MatterPumpConfigurationAndControlPluginServerInitCallback(); +void MatterPushAvStreamTransportPluginServerInitCallback(); void MatterRadonConcentrationMeasurementPluginServerInitCallback(); void MatterRefrigeratorAlarmPluginServerInitCallback(); void MatterRefrigeratorAndTemperatureControlledCabinetModePluginServerInitCallback(); @@ -108,6 +112,7 @@ void MatterThreadNetworkDiagnosticsPluginServerInitCallback(); void MatterThreadNetworkDirectoryPluginServerInitCallback(); void MatterTimeFormatLocalizationPluginServerInitCallback(); void MatterTimeSynchronizationPluginServerInitCallback(); +void MatterTlsCertificateManagementPluginServerInitCallback(); void MatterTotalVolatileOrganicCompoundsConcentrationMeasurementPluginServerInitCallback(); void MatterUnitLocalizationPluginServerInitCallback(); void MatterUnitTestingPluginServerInitCallback(); @@ -116,9 +121,12 @@ void MatterValveConfigurationAndControlPluginServerInitCallback(); void MatterWakeOnLanPluginServerInitCallback(); void MatterWaterHeaterManagementPluginServerInitCallback(); void MatterWaterHeaterModePluginServerInitCallback(); +void MatterWebRTCTransportProviderPluginServerInitCallback(); +void MatterWebRTCTransportRequestorPluginServerInitCallback(); void MatterWiFiNetworkDiagnosticsPluginServerInitCallback(); void MatterWiFiNetworkManagementPluginServerInitCallback(); void MatterWindowCoveringPluginServerInitCallback(); +void MatterZoneManagementPluginServerInitCallback(); #include diff --git a/components/esp_matter/zap_common/app/callback-stub.cpp b/components/esp_matter/zap_common/app/callback-stub.cpp index d96802d59..b97fa3e17 100644 --- a/components/esp_matter/zap_common/app/callback-stub.cpp +++ b/components/esp_matter/zap_common/app/callback-stub.cpp @@ -76,6 +76,16 @@ void __attribute__((weak)) emberAfBridgedDeviceBasicInformationClusterInitCallba // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfCameraAvSettingsUserLevelManagementClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfCameraAvStreamManagementClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfCarbonDioxideConcentrationMeasurementClusterInitCallback(EndpointId endpoint) { // To prevent warning @@ -91,6 +101,11 @@ void __attribute__((weak)) emberAfChannelClusterInitCallback(EndpointId endpoint // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfChimeClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfColorControlClusterInitCallback(EndpointId endpoint) { // To prevent warning @@ -431,6 +446,11 @@ void __attribute__((weak)) emberAfPumpConfigurationAndControlClusterInitCallback // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfPushAvStreamTransportClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfRadonConcentrationMeasurementClusterInitCallback(EndpointId endpoint) { // To prevent warning @@ -546,6 +566,11 @@ void __attribute__((weak)) emberAfTimeSynchronizationClusterInitCallback(Endpoin // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfTlsCertificateManagementClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfTotalVolatileOrganicCompoundsConcentrationMeasurementClusterInitCallback(EndpointId endpoint) { // To prevent warning @@ -586,6 +611,16 @@ void __attribute__((weak)) emberAfWaterHeaterModeClusterInitCallback(EndpointId // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfWebRTCTransportProviderClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfWebRTCTransportRequestorClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfWiFiNetworkDiagnosticsClusterInitCallback(EndpointId endpoint) { // To prevent warning @@ -601,3 +636,8 @@ void __attribute__((weak)) emberAfWindowCoveringClusterInitCallback(EndpointId e // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfZoneManagementClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} diff --git a/components/esp_matter/zap_common/app/cluster-init-callback.cpp b/components/esp_matter/zap_common/app/cluster-init-callback.cpp index 6b40488a3..186306e21 100644 --- a/components/esp_matter/zap_common/app/cluster-init-callback.cpp +++ b/components/esp_matter/zap_common/app/cluster-init-callback.cpp @@ -55,6 +55,12 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case app::Clusters::BridgedDeviceBasicInformation::Id: emberAfBridgedDeviceBasicInformationClusterInitCallback(endpoint); break; + case app::Clusters::CameraAvSettingsUserLevelManagement::Id: + emberAfCameraAvSettingsUserLevelManagementClusterInitCallback(endpoint); + break; + case app::Clusters::CameraAvStreamManagement::Id: + emberAfCameraAvStreamManagementClusterInitCallback(endpoint); + break; case app::Clusters::CarbonDioxideConcentrationMeasurement::Id: emberAfCarbonDioxideConcentrationMeasurementClusterInitCallback(endpoint); break; @@ -64,6 +70,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case app::Clusters::Channel::Id: emberAfChannelClusterInitCallback(endpoint); break; + case app::Clusters::Chime::Id: + emberAfChimeClusterInitCallback(endpoint); + break; case app::Clusters::ColorControl::Id: emberAfColorControlClusterInitCallback(endpoint); break; @@ -268,6 +277,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case app::Clusters::PumpConfigurationAndControl::Id: emberAfPumpConfigurationAndControlClusterInitCallback(endpoint); break; + case app::Clusters::PushAvStreamTransport::Id: + emberAfPushAvStreamTransportClusterInitCallback(endpoint); + break; case app::Clusters::RadonConcentrationMeasurement::Id: emberAfRadonConcentrationMeasurementClusterInitCallback(endpoint); break; @@ -337,6 +349,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case app::Clusters::TimeSynchronization::Id: emberAfTimeSynchronizationClusterInitCallback(endpoint); break; + case app::Clusters::TlsCertificateManagement::Id: + emberAfTlsCertificateManagementClusterInitCallback(endpoint); + break; case app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id: emberAfTotalVolatileOrganicCompoundsConcentrationMeasurementClusterInitCallback(endpoint); break; @@ -361,6 +376,12 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case app::Clusters::WaterHeaterMode::Id: emberAfWaterHeaterModeClusterInitCallback(endpoint); break; + case app::Clusters::WebRTCTransportProvider::Id: + emberAfWebRTCTransportProviderClusterInitCallback(endpoint); + break; + case app::Clusters::WebRTCTransportRequestor::Id: + emberAfWebRTCTransportRequestorClusterInitCallback(endpoint); + break; case app::Clusters::WiFiNetworkDiagnostics::Id: emberAfWiFiNetworkDiagnosticsClusterInitCallback(endpoint); break; @@ -370,6 +391,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case app::Clusters::WindowCovering::Id: emberAfWindowCoveringClusterInitCallback(endpoint); break; + case app::Clusters::ZoneManagement::Id: + emberAfZoneManagementClusterInitCallback(endpoint); + break; default: // Unrecognized cluster ID break; diff --git a/components/esp_matter/zap_common/generate_zap_common_files.py b/components/esp_matter/zap_common/generate_zap_common_files.py index d196b5c51..439a00b0f 100755 --- a/components/esp_matter/zap_common/generate_zap_common_files.py +++ b/components/esp_matter/zap_common/generate_zap_common_files.py @@ -29,7 +29,7 @@ import re # These clusters are not implemented in current connectedhomeip repo EXCLUDE_CLUSTERS = ['Demand Response Load Control', 'Timer'] # These words are special when formatting the cluster name -WORD_FORMAT_LIST = {'Wifi': 'WiFi', 'Pm2.5': 'Pm25'} +WORD_FORMAT_LIST = {'Wifi': 'WiFi', 'Pm2.5': 'Pm25', 'Webrtc': 'WebRTC'} if not os.getenv('ESP_MATTER_PATH'): logging.error("ESP_MATTER_PATH environment variable is not set") @@ -193,9 +193,12 @@ def get_attribute_write_privilege(attribute): def get_attribute_name(attribute): - for element in attribute: - if element.tag == 'description': - return element.text + try: + return attribute.attrib['name'] + except KeyError: + for element in attribute: + if element.tag == 'description': + return element.text def get_command_invoke_privilege(command): diff --git a/components/esp_matter/zap_common/zap-generated/access.h b/components/esp_matter/zap_common/zap-generated/access.h index 82cd432f8..ef273e3bd 100644 --- a/components/esp_matter/zap_common/zap-generated/access.h +++ b/components/esp_matter/zap_common/zap-generated/access.h @@ -15,6 +15,7 @@ 0x00000030, /* Cluster: General Commissioning, Attribute: TCMinRequiredVersion, Privilege: administer */ \ 0x00000030, /* Cluster: General Commissioning, Attribute: TCAcknowledgements, Privilege: administer */ \ 0x00000030, /* Cluster: General Commissioning, Attribute: TCAcknowledgementsRequired, Privilege: administer */ \ + 0x00000030, /* Cluster: General Commissioning, Attribute: TCUpdateDeadline, Privilege: administer */ \ 0x00000031, /* Cluster: Network Commissioning, Attribute: MaxNetworks, Privilege: administer */ \ 0x00000031, /* Cluster: Network Commissioning, Attribute: Networks, Privilege: administer */ \ 0x00000031, /* Cluster: Network Commissioning, Attribute: LastNetworkingStatus, Privilege: administer */ \ @@ -34,6 +35,26 @@ 0x00000453, /* Cluster: Thread Network Directory, Attribute: PreferredExtendedPanID, Privilege: manage */ \ 0x00000453, /* Cluster: Thread Network Directory, Attribute: ThreadNetworks, Privilege: operate */ \ 0x0000050D, /* Cluster: Application Basic, Attribute: AllowedVendorList, Privilege: administer */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: HDRModeEnabled, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: NightVision, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: NightVisionIllum, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: Viewport, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: SpeakerMuted, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: SpeakerVolumeLevel, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: SpeakerMaxLevel, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: SpeakerMinLevel, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneMuted, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneVolumeLevel, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneMaxLevel, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneMinLevel, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneAGCEnabled, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: ImageRotation, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: ImageFlipHorizontal, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: ImageFlipVertical, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: LocalVideoRecordingEnabled, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: LocalSnapshotRecordingEnabled, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: StatusLightEnabled, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: StatusLightBrightness, Privilege: manage */ \ 0x00000750, /* Cluster: Ecosystem Information, Attribute: DeviceDirectory, Privilege: manage */ \ 0x00000750, /* Cluster: Ecosystem Information, Attribute: LocationDirectory, Privilege: manage */ \ 0x00000751, /* Cluster: Commissioner Control, Attribute: SupportedDeviceCategories, Privilege: manage */ \ @@ -47,6 +68,7 @@ 0x00000006, /* Cluster: General Commissioning, Attribute: TCMinRequiredVersion, Privilege: administer */ \ 0x00000007, /* Cluster: General Commissioning, Attribute: TCAcknowledgements, Privilege: administer */ \ 0x00000008, /* Cluster: General Commissioning, Attribute: TCAcknowledgementsRequired, Privilege: administer */ \ + 0x00000009, /* Cluster: General Commissioning, Attribute: TCUpdateDeadline, Privilege: administer */ \ 0x00000000, /* Cluster: Network Commissioning, Attribute: MaxNetworks, Privilege: administer */ \ 0x00000001, /* Cluster: Network Commissioning, Attribute: Networks, Privilege: administer */ \ 0x00000005, /* Cluster: Network Commissioning, Attribute: LastNetworkingStatus, Privilege: administer */ \ @@ -66,6 +88,26 @@ 0x00000000, /* Cluster: Thread Network Directory, Attribute: PreferredExtendedPanID, Privilege: manage */ \ 0x00000001, /* Cluster: Thread Network Directory, Attribute: ThreadNetworks, Privilege: operate */ \ 0x00000007, /* Cluster: Application Basic, Attribute: AllowedVendorList, Privilege: administer */ \ + 0x0000000D, /* Cluster: Camera AV Stream Management, Attribute: HDRModeEnabled, Privilege: manage */ \ + 0x00000016, /* Cluster: Camera AV Stream Management, Attribute: NightVision, Privilege: manage */ \ + 0x00000017, /* Cluster: Camera AV Stream Management, Attribute: NightVisionIllum, Privilege: manage */ \ + 0x00000018, /* Cluster: Camera AV Stream Management, Attribute: Viewport, Privilege: manage */ \ + 0x00000019, /* Cluster: Camera AV Stream Management, Attribute: SpeakerMuted, Privilege: manage */ \ + 0x0000001A, /* Cluster: Camera AV Stream Management, Attribute: SpeakerVolumeLevel, Privilege: manage */ \ + 0x0000001B, /* Cluster: Camera AV Stream Management, Attribute: SpeakerMaxLevel, Privilege: manage */ \ + 0x0000001C, /* Cluster: Camera AV Stream Management, Attribute: SpeakerMinLevel, Privilege: manage */ \ + 0x0000001D, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneMuted, Privilege: manage */ \ + 0x0000001E, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneVolumeLevel, Privilege: manage */ \ + 0x0000001F, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneMaxLevel, Privilege: manage */ \ + 0x00000020, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneMinLevel, Privilege: manage */ \ + 0x00000021, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneAGCEnabled, Privilege: manage */ \ + 0x00000022, /* Cluster: Camera AV Stream Management, Attribute: ImageRotation, Privilege: manage */ \ + 0x00000023, /* Cluster: Camera AV Stream Management, Attribute: ImageFlipHorizontal, Privilege: manage */ \ + 0x00000024, /* Cluster: Camera AV Stream Management, Attribute: ImageFlipVertical, Privilege: manage */ \ + 0x00000025, /* Cluster: Camera AV Stream Management, Attribute: LocalVideoRecordingEnabled, Privilege: manage */ \ + 0x00000026, /* Cluster: Camera AV Stream Management, Attribute: LocalSnapshotRecordingEnabled, Privilege: manage */ \ + 0x00000027, /* Cluster: Camera AV Stream Management, Attribute: StatusLightEnabled, Privilege: manage */ \ + 0x00000028, /* Cluster: Camera AV Stream Management, Attribute: StatusLightBrightness, Privilege: manage */ \ 0x00000000, /* Cluster: Ecosystem Information, Attribute: DeviceDirectory, Privilege: manage */ \ 0x00000001, /* Cluster: Ecosystem Information, Attribute: LocationDirectory, Privilege: manage */ \ 0x00000000, /* Cluster: Commissioner Control, Attribute: SupportedDeviceCategories, Privilege: manage */ \ @@ -79,6 +121,7 @@ chip::Access::Privilege::kAdminister, /* Cluster: General Commissioning, Attribute: TCMinRequiredVersion, Privilege: administer */ \ chip::Access::Privilege::kAdminister, /* Cluster: General Commissioning, Attribute: TCAcknowledgements, Privilege: administer */ \ chip::Access::Privilege::kAdminister, /* Cluster: General Commissioning, Attribute: TCAcknowledgementsRequired, Privilege: administer */ \ + chip::Access::Privilege::kAdminister, /* Cluster: General Commissioning, Attribute: TCUpdateDeadline, Privilege: administer */ \ chip::Access::Privilege::kAdminister, /* Cluster: Network Commissioning, Attribute: MaxNetworks, Privilege: administer */ \ chip::Access::Privilege::kAdminister, /* Cluster: Network Commissioning, Attribute: Networks, Privilege: administer */ \ chip::Access::Privilege::kAdminister, /* Cluster: Network Commissioning, Attribute: LastNetworkingStatus, Privilege: administer */ \ @@ -98,6 +141,26 @@ chip::Access::Privilege::kManage, /* Cluster: Thread Network Directory, Attribute: PreferredExtendedPanID, Privilege: manage */ \ chip::Access::Privilege::kOperate, /* Cluster: Thread Network Directory, Attribute: ThreadNetworks, Privilege: operate */ \ chip::Access::Privilege::kAdminister, /* Cluster: Application Basic, Attribute: AllowedVendorList, Privilege: administer */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: HDRModeEnabled, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: NightVision, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: NightVisionIllum, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: Viewport, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: SpeakerMuted, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: SpeakerVolumeLevel, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: SpeakerMaxLevel, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: SpeakerMinLevel, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneMuted, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneVolumeLevel, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneMaxLevel, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneMinLevel, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneAGCEnabled, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: ImageRotation, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: ImageFlipHorizontal, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: ImageFlipVertical, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: LocalVideoRecordingEnabled, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: LocalSnapshotRecordingEnabled, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: StatusLightEnabled, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: StatusLightBrightness, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Ecosystem Information, Attribute: DeviceDirectory, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Ecosystem Information, Attribute: LocationDirectory, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Commissioner Control, Attribute: SupportedDeviceCategories, Privilege: manage */ \ @@ -211,6 +274,22 @@ 0x00000406, /* Cluster: Occupancy Sensing, Attribute: PhysicalContactUnoccupiedToOccupiedDelay, Privilege: manage */ \ 0x00000406, /* Cluster: Occupancy Sensing, Attribute: PhysicalContactUnoccupiedToOccupiedThreshold, Privilege: manage */ \ 0x00000453, /* Cluster: Thread Network Directory, Attribute: PreferredExtendedPanID, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: HDRModeEnabled, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: NightVision, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: NightVisionIllum, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: Viewport, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: SpeakerMuted, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: SpeakerVolumeLevel, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneMuted, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneVolumeLevel, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneAGCEnabled, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: ImageRotation, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: ImageFlipHorizontal, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: ImageFlipVertical, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: LocalVideoRecordingEnabled, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: LocalSnapshotRecordingEnabled, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: StatusLightEnabled, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Attribute: StatusLightBrightness, Privilege: manage */ \ } // Parallel array data (cluster, *attribute*, privilege) for write attribute @@ -319,6 +398,22 @@ 0x00000031, /* Cluster: Occupancy Sensing, Attribute: PhysicalContactUnoccupiedToOccupiedDelay, Privilege: manage */ \ 0x00000032, /* Cluster: Occupancy Sensing, Attribute: PhysicalContactUnoccupiedToOccupiedThreshold, Privilege: manage */ \ 0x00000000, /* Cluster: Thread Network Directory, Attribute: PreferredExtendedPanID, Privilege: manage */ \ + 0x0000000D, /* Cluster: Camera AV Stream Management, Attribute: HDRModeEnabled, Privilege: manage */ \ + 0x00000016, /* Cluster: Camera AV Stream Management, Attribute: NightVision, Privilege: manage */ \ + 0x00000017, /* Cluster: Camera AV Stream Management, Attribute: NightVisionIllum, Privilege: manage */ \ + 0x00000018, /* Cluster: Camera AV Stream Management, Attribute: Viewport, Privilege: manage */ \ + 0x00000019, /* Cluster: Camera AV Stream Management, Attribute: SpeakerMuted, Privilege: manage */ \ + 0x0000001A, /* Cluster: Camera AV Stream Management, Attribute: SpeakerVolumeLevel, Privilege: manage */ \ + 0x0000001D, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneMuted, Privilege: manage */ \ + 0x0000001E, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneVolumeLevel, Privilege: manage */ \ + 0x00000021, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneAGCEnabled, Privilege: manage */ \ + 0x00000022, /* Cluster: Camera AV Stream Management, Attribute: ImageRotation, Privilege: manage */ \ + 0x00000023, /* Cluster: Camera AV Stream Management, Attribute: ImageFlipHorizontal, Privilege: manage */ \ + 0x00000024, /* Cluster: Camera AV Stream Management, Attribute: ImageFlipVertical, Privilege: manage */ \ + 0x00000025, /* Cluster: Camera AV Stream Management, Attribute: LocalVideoRecordingEnabled, Privilege: manage */ \ + 0x00000026, /* Cluster: Camera AV Stream Management, Attribute: LocalSnapshotRecordingEnabled, Privilege: manage */ \ + 0x00000027, /* Cluster: Camera AV Stream Management, Attribute: StatusLightEnabled, Privilege: manage */ \ + 0x00000028, /* Cluster: Camera AV Stream Management, Attribute: StatusLightBrightness, Privilege: manage */ \ } // Parallel array data (cluster, attribute, *privilege*) for write attribute @@ -427,6 +522,22 @@ chip::Access::Privilege::kManage, /* Cluster: Occupancy Sensing, Attribute: PhysicalContactUnoccupiedToOccupiedDelay, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Occupancy Sensing, Attribute: PhysicalContactUnoccupiedToOccupiedThreshold, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Thread Network Directory, Attribute: PreferredExtendedPanID, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: HDRModeEnabled, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: NightVision, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: NightVisionIllum, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: Viewport, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: SpeakerMuted, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: SpeakerVolumeLevel, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneMuted, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneVolumeLevel, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: MicrophoneAGCEnabled, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: ImageRotation, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: ImageFlipHorizontal, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: ImageFlipVertical, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: LocalVideoRecordingEnabled, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: LocalSnapshotRecordingEnabled, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: StatusLightEnabled, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Attribute: StatusLightBrightness, Privilege: manage */ \ } //////////////////////////////////////////////////////////////////////////////// @@ -452,6 +563,7 @@ 0x00000031, /* Cluster: Network Commissioning, Command: ReorderNetwork, Privilege: administer */ \ 0x00000031, /* Cluster: Network Commissioning, Command: QueryIdentity, Privilege: administer */ \ 0x00000033, /* Cluster: General Diagnostics, Command: TestEventTrigger, Privilege: manage */ \ + 0x00000033, /* Cluster: General Diagnostics, Command: PayloadTestRequest, Privilege: manage */ \ 0x00000034, /* Cluster: Software Diagnostics, Command: ResetWatermarks, Privilege: manage */ \ 0x00000035, /* Cluster: Thread Network Diagnostics, Command: ResetCounts, Privilege: manage */ \ 0x00000037, /* Cluster: Ethernet Network Diagnostics, Command: ResetCounts, Privilege: manage */ \ @@ -482,6 +594,7 @@ 0x00000062, /* Cluster: Scenes Management, Command: RemoveScene, Privilege: manage */ \ 0x00000062, /* Cluster: Scenes Management, Command: RemoveAllScenes, Privilege: manage */ \ 0x00000062, /* Cluster: Scenes Management, Command: StoreScene, Privilege: manage */ \ + 0x00000062, /* Cluster: Scenes Management, Command: CopyScene, Privilege: manage */ \ 0x00000094, /* Cluster: Water Heater Management, Command: Boost, Privilege: manage */ \ 0x00000094, /* Cluster: Water Heater Management, Command: CancelBoost, Privilege: manage */ \ 0x00000101, /* Cluster: Door Lock, Command: SetWeekDaySchedule, Privilege: administer */ \ @@ -515,8 +628,29 @@ 0x0000050B, /* Cluster: Audio Output, Command: RenameOutput, Privilege: manage */ \ 0x0000050E, /* Cluster: Account Login, Command: GetSetupPIN, Privilege: administer */ \ 0x0000050E, /* Cluster: Account Login, Command: Login, Privilege: administer */ \ + 0x00000550, /* Cluster: Zone Management, Command: CreateTwoDCartesianZone, Privilege: manage */ \ + 0x00000550, /* Cluster: Zone Management, Command: UpdateTwoDCartesianZone, Privilege: manage */ \ + 0x00000550, /* Cluster: Zone Management, Command: GetTwoDCartesianZone, Privilege: manage */ \ + 0x00000550, /* Cluster: Zone Management, Command: RemoveZone, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Command: AudioStreamAllocate, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Command: AudioStreamDeallocate, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Command: VideoStreamAllocate, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Command: VideoStreamModify, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Command: VideoStreamDeallocate, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Command: SnapshotStreamAllocate, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Command: SnapshotStreamDeallocate, Privilege: manage */ \ + 0x00000551, /* Cluster: Camera AV Stream Management, Command: SetStreamPriorities, Privilege: administer */ \ + 0x00000555, /* Cluster: Push AV Stream Transport, Command: AllocatePushTransport, Privilege: manage */ \ + 0x00000555, /* Cluster: Push AV Stream Transport, Command: DeallocatePushTransport, Privilege: manage */ \ + 0x00000555, /* Cluster: Push AV Stream Transport, Command: ModifyPushTransport, Privilege: manage */ \ + 0x00000555, /* Cluster: Push AV Stream Transport, Command: SetTransportStatus, Privilege: manage */ \ 0x00000751, /* Cluster: Commissioner Control, Command: RequestCommissioningApproval, Privilege: manage */ \ 0x00000751, /* Cluster: Commissioner Control, Command: CommissionNode, Privilege: manage */ \ + 0x00000801, /* Cluster: TLS Certificate Management, Command: ProvisionRootCertificate, Privilege: administer */ \ + 0x00000801, /* Cluster: TLS Certificate Management, Command: RemoveRootCertificate, Privilege: administer */ \ + 0x00000801, /* Cluster: TLS Certificate Management, Command: TLSClientCSR, Privilege: administer */ \ + 0x00000801, /* Cluster: TLS Certificate Management, Command: ProvisionClientCertificate, Privilege: administer */ \ + 0x00000801, /* Cluster: TLS Certificate Management, Command: RemoveClientCertificate, Privilege: administer */ \ 0xFFF1FC06, /* Cluster: Fault Injection, Command: FailAtFault, Privilege: manage */ \ 0xFFF1FC06, /* Cluster: Fault Injection, Command: FailRandomlyAtFault, Privilege: manage */ \ } @@ -542,6 +676,7 @@ 0x00000008, /* Cluster: Network Commissioning, Command: ReorderNetwork, Privilege: administer */ \ 0x00000009, /* Cluster: Network Commissioning, Command: QueryIdentity, Privilege: administer */ \ 0x00000000, /* Cluster: General Diagnostics, Command: TestEventTrigger, Privilege: manage */ \ + 0x00000003, /* Cluster: General Diagnostics, Command: PayloadTestRequest, Privilege: manage */ \ 0x00000000, /* Cluster: Software Diagnostics, Command: ResetWatermarks, Privilege: manage */ \ 0x00000000, /* Cluster: Thread Network Diagnostics, Command: ResetCounts, Privilege: manage */ \ 0x00000000, /* Cluster: Ethernet Network Diagnostics, Command: ResetCounts, Privilege: manage */ \ @@ -572,6 +707,7 @@ 0x00000002, /* Cluster: Scenes Management, Command: RemoveScene, Privilege: manage */ \ 0x00000003, /* Cluster: Scenes Management, Command: RemoveAllScenes, Privilege: manage */ \ 0x00000004, /* Cluster: Scenes Management, Command: StoreScene, Privilege: manage */ \ + 0x00000040, /* Cluster: Scenes Management, Command: CopyScene, Privilege: manage */ \ 0x00000000, /* Cluster: Water Heater Management, Command: Boost, Privilege: manage */ \ 0x00000001, /* Cluster: Water Heater Management, Command: CancelBoost, Privilege: manage */ \ 0x0000000B, /* Cluster: Door Lock, Command: SetWeekDaySchedule, Privilege: administer */ \ @@ -605,8 +741,29 @@ 0x00000001, /* Cluster: Audio Output, Command: RenameOutput, Privilege: manage */ \ 0x00000000, /* Cluster: Account Login, Command: GetSetupPIN, Privilege: administer */ \ 0x00000002, /* Cluster: Account Login, Command: Login, Privilege: administer */ \ + 0x00000000, /* Cluster: Zone Management, Command: CreateTwoDCartesianZone, Privilege: manage */ \ + 0x00000002, /* Cluster: Zone Management, Command: UpdateTwoDCartesianZone, Privilege: manage */ \ + 0x00000003, /* Cluster: Zone Management, Command: GetTwoDCartesianZone, Privilege: manage */ \ + 0x00000005, /* Cluster: Zone Management, Command: RemoveZone, Privilege: manage */ \ + 0x00000000, /* Cluster: Camera AV Stream Management, Command: AudioStreamAllocate, Privilege: manage */ \ + 0x00000002, /* Cluster: Camera AV Stream Management, Command: AudioStreamDeallocate, Privilege: manage */ \ + 0x00000003, /* Cluster: Camera AV Stream Management, Command: VideoStreamAllocate, Privilege: manage */ \ + 0x00000005, /* Cluster: Camera AV Stream Management, Command: VideoStreamModify, Privilege: manage */ \ + 0x00000006, /* Cluster: Camera AV Stream Management, Command: VideoStreamDeallocate, Privilege: manage */ \ + 0x00000007, /* Cluster: Camera AV Stream Management, Command: SnapshotStreamAllocate, Privilege: manage */ \ + 0x00000009, /* Cluster: Camera AV Stream Management, Command: SnapshotStreamDeallocate, Privilege: manage */ \ + 0x0000000A, /* Cluster: Camera AV Stream Management, Command: SetStreamPriorities, Privilege: administer */ \ + 0x00000000, /* Cluster: Push AV Stream Transport, Command: AllocatePushTransport, Privilege: manage */ \ + 0x00000002, /* Cluster: Push AV Stream Transport, Command: DeallocatePushTransport, Privilege: manage */ \ + 0x00000003, /* Cluster: Push AV Stream Transport, Command: ModifyPushTransport, Privilege: manage */ \ + 0x00000004, /* Cluster: Push AV Stream Transport, Command: SetTransportStatus, Privilege: manage */ \ 0x00000000, /* Cluster: Commissioner Control, Command: RequestCommissioningApproval, Privilege: manage */ \ 0x00000001, /* Cluster: Commissioner Control, Command: CommissionNode, Privilege: manage */ \ + 0x00000000, /* Cluster: TLS Certificate Management, Command: ProvisionRootCertificate, Privilege: administer */ \ + 0x00000006, /* Cluster: TLS Certificate Management, Command: RemoveRootCertificate, Privilege: administer */ \ + 0x00000007, /* Cluster: TLS Certificate Management, Command: TLSClientCSR, Privilege: administer */ \ + 0x00000009, /* Cluster: TLS Certificate Management, Command: ProvisionClientCertificate, Privilege: administer */ \ + 0x0000000F, /* Cluster: TLS Certificate Management, Command: RemoveClientCertificate, Privilege: administer */ \ 0x00000000, /* Cluster: Fault Injection, Command: FailAtFault, Privilege: manage */ \ 0x00000001, /* Cluster: Fault Injection, Command: FailRandomlyAtFault, Privilege: manage */ \ } @@ -632,6 +789,7 @@ chip::Access::Privilege::kAdminister, /* Cluster: Network Commissioning, Command: ReorderNetwork, Privilege: administer */ \ chip::Access::Privilege::kAdminister, /* Cluster: Network Commissioning, Command: QueryIdentity, Privilege: administer */ \ chip::Access::Privilege::kManage, /* Cluster: General Diagnostics, Command: TestEventTrigger, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: General Diagnostics, Command: PayloadTestRequest, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Software Diagnostics, Command: ResetWatermarks, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Thread Network Diagnostics, Command: ResetCounts, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Ethernet Network Diagnostics, Command: ResetCounts, Privilege: manage */ \ @@ -662,6 +820,7 @@ chip::Access::Privilege::kManage, /* Cluster: Scenes Management, Command: RemoveScene, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Scenes Management, Command: RemoveAllScenes, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Scenes Management, Command: StoreScene, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Scenes Management, Command: CopyScene, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Water Heater Management, Command: Boost, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Water Heater Management, Command: CancelBoost, Privilege: manage */ \ chip::Access::Privilege::kAdminister, /* Cluster: Door Lock, Command: SetWeekDaySchedule, Privilege: administer */ \ @@ -695,8 +854,29 @@ chip::Access::Privilege::kManage, /* Cluster: Audio Output, Command: RenameOutput, Privilege: manage */ \ chip::Access::Privilege::kAdminister, /* Cluster: Account Login, Command: GetSetupPIN, Privilege: administer */ \ chip::Access::Privilege::kAdminister, /* Cluster: Account Login, Command: Login, Privilege: administer */ \ + chip::Access::Privilege::kManage, /* Cluster: Zone Management, Command: CreateTwoDCartesianZone, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Zone Management, Command: UpdateTwoDCartesianZone, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Zone Management, Command: GetTwoDCartesianZone, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Zone Management, Command: RemoveZone, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Command: AudioStreamAllocate, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Command: AudioStreamDeallocate, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Command: VideoStreamAllocate, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Command: VideoStreamModify, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Command: VideoStreamDeallocate, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Command: SnapshotStreamAllocate, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Camera AV Stream Management, Command: SnapshotStreamDeallocate, Privilege: manage */ \ + chip::Access::Privilege::kAdminister, /* Cluster: Camera AV Stream Management, Command: SetStreamPriorities, Privilege: administer */ \ + chip::Access::Privilege::kManage, /* Cluster: Push AV Stream Transport, Command: AllocatePushTransport, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Push AV Stream Transport, Command: DeallocatePushTransport, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Push AV Stream Transport, Command: ModifyPushTransport, Privilege: manage */ \ + chip::Access::Privilege::kManage, /* Cluster: Push AV Stream Transport, Command: SetTransportStatus, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Commissioner Control, Command: RequestCommissioningApproval, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Commissioner Control, Command: CommissionNode, Privilege: manage */ \ + chip::Access::Privilege::kAdminister, /* Cluster: TLS Certificate Management, Command: ProvisionRootCertificate, Privilege: administer */ \ + chip::Access::Privilege::kAdminister, /* Cluster: TLS Certificate Management, Command: RemoveRootCertificate, Privilege: administer */ \ + chip::Access::Privilege::kAdminister, /* Cluster: TLS Certificate Management, Command: TLSClientCSR, Privilege: administer */ \ + chip::Access::Privilege::kAdminister, /* Cluster: TLS Certificate Management, Command: ProvisionClientCertificate, Privilege: administer */ \ + chip::Access::Privilege::kAdminister, /* Cluster: TLS Certificate Management, Command: RemoveClientCertificate, Privilege: administer */ \ chip::Access::Privilege::kManage, /* Cluster: Fault Injection, Command: FailAtFault, Privilege: manage */ \ chip::Access::Privilege::kManage, /* Cluster: Fault Injection, Command: FailRandomlyAtFault, Privilege: manage */ \ } diff --git a/components/esp_matter_controller/core/esp_matter_controller_client.cpp b/components/esp_matter_controller/core/esp_matter_controller_client.cpp index 1416aba6c..a844c69ff 100644 --- a/components/esp_matter_controller/core/esp_matter_controller_client.cpp +++ b/components/esp_matter_controller/core/esp_matter_controller_client.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -69,6 +70,7 @@ esp_err_t matter_controller_client::init(NodeId node_id, FabricId fabric_id, uin factory_init_params.opCertStore = &m_operational_cert_store; factory_init_params.enableServerInteractions = m_operational_advertising; factory_init_params.sessionKeystore = &m_session_key_store; + factory_init_params.dataModelProvider = chip::app::CodegenDataModelProviderInstance(&m_default_storage); m_controller_node_id = node_id; m_controller_fabric_id = fabric_id; diff --git a/components/esp_matter_ota_provider/src/esp_matter_ota_provider.cpp b/components/esp_matter_ota_provider/src/esp_matter_ota_provider.cpp index ddcf8b30a..346fee7c3 100644 --- a/components/esp_matter_ota_provider/src/esp_matter_ota_provider.cpp +++ b/components/esp_matter_ota_provider/src/esp_matter_ota_provider.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include #include @@ -56,7 +57,7 @@ static void GenerateUpdateToken(uint8_t *buf, size_t bufSize) static void GetUpdateTokenString(const ByteSpan &token, char *buf, size_t bufSize) { const uint8_t *tokenData = static_cast(token.data()); - size_t minLength = chip::min(token.size(), bufSize); + size_t minLength = std::min(token.size(), bufSize); for (size_t i = 0; i < (minLength / 2) - 1; ++i) { snprintf(&buf[i * 2], bufSize, "%02X", tokenData[i]); } diff --git a/connectedhomeip/connectedhomeip b/connectedhomeip/connectedhomeip index 43aa98c2d..9b8fffe0b 160000 --- a/connectedhomeip/connectedhomeip +++ b/connectedhomeip/connectedhomeip @@ -1 +1 @@ -Subproject commit 43aa98c2d30ee547c6b587b9de7bbb794f175ece +Subproject commit 9b8fffe0bb4e7ba7aac319f5905070a3476db7cb diff --git a/examples/common/secondary_ble_adv/platform/ESP32_custom/BLEManagerImpl.h b/examples/common/secondary_ble_adv/platform/ESP32_custom/BLEManagerImpl.h index 1f64bb46d..ae315e0b9 100644 --- a/examples/common/secondary_ble_adv/platform/ESP32_custom/BLEManagerImpl.h +++ b/examples/common/secondary_ble_adv/platform/ESP32_custom/BLEManagerImpl.h @@ -135,7 +135,6 @@ class BLEManagerImpl final : public BLEManager, #endif // CONFIG_ENABLE_ESP32_BLE_CONTROLLER { public: - uint8_t scanResponseBuffer[MAX_SCAN_RSP_DATA_LEN]; BLEManagerImpl() {} #ifdef CONFIG_ENABLE_ESP32_BLE_CONTROLLER CHIP_ERROR ConfigureBle(uint32_t aAdapterId, bool aIsCentral); @@ -190,6 +189,7 @@ public: private: chip::Optional mScanResponse; + uint8_t scanResponseBuffer[MAX_SCAN_RSP_DATA_LEN]; // Allow the BLEManager interface class to delegate method calls to // the implementation methods provided by this class. diff --git a/examples/common/secondary_ble_adv/platform/ESP32_custom/ESP32Utils.cpp b/examples/common/secondary_ble_adv/platform/ESP32_custom/ESP32Utils.cpp index 7a7fcad29..505253537 100644 --- a/examples/common/secondary_ble_adv/platform/ESP32_custom/ESP32Utils.cpp +++ b/examples/common/secondary_ble_adv/platform/ESP32_custom/ESP32Utils.cpp @@ -241,7 +241,7 @@ CHIP_ERROR ESP32Utils::GetWiFiStationProvision(Internal::DeviceNetworkInfo & net netInfo.NetworkId = kWiFiStationNetworkId; netInfo.FieldPresent.NetworkId = true; memcpy(netInfo.WiFiSSID, stationConfig.sta.ssid, - min(strlen(reinterpret_cast(stationConfig.sta.ssid)) + 1, sizeof(netInfo.WiFiSSID))); + std::min(strlen(reinterpret_cast(stationConfig.sta.ssid)) + 1, sizeof(netInfo.WiFiSSID))); // Enforce that netInfo wifiSSID is null terminated netInfo.WiFiSSID[kMaxWiFiSSIDLength] = '\0'; @@ -249,7 +249,7 @@ CHIP_ERROR ESP32Utils::GetWiFiStationProvision(Internal::DeviceNetworkInfo & net if (includeCredentials) { static_assert(sizeof(netInfo.WiFiKey) < 255, "Our min might not fit in netInfo.WiFiKeyLen"); - netInfo.WiFiKeyLen = static_cast(min(strlen((char *) stationConfig.sta.password), sizeof(netInfo.WiFiKey))); + netInfo.WiFiKeyLen = static_cast(std::min(strlen((char *) stationConfig.sta.password), sizeof(netInfo.WiFiKey))); memcpy(netInfo.WiFiKey, stationConfig.sta.password, netInfo.WiFiKeyLen); } @@ -268,7 +268,7 @@ CHIP_ERROR ESP32Utils::SetWiFiStationProvision(const Internal::DeviceNetworkInfo ReturnErrorOnFailure(ESP32Utils::EnableStationMode()); // Enforce that wifiSSID is null terminated before copying it - memcpy(wifiSSID, netInfo.WiFiSSID, min(netInfoSSIDLen + 1, sizeof(wifiSSID))); + memcpy(wifiSSID, netInfo.WiFiSSID, std::min(netInfoSSIDLen + 1, sizeof(wifiSSID))); if (netInfoSSIDLen + 1 < sizeof(wifiSSID)) { wifiSSID[netInfoSSIDLen] = '\0'; @@ -280,8 +280,8 @@ CHIP_ERROR ESP32Utils::SetWiFiStationProvision(const Internal::DeviceNetworkInfo // Initialize an ESP wifi_config_t structure based on the new provision information. memset(&wifiConfig, 0, sizeof(wifiConfig)); - memcpy(wifiConfig.sta.ssid, wifiSSID, min(strlen(wifiSSID) + 1, sizeof(wifiConfig.sta.ssid))); - memcpy(wifiConfig.sta.password, netInfo.WiFiKey, min((size_t) netInfo.WiFiKeyLen, sizeof(wifiConfig.sta.password))); + memcpy(wifiConfig.sta.ssid, wifiSSID, std::min(strlen(wifiSSID) + 1, sizeof(wifiConfig.sta.ssid))); + memcpy(wifiConfig.sta.password, netInfo.WiFiKey, std::min((size_t) netInfo.WiFiKeyLen, sizeof(wifiConfig.sta.password))); wifiConfig.sta.scan_method = WIFI_ALL_CHANNEL_SCAN; wifiConfig.sta.sort_method = WIFI_CONNECT_AP_BY_SIGNAL; diff --git a/examples/common/secondary_ble_adv/platform/ESP32_custom/PlatformManagerImpl.cpp b/examples/common/secondary_ble_adv/platform/ESP32_custom/PlatformManagerImpl.cpp index 35ff83c2d..7c11f6316 100644 --- a/examples/common/secondary_ble_adv/platform/ESP32_custom/PlatformManagerImpl.cpp +++ b/examples/common/secondary_ble_adv/platform/ESP32_custom/PlatformManagerImpl.cpp @@ -71,7 +71,7 @@ CHIP_ERROR PlatformManagerImpl::DisableESPEventDispatch() return Internal::ESP32Utils::MapError(err); } -CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) +CHIP_ERROR PlatformManagerImpl::_InitChipStack() { // Arrange for CHIP-encapsulated ESP32 errors to be translated to text Internal::ESP32Utils::RegisterESP32ErrorFormatter(); @@ -88,6 +88,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) err = esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, PlatformManagerImpl::HandleESPSystemEvent, nullptr); VerifyOrReturnError(err == ESP_OK, Internal::ESP32Utils::MapError(err)); #endif + // Arrange for the ESP event loop to deliver events into the CHIP Device layer. err = esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID, PlatformManagerImpl::HandleESPSystemEvent, nullptr); VerifyOrReturnError(err == ESP_OK, Internal::ESP32Utils::MapError(err)); diff --git a/examples/common/secondary_ble_adv/platform/ESP32_custom/nimble/BLEManagerImpl.cpp b/examples/common/secondary_ble_adv/platform/ESP32_custom/nimble/BLEManagerImpl.cpp index a2c934db0..c9c81b4db 100644 --- a/examples/common/secondary_ble_adv/platform/ESP32_custom/nimble/BLEManagerImpl.cpp +++ b/examples/common/secondary_ble_adv/platform/ESP32_custom/nimble/BLEManagerImpl.cpp @@ -48,7 +48,9 @@ #include #include +#ifndef CONFIG_IDF_TARGET_ESP32P4 #include "esp_bt.h" +#endif #include "esp_log.h" #if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) @@ -125,6 +127,7 @@ uint8_t own_addr_type = BLE_OWN_ADDR_RANDOM; ChipDeviceScanner & mDeviceScanner = Internal::ChipDeviceScanner::GetInstance(); #endif BLEManagerImpl BLEManagerImpl::sInstance; + const struct ble_gatt_svc_def BLEManagerImpl::CHIPoBLEGATTService = { .type = BLE_GATT_SVC_TYPE_PRIMARY, .uuid = (ble_uuid_t *) (&ShortUUID_CHIPoBLEService), @@ -277,12 +280,12 @@ void BLEManagerImpl::BleAdvTimeoutHandler(System::Layer *, void *) BLEMgrImpl().mFlags.Set(Flags::kFastAdvertisingEnabled, 0); BLEMgrImpl().mFlags.Set(Flags::kAdvertisingRefreshNeeded, 1); -#if CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING +#if CHIP_DEVICE_CONFIG_EXT_ADVERTISING BLEMgrImpl().mFlags.Clear(Flags::kExtAdvertisingEnabled); BLEMgrImpl().StartBleAdvTimeoutTimer(CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_CHANGE_TIME_MS); #endif } -#if CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING +#if CHIP_DEVICE_CONFIG_EXT_ADVERTISING else { ChipLogProgress(DeviceLayer, "bleAdv Timeout : Start extended advertisement"); @@ -1001,7 +1004,7 @@ void BLEManagerImpl::ClaimBLEMemory(System::Layer *, void *) #ifdef CONFIG_IDF_TARGET_ESP32 err = esp_bt_mem_release(ESP_BT_MODE_BTDM); -#elif defined(CONFIG_IDF_TARGET_ESP32C2) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || \ +#elif defined(CONFIG_IDF_TARGET_ESP32C2) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || \ defined(CONFIG_IDF_TARGET_ESP32H2) || defined(CONFIG_IDF_TARGET_ESP32C6) err = esp_bt_mem_release(ESP_BT_MODE_BLE); #endif @@ -1030,6 +1033,11 @@ CHIP_ERROR BLEManagerImpl::DeinitBLE() return MapBLEError(err); } +#ifdef CONFIG_IDF_TARGET_ESP32P4 +// Stub function to avoid link error +extern "C" void ble_transport_ll_deinit(void) {} +#endif + CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void) { CHIP_ERROR err; @@ -1074,7 +1082,7 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void) ExitNow(); } -#if CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING +#if CHIP_DEVICE_CONFIG_EXT_ADVERTISING // Check for extended advertisement interval and redact VID/PID if past the initial period. if (mFlags.Has(Flags::kExtAdvertisingEnabled)) { @@ -1100,6 +1108,7 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void) index = static_cast(index + sizeof(deviceIdInfo)); mAdvDataLen = index; + exit: return err; } @@ -1112,7 +1121,7 @@ CHIP_ERROR BLEManagerImpl::ConfigureScanResponseData(ByteSpan data) return CHIP_ERROR_INVALID_ARGUMENT; } memcpy(scanResponseBuffer, data.data(), data.size()); - ByteSpan scanResponseSpan(scanResponseBuffer); + ByteSpan scanResponseSpan(scanResponseBuffer, data.size()); mScanResponse = chip::Optional(scanResponseSpan); return CHIP_NO_ERROR; } @@ -1572,7 +1581,7 @@ void BLEManagerImpl::HandleC3CharRead(struct ble_gatt_char_context * param) additionalDataFields); SuccessOrExit(err); - os_mbuf_append(param->ctxt->om, bufferHandle->Start(), bufferHandle->DataLength()); + os_mbuf_append(param->ctxt->om, bufferHandle->Start(), static_cast(bufferHandle->DataLength())); exit: if (err != CHIP_NO_ERROR) @@ -1682,7 +1691,7 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void) } else { -#if CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING +#if CHIP_DEVICE_CONFIG_EXT_ADVERTISING if (!mFlags.Has(Flags::kExtAdvertisingEnabled)) { adv_params.itvl_min = CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MIN; @@ -1784,7 +1793,6 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void) return err; } - int BLEManagerImpl::secondary_ble_svr_gap_event(struct ble_gap_event * event, void * arg) { if (chip::DeviceLayer::Internal::BLEMgrImpl().mSecondaryBleGapEventHandler) { diff --git a/examples/common/secondary_ble_adv/platform/ESP32_custom/platform_change.patch b/examples/common/secondary_ble_adv/platform/ESP32_custom/platform_change.patch index 23fee6cae..4689e9821 100644 --- a/examples/common/secondary_ble_adv/platform/ESP32_custom/platform_change.patch +++ b/examples/common/secondary_ble_adv/platform/ESP32_custom/platform_change.patch @@ -1,5 +1,5 @@ diff --git a/src/platform/ESP32/BLEManagerImpl.h b/src/platform/ESP32/BLEManagerImpl.h -index eeed125012..e5480505c5 100644 +index 2a489420a0..ae315e0b90 100644 --- a/src/platform/ESP32/BLEManagerImpl.h +++ b/src/platform/ESP32/BLEManagerImpl.h @@ -61,6 +61,9 @@ struct ble_gatt_char_context @@ -12,7 +12,7 @@ index eeed125012..e5480505c5 100644 #endif // CONFIG_BT_BLUEDROID_ENABLED #include -@@ -144,6 +147,45 @@ public: +@@ -143,6 +146,47 @@ public: CHIP_ERROR ConfigureScanResponseData(ByteSpan data); void ClearScanResponseData(void); @@ -54,11 +54,13 @@ index eeed125012..e5480505c5 100644 + mSecondaryBleBonding = bleBonding; + mSecondaryBleSmSc = bleSmSc; + } ++ ++ void RefreshAdv(void); + private: chip::Optional mScanResponse; - -@@ -346,7 +388,7 @@ private: + uint8_t scanResponseBuffer[MAX_SCAN_RSP_DATA_LEN]; +@@ -346,7 +390,7 @@ private: static void bleprph_host_task(void * param); static void bleprph_on_sync(void); static void bleprph_on_reset(int); @@ -67,7 +69,7 @@ index eeed125012..e5480505c5 100644 static int ble_svr_gap_event(struct ble_gap_event * event, void * arg); static int gatt_svr_chr_access(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt * ctxt, void * arg); -@@ -380,6 +422,31 @@ private: +@@ -380,6 +424,31 @@ private: #endif // CONFIG_ENABLE_ESP32_BLE_CONTROLLER static void DriveBLEState(intptr_t arg); @@ -100,7 +102,7 @@ index eeed125012..e5480505c5 100644 /** diff --git a/src/platform/ESP32/ESP32Utils.cpp b/src/platform/ESP32/ESP32Utils.cpp -index ffa45ee722..7a7fcad299 100644 +index e66007a0a8..5052535376 100644 --- a/src/platform/ESP32/ESP32Utils.cpp +++ b/src/platform/ESP32/ESP32Utils.cpp @@ -311,62 +311,7 @@ CHIP_ERROR ESP32Utils::ClearWiFiStationProvision(void) @@ -168,14 +170,13 @@ index ffa45ee722..7a7fcad299 100644 } #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI diff --git a/src/platform/ESP32/PlatformManagerImpl.cpp b/src/platform/ESP32/PlatformManagerImpl.cpp -index 2c73019933..35ff83c2df 100644 +index 2c73019933..7c11f63165 100644 --- a/src/platform/ESP32/PlatformManagerImpl.cpp +++ b/src/platform/ESP32/PlatformManagerImpl.cpp -@@ -60,7 +60,18 @@ static int app_entropy_source(void * data, unsigned char * output, size_t len, s +@@ -60,6 +60,17 @@ static int app_entropy_source(void * data, unsigned char * output, size_t len, s return 0; } --CHIP_ERROR PlatformManagerImpl::_InitChipStack() +CHIP_ERROR PlatformManagerImpl::DisableESPEventDispatch() +{ + esp_err_t err = esp_event_handler_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, PlatformManagerImpl::HandleESPSystemEvent); @@ -187,11 +188,10 @@ index 2c73019933..35ff83c2df 100644 + return Internal::ESP32Utils::MapError(err); +} + -+CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) + CHIP_ERROR PlatformManagerImpl::_InitChipStack() { // Arrange for CHIP-encapsulated ESP32 errors to be translated to text - Internal::ESP32Utils::RegisterESP32ErrorFormatter(); -@@ -73,6 +84,10 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() +@@ -73,6 +84,11 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() esp_err_t err = esp_netif_init(); VerifyOrReturnError(err == ESP_OK, Internal::ESP32Utils::MapError(err)); @@ -199,6 +199,7 @@ index 2c73019933..35ff83c2df 100644 + err = esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, PlatformManagerImpl::HandleESPSystemEvent, nullptr); + VerifyOrReturnError(err == ESP_OK, Internal::ESP32Utils::MapError(err)); +#endif ++ // Arrange for the ESP event loop to deliver events into the CHIP Device layer. err = esp_event_handler_register(IP_EVENT, ESP_EVENT_ANY_ID, PlatformManagerImpl::HandleESPSystemEvent, nullptr); VerifyOrReturnError(err == ESP_OK, Internal::ESP32Utils::MapError(err)); @@ -215,10 +216,10 @@ index cc2b0eefe9..0d99857ef8 100644 private: // ===== Methods that implement the PlatformManager abstract interface. diff --git a/src/platform/ESP32/nimble/BLEManagerImpl.cpp b/src/platform/ESP32/nimble/BLEManagerImpl.cpp -index d4d90f4536..75328ddb3c 100644 +index 0a2ddb1763..c9c81b4db1 100644 --- a/src/platform/ESP32/nimble/BLEManagerImpl.cpp +++ b/src/platform/ESP32/nimble/BLEManagerImpl.cpp -@@ -125,39 +125,35 @@ uint8_t own_addr_type = BLE_OWN_ADDR_RANDOM; +@@ -127,39 +127,36 @@ uint8_t own_addr_type = BLE_OWN_ADDR_RANDOM; ChipDeviceScanner & mDeviceScanner = Internal::ChipDeviceScanner::GetInstance(); #endif BLEManagerImpl BLEManagerImpl::sInstance; @@ -239,6 +240,7 @@ index d4d90f4536..75328ddb3c 100644 - .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_INDICATE, - .val_handle = &sInstance.mTXCharCCCDAttrHandle, - }, ++ +const struct ble_gatt_svc_def BLEManagerImpl::CHIPoBLEGATTService = { + .type = BLE_GATT_SVC_TYPE_PRIMARY, + .uuid = (ble_uuid_t *) (&ShortUUID_CHIPoBLEService), @@ -285,7 +287,7 @@ index d4d90f4536..75328ddb3c 100644 }; #ifdef CONFIG_ENABLE_ESP32_BLE_CONTROLLER -@@ -773,6 +769,12 @@ void BLEManagerImpl::DriveBLEState(void) +@@ -775,6 +772,12 @@ void BLEManagerImpl::DriveBLEState(void) ChipLogError(DeviceLayer, "Configure Adv Data failed: %s", ErrorStr(err)); ExitNow(); } @@ -298,7 +300,7 @@ index d4d90f4536..75328ddb3c 100644 } // Start advertising. This is also an asynchronous step. -@@ -783,6 +785,12 @@ void BLEManagerImpl::DriveBLEState(void) +@@ -785,6 +788,12 @@ void BLEManagerImpl::DriveBLEState(void) ChipLogError(DeviceLayer, "Start advertising failed: %s", ErrorStr(err)); ExitNow(); } @@ -311,7 +313,7 @@ index d4d90f4536..75328ddb3c 100644 mFlags.Clear(Flags::kAdvertisingRefreshNeeded); // Transition to the Advertising state... -@@ -808,12 +816,12 @@ void BLEManagerImpl::DriveBLEState(void) +@@ -810,12 +819,12 @@ void BLEManagerImpl::DriveBLEState(void) { if (mFlags.Has(Flags::kAdvertising)) { @@ -327,7 +329,7 @@ index d4d90f4536..75328ddb3c 100644 ExitNow(); } } -@@ -939,14 +947,15 @@ CHIP_ERROR BLEManagerImpl::InitESPBleLayer(void) +@@ -941,14 +950,15 @@ CHIP_ERROR BLEManagerImpl::InitESPBleLayer(void) ble_svc_gap_init(); ble_svc_gatt_init(); @@ -345,16 +347,7 @@ index d4d90f4536..75328ddb3c 100644 if (err != CHIP_NO_ERROR) { ChipLogError(DeviceLayer, "ble_gatts_add_svcs failed: %s", ErrorStr(err)); -@@ -992,7 +1001,7 @@ void BLEManagerImpl::ClaimBLEMemory(System::Layer *, void *) - - #ifdef CONFIG_IDF_TARGET_ESP32 - err = esp_bt_mem_release(ESP_BT_MODE_BTDM); --#elif defined(CONFIG_IDF_TARGET_ESP32C2) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || \ -+#elif defined(CONFIG_IDF_TARGET_ESP32C2) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) || \ - defined(CONFIG_IDF_TARGET_ESP32H2) || defined(CONFIG_IDF_TARGET_ESP32C6) - err = esp_bt_mem_release(ESP_BT_MODE_BLE); - #endif -@@ -1024,7 +1033,6 @@ CHIP_ERROR BLEManagerImpl::DeinitBLE() +@@ -1031,7 +1041,6 @@ extern "C" void ble_transport_ll_deinit(void) {} CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void) { CHIP_ERROR err; @@ -362,7 +355,7 @@ index d4d90f4536..75328ddb3c 100644 uint8_t index = 0; constexpr uint8_t kServiceDataTypeSize = 1; -@@ -1050,14 +1058,14 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void) +@@ -1057,14 +1066,14 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void) ExitNow(); } @@ -385,7 +378,7 @@ index d4d90f4536..75328ddb3c 100644 err = ConfigurationMgr().GetBLEDeviceIdentificationInfo(deviceIdInfo); if (err != CHIP_NO_ERROR) -@@ -1087,18 +1095,11 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void) +@@ -1094,17 +1103,11 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void) } #endif @@ -402,12 +395,26 @@ index d4d90f4536..75328ddb3c 100644 - ChipLogError(DeviceLayer, "ble_gap_adv_set_data failed: %s %d", ErrorStr(err), discriminator); - ExitNow(); - } -- + mAdvDataLen = index; + exit: return err; +@@ -1371,6 +1374,14 @@ CHIP_ERROR BLEManagerImpl::HandleGAPConnect(struct ble_gap_event * gapEvent) + #endif } -@@ -1651,16 +1652,18 @@ int BLEManagerImpl::gatt_svr_chr_access(uint16_t conn_handle, uint16_t attr_hand + ++void BLEManagerImpl::RefreshAdv(void) ++{ ++ mFlags.Set(Flags::kAdvertisingRefreshNeeded); ++ mFlags.Clear(Flags::kAdvertisingConfigured); ++ ++ PlatformMgr().ScheduleWork(DriveBLEState, 0); ++} ++ + CHIP_ERROR BLEManagerImpl::HandleGAPDisconnect(struct ble_gap_event * gapEvent) + { + ChipLogProgress(DeviceLayer, "BLE GAP connection terminated (con %u reason 0x%02x)", gapEvent->disconnect.conn.conn_handle, +@@ -1658,16 +1669,18 @@ int BLEManagerImpl::gatt_svr_chr_access(uint16_t conn_handle, uint16_t attr_hand CHIP_ERROR BLEManagerImpl::StartAdvertising(void) { CHIP_ERROR err; @@ -431,7 +438,7 @@ index d4d90f4536..75328ddb3c 100644 // Advertise in fast mode if it is connectable advertisement and // the application has expressly requested fast advertising. -@@ -1694,48 +1697,187 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void) +@@ -1701,48 +1714,186 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void) (((uint32_t) adv_params.itvl_min) * 10) / 16, (connectable) ? "" : "non-"); { @@ -453,8 +460,7 @@ index d4d90f4536..75328ddb3c 100644 - else + err = MapBLEError(ble_gap_ext_adv_configure(kChipAdvInstance, &adv_params, NULL, ble_svr_gap_event, NULL)); + if (err != CHIP_NO_ERROR) - { -- err = MapBLEError(ble_hs_pvcy_rpa_config(NIMBLE_HOST_ENABLE_RPA)); ++ { + ChipLogError(DeviceLayer, "ble_gap_ext_adv_configure failed: %s", ErrorStr(err)); + return err; + } @@ -494,7 +500,8 @@ index d4d90f4536..75328ddb3c 100644 + } + + if (mScanResponse.HasValue()) -+ { + { +- err = MapBLEError(ble_hs_pvcy_rpa_config(NIMBLE_HOST_ENABLE_RPA)); + uint16_t resp_size = static_cast(mScanResponse.Value().size()); + struct os_mbuf * resp_data = os_msys_get_pkthdr(resp_size, 0); + assert(resp_data); @@ -531,7 +538,6 @@ index d4d90f4536..75328ddb3c 100644 + return err; +} + -+ +int BLEManagerImpl::secondary_ble_svr_gap_event(struct ble_gap_event * event, void * arg) +{ + if (chip::DeviceLayer::Internal::BLEMgrImpl().mSecondaryBleGapEventHandler) { diff --git a/examples/zap_light/main/CMakeLists.txt b/examples/zap_light/main/CMakeLists.txt index c7c4a85fd..7b336ce3f 100644 --- a/examples/zap_light/main/CMakeLists.txt +++ b/examples/zap_light/main/CMakeLists.txt @@ -1,40 +1,19 @@ idf_component_register(SRC_DIRS "." - "${MATTER_SDK_PATH}/src/app/clusters/access-control-server" - "${MATTER_SDK_PATH}/src/app/clusters/administrator-commissioning-server" - "${MATTER_SDK_PATH}/src/app/clusters/basic-information" - "${MATTER_SDK_PATH}/src/app/clusters/bindings" - "${MATTER_SDK_PATH}/src/app/clusters/color-control-server" - "${MATTER_SDK_PATH}/src/app/clusters/descriptor" - "${MATTER_SDK_PATH}/src/app/clusters/diagnostic-logs-server" - "${MATTER_SDK_PATH}/src/app/clusters/ethernet-network-diagnostics-server" - "${MATTER_SDK_PATH}/src/app/clusters/fixed-label-server" - "${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-server" - "${MATTER_SDK_PATH}/src/app/clusters/identify-server" - "${MATTER_SDK_PATH}/src/app/clusters/level-control" - "${MATTER_SDK_PATH}/src/app/clusters/localization-configuration-server" - "${MATTER_SDK_PATH}/src/app/clusters/network-commissioning" - "${MATTER_SDK_PATH}/src/app/clusters/on-off-server" - "${MATTER_SDK_PATH}/src/app/clusters/operational-credentials-server" - "${MATTER_SDK_PATH}/src/app/clusters/ota-requestor" - "${MATTER_SDK_PATH}/src/app/clusters/scenes-server" - "${MATTER_SDK_PATH}/src/app/clusters/software-diagnostics-server" - "${MATTER_SDK_PATH}/src/app/clusters/switch-server" - "${MATTER_SDK_PATH}/src/app/clusters/thread-network-diagnostics-server" - "${MATTER_SDK_PATH}/src/app/clusters/time-format-localization-server" - "${MATTER_SDK_PATH}/src/app/clusters/user-label-server" - "${MATTER_SDK_PATH}/src/app/clusters/wifi-network-diagnostics-server" "${MATTER_SDK_PATH}/src/app/util" "${MATTER_SDK_PATH}/zzz_generated/app-common/app-common/zap-generated/attributes" + # TODO Remove this from source as the zap doesn't use binding cluster + "${MATTER_SDK_PATH}/src/app/clusters/bindings" PRIV_INCLUDE_DIRS "." "${ESP_MATTER_PATH}/examples/common/utils") -# We must set CHIP_ROOT to include esp32_codegen.cmake +# We must set CHIP_ROOT to include chip_data_model.cmake get_filename_component(CHIP_ROOT "${MATTER_SDK_PATH}" REALPATH) -include("${CHIP_ROOT}/build/chip/esp32/esp32_codegen.cmake") -chip_app_component_codegen("${CHIP_ROOT}/examples/lighting-app/lighting-common/lighting-app.matter") -chip_app_component_zapgen("${CHIP_ROOT}/examples/lighting-app/lighting-common/lighting-app.zap") +include(${CHIP_ROOT}/src/app/chip_data_model.cmake) +chip_configure_data_model(${COMPONENT_LIB} + ZAP_FILE ${CHIP_ROOT}/examples/lighting-app/lighting-common/lighting-app.zap) + +add_prebuilt_library(matterlib "${CMAKE_BINARY_DIR}/esp-idf/chip/lib/libCHIP.a" + REQUIRES esp_matter main) +target_link_libraries(${COMPONENT_LIB} INTERFACE matterlib) set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H")