From 848f2b0af1ab541d850b808b6ac451b8616e6b94 Mon Sep 17 00:00:00 2001 From: Michael Sandstedt Date: Wed, 6 Jul 2022 08:30:57 -0500 Subject: [PATCH 1/6] Make bluez source include conditional on chip_enable_ble Linux platform is unconditionally including bluez source files. But this only makes sense if ble is enabled. Configure includes to be conditional on this. --- src/platform/Linux/BUILD.gn | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/platform/Linux/BUILD.gn b/src/platform/Linux/BUILD.gn index bfcbcd9be73703..c2d582b76e81cc 100644 --- a/src/platform/Linux/BUILD.gn +++ b/src/platform/Linux/BUILD.gn @@ -77,21 +77,26 @@ static_library("Linux") { "PosixConfig.h", "SystemPlatformConfig.h", "SystemTimeSupport.cpp", - "bluez/AdapterIterator.cpp", - "bluez/AdapterIterator.h", - "bluez/ChipDeviceScanner.cpp", - "bluez/ChipDeviceScanner.h", - "bluez/Helper.cpp", - "bluez/Helper.h", - "bluez/MainLoop.cpp", - "bluez/MainLoop.h", - "bluez/Types.h", ] if (chip_enable_openthread) { sources += [ "NetworkCommissioningThreadDriver.cpp" ] } + if (chip_enable_ble) { + sources += [ + "bluez/AdapterIterator.cpp", + "bluez/AdapterIterator.h", + "bluez/ChipDeviceScanner.cpp", + "bluez/ChipDeviceScanner.h", + "bluez/Helper.cpp", + "bluez/Helper.h", + "bluez/MainLoop.cpp", + "bluez/MainLoop.h", + "bluez/Types.h", + ] + } + deps = [ "${chip_root}/src/setup_payload" ] public_deps = [ From 2e026cccd8270136aabdeeac49c9178fdad48f25 Mon Sep 17 00:00:00 2001 From: Michael Sandstedt Date: Wed, 6 Jul 2022 08:42:31 -0500 Subject: [PATCH 2/6] Make WiFi commissioning driver source include conditional on chip_enable_wifi Linux platform is unconditionally including the WiFI commissioning driver source files. But this only makes sense if wifi is enabled. Configure includes to be conditional on this. --- src/platform/Linux/BUILD.gn | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/platform/Linux/BUILD.gn b/src/platform/Linux/BUILD.gn index c2d582b76e81cc..5a66ab0ccc335d 100644 --- a/src/platform/Linux/BUILD.gn +++ b/src/platform/Linux/BUILD.gn @@ -70,7 +70,6 @@ static_library("Linux") { "Logging.cpp", "NetworkCommissioningDriver.h", "NetworkCommissioningEthernetDriver.cpp", - "NetworkCommissioningWiFiDriver.cpp", "PlatformManagerImpl.cpp", "PlatformManagerImpl.h", "PosixConfig.cpp", @@ -140,7 +139,10 @@ static_library("Linux") { } if (chip_enable_wifi) { - sources += [ "GlibTypeDeleter.h" ] + sources += [ + "GlibTypeDeleter.h", + "NetworkCommissioningWiFiDriver.cpp", + ] public_deps += [ "dbus/wpa" ] } From 1f021123e2615c21311d1a3fe0a7a1a2babddedf Mon Sep 17 00:00:00 2001 From: Michael Sandstedt Date: Wed, 6 Jul 2022 08:52:23 -0500 Subject: [PATCH 3/6] Move Network Commissioning driver source includes into app projects Network commissioning source is unconditionally included in the Linux platform. But this only makes sense for commissionable apps that actually use this code. This commit moves these source includes to the apps and also fixes a build error that is arising from blindly assigning size_t to a uint8_t. --- examples/all-clusters-app/linux/BUILD.gn | 2 ++ examples/all-clusters-minimal-app/linux/BUILD.gn | 2 ++ examples/ota-requestor-app/linux/BUILD.gn | 2 ++ src/include/platform/NetworkCommissioning.h | 2 +- src/platform/Linux/BUILD.gn | 2 -- src/platform/Linux/NetworkCommissioningDriver.h | 4 ++-- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 52139ef1338da2..7d99c7cfdc156c 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -24,6 +24,8 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", + "${chip_root}/src/platform/Linux/NetworkCommissioningDriver.h", + "${chip_root}/src/platform/Linux/NetworkCommissioningEthernetDriver.cpp", "AppOptions.cpp", "include/tv-callbacks.cpp", "include/tv-callbacks.h", diff --git a/examples/all-clusters-minimal-app/linux/BUILD.gn b/examples/all-clusters-minimal-app/linux/BUILD.gn index cc2714427d4f3e..c24ef2af647a19 100644 --- a/examples/all-clusters-minimal-app/linux/BUILD.gn +++ b/examples/all-clusters-minimal-app/linux/BUILD.gn @@ -24,6 +24,8 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", + "${chip_root}/src/platform/Linux/NetworkCommissioningDriver.h", + "${chip_root}/src/platform/Linux/NetworkCommissioningEthernetDriver.cpp", "AppOptions.cpp", "include/tv-callbacks.cpp", "include/tv-callbacks.h", diff --git a/examples/ota-requestor-app/linux/BUILD.gn b/examples/ota-requestor-app/linux/BUILD.gn index 2d698377703640..e2ba1e908e928b 100644 --- a/examples/ota-requestor-app/linux/BUILD.gn +++ b/examples/ota-requestor-app/linux/BUILD.gn @@ -23,6 +23,8 @@ executable("chip-ota-requestor-app") { "${chip_root}/examples/platform/linux:app-main", "${chip_root}/src/app/server", "${chip_root}/src/lib", + "${chip_root}/src/platform/Linux/NetworkCommissioningDriver.h", + "${chip_root}/src/platform/Linux/NetworkCommissioningEthernetDriver.cpp", ] cflags = [ "-Wconversion" ] diff --git a/src/include/platform/NetworkCommissioning.h b/src/include/platform/NetworkCommissioning.h index 589f1d17a61dfb..a2ada87d407887 100644 --- a/src/include/platform/NetworkCommissioning.h +++ b/src/include/platform/NetworkCommissioning.h @@ -79,7 +79,7 @@ class Iterator struct Network { uint8_t networkID[kMaxNetworkIDLen]; - uint8_t networkIDLen; + size_t networkIDLen; bool connected; }; diff --git a/src/platform/Linux/BUILD.gn b/src/platform/Linux/BUILD.gn index 5a66ab0ccc335d..103526e20a7cc1 100644 --- a/src/platform/Linux/BUILD.gn +++ b/src/platform/Linux/BUILD.gn @@ -68,8 +68,6 @@ static_library("Linux") { "KeyValueStoreManagerImpl.cpp", "KeyValueStoreManagerImpl.h", "Logging.cpp", - "NetworkCommissioningDriver.h", - "NetworkCommissioningEthernetDriver.cpp", "PlatformManagerImpl.cpp", "PlatformManagerImpl.h", "PosixConfig.cpp", diff --git a/src/platform/Linux/NetworkCommissioningDriver.h b/src/platform/Linux/NetworkCommissioningDriver.h index e0e522a29eff3e..05d8230a588705 100644 --- a/src/platform/Linux/NetworkCommissioningDriver.h +++ b/src/platform/Linux/NetworkCommissioningDriver.h @@ -180,8 +180,8 @@ class LinuxEthernetDriver final : public EthernetDriver // Public, but cannot be accessed via NetworkIterator interface. uint8_t interfaceName[kMaxNetworkIDLen]; - uint8_t interfaceNameLen = 0; - bool exhausted = false; + size_t interfaceNameLen = 0; + bool exhausted = false; }; uint8_t GetMaxNetworks() override { return 1; }; From cf6500e2e6dde3b3c93dfab0ad819d0e19d2ce75 Mon Sep 17 00:00:00 2001 From: Michael Sandstedt Date: Wed, 6 Jul 2022 10:09:38 -0500 Subject: [PATCH 4/6] per Damian-Nordic, revert networkIDLen to uint8_t But, use static_cast to fix build warning --- src/include/platform/NetworkCommissioning.h | 2 +- src/platform/Linux/NetworkCommissioningDriver.h | 4 ++-- src/platform/Linux/NetworkCommissioningEthernetDriver.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/include/platform/NetworkCommissioning.h b/src/include/platform/NetworkCommissioning.h index a2ada87d407887..589f1d17a61dfb 100644 --- a/src/include/platform/NetworkCommissioning.h +++ b/src/include/platform/NetworkCommissioning.h @@ -79,7 +79,7 @@ class Iterator struct Network { uint8_t networkID[kMaxNetworkIDLen]; - size_t networkIDLen; + uint8_t networkIDLen; bool connected; }; diff --git a/src/platform/Linux/NetworkCommissioningDriver.h b/src/platform/Linux/NetworkCommissioningDriver.h index 05d8230a588705..e0e522a29eff3e 100644 --- a/src/platform/Linux/NetworkCommissioningDriver.h +++ b/src/platform/Linux/NetworkCommissioningDriver.h @@ -180,8 +180,8 @@ class LinuxEthernetDriver final : public EthernetDriver // Public, but cannot be accessed via NetworkIterator interface. uint8_t interfaceName[kMaxNetworkIDLen]; - size_t interfaceNameLen = 0; - bool exhausted = false; + uint8_t interfaceNameLen = 0; + bool exhausted = false; }; uint8_t GetMaxNetworks() override { return 1; }; diff --git a/src/platform/Linux/NetworkCommissioningEthernetDriver.cpp b/src/platform/Linux/NetworkCommissioningEthernetDriver.cpp index 00c619c3605be3..10d056708a980d 100644 --- a/src/platform/Linux/NetworkCommissioningEthernetDriver.cpp +++ b/src/platform/Linux/NetworkCommissioningEthernetDriver.cpp @@ -34,7 +34,7 @@ NetworkIterator * LinuxEthernetDriver::GetNetworks() { auto ret = new EthernetNetworkIterator(); ConnectivityUtils::GetEthInterfaceName(SafePointerCast(ret->interfaceName), sizeof(ret->interfaceName)); - ret->interfaceNameLen = strnlen(SafePointerCast(ret->interfaceName), sizeof(ret->interfaceName)); + ret->interfaceNameLen = static_cast(strnlen(SafePointerCast(ret->interfaceName), sizeof(ret->interfaceName))); return ret; } From bc3bd1e90de06beec33c964d646e577965e6499b Mon Sep 17 00:00:00 2001 From: Michael Sandstedt Date: Wed, 6 Jul 2022 10:59:36 -0500 Subject: [PATCH 5/6] per Damian-Nordic, introduce chip_enable_network_commissioning This allows general and ethernet network commissioning source to be conditionally included in platform configuration. --- examples/all-clusters-app/linux/BUILD.gn | 2 -- examples/all-clusters-app/linux/main-common.cpp | 9 +++++++++ examples/all-clusters-minimal-app/linux/BUILD.gn | 2 -- .../all-clusters-minimal-app/linux/main-common.cpp | 4 ++++ examples/ota-requestor-app/linux/BUILD.gn | 2 -- src/platform/Ameba/BUILD.gn | 10 ++++++++-- src/platform/BUILD.gn | 7 +++++++ src/platform/Darwin/BUILD.gn | 5 ++++- src/platform/ESP32/BUILD.gn | 7 +++++-- src/platform/Linux/BUILD.gn | 7 +++++++ src/platform/P6/BUILD.gn | 10 ++++++++-- src/platform/Tizen/BUILD.gn | 11 ++++++++--- src/platform/device.gni | 10 ++++++++-- src/platform/mbed/BUILD.gn | 11 ++++++++--- src/platform/qpg/BUILD.gn | 9 +++++++-- src/platform/webos/BUILD.gn | 9 ++++++--- 16 files changed, 89 insertions(+), 26 deletions(-) diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 7d99c7cfdc156c..52139ef1338da2 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -24,8 +24,6 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", - "${chip_root}/src/platform/Linux/NetworkCommissioningDriver.h", - "${chip_root}/src/platform/Linux/NetworkCommissioningEthernetDriver.cpp", "AppOptions.cpp", "include/tv-callbacks.cpp", "include/tv-callbacks.h", diff --git a/examples/all-clusters-app/linux/main-common.cpp b/examples/all-clusters-app/linux/main-common.cpp index aa22bb0a3148d1..b64f24644883a3 100644 --- a/examples/all-clusters-app/linux/main-common.cpp +++ b/examples/all-clusters-app/linux/main-common.cpp @@ -405,7 +405,10 @@ NetworkCommissioning::LinuxThreadDriver sThreadDriver; NetworkCommissioning::LinuxWiFiDriver sWiFiDriver; #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI +#if CHIP_DEVICE_ENABLE_NETWORK_COMMISSIONING NetworkCommissioning::LinuxEthernetDriver sEthernetDriver; +#endif // CHIP_DEVICE_ENABLE_NETWORK_COMMISSIONING + #endif // CHIP_DEVICE_LAYER_TARGET_LINUX #if CHIP_DEVICE_LAYER_TARGET_DARWIN @@ -413,7 +416,9 @@ NetworkCommissioning::LinuxEthernetDriver sEthernetDriver; NetworkCommissioning::DarwinWiFiDriver sWiFiDriver; #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI +#if CHIP_DEVICE_CONFIG_ENABLE_NETWORK_COMMISSIONING NetworkCommissioning::DarwinEthernetDriver sEthernetDriver; +#endif // CHIP_DEVICE_CONFIG_ENABLE_NETWORK_COMMISSIONING #endif // CHIP_DEVICE_LAYER_TARGET_DARWIN #if CHIP_DEVICE_CONFIG_ENABLE_THREAD @@ -424,7 +429,9 @@ Clusters::NetworkCommissioning::Instance sThreadNetworkCommissioningInstance(kNe Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(kNetworkCommissioningEndpointSecondary, &sWiFiDriver); #endif +#if CHIP_DEVICE_CONFIG_ENABLE_NETWORK_COMMISSIONING Clusters::NetworkCommissioning::Instance sEthernetNetworkCommissioningInstance(kNetworkCommissioningEndpointMain, &sEthernetDriver); +#endif // CHIP_DEVICE_CONFIG_ENABLE_NETWORK_COMMISSIONING } // namespace void ApplicationInit() @@ -482,7 +489,9 @@ void ApplicationInit() } else { +#if CHIP_DEVICE_CONFIG_ENABLE_NETWORK_COMMISSIONING sEthernetNetworkCommissioningInstance.Init(); +#endif } } diff --git a/examples/all-clusters-minimal-app/linux/BUILD.gn b/examples/all-clusters-minimal-app/linux/BUILD.gn index c24ef2af647a19..cc2714427d4f3e 100644 --- a/examples/all-clusters-minimal-app/linux/BUILD.gn +++ b/examples/all-clusters-minimal-app/linux/BUILD.gn @@ -24,8 +24,6 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/binding-handler.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", - "${chip_root}/src/platform/Linux/NetworkCommissioningDriver.h", - "${chip_root}/src/platform/Linux/NetworkCommissioningEthernetDriver.cpp", "AppOptions.cpp", "include/tv-callbacks.cpp", "include/tv-callbacks.h", diff --git a/examples/all-clusters-minimal-app/linux/main-common.cpp b/examples/all-clusters-minimal-app/linux/main-common.cpp index 7829f3a6c1894a..a2d17659c1410c 100644 --- a/examples/all-clusters-minimal-app/linux/main-common.cpp +++ b/examples/all-clusters-minimal-app/linux/main-common.cpp @@ -107,9 +107,11 @@ NetworkCommissioning::LinuxWiFiDriver sLinuxWiFiDriver; Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(kNetworkCommissioningEndpointSecondary, &sLinuxWiFiDriver); #endif +#if CHIP_DEVICE_ENABLE_NETWORK_COMMISSIONING NetworkCommissioning::LinuxEthernetDriver sLinuxEthernetDriver; Clusters::NetworkCommissioning::Instance sEthernetNetworkCommissioningInstance(kNetworkCommissioningEndpointMain, &sLinuxEthernetDriver); +#endif #else // CHIP_DEVICE_LAYER_TARGET_LINUX Clusters::NetworkCommissioning::NullNetworkDriver sNullNetworkDriver; Clusters::NetworkCommissioning::Instance sNullNetworkCommissioningInstance(kNetworkCommissioningEndpointMain, &sNullNetworkDriver); @@ -169,11 +171,13 @@ void ApplicationInit() else #endif // CHIP_DEVICE_LAYER_TARGET_LINUX { +#if CHIP_DEVICE_ENABLE_NETWORK_COMMISSIONING #if CHIP_DEVICE_LAYER_TARGET_LINUX sEthernetNetworkCommissioningInstance.Init(); #else // Use NullNetworkCommissioningInstance to disable the network commissioning functions. sNullNetworkCommissioningInstance.Init(); +#endif #endif } } diff --git a/examples/ota-requestor-app/linux/BUILD.gn b/examples/ota-requestor-app/linux/BUILD.gn index e2ba1e908e928b..2d698377703640 100644 --- a/examples/ota-requestor-app/linux/BUILD.gn +++ b/examples/ota-requestor-app/linux/BUILD.gn @@ -23,8 +23,6 @@ executable("chip-ota-requestor-app") { "${chip_root}/examples/platform/linux:app-main", "${chip_root}/src/app/server", "${chip_root}/src/lib", - "${chip_root}/src/platform/Linux/NetworkCommissioningDriver.h", - "${chip_root}/src/platform/Linux/NetworkCommissioningEthernetDriver.cpp", ] cflags = [ "-Wconversion" ] diff --git a/src/platform/Ameba/BUILD.gn b/src/platform/Ameba/BUILD.gn index f9524f21487989..a26863077b2e5b 100755 --- a/src/platform/Ameba/BUILD.gn +++ b/src/platform/Ameba/BUILD.gn @@ -41,8 +41,6 @@ static_library("Ameba") { "KeyValueStoreManagerImpl.h", "Logging.cpp", "LwIPCoreLock.cpp", - "NetworkCommissioningDriver.h", - "NetworkCommissioningWiFiDriver.cpp", "PlatformManagerImpl.cpp", "PlatformManagerImpl.h", "SoftwareUpdateManagerImpl.h", @@ -50,6 +48,14 @@ static_library("Ameba") { "SystemTimeSupport.h", ] + if (chip_enable_network_commissioning) { + sources += [ "NetworkCommissioningDriver.h" ] + } + + if (chip_enable_wifi) { + sources += [ "NetworkCommissioningWiFiDriver.cpp" ] + } + deps = [ "${chip_root}/src/lib/dnssd:platform_header", "${chip_root}/src/setup_payload", diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index a5bb4df51d30e2..489d4e6cfb8825 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -118,6 +118,13 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { defines += [ "CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE=${chip_enable_ble}" ] } + if (chip_device_platform == "ameba" || chip_device_platform == "darwin" || + chip_device_platform == "esp32" || chip_device_platform == "linux" || + chip_device_platform == "mbed" || chip_device_platform == "qpg" || + chip_device_platform == "tizen" || chip_device_platform == "webos") { + defines += [ "CHIP_DEVICE_CONFIG_ENABLE_NETWORK_COMMISSIONING=${chip_enable_network_commissioning}" ] + } + if (chip_enable_nfc) { defines += [ "CHIP_DEVICE_CONFIG_ENABLE_NFC=1", diff --git a/src/platform/Darwin/BUILD.gn b/src/platform/Darwin/BUILD.gn index c0c4416643ad3f..4f0fe64460cbcb 100644 --- a/src/platform/Darwin/BUILD.gn +++ b/src/platform/Darwin/BUILD.gn @@ -61,7 +61,6 @@ static_library("Darwin") { "Logging.cpp", "MdnsError.cpp", "MdnsError.h", - "NetworkCommissioningDriver.h", "PlatformManagerImpl.cpp", "PlatformManagerImpl.h", "PosixConfig.cpp", @@ -70,6 +69,10 @@ static_library("Darwin") { "SystemTimeSupport.cpp", ] + if (chip_enable_network_commissioning) { + sources += [ "NetworkCommissioningDriver.h" ] + } + if (chip_enable_wifi) { sources += [ "WiFi/ConfigurationManagerImplWiFi.cpp", diff --git a/src/platform/ESP32/BUILD.gn b/src/platform/ESP32/BUILD.gn index 822ffa58efcd5c..35f392ed282d5b 100644 --- a/src/platform/ESP32/BUILD.gn +++ b/src/platform/ESP32/BUILD.gn @@ -74,12 +74,15 @@ static_library("ESP32") { ] } - if (chip_enable_wifi) { + if (chip_enable_network_commissioning) { sources += [ - "ConnectivityManagerImpl_WiFi.cpp", "NetworkCommissioningDriver.cpp", "NetworkCommissioningDriver.h", ] + } + + if (chip_enable_wifi) { + sources += [ "ConnectivityManagerImpl_WiFi.cpp" ] if (chip_mdns == "platform") { sources += [ "DnssdImpl.cpp", diff --git a/src/platform/Linux/BUILD.gn b/src/platform/Linux/BUILD.gn index 103526e20a7cc1..1b0271a2c86284 100644 --- a/src/platform/Linux/BUILD.gn +++ b/src/platform/Linux/BUILD.gn @@ -80,6 +80,13 @@ static_library("Linux") { sources += [ "NetworkCommissioningThreadDriver.cpp" ] } + if (chip_enable_network_commissioning) { + sources += [ + "NetworkCommissioningDriver.h", + "NetworkCommissioningEthernetDriver.cpp", + ] + } + if (chip_enable_ble) { sources += [ "bluez/AdapterIterator.cpp", diff --git a/src/platform/P6/BUILD.gn b/src/platform/P6/BUILD.gn index d7af750cb91df7..ca3b8e775e908b 100644 --- a/src/platform/P6/BUILD.gn +++ b/src/platform/P6/BUILD.gn @@ -47,8 +47,6 @@ static_library("P6") { "LwIPCoreLock.cpp", "MTBKeyValueStore.cpp", "MTBKeyValueStore.h", - "NetworkCommissioningDriver.h", - "NetworkCommissioningWiFiDriver.cpp", "OTAImageProcessorImpl.cpp", "OTAImageProcessorImpl.h", "P6Config.cpp", @@ -69,6 +67,14 @@ static_library("P6") { "cycfg_gatt_db.h", ] + if (chip_enable_network_commissioning) { + sources += [ "NetworkCommissioningDriver.h" ] + } + + if (chip_enable_wifi) { + sources += [ "NetworkCommissioningWiFiDriver.cpp" ] + } + deps = [ "${chip_root}/src/lib/dnssd:platform_header", "${chip_root}/src/setup_payload", diff --git a/src/platform/Tizen/BUILD.gn b/src/platform/Tizen/BUILD.gn index 825224b90e1417..6aa51401ff7275 100644 --- a/src/platform/Tizen/BUILD.gn +++ b/src/platform/Tizen/BUILD.gn @@ -53,9 +53,6 @@ static_library("Tizen") { "Logging.cpp", "MainLoop.cpp", "MainLoop.h", - "NetworkCommissioningDriver.h", - "NetworkCommissioningThreadDriver.cpp", - "NetworkCommissioningWiFiDriver.cpp", "PlatformManagerImpl.cpp", "PlatformManagerImpl.h", "PosixConfig.cpp", @@ -81,6 +78,14 @@ static_library("Tizen") { deps += [ "${chip_root}/src/lib/dnssd:platform_header" ] } + if (chip_network_commissioning) { + sources += [ + "NetworkCommissioningDriver.h", + "NetworkCommissioningThreadDriver.cpp", + "NetworkCommissioningWiFiDriver.cpp", + ] + } + if (chip_enable_openthread) { sources += [ "ThreadStackManagerImpl.cpp", diff --git a/src/platform/device.gni b/src/platform/device.gni index 3e4486b6df6b7c..7510e04f99fd95 100755 --- a/src/platform/device.gni +++ b/src/platform/device.gni @@ -57,14 +57,20 @@ declare_args() { declare_args() { chip_openthread_ftd = chip_enable_openthread + # Enable network commissioning. + chip_enable_network_commissioning = + chip_device_platform == "ameba" || chip_device_platform == "darwin" || + chip_device_platform == "esp32" || chip_device_platform == "linux" || + chip_device_platform == "mbed" || chip_device_platform == "qpg" || + chip_device_platform == "tizen" || chip_device_platform == "webos" + # Enable wifi support. chip_enable_wifi = chip_device_platform == "linux" || chip_device_platform == "esp32" || chip_device_platform == "mbed" || chip_device_platform == "tizen" || chip_device_platform == "android" || chip_device_platform == "ameba" || chip_device_platform == "webos" || chip_device_platform == "cc32xx" || - chip_device_platform == "bl602" || chip_device_platform == "bl602" || - chip_device_platform == "mw320" || + chip_device_platform == "bl602" || chip_device_platform == "mw320" || (chip_device_platform == "darwin" && current_os == "mac") # Enable ble support. diff --git a/src/platform/mbed/BUILD.gn b/src/platform/mbed/BUILD.gn index 1e13e2cfd2fa00..bf071483c7a1c0 100644 --- a/src/platform/mbed/BUILD.gn +++ b/src/platform/mbed/BUILD.gn @@ -26,8 +26,6 @@ static_library("mbed") { "ConfigurationManagerImpl.cpp", "ConnectivityManagerImpl.cpp", "ConnectivityManagerImpl.h", - "DeviceNetworkProvisioningDelegateImpl.cpp", - "DeviceNetworkProvisioningDelegateImpl.h", "DiagnosticDataProviderImpl.cpp", "DiagnosticDataProviderImpl.h", "KeyValueStoreManagerImpl.cpp", @@ -35,7 +33,6 @@ static_library("mbed") { "Logging.cpp", "MbedConfig.cpp", "MbedEventTimeout.cpp", - "NetworkCommissioningDriver.h", "PlatformManagerImpl.cpp", "SystemTimeSupport.cpp", "arch.c", @@ -43,6 +40,14 @@ static_library("mbed") { public_deps = [ "${chip_root}/src/platform:platform_base" ] + if (chip_enable_network_commissioning) { + sources += [ + "DeviceNetworkProvisioningDelegateImpl.cpp", + "DeviceNetworkProvisioningDelegateImpl.h", + "NetworkCommissioningDriver.h", + ] + } + if (chip_enable_wifi) { sources += [ "ConnectivityManagerImpl_WiFi.cpp", diff --git a/src/platform/qpg/BUILD.gn b/src/platform/qpg/BUILD.gn index 6abc13b4513754..8cf5eda3abe43e 100644 --- a/src/platform/qpg/BUILD.gn +++ b/src/platform/qpg/BUILD.gn @@ -36,8 +36,6 @@ static_library("qpg") { "ConfigurationManagerImpl.h", "ConnectivityManagerImpl.cpp", "ConnectivityManagerImpl.h", - "DeviceNetworkProvisioningDelegateImpl.cpp", - "DeviceNetworkProvisioningDelegateImpl.h", "DiagnosticDataProviderImpl.cpp", "DiagnosticDataProviderImpl.h", "InetPlatformConfig.h", @@ -61,6 +59,13 @@ static_library("qpg") { "KeyValueStoreManagerImpl.h", ] + if (chip_enable_network_commissioning) { + sources += [ + "DeviceNetworkProvisioningDelegateImpl.cpp", + "DeviceNetworkProvisioningDelegateImpl.h", + ] + } + if (chip_enable_openthread) { if (chip_openthread_ftd) { public_deps += [ "${openthread_root}:libopenthread-ftd" ] diff --git a/src/platform/webos/BUILD.gn b/src/platform/webos/BUILD.gn index 06323b323528af..c3a16f27562c8f 100644 --- a/src/platform/webos/BUILD.gn +++ b/src/platform/webos/BUILD.gn @@ -92,9 +92,6 @@ static_library("webos") { "Logging.cpp", "MainLoop.cpp", "MainLoop.h", - "NetworkCommissioningDriver.h", - "NetworkCommissioningThreadDriver.cpp", - "NetworkCommissioningWiFiDriver.cpp", "PlatformManagerImpl.cpp", "PlatformManagerImpl.h", "PosixConfig.cpp", @@ -128,9 +125,14 @@ static_library("webos") { ] } + if (chip_enable_network_commissioning) { + sources += [ "NetworkCommissioningDriver.h" ] + } + if (chip_enable_openthread) { sources += [ "GlibTypeDeleter.h", + "NetworkCommissioningThreadDriver.cpp", "ThreadStackManagerImpl.cpp", "ThreadStackManagerImpl.h", ] @@ -139,6 +141,7 @@ static_library("webos") { } if (chip_enable_wifi) { + sources += [ "NetworkCommissioningWiFiDriver.cpp" ] # TBD: Use webOS specific Wi-Fi resource #public_deps += [ "dbus/wpa" ] } From 8d62f0b6085658822570c9346452c8bf55b4f94b Mon Sep 17 00:00:00 2001 From: Michael Sandstedt Date: Wed, 6 Jul 2022 12:58:22 -0500 Subject: [PATCH 6/6] Revert NetworkCommissioningDriver changes --- examples/all-clusters-app/linux/main-common.cpp | 9 --------- .../all-clusters-minimal-app/linux/main-common.cpp | 4 ---- src/platform/Ameba/BUILD.gn | 10 ++-------- src/platform/BUILD.gn | 7 ------- src/platform/Darwin/BUILD.gn | 5 +---- src/platform/ESP32/BUILD.gn | 7 ++----- src/platform/Linux/BUILD.gn | 9 ++------- src/platform/P6/BUILD.gn | 10 ++-------- src/platform/Tizen/BUILD.gn | 11 +++-------- src/platform/device.gni | 10 ++-------- src/platform/mbed/BUILD.gn | 11 +++-------- src/platform/qpg/BUILD.gn | 9 ++------- src/platform/webos/BUILD.gn | 9 +++------ 13 files changed, 22 insertions(+), 89 deletions(-) diff --git a/examples/all-clusters-app/linux/main-common.cpp b/examples/all-clusters-app/linux/main-common.cpp index b64f24644883a3..aa22bb0a3148d1 100644 --- a/examples/all-clusters-app/linux/main-common.cpp +++ b/examples/all-clusters-app/linux/main-common.cpp @@ -405,10 +405,7 @@ NetworkCommissioning::LinuxThreadDriver sThreadDriver; NetworkCommissioning::LinuxWiFiDriver sWiFiDriver; #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI -#if CHIP_DEVICE_ENABLE_NETWORK_COMMISSIONING NetworkCommissioning::LinuxEthernetDriver sEthernetDriver; -#endif // CHIP_DEVICE_ENABLE_NETWORK_COMMISSIONING - #endif // CHIP_DEVICE_LAYER_TARGET_LINUX #if CHIP_DEVICE_LAYER_TARGET_DARWIN @@ -416,9 +413,7 @@ NetworkCommissioning::LinuxEthernetDriver sEthernetDriver; NetworkCommissioning::DarwinWiFiDriver sWiFiDriver; #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI -#if CHIP_DEVICE_CONFIG_ENABLE_NETWORK_COMMISSIONING NetworkCommissioning::DarwinEthernetDriver sEthernetDriver; -#endif // CHIP_DEVICE_CONFIG_ENABLE_NETWORK_COMMISSIONING #endif // CHIP_DEVICE_LAYER_TARGET_DARWIN #if CHIP_DEVICE_CONFIG_ENABLE_THREAD @@ -429,9 +424,7 @@ Clusters::NetworkCommissioning::Instance sThreadNetworkCommissioningInstance(kNe Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(kNetworkCommissioningEndpointSecondary, &sWiFiDriver); #endif -#if CHIP_DEVICE_CONFIG_ENABLE_NETWORK_COMMISSIONING Clusters::NetworkCommissioning::Instance sEthernetNetworkCommissioningInstance(kNetworkCommissioningEndpointMain, &sEthernetDriver); -#endif // CHIP_DEVICE_CONFIG_ENABLE_NETWORK_COMMISSIONING } // namespace void ApplicationInit() @@ -489,9 +482,7 @@ void ApplicationInit() } else { -#if CHIP_DEVICE_CONFIG_ENABLE_NETWORK_COMMISSIONING sEthernetNetworkCommissioningInstance.Init(); -#endif } } diff --git a/examples/all-clusters-minimal-app/linux/main-common.cpp b/examples/all-clusters-minimal-app/linux/main-common.cpp index a2d17659c1410c..7829f3a6c1894a 100644 --- a/examples/all-clusters-minimal-app/linux/main-common.cpp +++ b/examples/all-clusters-minimal-app/linux/main-common.cpp @@ -107,11 +107,9 @@ NetworkCommissioning::LinuxWiFiDriver sLinuxWiFiDriver; Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(kNetworkCommissioningEndpointSecondary, &sLinuxWiFiDriver); #endif -#if CHIP_DEVICE_ENABLE_NETWORK_COMMISSIONING NetworkCommissioning::LinuxEthernetDriver sLinuxEthernetDriver; Clusters::NetworkCommissioning::Instance sEthernetNetworkCommissioningInstance(kNetworkCommissioningEndpointMain, &sLinuxEthernetDriver); -#endif #else // CHIP_DEVICE_LAYER_TARGET_LINUX Clusters::NetworkCommissioning::NullNetworkDriver sNullNetworkDriver; Clusters::NetworkCommissioning::Instance sNullNetworkCommissioningInstance(kNetworkCommissioningEndpointMain, &sNullNetworkDriver); @@ -171,13 +169,11 @@ void ApplicationInit() else #endif // CHIP_DEVICE_LAYER_TARGET_LINUX { -#if CHIP_DEVICE_ENABLE_NETWORK_COMMISSIONING #if CHIP_DEVICE_LAYER_TARGET_LINUX sEthernetNetworkCommissioningInstance.Init(); #else // Use NullNetworkCommissioningInstance to disable the network commissioning functions. sNullNetworkCommissioningInstance.Init(); -#endif #endif } } diff --git a/src/platform/Ameba/BUILD.gn b/src/platform/Ameba/BUILD.gn index a26863077b2e5b..f9524f21487989 100755 --- a/src/platform/Ameba/BUILD.gn +++ b/src/platform/Ameba/BUILD.gn @@ -41,6 +41,8 @@ static_library("Ameba") { "KeyValueStoreManagerImpl.h", "Logging.cpp", "LwIPCoreLock.cpp", + "NetworkCommissioningDriver.h", + "NetworkCommissioningWiFiDriver.cpp", "PlatformManagerImpl.cpp", "PlatformManagerImpl.h", "SoftwareUpdateManagerImpl.h", @@ -48,14 +50,6 @@ static_library("Ameba") { "SystemTimeSupport.h", ] - if (chip_enable_network_commissioning) { - sources += [ "NetworkCommissioningDriver.h" ] - } - - if (chip_enable_wifi) { - sources += [ "NetworkCommissioningWiFiDriver.cpp" ] - } - deps = [ "${chip_root}/src/lib/dnssd:platform_header", "${chip_root}/src/setup_payload", diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index 489d4e6cfb8825..a5bb4df51d30e2 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -118,13 +118,6 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { defines += [ "CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE=${chip_enable_ble}" ] } - if (chip_device_platform == "ameba" || chip_device_platform == "darwin" || - chip_device_platform == "esp32" || chip_device_platform == "linux" || - chip_device_platform == "mbed" || chip_device_platform == "qpg" || - chip_device_platform == "tizen" || chip_device_platform == "webos") { - defines += [ "CHIP_DEVICE_CONFIG_ENABLE_NETWORK_COMMISSIONING=${chip_enable_network_commissioning}" ] - } - if (chip_enable_nfc) { defines += [ "CHIP_DEVICE_CONFIG_ENABLE_NFC=1", diff --git a/src/platform/Darwin/BUILD.gn b/src/platform/Darwin/BUILD.gn index 4f0fe64460cbcb..c0c4416643ad3f 100644 --- a/src/platform/Darwin/BUILD.gn +++ b/src/platform/Darwin/BUILD.gn @@ -61,6 +61,7 @@ static_library("Darwin") { "Logging.cpp", "MdnsError.cpp", "MdnsError.h", + "NetworkCommissioningDriver.h", "PlatformManagerImpl.cpp", "PlatformManagerImpl.h", "PosixConfig.cpp", @@ -69,10 +70,6 @@ static_library("Darwin") { "SystemTimeSupport.cpp", ] - if (chip_enable_network_commissioning) { - sources += [ "NetworkCommissioningDriver.h" ] - } - if (chip_enable_wifi) { sources += [ "WiFi/ConfigurationManagerImplWiFi.cpp", diff --git a/src/platform/ESP32/BUILD.gn b/src/platform/ESP32/BUILD.gn index 35f392ed282d5b..822ffa58efcd5c 100644 --- a/src/platform/ESP32/BUILD.gn +++ b/src/platform/ESP32/BUILD.gn @@ -74,15 +74,12 @@ static_library("ESP32") { ] } - if (chip_enable_network_commissioning) { + if (chip_enable_wifi) { sources += [ + "ConnectivityManagerImpl_WiFi.cpp", "NetworkCommissioningDriver.cpp", "NetworkCommissioningDriver.h", ] - } - - if (chip_enable_wifi) { - sources += [ "ConnectivityManagerImpl_WiFi.cpp" ] if (chip_mdns == "platform") { sources += [ "DnssdImpl.cpp", diff --git a/src/platform/Linux/BUILD.gn b/src/platform/Linux/BUILD.gn index 1b0271a2c86284..5a66ab0ccc335d 100644 --- a/src/platform/Linux/BUILD.gn +++ b/src/platform/Linux/BUILD.gn @@ -68,6 +68,8 @@ static_library("Linux") { "KeyValueStoreManagerImpl.cpp", "KeyValueStoreManagerImpl.h", "Logging.cpp", + "NetworkCommissioningDriver.h", + "NetworkCommissioningEthernetDriver.cpp", "PlatformManagerImpl.cpp", "PlatformManagerImpl.h", "PosixConfig.cpp", @@ -80,13 +82,6 @@ static_library("Linux") { sources += [ "NetworkCommissioningThreadDriver.cpp" ] } - if (chip_enable_network_commissioning) { - sources += [ - "NetworkCommissioningDriver.h", - "NetworkCommissioningEthernetDriver.cpp", - ] - } - if (chip_enable_ble) { sources += [ "bluez/AdapterIterator.cpp", diff --git a/src/platform/P6/BUILD.gn b/src/platform/P6/BUILD.gn index ca3b8e775e908b..d7af750cb91df7 100644 --- a/src/platform/P6/BUILD.gn +++ b/src/platform/P6/BUILD.gn @@ -47,6 +47,8 @@ static_library("P6") { "LwIPCoreLock.cpp", "MTBKeyValueStore.cpp", "MTBKeyValueStore.h", + "NetworkCommissioningDriver.h", + "NetworkCommissioningWiFiDriver.cpp", "OTAImageProcessorImpl.cpp", "OTAImageProcessorImpl.h", "P6Config.cpp", @@ -67,14 +69,6 @@ static_library("P6") { "cycfg_gatt_db.h", ] - if (chip_enable_network_commissioning) { - sources += [ "NetworkCommissioningDriver.h" ] - } - - if (chip_enable_wifi) { - sources += [ "NetworkCommissioningWiFiDriver.cpp" ] - } - deps = [ "${chip_root}/src/lib/dnssd:platform_header", "${chip_root}/src/setup_payload", diff --git a/src/platform/Tizen/BUILD.gn b/src/platform/Tizen/BUILD.gn index 6aa51401ff7275..825224b90e1417 100644 --- a/src/platform/Tizen/BUILD.gn +++ b/src/platform/Tizen/BUILD.gn @@ -53,6 +53,9 @@ static_library("Tizen") { "Logging.cpp", "MainLoop.cpp", "MainLoop.h", + "NetworkCommissioningDriver.h", + "NetworkCommissioningThreadDriver.cpp", + "NetworkCommissioningWiFiDriver.cpp", "PlatformManagerImpl.cpp", "PlatformManagerImpl.h", "PosixConfig.cpp", @@ -78,14 +81,6 @@ static_library("Tizen") { deps += [ "${chip_root}/src/lib/dnssd:platform_header" ] } - if (chip_network_commissioning) { - sources += [ - "NetworkCommissioningDriver.h", - "NetworkCommissioningThreadDriver.cpp", - "NetworkCommissioningWiFiDriver.cpp", - ] - } - if (chip_enable_openthread) { sources += [ "ThreadStackManagerImpl.cpp", diff --git a/src/platform/device.gni b/src/platform/device.gni index 7510e04f99fd95..3e4486b6df6b7c 100755 --- a/src/platform/device.gni +++ b/src/platform/device.gni @@ -57,20 +57,14 @@ declare_args() { declare_args() { chip_openthread_ftd = chip_enable_openthread - # Enable network commissioning. - chip_enable_network_commissioning = - chip_device_platform == "ameba" || chip_device_platform == "darwin" || - chip_device_platform == "esp32" || chip_device_platform == "linux" || - chip_device_platform == "mbed" || chip_device_platform == "qpg" || - chip_device_platform == "tizen" || chip_device_platform == "webos" - # Enable wifi support. chip_enable_wifi = chip_device_platform == "linux" || chip_device_platform == "esp32" || chip_device_platform == "mbed" || chip_device_platform == "tizen" || chip_device_platform == "android" || chip_device_platform == "ameba" || chip_device_platform == "webos" || chip_device_platform == "cc32xx" || - chip_device_platform == "bl602" || chip_device_platform == "mw320" || + chip_device_platform == "bl602" || chip_device_platform == "bl602" || + chip_device_platform == "mw320" || (chip_device_platform == "darwin" && current_os == "mac") # Enable ble support. diff --git a/src/platform/mbed/BUILD.gn b/src/platform/mbed/BUILD.gn index bf071483c7a1c0..1e13e2cfd2fa00 100644 --- a/src/platform/mbed/BUILD.gn +++ b/src/platform/mbed/BUILD.gn @@ -26,6 +26,8 @@ static_library("mbed") { "ConfigurationManagerImpl.cpp", "ConnectivityManagerImpl.cpp", "ConnectivityManagerImpl.h", + "DeviceNetworkProvisioningDelegateImpl.cpp", + "DeviceNetworkProvisioningDelegateImpl.h", "DiagnosticDataProviderImpl.cpp", "DiagnosticDataProviderImpl.h", "KeyValueStoreManagerImpl.cpp", @@ -33,6 +35,7 @@ static_library("mbed") { "Logging.cpp", "MbedConfig.cpp", "MbedEventTimeout.cpp", + "NetworkCommissioningDriver.h", "PlatformManagerImpl.cpp", "SystemTimeSupport.cpp", "arch.c", @@ -40,14 +43,6 @@ static_library("mbed") { public_deps = [ "${chip_root}/src/platform:platform_base" ] - if (chip_enable_network_commissioning) { - sources += [ - "DeviceNetworkProvisioningDelegateImpl.cpp", - "DeviceNetworkProvisioningDelegateImpl.h", - "NetworkCommissioningDriver.h", - ] - } - if (chip_enable_wifi) { sources += [ "ConnectivityManagerImpl_WiFi.cpp", diff --git a/src/platform/qpg/BUILD.gn b/src/platform/qpg/BUILD.gn index 8cf5eda3abe43e..6abc13b4513754 100644 --- a/src/platform/qpg/BUILD.gn +++ b/src/platform/qpg/BUILD.gn @@ -36,6 +36,8 @@ static_library("qpg") { "ConfigurationManagerImpl.h", "ConnectivityManagerImpl.cpp", "ConnectivityManagerImpl.h", + "DeviceNetworkProvisioningDelegateImpl.cpp", + "DeviceNetworkProvisioningDelegateImpl.h", "DiagnosticDataProviderImpl.cpp", "DiagnosticDataProviderImpl.h", "InetPlatformConfig.h", @@ -59,13 +61,6 @@ static_library("qpg") { "KeyValueStoreManagerImpl.h", ] - if (chip_enable_network_commissioning) { - sources += [ - "DeviceNetworkProvisioningDelegateImpl.cpp", - "DeviceNetworkProvisioningDelegateImpl.h", - ] - } - if (chip_enable_openthread) { if (chip_openthread_ftd) { public_deps += [ "${openthread_root}:libopenthread-ftd" ] diff --git a/src/platform/webos/BUILD.gn b/src/platform/webos/BUILD.gn index c3a16f27562c8f..06323b323528af 100644 --- a/src/platform/webos/BUILD.gn +++ b/src/platform/webos/BUILD.gn @@ -92,6 +92,9 @@ static_library("webos") { "Logging.cpp", "MainLoop.cpp", "MainLoop.h", + "NetworkCommissioningDriver.h", + "NetworkCommissioningThreadDriver.cpp", + "NetworkCommissioningWiFiDriver.cpp", "PlatformManagerImpl.cpp", "PlatformManagerImpl.h", "PosixConfig.cpp", @@ -125,14 +128,9 @@ static_library("webos") { ] } - if (chip_enable_network_commissioning) { - sources += [ "NetworkCommissioningDriver.h" ] - } - if (chip_enable_openthread) { sources += [ "GlibTypeDeleter.h", - "NetworkCommissioningThreadDriver.cpp", "ThreadStackManagerImpl.cpp", "ThreadStackManagerImpl.h", ] @@ -141,7 +139,6 @@ static_library("webos") { } if (chip_enable_wifi) { - sources += [ "NetworkCommissioningWiFiDriver.cpp" ] # TBD: Use webOS specific Wi-Fi resource #public_deps += [ "dbus/wpa" ] }