Skip to content

Commit

Permalink
Add CONFIG_CHIP_DATA_MODEL flag to all Mbed examples
Browse files Browse the repository at this point in the history
Passing config data model flag to gn build
Fix Wifi driver initialization for no data model examples
  • Loading branch information
ATmobica committed Feb 16, 2022
1 parent fbcd612 commit 7857815
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions config/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion examples/all-clusters-app/mbed/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
CONFIG_CHIP_OTA_REQUESTOR=y
CONFIG_CHIP_DATA_MODEL=y
3 changes: 2 additions & 1 deletion examples/lighting-app/mbed/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
CONFIG_CHIP_OTA_REQUESTOR=y
CONFIG_CHIP_DATA_MODEL=y
3 changes: 2 additions & 1 deletion examples/lock-app/mbed/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
CONFIG_CHIP_OTA_REQUESTOR=n
CONFIG_CHIP_DATA_MODEL=y
3 changes: 2 additions & 1 deletion examples/ota-requestor-app/mbed/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
CONFIG_CHIP_OTA_REQUESTOR=y
CONFIG_CHIP_DATA_MODEL=y
3 changes: 2 additions & 1 deletion examples/pigweed-app/mbed/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
CONFIG_CHIP_OTA_REQUESTOR=n
CONFIG_CHIP_DATA_MODEL=n
1 change: 1 addition & 0 deletions examples/shell/mbed/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 7 additions & 3 deletions src/platform/mbed/ConnectivityManagerImpl_WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/test_driver/mbed/unit_tests/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7857815

Please sign in to comment.