From 026b09b50835437cd65c1a8fb18c9abdacc61a92 Mon Sep 17 00:00:00 2001 From: ATmobica Date: Fri, 11 Feb 2022 10:57:46 +0000 Subject: [PATCH] Add CONFIG_CHIP_DATA_MODEL flag to all Mbed examples Passing config data model flag to gn build Fix Wifi driver initialization for no data model examples --- config/mbed/CMakeLists.txt | 1 + examples/all-clusters-app/mbed/config.in | 3 ++- examples/lighting-app/mbed/config.in | 3 ++- examples/lock-app/mbed/config.in | 3 ++- examples/ota-requestor-app/mbed/config.in | 3 ++- examples/pigweed-app/mbed/config.in | 3 ++- examples/shell/mbed/config.in | 1 + src/platform/mbed/ConnectivityManagerImpl_WiFi.cpp | 10 +++++++--- src/test_driver/mbed/unit_tests/config.in | 1 + 9 files changed, 20 insertions(+), 8 deletions(-) diff --git a/config/mbed/CMakeLists.txt b/config/mbed/CMakeLists.txt index 795dc68366a651..35b615115585ac 100644 --- a/config/mbed/CMakeLists.txt +++ b/config/mbed/CMakeLists.txt @@ -273,6 +273,7 @@ chip_gn_arg_bool ("chip_build_libshell" CONFIG_CHIP_LIB_SHELL) chip_gn_arg_bool ("chip_with_platform_mbedtls" CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS) chip_gn_arg_bool ("chip_bypass_rendezvous" CONFIG_CHIP_BYPASS_RENDEZVOUS) chip_gn_arg_bool ("chip_build_pw_rpc_lib" CONFIG_CHIP_PW_RPC) +chip_gn_arg_bool ("chip_enable_data_model" CONFIG_CHIP_DATA_MODEL) if (CONFIG_CHIP_PW_RPC) chip_gn_arg_bool ("chip_build_pw_rpc_echo_proto" CONFIG_CHIP_PW_RPC_ECHO_PROTO) chip_gn_arg_bool ("chip_build_pw_rpc_common_proto" CONFIG_CHIP_PW_RPC_COMMON_PROTO) diff --git a/examples/all-clusters-app/mbed/config.in b/examples/all-clusters-app/mbed/config.in index 262822b1ca58df..e1bc59c07a44b0 100644 --- a/examples/all-clusters-app/mbed/config.in +++ b/examples/all-clusters-app/mbed/config.in @@ -3,4 +3,5 @@ CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS=y CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h CONFIG_CHIP_BYPASS_RENDEZVOUS=n CONFIG_MBED_BSD_SOCKET_TRACE=n -CONFIG_CHIP_OTA_REQUESTOR=y \ No newline at end of file +CONFIG_CHIP_OTA_REQUESTOR=y +CONFIG_CHIP_DATA_MODEL=y diff --git a/examples/lighting-app/mbed/config.in b/examples/lighting-app/mbed/config.in index 2d07ccc63b03c3..f55d13d9e9dd68 100644 --- a/examples/lighting-app/mbed/config.in +++ b/examples/lighting-app/mbed/config.in @@ -4,4 +4,5 @@ CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h CONFIG_CHIP_BYPASS_RENDEZVOUS=n CONFIG_MBED_BSD_SOCKET_TRACE=n CONFIG_CHIP_PW_RPC=y -CONFIG_CHIP_OTA_REQUESTOR=y \ No newline at end of file +CONFIG_CHIP_OTA_REQUESTOR=y +CONFIG_CHIP_DATA_MODEL=y diff --git a/examples/lock-app/mbed/config.in b/examples/lock-app/mbed/config.in index 6c687926f2f5c7..87619681f691c0 100644 --- a/examples/lock-app/mbed/config.in +++ b/examples/lock-app/mbed/config.in @@ -4,4 +4,5 @@ CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h CONFIG_CHIP_BYPASS_RENDEZVOUS=n CONFIG_MBED_BSD_SOCKET_TRACE=n CONFIG_CHIP_PW_RPC=y -CONFIG_CHIP_OTA_REQUESTOR=n \ No newline at end of file +CONFIG_CHIP_OTA_REQUESTOR=n +CONFIG_CHIP_DATA_MODEL=y diff --git a/examples/ota-requestor-app/mbed/config.in b/examples/ota-requestor-app/mbed/config.in index 262822b1ca58df..93cc98cf544af1 100644 --- a/examples/ota-requestor-app/mbed/config.in +++ b/examples/ota-requestor-app/mbed/config.in @@ -3,4 +3,5 @@ CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS=y CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h CONFIG_CHIP_BYPASS_RENDEZVOUS=n CONFIG_MBED_BSD_SOCKET_TRACE=n -CONFIG_CHIP_OTA_REQUESTOR=y \ No newline at end of file +CONFIG_CHIP_OTA_REQUESTOR=y +CONFIG_CHIP_DATA_MODEL=y \ No newline at end of file diff --git a/examples/pigweed-app/mbed/config.in b/examples/pigweed-app/mbed/config.in index 6c687926f2f5c7..89a6a784e8a438 100644 --- a/examples/pigweed-app/mbed/config.in +++ b/examples/pigweed-app/mbed/config.in @@ -4,4 +4,5 @@ CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h CONFIG_CHIP_BYPASS_RENDEZVOUS=n CONFIG_MBED_BSD_SOCKET_TRACE=n CONFIG_CHIP_PW_RPC=y -CONFIG_CHIP_OTA_REQUESTOR=n \ No newline at end of file +CONFIG_CHIP_OTA_REQUESTOR=n +CONFIG_CHIP_DATA_MODEL=n diff --git a/examples/shell/mbed/config.in b/examples/shell/mbed/config.in index ace6c25e719399..700185f2f5ceca 100644 --- a/examples/shell/mbed/config.in +++ b/examples/shell/mbed/config.in @@ -5,3 +5,4 @@ CONFIG_CHIP_BYPASS_RENDEZVOUS=n CONFIG_CHIP_LIB_SHELL=y CONFIG_MBED_BSD_SOCKET_TRACE=n CONFIG_CHIP_OTA_REQUESTOR=y +CONFIG_CHIP_DATA_MODEL=n diff --git a/src/platform/mbed/ConnectivityManagerImpl_WiFi.cpp b/src/platform/mbed/ConnectivityManagerImpl_WiFi.cpp index 94a942180b2772..57aca8b67b5183 100644 --- a/src/platform/mbed/ConnectivityManagerImpl_WiFi.cpp +++ b/src/platform/mbed/ConnectivityManagerImpl_WiFi.cpp @@ -38,10 +38,12 @@ using namespace ::chip::DeviceLayer::Internal; namespace chip { namespace DeviceLayer { +#if CHIP_DEVICE_ENABLE_DATA_MODEL namespace { app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(0 /* Endpoint Id */, &(NetworkCommissioning::WiFiDriverImpl::GetInstance())); } // namespace +#endif // CHIP_DEVICE_ENABLE_DATA_MODEL CHIP_ERROR ConnectivityManagerImpl::InitWiFi() { @@ -51,10 +53,12 @@ CHIP_ERROR ConnectivityManagerImpl::InitWiFi() mWiFiStationState = kWiFiStationState_NotConnected; mWiFiStationReconnectInterval = System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_WIFI_STATION_RECONNECT_INTERVAL); - +#if CHIP_DEVICE_ENABLE_DATA_MODEL err = sWiFiNetworkCommissioningInstance.Init(); - VerifyOrExit(err == CHIP_NO_ERROR, - ChipLogError(DeviceLayer, "WiFi network commissioning instance init failed: %s", chip::ErrorStr(err))); +#else + err = NetworkCommissioning::WiFiDriverImpl::GetInstance().Init(); +#endif + VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "WiFi driver init failed: %s", chip::ErrorStr(err))); mWiFiStationMode = kWiFiStationMode_Enabled; networks = NetworkCommissioning::WiFiDriverImpl::GetInstance().GetNetworks(); diff --git a/src/test_driver/mbed/unit_tests/config.in b/src/test_driver/mbed/unit_tests/config.in index 11e0c0f68a10a9..a05daae71a9792 100644 --- a/src/test_driver/mbed/unit_tests/config.in +++ b/src/test_driver/mbed/unit_tests/config.in @@ -2,3 +2,4 @@ CONFIG_CHIP_BUILD_TESTS=y CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS=y CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h CONFIG_MBED_BSD_SOCKET_TRACE=n +CONFIG_CHIP_DATA_MODEL=n \ No newline at end of file