Skip to content

Commit

Permalink
[Mbed] Fix network commissioning - add network commissioning driver (p…
Browse files Browse the repository at this point in the history
…roject-chip#15041)

* Add Network Commisioning Driver implementation
Add WiFi Driver

* Improve Mbed WiFi driver - move all WiFi interface code from ConnectivityManagerImpl

* Use Mbed Wifi driver in NetworkProvisioningDelegateImpl class

* Wifi interface separation from ConnectivityManagerImpl class
Create ConnectivityManagerImpl_WiFi class
Remove deprecated functions calling

* Changes restyle

* Add data model included indicator to platform config

* 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

* Move connect callback calling to OnNetworkConnected handler
  • Loading branch information
ATmobica authored and pull[bot] committed Mar 2, 2022
1 parent c2a0ef1 commit 1158269
Show file tree
Hide file tree
Showing 22 changed files with 1,057 additions and 476 deletions.
1 change: 1 addition & 0 deletions config/mbed/CMakeLists.txt
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
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
2 changes: 0 additions & 2 deletions examples/all-clusters-app/mbed/main/AppTask.cpp
Expand Up @@ -62,8 +62,6 @@ int AppTask::Init()
},
0);

ConnectivityMgrImpl().StartWiFiManagement();

// Init ZCL Data Model and start server
error = Server::GetInstance().Init();
if (error != CHIP_NO_ERROR)
Expand Down
3 changes: 2 additions & 1 deletion examples/lighting-app/mbed/config.in
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
2 changes: 0 additions & 2 deletions examples/lighting-app/mbed/main/AppTask.cpp
Expand Up @@ -114,8 +114,6 @@ int AppTask::Init()
LightingMgr().Init(MBED_CONF_APP_LIGHTING_STATE_LED);
LightingMgr().SetCallbacks(ActionInitiated, ActionCompleted);

ConnectivityMgrImpl().StartWiFiManagement();

// Init ZCL Data Model and start server
error = Server::GetInstance().Init();
if (error != CHIP_NO_ERROR)
Expand Down
3 changes: 2 additions & 1 deletion examples/lock-app/mbed/config.in
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
2 changes: 0 additions & 2 deletions examples/lock-app/mbed/main/AppTask.cpp
Expand Up @@ -117,8 +117,6 @@ int AppTask::Init()
BoltLockMgr().Init();
BoltLockMgr().SetCallbacks(ActionInitiated, ActionCompleted);

ConnectivityMgrImpl().StartWiFiManagement();

// Init ZCL Data Model and start server
error = Server::GetInstance().Init();
if (error != CHIP_NO_ERROR)
Expand Down
3 changes: 2 additions & 1 deletion examples/ota-requestor-app/mbed/config.in
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
2 changes: 0 additions & 2 deletions examples/ota-requestor-app/mbed/main/AppTask.cpp
Expand Up @@ -103,8 +103,6 @@ int AppTask::Init()
sFunctionButton2.rise(mbed::callback(this, &AppTask::FunctionButton2ReleaseEventHandler));
#endif

ConnectivityMgrImpl().StartWiFiManagement();

// Init ZCL Data Model and start server
error = Server::GetInstance().Init();
if (error != CHIP_NO_ERROR)
Expand Down
3 changes: 2 additions & 1 deletion examples/pigweed-app/mbed/config.in
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
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
4 changes: 0 additions & 4 deletions examples/shell/mbed/main/main.cpp
Expand Up @@ -72,10 +72,6 @@ int main()
}
#endif

#if CHIP_DEVICE_CONFIG_ENABLE_WPA
ConnectivityManagerImpl().StartWiFiManagement();
#endif

err = PlatformMgr().StartEventLoopTask();
if (err != CHIP_NO_ERROR)
{
Expand Down
5 changes: 5 additions & 0 deletions src/platform/BUILD.gn
Expand Up @@ -65,6 +65,9 @@ if (chip_device_platform != "none") {
# todo: below operates are not work without root permission
# pthread_attr_setschedpolicy in GenericPlatformManagerImpl_POSIX.cpp
chip_device_config_run_as_root = current_os != "android"

# Indication that the CHIP data model is included
chip_enable_data_model = false
}

if (chip_stack_lock_tracking == "auto") {
Expand Down Expand Up @@ -200,6 +203,8 @@ if (chip_device_platform != "none") {
defines += [
"CHIP_DEVICE_LAYER_TARGET_MBED=1",
"CHIP_DEVICE_LAYER_TARGET=mbed",
"CHIP_DEVICE_CONFIG_ENABLE_WIFI=${chip_enable_wifi}",
"CHIP_DEVICE_ENABLE_DATA_MODEL=${chip_enable_data_model}",
]
} else if (chip_device_platform == "fake") {
defines += [
Expand Down
9 changes: 6 additions & 3 deletions src/platform/mbed/BUILD.gn
Expand Up @@ -35,15 +35,18 @@ static_library("mbed") {
"Logging.cpp",
"MbedConfig.cpp",
"MbedEventTimeout.cpp",
"NetworkCommissioningDriver.h",
"PlatformManagerImpl.cpp",
"SystemTimeSupport.cpp",
"arch.c",
]

public_deps = [ "${chip_root}/src/platform:platform_base" ]

if (chip_enable_openthread && chip_mdns == "platform") {
sources += [ "../OpenThread/DnssdImpl.cpp" ]
public_deps += [ "${chip_root}/src/lib/dnssd:platform_header" ]
if (chip_enable_wifi) {
sources += [
"ConnectivityManagerImpl_WiFi.cpp",
"NetworkCommissioningWiFiDriver.cpp",
]
}
}

0 comments on commit 1158269

Please sign in to comment.