RDK Documentation (Open Sourced RDK Components)
XrdkBlueTooth.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 /**
21  * @file XrdkBlueTooth.h
22  * @brief The header file provides components Xrdk SDCard information APIs.
23  */
24 
25 /**
26  * @defgroup TR69_HOSTIF_STBSERVICES_SDCARD TR-069 Object (Device.STBServices.{i}.Components.XrdkSDCard.{i})
27  * @par External rdk SDCard
28  * @ingroup TR69_HOSTIF_STBSERVICES
29  *
30  * @defgroup TR69_HOSTIF_STBSERVICES_SDCARD_API TR-069 Object (Device.STBServices.{i}.Components.XrdkSDCard.{i}) Public APIs
31  * Describe the details about RDK TR-069 components XRDK_SDK APIs specifications.
32  * @ingroup TR69_HOSTIF_STBSERVICES_SDCARD
33  *
34  * @defgroup TR69_HOSTIF_STBSERVICES_SDCARD_CLASSES TR-069 Object (Device.STBServices.{i}.Components.XrdkSDCard.{i}) Public Classes
35  * Describe the details about classes used in TR069 components XRDK_SDCARD.
36  * @ingroup TR69_HOSTIF_STBSERVICES_SDCARD
37  */
38 
39 /**
40 * @defgroup tr69hostif
41 * @{
42 * @defgroup hostif
43 * @{
44 **/
45 
46 #ifndef X_RDKCENTRAL_COM_XBLUETOOTH_H_
47 #define X_RDKCENTRAL_COM_XBLUETOOTH_H_
48 
49 #ifdef USE_XRDK_BT_PROFILE
50 
51 #include "hostIf_utils.h"
52 #include "hostIf_tr69ReqHandler.h"
53 #include "hostIf_updateHandler.h"
54 #include "hostIf_main.h"
55 #include <mutex>
56 extern "C" {
57 #include "btmgr.h"
58 }
59 
60 #define X_BT_ROOT_OBJ "Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth."
61 #define BT_ENABLE_STRING "enable"
62 #define BT_DISCOVERY_ENABLED_STRING "DiscoveryEnabled"
63 #define BT_DISCOVERY_DEVICE_CNT_STRING "DiscoveredDeviceCnt"
64 #define BT_PAIRED_DEVICE_CNT_STRING "PairedDeviceCnt"
65 #define BT_CONNECTED_DEVICE_CNT_STRING "ConnectedDeviceCnt"
66 #define BT_LIMIT_BEACON_DETECTION_STRING "LimitBeaconDetection"
67 
68 #define X_BT_DISCOVERED_DEV_OBJ "Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DiscoveredDevice"
69 #define X_BT_PAIRED_DEV_OBJ "Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.PairedDevice"
70 #define X_BT_CONNECTED_DEV_OBJ "Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.ConnectedDevice"
71 #define X_BT_DEVICEINFO_OBJ "Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DeviceInfo"
72 #define X_BT_LIMITBEACONDETECTION_OBJ "Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.LimitBeaconDetection"
73 
74 #ifdef BLE_TILE_PROFILE
75 //#define X_BT_BLE_TILE_OBJ "Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.BLE.Tile"
76 #define BT_TILE_ID_STRING "BLE.Tile.Ring.Id"
77 #define BT_TILE_SESSION_ID_STRING "BLE.Tile.Ring.SessionId"
78 #define BT_TILE_TRIGGER_STRING "BLE.Tile.Ring.Trigger"
79 #define BT_TILE_CMD_REQUEST_STRING "BLE.Tile.Cmd.Request"
80 #define BT_TILE_CMD_NOTIFY_STRING "BLE.Tile.Cmd.Notify"
81 #endif
82 
83 #define BT_DEV_NAME_STRING "Name"
84 #define BT_DEV_DEVICE_ID_STRING "DeviceID"
85 #define BT_DEV_LOWENERGYENABLED_STRING "LowEnergyEnabled"
86 #define BT_DEV_ACTIVE_STRING "Active"
87 #define BT_DEV_CONNECTED_STRING "Connected"
88 #define BT_DEV_DEVICE_TYPE_STRING "DeviceType"
89 #define BT_DEV_PAIRED_STRING "Paired"
90 
91 #define BT_DEV_GETDEVICEINFO_STRING "GetDeviceInfo"
92 #define BT_DEV_INFO_DEVICE_ID_STRING "DeviceInfo.DeviceID"
93 #define BT_DEV_INFO_PROFILE_STRING "DeviceInfo.Profile"
94 #define BT_DEV_INFO_MAC_STRING "DeviceInfo.MAC"
95 #define BT_DEV_INFO_MANUFACTURER_STRING "DeviceInfo.Manufacturer"
96 #define BT_DEV_INFO_RSSI_STRING "DeviceInfo.RSSI"
97 #define BT_DEV_INFO_SIGNALLEVEL_STRING "DeviceInfo.SignalStrength"
98 
99 /**
100  * @brief This class provides the TR-069 components Bluetooth devices information.
101  * @ingroup TR69_HOSTIF_X_RDKCENTRAL-COM_xBlueTooth_CLASSES
102  */
103 class hostIf_DeviceInfoRdk_xBT
104 {
105 private:
106  hostIf_DeviceInfoRdk_xBT();
107  ~hostIf_DeviceInfoRdk_xBT() {};
108 
109  static std::mutex m;
110 
111  static hostIf_DeviceInfoRdk_xBT* m_instance;
112  static int noOfDiscoveredDevice;
113  static int noOfPairedDevice;
114  static int noOfConnectedDevices;
115 
116  static BTRMGR_DiscoveredDevicesList_t disDevList;
117  static BTRMGR_PairedDevicesList_t pairedDevList;
118  static BTRMGR_ConnectedDevicesList_t connectedDevList;
119 
120  static updateCallback mUpdateCallback;
121 
122  string tile_Id;
123  string sessionId;
124  bool triggerFlag;
125  int do_Ring_A_Tile(bool );
126  int process_TileCmdRequest(HOSTIF_MsgData_t *stMsgData);
127 
128  int isEnabled(HOSTIF_MsgData_t *);
129  int isDiscoveryEnabled(HOSTIF_MsgData_t *);
130  int getDiscoveredDeviceCnt(HOSTIF_MsgData_t *);
131  int getPairedDeviceCnt(HOSTIF_MsgData_t *);
132  int getConnectedDeviceCnt(HOSTIF_MsgData_t *);
133 
134  /* Discovered Device Methods */
135  int getDiscoveredDevice_Name(HOSTIF_MsgData_t *);
136  int getDiscoveredDevice_Profile(HOSTIF_MsgData_t *);
137  int getDiscoveredDevice_MAC(HOSTIF_MsgData_t *);
138  int getDiscoveredDevice_DeviceID(HOSTIF_MsgData_t *);
139  int getDiscoveredDevice_Manufacturer(HOSTIF_MsgData_t *);
140  int getDiscoveredDevice_Connected(HOSTIF_MsgData_t *);
141  int getDiscoveredDevice_DeviceType(HOSTIF_MsgData_t *);
142  int getDiscoveredDevice_Paired(HOSTIF_MsgData_t *);
143 
144 
145  /* Paired Device Methods */
146  int getPairedDevice_Name(HOSTIF_MsgData_t *);
147  int getPairedDevice_Profile(HOSTIF_MsgData_t *);
148  int getPairedDevice_MAC(HOSTIF_MsgData_t *);
149  int getPairedDevice_Manufacturer(HOSTIF_MsgData_t *);
150  int getPairedDevice_Connected(HOSTIF_MsgData_t *);
151  int getPairedDevice_DeviceType(HOSTIF_MsgData_t *);
152  int getPairedDevice_DeviceID(HOSTIF_MsgData_t *);
153 
154  /* Connected Device methods */
155  int getConnectedDevice_Name(HOSTIF_MsgData_t *);
156  int getConnectedDevice_Active(HOSTIF_MsgData_t *);
157  int getConnectedDevice_DeviceType(HOSTIF_MsgData_t *);
158  int getConnectedDevice_DeviceID(HOSTIF_MsgData_t *);
159 
160  /* DeviceInfo methods */
161  int getDeviceInfo_DeviceID(HOSTIF_MsgData_t *);
162  int getDeviceInfo_Manufacturer(HOSTIF_MsgData_t *);
163  int getDeviceInfo_Profile(HOSTIF_MsgData_t *);
164  int getDeviceInfo_MAC(HOSTIF_MsgData_t *);
165  int getDeviceInfo_SignalLevel(HOSTIF_MsgData_t *);
166  int getDeviceInfo_RSSI(HOSTIF_MsgData_t *);
167 
168  int getDeviceInfo(HOSTIF_MsgData_t *);
169  int setDeviceInfo(HOSTIF_MsgData_t *);
170 
171 #ifdef BLE_TILE_PROFILE
172  int getLimitBeaconDetection(HOSTIF_MsgData_t *);
173  int setLimitBeaconDetection(HOSTIF_MsgData_t *);
174 #endif
175 
176  static void fetch_Bluetooth_DiscoveredDevicesList();
177  static void fetch_Bluetooth_PairedDevicesList();
178  static void fetch_Bluetooth_ConnectedDevicesList();
179 
180  void notifyValueChangeEvent(updateCallback mUpdateCallback);
181 
182 public:
183  static void reset();
184  static hostIf_DeviceInfoRdk_xBT *getInstance();
185  static void closeInstance();
186  int handleGetMsg(HOSTIF_MsgData_t *);
187  int handleSetMsg(HOSTIF_MsgData_t *);
188 
189  static void registerUpdateCallback(updateCallback cb);
190  static void checkForUpdates();
191 };
192 
193 #endif /*#USE_XRDK_BLUETOOTH_PROFILE*/
194 #endif /* X_RDKCENTRAL_COM_XBLUETOOTH_H_ */
195 
196 
197 /** @} */
198 /** @} */
_HostIf_MsgData_t
Definition: hostIf_tr69ReqHandler.h:170
btmgr.h
hostIf_main.h
hostIf_main API.
_BTRMGR_PairedDevicesList_t
Represents the list of paired devices.
Definition: btmgr.h:476
_BTRMGR_ConnectedDevicesList_t
Represents the connected devices list.
Definition: btmgr.h:468
_BTRMGR_DiscoveredDevicesList_t
Represents the list of scanned devices.
Definition: btmgr.h:484