From f89243edf40f1e0ed3713bf89760c09515ce195c Mon Sep 17 00:00:00 2001 From: Michael Sandstedt Date: Wed, 6 Jul 2022 08:52:23 -0500 Subject: [PATCH] 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 | 2 +- 6 files changed, 8 insertions(+), 4 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..57ef026e7c952e 100644 --- a/src/platform/Linux/NetworkCommissioningDriver.h +++ b/src/platform/Linux/NetworkCommissioningDriver.h @@ -180,7 +180,7 @@ class LinuxEthernetDriver final : public EthernetDriver // Public, but cannot be accessed via NetworkIterator interface. uint8_t interfaceName[kMaxNetworkIDLen]; - uint8_t interfaceNameLen = 0; + size_t interfaceNameLen = 0; bool exhausted = false; };