From 1023574539db320455803c47bc33218de1c607fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Ku=C5=BAnia?= Date: Tue, 8 Sep 2020 21:31:52 +0200 Subject: [PATCH] [nrfconnect] enable multiprotocol (#2484) * [zephyr] add friend declaration of BLEManagerImpl to ThreadStackManager * [zephyr] remove no longer needed workaround functions * [nrfconnect] enable multiprotocol * [workflows] bump container version used for CHIP NRF build --- .github/workflows/examples.yaml | 2 +- config/nrfconnect/Kconfig | 9 ++++++++- examples/lock-app/nrfconnect/prj.conf | 19 ++++++++++--------- examples/shell/nrfconnect/prj.conf | 19 ++++++++++--------- src/include/platform/ThreadStackManager.h | 4 ++++ src/inet/ZephyrSocket.h | 10 ---------- 6 files changed, 33 insertions(+), 30 deletions(-) diff --git a/.github/workflows/examples.yaml b/.github/workflows/examples.yaml index 4e5b10b473fe2f..d4be2e9d86831e 100644 --- a/.github/workflows/examples.yaml +++ b/.github/workflows/examples.yaml @@ -167,7 +167,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build-nrf-platform:0.4.2 + image: connectedhomeip/chip-build-nrf-platform:0.4.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" - "/tmp/output_binaries:/tmp/output_binaries" diff --git a/config/nrfconnect/Kconfig b/config/nrfconnect/Kconfig index a8af2408ecac8d..eb3455b1b32843 100644 --- a/config/nrfconnect/Kconfig +++ b/config/nrfconnect/Kconfig @@ -21,4 +21,11 @@ source "Kconfig.zephyr" config CHIP_LIB_SHELL bool "Enable CHIP's shell library" help - Link the application with the library containing CHIP shell commands + Link the application with the library containing CHIP shell commands + +config MULTIPROTOCOL + bool "Enable multiprotocol support" + select NRF_802154_MULTIPROTOCOL_SUPPORT + depends on BT && NET_L2_OPENTHREAD + help + Enable multiprotocol in the nRF 802.15.4 radio driver diff --git a/examples/lock-app/nrfconnect/prj.conf b/examples/lock-app/nrfconnect/prj.conf index e830ea5a45762b..d6fe2049abaced 100644 --- a/examples/lock-app/nrfconnect/prj.conf +++ b/examples/lock-app/nrfconnect/prj.conf @@ -76,15 +76,16 @@ CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=6 CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=8 CONFIG_NET_MAX_CONTEXTS=10 -# Disable Bluetooth Low Energy temporarily until dynamic multiprotocol is available -# To enable Bluetooth, set CONFIG_BT=y and uncomment the below configs. You will also -# have to set CONFIG_NET_L2_OPENTHREAD=n. -CONFIG_BT=n -# CONFIG_BT_PERIPHERAL=y -# CONFIG_BT_DEVICE_APPEARANCE=0 -# CONFIG_BT_DEVICE_NAME_DYNAMIC=y -# CONFIG_BT_DEVICE_NAME_MAX=15 -# CONFIG_BT_MAX_CONN=2 +# Enable multiprotocol +CONFIG_MULTIPROTOCOL=y + +# Bluetooth Low Energy configs +CONFIG_BT=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_DEVICE_APPEARANCE=0 +CONFIG_BT_DEVICE_NAME_DYNAMIC=y +CONFIG_BT_DEVICE_NAME_MAX=15 +CONFIG_BT_MAX_CONN=2 # Use mbedTLS from nrf_security library CONFIG_NORDIC_SECURITY_BACKEND=y diff --git a/examples/shell/nrfconnect/prj.conf b/examples/shell/nrfconnect/prj.conf index 57d7cd29bab881..cca1b70144ea78 100644 --- a/examples/shell/nrfconnect/prj.conf +++ b/examples/shell/nrfconnect/prj.conf @@ -81,15 +81,16 @@ CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=6 CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=8 CONFIG_NET_MAX_CONTEXTS=10 -# Disable Bluetooth Low Energy temporarily until dynamic multiprotocol is available -# To enable Bluetooth, set CONFIG_BT=y and uncomment the below configs. You will also -# have to set CONFIG_NET_L2_OPENTHREAD=n. -CONFIG_BT=n -# CONFIG_BT_PERIPHERAL=y -# CONFIG_BT_DEVICE_APPEARANCE=0 -# CONFIG_BT_DEVICE_NAME_DYNAMIC=y -# CONFIG_BT_DEVICE_NAME_MAX=15 -# CONFIG_BT_MAX_CONN=2 +# Enable multiprotocol +CONFIG_MULTIPROTOCOL=y + +# Bluetooth Low Energy configs +CONFIG_BT=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_DEVICE_APPEARANCE=0 +CONFIG_BT_DEVICE_NAME_DYNAMIC=y +CONFIG_BT_DEVICE_NAME_MAX=15 +CONFIG_BT_MAX_CONN=2 # Use mbedTLS from nrf_security library CONFIG_NORDIC_SECURITY_BACKEND=y diff --git a/src/include/platform/ThreadStackManager.h b/src/include/platform/ThreadStackManager.h index fd7e4bac3a20aa..d7717ea6584a85 100644 --- a/src/include/platform/ThreadStackManager.h +++ b/src/include/platform/ThreadStackManager.h @@ -38,6 +38,8 @@ class DeviceNetworkInfo; class DeviceControlServer; class BLEManagerImpl; template +class GenericBLEManagerImpl_Zephyr; +template class GenericPlatformManagerImpl; template class GenericConfigurationManagerImpl; @@ -89,6 +91,8 @@ class ThreadStackManager friend class ConfigurationManagerImpl; #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE friend class Internal::BLEManagerImpl; + template + friend class Internal::GenericBLEManagerImpl_Zephyr; #endif friend class Internal::DeviceControlServer; template diff --git a/src/inet/ZephyrSocket.h b/src/inet/ZephyrSocket.h index be077e7c6aea0c..5b087124585a13 100644 --- a/src/inet/ZephyrSocket.h +++ b/src/inet/ZephyrSocket.h @@ -26,16 +26,6 @@ #include -static inline int getsockname(int sock, sockaddr * addr, socklen_t * addrlen) -{ - return zsock_getsockname(sock, addr, addrlen); -} - -static inline ssize_t sendmsg(int sock, const struct msghdr * msg, int flags) -{ - return zsock_sendmsg(sock, msg, flags); -} - static inline ssize_t recvmsg(int sock, struct msghdr * msg, int flags) { // Zephyr doesn't implement recvmsg at all, but if the message vector size is > 0 we can simply