From 2d7c866a220c7d58b07410e473720c5b3565ec64 Mon Sep 17 00:00:00 2001 From: Michael Sandstedt Date: Wed, 6 Jul 2022 10:59:36 -0500 Subject: [PATCH] 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 | 12 ++++++++++-- src/platform/BUILD.gn | 11 +++++++++++ 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 | 14 ++++++++++++-- src/platform/mbed/BUILD.gn | 11 ++++++++--- src/platform/qpg/BUILD.gn | 9 +++++++-- src/platform/webos/BUILD.gn | 11 ++++++++--- 16 files changed, 101 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..c8bdd5a770725d 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,16 @@ 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..001fc4ca1edaca 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -118,6 +118,17 @@ 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..f3774fe15f14ae 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..f51a4ad20de4ef 100755 --- a/src/platform/device.gni +++ b/src/platform/device.gni @@ -57,14 +57,24 @@ 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..3974f73415b94f 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 += [ + "NetworkCommissioningDriver.h", + "DeviceNetworkProvisioningDelegateImpl.cpp", + "DeviceNetworkProvisioningDelegateImpl.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..8c6b49d8e1dcb6 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,17 +125,25 @@ static_library("webos") { ] } + if (chip_enable_network_commissioning) { + sources += [ + "NetworkCommissioningDriver.h", + ] + } + if (chip_enable_openthread) { sources += [ "GlibTypeDeleter.h", "ThreadStackManagerImpl.cpp", "ThreadStackManagerImpl.h", + "NetworkCommissioningThreadDriver.cpp", ] public_deps += [ "dbus/openthread" ] } if (chip_enable_wifi) { + "NetworkCommissioningWiFiDriver.cpp", # TBD: Use webOS specific Wi-Fi resource #public_deps += [ "dbus/wpa" ] }