From ca1a2f7daa28d3cab2de94d388a8b555d03f1b9d Mon Sep 17 00:00:00 2001 From: chendejin Date: Mon, 3 Jun 2024 15:03:32 +0800 Subject: [PATCH] Added endpoint id for Thread network commissioning instance --- src/platform/BUILD.gn | 8 ++++++++ .../GenericThreadStackManagerImpl_OpenThread.hpp | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index 97365a2ee72e0f..474e3c17ce284b 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -85,6 +85,9 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { # devices with multiple radios that have different sleep behavior for # different radios. chip_device_config_enable_dynamic_mrp_config = false + + # Define the default endpoint id for the generic Thread network commissioning instance + chip_device_config_thread_network_endpoint_id = 0 } if (chip_stack_lock_tracking == "auto") { @@ -389,6 +392,11 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { defines += [ "CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES=${chip_max_discovered_ip_addresses}" ] + if (chip_enable_openthread && chip_device_platform != "linux" && + chip_device_platform != "tizen" && chip_device_platform != "webos") { + defines += [ "CHIP_DEVICE_CONFIG_THREAD_NETWORK_ENDPOINT_ID=${chip_device_config_thread_network_endpoint_id}" ] + } + visibility = [ ":platform_config_header", "${chip_root}/src/ble:ble_config_header", diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp index cf1894cf93fc74..2056699d77c8c0 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp @@ -76,7 +76,8 @@ static_assert(OPENTHREAD_API_VERSION >= 219, "OpenThread version too old"); namespace { #ifndef _NO_NETWORK_COMMISSIONING_DRIVER_ NetworkCommissioning::GenericThreadDriver sGenericThreadDriver; -app::Clusters::NetworkCommissioning::Instance sThreadNetworkCommissioningInstance(0 /* Endpoint Id */, &sGenericThreadDriver); +app::Clusters::NetworkCommissioning::Instance + sThreadNetworkCommissioningInstance(CHIP_DEVICE_CONFIG_THREAD_NETWORK_ENDPOINT_ID /* Endpoint Id */, &sGenericThreadDriver); #endif void initNetworkCommissioningThreadDriver(void)