From 2161b448b09415aa93e67d546c8000182bd01a2c Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Thu, 12 Mar 2020 21:39:06 -0700 Subject: [PATCH 1/7] Fix typo RESPOSNE => RESPONSE --- src/platform/include/CHIPDeviceConfig.h | 12 ++++++------ src/platform/include/SoftwareUpdateManager.h | 2 +- .../include/{ => internal}/CHIPDeviceLayerInternal.h | 0 3 files changed, 7 insertions(+), 7 deletions(-) rename src/platform/include/{ => internal}/CHIPDeviceLayerInternal.h (100%) diff --git a/src/platform/include/CHIPDeviceConfig.h b/src/platform/include/CHIPDeviceConfig.h index 11e6833d5de01a..7374e797d08be7 100644 --- a/src/platform/include/CHIPDeviceConfig.h +++ b/src/platform/include/CHIPDeviceConfig.h @@ -892,25 +892,25 @@ #endif /** - * CHIP_DEVICE_CONFIG_SOFTWARE_UPDATE_RESPOSNE_TIMEOUT + * CHIP_DEVICE_CONFIG_SOFTWARE_UPDATE_RESPONSE_TIMEOUT * * Specifies the maximum amount of time (in milliseconds) to wait for a response from a * chip Software Update service. * */ -#ifndef CHIP_DEVICE_CONFIG_SOFTWARE_UPDATE_RESPOSNE_TIMEOUT -#define CHIP_DEVICE_CONFIG_SOFTWARE_UPDATE_RESPOSNE_TIMEOUT 10000 +#ifndef CHIP_DEVICE_CONFIG_SOFTWARE_UPDATE_RESPONSE_TIMEOUT +#define CHIP_DEVICE_CONFIG_SOFTWARE_UPDATE_RESPONSE_TIMEOUT 10000 #endif /** - * CHIP_DEVICE_CONFIG_FILE_DOWNLOAD_RESPOSNE_TIMEOUT + * CHIP_DEVICE_CONFIG_FILE_DOWNLOAD_RESPONSE_TIMEOUT * * Specifies the maximum amount of time (in milliseconds) to wait for a response from a * chip File Download service. * */ -#ifndef CHIP_DEVICE_CONFIG_FILE_DOWNLOAD_RESPOSNE_TIMEOUT -#define CHIP_DEVICE_CONFIG_FILE_DOWNLOAD_RESPOSNE_TIMEOUT 10000 +#ifndef CHIP_DEVICE_CONFIG_FILE_DOWNLOAD_RESPONSE_TIMEOUT +#define CHIP_DEVICE_CONFIG_FILE_DOWNLOAD_RESPONSE_TIMEOUT 10000 #endif /** diff --git a/src/platform/include/SoftwareUpdateManager.h b/src/platform/include/SoftwareUpdateManager.h index 823e57e1215e42..7a2725be212f34 100644 --- a/src/platform/include/SoftwareUpdateManager.h +++ b/src/platform/include/SoftwareUpdateManager.h @@ -26,7 +26,7 @@ #if CHIP_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER #include -#include +#include namespace chip { namespace DeviceLayer { diff --git a/src/platform/include/CHIPDeviceLayerInternal.h b/src/platform/include/internal/CHIPDeviceLayerInternal.h similarity index 100% rename from src/platform/include/CHIPDeviceLayerInternal.h rename to src/platform/include/internal/CHIPDeviceLayerInternal.h From 2de495fa6b84d0e8cf93db454af1728dcf68fc29 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Fri, 13 Mar 2020 10:08:20 -0700 Subject: [PATCH 2/7] Fix included header paths --- src/platform/include/CHIPDeviceEvent.h | 2 +- src/platform/include/CHIPDeviceLayer.h | 6 +++--- src/platform/include/ConfigurationManager.h | 2 +- src/platform/include/ConnectivityManager.h | 2 +- src/platform/include/PlatformManager.h | 2 +- src/platform/include/SoftwareUpdateManager.h | 2 +- src/platform/include/ThreadStackManager.h | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/platform/include/CHIPDeviceEvent.h b/src/platform/include/CHIPDeviceEvent.h index 59fa2a2d942516..d359d26943e4f9 100644 --- a/src/platform/include/CHIPDeviceEvent.h +++ b/src/platform/include/CHIPDeviceEvent.h @@ -266,7 +266,7 @@ typedef void (*AsyncWorkFunct)(intptr_t arg); #ifdef EXTERNAL_CHIPDEVICEPLATFORMEVENT_HEADER #include EXTERNAL_CHIPDEVICEPLATFORMEVENT_HEADER #else -#define CHIPDEVICEPLATFORMEVENT_HEADER +#define CHIPDEVICEPLATFORMEVENT_HEADER #include CHIPDEVICEPLATFORMEVENT_HEADER #endif diff --git a/src/platform/include/CHIPDeviceLayer.h b/src/platform/include/CHIPDeviceLayer.h index 67c4ab2d9cba20..c17c1f7f50e5df 100644 --- a/src/platform/include/CHIPDeviceLayer.h +++ b/src/platform/include/CHIPDeviceLayer.h @@ -19,7 +19,7 @@ #define CHIP_DEVICE_H #include -#include +// #include #include #include #include @@ -39,12 +39,12 @@ namespace chip { namespace DeviceLayer { struct chipDeviceEvent; - +/* using chip::FabricState; using chip::MessageLayer; using chip::ExchangeMgr; using chip::SecurityMgr; - +*/ extern chip::System::Layer SystemLayer; extern Inet::InetLayer InetLayer; diff --git a/src/platform/include/ConfigurationManager.h b/src/platform/include/ConfigurationManager.h index 2834ac37debe94..2b77a5b1f2de36 100644 --- a/src/platform/include/ConfigurationManager.h +++ b/src/platform/include/ConfigurationManager.h @@ -193,7 +193,7 @@ extern ConfigurationManagerImpl & ConfigurationMgrImpl(void); #ifdef EXTERNAL_CONFIGURATIONMANAGERIMPL_HEADER #include EXTERNAL_CONFIGURATIONMANAGERIMPL_HEADER #else -#define CONFIGURATIONMANAGERIMPL_HEADER +#define CONFIGURATIONMANAGERIMPL_HEADER #include CONFIGURATIONMANAGERIMPL_HEADER #endif diff --git a/src/platform/include/ConnectivityManager.h b/src/platform/include/ConnectivityManager.h index 52df85870c3fc5..3b846fad64a13f 100644 --- a/src/platform/include/ConnectivityManager.h +++ b/src/platform/include/ConnectivityManager.h @@ -243,7 +243,7 @@ extern ConnectivityManagerImpl & ConnectivityMgrImpl(void); #ifdef EXTERNAL_CONNECTIVITYMANAGERIMPL_HEADER #include EXTERNAL_CONNECTIVITYMANAGERIMPL_HEADER #else -#define CONNECTIVITYMANAGERIMPL_HEADER +#define CONNECTIVITYMANAGERIMPL_HEADER #include CONNECTIVITYMANAGERIMPL_HEADER #endif diff --git a/src/platform/include/PlatformManager.h b/src/platform/include/PlatformManager.h index c1d4bc7d560fe2..7e1b6cac45d474 100644 --- a/src/platform/include/PlatformManager.h +++ b/src/platform/include/PlatformManager.h @@ -148,7 +148,7 @@ extern PlatformManagerImpl & PlatformMgrImpl(void); #ifdef EXTERNAL_PLATFORMMANAGERIMPL_HEADER #include EXTERNAL_PLATFORMMANAGERIMPL_HEADER #else -#define PLATFORMMANAGERIMPL_HEADER +#define PLATFORMMANAGERIMPL_HEADER #include PLATFORMMANAGERIMPL_HEADER #endif diff --git a/src/platform/include/SoftwareUpdateManager.h b/src/platform/include/SoftwareUpdateManager.h index 7a2725be212f34..278cdafb7597e1 100644 --- a/src/platform/include/SoftwareUpdateManager.h +++ b/src/platform/include/SoftwareUpdateManager.h @@ -356,7 +356,7 @@ extern SoftwareUpdateManagerImpl & SoftwareUpdateMgrImpl(void); #ifdef EXTERNAL_SOFTWAREUPDATEMANAGERIMPL_HEADER #include EXTERNAL_SOFTWAREUPDATEMANAGERIMPL_HEADER #else -#define SOFTWAREUPDATEMANAGERIMPL_HEADER +#define SOFTWAREUPDATEMANAGERIMPL_HEADER #include SOFTWAREUPDATEMANAGERIMPL_HEADER #endif diff --git a/src/platform/include/ThreadStackManager.h b/src/platform/include/ThreadStackManager.h index d45b4831743032..610821c30e0184 100644 --- a/src/platform/include/ThreadStackManager.h +++ b/src/platform/include/ThreadStackManager.h @@ -137,7 +137,7 @@ extern ThreadStackManagerImpl & ThreadStackMgrImpl(void); #ifdef EXTERNAL_THREADSTACKMANAGERIMPL_HEADER #include EXTERNAL_THREADSTACKMANAGERIMPL_HEADER #else -#define THREADSTACKMANAGERIMPL_HEADER +#define THREADSTACKMANAGERIMPL_HEADER #include THREADSTACKMANAGERIMPL_HEADER #endif From 41aa071ce64a44fe9fc3d3cdbc07653ef2891f44 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Fri, 13 Mar 2020 10:38:34 -0700 Subject: [PATCH 3/7] Import connection manager impl and its generic dependencies --- .../include/ConnectivityManagerImpl.h | 131 ++++++++++ .../internal/DeviceDescriptionServer.h | 104 ++++++++ .../internal/GenericConnectivityManagerImpl.h | 91 +++++++ .../GenericConnectivityManagerImpl_BLE.h | 143 +++++++++++ .../GenericConnectivityManagerImpl_BLE.ipp | 61 +++++ .../GenericConnectivityManagerImpl_NoBLE.h | 139 +++++++++++ .../GenericConnectivityManagerImpl_NoThread.h | 140 +++++++++++ .../GenericConnectivityManagerImpl_NoTunnel.h | 112 +++++++++ .../GenericConnectivityManagerImpl_NoWiFi.h | 225 ++++++++++++++++++ .../GenericConnectivityManagerImpl_Thread.h | 165 +++++++++++++ .../GenericConnectivityManagerImpl_Thread.ipp | 154 ++++++++++++ 11 files changed, 1465 insertions(+) create mode 100644 src/platform/include/ConnectivityManagerImpl.h create mode 100644 src/platform/include/internal/DeviceDescriptionServer.h create mode 100644 src/platform/include/internal/GenericConnectivityManagerImpl.h create mode 100644 src/platform/include/internal/GenericConnectivityManagerImpl_BLE.h create mode 100644 src/platform/include/internal/GenericConnectivityManagerImpl_BLE.ipp create mode 100644 src/platform/include/internal/GenericConnectivityManagerImpl_NoBLE.h create mode 100644 src/platform/include/internal/GenericConnectivityManagerImpl_NoThread.h create mode 100644 src/platform/include/internal/GenericConnectivityManagerImpl_NoTunnel.h create mode 100644 src/platform/include/internal/GenericConnectivityManagerImpl_NoWiFi.h create mode 100644 src/platform/include/internal/GenericConnectivityManagerImpl_Thread.h create mode 100644 src/platform/include/internal/GenericConnectivityManagerImpl_Thread.ipp diff --git a/src/platform/include/ConnectivityManagerImpl.h b/src/platform/include/ConnectivityManagerImpl.h new file mode 100644 index 00000000000000..d167c1173ceb0b --- /dev/null +++ b/src/platform/include/ConnectivityManagerImpl.h @@ -0,0 +1,131 @@ +/* + * + * Copyright (c) 2018 Nest Labs, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CONNECTIVITY_MANAGER_IMPL_H +#define CONNECTIVITY_MANAGER_IMPL_H + +#include +#include +#if WEAVE_DEVICE_CONFIG_ENABLE_WOBLE +#include +#else +#include +#endif +#if WEAVE_DEVICE_CONFIG_ENABLE_THREAD +#include +#else +#include +#endif +#include +#include +#include + +namespace nl { +namespace Inet { +class IPAddress; +} // namespace Inet +} // namespace nl + +namespace nl { +namespace Weave { +namespace DeviceLayer { + +/** + * Concrete implementation of the ConnectivityManager singleton object for Nordic nRF52 platforms. + */ +class ConnectivityManagerImpl final + : public ConnectivityManager, + public Internal::GenericConnectivityManagerImpl, +#if WEAVE_DEVICE_CONFIG_ENABLE_WOBLE + public Internal::GenericConnectivityManagerImpl_BLE, +#else + public Internal::GenericConnectivityManagerImpl_NoBLE, +#endif +#if WEAVE_DEVICE_CONFIG_ENABLE_THREAD + public Internal::GenericConnectivityManagerImpl_Thread, +#else + public Internal::GenericConnectivityManagerImpl_NoThread, +#endif + public Internal::GenericConnectivityManagerImpl_NoWiFi, + public Internal::GenericConnectivityManagerImpl_NoTunnel +{ + // Allow the ConnectivityManager interface class to delegate method calls to + // the implementation methods provided by this class. + friend class ConnectivityManager; + +private: + + // ===== Members that implement the ConnectivityManager abstract interface. + + bool _HaveIPv4InternetConnectivity(void); + bool _HaveIPv6InternetConnectivity(void); + bool _HaveServiceConnectivity(void); + WEAVE_ERROR _Init(void); + void _OnPlatformEvent(const WeaveDeviceEvent * event); + + // ===== Members for internal use by the following friends. + + friend ConnectivityManager & ConnectivityMgr(void); + friend ConnectivityManagerImpl & ConnectivityMgrImpl(void); + + static ConnectivityManagerImpl sInstance; +}; + +inline bool ConnectivityManagerImpl::_HaveIPv4InternetConnectivity(void) +{ + return false; +} + +inline bool ConnectivityManagerImpl::_HaveIPv6InternetConnectivity(void) +{ + return false; +} + +inline bool ConnectivityManagerImpl::_HaveServiceConnectivity(void) +{ + return _HaveServiceConnectivityViaThread(); +} + + +/** + * Returns the public interface of the ConnectivityManager singleton object. + * + * Weave applications should use this to access features of the ConnectivityManager object + * that are common to all platforms. + */ +inline ConnectivityManager & ConnectivityMgr(void) +{ + return ConnectivityManagerImpl::sInstance; +} + +/** + * Returns the platform-specific implementation of the ConnectivityManager singleton object. + * + * Weave applications can use this to gain access to features of the ConnectivityManager + * that are specific to the ESP32 platform. + */ +inline ConnectivityManagerImpl & ConnectivityMgrImpl(void) +{ + return ConnectivityManagerImpl::sInstance; +} + +} // namespace DeviceLayer +} // namespace Weave +} // namespace nl + +#endif // CONNECTIVITY_MANAGER_IMPL_H diff --git a/src/platform/include/internal/DeviceDescriptionServer.h b/src/platform/include/internal/DeviceDescriptionServer.h new file mode 100644 index 00000000000000..75906269f08a13 --- /dev/null +++ b/src/platform/include/internal/DeviceDescriptionServer.h @@ -0,0 +1,104 @@ +/* + * + * Copyright (c) 2018 Nest Labs, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Defines the Device Layer DeviceDescriptionServer object. + */ + +#ifndef DEVICE_DESCRIPTION_SERVER_H +#define DEVICE_DESCRIPTION_SERVER_H + +#include +#include + +namespace nl { +namespace Weave { +namespace DeviceLayer { +namespace Internal { + +/** + * Implements the Weave Device Description profile for a Weave device. + */ +class DeviceDescriptionServer final + : public ::nl::Weave::Profiles::DeviceDescription::DeviceDescriptionServer +{ + typedef ::nl::Weave::Profiles::DeviceDescription::DeviceDescriptionServer ServerBaseClass; + +public: + + // ===== Members for internal use by other Device Layer components. + + WEAVE_ERROR Init(); + + bool IsUserSelectedModeActive(void); + void SetUserSelectedMode(bool val); + uint16_t GetUserSelectedModeTimeout(void); + void SetUserSelectedModeTimeout(uint16_t val); + + void OnPlatformEvent(const WeaveDeviceEvent * event); + +private: + + // ===== Members for internal use by the following friends. + + friend DeviceDescriptionServer & DeviceDescriptionSvr(void); + + static DeviceDescriptionServer sInstance; + + // ===== Private members reserved for use by this class only. + + enum + { + kUserSelectedModeTimeShift = 10 + }; + + uint32_t mUserSelectedModeEndTime; // Monotonic system time scaled to units of 1024ms. + uint16_t mUserSelectedModeTimeoutSec; + + static void HandleIdentifyRequest(void *appState, uint64_t nodeId, const IPAddress& nodeAddr, + const ::nl::Weave::Profiles::DeviceDescription::IdentifyRequestMessage& reqMsg, bool& sendResp, + ::nl::Weave::Profiles::DeviceDescription::IdentifyResponseMessage& respMsg); + +protected: + + // Construction/destruction limited to subclasses. + DeviceDescriptionServer() = default; + ~DeviceDescriptionServer() = default; + + // No copy, move or assignment. + DeviceDescriptionServer(const DeviceDescriptionServer &) = delete; + DeviceDescriptionServer(const DeviceDescriptionServer &&) = delete; + DeviceDescriptionServer & operator=(const DeviceDescriptionServer &) = delete; +}; + +/** + * Returns a reference to the DeviceDescriptionServer singleton object. + */ +inline DeviceDescriptionServer & DeviceDescriptionSvr(void) +{ + return DeviceDescriptionServer::sInstance; +} + +} // namespace Internal +} // namespace DeviceLayer +} // namespace Weave +} // namespace nl + + +#endif // DEVICE_DESCRIPTION_SERVER_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl.h b/src/platform/include/internal/GenericConnectivityManagerImpl.h new file mode 100644 index 00000000000000..5bfd9911a44508 --- /dev/null +++ b/src/platform/include/internal/GenericConnectivityManagerImpl.h @@ -0,0 +1,91 @@ +/* + * + * Copyright (c) 2019 Nest Labs, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Provides an generic implementation of ConnectivityManager features + * for use on various platforms. + */ + +#ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_H +#define GENERIC_CONNECTIVITY_MANAGER_IMPL_H + +#include + + +namespace nl { +namespace Weave { +namespace DeviceLayer { +namespace Internal { + +/** + * Provides a generic implementation of ConnectivityManager features that works on multiple platforms. + * + * This template contains implementations of select features from the ConnectivityManager abstract + * interface that are suitable for use on all platforms. It is intended to be inherited (directly + * or indirectly) by the ConfigurationManagerImpl class, which also appears as the template's ImplClass + * parameter. + */ +template +class GenericConnectivityManagerImpl +{ +public: + + // ===== Methods that implement the ConnectivityManager abstract interface. + + bool _IsUserSelectedModeActive(void); + void _SetUserSelectedMode(bool val); + uint16_t _GetUserSelectedModeTimeout(void); + void _SetUserSelectedModeTimeout(uint16_t val); + +private: + + ImplClass * Impl() { return static_cast(this); } +}; + +template +inline bool GenericConnectivityManagerImpl::_IsUserSelectedModeActive(void) +{ + return DeviceDescriptionSvr().IsUserSelectedModeActive(); +} + +template +inline void GenericConnectivityManagerImpl::_SetUserSelectedMode(bool val) +{ + DeviceDescriptionSvr().SetUserSelectedMode(val); +} + +template +inline uint16_t GenericConnectivityManagerImpl::_GetUserSelectedModeTimeout(void) +{ + return DeviceDescriptionSvr().GetUserSelectedModeTimeout(); +} + +template +inline void GenericConnectivityManagerImpl::_SetUserSelectedModeTimeout(uint16_t val) +{ + DeviceDescriptionSvr().SetUserSelectedModeTimeout(val); +} + + +} // namespace Internal +} // namespace DeviceLayer +} // namespace Weave +} // namespace nl + +#endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.h b/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.h new file mode 100644 index 00000000000000..9c79341245f28b --- /dev/null +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.h @@ -0,0 +1,143 @@ +/* + * + * Copyright (c) 2019 Nest Labs, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Provides an generic implementation of ConnectivityManager features + * for use on platforms that support BLE. + */ + +#ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_BLE_H +#define GENERIC_CONNECTIVITY_MANAGER_IMPL_BLE_H + +#include + +namespace nl { +namespace Weave { +namespace DeviceLayer { + +class ConnectivityManagerImpl; + +namespace Internal { + + +/** + * Provides a generic implementation of BLE-specific ConnectivityManager features for + * platforms where BLE functionality is implemented by the BLEManager class. + * + * This class is intended to be inherited (directly or indirectly) by the ConnectivityManagerImpl + * class, which also appears as the template's ImplClass parameter. + * + * The majority of methods on this class simply forward calls to similarly-named methods on + * the BLEManager class. This arrangement, where the ConnectivityManager implementation delegates + * BLE support to the BLEManager class, is standard on platforms that support BLE, and helps to + * limit the complexity of the ConnectivityManagerImpl class. + */ +template +class GenericConnectivityManagerImpl_BLE +{ +public: + + // ===== Methods that implement the ConnectivityManager abstract interface. + + ConnectivityManager::WoBLEServiceMode _GetWoBLEServiceMode(void); + WEAVE_ERROR _SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val); + bool _IsBLEAdvertisingEnabled(void); + WEAVE_ERROR _SetBLEAdvertisingEnabled(bool val); + bool _IsBLEFastAdvertisingEnabled(void); + WEAVE_ERROR _SetBLEFastAdvertisingEnabled(bool val); + bool _IsBLEAdvertising(void); + WEAVE_ERROR _GetBLEDeviceName(char * buf, size_t bufSize); + WEAVE_ERROR _SetBLEDeviceName(const char * deviceName); + uint16_t _NumBLEConnections(void); + static const char * _WoBLEServiceModeToStr(ConnectivityManager::WoBLEServiceMode mode); + +private: + + ImplClass * Impl() { return static_cast(this); } +}; + +// Instruct the compiler to instantiate the template only when explicitly told to do so. +extern template class GenericConnectivityManagerImpl_BLE; + +template +inline ConnectivityManager::WoBLEServiceMode GenericConnectivityManagerImpl_BLE::_GetWoBLEServiceMode(void) +{ + return BLEMgr().GetWoBLEServiceMode(); +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_BLE::_SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val) +{ + return BLEMgr().SetWoBLEServiceMode(val); +} + +template +inline bool GenericConnectivityManagerImpl_BLE::_IsBLEAdvertisingEnabled(void) +{ + return BLEMgr().IsAdvertisingEnabled(); +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_BLE::_SetBLEAdvertisingEnabled(bool val) +{ + return BLEMgr().SetAdvertisingEnabled(val); +} + +template +inline bool GenericConnectivityManagerImpl_BLE::_IsBLEFastAdvertisingEnabled(void) +{ + return BLEMgr().IsFastAdvertisingEnabled(); +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_BLE::_SetBLEFastAdvertisingEnabled(bool val) +{ + return BLEMgr().SetFastAdvertisingEnabled(val); +} + +template +inline bool GenericConnectivityManagerImpl_BLE::_IsBLEAdvertising(void) +{ + return BLEMgr().IsAdvertising(); +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_BLE::_GetBLEDeviceName(char * buf, size_t bufSize) +{ + return BLEMgr().GetDeviceName(buf, bufSize); +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_BLE::_SetBLEDeviceName(const char * deviceName) +{ + return BLEMgr().SetDeviceName(deviceName); +} + +template +inline uint16_t GenericConnectivityManagerImpl_BLE::_NumBLEConnections(void) +{ + return BLEMgr().NumConnections(); +} + +} // namespace Internal +} // namespace DeviceLayer +} // namespace Weave +} // namespace nl + +#endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_BLE_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.ipp b/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.ipp new file mode 100644 index 00000000000000..a4531d98541515 --- /dev/null +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.ipp @@ -0,0 +1,61 @@ +/* + * + * Copyright (c) 2019 Nest Labs, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Provides an generic implementation of ConnectivityManager features + * for use on platforms that support BLE. + */ + +#ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_BLE_IPP +#define GENERIC_CONNECTIVITY_MANAGER_IMPL_BLE_IPP + +#include + + +namespace nl { +namespace Weave { +namespace DeviceLayer { +namespace Internal { + +// Fully instantiate the template class in whatever compilation unit includes this file. +template class GenericConnectivityManagerImpl_BLE; + +template +const char * GenericConnectivityManagerImpl_BLE::_WoBLEServiceModeToStr(ConnectivityManager::WoBLEServiceMode mode) +{ + switch (mode) + { + case ConnectivityManager::kWoBLEServiceMode_NotSupported: + return "NotSupported"; + case ConnectivityManager::kWoBLEServiceMode_Enabled: + return "Disabled"; + case ConnectivityManager::kWoBLEServiceMode_Disabled: + return "Enabled"; + default: + return "(unknown)"; + } +} + +} // namespace Internal +} // namespace DeviceLayer +} // namespace Weave +} // namespace nl + + +#endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_BLE_IPP diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_NoBLE.h b/src/platform/include/internal/GenericConnectivityManagerImpl_NoBLE.h new file mode 100644 index 00000000000000..d31c7a8227b6d7 --- /dev/null +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_NoBLE.h @@ -0,0 +1,139 @@ +/* + * + * Copyright (c) 2019 Nest Labs, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Provides an generic implementation of ConnectivityManager features + * for use on platforms that don't have BLE. + */ + +#ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_BLE_H +#define GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_BLE_H + +namespace nl { +namespace Weave { +namespace DeviceLayer { +namespace Internal { + +/** + * Provides a generic implementation of BLE-specific ConnectivityManager features for + * platforms that don't support BLE. + * + * This class is intended to be inherited (directly or indirectly) by the ConnectivityManagerImpl + * class, which also appears as the template's ImplClass parameter. + * + * The members of this class are all inlined methods that do nothing, and return static return + * values. This allows the compiler to optimize away dead code without the use of #ifdef's. + * For example: + * + * ``` + * if (ConnectivityMgr().GetWoBLEServiceMode() != ConnectivityManager::kWoBLEServiceMode_NotSupported) + * { + * // ... do something on devices that support WoBLE ... + * } + * ``` + */ +template +class GenericConnectivityManagerImpl_NoBLE +{ +public: + + // ===== Methods that implement the ConnectivityManager abstract interface. + + ConnectivityManager::WoBLEServiceMode _GetWoBLEServiceMode(void); + WEAVE_ERROR _SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val); + bool _IsBLEAdvertisingEnabled(void); + WEAVE_ERROR _SetBLEAdvertisingEnabled(bool val); + bool _IsBLEFastAdvertisingEnabled(void); + WEAVE_ERROR _SetBLEFastAdvertisingEnabled(bool val); + WEAVE_ERROR _GetBLEDeviceName(char * buf, size_t bufSize); + WEAVE_ERROR _SetBLEDeviceName(const char * deviceName); + uint16_t _NumBLEConnections(void); + static const char * _WoBLEServiceModeToStr(ConnectivityManager::WoBLEServiceMode mode); + +private: + + ImplClass * Impl() { return static_cast(this); } +}; + +template +inline ConnectivityManager::WoBLEServiceMode GenericConnectivityManagerImpl_NoBLE::_GetWoBLEServiceMode(void) +{ + return ConnectivityManager::kWoBLEServiceMode_NotSupported; +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_NoBLE::_SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val) +{ + return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; +} + +template +inline bool GenericConnectivityManagerImpl_NoBLE::_IsBLEAdvertisingEnabled(void) +{ + return false; +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_NoBLE::_SetBLEAdvertisingEnabled(bool val) +{ + return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; +} + +template +inline bool GenericConnectivityManagerImpl_NoBLE::_IsBLEFastAdvertisingEnabled(void) +{ + return false; +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_NoBLE::_SetBLEFastAdvertisingEnabled(bool val) +{ + return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_NoBLE::_GetBLEDeviceName(char * buf, size_t bufSize) +{ + return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_NoBLE::_SetBLEDeviceName(const char * deviceName) +{ + return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; +} + +template +inline uint16_t GenericConnectivityManagerImpl_NoBLE::_NumBLEConnections(void) +{ + return false; +} + +template +inline const char * GenericConnectivityManagerImpl_NoBLE::_WoBLEServiceModeToStr(ConnectivityManager::WoBLEServiceMode mode) +{ + return NULL; +} + +} // namespace Internal +} // namespace DeviceLayer +} // namespace Weave +} // namespace nl + +#endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_BLE_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_NoThread.h b/src/platform/include/internal/GenericConnectivityManagerImpl_NoThread.h new file mode 100644 index 00000000000000..96b550a7a03dce --- /dev/null +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_NoThread.h @@ -0,0 +1,140 @@ +/* + * + * Copyright (c) 2019 Nest Labs, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Provides a generic implementation of ConnectivityManager features + * for use on platforms that do NOT support Thread. + */ + +#ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_THREAD_H +#define GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_THREAD_H + +namespace nl { +namespace Weave { +namespace DeviceLayer { +namespace Internal { + +/** + * Provides a generic implementation of WiFi-specific ConnectivityManager features for + * use on platforms that do NOT support Thread. + * + * This class is intended to be inherited (directly or indirectly) by the ConnectivityManagerImpl + * class, which also appears as the template's ImplClass parameter. + * + */ +template +class GenericConnectivityManagerImpl_NoThread +{ +protected: + + // ===== Methods that implement the ConnectivityManager abstract interface. + + ConnectivityManager::ThreadMode _GetThreadMode(void); + WEAVE_ERROR _SetThreadMode(ConnectivityManager::ThreadMode val); + bool _IsThreadEnabled(void); + bool _IsThreadApplicationControlled(void); + ConnectivityManager::ThreadDeviceType _GetThreadDeviceType(void); + WEAVE_ERROR _SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType); + void _GetThreadPollingConfig(ConnectivityManager::ThreadPollingConfig & pollingConfig); + WEAVE_ERROR _SetThreadPollingConfig(const ConnectivityManager::ThreadPollingConfig & pollingConfig); + bool _IsThreadAttached(void); + bool _IsThreadProvisioned(void); + void _ClearThreadProvision(void); + bool _HaveServiceConnectivityViaThread(void); + + ImplClass * Impl() { return static_cast(this); } +}; + +template +inline ConnectivityManager::ThreadMode GenericConnectivityManagerImpl_NoThread::_GetThreadMode(void) +{ + return ConnectivityManager::kThreadMode_NotSupported; +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_NoThread::_SetThreadMode(ConnectivityManager::ThreadMode val) +{ + return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; +} + +template +inline bool GenericConnectivityManagerImpl_NoThread::_IsThreadEnabled(void) +{ + return false; +} + +template +inline bool GenericConnectivityManagerImpl_NoThread::_IsThreadApplicationControlled(void) +{ + return false; +} + +template +inline bool GenericConnectivityManagerImpl_NoThread::_IsThreadAttached(void) +{ + return false; +} + +template +inline bool GenericConnectivityManagerImpl_NoThread::_IsThreadProvisioned(void) +{ + return false; +} + +template +inline void GenericConnectivityManagerImpl_NoThread::_ClearThreadProvision(void) +{ +} + +template +inline ConnectivityManager::ThreadDeviceType GenericConnectivityManagerImpl_NoThread::_GetThreadDeviceType(void) +{ + return ConnectivityManager::kThreadDeviceType_NotSupported; +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_NoThread::_SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType) +{ + return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; +} + +template +inline void GenericConnectivityManagerImpl_NoThread::_GetThreadPollingConfig(ConnectivityManager::ThreadPollingConfig & pollingConfig) +{ + pollingConfig.Clear(); +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_NoThread::_SetThreadPollingConfig(const ConnectivityManager::ThreadPollingConfig & pollingConfig) +{ + return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; +} + +template +inline bool GenericConnectivityManagerImpl_NoThread::_HaveServiceConnectivityViaThread(void) +{ + return false; +} + +} // namespace Internal +} // namespace DeviceLayer +} // namespace Weave +} // namespace nl + +#endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_THREAD_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_NoTunnel.h b/src/platform/include/internal/GenericConnectivityManagerImpl_NoTunnel.h new file mode 100644 index 00000000000000..7ca8ca2fcd9ebd --- /dev/null +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_NoTunnel.h @@ -0,0 +1,112 @@ +/* + * + * Copyright (c) 2019 Nest Labs, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Provides an generic implementation of ConnectivityManager features + * for use on platforms that don't support a service tunnel. + */ + +#ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_TUNNEL_H +#define GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_TUNNEL_H + +namespace nl { +namespace Weave { +namespace DeviceLayer { +namespace Internal { + +/** + * Provides a generic implementation of service tunnel-specific ConnectivityManager features for + * platforms that don't support a service tunnel. + * + * This class is intended to be inherited (directly or indirectly) by the ConnectivityManagerImpl + * class, which also appears as the template's ImplClass parameter. + * + * The members of this class are all inlined methods that do nothing, and return static return + * values. This allows the compiler to optimize away dead code without the use of #ifdef's. + * For example: + * + * ``` + * if (ConnectivityMgr().GetServiceTunnelMode() != ConnectivityManager::kWoBLEServiceMode_NotSupported) + * { + * // ... do something on devices that support service tunnels ... + * } + * ``` + */ +template +class GenericConnectivityManagerImpl_NoTunnel +{ +public: + + // ===== Methods that implement the ConnectivityManager abstract interface. + + ConnectivityManager::ServiceTunnelMode _GetServiceTunnelMode(void); + WEAVE_ERROR _SetServiceTunnelMode(ConnectivityManager::ServiceTunnelMode val); + bool _IsServiceTunnelConnected(void); + bool _IsServiceTunnelRestricted(void); + bool _HaveServiceConnectivityViaTunnel(void); + static const char * _ServiceTunnelModeToStr(ConnectivityManager::ServiceTunnelMode mode); + +private: + + ImplClass * Impl() { return static_cast(this); } +}; + +template +inline ConnectivityManager::ServiceTunnelMode GenericConnectivityManagerImpl_NoTunnel::_GetServiceTunnelMode(void) +{ + return ConnectivityManager::kServiceTunnelMode_NotSupported; +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_NoTunnel::_SetServiceTunnelMode(ConnectivityManager::ServiceTunnelMode val) +{ + return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; +} + +template +inline bool GenericConnectivityManagerImpl_NoTunnel::_IsServiceTunnelConnected(void) +{ + return false; +} + +template +inline bool GenericConnectivityManagerImpl_NoTunnel::_IsServiceTunnelRestricted(void) +{ + return false; +} + +template +inline bool GenericConnectivityManagerImpl_NoTunnel::_HaveServiceConnectivityViaTunnel(void) +{ + return false; +} + +template +inline const char * GenericConnectivityManagerImpl_NoTunnel::_ServiceTunnelModeToStr(ConnectivityManager::ServiceTunnelMode mode) +{ + return NULL; +} + + +} // namespace Internal +} // namespace DeviceLayer +} // namespace Weave +} // namespace nl + +#endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_TUNNEL_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_NoWiFi.h b/src/platform/include/internal/GenericConnectivityManagerImpl_NoWiFi.h new file mode 100644 index 00000000000000..cd9c3b897c442c --- /dev/null +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_NoWiFi.h @@ -0,0 +1,225 @@ +/* + * + * Copyright (c) 2019 Nest Labs, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Provides an generic implementation of ConnectivityManager features + * for use on platforms that don't have WiFi. + */ + +#ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_WIFI_H +#define GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_WIFI_H + +namespace nl { +namespace Weave { +namespace DeviceLayer { +namespace Internal { + +/** + * Provides a generic implementation of WiFi-specific ConnectivityManager features for + * platforms that don't support WiFi. + * + * This class is intended to be inherited (directly or indirectly) by the ConnectivityManagerImpl + * class, which also appears as the template's ImplClass parameter. + * + * The members of this class are all inlined methods that do nothing, and return static return + * values. This allows the compiler to optimize away dead code without the use of #ifdef's. + * For example: + * + * ``` + * if (ConnectivityMgr().GetWiFiStationMode() != ConnectivityManager::kWiFiStationMode_NotSupported) + * { + * // ... do something on devices that support WiFi ... + * } + * ``` + */ +template +class GenericConnectivityManagerImpl_NoWiFi +{ +public: + + // ===== Methods that implement the ConnectivityManager abstract interface. + + ConnectivityManager::WiFiStationMode _GetWiFiStationMode(void); + WEAVE_ERROR _SetWiFiStationMode(ConnectivityManager::WiFiStationMode val); + bool _IsWiFiStationEnabled(void); + bool _IsWiFiStationApplicationControlled(void); + bool _IsWiFiStationConnected(void); + uint32_t _GetWiFiStationReconnectIntervalMS(void); + WEAVE_ERROR _SetWiFiStationReconnectIntervalMS(uint32_t val); + bool _IsWiFiStationProvisioned(void); + void _ClearWiFiStationProvision(void); + ConnectivityManager::WiFiAPMode _GetWiFiAPMode(void); + WEAVE_ERROR _SetWiFiAPMode(ConnectivityManager::WiFiAPMode val); + bool _IsWiFiAPActive(void); + bool _IsWiFiAPApplicationControlled(void); + void _DemandStartWiFiAP(void); + void _StopOnDemandWiFiAP(void); + void _MaintainOnDemandWiFiAP(void); + uint32_t _GetWiFiAPIdleTimeoutMS(void); + void _SetWiFiAPIdleTimeoutMS(uint32_t val); + WEAVE_ERROR _GetAndLogWifiStatsCounters(void); + bool _CanStartWiFiScan(); + void _OnWiFiScanDone(); + void _OnWiFiStationProvisionChange(); + static const char * _WiFiStationModeToStr(ConnectivityManager::WiFiStationMode mode); + static const char * _WiFiAPModeToStr(ConnectivityManager::WiFiAPMode mode); + +private: + + ImplClass * Impl() { return static_cast(this); } +}; + +template +inline ConnectivityManager::WiFiStationMode GenericConnectivityManagerImpl_NoWiFi::_GetWiFiStationMode(void) +{ + return ConnectivityManager::kWiFiStationMode_NotSupported; +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_NoWiFi::_SetWiFiStationMode(ConnectivityManager::WiFiStationMode val) +{ + return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; +} + +template +inline bool GenericConnectivityManagerImpl_NoWiFi::_IsWiFiStationEnabled(void) +{ + return false; +} + +template +inline bool GenericConnectivityManagerImpl_NoWiFi::_IsWiFiStationConnected(void) +{ + return false; +} + +template +inline uint32_t GenericConnectivityManagerImpl_NoWiFi::_GetWiFiStationReconnectIntervalMS(void) +{ + return 0; +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_NoWiFi::_SetWiFiStationReconnectIntervalMS(uint32_t val) +{ + return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; +} + +template +inline bool GenericConnectivityManagerImpl_NoWiFi::_IsWiFiStationProvisioned(void) +{ + return false; +} + +template +inline void GenericConnectivityManagerImpl_NoWiFi::_ClearWiFiStationProvision(void) +{ +} + +template +inline ConnectivityManager::WiFiAPMode GenericConnectivityManagerImpl_NoWiFi::_GetWiFiAPMode(void) +{ + return ConnectivityManager::kWiFiAPMode_NotSupported; +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_NoWiFi::_SetWiFiAPMode(ConnectivityManager::WiFiAPMode val) +{ + return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; +} + +template +inline bool GenericConnectivityManagerImpl_NoWiFi::_IsWiFiAPActive(void) +{ + return false; +} + +template +inline bool GenericConnectivityManagerImpl_NoWiFi::_IsWiFiAPApplicationControlled(void) +{ + return false; +} + +template +inline void GenericConnectivityManagerImpl_NoWiFi::_DemandStartWiFiAP(void) +{ +} + +template +inline void GenericConnectivityManagerImpl_NoWiFi::_StopOnDemandWiFiAP(void) +{ +} + +template +inline void GenericConnectivityManagerImpl_NoWiFi::_MaintainOnDemandWiFiAP(void) +{ +} + +template +inline uint32_t GenericConnectivityManagerImpl_NoWiFi::_GetWiFiAPIdleTimeoutMS(void) +{ + return 0; +} + +template +inline void GenericConnectivityManagerImpl_NoWiFi::_SetWiFiAPIdleTimeoutMS(uint32_t val) +{ +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_NoWiFi::_GetAndLogWifiStatsCounters(void) +{ + return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; +} + +template +inline bool GenericConnectivityManagerImpl_NoWiFi::_CanStartWiFiScan() +{ + return false; +} + +template +inline void GenericConnectivityManagerImpl_NoWiFi::_OnWiFiScanDone() +{ +} + +template +inline void GenericConnectivityManagerImpl_NoWiFi::_OnWiFiStationProvisionChange() +{ +} + +template +inline const char * GenericConnectivityManagerImpl_NoWiFi::_WiFiStationModeToStr(ConnectivityManager::WiFiStationMode mode) +{ + return NULL; +} + +template +inline const char * GenericConnectivityManagerImpl_NoWiFi::_WiFiAPModeToStr(ConnectivityManager::WiFiAPMode mode) +{ + return NULL; +} + + +} // namespace Internal +} // namespace DeviceLayer +} // namespace Weave +} // namespace nl + +#endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_WIFI_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_Thread.h b/src/platform/include/internal/GenericConnectivityManagerImpl_Thread.h new file mode 100644 index 00000000000000..d003cb04e08e56 --- /dev/null +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_Thread.h @@ -0,0 +1,165 @@ +/* + * + * Copyright (c) 2019 Nest Labs, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Provides an generic implementation of ConnectivityManager features + * for use on platforms that support Thread. + */ + +#ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_THREAD_H +#define GENERIC_CONNECTIVITY_MANAGER_IMPL_THREAD_H + +#include + +namespace nl { +namespace Weave { +namespace DeviceLayer { + +class ConnectivityManagerImpl; + +namespace Internal { + +/** + * Provides a generic implementation of WiFi-specific ConnectivityManager features for + * use on platforms that support Thread. + * + * This class is intended to be inherited (directly or indirectly) by the ConnectivityManagerImpl + * class, which also appears as the template's ImplClass parameter. + * + * The GenericConnectivityManagerImpl_Thread<> class is designed to be independent of the particular + * Thread stack in use, implying, for example, that the code does not make direct use of any OpenThread + * APIs. This is achieved by delegating all stack-specific operations to the ThreadStackManager class. + * + */ +template +class GenericConnectivityManagerImpl_Thread +{ +protected: + + // ===== Methods that implement the ConnectivityManager abstract interface. + + void _Init(void); + void _OnPlatformEvent(const WeaveDeviceEvent * event); + ConnectivityManager::ThreadMode _GetThreadMode(void); + WEAVE_ERROR _SetThreadMode(ConnectivityManager::ThreadMode val); + bool _IsThreadEnabled(void); + bool _IsThreadApplicationControlled(void); + ConnectivityManager::ThreadDeviceType _GetThreadDeviceType(void); + WEAVE_ERROR _SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType); + void _GetThreadPollingConfig(ConnectivityManager::ThreadPollingConfig & pollingConfig); + WEAVE_ERROR _SetThreadPollingConfig(const ConnectivityManager::ThreadPollingConfig & pollingConfig); + bool _IsThreadAttached(void); + bool _IsThreadProvisioned(void); + void _ClearThreadProvision(void); + bool _HaveServiceConnectivityViaThread(void); + + // ===== Members for use by the implementation subclass. + + void UpdateServiceConnectivity(void); + +private: + + // ===== Private members reserved for use by this class only. + + enum Flags + { + kFlag_HaveServiceConnectivity = 0x01, + kFlag_IsApplicationControlled = 0x02 + }; + + uint8_t mFlags; + + ImplClass * Impl() { return static_cast(this); } +}; + +// Instruct the compiler to instantiate the template only when explicitly told to do so. +extern template class GenericConnectivityManagerImpl_Thread; + +template +inline void GenericConnectivityManagerImpl_Thread::_Init(void) +{ + mFlags = 0; +} + +template +inline bool GenericConnectivityManagerImpl_Thread::_IsThreadEnabled(void) +{ + return ThreadStackMgrImpl().IsThreadEnabled(); +} + +template +inline bool GenericConnectivityManagerImpl_Thread::_IsThreadApplicationControlled(void) +{ + return GetFlag(mFlags, kFlag_IsApplicationControlled); +} + +template +inline bool GenericConnectivityManagerImpl_Thread::_IsThreadAttached(void) +{ + return ThreadStackMgrImpl().IsThreadAttached(); +} + +template +inline bool GenericConnectivityManagerImpl_Thread::_IsThreadProvisioned(void) +{ + return ThreadStackMgrImpl().IsThreadProvisioned(); +} + +template +inline void GenericConnectivityManagerImpl_Thread::_ClearThreadProvision(void) +{ + ThreadStackMgrImpl().ClearThreadProvision(); +} + +template +inline ConnectivityManager::ThreadDeviceType GenericConnectivityManagerImpl_Thread::_GetThreadDeviceType(void) +{ + return ThreadStackMgrImpl().GetThreadDeviceType(); +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_Thread::_SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType) +{ + return ThreadStackMgrImpl().SetThreadDeviceType(deviceType); +} + +template +inline void GenericConnectivityManagerImpl_Thread::_GetThreadPollingConfig(ConnectivityManager::ThreadPollingConfig & pollingConfig) +{ + ThreadStackMgrImpl().GetThreadPollingConfig(pollingConfig); +} + +template +inline WEAVE_ERROR GenericConnectivityManagerImpl_Thread::_SetThreadPollingConfig(const ConnectivityManager::ThreadPollingConfig & pollingConfig) +{ + return ThreadStackMgrImpl().SetThreadPollingConfig(pollingConfig); +} + +template +inline bool GenericConnectivityManagerImpl_Thread::_HaveServiceConnectivityViaThread(void) +{ + return GetFlag(mFlags, kFlag_HaveServiceConnectivity); +} + +} // namespace Internal +} // namespace DeviceLayer +} // namespace Weave +} // namespace nl + +#endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_THREAD_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_Thread.ipp b/src/platform/include/internal/GenericConnectivityManagerImpl_Thread.ipp new file mode 100644 index 00000000000000..a564175577a411 --- /dev/null +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_Thread.ipp @@ -0,0 +1,154 @@ +/* + * + * Copyright (c) 2019 Nest Labs, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Provides an generic implementation of ConnectivityManager features + * for use on platforms that support Thread. + */ + +#ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_THREAD_IPP +#define GENERIC_CONNECTIVITY_MANAGER_IMPL_THREAD_IPP + +#include +#include +#include + +namespace nl { +namespace Weave { +namespace DeviceLayer { +namespace Internal { + +// Fully instantiate the generic implementation class in whatever compilation unit includes this file. +template class GenericConnectivityManagerImpl_Thread; + +template +void GenericConnectivityManagerImpl_Thread::_OnPlatformEvent(const WeaveDeviceEvent * event) +{ + // Define some short-hands for various interesting event conditions. + const bool threadConnChanged = (event->Type == DeviceEventType::kThreadConnectivityChange && + event->ThreadConnectivityChange.Result != kConnectivity_NoChange); + const bool threadAddrChanged = (event->Type == DeviceEventType::kThreadStateChange && + event->ThreadStateChange.AddressChanged); + const bool threadNetDataChanged = (event->Type == DeviceEventType::kThreadStateChange && + event->ThreadStateChange.NetDataChanged); + const bool fabricMembershipChanged = (event->Type == DeviceEventType::kFabricMembershipChange); + + // If the state of the Thread interface has changed, notify WARM accordingly. + if (threadConnChanged) + { + Warm::ThreadInterfaceStateChange(event->ThreadConnectivityChange.Result == kConnectivity_Established + ? Warm::kInterfaceStateUp : Warm::kInterfaceStateDown); + } + + // If any of the above events has occurred, assess whether there's been a change in + // service connectivity via Thread. + if (threadConnChanged || threadAddrChanged || threadNetDataChanged || fabricMembershipChanged) + { + UpdateServiceConnectivity(); + } +} + +template +ConnectivityManager::ThreadMode GenericConnectivityManagerImpl_Thread::_GetThreadMode(void) +{ + if (GetFlag(mFlags, kFlag_IsApplicationControlled)) + { + return ConnectivityManager::kThreadMode_ApplicationControlled; + } + + return ThreadStackMgrImpl().IsThreadEnabled() + ? ConnectivityManager::kThreadMode_Enabled + : ConnectivityManager::kThreadMode_Disabled; +} + +template +WEAVE_ERROR GenericConnectivityManagerImpl_Thread::_SetThreadMode(ConnectivityManager::ThreadMode val) +{ + WEAVE_ERROR err = WEAVE_NO_ERROR; + + VerifyOrExit(val == ConnectivityManager::kThreadMode_Enabled || + val == ConnectivityManager::kThreadMode_Disabled || + val == ConnectivityManager::kThreadMode_ApplicationControlled, err = WEAVE_ERROR_INVALID_ARGUMENT); + + if (val == ConnectivityManager::kThreadMode_ApplicationControlled) + { + SetFlag(mFlags, kFlag_IsApplicationControlled); + } + else + { + ClearFlag(mFlags, kFlag_IsApplicationControlled); + + err = ThreadStackMgrImpl().SetThreadEnabled(val == ConnectivityManager::kThreadMode_Enabled); + SuccessOrExit(err); + } + +exit: + return err; +} + +template +void GenericConnectivityManagerImpl_Thread::UpdateServiceConnectivity(void) +{ + bool haveServiceConnectivity = false; + + // Evaluate whether there is connectivity to the Weave service subnet via the Thread network. + // + // If the device is a member of a fabric, then service connectivity is assessed by checking if the + // local Thread stack has a route to the Weave service subnet. This route will typically be a /48 + // Weave ULA route that has been advertised by one or more Weave border router devices in the Thread + // network. If no such route exists, then it is likely that there are no functioning Weave border + // routers, and thus no route to the service via Thread. + // + // If the device is NOT a member of a fabric, then there can be no Weave service connectivity via Thread. + // + if (FabricState.FabricId != kFabricIdNotSpecified) + { + const uint64_t fabricGlobalId = WeaveFabricIdToIPv6GlobalId(FabricState.FabricId); + IPAddress serviceAddr = IPAddress::MakeULA(fabricGlobalId, nl::Weave::kWeaveSubnetId_Service, 1); + haveServiceConnectivity = ThreadStackMgr().HaveRouteToAddress(serviceAddr); + } + + // If service connectivity via Thread has changed, post an event signaling the change. + if (GetFlag(mFlags, kFlag_HaveServiceConnectivity) != haveServiceConnectivity) + { + WeaveLogProgress(DeviceLayer, "ConnectivityManager: Service connectivity via Thread %s", (haveServiceConnectivity) ? "ESTABLISHED" : "LOST"); + + SetFlag(mFlags, kFlag_HaveServiceConnectivity, haveServiceConnectivity); + + { + WeaveDeviceEvent event; + event.Clear(); + event.Type = DeviceEventType::kServiceConnectivityChange; + event.ServiceConnectivityChange.ViaThread.Result = (haveServiceConnectivity) ? kConnectivity_Established : kConnectivity_Lost; + event.ServiceConnectivityChange.ViaTunnel.Result = kConnectivity_NoChange; + event.ServiceConnectivityChange.Overall.Result = (Impl()->HaveServiceConnectivityViaTunnel()) + ? kConnectivity_NoChange + : event.ServiceConnectivityChange.ViaThread.Result; + PlatformMgr().PostEvent(&event); + } + } +} + + +} // namespace Internal +} // namespace DeviceLayer +} // namespace Weave +} // namespace nl + +#endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_THREAD_IPP From 033c41c6391d17ab7bf2ce208e64d305f72cbea1 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Fri, 13 Mar 2020 11:06:21 -0700 Subject: [PATCH 4/7] Change namespace of connection manager to CHIP --- src/platform/include/CHIPDeviceLayer.h | 18 +- .../include/ConnectivityManagerImpl.h | 47 ++--- src/platform/include/PlatformManager.h | 2 +- src/platform/include/SoftwareUpdateManager.h | 2 +- src/platform/include/internal/BLEManager.h | 191 ++++++++++++++++++ .../internal/CHIPDeviceLayerInternal.h | 2 +- .../internal/DeviceDescriptionServer.h | 27 ++- .../internal/GenericConnectivityManagerImpl.h | 11 +- .../GenericConnectivityManagerImpl_BLE.h | 31 ++- .../GenericConnectivityManagerImpl_BLE.ipp | 11 +- .../GenericConnectivityManagerImpl_NoBLE.h | 39 ++-- .../GenericConnectivityManagerImpl_NoThread.h | 27 ++- .../GenericConnectivityManagerImpl_NoTunnel.h | 15 +- .../GenericConnectivityManagerImpl_NoWiFi.h | 33 ++- .../GenericConnectivityManagerImpl_Thread.h | 23 +-- .../GenericConnectivityManagerImpl_Thread.ipp | 40 ++-- 16 files changed, 338 insertions(+), 181 deletions(-) create mode 100644 src/platform/include/internal/BLEManager.h diff --git a/src/platform/include/CHIPDeviceLayer.h b/src/platform/include/CHIPDeviceLayer.h index c17c1f7f50e5df..0385e74775c5c4 100644 --- a/src/platform/include/CHIPDeviceLayer.h +++ b/src/platform/include/CHIPDeviceLayer.h @@ -20,19 +20,19 @@ #include // #include -#include -#include -#include +#include +#include +#include #include -#include -#include -#include +#include +#include +#include #if CHIP_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER -#include +#include #endif // CHIP_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER -#include +#include #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD namespace chip { diff --git a/src/platform/include/ConnectivityManagerImpl.h b/src/platform/include/ConnectivityManagerImpl.h index d167c1173ceb0b..d1853e8289e665 100644 --- a/src/platform/include/ConnectivityManagerImpl.h +++ b/src/platform/include/ConnectivityManagerImpl.h @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2018 Nest Labs, Inc. - * All rights reserved. + * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,30 +18,29 @@ #ifndef CONNECTIVITY_MANAGER_IMPL_H #define CONNECTIVITY_MANAGER_IMPL_H -#include -#include -#if WEAVE_DEVICE_CONFIG_ENABLE_WOBLE -#include +#include +#include +#if CHIP_DEVICE_CONFIG_ENABLE_WOBLE +#include #else -#include +#include #endif -#if WEAVE_DEVICE_CONFIG_ENABLE_THREAD -#include +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD +#include #else -#include +#include #endif -#include -#include -#include +#include +#include +#include -namespace nl { +namespace chip { namespace Inet { class IPAddress; } // namespace Inet -} // namespace nl +} // namespace chip -namespace nl { -namespace Weave { +namespace chip { namespace DeviceLayer { /** @@ -51,12 +49,12 @@ namespace DeviceLayer { class ConnectivityManagerImpl final : public ConnectivityManager, public Internal::GenericConnectivityManagerImpl, -#if WEAVE_DEVICE_CONFIG_ENABLE_WOBLE +#if CHIP_DEVICE_CONFIG_ENABLE_WOBLE public Internal::GenericConnectivityManagerImpl_BLE, #else public Internal::GenericConnectivityManagerImpl_NoBLE, #endif -#if WEAVE_DEVICE_CONFIG_ENABLE_THREAD +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD public Internal::GenericConnectivityManagerImpl_Thread, #else public Internal::GenericConnectivityManagerImpl_NoThread, @@ -75,8 +73,8 @@ class ConnectivityManagerImpl final bool _HaveIPv4InternetConnectivity(void); bool _HaveIPv6InternetConnectivity(void); bool _HaveServiceConnectivity(void); - WEAVE_ERROR _Init(void); - void _OnPlatformEvent(const WeaveDeviceEvent * event); + CHIP_ERROR _Init(void); + void _OnPlatformEvent(const ChipDeviceEvent * event); // ===== Members for internal use by the following friends. @@ -105,7 +103,7 @@ inline bool ConnectivityManagerImpl::_HaveServiceConnectivity(void) /** * Returns the public interface of the ConnectivityManager singleton object. * - * Weave applications should use this to access features of the ConnectivityManager object + * chip applications should use this to access features of the ConnectivityManager object * that are common to all platforms. */ inline ConnectivityManager & ConnectivityMgr(void) @@ -116,7 +114,7 @@ inline ConnectivityManager & ConnectivityMgr(void) /** * Returns the platform-specific implementation of the ConnectivityManager singleton object. * - * Weave applications can use this to gain access to features of the ConnectivityManager + * chip applications can use this to gain access to features of the ConnectivityManager * that are specific to the ESP32 platform. */ inline ConnectivityManagerImpl & ConnectivityMgrImpl(void) @@ -125,7 +123,6 @@ inline ConnectivityManagerImpl & ConnectivityMgrImpl(void) } } // namespace DeviceLayer -} // namespace Weave -} // namespace nl +} // namespace chip #endif // CONNECTIVITY_MANAGER_IMPL_H diff --git a/src/platform/include/PlatformManager.h b/src/platform/include/PlatformManager.h index 7e1b6cac45d474..79b31800480a1e 100644 --- a/src/platform/include/PlatformManager.h +++ b/src/platform/include/PlatformManager.h @@ -23,7 +23,7 @@ #ifndef PLATFORM_MANAGER_H #define PLATFORM_MANAGER_H -#include +#include namespace chip { namespace System { diff --git a/src/platform/include/SoftwareUpdateManager.h b/src/platform/include/SoftwareUpdateManager.h index 278cdafb7597e1..a627efb4f90eb8 100644 --- a/src/platform/include/SoftwareUpdateManager.h +++ b/src/platform/include/SoftwareUpdateManager.h @@ -26,7 +26,7 @@ #if CHIP_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER #include -#include +#include namespace chip { namespace DeviceLayer { diff --git a/src/platform/include/internal/BLEManager.h b/src/platform/include/internal/BLEManager.h new file mode 100644 index 00000000000000..f1a6edb17c803f --- /dev/null +++ b/src/platform/include/internal/BLEManager.h @@ -0,0 +1,191 @@ +/* + * + * Copyright (c) 2018 Nest Labs, Inc. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Defines the abstract interface for the Device Layer's + * internal BLEManager object. + */ + +#ifndef BLE_MANAGER_H +#define BLE_MANAGER_H + +#if WEAVE_DEVICE_CONFIG_ENABLE_WOBLE + +namespace nl { +namespace Weave { +namespace DeviceLayer { +namespace Internal { + +class BLEManagerImpl; + +/** + * Provides control over WoBLE services and connectivity for a Weave device. + * + * BLEManager defines the abstract interface of a singleton object that provides + * control over WoBLE services and connectivity for a Weave device. BLEManager + * is an internal object that is used by other components with the Weave Device + * Layer, but is not directly accessible to the application. + */ +class BLEManager +{ + using ImplClass = BLEManagerImpl; + +public: + + // ===== Members that define the internal interface of the BLEManager + + using WoBLEServiceMode = ConnectivityManager::WoBLEServiceMode; + + WEAVE_ERROR Init(void); + WoBLEServiceMode GetWoBLEServiceMode(void); + WEAVE_ERROR SetWoBLEServiceMode(WoBLEServiceMode val); + bool IsAdvertisingEnabled(void); + WEAVE_ERROR SetAdvertisingEnabled(bool val); + bool IsFastAdvertisingEnabled(void); + WEAVE_ERROR SetFastAdvertisingEnabled(bool val); + bool IsAdvertising(void); + WEAVE_ERROR GetDeviceName(char * buf, size_t bufSize); + WEAVE_ERROR SetDeviceName(const char * deviceName); + uint16_t NumConnections(void); + void OnPlatformEvent(const WeaveDeviceEvent * event); + ::nl::Ble::BleLayer * GetBleLayer(void) const; + +protected: + + // Construction/destruction limited to subclasses. + BLEManager() = default; + ~BLEManager() = default; + + // No copy, move or assignment. + BLEManager(const BLEManager &) = delete; + BLEManager(const BLEManager &&) = delete; + BLEManager & operator=(const BLEManager &) = delete; +}; + +/** + * Returns a reference to the public interface of the BLEManager singleton object. + * + * Internal components should use this to access features of the BLEManager object + * that are common to all platforms. + */ +extern BLEManager & BLEMgr(void); + +/** + * Returns the platform-specific implementation of the BLEManager singleton object. + * + * Weave applications can use this to gain access to features of the BLEManager + * that are specific to the selected platform. + */ +extern BLEManagerImpl & BLEMgrImpl(void); + +} // namespace Internal +} // namespace DeviceLayer +} // namespace Weave +} // namespace nl + +/* Include a header file containing the implementation of the BLEManager + * object for the selected platform. + */ +#ifdef EXTERNAL_BLEMANAGERIMPL_HEADER +#include EXTERNAL_BLEMANAGERIMPL_HEADER +#else +#define BLEMANAGERIMPL_HEADER +#include BLEMANAGERIMPL_HEADER +#endif + +namespace nl { +namespace Weave { +namespace DeviceLayer { +namespace Internal { + +inline WEAVE_ERROR BLEManager::Init(void) +{ + return static_cast(this)->_Init(); +} + +inline BLEManager::WoBLEServiceMode BLEManager::GetWoBLEServiceMode(void) +{ + return static_cast(this)->_GetWoBLEServiceMode(); +} + +inline WEAVE_ERROR BLEManager::SetWoBLEServiceMode(WoBLEServiceMode val) +{ + return static_cast(this)->_SetWoBLEServiceMode(val); +} + +inline bool BLEManager::IsAdvertisingEnabled(void) +{ + return static_cast(this)->_IsAdvertisingEnabled(); +} + +inline WEAVE_ERROR BLEManager::SetAdvertisingEnabled(bool val) +{ + return static_cast(this)->_SetAdvertisingEnabled(val); +} + +inline bool BLEManager::IsFastAdvertisingEnabled(void) +{ + return static_cast(this)->_IsFastAdvertisingEnabled(); +} + +inline WEAVE_ERROR BLEManager::SetFastAdvertisingEnabled(bool val) +{ + return static_cast(this)->_SetFastAdvertisingEnabled(val); +} + +inline bool BLEManager::IsAdvertising(void) +{ + return static_cast(this)->_IsAdvertising(); +} + +inline WEAVE_ERROR BLEManager::GetDeviceName(char * buf, size_t bufSize) +{ + return static_cast(this)->_GetDeviceName(buf, bufSize); +} + +inline WEAVE_ERROR BLEManager::SetDeviceName(const char * deviceName) +{ + return static_cast(this)->_SetDeviceName(deviceName); +} + +inline uint16_t BLEManager::NumConnections(void) +{ + return static_cast(this)->_NumConnections(); +} + +inline void BLEManager::OnPlatformEvent(const WeaveDeviceEvent * event) +{ + static_cast(this)->_OnPlatformEvent(event); +} + +inline ::nl::Ble::BleLayer * BLEManager::GetBleLayer(void) const +{ + return static_cast(this)->_GetBleLayer(); +} + +} // namespace Internal +} // namespace DeviceLayer +} // namespace Weave +} // namespace nl + +#endif // WEAVE_DEVICE_CONFIG_ENABLE_WOBLE + +#endif // BLE_MANAGER_H + + diff --git a/src/platform/include/internal/CHIPDeviceLayerInternal.h b/src/platform/include/internal/CHIPDeviceLayerInternal.h index ca1b27fc401224..85db2c55f21aed 100644 --- a/src/platform/include/internal/CHIPDeviceLayerInternal.h +++ b/src/platform/include/internal/CHIPDeviceLayerInternal.h @@ -29,7 +29,7 @@ enum } // namespace Logging } // namespace chip -#include +#include namespace chip { namespace DeviceLayer { diff --git a/src/platform/include/internal/DeviceDescriptionServer.h b/src/platform/include/internal/DeviceDescriptionServer.h index 75906269f08a13..1f5a9ddc557692 100644 --- a/src/platform/include/internal/DeviceDescriptionServer.h +++ b/src/platform/include/internal/DeviceDescriptionServer.h @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2018 Nest Labs, Inc. - * All rights reserved. + * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,34 +23,33 @@ #ifndef DEVICE_DESCRIPTION_SERVER_H #define DEVICE_DESCRIPTION_SERVER_H -#include -#include +#include +#include -namespace nl { -namespace Weave { +namespace chip { namespace DeviceLayer { namespace Internal { /** - * Implements the Weave Device Description profile for a Weave device. + * Implements the chip Device Description profile for a chip device. */ class DeviceDescriptionServer final - : public ::nl::Weave::Profiles::DeviceDescription::DeviceDescriptionServer + : public ::chip::Profiles::DeviceDescription::DeviceDescriptionServer { - typedef ::nl::Weave::Profiles::DeviceDescription::DeviceDescriptionServer ServerBaseClass; + typedef ::chip::Profiles::DeviceDescription::DeviceDescriptionServer ServerBaseClass; public: // ===== Members for internal use by other Device Layer components. - WEAVE_ERROR Init(); + CHIP_ERROR Init(); bool IsUserSelectedModeActive(void); void SetUserSelectedMode(bool val); uint16_t GetUserSelectedModeTimeout(void); void SetUserSelectedModeTimeout(uint16_t val); - void OnPlatformEvent(const WeaveDeviceEvent * event); + void OnPlatformEvent(const ChipDeviceEvent * event); private: @@ -72,8 +70,8 @@ class DeviceDescriptionServer final uint16_t mUserSelectedModeTimeoutSec; static void HandleIdentifyRequest(void *appState, uint64_t nodeId, const IPAddress& nodeAddr, - const ::nl::Weave::Profiles::DeviceDescription::IdentifyRequestMessage& reqMsg, bool& sendResp, - ::nl::Weave::Profiles::DeviceDescription::IdentifyResponseMessage& respMsg); + const ::chip::Profiles::DeviceDescription::IdentifyRequestMessage& reqMsg, bool& sendResp, + ::chip::Profiles::DeviceDescription::IdentifyResponseMessage& respMsg); protected: @@ -97,8 +95,7 @@ inline DeviceDescriptionServer & DeviceDescriptionSvr(void) } // namespace Internal } // namespace DeviceLayer -} // namespace Weave -} // namespace nl +} // namespace chip #endif // DEVICE_DESCRIPTION_SERVER_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl.h b/src/platform/include/internal/GenericConnectivityManagerImpl.h index 5bfd9911a44508..58eead848caea5 100644 --- a/src/platform/include/internal/GenericConnectivityManagerImpl.h +++ b/src/platform/include/internal/GenericConnectivityManagerImpl.h @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2019 Nest Labs, Inc. - * All rights reserved. + * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,11 +24,10 @@ #ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_H #define GENERIC_CONNECTIVITY_MANAGER_IMPL_H -#include +#include -namespace nl { -namespace Weave { +namespace chip { namespace DeviceLayer { namespace Internal { @@ -85,7 +83,6 @@ inline void GenericConnectivityManagerImpl::_SetUserSelectedModeTimeo } // namespace Internal } // namespace DeviceLayer -} // namespace Weave -} // namespace nl +} // namespace chip #endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.h b/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.h index 9c79341245f28b..e5feeb8f4b4457 100644 --- a/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.h +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.h @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2019 Nest Labs, Inc. - * All rights reserved. + * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +24,9 @@ #ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_BLE_H #define GENERIC_CONNECTIVITY_MANAGER_IMPL_BLE_H -#include +#include -namespace nl { -namespace Weave { +namespace chip { namespace DeviceLayer { class ConnectivityManagerImpl; @@ -56,14 +54,14 @@ class GenericConnectivityManagerImpl_BLE // ===== Methods that implement the ConnectivityManager abstract interface. ConnectivityManager::WoBLEServiceMode _GetWoBLEServiceMode(void); - WEAVE_ERROR _SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val); + CHIP_ERROR _SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val); bool _IsBLEAdvertisingEnabled(void); - WEAVE_ERROR _SetBLEAdvertisingEnabled(bool val); + CHIP_ERROR _SetBLEAdvertisingEnabled(bool val); bool _IsBLEFastAdvertisingEnabled(void); - WEAVE_ERROR _SetBLEFastAdvertisingEnabled(bool val); + CHIP_ERROR _SetBLEFastAdvertisingEnabled(bool val); bool _IsBLEAdvertising(void); - WEAVE_ERROR _GetBLEDeviceName(char * buf, size_t bufSize); - WEAVE_ERROR _SetBLEDeviceName(const char * deviceName); + CHIP_ERROR _GetBLEDeviceName(char * buf, size_t bufSize); + CHIP_ERROR _SetBLEDeviceName(const char * deviceName); uint16_t _NumBLEConnections(void); static const char * _WoBLEServiceModeToStr(ConnectivityManager::WoBLEServiceMode mode); @@ -82,7 +80,7 @@ inline ConnectivityManager::WoBLEServiceMode GenericConnectivityManagerImpl_BLE< } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_BLE::_SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val) +inline CHIP_ERROR GenericConnectivityManagerImpl_BLE::_SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val) { return BLEMgr().SetWoBLEServiceMode(val); } @@ -94,7 +92,7 @@ inline bool GenericConnectivityManagerImpl_BLE::_IsBLEAdvertisingEnab } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_BLE::_SetBLEAdvertisingEnabled(bool val) +inline CHIP_ERROR GenericConnectivityManagerImpl_BLE::_SetBLEAdvertisingEnabled(bool val) { return BLEMgr().SetAdvertisingEnabled(val); } @@ -106,7 +104,7 @@ inline bool GenericConnectivityManagerImpl_BLE::_IsBLEFastAdvertising } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_BLE::_SetBLEFastAdvertisingEnabled(bool val) +inline CHIP_ERROR GenericConnectivityManagerImpl_BLE::_SetBLEFastAdvertisingEnabled(bool val) { return BLEMgr().SetFastAdvertisingEnabled(val); } @@ -118,13 +116,13 @@ inline bool GenericConnectivityManagerImpl_BLE::_IsBLEAdvertising(voi } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_BLE::_GetBLEDeviceName(char * buf, size_t bufSize) +inline CHIP_ERROR GenericConnectivityManagerImpl_BLE::_GetBLEDeviceName(char * buf, size_t bufSize) { return BLEMgr().GetDeviceName(buf, bufSize); } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_BLE::_SetBLEDeviceName(const char * deviceName) +inline CHIP_ERROR GenericConnectivityManagerImpl_BLE::_SetBLEDeviceName(const char * deviceName) { return BLEMgr().SetDeviceName(deviceName); } @@ -137,7 +135,6 @@ inline uint16_t GenericConnectivityManagerImpl_BLE::_NumBLEConnection } // namespace Internal } // namespace DeviceLayer -} // namespace Weave -} // namespace nl +} // namespace chip #endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_BLE_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.ipp b/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.ipp index a4531d98541515..10d23ba8e85cea 100644 --- a/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.ipp +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.ipp @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2019 Nest Labs, Inc. - * All rights reserved. + * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,11 +24,10 @@ #ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_BLE_IPP #define GENERIC_CONNECTIVITY_MANAGER_IMPL_BLE_IPP -#include +#include -namespace nl { -namespace Weave { +namespace chip { namespace DeviceLayer { namespace Internal { @@ -54,8 +52,7 @@ const char * GenericConnectivityManagerImpl_BLE::_WoBLEServiceModeToS } // namespace Internal } // namespace DeviceLayer -} // namespace Weave -} // namespace nl +} // namespace chip #endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_BLE_IPP diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_NoBLE.h b/src/platform/include/internal/GenericConnectivityManagerImpl_NoBLE.h index d31c7a8227b6d7..49e767450430c0 100644 --- a/src/platform/include/internal/GenericConnectivityManagerImpl_NoBLE.h +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_NoBLE.h @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2019 Nest Labs, Inc. - * All rights reserved. + * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +24,7 @@ #ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_BLE_H #define GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_BLE_H -namespace nl { -namespace Weave { +namespace chip { namespace DeviceLayer { namespace Internal { @@ -56,13 +54,13 @@ class GenericConnectivityManagerImpl_NoBLE // ===== Methods that implement the ConnectivityManager abstract interface. ConnectivityManager::WoBLEServiceMode _GetWoBLEServiceMode(void); - WEAVE_ERROR _SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val); + CHIP_ERROR _SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val); bool _IsBLEAdvertisingEnabled(void); - WEAVE_ERROR _SetBLEAdvertisingEnabled(bool val); + CHIP_ERROR _SetBLEAdvertisingEnabled(bool val); bool _IsBLEFastAdvertisingEnabled(void); - WEAVE_ERROR _SetBLEFastAdvertisingEnabled(bool val); - WEAVE_ERROR _GetBLEDeviceName(char * buf, size_t bufSize); - WEAVE_ERROR _SetBLEDeviceName(const char * deviceName); + CHIP_ERROR _SetBLEFastAdvertisingEnabled(bool val); + CHIP_ERROR _GetBLEDeviceName(char * buf, size_t bufSize); + CHIP_ERROR _SetBLEDeviceName(const char * deviceName); uint16_t _NumBLEConnections(void); static const char * _WoBLEServiceModeToStr(ConnectivityManager::WoBLEServiceMode mode); @@ -78,9 +76,9 @@ inline ConnectivityManager::WoBLEServiceMode GenericConnectivityManagerImpl_NoBL } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_NoBLE::_SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoBLE::_SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val) { - return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } template @@ -90,9 +88,9 @@ inline bool GenericConnectivityManagerImpl_NoBLE::_IsBLEAdvertisingEn } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_NoBLE::_SetBLEAdvertisingEnabled(bool val) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoBLE::_SetBLEAdvertisingEnabled(bool val) { - return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } template @@ -102,21 +100,21 @@ inline bool GenericConnectivityManagerImpl_NoBLE::_IsBLEFastAdvertisi } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_NoBLE::_SetBLEFastAdvertisingEnabled(bool val) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoBLE::_SetBLEFastAdvertisingEnabled(bool val) { - return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_NoBLE::_GetBLEDeviceName(char * buf, size_t bufSize) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoBLE::_GetBLEDeviceName(char * buf, size_t bufSize) { - return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_NoBLE::_SetBLEDeviceName(const char * deviceName) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoBLE::_SetBLEDeviceName(const char * deviceName) { - return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } template @@ -133,7 +131,6 @@ inline const char * GenericConnectivityManagerImpl_NoBLE::_WoBLEServi } // namespace Internal } // namespace DeviceLayer -} // namespace Weave -} // namespace nl +} // namespace chip #endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_BLE_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_NoThread.h b/src/platform/include/internal/GenericConnectivityManagerImpl_NoThread.h index 96b550a7a03dce..8ab15873b4170f 100644 --- a/src/platform/include/internal/GenericConnectivityManagerImpl_NoThread.h +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_NoThread.h @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2019 Nest Labs, Inc. - * All rights reserved. + * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +24,7 @@ #ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_THREAD_H #define GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_THREAD_H -namespace nl { -namespace Weave { +namespace chip { namespace DeviceLayer { namespace Internal { @@ -46,13 +44,13 @@ class GenericConnectivityManagerImpl_NoThread // ===== Methods that implement the ConnectivityManager abstract interface. ConnectivityManager::ThreadMode _GetThreadMode(void); - WEAVE_ERROR _SetThreadMode(ConnectivityManager::ThreadMode val); + CHIP_ERROR _SetThreadMode(ConnectivityManager::ThreadMode val); bool _IsThreadEnabled(void); bool _IsThreadApplicationControlled(void); ConnectivityManager::ThreadDeviceType _GetThreadDeviceType(void); - WEAVE_ERROR _SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType); + CHIP_ERROR _SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType); void _GetThreadPollingConfig(ConnectivityManager::ThreadPollingConfig & pollingConfig); - WEAVE_ERROR _SetThreadPollingConfig(const ConnectivityManager::ThreadPollingConfig & pollingConfig); + CHIP_ERROR _SetThreadPollingConfig(const ConnectivityManager::ThreadPollingConfig & pollingConfig); bool _IsThreadAttached(void); bool _IsThreadProvisioned(void); void _ClearThreadProvision(void); @@ -68,9 +66,9 @@ inline ConnectivityManager::ThreadMode GenericConnectivityManagerImpl_NoThread -inline WEAVE_ERROR GenericConnectivityManagerImpl_NoThread::_SetThreadMode(ConnectivityManager::ThreadMode val) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoThread::_SetThreadMode(ConnectivityManager::ThreadMode val) { - return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } template @@ -109,9 +107,9 @@ inline ConnectivityManager::ThreadDeviceType GenericConnectivityManagerImpl_NoTh } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_NoThread::_SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoThread::_SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType) { - return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } template @@ -121,9 +119,9 @@ inline void GenericConnectivityManagerImpl_NoThread::_GetThreadPollin } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_NoThread::_SetThreadPollingConfig(const ConnectivityManager::ThreadPollingConfig & pollingConfig) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoThread::_SetThreadPollingConfig(const ConnectivityManager::ThreadPollingConfig & pollingConfig) { - return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } template @@ -134,7 +132,6 @@ inline bool GenericConnectivityManagerImpl_NoThread::_HaveServiceConn } // namespace Internal } // namespace DeviceLayer -} // namespace Weave -} // namespace nl +} // namespace chip #endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_THREAD_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_NoTunnel.h b/src/platform/include/internal/GenericConnectivityManagerImpl_NoTunnel.h index 7ca8ca2fcd9ebd..213d65147b2f97 100644 --- a/src/platform/include/internal/GenericConnectivityManagerImpl_NoTunnel.h +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_NoTunnel.h @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2019 Nest Labs, Inc. - * All rights reserved. + * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +24,7 @@ #ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_TUNNEL_H #define GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_TUNNEL_H -namespace nl { -namespace Weave { +namespace chip { namespace DeviceLayer { namespace Internal { @@ -56,7 +54,7 @@ class GenericConnectivityManagerImpl_NoTunnel // ===== Methods that implement the ConnectivityManager abstract interface. ConnectivityManager::ServiceTunnelMode _GetServiceTunnelMode(void); - WEAVE_ERROR _SetServiceTunnelMode(ConnectivityManager::ServiceTunnelMode val); + CHIP_ERROR _SetServiceTunnelMode(ConnectivityManager::ServiceTunnelMode val); bool _IsServiceTunnelConnected(void); bool _IsServiceTunnelRestricted(void); bool _HaveServiceConnectivityViaTunnel(void); @@ -74,9 +72,9 @@ inline ConnectivityManager::ServiceTunnelMode GenericConnectivityManagerImpl_NoT } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_NoTunnel::_SetServiceTunnelMode(ConnectivityManager::ServiceTunnelMode val) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoTunnel::_SetServiceTunnelMode(ConnectivityManager::ServiceTunnelMode val) { - return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } template @@ -106,7 +104,6 @@ inline const char * GenericConnectivityManagerImpl_NoTunnel::_Service } // namespace Internal } // namespace DeviceLayer -} // namespace Weave -} // namespace nl +} // namespace chip #endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_TUNNEL_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_NoWiFi.h b/src/platform/include/internal/GenericConnectivityManagerImpl_NoWiFi.h index cd9c3b897c442c..d3abe5dc564248 100644 --- a/src/platform/include/internal/GenericConnectivityManagerImpl_NoWiFi.h +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_NoWiFi.h @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2019 Nest Labs, Inc. - * All rights reserved. + * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +24,7 @@ #ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_WIFI_H #define GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_WIFI_H -namespace nl { -namespace Weave { +namespace chip { namespace DeviceLayer { namespace Internal { @@ -56,16 +54,16 @@ class GenericConnectivityManagerImpl_NoWiFi // ===== Methods that implement the ConnectivityManager abstract interface. ConnectivityManager::WiFiStationMode _GetWiFiStationMode(void); - WEAVE_ERROR _SetWiFiStationMode(ConnectivityManager::WiFiStationMode val); + CHIP_ERROR _SetWiFiStationMode(ConnectivityManager::WiFiStationMode val); bool _IsWiFiStationEnabled(void); bool _IsWiFiStationApplicationControlled(void); bool _IsWiFiStationConnected(void); uint32_t _GetWiFiStationReconnectIntervalMS(void); - WEAVE_ERROR _SetWiFiStationReconnectIntervalMS(uint32_t val); + CHIP_ERROR _SetWiFiStationReconnectIntervalMS(uint32_t val); bool _IsWiFiStationProvisioned(void); void _ClearWiFiStationProvision(void); ConnectivityManager::WiFiAPMode _GetWiFiAPMode(void); - WEAVE_ERROR _SetWiFiAPMode(ConnectivityManager::WiFiAPMode val); + CHIP_ERROR _SetWiFiAPMode(ConnectivityManager::WiFiAPMode val); bool _IsWiFiAPActive(void); bool _IsWiFiAPApplicationControlled(void); void _DemandStartWiFiAP(void); @@ -73,7 +71,7 @@ class GenericConnectivityManagerImpl_NoWiFi void _MaintainOnDemandWiFiAP(void); uint32_t _GetWiFiAPIdleTimeoutMS(void); void _SetWiFiAPIdleTimeoutMS(uint32_t val); - WEAVE_ERROR _GetAndLogWifiStatsCounters(void); + CHIP_ERROR _GetAndLogWifiStatsCounters(void); bool _CanStartWiFiScan(); void _OnWiFiScanDone(); void _OnWiFiStationProvisionChange(); @@ -92,9 +90,9 @@ inline ConnectivityManager::WiFiStationMode GenericConnectivityManagerImpl_NoWiF } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_NoWiFi::_SetWiFiStationMode(ConnectivityManager::WiFiStationMode val) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoWiFi::_SetWiFiStationMode(ConnectivityManager::WiFiStationMode val) { - return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } template @@ -116,9 +114,9 @@ inline uint32_t GenericConnectivityManagerImpl_NoWiFi::_GetWiFiStatio } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_NoWiFi::_SetWiFiStationReconnectIntervalMS(uint32_t val) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoWiFi::_SetWiFiStationReconnectIntervalMS(uint32_t val) { - return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } template @@ -139,9 +137,9 @@ inline ConnectivityManager::WiFiAPMode GenericConnectivityManagerImpl_NoWiFi -inline WEAVE_ERROR GenericConnectivityManagerImpl_NoWiFi::_SetWiFiAPMode(ConnectivityManager::WiFiAPMode val) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoWiFi::_SetWiFiAPMode(ConnectivityManager::WiFiAPMode val) { - return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } template @@ -183,9 +181,9 @@ inline void GenericConnectivityManagerImpl_NoWiFi::_SetWiFiAPIdleTime } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_NoWiFi::_GetAndLogWifiStatsCounters(void) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoWiFi::_GetAndLogWifiStatsCounters(void) { - return WEAVE_ERROR_UNSUPPORTED_WEAVE_FEATURE; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } template @@ -219,7 +217,6 @@ inline const char * GenericConnectivityManagerImpl_NoWiFi::_WiFiAPMod } // namespace Internal } // namespace DeviceLayer -} // namespace Weave -} // namespace nl +} // namespace chip #endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_NO_WIFI_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_Thread.h b/src/platform/include/internal/GenericConnectivityManagerImpl_Thread.h index d003cb04e08e56..1874b75fead1ff 100644 --- a/src/platform/include/internal/GenericConnectivityManagerImpl_Thread.h +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_Thread.h @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2019 Nest Labs, Inc. - * All rights reserved. + * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +24,9 @@ #ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_THREAD_H #define GENERIC_CONNECTIVITY_MANAGER_IMPL_THREAD_H -#include +#include -namespace nl { -namespace Weave { +namespace chip { namespace DeviceLayer { class ConnectivityManagerImpl; @@ -55,15 +53,15 @@ class GenericConnectivityManagerImpl_Thread // ===== Methods that implement the ConnectivityManager abstract interface. void _Init(void); - void _OnPlatformEvent(const WeaveDeviceEvent * event); + void _OnPlatformEvent(const ChipDeviceEvent * event); ConnectivityManager::ThreadMode _GetThreadMode(void); - WEAVE_ERROR _SetThreadMode(ConnectivityManager::ThreadMode val); + CHIP_ERROR _SetThreadMode(ConnectivityManager::ThreadMode val); bool _IsThreadEnabled(void); bool _IsThreadApplicationControlled(void); ConnectivityManager::ThreadDeviceType _GetThreadDeviceType(void); - WEAVE_ERROR _SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType); + CHIP_ERROR _SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType); void _GetThreadPollingConfig(ConnectivityManager::ThreadPollingConfig & pollingConfig); - WEAVE_ERROR _SetThreadPollingConfig(const ConnectivityManager::ThreadPollingConfig & pollingConfig); + CHIP_ERROR _SetThreadPollingConfig(const ConnectivityManager::ThreadPollingConfig & pollingConfig); bool _IsThreadAttached(void); bool _IsThreadProvisioned(void); void _ClearThreadProvision(void); @@ -134,7 +132,7 @@ inline ConnectivityManager::ThreadDeviceType GenericConnectivityManagerImpl_Thre } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_Thread::_SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType) +inline CHIP_ERROR GenericConnectivityManagerImpl_Thread::_SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType) { return ThreadStackMgrImpl().SetThreadDeviceType(deviceType); } @@ -146,7 +144,7 @@ inline void GenericConnectivityManagerImpl_Thread::_GetThreadPollingC } template -inline WEAVE_ERROR GenericConnectivityManagerImpl_Thread::_SetThreadPollingConfig(const ConnectivityManager::ThreadPollingConfig & pollingConfig) +inline CHIP_ERROR GenericConnectivityManagerImpl_Thread::_SetThreadPollingConfig(const ConnectivityManager::ThreadPollingConfig & pollingConfig) { return ThreadStackMgrImpl().SetThreadPollingConfig(pollingConfig); } @@ -159,7 +157,6 @@ inline bool GenericConnectivityManagerImpl_Thread::_HaveServiceConnec } // namespace Internal } // namespace DeviceLayer -} // namespace Weave -} // namespace nl +} // namespace chip #endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_THREAD_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_Thread.ipp b/src/platform/include/internal/GenericConnectivityManagerImpl_Thread.ipp index a564175577a411..457f9c6359a540 100644 --- a/src/platform/include/internal/GenericConnectivityManagerImpl_Thread.ipp +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_Thread.ipp @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2019 Nest Labs, Inc. - * All rights reserved. + * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,12 +24,10 @@ #ifndef GENERIC_CONNECTIVITY_MANAGER_IMPL_THREAD_IPP #define GENERIC_CONNECTIVITY_MANAGER_IMPL_THREAD_IPP -#include -#include -#include +#include +#include -namespace nl { -namespace Weave { +namespace chip { namespace DeviceLayer { namespace Internal { @@ -38,7 +35,7 @@ namespace Internal { template class GenericConnectivityManagerImpl_Thread; template -void GenericConnectivityManagerImpl_Thread::_OnPlatformEvent(const WeaveDeviceEvent * event) +void GenericConnectivityManagerImpl_Thread::_OnPlatformEvent(const ChipDeviceEvent * event) { // Define some short-hands for various interesting event conditions. const bool threadConnChanged = (event->Type == DeviceEventType::kThreadConnectivityChange && @@ -78,13 +75,13 @@ ConnectivityManager::ThreadMode GenericConnectivityManagerImpl_Thread } template -WEAVE_ERROR GenericConnectivityManagerImpl_Thread::_SetThreadMode(ConnectivityManager::ThreadMode val) +CHIP_ERROR GenericConnectivityManagerImpl_Thread::_SetThreadMode(ConnectivityManager::ThreadMode val) { - WEAVE_ERROR err = WEAVE_NO_ERROR; + CHIP_ERROR err = CHIP_NO_ERROR; VerifyOrExit(val == ConnectivityManager::kThreadMode_Enabled || val == ConnectivityManager::kThreadMode_Disabled || - val == ConnectivityManager::kThreadMode_ApplicationControlled, err = WEAVE_ERROR_INVALID_ARGUMENT); + val == ConnectivityManager::kThreadMode_ApplicationControlled, err = CHIP_ERROR_INVALID_ARGUMENT); if (val == ConnectivityManager::kThreadMode_ApplicationControlled) { @@ -107,32 +104,32 @@ void GenericConnectivityManagerImpl_Thread::UpdateServiceConnectivity { bool haveServiceConnectivity = false; - // Evaluate whether there is connectivity to the Weave service subnet via the Thread network. + // Evaluate whether there is connectivity to the chip service subnet via the Thread network. // // If the device is a member of a fabric, then service connectivity is assessed by checking if the - // local Thread stack has a route to the Weave service subnet. This route will typically be a /48 - // Weave ULA route that has been advertised by one or more Weave border router devices in the Thread - // network. If no such route exists, then it is likely that there are no functioning Weave border + // local Thread stack has a route to the chip service subnet. This route will typically be a /48 + // chip ULA route that has been advertised by one or more chip border router devices in the Thread + // network. If no such route exists, then it is likely that there are no functioning chip border // routers, and thus no route to the service via Thread. // - // If the device is NOT a member of a fabric, then there can be no Weave service connectivity via Thread. + // If the device is NOT a member of a fabric, then there can be no chip service connectivity via Thread. // if (FabricState.FabricId != kFabricIdNotSpecified) { - const uint64_t fabricGlobalId = WeaveFabricIdToIPv6GlobalId(FabricState.FabricId); - IPAddress serviceAddr = IPAddress::MakeULA(fabricGlobalId, nl::Weave::kWeaveSubnetId_Service, 1); + const uint64_t fabricGlobalId = ChipFabricIdToIPv6GlobalId(FabricState.FabricId); + IPAddress serviceAddr = IPAddress::MakeULA(fabricGlobalId, nl::chip::kChipSubnetId_Service, 1); haveServiceConnectivity = ThreadStackMgr().HaveRouteToAddress(serviceAddr); } // If service connectivity via Thread has changed, post an event signaling the change. if (GetFlag(mFlags, kFlag_HaveServiceConnectivity) != haveServiceConnectivity) { - WeaveLogProgress(DeviceLayer, "ConnectivityManager: Service connectivity via Thread %s", (haveServiceConnectivity) ? "ESTABLISHED" : "LOST"); + ChipLogProgress(DeviceLayer, "ConnectivityManager: Service connectivity via Thread %s", (haveServiceConnectivity) ? "ESTABLISHED" : "LOST"); SetFlag(mFlags, kFlag_HaveServiceConnectivity, haveServiceConnectivity); { - WeaveDeviceEvent event; + ChipDeviceEvent event; event.Clear(); event.Type = DeviceEventType::kServiceConnectivityChange; event.ServiceConnectivityChange.ViaThread.Result = (haveServiceConnectivity) ? kConnectivity_Established : kConnectivity_Lost; @@ -148,7 +145,6 @@ void GenericConnectivityManagerImpl_Thread::UpdateServiceConnectivity } // namespace Internal } // namespace DeviceLayer -} // namespace Weave -} // namespace nl +} // namespace chip #endif // GENERIC_CONNECTIVITY_MANAGER_IMPL_THREAD_IPP From e2563926ab51c75418aff91710b07c9df64f9f2f Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Fri, 13 Mar 2020 11:10:10 -0700 Subject: [PATCH 5/7] Update namespace for BLE manager --- src/platform/include/internal/BLEManager.h | 61 ++++++++++------------ 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/src/platform/include/internal/BLEManager.h b/src/platform/include/internal/BLEManager.h index f1a6edb17c803f..54cdf1f44335fa 100644 --- a/src/platform/include/internal/BLEManager.h +++ b/src/platform/include/internal/BLEManager.h @@ -1,7 +1,6 @@ /* * - * Copyright (c) 2018 Nest Labs, Inc. - * All rights reserved. + * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,21 +24,20 @@ #ifndef BLE_MANAGER_H #define BLE_MANAGER_H -#if WEAVE_DEVICE_CONFIG_ENABLE_WOBLE +#if CHIP_DEVICE_CONFIG_ENABLE_WOBLE -namespace nl { -namespace Weave { +namespace chip { namespace DeviceLayer { namespace Internal { class BLEManagerImpl; /** - * Provides control over WoBLE services and connectivity for a Weave device. + * Provides control over WoBLE services and connectivity for a chip device. * * BLEManager defines the abstract interface of a singleton object that provides - * control over WoBLE services and connectivity for a Weave device. BLEManager - * is an internal object that is used by other components with the Weave Device + * control over WoBLE services and connectivity for a chip device. BLEManager + * is an internal object that is used by other components with the chip Device * Layer, but is not directly accessible to the application. */ class BLEManager @@ -52,19 +50,19 @@ class BLEManager using WoBLEServiceMode = ConnectivityManager::WoBLEServiceMode; - WEAVE_ERROR Init(void); + CHIP_ERROR Init(void); WoBLEServiceMode GetWoBLEServiceMode(void); - WEAVE_ERROR SetWoBLEServiceMode(WoBLEServiceMode val); + CHIP_ERROR SetWoBLEServiceMode(WoBLEServiceMode val); bool IsAdvertisingEnabled(void); - WEAVE_ERROR SetAdvertisingEnabled(bool val); + CHIP_ERROR SetAdvertisingEnabled(bool val); bool IsFastAdvertisingEnabled(void); - WEAVE_ERROR SetFastAdvertisingEnabled(bool val); + CHIP_ERROR SetFastAdvertisingEnabled(bool val); bool IsAdvertising(void); - WEAVE_ERROR GetDeviceName(char * buf, size_t bufSize); - WEAVE_ERROR SetDeviceName(const char * deviceName); + CHIP_ERROR GetDeviceName(char * buf, size_t bufSize); + CHIP_ERROR SetDeviceName(const char * deviceName); uint16_t NumConnections(void); - void OnPlatformEvent(const WeaveDeviceEvent * event); - ::nl::Ble::BleLayer * GetBleLayer(void) const; + void OnPlatformEvent(const chipDeviceEvent * event); + ::Ble::BleLayer * GetBleLayer(void) const; protected: @@ -89,15 +87,14 @@ extern BLEManager & BLEMgr(void); /** * Returns the platform-specific implementation of the BLEManager singleton object. * - * Weave applications can use this to gain access to features of the BLEManager + * chip applications can use this to gain access to features of the BLEManager * that are specific to the selected platform. */ extern BLEManagerImpl & BLEMgrImpl(void); } // namespace Internal } // namespace DeviceLayer -} // namespace Weave -} // namespace nl +} // namespace chip /* Include a header file containing the implementation of the BLEManager * object for the selected platform. @@ -105,16 +102,15 @@ extern BLEManagerImpl & BLEMgrImpl(void); #ifdef EXTERNAL_BLEMANAGERIMPL_HEADER #include EXTERNAL_BLEMANAGERIMPL_HEADER #else -#define BLEMANAGERIMPL_HEADER +#define BLEMANAGERIMPL_HEADER #include BLEMANAGERIMPL_HEADER #endif -namespace nl { -namespace Weave { +namespace chip { namespace DeviceLayer { namespace Internal { -inline WEAVE_ERROR BLEManager::Init(void) +inline CHIP_ERROR BLEManager::Init(void) { return static_cast(this)->_Init(); } @@ -124,7 +120,7 @@ inline BLEManager::WoBLEServiceMode BLEManager::GetWoBLEServiceMode(void) return static_cast(this)->_GetWoBLEServiceMode(); } -inline WEAVE_ERROR BLEManager::SetWoBLEServiceMode(WoBLEServiceMode val) +inline CHIP_ERROR BLEManager::SetWoBLEServiceMode(WoBLEServiceMode val) { return static_cast(this)->_SetWoBLEServiceMode(val); } @@ -134,7 +130,7 @@ inline bool BLEManager::IsAdvertisingEnabled(void) return static_cast(this)->_IsAdvertisingEnabled(); } -inline WEAVE_ERROR BLEManager::SetAdvertisingEnabled(bool val) +inline CHIP_ERROR BLEManager::SetAdvertisingEnabled(bool val) { return static_cast(this)->_SetAdvertisingEnabled(val); } @@ -144,7 +140,7 @@ inline bool BLEManager::IsFastAdvertisingEnabled(void) return static_cast(this)->_IsFastAdvertisingEnabled(); } -inline WEAVE_ERROR BLEManager::SetFastAdvertisingEnabled(bool val) +inline CHIP_ERROR BLEManager::SetFastAdvertisingEnabled(bool val) { return static_cast(this)->_SetFastAdvertisingEnabled(val); } @@ -154,12 +150,12 @@ inline bool BLEManager::IsAdvertising(void) return static_cast(this)->_IsAdvertising(); } -inline WEAVE_ERROR BLEManager::GetDeviceName(char * buf, size_t bufSize) +inline CHIP_ERROR BLEManager::GetDeviceName(char * buf, size_t bufSize) { return static_cast(this)->_GetDeviceName(buf, bufSize); } -inline WEAVE_ERROR BLEManager::SetDeviceName(const char * deviceName) +inline CHIP_ERROR BLEManager::SetDeviceName(const char * deviceName) { return static_cast(this)->_SetDeviceName(deviceName); } @@ -169,22 +165,21 @@ inline uint16_t BLEManager::NumConnections(void) return static_cast(this)->_NumConnections(); } -inline void BLEManager::OnPlatformEvent(const WeaveDeviceEvent * event) +inline void BLEManager::OnPlatformEvent(const chipDeviceEvent * event) { static_cast(this)->_OnPlatformEvent(event); } -inline ::nl::Ble::BleLayer * BLEManager::GetBleLayer(void) const +inline ::Ble::BleLayer * BLEManager::GetBleLayer(void) const { return static_cast(this)->_GetBleLayer(); } } // namespace Internal } // namespace DeviceLayer -} // namespace Weave -} // namespace nl +} // namespace chip -#endif // WEAVE_DEVICE_CONFIG_ENABLE_WOBLE +#endif // CHIP_DEVICE_CONFIG_ENABLE_WOBLE #endif // BLE_MANAGER_H From 484ffbcf6e1aed15f04c80eccd982896a0a82dfe Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Fri, 13 Mar 2020 11:18:39 -0700 Subject: [PATCH 6/7] Fix camel casing in BLEManager --- src/platform/include/internal/BLEManager.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform/include/internal/BLEManager.h b/src/platform/include/internal/BLEManager.h index 54cdf1f44335fa..38e4b9e944bae1 100644 --- a/src/platform/include/internal/BLEManager.h +++ b/src/platform/include/internal/BLEManager.h @@ -61,7 +61,7 @@ class BLEManager CHIP_ERROR GetDeviceName(char * buf, size_t bufSize); CHIP_ERROR SetDeviceName(const char * deviceName); uint16_t NumConnections(void); - void OnPlatformEvent(const chipDeviceEvent * event); + void OnPlatformEvent(const ChipDeviceEvent * event); ::Ble::BleLayer * GetBleLayer(void) const; protected: @@ -165,7 +165,7 @@ inline uint16_t BLEManager::NumConnections(void) return static_cast(this)->_NumConnections(); } -inline void BLEManager::OnPlatformEvent(const chipDeviceEvent * event) +inline void BLEManager::OnPlatformEvent(const ChipDeviceEvent * event) { static_cast(this)->_OnPlatformEvent(event); } From 4cf23e94fa86fc1464976b75865231ce9f04d473 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Fri, 13 Mar 2020 11:58:13 -0700 Subject: [PATCH 7/7] Replace WoBle with CHIPoBle --- src/ble/BLEEndPoint.cpp | 174 +++++++++--------- src/ble/BLEEndPoint.h | 34 ++-- src/ble/Ble.h | 2 +- src/ble/BleError.cpp | 2 +- src/ble/BleError.h | 4 +- src/ble/BleLayer.cpp | 4 +- src/ble/BleLayer.h | 12 +- src/ble/{WoBle.cpp => CHIPoBle.cpp} | 72 ++++---- src/ble/{WoBle.h => CHIPoBle.h} | 30 +-- src/ble/Makefile | 2 +- src/include/BuildConfig.h | 6 +- src/lib/support/CHIPFaultInjection.cpp | 2 +- src/lib/support/CHIPFaultInjection.h | 2 +- src/platform/include/CHIPDeviceConfig.h | 30 +-- src/platform/include/CHIPDeviceEvent.h | 34 ++-- src/platform/include/CHIPDeviceLayer.h | 7 - src/platform/include/ConnectivityManager.h | 28 +-- .../include/ConnectivityManagerImpl.h | 4 +- src/platform/include/ThreadStackManager.h | 12 +- src/platform/include/internal/BLEManager.h | 22 +-- .../GenericConnectivityManagerImpl_BLE.h | 14 +- .../GenericConnectivityManagerImpl_BLE.ipp | 8 +- .../GenericConnectivityManagerImpl_NoBLE.h | 18 +- .../GenericConnectivityManagerImpl_NoTunnel.h | 2 +- 24 files changed, 259 insertions(+), 266 deletions(-) rename src/ble/{WoBle.cpp => CHIPoBle.cpp} (89%) rename src/ble/{WoBle.h => CHIPoBle.h} (92%) diff --git a/src/ble/BLEEndPoint.cpp b/src/ble/BLEEndPoint.cpp index eb55924a5c854f..d948d2f0d25aa7 100644 --- a/src/ble/BLEEndPoint.cpp +++ b/src/ble/BLEEndPoint.cpp @@ -19,7 +19,7 @@ * @file * This file implements a Bluetooth Low Energy (BLE) connection * endpoint abstraction for the byte-streaming, - * connection-oriented chip over Bluetooth Low Energy (WoBLE) + * connection-oriented chip over Bluetooth Low Energy (CHIPoBLE) * Bluetooth Transport Protocol (BTP). * */ @@ -41,9 +41,9 @@ #include #include -#include -#if CHIP_ENABLE_WOBLE_TEST -#include "WoBleTest.h" +#include +#if CHIP_ENABLE_CHIPOBLE_TEST +#include "CHIPoBleTest.h" #endif // clang-format off @@ -221,8 +221,8 @@ void BLEEndPoint::HandleSubscribeReceived() VerifyOrExit(mSendQueue != NULL, err = BLE_ERROR_INCORRECT_STATE); // Send BTP capabilities response to peripheral via GATT indication. -#if CHIP_ENABLE_WOBLE_TEST - VerifyOrExit(mWoBle.PopPacketTag(mSendQueue) == kType_Data, err = BLE_ERROR_INVALID_BTP_HEADER_FLAGS); +#if CHIP_ENABLE_CHIPOBLE_TEST + VerifyOrExit(mCHIPoBle.PopPacketTag(mSendQueue) == kType_Data, err = BLE_ERROR_INVALID_BTP_HEADER_FLAGS); #endif if (!SendIndication(mSendQueue)) { @@ -306,7 +306,7 @@ void BLEEndPoint::Abort() OnConnectComplete = NULL; OnConnectionClosed = NULL; OnMessageReceived = NULL; -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST OnCommandReceived = NULL; #endif @@ -319,7 +319,7 @@ void BLEEndPoint::Close() OnConnectComplete = NULL; OnConnectionClosed = NULL; OnMessageReceived = NULL; -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST OnCommandReceived = NULL; #endif @@ -346,7 +346,7 @@ void BLEEndPoint::DoClose(uint8_t flags, BLE_ERROR err) } // If transmit buffer is empty or a transmission abort was specified... - if (mWoBle.TxState() == WoBle::kState_Idle || (flags & kBleCloseFlag_AbortTransmission)) + if (mCHIPoBle.TxState() == CHIPoBle::kState_Idle || (flags & kBleCloseFlag_AbortTransmission)) { FinalizeClose(oldState, flags, err); } @@ -354,8 +354,8 @@ void BLEEndPoint::DoClose(uint8_t flags, BLE_ERROR err) { // Wait for send queue and fragmenter's tx buffer to become empty, to ensure all pending messages have been // sent. Only free end point and tell platform it can throw away the underlying BLE connection once all - // pending messages have been sent and acknowledged by the remote WoBLE stack, or once the remote stack - // closes the WoBLE connection. + // pending messages have been sent and acknowledged by the remote CHIPoBLE stack, or once the remote stack + // closes the CHIPoBLE connection. // // In so doing, BLEEndPoint attempts to emulate the level of reliability afforded by TCPEndPoint and TCP // sockets in general with a typical default SO_LINGER option. That said, there is no hard guarantee that @@ -381,9 +381,9 @@ void BLEEndPoint::FinalizeClose(uint8_t oldState, uint8_t flags, BLE_ERROR err) mSendQueue = NULL; QueueTxUnlock(); -#if CHIP_ENABLE_WOBLE_TEST - PacketBuffer::Free(mWoBleTest.mCommandReceiveQueue); - mWoBleTest.mCommandReceiveQueue = NULL; +#if CHIP_ENABLE_CHIPOBLE_TEST + PacketBuffer::Free(mCHIPoBleTest.mCommandReceiveQueue); + mCHIPoBleTest.mCommandReceiveQueue = NULL; #endif // Fire application's close callback if we haven't already, and it's not suppressed. @@ -411,7 +411,7 @@ void BLEEndPoint::FinalizeClose(uint8_t oldState, uint8_t flags, BLE_ERROR err) // we're really sure the unsubscribe request has been sent. if (!mBle->mPlatformDelegate->UnsubscribeCharacteristic(mConnObj, &CHIP_BLE_SVC_ID, &mBle->CHIP_BLE_CHAR_2_ID)) { - chipLogError(Ble, "WoBle unsub failed"); + chipLogError(Ble, "CHIPoBle unsub failed"); // If unsubscribe fails, release BLE connection and free end point immediately. Free(); @@ -488,7 +488,7 @@ void BLEEndPoint::Free() ReleaseBleConnection(); // Clear fragmentation and reassembly engine's Tx and Rx buffers. Counters will be reset by next engine init. - FreeWoBle(); + FreeCHIPoBle(); // Clear pending ack buffer, if any. PacketBuffer::Free(mAckToSend); @@ -499,8 +499,8 @@ void BLEEndPoint::Free() StopAckReceivedTimer(); StopSendAckTimer(); StopUnsubscribeTimer(); -#if CHIP_ENABLE_WOBLE_TEST - mWoBleTest.StopTestTimer(); +#if CHIP_ENABLE_CHIPOBLE_TEST + mCHIPoBleTest.StopTestTimer(); // Clear callback OnCommandReceived = NULL; #endif @@ -517,18 +517,18 @@ void BLEEndPoint::Free() Release(); } -void BLEEndPoint::FreeWoBle() +void BLEEndPoint::FreeCHIPoBle() { PacketBuffer * buf; // Free transmit disassembly buffer - buf = mWoBle.TxPacket(); - mWoBle.ClearTxPacket(); + buf = mCHIPoBle.TxPacket(); + mCHIPoBle.ClearTxPacket(); PacketBuffer::Free(buf); // Free receive reassembly buffer - buf = mWoBle.RxPacket(); - mWoBle.ClearRxPacket(); + buf = mCHIPoBle.RxPacket(); + mCHIPoBle.ClearRxPacket(); PacketBuffer::Free(buf); } @@ -555,24 +555,24 @@ BLE_ERROR BLEEndPoint::Init(BleLayer * bleLayer, BLE_CONNECTION_OBJECT connObj, // If central, periperal's handshake indication 'ack's write sent by central to kick off the BTP handshake. expectInitialAck = (role == kBleRole_Peripheral); - err = mWoBle.Init(this, expectInitialAck); + err = mCHIPoBle.Init(this, expectInitialAck); if (err != BLE_NO_ERROR) { - chipLogError(Ble, "WoBle init failed"); + chipLogError(Ble, "CHIPoBle init failed"); ExitNow(); } -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST err = (BLE_ERROR) mTxQueueMutex.Init(mTxQueueMutex); if (err != BLE_NO_ERROR) { chipLogError(Ble, "%s: Mutex init failed", __FUNCTION__); ExitNow(); } - err = mWoBleTest.Init(this); + err = mCHIPoBleTest.Init(this); if (err != BLE_NO_ERROR) { - chipLogError(Ble, "WoBleTest init failed"); + chipLogError(Ble, "CHIPoBleTest init failed"); ExitNow(); } #endif @@ -643,9 +643,9 @@ BLE_ERROR BLEEndPoint::SendCharacteristic(PacketBuffer * buf) */ void BLEEndPoint::QueueTx(PacketBuffer * data, PacketType_t type) { -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST chipLogDebugBleEndPoint(Ble, "%s: data->%p, type %d, len %d", __FUNCTION__, data, type, data->DataLength()); - mWoBle.PushPacketTag(data, type); + mCHIPoBle.PushPacketTag(data, type); #endif QueueTxLock(); @@ -728,7 +728,7 @@ bool BLEEndPoint::PrepareNextFragment(PacketBuffer * data, bool & sentAck) sentAck = false; } - return mWoBle.HandleCharacteristicSend(data, sentAck); + return mCHIPoBle.HandleCharacteristicSend(data, sentAck); } BLE_ERROR BLEEndPoint::SendNextMessage() @@ -738,7 +738,7 @@ BLE_ERROR BLEEndPoint::SendNextMessage() // Get the first queued packet to send QueueTxLock(); -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST // Return if tx queue is empty // Note: DetachTail() does not check an empty queue if (mSendQueue == NULL) @@ -752,19 +752,19 @@ BLE_ERROR BLEEndPoint::SendNextMessage() mSendQueue = mSendQueue->DetachTail(); QueueTxUnlock(); -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST // Get and consume the packet tag in message buffer - PacketType_t type = mWoBle.PopPacketTag(data); - mWoBle.SetTxPacketType(type); - mWoBleTest.DoTxTiming(data, WOBLE_TX_START); + PacketType_t type = mCHIPoBle.PopPacketTag(data); + mCHIPoBle.SetTxPacketType(type); + mCHIPoBleTest.DoTxTiming(data, CHIPOBLE_TX_START); #endif // Hand whole message payload to the fragmenter. - VerifyOrExit(PrepareNextFragment(data, sentAck), err = BLE_ERROR_WOBLE_PROTOCOL_ABORT); + VerifyOrExit(PrepareNextFragment(data, sentAck), err = BLE_ERROR_CHIPOBLE_PROTOCOL_ABORT); data = NULL; // Ownership passed to fragmenter's tx buf on PrepareNextFragment success. // Send first message fragment over the air. - CHIP_FAULT_INJECT(chip::FaultInjection::kFault_WOBLESend, { + CHIP_FAULT_INJECT(chip::FaultInjection::kFault_CHIPOBLESend, { if (mRole == kBleRole_Central) { err = BLE_ERROR_GATT_WRITE_FAILED; @@ -775,7 +775,7 @@ BLE_ERROR BLEEndPoint::SendNextMessage() } ExitNow(); }); - err = SendCharacteristic(mWoBle.TxPacket()); + err = SendCharacteristic(mCHIPoBle.TxPacket()); SuccessOrExit(err); if (sentAck) @@ -806,13 +806,13 @@ BLE_ERROR BLEEndPoint::ContinueMessageSend() { // Log BTP error chipLogError(Ble, "btp fragmenter error on send!"); - mWoBle.LogState(); + mCHIPoBle.LogState(); - err = BLE_ERROR_WOBLE_PROTOCOL_ABORT; + err = BLE_ERROR_CHIPOBLE_PROTOCOL_ABORT; ExitNow(); } - err = SendCharacteristic(mWoBle.TxPacket()); + err = SendCharacteristic(mCHIPoBle.TxPacket()); SuccessOrExit(err); if (sentAck) @@ -929,7 +929,7 @@ BLE_ERROR BLEEndPoint::HandleFragmentConfirmationReceived() // the stand-alone ack, and also the case where a window size < the immediate ack threshold was detected in // Receive(), but the stand-alone ack was deferred due to a pending outbound message fragment. if (mLocalReceiveWindowSize <= BLE_CONFIG_IMMEDIATE_ACK_WINDOW_THRESHOLD && - !(mSendQueue != NULL || mWoBle.TxState() == WoBle::kState_InProgress)) + !(mSendQueue != NULL || mCHIPoBle.TxState() == CHIPoBle::kState_InProgress)) { err = DriveStandAloneAck(); // Encode stand-alone ack and drive sending. SuccessOrExit(err); @@ -996,7 +996,7 @@ BLE_ERROR BLEEndPoint::DoSendStandAloneAck() chipLogDebugBleEndPoint(Ble, "entered DoSendStandAloneAck; sending stand-alone ack"); // Encode and transmit stand-alone ack. - mWoBle.EncodeStandAloneAck(mAckToSend); + mCHIPoBle.EncodeStandAloneAck(mAckToSend); BLE_ERROR err = SendCharacteristic(mAckToSend); SuccessOrExit(err); @@ -1055,7 +1055,7 @@ BLE_ERROR BLEEndPoint::DriveSending() err = DoSendStandAloneAck(); SuccessOrExit(err); } - else if (mWoBle.TxState() == WoBle::kState_Idle) // Else send next message fragment, if any. + else if (mCHIPoBle.TxState() == CHIPoBle::kState_Idle) // Else send next message fragment, if any. { // Fragmenter's idle, let's see what's in the send queue... if (mSendQueue != NULL) @@ -1069,20 +1069,20 @@ BLE_ERROR BLEEndPoint::DriveSending() // Nothing to send! } } - else if (mWoBle.TxState() == WoBle::kState_InProgress) + else if (mCHIPoBle.TxState() == CHIPoBle::kState_InProgress) { // Send next fragment of message currently held by fragmenter. err = ContinueMessageSend(); SuccessOrExit(err); } - else if (mWoBle.TxState() == WoBle::kState_Complete) + else if (mCHIPoBle.TxState() == CHIPoBle::kState_Complete) { // Clear fragmenter's pointer to sent message buffer and reset its Tx state. - PacketBuffer * sentBuf = mWoBle.TxPacket(); -#if CHIP_ENABLE_WOBLE_TEST - mWoBleTest.DoTxTiming(sentBuf, WOBLE_TX_DONE); -#endif // CHIP_ENABLE_WOBLE_TEST - mWoBle.ClearTxPacket(); + PacketBuffer * sentBuf = mCHIPoBle.TxPacket(); +#if CHIP_ENABLE_CHIPOBLE_TEST + mCHIPoBleTest.DoTxTiming(sentBuf, CHIPOBLE_TX_DONE); +#endif // CHIP_ENABLE_CHIPOBLE_TEST + mCHIPoBle.ClearTxPacket(); // Free sent buffer. PacketBuffer::Free(sentBuf); @@ -1094,7 +1094,7 @@ BLE_ERROR BLEEndPoint::DriveSending() err = SendNextMessage(); SuccessOrExit(err); } - else if (mState == kState_Closing && !mWoBle.ExpectingAck()) // and mSendQueue is NULL, per above... + else if (mState == kState_Closing && !mCHIPoBle.ExpectingAck()) // and mSendQueue is NULL, per above... { // If end point closing, got last ack, and got out-of-order confirmation for last send, finalize close. FinalizeClose(mState, kBleCloseFlag_SuppressCallback, BLE_NO_ERROR); @@ -1142,12 +1142,12 @@ BLE_ERROR BLEEndPoint::HandleCapabilitiesRequestReceived(PacketBuffer * data) if (mtu > 0) // If one or both device knows connection's MTU... { resp.mFragmentSize = - chip::min(static_cast(mtu - 3), WoBle::sMaxFragmentSize); // Reserve 3 bytes of MTU for ATT header. + chip::min(static_cast(mtu - 3), CHIPoBle::sMaxFragmentSize); // Reserve 3 bytes of MTU for ATT header. } else // Else, if neither device knows MTU... { - chipLogProgress(Ble, "cannot determine ATT MTU; selecting default fragment size = %u", WoBle::sDefaultFragmentSize); - resp.mFragmentSize = WoBle::sDefaultFragmentSize; + chipLogProgress(Ble, "cannot determine ATT MTU; selecting default fragment size = %u", CHIPoBle::sDefaultFragmentSize); + resp.mFragmentSize = CHIPoBle::sDefaultFragmentSize; } // Select local and remote max receive window size based on local resources available for both incoming writes AND @@ -1174,15 +1174,15 @@ BLE_ERROR BLEEndPoint::HandleCapabilitiesRequestReceived(PacketBuffer * data) (resp.mSelectedProtocolVersion == kBleTransportProtocolVersion_V2)) { // Set Rx and Tx fragment sizes to the same value - mWoBle.SetRxFragmentSize(resp.mFragmentSize); - mWoBle.SetTxFragmentSize(resp.mFragmentSize); + mCHIPoBle.SetRxFragmentSize(resp.mFragmentSize); + mCHIPoBle.SetTxFragmentSize(resp.mFragmentSize); } else // resp.SelectedProtocolVersion >= kBleTransportProtocolVersion_V3 { // This is the peripheral, so set Rx fragment size, and leave Tx at default - mWoBle.SetRxFragmentSize(resp.mFragmentSize); + mCHIPoBle.SetRxFragmentSize(resp.mFragmentSize); } - chipLogProgress(Ble, "using BTP fragment sizes rx %d / tx %d.", mWoBle.GetRxFragmentSize(), mWoBle.GetTxFragmentSize()); + chipLogProgress(Ble, "using BTP fragment sizes rx %d / tx %d.", mCHIPoBle.GetRxFragmentSize(), mCHIPoBle.GetTxFragmentSize()); err = resp.Encode(responseBuf); SuccessOrExit(err); @@ -1232,21 +1232,21 @@ BLE_ERROR BLEEndPoint::HandleCapabilitiesResponseReceived(PacketBuffer * data) ExitNow(); } - // Set fragment size as minimum of (reported ATT MTU, WoBLE characteristic size) - resp.mFragmentSize = chip::min(resp.mFragmentSize, WoBle::sMaxFragmentSize); + // Set fragment size as minimum of (reported ATT MTU, CHIPoBLE characteristic size) + resp.mFragmentSize = chip::min(resp.mFragmentSize, CHIPoBle::sMaxFragmentSize); if ((resp.mSelectedProtocolVersion == kBleTransportProtocolVersion_V1) || (resp.mSelectedProtocolVersion == kBleTransportProtocolVersion_V2)) { - mWoBle.SetRxFragmentSize(resp.mFragmentSize); - mWoBle.SetTxFragmentSize(resp.mFragmentSize); + mCHIPoBle.SetRxFragmentSize(resp.mFragmentSize); + mCHIPoBle.SetTxFragmentSize(resp.mFragmentSize); } else // resp.SelectedProtocolVersion >= kBleTransportProtocolVersion_V3 { // This is the central, so set Tx fragement size, and leave Rx at default. - mWoBle.SetTxFragmentSize(resp.mFragmentSize); + mCHIPoBle.SetTxFragmentSize(resp.mFragmentSize); } - chipLogProgress(Ble, "using BTP fragment sizes rx %d / tx %d.", mWoBle.GetRxFragmentSize(), mWoBle.GetTxFragmentSize()); + chipLogProgress(Ble, "using BTP fragment sizes rx %d / tx %d.", mCHIPoBle.GetRxFragmentSize(), mCHIPoBle.GetTxFragmentSize()); // Select local and remote max receive window size based on local resources available for both incoming indications // AND GATT confirmations. @@ -1313,14 +1313,14 @@ BLE_ERROR BLEEndPoint::Receive(PacketBuffer * data) uint8_t closeFlags = kBleCloseFlag_AbortTransmission; bool didReceiveAck = false; -#if CHIP_ENABLE_WOBLE_TEST - if (mWoBle.IsCommandPacket(data)) +#if CHIP_ENABLE_CHIPOBLE_TEST + if (mCHIPoBle.IsCommandPacket(data)) { chipLogDebugBleEndPoint(Ble, "%s: Received Control frame: Flags %x", __FUNCTION__, *(data->Start())); } else #endif - { // This is a special handling on the first Woble data packet, the CapabilitiesRequest. + { // This is a special handling on the first CHIPoBLE data packet, the CapabilitiesRequest. // Suppress error logging if peer's send overlaps with our unsubscribe on final close. if (IsUnsubscribePending()) { @@ -1377,15 +1377,15 @@ BLE_ERROR BLEEndPoint::Receive(PacketBuffer * data) ExitNow(); } - chipLogDebugBleEndPoint(Ble, "woble about to rx characteristic, state before:"); - mWoBle.LogStateDebug(); + chipLogDebugBleEndPoint(Ble, "CHIPoBLE about to rx characteristic, state before:"); + mCHIPoBle.LogStateDebug(); // Pass received packet into BTP protocol engine. - err = mWoBle.HandleCharacteristicReceived(data, receivedAck, didReceiveAck); + err = mCHIPoBle.HandleCharacteristicReceived(data, receivedAck, didReceiveAck); data = NULL; // Buffer consumed by protocol engine; either freed or added to message reassembly area. - chipLogDebugBleEndPoint(Ble, "woble rx'd characteristic, state after:"); - mWoBle.LogStateDebug(); + chipLogDebugBleEndPoint(Ble, "CHIPoBLE rx'd characteristic, state after:"); + mCHIPoBle.LogStateDebug(); SuccessOrExit(err); @@ -1399,12 +1399,12 @@ BLE_ERROR BLEEndPoint::Receive(PacketBuffer * data) chipLogDebugBleEndPoint(Ble, "got btp ack = %u", receivedAck); // If ack was rx'd for neweset unacked sent fragment, stop ack received timer. - if (!mWoBle.ExpectingAck()) + if (!mCHIPoBle.ExpectingAck()) { chipLogDebugBleEndPoint(Ble, "got ack for last outstanding fragment"); StopAckReceivedTimer(); - if (mState == kState_Closing && mSendQueue == NULL && mWoBle.TxState() == WoBle::kState_Idle) + if (mState == kState_Closing && mSendQueue == NULL && mCHIPoBle.TxState() == CHIPoBle::kState_Idle) { // If end point closing, got confirmation for last send, and waiting for last ack, finalize close. FinalizeClose(mState, kBleCloseFlag_SuppressCallback, BLE_NO_ERROR); @@ -1420,12 +1420,12 @@ BLE_ERROR BLEEndPoint::Receive(PacketBuffer * data) chipLogDebugBleEndPoint(Ble, "about to adjust remote rx window; got ack num = %u, newest unacked sent seq num = %u, \ old window size = %u, max window size = %u", - receivedAck, mWoBle.GetNewestUnackedSentSequenceNumber(), mRemoteReceiveWindowSize, + receivedAck, mCHIPoBle.GetNewestUnackedSentSequenceNumber(), mRemoteReceiveWindowSize, mReceiveWindowMaxSize); // Open remote device's receive window according to sequence number it just acknowledged. mRemoteReceiveWindowSize = - AdjustRemoteReceiveWindow(receivedAck, mReceiveWindowMaxSize, mWoBle.GetNewestUnackedSentSequenceNumber()); + AdjustRemoteReceiveWindow(receivedAck, mReceiveWindowMaxSize, mCHIPoBle.GetNewestUnackedSentSequenceNumber()); chipLogDebugBleEndPoint(Ble, "adjusted remote rx window, new size = %u", mRemoteReceiveWindowSize); @@ -1447,7 +1447,7 @@ BLE_ERROR BLEEndPoint::Receive(PacketBuffer * data) // // If any GATT operation is in flight that is NOT a stand-alone ack, the window size will be checked against // this threshold again when the GATT operation is confirmed. - if (mWoBle.HasUnackedData()) + if (mCHIPoBle.HasUnackedData()) { if (mLocalReceiveWindowSize <= BLE_CONFIG_IMMEDIATE_ACK_WINDOW_THRESHOLD && !GetFlag(mConnStateFlags, kConnState_GattOperationInFlight)) @@ -1467,22 +1467,22 @@ BLE_ERROR BLEEndPoint::Receive(PacketBuffer * data) } // If we've reassembled a whole message... - if (mWoBle.RxState() == WoBle::kState_Complete) + if (mCHIPoBle.RxState() == CHIPoBle::kState_Complete) { // Take ownership of message PacketBuffer - PacketBuffer * full_packet = mWoBle.RxPacket(); - mWoBle.ClearRxPacket(); + PacketBuffer * full_packet = mCHIPoBle.RxPacket(); + mCHIPoBle.ClearRxPacket(); chipLogDebugBleEndPoint(Ble, "reassembled whole msg, len = %d", full_packet->DataLength()); -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST // If we have a control message received callback, and end point is not closing... - if (mWoBle.RxPacketType() == kType_Control && OnCommandReceived && mState != kState_Closing) + if (mCHIPoBle.RxPacketType() == kType_Control && OnCommandReceived && mState != kState_Closing) { chipLogDebugBleEndPoint(Ble, "%s: calling OnCommandReceived, seq# %u, len = %u, type %u", __FUNCTION__, receivedAck, - full_packet->DataLength(), mWoBle.RxPacketType()); + full_packet->DataLength(), mCHIPoBle.RxPacketType()); // Pass received control message up the stack. - mWoBle.SetRxPacketSeq(receivedAck); + mCHIPoBle.SetRxPacketSeq(receivedAck); OnCommandReceived(this, full_packet); } else @@ -1700,7 +1700,7 @@ void BLEEndPoint::HandleAckReceivedTimeout(chip::System::Layer * systemLayer, vo if (GetFlag(ep->mTimerStateFlags, kTimerState_AckReceivedTimerRunning)) { chipLogError(Ble, "ack recv timeout, closing ep %p", ep); - ep->mWoBle.LogStateDebug(); + ep->mCHIPoBle.LogStateDebug(); SetFlag(ep->mTimerStateFlags, kTimerState_AckReceivedTimerRunning, false); ep->DoClose(kBleCloseFlag_AbortTransmission, BLE_ERROR_FRAGMENT_ACK_TIMED_OUT); } diff --git a/src/ble/BLEEndPoint.h b/src/ble/BLEEndPoint.h index 9942f11076f846..73f709d3add5b6 100644 --- a/src/ble/BLEEndPoint.h +++ b/src/ble/BLEEndPoint.h @@ -19,7 +19,7 @@ * @file * This file defines a Bluetooth Low Energy (BLE) connection * endpoint abstraction for the byte-streaming, - * connection-oriented chip over Bluetooth Low Energy (WoBLE) + * connection-oriented chip over Bluetooth Low Energy (CHIPoBLE) * Bluetooth Transport Protocol (BTP). * */ @@ -30,9 +30,9 @@ #include #include -#include -#if CHIP_ENABLE_WOBLE_TEST -#include +#include +#if CHIP_ENABLE_CHIPOBLE_TEST +#include #endif namespace chip { @@ -49,16 +49,16 @@ enum // Forward declarations class BleLayer; class BleEndPointPool; -#if CHIP_ENABLE_WOBLE_TEST -class WoBleTest; +#if CHIP_ENABLE_CHIPOBLE_TEST +class CHIPoBleTest; #endif class DLL_EXPORT BLEEndPoint : public BleLayerObject { friend class BleLayer; friend class BleEndPointPool; -#if CHIP_ENABLE_WOBLE_TEST - friend class WoBleTest; +#if CHIP_ENABLE_CHIPOBLE_TEST + friend class CHIPoBleTest; #endif public: @@ -86,11 +86,11 @@ class DLL_EXPORT BLEEndPoint : public BleLayerObject typedef void (*OnConnectionClosedFunct)(BLEEndPoint * endPoint, BLE_ERROR err); OnConnectionClosedFunct OnConnectionClosed; -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST typedef void (*OnCommandReceivedFunct)(BLEEndPoint * endPoint, PacketBuffer * msg); OnCommandReceivedFunct OnCommandReceived; inline void SetOnCommandReceivedCB(OnCommandReceivedFunct cb) { OnCommandReceived = cb; }; - WoBleTest mWoBleTest; + CHIPoBleTest mCHIPoBleTest; inline void SetTxWindowSize(uint8_t size) { mRemoteReceiveWindowSize = size; }; inline void SetRxWindowSize(uint8_t size) { mReceiveWindowMaxSize = size; }; #endif @@ -125,7 +125,7 @@ class DLL_EXPORT BLEEndPoint : public BleLayerObject kTimerState_AckReceivedTimerRunning = 0x04, // Ack received timer running due to unacked sent fragment. kTimerState_SendAckTimerRunning = 0x08, // Send ack timer running; indicates pending ack to send. kTimerState_UnsubscribeTimerRunning = 0x10, // Unsubscribe completion timer running. -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST kTimerState_UnderTestTimerRunnung = 0x80 // running throughput Tx test #endif }; @@ -135,7 +135,7 @@ class DLL_EXPORT BLEEndPoint : public BleLayerObject // modify the state of the underlying BLE connection. BLE_CONNECTION_OBJECT mConnObj; - // Queue of outgoing messages to send when current WoBle transmission completes. + // Queue of outgoing messages to send when current CHIPoBle transmission completes. // // Re-used during connection setup to cache capabilities request and response payloads; payloads are freed when // connection is established. @@ -145,14 +145,14 @@ class DLL_EXPORT BLEEndPoint : public BleLayerObject // progress. PacketBuffer * mAckToSend; - WoBle mWoBle; + CHIPoBle mCHIPoBle; BleRole mRole; uint8_t mConnStateFlags; uint8_t mTimerStateFlags; SequenceNumber_t mLocalReceiveWindowSize; SequenceNumber_t mRemoteReceiveWindowSize; SequenceNumber_t mReceiveWindowMaxSize; -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST chip::System::Mutex mTxQueueMutex; // For MT-safe Tx queuing #endif @@ -215,10 +215,10 @@ class DLL_EXPORT BLEEndPoint : public BleLayerObject void FinalizeClose(uint8_t state, uint8_t flags, BLE_ERROR err); void ReleaseBleConnection(void); void Free(void); - void FreeWoBle(void); + void FreeCHIPoBle(void); - // Mutex lock on Tx queue. Used only in WoBle test build for now. -#if CHIP_ENABLE_WOBLE_TEST + // Mutex lock on Tx queue. Used only in CHIPoBle test build for now. +#if CHIP_ENABLE_CHIPOBLE_TEST inline void QueueTxLock() { mTxQueueMutex.Lock(); }; inline void QueueTxUnlock() { mTxQueueMutex.Unlock(); }; #else diff --git a/src/ble/Ble.h b/src/ble/Ble.h index b0fc8de6156d9c..25b9d47e50c485 100644 --- a/src/ble/Ble.h +++ b/src/ble/Ble.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include /** * @namespace Ble diff --git a/src/ble/BleError.cpp b/src/ble/BleError.cpp index 74f10fc9957697..8bd95a3c22d322 100644 --- a/src/ble/BleError.cpp +++ b/src/ble/BleError.cpp @@ -86,7 +86,7 @@ bool FormatBleLayerError(char * buf, uint16_t bufSize, int32_t err) case BLE_ERROR_NOT_IMPLEMENTED: desc = "Not implemented"; break; - case BLE_ERROR_WOBLE_PROTOCOL_ABORT: + case BLE_ERROR_CHIPOBLE_PROTOCOL_ABORT: desc = "BLE transport protocol fired abort"; break; case BLE_ERROR_REMOTE_DEVICE_DISCONNECTED: diff --git a/src/ble/BleError.h b/src/ble/BleError.h index 9b57fa76f0b376..1ec925bdc63fc8 100644 --- a/src/ble/BleError.h +++ b/src/ble/BleError.h @@ -195,13 +195,13 @@ typedef BLE_CONFIG_ERROR_TYPE BLE_ERROR; */ /** - * @def BLE_ERROR_WOBLE_PROTOCOL_ABORT + * @def BLE_ERROR_CHIPOBLE_PROTOCOL_ABORT * * @brief * A BLE Transport Protocol (BTP) error was encountered. * */ -#define BLE_ERROR_WOBLE_PROTOCOL_ABORT _BLE_ERROR(11) +#define BLE_ERROR_CHIPOBLE_PROTOCOL_ABORT _BLE_ERROR(11) /** * @def BLE_ERROR_REMOTE_DEVICE_DISCONNECTED diff --git a/src/ble/BleLayer.cpp b/src/ble/BleLayer.cpp index 998a655ed45d84..faa5cce2622131 100644 --- a/src/ble/BleLayer.cpp +++ b/src/ble/BleLayer.cpp @@ -320,7 +320,7 @@ BLE_ERROR BleLayer::Init(BlePlatformDelegate * platformDelegate, BleApplicationD mState = kState_Initialized; -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST mTestBleEndPoint = NULL; #endif @@ -382,7 +382,7 @@ BLE_ERROR BleLayer::NewBleEndPoint(BLEEndPoint ** retEndPoint, BLE_CONNECTION_OB (*retEndPoint)->Init(this, connObj, role, autoClose); -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST mTestBleEndPoint = *retEndPoint; #endif diff --git a/src/ble/BleLayer.h b/src/ble/BleLayer.h index 5f9f67149635c9..871698d550e501 100644 --- a/src/ble/BleLayer.h +++ b/src/ble/BleLayer.h @@ -98,9 +98,9 @@ typedef enum typedef enum { kBleTransportProtocolVersion_None = 0, - kBleTransportProtocolVersion_V1 = 1, // Prototype WoBLe version without ACKs or flow-control. - kBleTransportProtocolVersion_V2 = 2, // First WoBLE version with ACKs and flow-control. - kBleTransportProtocolVersion_V3 = 3 // First WoBLE version with asymetric fragement sizes. + kBleTransportProtocolVersion_V1 = 1, // Prototype CHIPoBle version without ACKs or flow-control. + kBleTransportProtocolVersion_V2 = 2, // First CHIPoBLE version with ACKs and flow-control. + kBleTransportProtocolVersion_V3 = 3 // First CHIPoBLE version with asymetric fragement sizes. } BleTransportProtocolVersion; class BleLayerObject @@ -229,8 +229,8 @@ class BleTransportCapabilitiesResponseMessage class DLL_EXPORT BleLayer { friend class BLEEndPoint; -#if CHIP_ENABLE_WOBLE_TEST - friend class WoBleTest; +#if CHIP_ENABLE_CHIPOBLE_TEST + friend class CHIPoBleTest; #endif public: @@ -330,7 +330,7 @@ class DLL_EXPORT BleLayer * err = BLE_ERROR_APP_CLOSED_CONNECTION to prevent the leak of this chipConnection and its end point object. */ void HandleConnectionError(BLE_CONNECTION_OBJECT connObj, BLE_ERROR err); -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST BLEEndPoint * mTestBleEndPoint; #endif diff --git a/src/ble/WoBle.cpp b/src/ble/CHIPoBle.cpp similarity index 89% rename from src/ble/WoBle.cpp rename to src/ble/CHIPoBle.cpp index fabe67b538c7ef..9d53a98e4bd78d 100644 --- a/src/ble/WoBle.cpp +++ b/src/ble/CHIPoBle.cpp @@ -18,7 +18,7 @@ /** * @file * This file implements types and an object for the chip over - * Bluetooth Low Energy (WoBLE) byte-stream, connection-oriented + * Bluetooth Low Energy (CHIPoBLE) byte-stream, connection-oriented * adaptation of chip for point-to-point Bluetooth Low Energy * (BLE) links. * @@ -28,9 +28,9 @@ #if CONFIG_NETWORK_LAYER_BLE -#include -#if CHIP_ENABLE_WOBLE_TEST -#include +#include +#if CHIP_ENABLE_CHIPOBLE_TEST +#include #endif #include @@ -72,8 +72,8 @@ static inline void IncSeqNum(SequenceNumber_t & a_seq_num) static inline bool DidReceiveData(uint8_t rx_flags) { - return (GetFlag(rx_flags, WoBle::kHeaderFlag_StartMessage) || GetFlag(rx_flags, WoBle::kHeaderFlag_ContinueMessage) || - GetFlag(rx_flags, WoBle::kHeaderFlag_EndMessage)); + return (GetFlag(rx_flags, CHIPoBle::kHeaderFlag_StartMessage) || GetFlag(rx_flags, CHIPoBle::kHeaderFlag_ContinueMessage) || + GetFlag(rx_flags, CHIPoBle::kHeaderFlag_EndMessage)); } static void PrintBufDebug(PacketBuffer * buf) @@ -88,10 +88,10 @@ static void PrintBufDebug(PacketBuffer * buf) #endif } -const uint16_t WoBle::sDefaultFragmentSize = 20; // 23-byte minimum ATT_MTU - 3 bytes for ATT operation header -const uint16_t WoBle::sMaxFragmentSize = 128; // Size of write and indication characteristics +const uint16_t CHIPoBle::sDefaultFragmentSize = 20; // 23-byte minimum ATT_MTU - 3 bytes for ATT operation header +const uint16_t CHIPoBle::sMaxFragmentSize = 128; // Size of write and indication characteristics -BLE_ERROR WoBle::Init(void * an_app_state, bool expect_first_ack) +BLE_ERROR CHIPoBle::Init(void * an_app_state, bool expect_first_ack) { mAppState = an_app_state; mRxState = kState_Idle; @@ -108,9 +108,9 @@ BLE_ERROR WoBle::Init(void * an_app_state, bool expect_first_ack) mTxPacketCount = 0; mTxNewestUnackedSeqNum = 0; mTxOldestUnackedSeqNum = 0; -#if CHIP_ENABLE_WOBLE_TEST - mTxPacketType = kType_Data; // Default WoBle Data packet - mRxPacketType = kType_Data; // Default WoBle Data packet +#if CHIP_ENABLE_CHIPOBLE_TEST + mTxPacketType = kType_Data; // Default CHIPoBle Data packet + mRxPacketType = kType_Data; // Default CHIPoBle Data packet #endif if (expect_first_ack) @@ -129,7 +129,7 @@ BLE_ERROR WoBle::Init(void * an_app_state, bool expect_first_ack) return BLE_NO_ERROR; } -SequenceNumber_t WoBle::GetAndIncrementNextTxSeqNum() +SequenceNumber_t CHIPoBle::GetAndIncrementNextTxSeqNum() { SequenceNumber_t ret = mTxNextSeqNum; @@ -149,7 +149,7 @@ SequenceNumber_t WoBle::GetAndIncrementNextTxSeqNum() return ret; } -SequenceNumber_t WoBle::GetAndRecordRxAckSeqNum() +SequenceNumber_t CHIPoBle::GetAndRecordRxAckSeqNum() { SequenceNumber_t ret = mRxNewestUnackedSeqNum; @@ -159,12 +159,12 @@ SequenceNumber_t WoBle::GetAndRecordRxAckSeqNum() return ret; } -bool WoBle::HasUnackedData() const +bool CHIPoBle::HasUnackedData() const { return (mRxOldestUnackedSeqNum != mRxNextSeqNum); } -bool WoBle::IsValidAck(SequenceNumber_t ack_num) const +bool CHIPoBle::IsValidAck(SequenceNumber_t ack_num) const { chipLogDebugBtpEngine(Ble, "entered IsValidAck, ack = %u, oldest = %u, newest = %u", ack_num, mTxOldestUnackedSeqNum, mTxNewestUnackedSeqNum); @@ -188,7 +188,7 @@ bool WoBle::IsValidAck(SequenceNumber_t ack_num) const } } -BLE_ERROR WoBle::HandleAckReceived(SequenceNumber_t ack_num) +BLE_ERROR CHIPoBle::HandleAckReceived(SequenceNumber_t ack_num) { BLE_ERROR err = BLE_NO_ERROR; @@ -217,7 +217,7 @@ BLE_ERROR WoBle::HandleAckReceived(SequenceNumber_t ack_num) // Calling convention: // EncodeStandAloneAck may only be called if data arg is commited for immediate, synchronous subsequent transmission. -BLE_ERROR WoBle::EncodeStandAloneAck(PacketBuffer * data) +BLE_ERROR CHIPoBle::EncodeStandAloneAck(PacketBuffer * data) { BLE_ERROR err = BLE_NO_ERROR; uint8_t * characteristic; @@ -247,9 +247,9 @@ BLE_ERROR WoBle::EncodeStandAloneAck(PacketBuffer * data) } // Calling convention: -// WoBle does not retain ownership of reassembled messages, layer above needs to free when done. +// CHIPoBle does not retain ownership of reassembled messages, layer above needs to free when done. // -// WoBle does not reset itself on error. Upper layer should free outbound message and inbound reassembly buffers +// CHIPoBle does not reset itself on error. Upper layer should free outbound message and inbound reassembly buffers // if there is a problem. // HandleCharacteristicReceived(): @@ -259,7 +259,7 @@ BLE_ERROR WoBle::EncodeStandAloneAck(PacketBuffer * data) // function returns. // // Upper layer must immediately clean up and reinitialize protocol engine if returned err != BLE_NO_ERROR. -BLE_ERROR WoBle::HandleCharacteristicReceived(PacketBuffer * data, SequenceNumber_t & receivedAck, bool & didReceiveAck) +BLE_ERROR CHIPoBle::HandleCharacteristicReceived(PacketBuffer * data, SequenceNumber_t & receivedAck, bool & didReceiveAck) { BLE_ERROR err = BLE_NO_ERROR; uint8_t rx_flags = 0; @@ -272,7 +272,7 @@ BLE_ERROR WoBle::HandleCharacteristicReceived(PacketBuffer * data, SequenceNumbe // Get header flags, always in first byte. rx_flags = characteristic[cursor++]; -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST if (GetFlag(rx_flags, kHeaderFlag_CommandMessage)) SetRxPacketType(kType_Control); else @@ -352,8 +352,8 @@ BLE_ERROR WoBle::HandleCharacteristicReceived(PacketBuffer * data, SequenceNumbe mRxBuf->CompactHead(); // will free 'data' and adjust rx buf's end/length data = NULL; - // For now, limit WoBle message size to max length of 1 pbuf, as we do for chip messages sent via IP. - // TODO add support for WoBle messages longer than 1 pbuf + // For now, limit CHIPoBle message size to max length of 1 pbuf, as we do for chip messages sent via IP. + // TODO add support for CHIPoBle messages longer than 1 pbuf VerifyOrExit(mRxBuf->Next() == NULL, err = BLE_ERROR_RECEIVED_MESSAGE_TOO_BIG); } else @@ -414,12 +414,12 @@ BLE_ERROR WoBle::HandleCharacteristicReceived(PacketBuffer * data, SequenceNumbe return err; } -PacketBuffer * WoBle::RxPacket() +PacketBuffer * CHIPoBle::RxPacket() { return mRxBuf; } -bool WoBle::ClearRxPacket() +bool CHIPoBle::ClearRxPacket() { if (mRxState == kState_Complete) { @@ -435,7 +435,7 @@ bool WoBle::ClearRxPacket() // Calling convention: // May only be called if data arg is commited for immediate, synchronous subsequent transmission. // Returns false on error. Caller must free data arg on error. -bool WoBle::HandleCharacteristicSend(PacketBuffer * data, bool send_ack) +bool CHIPoBle::HandleCharacteristicSend(PacketBuffer * data, bool send_ack) { uint8_t * characteristic; mTxCharCount++; @@ -457,7 +457,7 @@ bool WoBle::HandleCharacteristicSend(PacketBuffer * data, bool send_ack) mTxState = kState_InProgress; mTxLength = mTxBuf->DataLength(); - chipLogDebugBtpEngine(Ble, ">>> WoBle preparing to send whole message:"); + chipLogDebugBtpEngine(Ble, ">>> CHIPoBle preparing to send whole message:"); PrintBufDebug(data); // Determine fragment header size. @@ -483,7 +483,7 @@ bool WoBle::HandleCharacteristicSend(PacketBuffer * data, bool send_ack) characteristic[0] = kHeaderFlag_StartMessage; -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST if (TxPacketType() == kType_Control) SetFlag(characteristic[0], kHeaderFlag_CommandMessage, true); #endif @@ -513,7 +513,7 @@ bool WoBle::HandleCharacteristicSend(PacketBuffer * data, bool send_ack) mTxLength -= mTxFragmentSize - cursor; } - chipLogDebugBtpEngine(Ble, ">>> WoBle preparing to send first fragment:"); + chipLogDebugBtpEngine(Ble, ">>> CHIPoBle preparing to send first fragment:"); PrintBufDebug(data); } else if (mTxState == kState_InProgress) @@ -536,7 +536,7 @@ bool WoBle::HandleCharacteristicSend(PacketBuffer * data, bool send_ack) characteristic[0] = kHeaderFlag_ContinueMessage; -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST if (TxPacketType() == kType_Control) SetFlag(characteristic[0], kHeaderFlag_CommandMessage, true); #endif @@ -564,7 +564,7 @@ bool WoBle::HandleCharacteristicSend(PacketBuffer * data, bool send_ack) mTxLength -= mTxFragmentSize - cursor; } - chipLogDebugBtpEngine(Ble, ">>> WoBle preparing to send additional fragment:"); + chipLogDebugBtpEngine(Ble, ">>> CHIPoBle preparing to send additional fragment:"); PrintBufDebug(mTxBuf); } else @@ -576,12 +576,12 @@ bool WoBle::HandleCharacteristicSend(PacketBuffer * data, bool send_ack) return true; } -PacketBuffer * WoBle::TxPacket() +PacketBuffer * CHIPoBle::TxPacket() { return mTxBuf; } -bool WoBle::ClearTxPacket() +bool CHIPoBle::ClearTxPacket() { if (mTxState == kState_Complete) { @@ -594,7 +594,7 @@ bool WoBle::ClearTxPacket() return false; } -void WoBle::LogState() const +void CHIPoBle::LogState() const { chipLogError(Ble, "mAppState: %p", mAppState); @@ -617,7 +617,7 @@ void WoBle::LogState() const chipLogError(Ble, "mTxPacketCount: %d", mTxPacketCount); } -void WoBle::LogStateDebug() const +void CHIPoBle::LogStateDebug() const { #ifdef CHIP_BTP_PROTOCOL_ENGINE_DEBUG_LOGGING_ENABLED LogState(); diff --git a/src/ble/WoBle.h b/src/ble/CHIPoBle.h similarity index 92% rename from src/ble/WoBle.h rename to src/ble/CHIPoBle.h index 3cbc4bcff7a0b8..436bf824847676 100644 --- a/src/ble/WoBle.h +++ b/src/ble/CHIPoBle.h @@ -18,14 +18,14 @@ /** * @file * This file defines types and an object for the chip over - * Bluetooth Low Energy (WoBLE) byte-stream, connection-oriented + * Bluetooth Low Energy (CHIPoBLE) byte-stream, connection-oriented * adaptation of chip for point-to-point Bluetooth Low Energy * (BLE) links. * */ -#ifndef WOBLE_H_ -#define WOBLE_H_ +#ifndef CHIPOBLE_H_ +#define CHIPOBLE_H_ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS @@ -44,10 +44,10 @@ namespace Ble { using ::chip::System::PacketBuffer; -typedef uint8_t SequenceNumber_t; // If type changed from uint8_t, adjust assumptions in WoBle::IsValidAck and +typedef uint8_t SequenceNumber_t; // If type changed from uint8_t, adjust assumptions in CHIPoBle::IsValidAck and // BLEEndPoint::AdjustReceiveWindow. -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST class BLEEndPoint; #endif @@ -56,11 +56,11 @@ typedef enum { kType_Data = 0, // Default 0 for data kType_Control = 1, -} PacketType_t; // WoBle packet types +} PacketType_t; // CHIPoBle packet types -class WoBle +class CHIPoBle { -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST friend class BLEEndPoint; #endif @@ -80,7 +80,7 @@ class WoBle kHeaderFlag_ContinueMessage = 0x02, kHeaderFlag_EndMessage = 0x04, kHeaderFlag_FragmentAck = 0x08, -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST kHeaderFlag_CommandMessage = 0x10, #endif }; // Masks for BTP fragment header flag bits. @@ -90,8 +90,8 @@ class WoBle public: // Public functions: - WoBle(void) { }; - ~WoBle(void) { }; + CHIPoBle(void) { }; + ~CHIPoBle(void) { }; BLE_ERROR Init(void * an_app_state, bool expect_first_ack); @@ -111,7 +111,7 @@ class WoBle inline State_t RxState(void) { return mRxState; } inline State_t TxState(void) { return mTxState; } -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST inline PacketType_t SetTxPacketType(PacketType_t type) { return (mTxPacketType = type); }; inline PacketType_t SetRxPacketType(PacketType_t type) { return (mRxPacketType = type); }; inline PacketType_t TxPacketType() { return mTxPacketType; }; @@ -133,7 +133,7 @@ class WoBle p->SetStart(p->Start() + sizeof(type)); return type; }; -#endif // CHIP_ENABLE_WOBLE_TEST +#endif // CHIP_ENABLE_CHIPOBLE_TEST bool HasUnackedData(void) const; @@ -152,7 +152,7 @@ class WoBle private: // Private data members: -#if CHIP_ENABLE_WOBLE_TEST +#if CHIP_ENABLE_CHIPOBLE_TEST PacketType_t mTxPacketType; PacketType_t mRxPacketType; SequenceNumber_t mTxPacketSeq; @@ -190,4 +190,4 @@ class WoBle } /* namespace Ble */ } /* namespace chip */ -#endif /* WOBLE_H_ */ +#endif /* CHIPOBLE_H_ */ diff --git a/src/ble/Makefile b/src/ble/Makefile index ed8323f1de60e3..161c160a9fc2eb 100644 --- a/src/ble/Makefile +++ b/src/ble/Makefile @@ -25,7 +25,7 @@ CPP_Files = \ BleError.cpp \ BleLayer.cpp \ BleUUID.cpp \ - WoBle.cpp + CHIPoBle.cpp libble.a: $(CPP_Objects) ar rvs $@ $^ diff --git a/src/include/BuildConfig.h b/src/include/BuildConfig.h index 7b91f7fbf216b0..771b0c23aaf6da 100644 --- a/src/include/BuildConfig.h +++ b/src/include/BuildConfig.h @@ -7,7 +7,7 @@ /* Path to BLE platform config header file */ /* #undef BLE_PLATFORM_CONFIG_INCLUDE */ -/* Define to 1 if you want to enable WoBle over bluez. */ +/* Define to 1 if you want to enable CHIPoBle over bluez. */ #define CONFIG_BLE_PLATFORM_BLUEZ 0 /* Define to 1 if you want to use the CHIP Device Layer. */ @@ -426,9 +426,9 @@ /* Path to CHIP Device Layer platform config header file */ /* #undef CHIP_DEVICE_PROJECT_CONFIG_INCLUDE */ -/* Define to 1 if you want to enable WoBle Control Path and Throughput Test. +/* Define to 1 if you want to enable CHIPoBle Control Path and Throughput Test. */ -#define CHIP_ENABLE_WOBLE_TEST 0 +#define CHIP_ENABLE_CHIPOBLE_TEST 0 /* Define to 1 if support for fuzzing enabled */ /* #undef CHIP_FUZZING_ENABLED */ diff --git a/src/lib/support/CHIPFaultInjection.cpp b/src/lib/support/CHIPFaultInjection.cpp index 8cfcf0644d5cfd..06061ee692e416 100644 --- a/src/lib/support/CHIPFaultInjection.cpp +++ b/src/lib/support/CHIPFaultInjection.cpp @@ -79,7 +79,7 @@ static const FaultInjection::Name sFaultNames[] = { "TunnelPacketDropByPolicy", #endif // CHIP_CONFIG_ENABLE_TUNNELING #if CONFIG_NETWORK_LAYER_BLE - "WOBLESend", + "CHIPOBLESend", #endif // CONFIG_NETWORK_LAYER_BLE }; diff --git a/src/lib/support/CHIPFaultInjection.h b/src/lib/support/CHIPFaultInjection.h index 9ad7766320ec48..0e85e9b947d673 100644 --- a/src/lib/support/CHIPFaultInjection.h +++ b/src/lib/support/CHIPFaultInjection.h @@ -94,7 +94,7 @@ typedef enum kFault_TunnelPacketDropByPolicy, /**< Trigger an explicit drop of the packet as if done by an application policy */ #endif // CHIP_CONFIG_ENABLE_TUNNELING #if CONFIG_NETWORK_LAYER_BLE - kFault_WOBLESend, /**< Inject a GATT error when sending the first fragment of a chip message over BLE */ + kFault_CHIPOBLESend, /**< Inject a GATT error when sending the first fragment of a chip message over BLE */ #endif // CONFIG_NETWORK_LAYER_BLE kFault_NumItems, } Id; diff --git a/src/platform/include/CHIPDeviceConfig.h b/src/platform/include/CHIPDeviceConfig.h index 7374e797d08be7..11551da3c50a07 100644 --- a/src/platform/include/CHIPDeviceConfig.h +++ b/src/platform/include/CHIPDeviceConfig.h @@ -313,35 +313,35 @@ #define CHIP_DEVICE_CONFIG_LWIP_WIFI_AP_IF_NAME "ap" #endif -// -------------------- BLE/WoBLE Configuration -------------------- +// -------------------- BLE/CHIPoBLE Configuration -------------------- /** - * CHIP_DEVICE_CONFIG_ENABLE_WOBLE + * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE * - * Enable support for chip-over-BLE (WoBLE). + * Enable support for chip-over-BLE (CHIPoBLE). */ -#ifndef CHIP_DEVICE_CONFIG_ENABLE_WOBLE -#define CHIP_DEVICE_CONFIG_ENABLE_WOBLE 1 +#ifndef CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE +#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 #endif /** - * CHIP_DEVICE_CONFIG_SINGLE_WOBLE_CONNECTION + * CHIP_DEVICE_CONFIG_SINGLE_CHIPOBLE_CONNECTION * - * Limit support for chip-over-BLE (WoBLE) to a single connection. - * When set, WoBLE advertisements will stop while a WoBLE connection is active. + * Limit support for chip-over-BLE (CHIPoBLE) to a single connection. + * When set, CHIPoBLE advertisements will stop while a CHIPoBLE connection is active. */ -#ifndef CHIP_DEVICE_CONFIG_WOBLE_SINGLE_CONNECTION -#define CHIP_DEVICE_CONFIG_WOBLE_SINGLE_CONNECTION 0 +#ifndef CHIP_DEVICE_CONFIG_CHIPOBLE_SINGLE_CONNECTION +#define CHIP_DEVICE_CONFIG_CHIPOBLE_SINGLE_CONNECTION 0 #endif /** - * CHIP_DEVICE_CONFIG_WOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED + * CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED * - * Automatically disable WoBLE advertising when the device transitions to a fully + * Automatically disable CHIPoBLE advertising when the device transitions to a fully * provisioned state. */ -#ifndef CHIP_DEVICE_CONFIG_WOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED -#define CHIP_DEVICE_CONFIG_WOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED 0 +#ifndef CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED +#define CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED 0 #endif /** @@ -351,7 +351,7 @@ * consists of the final two bytes of the device's chip node id in hex. * * NOTE: The device layer limits the total length of a device name to 16 characters. - * However, due to other data sent in WoBLE advertise packets, the device name + * However, due to other data sent in CHIPoBLE advertise packets, the device name * may need to be shorter. */ #ifndef CHIP_DEVICE_CONFIG_BLE_DEVICE_NAME_PREFIX diff --git a/src/platform/include/CHIPDeviceEvent.h b/src/platform/include/CHIPDeviceEvent.h index d359d26943e4f9..02cbd65d23389e 100644 --- a/src/platform/include/CHIPDeviceEvent.h +++ b/src/platform/include/CHIPDeviceEvent.h @@ -168,11 +168,11 @@ enum PublicEventTypes kSessionEstablished, /** - * WoBLE Connection Established + * CHIPoBLE Connection Established * - * Signals that an external entity has established a new WoBLE connection with the device. + * Signals that an external entity has established a new CHIPoBLE connection with the device. */ - kWoBLEConnectionEstablished, + kCHIPoBLEConnectionEstablished, /** * Thread State Change @@ -189,11 +189,11 @@ enum PublicEventTypes kThreadInterfaceStateChange, /** - * chip-over-BLE (WoBLE) Advertising Change + * chip-over-BLE (CHIPoBLE) Advertising Change * - * Signals that the state of WoBLE advertising has changed. + * Signals that the state of CHIPoBLE advertising has changed. */ - kWoBLEAdvertisingChange, + kCHIPoBLEAdvertisingChange, }; /** @@ -208,11 +208,11 @@ enum InternalEventTypes kNoOp, kCallWorkFunct, kChipSystemLayerEvent, - kWoBLESubscribe, - kWoBLEUnsubscribe, - kWoBLEWriteReceived, - kWoBLEIndicateConfirm, - kWoBLEConnectionError, + kCHIPoBLESubscribe, + kCHIPoBLEUnsubscribe, + kCHIPoBLEWriteReceived, + kCHIPoBLEIndicateConfirm, + kCHIPoBLEConnectionError, }; static_assert(kEventTypeNotSet == 0, "kEventTypeNotSet must be defined as 0"); @@ -359,25 +359,25 @@ struct ChipDeviceEvent final struct { BLE_CONNECTION_OBJECT ConId; - } WoBLESubscribe; + } CHIPoBLESubscribe; struct { BLE_CONNECTION_OBJECT ConId; - } WoBLEUnsubscribe; + } CHIPoBLEUnsubscribe; struct { BLE_CONNECTION_OBJECT ConId; PacketBuffer * Data; - } WoBLEWriteReceived; + } CHIPoBLEWriteReceived; struct { BLE_CONNECTION_OBJECT ConId; - } WoBLEIndicateConfirm; + } CHIPoBLEIndicateConfirm; struct { BLE_CONNECTION_OBJECT ConId; CHIP_ERROR Reason; - } WoBLEConnectionError; + } CHIPoBLEConnectionError; struct { bool RoleChanged : 1; @@ -392,7 +392,7 @@ struct ChipDeviceEvent final struct { ActivityChange Result; - } WoBLEAdvertisingChange; + } CHIPoBLEAdvertisingChange; }; void Clear() { memset(this, 0, sizeof(*this)); } diff --git a/src/platform/include/CHIPDeviceLayer.h b/src/platform/include/CHIPDeviceLayer.h index 0385e74775c5c4..294e16a98e6abe 100644 --- a/src/platform/include/CHIPDeviceLayer.h +++ b/src/platform/include/CHIPDeviceLayer.h @@ -19,7 +19,6 @@ #define CHIP_DEVICE_H #include -// #include #include #include #include @@ -39,12 +38,6 @@ namespace chip { namespace DeviceLayer { struct chipDeviceEvent; -/* -using chip::FabricState; -using chip::MessageLayer; -using chip::ExchangeMgr; -using chip::SecurityMgr; -*/ extern chip::System::Layer SystemLayer; extern Inet::InetLayer InetLayer; diff --git a/src/platform/include/ConnectivityManager.h b/src/platform/include/ConnectivityManager.h index 3b846fad64a13f..21ad39be9cb44d 100644 --- a/src/platform/include/ConnectivityManager.h +++ b/src/platform/include/ConnectivityManager.h @@ -79,11 +79,11 @@ class ConnectivityManager kServiceTunnelMode_Enabled = 2, }; - enum WoBLEServiceMode + enum CHIPoBLEServiceMode { - kWoBLEServiceMode_NotSupported = 0, - kWoBLEServiceMode_Enabled = 1, - kWoBLEServiceMode_Disabled = 2, + kCHIPoBLEServiceMode_NotSupported = 0, + kCHIPoBLEServiceMode_Enabled = 1, + kCHIPoBLEServiceMode_Disabled = 2, }; enum ThreadDeviceType @@ -148,9 +148,9 @@ class ConnectivityManager // Service connectivity methods bool HaveServiceConnectivity(void); - // WoBLE service methods - WoBLEServiceMode GetWoBLEServiceMode(void); - CHIP_ERROR SetWoBLEServiceMode(WoBLEServiceMode val); + // CHIPoBLE service methods + CHIPoBLEServiceMode GetCHIPoBLEServiceMode(void); + CHIP_ERROR SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val); bool IsBLEAdvertisingEnabled(void); CHIP_ERROR SetBLEAdvertisingEnabled(bool val); bool IsBLEFastAdvertisingEnabled(void); @@ -170,7 +170,7 @@ class ConnectivityManager static const char * WiFiStationModeToStr(WiFiStationMode mode); static const char * WiFiAPModeToStr(WiFiAPMode mode); static const char * ServiceTunnelModeToStr(ServiceTunnelMode mode); - static const char * WoBLEServiceModeToStr(WoBLEServiceMode mode); + static const char * CHIPoBLEServiceModeToStr(CHIPoBLEServiceMode mode); private: @@ -446,14 +446,14 @@ inline bool ConnectivityManager::HaveServiceConnectivityViaThread(void) return static_cast(this)->_HaveServiceConnectivityViaThread(); } -inline ConnectivityManager::WoBLEServiceMode ConnectivityManager::GetWoBLEServiceMode(void) +inline ConnectivityManager::CHIPoBLEServiceMode ConnectivityManager::GetCHIPoBLEServiceMode(void) { - return static_cast(this)->_GetWoBLEServiceMode(); + return static_cast(this)->_GetCHIPoBLEServiceMode(); } -inline CHIP_ERROR ConnectivityManager::SetWoBLEServiceMode(WoBLEServiceMode val) +inline CHIP_ERROR ConnectivityManager::SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val) { - return static_cast(this)->_SetWoBLEServiceMode(val); + return static_cast(this)->_SetCHIPoBLEServiceMode(val); } inline bool ConnectivityManager::IsBLEAdvertisingEnabled(void) @@ -531,9 +531,9 @@ inline const char * ConnectivityManager::ServiceTunnelModeToStr(ServiceTunnelMod return ImplClass::_ServiceTunnelModeToStr(mode); } -inline const char * ConnectivityManager::WoBLEServiceModeToStr(WoBLEServiceMode mode) +inline const char * ConnectivityManager::CHIPoBLEServiceModeToStr(CHIPoBLEServiceMode mode) { - return ImplClass::_WoBLEServiceModeToStr(mode); + return ImplClass::_CHIPoBLEServiceModeToStr(mode); } inline CHIP_ERROR ConnectivityManager::Init(void) diff --git a/src/platform/include/ConnectivityManagerImpl.h b/src/platform/include/ConnectivityManagerImpl.h index d1853e8289e665..b61de9bc550e5c 100644 --- a/src/platform/include/ConnectivityManagerImpl.h +++ b/src/platform/include/ConnectivityManagerImpl.h @@ -20,7 +20,7 @@ #include #include -#if CHIP_DEVICE_CONFIG_ENABLE_WOBLE +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE #include #else #include @@ -49,7 +49,7 @@ namespace DeviceLayer { class ConnectivityManagerImpl final : public ConnectivityManager, public Internal::GenericConnectivityManagerImpl, -#if CHIP_DEVICE_CONFIG_ENABLE_WOBLE +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE public Internal::GenericConnectivityManagerImpl_BLE, #else public Internal::GenericConnectivityManagerImpl_NoBLE, diff --git a/src/platform/include/ThreadStackManager.h b/src/platform/include/ThreadStackManager.h index 610821c30e0184..33e385430dddbe 100644 --- a/src/platform/include/ThreadStackManager.h +++ b/src/platform/include/ThreadStackManager.h @@ -97,8 +97,8 @@ class ThreadStackManager CHIP_ERROR SetThreadPollingConfig(const ConnectivityManager::ThreadPollingConfig & pollingConfig); bool HaveMeshConnectivity(void); void OnMessageLayerActivityChanged(bool messageLayerIsActive); - void OnWoBLEAdvertisingStart(void); - void OnWoBLEAdvertisingStop(void); + void OnCHIPoBLEAdvertisingStart(void); + void OnCHIPoBLEAdvertisingStop(void); protected: @@ -252,14 +252,14 @@ inline void ThreadStackManager::OnMessageLayerActivityChanged(bool messageLayerI return static_cast(this)->_OnMessageLayerActivityChanged(messageLayerIsActive); } -inline void ThreadStackManager::OnWoBLEAdvertisingStart(void) +inline void ThreadStackManager::OnCHIPoBLEAdvertisingStart(void) { - static_cast(this)->_OnWoBLEAdvertisingStart(); + static_cast(this)->_OnCHIPoBLEAdvertisingStart(); } -inline void ThreadStackManager::OnWoBLEAdvertisingStop(void) +inline void ThreadStackManager::OnCHIPoBLEAdvertisingStop(void) { - static_cast(this)->_OnWoBLEAdvertisingStop(); + static_cast(this)->_OnCHIPoBLEAdvertisingStop(); } inline CHIP_ERROR ThreadStackManager::GetAndLogThreadStatsCounters(void) diff --git a/src/platform/include/internal/BLEManager.h b/src/platform/include/internal/BLEManager.h index 38e4b9e944bae1..c65c4b17c8a84d 100644 --- a/src/platform/include/internal/BLEManager.h +++ b/src/platform/include/internal/BLEManager.h @@ -24,7 +24,7 @@ #ifndef BLE_MANAGER_H #define BLE_MANAGER_H -#if CHIP_DEVICE_CONFIG_ENABLE_WOBLE +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE namespace chip { namespace DeviceLayer { @@ -33,10 +33,10 @@ namespace Internal { class BLEManagerImpl; /** - * Provides control over WoBLE services and connectivity for a chip device. + * Provides control over CHIPoBLE services and connectivity for a chip device. * * BLEManager defines the abstract interface of a singleton object that provides - * control over WoBLE services and connectivity for a chip device. BLEManager + * control over CHIPoBLE services and connectivity for a chip device. BLEManager * is an internal object that is used by other components with the chip Device * Layer, but is not directly accessible to the application. */ @@ -48,11 +48,11 @@ class BLEManager // ===== Members that define the internal interface of the BLEManager - using WoBLEServiceMode = ConnectivityManager::WoBLEServiceMode; + using CHIPoBLEServiceMode = ConnectivityManager::CHIPoBLEServiceMode; CHIP_ERROR Init(void); - WoBLEServiceMode GetWoBLEServiceMode(void); - CHIP_ERROR SetWoBLEServiceMode(WoBLEServiceMode val); + CHIPoBLEServiceMode GetCHIPoBLEServiceMode(void); + CHIP_ERROR SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val); bool IsAdvertisingEnabled(void); CHIP_ERROR SetAdvertisingEnabled(bool val); bool IsFastAdvertisingEnabled(void); @@ -115,14 +115,14 @@ inline CHIP_ERROR BLEManager::Init(void) return static_cast(this)->_Init(); } -inline BLEManager::WoBLEServiceMode BLEManager::GetWoBLEServiceMode(void) +inline BLEManager::CHIPoBLEServiceMode BLEManager::GetCHIPoBLEServiceMode(void) { - return static_cast(this)->_GetWoBLEServiceMode(); + return static_cast(this)->_GetCHIPoBLEServiceMode(); } -inline CHIP_ERROR BLEManager::SetWoBLEServiceMode(WoBLEServiceMode val) +inline CHIP_ERROR BLEManager::SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val) { - return static_cast(this)->_SetWoBLEServiceMode(val); + return static_cast(this)->_SetCHIPoBLEServiceMode(val); } inline bool BLEManager::IsAdvertisingEnabled(void) @@ -179,7 +179,7 @@ inline ::Ble::BleLayer * BLEManager::GetBleLayer(void) const } // namespace DeviceLayer } // namespace chip -#endif // CHIP_DEVICE_CONFIG_ENABLE_WOBLE +#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE #endif // BLE_MANAGER_H diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.h b/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.h index e5feeb8f4b4457..9e147ea35a3c99 100644 --- a/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.h +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.h @@ -53,8 +53,8 @@ class GenericConnectivityManagerImpl_BLE // ===== Methods that implement the ConnectivityManager abstract interface. - ConnectivityManager::WoBLEServiceMode _GetWoBLEServiceMode(void); - CHIP_ERROR _SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val); + ConnectivityManager::CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void); + CHIP_ERROR _SetCHIPoBLEServiceMode(ConnectivityManager::CHIPoBLEServiceMode val); bool _IsBLEAdvertisingEnabled(void); CHIP_ERROR _SetBLEAdvertisingEnabled(bool val); bool _IsBLEFastAdvertisingEnabled(void); @@ -63,7 +63,7 @@ class GenericConnectivityManagerImpl_BLE CHIP_ERROR _GetBLEDeviceName(char * buf, size_t bufSize); CHIP_ERROR _SetBLEDeviceName(const char * deviceName); uint16_t _NumBLEConnections(void); - static const char * _WoBLEServiceModeToStr(ConnectivityManager::WoBLEServiceMode mode); + static const char * _CHIPoBLEServiceModeToStr(ConnectivityManager::CHIPoBLEServiceMode mode); private: @@ -74,15 +74,15 @@ class GenericConnectivityManagerImpl_BLE extern template class GenericConnectivityManagerImpl_BLE; template -inline ConnectivityManager::WoBLEServiceMode GenericConnectivityManagerImpl_BLE::_GetWoBLEServiceMode(void) +inline ConnectivityManager::CHIPoBLEServiceMode GenericConnectivityManagerImpl_BLE::_GetCHIPoBLEServiceMode(void) { - return BLEMgr().GetWoBLEServiceMode(); + return BLEMgr().GetCHIPoBLEServiceMode(); } template -inline CHIP_ERROR GenericConnectivityManagerImpl_BLE::_SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val) +inline CHIP_ERROR GenericConnectivityManagerImpl_BLE::_SetCHIPoBLEServiceMode(ConnectivityManager::CHIPoBLEServiceMode val) { - return BLEMgr().SetWoBLEServiceMode(val); + return BLEMgr().SetCHIPoBLEServiceMode(val); } template diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.ipp b/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.ipp index 10d23ba8e85cea..d58d3711084edb 100644 --- a/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.ipp +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_BLE.ipp @@ -35,15 +35,15 @@ namespace Internal { template class GenericConnectivityManagerImpl_BLE; template -const char * GenericConnectivityManagerImpl_BLE::_WoBLEServiceModeToStr(ConnectivityManager::WoBLEServiceMode mode) +const char * GenericConnectivityManagerImpl_BLE::_CHIPoBLEServiceModeToStr(ConnectivityManager::CHIPoBLEServiceMode mode) { switch (mode) { - case ConnectivityManager::kWoBLEServiceMode_NotSupported: + case ConnectivityManager::kCHIPoBLEServiceMode_NotSupported: return "NotSupported"; - case ConnectivityManager::kWoBLEServiceMode_Enabled: + case ConnectivityManager::kCHIPoBLEServiceMode_Enabled: return "Disabled"; - case ConnectivityManager::kWoBLEServiceMode_Disabled: + case ConnectivityManager::kCHIPoBLEServiceMode_Disabled: return "Enabled"; default: return "(unknown)"; diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_NoBLE.h b/src/platform/include/internal/GenericConnectivityManagerImpl_NoBLE.h index 49e767450430c0..bef0797adda825 100644 --- a/src/platform/include/internal/GenericConnectivityManagerImpl_NoBLE.h +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_NoBLE.h @@ -40,9 +40,9 @@ namespace Internal { * For example: * * ``` - * if (ConnectivityMgr().GetWoBLEServiceMode() != ConnectivityManager::kWoBLEServiceMode_NotSupported) + * if (ConnectivityMgr().GetCHIPoBLEServiceMode() != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported) * { - * // ... do something on devices that support WoBLE ... + * // ... do something on devices that support CHIPoBLE ... * } * ``` */ @@ -53,8 +53,8 @@ class GenericConnectivityManagerImpl_NoBLE // ===== Methods that implement the ConnectivityManager abstract interface. - ConnectivityManager::WoBLEServiceMode _GetWoBLEServiceMode(void); - CHIP_ERROR _SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val); + ConnectivityManager::CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void); + CHIP_ERROR _SetCHIPoBLEServiceMode(ConnectivityManager::CHIPoBLEServiceMode val); bool _IsBLEAdvertisingEnabled(void); CHIP_ERROR _SetBLEAdvertisingEnabled(bool val); bool _IsBLEFastAdvertisingEnabled(void); @@ -62,7 +62,7 @@ class GenericConnectivityManagerImpl_NoBLE CHIP_ERROR _GetBLEDeviceName(char * buf, size_t bufSize); CHIP_ERROR _SetBLEDeviceName(const char * deviceName); uint16_t _NumBLEConnections(void); - static const char * _WoBLEServiceModeToStr(ConnectivityManager::WoBLEServiceMode mode); + static const char * _CHIPoBLEServiceModeToStr(ConnectivityManager::CHIPoBLEServiceMode mode); private: @@ -70,13 +70,13 @@ class GenericConnectivityManagerImpl_NoBLE }; template -inline ConnectivityManager::WoBLEServiceMode GenericConnectivityManagerImpl_NoBLE::_GetWoBLEServiceMode(void) +inline ConnectivityManager::CHIPoBLEServiceMode GenericConnectivityManagerImpl_NoBLE::_GetCHIPoBLEServiceMode(void) { - return ConnectivityManager::kWoBLEServiceMode_NotSupported; + return ConnectivityManager::kCHIPoBLEServiceMode_NotSupported; } template -inline CHIP_ERROR GenericConnectivityManagerImpl_NoBLE::_SetWoBLEServiceMode(ConnectivityManager::WoBLEServiceMode val) +inline CHIP_ERROR GenericConnectivityManagerImpl_NoBLE::_SetCHIPoBLEServiceMode(ConnectivityManager::CHIPoBLEServiceMode val) { return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } @@ -124,7 +124,7 @@ inline uint16_t GenericConnectivityManagerImpl_NoBLE::_NumBLEConnecti } template -inline const char * GenericConnectivityManagerImpl_NoBLE::_WoBLEServiceModeToStr(ConnectivityManager::WoBLEServiceMode mode) +inline const char * GenericConnectivityManagerImpl_NoBLE::_CHIPoBLEServiceModeToStr(ConnectivityManager::CHIPoBLEServiceMode mode) { return NULL; } diff --git a/src/platform/include/internal/GenericConnectivityManagerImpl_NoTunnel.h b/src/platform/include/internal/GenericConnectivityManagerImpl_NoTunnel.h index 213d65147b2f97..ee6940f560a19a 100644 --- a/src/platform/include/internal/GenericConnectivityManagerImpl_NoTunnel.h +++ b/src/platform/include/internal/GenericConnectivityManagerImpl_NoTunnel.h @@ -40,7 +40,7 @@ namespace Internal { * For example: * * ``` - * if (ConnectivityMgr().GetServiceTunnelMode() != ConnectivityManager::kWoBLEServiceMode_NotSupported) + * if (ConnectivityMgr().GetServiceTunnelMode() != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported) * { * // ... do something on devices that support service tunnels ... * }