Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / platform / Darwin / BLEManagerImpl.cpp
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *    Copyright (c) 2018 Nest Labs, Inc.
5  *
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
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  */
18
19 /**
20  *    @file
21  *          Provides an implementation of the BLEManager singleton object
22  *          for Darwin platforms.
23  */
24 #include <platform/internal/CHIPDeviceLayerInternal.h>
25
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>
31
32 #include <new>
33
34 #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
35
36 using namespace ::chip;
37 using namespace ::chip::Ble;
38
39 namespace chip {
40 namespace DeviceLayer {
41 namespace Internal {
42
43 BLEManagerImpl BLEManagerImpl::sInstance;
44
45 CHIP_ERROR BLEManagerImpl::_Init()
46 {
47     CHIP_ERROR err;
48
49     ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
50
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);
56     return err;
57 }
58
59 ConnectivityManager::CHIPoBLEServiceMode BLEManagerImpl::_GetCHIPoBLEServiceMode(void)
60 {
61     ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
62     return ConnectivityManager::kCHIPoBLEServiceMode_NotSupported;
63 }
64
65 CHIP_ERROR BLEManagerImpl::_SetCHIPoBLEServiceMode(ConnectivityManager::CHIPoBLEServiceMode val)
66 {
67     ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
68     return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
69 }
70
71 bool BLEManagerImpl::_IsAdvertisingEnabled(void)
72 {
73     ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
74     return false;
75 }
76
77 CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val)
78 {
79     ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
80     return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
81 }
82
83 CHIP_ERROR BLEManagerImpl::_SetAdvertisingMode(BLEAdvertisingMode mode)
84 {
85     ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
86     return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
87 }
88
89 bool BLEManagerImpl::_IsAdvertising(void)
90 {
91     ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
92     return false;
93 }
94
95 CHIP_ERROR BLEManagerImpl::_GetDeviceName(char * buf, size_t bufSize)
96 {
97     ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
98     return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
99 }
100
101 CHIP_ERROR BLEManagerImpl::_SetDeviceName(const char * deviceName)
102 {
103     ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
104     return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
105 }
106
107 BleLayer * BLEManagerImpl::_GetBleLayer()
108 {
109     return this;
110 }
111
112 uint16_t BLEManagerImpl::_NumConnections(void)
113 {
114     ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
115     return 0;
116 }
117
118 void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
119 {
120     ChipLogDetail(DeviceLayer, "%s", __FUNCTION__);
121 }
122
123 } // namespace Internal
124 } // namespace DeviceLayer
125 } // namespace chip
126
127 #endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE