Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / platform / Darwin / BLEManagerImpl.h
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *
5  *    Licensed under the Apache License, Version 2.0 (the "License");
6  *    you may not use this file except in compliance with the License.
7  *    You may obtain a copy of the License at
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *    Unless required by applicable law or agreed to in writing, software
12  *    distributed under the License is distributed on an "AS IS" BASIS,
13  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *    See the License for the specific language governing permissions and
15  *    limitations under the License.
16  */
17
18 /**
19  *    @file
20  *          Provides an implementation of the BLEManager singleton object
21  *          for the Darwin platforms.
22  */
23
24 #pragma once
25
26 #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
27
28 namespace chip {
29 namespace DeviceLayer {
30 namespace Internal {
31
32 using namespace chip::Ble;
33
34 /**
35  * Concrete implementation of the BLEManagerImpl singleton object for the Darwin platforms.
36  */
37 class BLEManagerImpl final : public BLEManager, private BleLayer
38 {
39     // Allow the BLEManager interface class to delegate method calls to
40     // the implementation methods provided by this class.
41     friend BLEManager;
42
43 public:
44     CHIP_ERROR ConfigureBle(uint32_t aNodeId, bool aIsCentral) { return CHIP_NO_ERROR; }
45
46 private:
47     // ===== Members that implement the BLEManager internal interface.
48
49     CHIP_ERROR _Init(void);
50     CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void);
51     CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val);
52     bool _IsAdvertisingEnabled(void);
53     CHIP_ERROR _SetAdvertisingEnabled(bool val);
54     bool _IsAdvertising(void);
55     CHIP_ERROR _SetAdvertisingMode(BLEAdvertisingMode mode);
56     CHIP_ERROR _GetDeviceName(char * buf, size_t bufSize);
57     CHIP_ERROR _SetDeviceName(const char * deviceName);
58     uint16_t _NumConnections(void);
59     void _OnPlatformEvent(const ChipDeviceEvent * event);
60     BleLayer * _GetBleLayer(void);
61
62     // ===== Members for internal use by the following friends.
63
64     friend BLEManager & BLEMgr(void);
65     friend BLEManagerImpl & BLEMgrImpl(void);
66
67     static BLEManagerImpl sInstance;
68 };
69
70 /**
71  * Returns a reference to the public interface of the BLEManager singleton object.
72  *
73  * Internal components should use this to access features of the BLEManager object
74  * that are common to all platforms.
75  */
76 inline BLEManager & BLEMgr(void)
77 {
78     return BLEManagerImpl::sInstance;
79 }
80
81 /**
82  * Returns the platform-specific implementation of the BLEManager singleton object.
83  *
84  * Internal components can use this to gain access to features of the BLEManager
85  * that are specific to the Darwin platforms.
86  */
87 inline BLEManagerImpl & BLEMgrImpl(void)
88 {
89     return BLEManagerImpl::sInstance;
90 }
91
92 } // namespace Internal
93 } // namespace DeviceLayer
94 } // namespace chip
95
96 #endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE