Skip to content

Commit

Permalink
per Damian-Nordic, introduce chip_enable_network_commissioning
Browse files Browse the repository at this point in the history
This allows general and ethernet network commissioning source to be
conditionally included in platform configuration.
  • Loading branch information
msandstedt committed Jul 6, 2022
1 parent cf6500e commit 2d7c866
Show file tree
Hide file tree
Showing 16 changed files with 101 additions and 26 deletions.
2 changes: 0 additions & 2 deletions examples/all-clusters-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 9 additions & 0 deletions examples/all-clusters-app/linux/main-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,15 +405,20 @@ 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
#if CHIP_DEVICE_CONFIG_ENABLE_WIFI
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
Expand All @@ -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()
Expand Down Expand Up @@ -482,7 +489,9 @@ void ApplicationInit()
}
else
{
#if CHIP_DEVICE_CONFIG_ENABLE_NETWORK_COMMISSIONING
sEthernetNetworkCommissioningInstance.Init();
#endif
}
}

Expand Down
2 changes: 0 additions & 2 deletions examples/all-clusters-minimal-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions examples/all-clusters-minimal-app/linux/main-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
}
}
Expand Down
2 changes: 0 additions & 2 deletions examples/ota-requestor-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down
12 changes: 10 additions & 2 deletions src/platform/Ameba/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,23 @@ static_library("Ameba") {
"KeyValueStoreManagerImpl.h",
"Logging.cpp",
"LwIPCoreLock.cpp",
"NetworkCommissioningDriver.h",
"NetworkCommissioningWiFiDriver.cpp",
"PlatformManagerImpl.cpp",
"PlatformManagerImpl.h",
"SoftwareUpdateManagerImpl.h",
"SystemTimeSupport.cpp",
"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",
Expand Down
11 changes: 11 additions & 0 deletions src/platform/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion src/platform/Darwin/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ static_library("Darwin") {
"Logging.cpp",
"MdnsError.cpp",
"MdnsError.h",
"NetworkCommissioningDriver.h",
"PlatformManagerImpl.cpp",
"PlatformManagerImpl.h",
"PosixConfig.cpp",
Expand All @@ -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",
Expand Down
7 changes: 5 additions & 2 deletions src/platform/ESP32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions src/platform/Linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 8 additions & 2 deletions src/platform/P6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ static_library("P6") {
"LwIPCoreLock.cpp",
"MTBKeyValueStore.cpp",
"MTBKeyValueStore.h",
"NetworkCommissioningDriver.h",
"NetworkCommissioningWiFiDriver.cpp",
"OTAImageProcessorImpl.cpp",
"OTAImageProcessorImpl.h",
"P6Config.cpp",
Expand All @@ -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",
Expand Down
11 changes: 8 additions & 3 deletions src/platform/Tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
14 changes: 12 additions & 2 deletions src/platform/device.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 8 additions & 3 deletions src/platform/mbed/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,28 @@ static_library("mbed") {
"ConfigurationManagerImpl.cpp",
"ConnectivityManagerImpl.cpp",
"ConnectivityManagerImpl.h",
"DeviceNetworkProvisioningDelegateImpl.cpp",
"DeviceNetworkProvisioningDelegateImpl.h",
"DiagnosticDataProviderImpl.cpp",
"DiagnosticDataProviderImpl.h",
"KeyValueStoreManagerImpl.cpp",
"KeyValueStoreManagerImpl.h",
"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_network_commissioning) {
sources += [
"NetworkCommissioningDriver.h",
"DeviceNetworkProvisioningDelegateImpl.cpp",
"DeviceNetworkProvisioningDelegateImpl.h",
}
}

if (chip_enable_wifi) {
sources += [
"ConnectivityManagerImpl_WiFi.cpp",
Expand Down
9 changes: 7 additions & 2 deletions src/platform/qpg/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ static_library("qpg") {
"ConfigurationManagerImpl.h",
"ConnectivityManagerImpl.cpp",
"ConnectivityManagerImpl.h",
"DeviceNetworkProvisioningDelegateImpl.cpp",
"DeviceNetworkProvisioningDelegateImpl.h",
"DiagnosticDataProviderImpl.cpp",
"DiagnosticDataProviderImpl.h",
"InetPlatformConfig.h",
Expand All @@ -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" ]
Expand Down
11 changes: 8 additions & 3 deletions src/platform/webos/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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" ]
}
Expand Down

0 comments on commit 2d7c866

Please sign in to comment.