mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
submodule: Update connectedhomeip to f1f3a55c9b
esp_matter: Add support for disabling/enabling ICD server dynamically
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ variables:
|
||||
IDF_CHECKOUT_REF: "v5.4.1"
|
||||
# This variable represents the short hash of the connectedhomeip submodule.
|
||||
# Note: Do change this short hash on submodule update MRs.
|
||||
CHIP_SHORT_HASH: "19aeeb3ba0"
|
||||
CHIP_SHORT_HASH: "f1f3a55c9b"
|
||||
DOCKER_IMAGE_NAME: "espressif/chip-idf"
|
||||
|
||||
.add_gitlab_ssh_key: &add_gitlab_ssh_key |
|
||||
|
||||
@@ -28,7 +28,7 @@ section in the ESP-Matter Programming Guide.
|
||||
|
||||
## Supported ESP-IDF and connectedhomeip versions
|
||||
|
||||
- This SDK currently works with commit [19aeeb3ba0](https://github.com/project-chip/connectedhomeip/tree/19aeeb3ba0) of connectedhomeip.
|
||||
- This SDK currently works with commit [f1f3a55c9b](https://github.com/project-chip/connectedhomeip/tree/f1f3a55c9b) of connectedhomeip.
|
||||
- For Matter projects development with this SDK, it is recommended to utilize ESP-IDF [v5.4.1](https://github.com/espressif/esp-idf/tree/v5.4.1).
|
||||
|
||||
## Documentation
|
||||
|
||||
@@ -36,6 +36,10 @@ endif()
|
||||
|
||||
set(REQUIRES_LIST chip bt esp_matter_console nvs_flash app_update esp_secure_cert_mgr mbedtls esp_system openthread json)
|
||||
|
||||
if ("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
|
||||
list(APPEND REQUIRES_LIST esp_rcp_update)
|
||||
endif()
|
||||
|
||||
idf_component_register( SRC_DIRS ${SRC_DIRS_LIST}
|
||||
INCLUDE_DIRS ${INCLUDE_DIRS_LIST}
|
||||
EXCLUDE_SRCS ${EXCLUDE_SRCS_LIST}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <esp_log.h>
|
||||
#include <esp_matter.h>
|
||||
#include <esp_matter_core.h>
|
||||
#include <esp_matter_icd_configuration.h>
|
||||
#include <esp_matter_test_event_trigger.h>
|
||||
#include <nvs.h>
|
||||
|
||||
@@ -781,6 +782,20 @@ static void esp_matter_chip_init_task(intptr_t context)
|
||||
if (GetDiagnosticDataProvider().GetBootReason(bootReason) == CHIP_NO_ERROR) {
|
||||
chip::app::Clusters::GeneralDiagnosticsServer::Instance().OnDeviceReboot(bootReason);
|
||||
}
|
||||
|
||||
#if CHIP_CONFIG_ENABLE_ICD_SERVER
|
||||
if (!icd::get_icd_server_enabled()) {
|
||||
// ICD server has been initialized in chip::Server::GetInstance().Init(). disable it here if
|
||||
// icd_server_enabled is set to false.
|
||||
chip::app::InteractionModelEngine::GetInstance()->SetICDManager(nullptr);
|
||||
chip::app::DnssdServer::Instance().SetICDManager(nullptr);
|
||||
chip::TestEventTriggerDelegate *test_event_trigger = chip::Server::GetInstance().GetTestEventTriggerDelegate();
|
||||
if (test_event_trigger) {
|
||||
test_event_trigger->RemoveHandler(&chip::Server::GetInstance().GetICDManager());
|
||||
}
|
||||
chip::Server::GetInstance().GetICDManager().Shutdown();
|
||||
}
|
||||
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
|
||||
PlatformMgr().ScheduleWork(deinit_ble_if_commissioned, reinterpret_cast<intptr_t>(nullptr));
|
||||
xTaskNotifyGive(task_to_notify);
|
||||
}
|
||||
@@ -839,7 +854,13 @@ static esp_err_t chip_init(event_callback_t callback, intptr_t callback_arg)
|
||||
#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"));
|
||||
if (icd::get_icd_server_enabled()) {
|
||||
VerifyOrReturnError(ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice) == 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"));
|
||||
}
|
||||
|
||||
#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"));
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <esp_log.h>
|
||||
#include <esp_matter.h>
|
||||
#include <esp_matter_endpoint.h>
|
||||
#include <esp_matter_icd_configuration.h>
|
||||
|
||||
static const char *TAG = "esp_matter_endpoint";
|
||||
|
||||
@@ -80,17 +81,19 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
|
||||
group_key_management::create(endpoint, CLUSTER_FLAG_SERVER);
|
||||
|
||||
#if CHIP_CONFIG_ENABLE_ICD_SERVER
|
||||
icd_management::create(endpoint, &(config->icd_management), CLUSTER_FLAG_SERVER,
|
||||
if (icd::get_icd_server_enabled()) {
|
||||
icd_management::create(endpoint, &(config->icd_management), CLUSTER_FLAG_SERVER,
|
||||
#if CHIP_CONFIG_ENABLE_ICD_LIT
|
||||
icd_management::feature::long_idle_time_support::get_id() |
|
||||
icd_management::feature::long_idle_time_support::get_id() |
|
||||
#if CHIP_CONFIG_ENABLE_ICD_CIP
|
||||
icd_management::feature::check_in_protocol_support::get_id() |
|
||||
icd_management::feature::check_in_protocol_support::get_id() |
|
||||
#endif // CHIP_CONFIG_ENABLE_ICD_CIP
|
||||
#if CHIP_CONFIG_ENABLE_ICD_UAT
|
||||
icd_management::feature::user_active_mode_trigger::get_id() |
|
||||
icd_management::feature::user_active_mode_trigger::get_id() |
|
||||
#endif // CHIP_CONFIG_ENABLE_ICD_UAT
|
||||
#endif // CHIP_CONFIG_ENABLE_ICD_LIT
|
||||
0);
|
||||
}
|
||||
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@@ -107,17 +107,31 @@ static esp_err_t set_active_threshold(uint32_t active_threshold_ms)
|
||||
return chip::Test::ICDConfigurationDataTestAccess::SetActiveThreshold(Milliseconds32(active_threshold_ms));
|
||||
}
|
||||
|
||||
static bool s_enable_icd_server = true;
|
||||
|
||||
bool get_icd_server_enabled()
|
||||
{
|
||||
return s_enable_icd_server;
|
||||
}
|
||||
|
||||
esp_err_t set_configuration_data(config_t *config)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(config, ESP_ERR_INVALID_ARG, TAG, "config cannot be NULL");
|
||||
if (!config->enable_icd_server) {
|
||||
ESP_RETURN_ON_FALSE(!node::get(), ESP_ERR_INVALID_STATE, TAG,
|
||||
"Could not disable ICD server after data model is created");
|
||||
}
|
||||
s_enable_icd_server = config->enable_icd_server;
|
||||
ESP_RETURN_ON_FALSE(!is_started(), ESP_ERR_INVALID_STATE, TAG,
|
||||
"Could not change ICD configuration data after Matter is started");
|
||||
ESP_RETURN_ON_FALSE(config, ESP_ERR_INVALID_ARG, TAG, "config cannot be NULL");
|
||||
ESP_RETURN_ON_ERROR(set_polling_intervals(config->fast_interval_ms, config->slow_interval_ms), TAG,
|
||||
"Failed to set polling intervals");
|
||||
ESP_RETURN_ON_ERROR(set_mode_durations(config->active_mode_duration_ms, config->idle_mode_duration_s), TAG,
|
||||
"Failed to set mode durations");
|
||||
ESP_RETURN_ON_ERROR(set_active_threshold(config->active_threshold_ms.value()), TAG,
|
||||
"Failed to set active threshold");
|
||||
if (config->active_threshold_ms.has_value()) {
|
||||
ESP_RETURN_ON_ERROR(set_active_threshold(config->active_threshold_ms.value()), TAG,
|
||||
"Failed to set active threshold");
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace esp_matter {
|
||||
namespace icd {
|
||||
|
||||
typedef struct config {
|
||||
bool enable_icd_server;
|
||||
std::optional<uint32_t> fast_interval_ms;
|
||||
std::optional<uint32_t> slow_interval_ms;
|
||||
std::optional<uint32_t> active_mode_duration_ms;
|
||||
@@ -26,6 +27,14 @@ typedef struct config {
|
||||
std::optional<uint32_t> active_threshold_ms;
|
||||
} config_t;
|
||||
|
||||
/** Get whether ICD server is enabled for Matter end-device
|
||||
*/
|
||||
bool get_icd_server_enabled();
|
||||
|
||||
/** Set ICD configuration data
|
||||
*
|
||||
* This function allows the user to enable or disable the ICD server and configure its settings at runtime, before creating the Matter data model.
|
||||
*/
|
||||
esp_err_t set_configuration_data(config_t *config);
|
||||
|
||||
} // namespace icd
|
||||
|
||||
Submodule connectedhomeip/connectedhomeip updated: 19aeeb3ba0...f1f3a55c9b
Reference in New Issue
Block a user