3 * Copyright (c) 2020 Project CHIP Authors
4 * Copyright (c) 2018 Nest Labs, Inc.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 * Provides an implementation of the BLEManager singleton object
22 * for Darwin platforms.
24 #include <platform/internal/CHIPDeviceLayerInternal.h>
26 #include <ble/CHIPBleServiceData.h>
27 #include <platform/Darwin/BleApplicationDelegate.h>
28 #include <platform/Darwin/BleConnectionDelegate.h>
29 #include <platform/Darwin/BlePlatformDelegate.h>
30 #include <support/logging/CHIPLogging.h>
34 #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
36 using namespace ::chip;
37 using namespace ::chip::Ble;
40 namespace DeviceLayer {
43 BLEManagerImpl BLEManagerImpl::sInstance;
45 CHIP_ERROR BLEManagerImpl::_Init()
49 ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
51 // Initialize the Chip BleLayer.
52 BleApplicationDelegateImpl * appDelegate = new BleApplicationDelegateImpl();
53 BleConnectionDelegateImpl * connDelegate = new BleConnectionDelegateImpl();
54 BlePlatformDelegateImpl * platformDelegate = new BlePlatformDelegateImpl();
55 err = BleLayer::Init(platformDelegate, connDelegate, appDelegate, &SystemLayer);
59 ConnectivityManager::CHIPoBLEServiceMode BLEManagerImpl::_GetCHIPoBLEServiceMode(void)
61 ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
62 return ConnectivityManager::kCHIPoBLEServiceMode_NotSupported;
65 CHIP_ERROR BLEManagerImpl::_SetCHIPoBLEServiceMode(ConnectivityManager::CHIPoBLEServiceMode val)
67 ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
68 return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
71 bool BLEManagerImpl::_IsAdvertisingEnabled(void)
73 ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
77 CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val)
79 ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
80 return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
83 CHIP_ERROR BLEManagerImpl::_SetAdvertisingMode(BLEAdvertisingMode mode)
85 ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
86 return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
89 bool BLEManagerImpl::_IsAdvertising(void)
91 ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
95 CHIP_ERROR BLEManagerImpl::_GetDeviceName(char * buf, size_t bufSize)
97 ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
98 return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
101 CHIP_ERROR BLEManagerImpl::_SetDeviceName(const char * deviceName)
103 ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
104 return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
107 BleLayer * BLEManagerImpl::_GetBleLayer()
112 uint16_t BLEManagerImpl::_NumConnections(void)
114 ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
118 void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
120 ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
123 } // namespace Internal
124 } // namespace DeviceLayer
127 #endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE