Skip to content

Commit

Permalink
Cleanup Linux platform source includes (#20362)
Browse files Browse the repository at this point in the history
* 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.

* 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.

* 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.

* per Damian-Nordic, revert networkIDLen to uint8_t

But, use static_cast<uint8_t> to fix build warning

* per Damian-Nordic, introduce chip_enable_network_commissioning

This allows general and ethernet network commissioning source to be
conditionally included in platform configuration.

* Revert NetworkCommissioningDriver changes
  • Loading branch information
msandstedt authored Jul 7, 2022
1 parent 1107d8e commit ef588e1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
29 changes: 18 additions & 11 deletions src/platform/Linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -70,28 +70,32 @@ static_library("Linux") {
"Logging.cpp",
"NetworkCommissioningDriver.h",
"NetworkCommissioningEthernetDriver.cpp",
"NetworkCommissioningWiFiDriver.cpp",
"PlatformManagerImpl.cpp",
"PlatformManagerImpl.h",
"PosixConfig.cpp",
"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 = [
Expand Down Expand Up @@ -135,7 +139,10 @@ static_library("Linux") {
}

if (chip_enable_wifi) {
sources += [ "GlibTypeDeleter.h" ]
sources += [
"GlibTypeDeleter.h",
"NetworkCommissioningWiFiDriver.cpp",
]

public_deps += [ "dbus/wpa" ]
}
Expand Down
2 changes: 1 addition & 1 deletion src/platform/Linux/NetworkCommissioningEthernetDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ NetworkIterator * LinuxEthernetDriver::GetNetworks()
{
auto ret = new EthernetNetworkIterator();
ConnectivityUtils::GetEthInterfaceName(SafePointerCast<char *>(ret->interfaceName), sizeof(ret->interfaceName));
ret->interfaceNameLen = strnlen(SafePointerCast<char *>(ret->interfaceName), sizeof(ret->interfaceName));
ret->interfaceNameLen = static_cast<uint8_t>(strnlen(SafePointerCast<char *>(ret->interfaceName), sizeof(ret->interfaceName)));
return ret;
}

Expand Down

0 comments on commit ef588e1

Please sign in to comment.