RDK Documentation (Open Sourced RDK Components)
XrdkBlueTooth.cpp
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.cpp
22  * @brief This source file contains the APIs for getting bluetooth device information.
23  */
24 
25 /**
26  * @file XrdkBlueTooth.cpp
27  *
28  * @brief DeviceInfo X_RDKCENTRAL-COM_xBlueTooth API Implementation.
29  *
30  * This is the implementation of the DeviceInfo API.
31  *
32  * @par Document
33  * TBD Relevant design or API documentation.
34  *
35  */
36 
37 
38 /*****************************************************************************
39  * STANDARD INCLUDE FILES
40  *****************************************************************************/
41 
42 
43 /**
44 * @defgroup tr69hostif
45 * @{
46 * @defgroup hostif
47 * @{
48 **/
49 
50 #ifdef USE_XRDK_BT_PROFILE
51 
52 #include "XrdkBlueTooth.h"
53 #include <mutex>
54 
55 #include "btmgr.h"
56 
57 #ifdef BLE_TILE_PROFILE
58 #include "lemgr_iarm_interface.h"
59 #include "hostIf_NotificationHandler.h"
60 #endif
61 
62 
63 BTRMGR_DiscoveredDevicesList_t hostIf_DeviceInfoRdk_xBT::disDevList;
64 BTRMGR_PairedDevicesList_t hostIf_DeviceInfoRdk_xBT::pairedDevList;
65 BTRMGR_ConnectedDevicesList_t hostIf_DeviceInfoRdk_xBT::connectedDevList;
66 
67 static BTRMGR_DevicesProperty_t deviceProperty;
68 static BTRMgrDeviceHandle handle_devInfo = 0;
69 
70 std::mutex hostIf_DeviceInfoRdk_xBT::m;
71 hostIf_DeviceInfoRdk_xBT* hostIf_DeviceInfoRdk_xBT::m_instance = NULL;
72 
73 #define BTRMGR_QUERY_INTERVAL 5
74 
75 int hostIf_DeviceInfoRdk_xBT::noOfDiscoveredDevice=0;
76 int hostIf_DeviceInfoRdk_xBT::noOfPairedDevice=0;
77 int hostIf_DeviceInfoRdk_xBT::noOfConnectedDevices=0;
78 
79 updateCallback hostIf_DeviceInfoRdk_xBT::mUpdateCallback = NULL;
80 
81 hostIf_DeviceInfoRdk_xBT* hostIf_DeviceInfoRdk_xBT::getInstance()
82 {
83  if(!m_instance)
84  {
85  try {
86  m_instance = new hostIf_DeviceInfoRdk_xBT();
87  } catch(const std::exception& e)
88  {
89  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s:%d] xBlueTooth: Caught exception \" %s\"\n", __FUNCTION__, __LINE__, e.what());
90  }
91  }
92  return m_instance;
93 }
94 
95 
96 void hostIf_DeviceInfoRdk_xBT::closeInstance()
97 {
98  if(m_instance)
99  {
100  delete m_instance;
101  }
102 }
103 
104 
105 void hostIf_DeviceInfoRdk_xBT::reset()
106 {
107  std::lock_guard<std::mutex> lg(m);
108 
109  noOfDiscoveredDevice = 0;
110  noOfPairedDevice = 0;
111  noOfConnectedDevices = 0;
112 }
113 
114 
115 /**
116  * @brief Class default Constructor.
117  */
118 hostIf_DeviceInfoRdk_xBT::hostIf_DeviceInfoRdk_xBT()
119 {
120  this->tile_Id="";
121  this->sessionId="";
122  this->triggerFlag = false;
123 }
124 
125 /**
126  * @brief This function set the bluetooth profile attributes
127  *
128  *
129  * @param[in] stMsgData HostIf Message Request param contains the attribute value.
130  *
131  * @return Returns an Integer value.
132  * @ingroup TR69_HOSTIF_X_RDKCENTRAL-COM_xBlueTooth_API
133  */
134 int hostIf_DeviceInfoRdk_xBT::handleSetMsg(HOSTIF_MsgData_t *stMsgData)
135 {
136  int ret = NOT_HANDLED;
137  const char *path = NULL, *paramName = NULL, *tblAttName = NULL;
138  int index = 0;
139  std::lock_guard<std::mutex> lg(m);
140 
141  try {
142  int str_len = strlen(X_BT_ROOT_OBJ);
143  path = stMsgData->paramName;
144 
145  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering... \n", __FUNCTION__, __LINE__);
146 
147  if(NULL == path) {
148  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed : Parameter is NULL, %s \n", __FUNCTION__, __LINE__, path);
149  stMsgData->faultCode = fcInvalidParameterName;
150  return ret;
151  }
152 
153  if((strncasecmp(path, X_BT_ROOT_OBJ, str_len) != 0)) {
154  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed due to Mismatch parameter path : %s \n", __FUNCTION__, __LINE__, path);
155  stMsgData->faultCode = fcInvalidParameterName;
156  return ret;
157  }
158  const char *tmp_ptr = strchr(path+str_len-1,'.');
159  if(tmp_ptr == NULL) {
160  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Parameter is NULL \n", __FUNCTION__, __LINE__);
161  stMsgData->faultCode = fcInvalidParameterName;
162  return ret;
163  }
164 
165  tmp_ptr++;
166  paramName = tmp_ptr;
167  if (strncasecmp(paramName, BT_DEV_GETDEVICEINFO_STRING, strlen(BT_DEV_GETDEVICEINFO_STRING)) == 0)
168  {
169  ret = setDeviceInfo(stMsgData);
170  }
171 #ifdef BLE_TILE_PROFILE
172  else if (strncasecmp(paramName, BT_LIMIT_BEACON_DETECTION_STRING, strlen(BT_LIMIT_BEACON_DETECTION_STRING)) == 0)
173  {
174  ret = setLimitBeaconDetection(stMsgData);
175  }
176  else if (strncasecmp(paramName, BT_TILE_ID_STRING, strlen(BT_TILE_ID_STRING)) == 0)
177  {
178  this->tile_Id = stMsgData->paramValue;
179  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]]xBlueTooth: :Set for parameters %s and value %s. \n", __FUNCTION__, __LINE__, stMsgData->paramName, stMsgData->paramValue);
180  ret = OK;
181  }
182  else if (strncasecmp(paramName, BT_TILE_SESSION_ID_STRING, strlen(BT_TILE_SESSION_ID_STRING)) == 0)
183  {
184  this->sessionId = stMsgData->paramValue;
185  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]]xBlueTooth: :Set for parameters %s and value %s. \n", __FUNCTION__, __LINE__, stMsgData->paramName, stMsgData->paramValue);
186  ret = OK;
187  }
188  else if (strncasecmp(paramName, BT_TILE_TRIGGER_STRING, strlen(BT_TILE_TRIGGER_STRING)) == 0)
189  {
190  bool triggerFlag = get_boolean(stMsgData->paramValue);
191  RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF,"[%s:%d]]xBlueTooth: :Set for parameters %s and value %d. \n", __FUNCTION__, __LINE__, stMsgData->paramName, triggerFlag);
192 
193  if(triggerFlag == true && (!tile_Id.empty())) // && !sessionId.empty() ))
194  {
195  this->triggerFlag = triggerFlag;
196  RDK_LOG(RDK_LOG_INFO,LOG_TR69HOSTIF,"[%s:%d]]xBlueTooth: :Trigger Ring a tile. \n", __FUNCTION__, __LINE__);
197  this->do_Ring_A_Tile(triggerFlag);
198  ret = OK;
199  }
200  else {
201  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]]xBlueTooth::Empty tile Id or session id. Please set these parameters first. \n", __FUNCTION__, __LINE__);
202  }
203  }
204  else if (strncasecmp(paramName, BT_TILE_CMD_REQUEST_STRING, strlen(BT_TILE_CMD_REQUEST_STRING))== 0)
205  {
206  ret = process_TileCmdRequest(stMsgData);
207  }
208  else if (strncasecmp(paramName, BT_TILE_CMD_NOTIFY_STRING, strlen(BT_TILE_CMD_NOTIFY_STRING))== 0)
209  {
210  // NOTE: this parameter is for internal use only and meant to be set only using an IARM call from BT LE mgr.
211  // It has not been added to the data model.
212  // If parameter validation is performed for IARM set calls, control will never reach here
213  NotificationHandler::getInstance()->pushKeyValueNotification("event:BLE_TILE_RING_NOTIFICATION", "cmd_notify", stMsgData->paramValue);
214  }
215 #endif
216  else
217  {
218  stMsgData->faultCode = fcInvalidParameterName;
219  ret = NOT_HANDLED;
220  }
221  }
222  catch (const std::exception& e )
223  {
224  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exception caught %s \n", __FUNCTION__, __LINE__, e.what());
225  stMsgData->faultCode = fcInternalError;
226  return NOK;
227  }
228  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
229 
230  return ret;
231 }
232 
233 /**
234  * @brief This function get the bluetooth attributes such as name, profile, count and others
235  * for paired and connected devices..
236  *
237  * @param[in] stMsgData HostIf Message Request param contains the external SD Card attribute value.
238  *
239  * @return Returns an Integer value.
240  * @retval 0 If successfully get the attribute values.
241  * @retval -1 If failed and Not able to get.
242  * @retval -2 If Not handle the requested attribute.
243  * @ingroup TR69_HOSTIF_X_RDKCENTRAL-COM_xBlueTooth_API
244  */
245 int hostIf_DeviceInfoRdk_xBT::handleGetMsg(HOSTIF_MsgData_t *stMsgData)
246 {
247  int ret = NOT_HANDLED;
248  const char *path = NULL, *paramName = NULL, *tblAttName = NULL;
249  int index = 0;
250  std::lock_guard<std::mutex> lg(m);
251 
252  try {
253  int str_len = strlen(X_BT_ROOT_OBJ);
254  path = stMsgData->paramName;
255 
256  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering... \n", __FUNCTION__, __LINE__);
257 
258  if(NULL == path) {
259  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed : Parameter is NULL, %s \n", __FUNCTION__, __LINE__, path);
260  return ret;
261  }
262 
263  if((strncasecmp(path, X_BT_ROOT_OBJ, str_len) != 0)) {
264  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed due to Mismatch parameter path : %s \n", __FUNCTION__, __LINE__, path);
265  return ret;
266  }
267  const char *tmp_ptr = strchr(path+str_len-1,'.');
268  if(tmp_ptr == NULL) {
269  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Parameter is NULL \n", __FUNCTION__, __LINE__);
270  return ret;
271  }
272 
273  tmp_ptr++;
274  paramName = tmp_ptr;
275  if (strncasecmp(paramName, BT_ENABLE_STRING, strlen(BT_ENABLE_STRING)) == 0)
276  {
277  ret = isEnabled(stMsgData);
278  }
279  else if (strncasecmp(paramName, BT_DISCOVERY_ENABLED_STRING, strlen(BT_DISCOVERY_ENABLED_STRING)) == 0)
280  {
281  ret = isDiscoveryEnabled(stMsgData);
282  }
283  else if (strncasecmp(paramName, BT_DISCOVERY_DEVICE_CNT_STRING, strlen(BT_DISCOVERY_DEVICE_CNT_STRING)) == 0)
284  {
285  ret = getDiscoveredDeviceCnt(stMsgData);
286  }
287  else if (strncasecmp(paramName, BT_PAIRED_DEVICE_CNT_STRING, strlen(BT_PAIRED_DEVICE_CNT_STRING)) == 0)
288  {
289  ret = getPairedDeviceCnt(stMsgData);
290  }
291  else if (strncasecmp(paramName, BT_CONNECTED_DEVICE_CNT_STRING, strlen(BT_CONNECTED_DEVICE_CNT_STRING)) == 0)
292  {
293  ret = getConnectedDeviceCnt(stMsgData);
294  }
295  /*For profile: Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DeviceInfo.*/
296  else if (strncasecmp(paramName, BT_DEV_GETDEVICEINFO_STRING, strlen(BT_DEV_GETDEVICEINFO_STRING)) == 0)
297  {
298  ret = getDeviceInfo(stMsgData);
299  }
300  else if (strncasecmp(paramName, BT_DEV_INFO_DEVICE_ID_STRING, strlen(BT_DEV_INFO_DEVICE_ID_STRING)) == 0)
301  {
302  ret = getDeviceInfo_DeviceID(stMsgData);
303  }
304  else if (strncasecmp(paramName, BT_DEV_INFO_MANUFACTURER_STRING, strlen(BT_DEV_INFO_MANUFACTURER_STRING)) == 0)
305  {
306  ret = getDeviceInfo_Manufacturer(stMsgData);
307  }
308  else if (strncasecmp(paramName, BT_DEV_INFO_PROFILE_STRING, strlen(BT_DEV_INFO_PROFILE_STRING)) == 0)
309  {
310  ret = getDeviceInfo_Profile(stMsgData);
311  }
312  else if (strncasecmp(paramName, BT_DEV_INFO_MAC_STRING, strlen(BT_DEV_INFO_MAC_STRING)) == 0)
313  {
314  ret = getDeviceInfo_MAC(stMsgData);
315  }
316  else if (strncasecmp(paramName, BT_DEV_INFO_SIGNALLEVEL_STRING, strlen(BT_DEV_INFO_SIGNALLEVEL_STRING)) == 0)
317  {
318  ret = getDeviceInfo_SignalLevel(stMsgData);
319  }
320  else if (strncasecmp(paramName, BT_DEV_INFO_RSSI_STRING, strlen(BT_DEV_INFO_RSSI_STRING)) == 0)
321  {
322  ret = getDeviceInfo_RSSI(stMsgData);
323  }
324 #ifdef BLE_TILE_PROFILE
325  else if (strncasecmp(paramName, BT_LIMIT_BEACON_DETECTION_STRING, strlen(BT_LIMIT_BEACON_DETECTION_STRING)) == 0)
326  {
327  ret = getLimitBeaconDetection(stMsgData);
328  }
329  else if (strncasecmp(paramName, BT_TILE_ID_STRING, strlen(BT_TILE_ID_STRING)) == 0)
330  {
331  snprintf(stMsgData->paramValue, (TR69HOSTIFMGR_MAX_PARAM_LEN -1), "%s", this->tile_Id.c_str());
332  RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: :Parameter name : \"%s \"and value \"%d\". \n", __FUNCTION__, __LINE__, stMsgData->paramName, this->triggerFlag);
333  stMsgData->paramtype=hostIf_StringType;
334  ret = OK;
335  }
336  else if (strncasecmp(paramName, BT_TILE_SESSION_ID_STRING, strlen(BT_TILE_SESSION_ID_STRING)) == 0)
337  {
338  snprintf(stMsgData->paramValue, (TR69HOSTIFMGR_MAX_PARAM_LEN -1), "%s", this->sessionId.c_str());
339  RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: :Parameter name : \"%s \"and value \"%d\". \n", __FUNCTION__, __LINE__, stMsgData->paramName, this->triggerFlag);
340  stMsgData->paramtype=hostIf_StringType;
341  ret = OK;
342  }
343  else if (strncasecmp(paramName, BT_TILE_TRIGGER_STRING, strlen(BT_TILE_TRIGGER_STRING)) == 0)
344  {
345  put_boolean(stMsgData->paramValue, this->triggerFlag);
346  RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: :Parameter name : \"%s \"and value \"%d\". \n", __FUNCTION__, __LINE__, stMsgData->paramName, this->triggerFlag);
347  stMsgData->paramtype=hostIf_BooleanType;
348  ret = OK;
349  }
350 #endif
351  /* For Discovered Devices */
352  else if(matchComponent(stMsgData->paramName, X_BT_DISCOVERED_DEV_OBJ, &tblAttName, index))
353  {
354  stMsgData->instanceNum = index;
355  if (strcasecmp(tblAttName, BT_DEV_NAME_STRING) == 0)
356  {
357  ret = getDiscoveredDevice_Name(stMsgData);
358  }
359  else if (strcasecmp(tblAttName, BT_DEV_DEVICE_ID_STRING) == 0)
360  {
361  ret = getDiscoveredDevice_DeviceID(stMsgData);
362  }
363  else if (strcasecmp(tblAttName, BT_DEV_DEVICE_TYPE_STRING) == 0)
364  {
365  ret = getDiscoveredDevice_DeviceType(stMsgData);
366  }
367  else if (strcasecmp(tblAttName, BT_DEV_PAIRED_STRING) == 0)
368  {
369  ret = getDiscoveredDevice_Paired(stMsgData);
370  }
371  else if (strcasecmp(tblAttName, BT_DEV_CONNECTED_STRING) == 0)
372  {
373  ret = getDiscoveredDevice_Connected (stMsgData);
374  }
375  else
376  {
377  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Parameter \'%s\' is Not Supported \n", __FUNCTION__, __LINE__, stMsgData->paramName);
378  stMsgData->faultCode = fcInvalidParameterName;
379  ret = NOK;
380  }
381  }
382  /* For Paired Devices */
383  else if(matchComponent(stMsgData->paramName, X_BT_PAIRED_DEV_OBJ, &tblAttName, index))
384  {
385  stMsgData->instanceNum = index;
386  if (strcasecmp(tblAttName, BT_DEV_NAME_STRING) == 0)
387  {
388  ret = getPairedDevice_Name(stMsgData);
389  }
390  else if (strcasecmp(tblAttName, BT_DEV_DEVICE_ID_STRING) == 0)
391  {
392  ret = getPairedDevice_DeviceID(stMsgData);
393  }
394  else if (strcasecmp(tblAttName, BT_DEV_CONNECTED_STRING) == 0)
395  {
396  ret = getPairedDevice_Connected (stMsgData);
397  }
398  else if (strcasecmp(tblAttName, BT_DEV_DEVICE_TYPE_STRING) == 0)
399  {
400  ret = getPairedDevice_DeviceType(stMsgData);
401  }
402  else
403  {
404  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Parameter \'%s\' is Not Supported \n", __FUNCTION__, __LINE__, stMsgData->paramName);
405  stMsgData->faultCode = fcInvalidParameterName;
406  ret = NOK;
407  }
408  }
409  /* For Connected Devices */
410  else if(matchComponent(stMsgData->paramName, X_BT_CONNECTED_DEV_OBJ, &tblAttName, index))
411  {
412  stMsgData->instanceNum = index;
413 
414  if (strcasecmp(tblAttName, BT_DEV_NAME_STRING) == 0)
415  {
416  ret = getConnectedDevice_Name(stMsgData);
417  }
418  else if (strcasecmp(tblAttName, BT_DEV_DEVICE_ID_STRING) == 0)
419  {
420  ret = getConnectedDevice_DeviceID(stMsgData);
421  }
422  else if (strcasecmp(tblAttName, BT_DEV_DEVICE_TYPE_STRING) == 0)
423  {
424  ret = getConnectedDevice_DeviceType(stMsgData);
425  }
426  else if (strcasecmp(tblAttName, BT_DEV_ACTIVE_STRING) == 0)
427  {
428  ret = getConnectedDevice_Active(stMsgData);
429  }
430  else
431  {
432  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Parameter \'%s\' is Not Supported \n", __FUNCTION__, __LINE__, stMsgData->paramName);
433  stMsgData->faultCode = fcInvalidParameterName;
434  ret = NOK;
435  }
436  }
437  else
438  {
439  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Parameter \'%s\' is Not Supported \n", __FUNCTION__, __LINE__, paramName);
440  stMsgData->faultCode = fcInvalidParameterName;
441  ret = NOK;
442  }
443  }
444  catch (const std::exception& e )
445  {
446  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exception caught %s \n", __FUNCTION__, __LINE__, e.what());
447  stMsgData->faultCode = fcInternalError;
448  return NOK;
449  }
450  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
451  return ret;
452 }
453 
454 
455 
456 /************************************************************
457  * Description : Get the 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.enable' status.
458  * 'true(1)' if enabled or 'false(0)'
459  * Precondition : Bluetooth stack should be present.
460  * Input :
461 
462  * Return : OK -> Success
463  NOK -> Failure
464  value -> 0: false
465  -> 1: true
466 ************************************************************/
467 int hostIf_DeviceInfoRdk_xBT::isEnabled(HOSTIF_MsgData_t *stMsgData)
468 {
469  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
470 
471  try {
472  /* BLUETOOTH_DISABLED, BLUETOOTH_ENABLED, BLUETOOTH_INPUT_ENABLED */
473  unsigned char power_status = 0;
474  if(BTRMGR_RESULT_SUCCESS == BTRMGR_GetAdapterPowerStatus (0, &power_status) && 0 != power_status) {
475  strncpy(stMsgData->paramValue, "BLUETOOTH_ENABLED", TR69HOSTIFMGR_MAX_PARAM_LEN);
476  RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,"[%s]xBlueTooth: Successfully get BTRMGR_GetAdapterPowerStatus (%u), so BLUETOOTH_ENABLED. \n",
477  __FUNCTION__, power_status);
478  }
479  else {
480  strncpy(stMsgData->paramValue, "BLUETOOTH_DISABLED", TR69HOSTIFMGR_MAX_PARAM_LEN);
481  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed in get BTRMGR_GetAdapterPowerStatus, so BLUETOOTH_DISABLED. \n", __FUNCTION__, __LINE__);
482  }
483  } catch (const std::exception& e) {
484  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exception : %s\r\n",__FUNCTION__, __LINE__, e.what());
485  return NOK;
486  }
487  stMsgData->paramtype=hostIf_StringType;
488  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
489  return OK;
490 }
491 
492 
493 /************************************************************
494  * Description : Get the 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DiscoveryEnabled' status.
495  * 'true(1)' if enabled or 'false(0)'
496  * Precondition : Bluetooth stack should be present.
497  * Input :
498 
499  * Return : OK -> Success
500  NOK -> Failure
501  value -> 0: false
502  -> 1: true
503 ************************************************************/
504 int hostIf_DeviceInfoRdk_xBT::isDiscoveryEnabled(HOSTIF_MsgData_t *stMsgData)
505 {
506  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
507  bool isDisEnable = false;
508 
509  try {
510  unsigned char isDiscoverable = 0;
511  isDisEnable = (BTRMGR_RESULT_SUCCESS == BTRMGR_IsAdapterDiscoverable(0, &isDiscoverable) && isDiscoverable == 1)? true:false;
512  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: isDiscoveryEnabled : %d \n",
513  __FUNCTION__, isDisEnable);
514  } catch (const std::exception& e) {
515  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exception : %s\r\n",__FUNCTION__, __LINE__, e.what());
516  return NOK;
517  }
518  put_boolean(stMsgData->paramValue, isDisEnable);
519  stMsgData->paramtype=hostIf_BooleanType;
520  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
521  return OK;
522 }
523 
524 
525 /************************************************************
526  * Description : Number of discovered devices and get the
527  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DiscoveredDeviceCnt' value.
528  *
529  * Precondition : Bluetooth stack should be present.
530  * Input :
531 
532  * Return : OK -> Success
533  NOK -> Failure
534  value -> 1..N
535  -> 0: Not discovered
536 ************************************************************/
537 int hostIf_DeviceInfoRdk_xBT::getDiscoveredDeviceCnt(HOSTIF_MsgData_t *stMsgData)
538 {
539  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
540  int disDevCount = 0;
541 
542  put_int(stMsgData->paramValue, disDevList.m_numOfDevices);
543  stMsgData->paramtype=hostIf_UnsignedIntType;
544  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
545  return OK;
546 }
547 
548 
549 /************************************************************
550  * Description : Number of Paired devices and get the
551  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.PairedDeviceCnt' value.
552  *
553  * Precondition : Bluetooth stack should be present.
554  * Input :
555 
556  * Return : OK -> Success
557  NOK -> Failure
558  value -> 1..N
559  -> 0: Not paired
560 ************************************************************/
561 int hostIf_DeviceInfoRdk_xBT::getPairedDeviceCnt(HOSTIF_MsgData_t *stMsgData)
562 {
563  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
564 
565  put_int(stMsgData->paramValue, pairedDevList.m_numOfDevices);
566  stMsgData->paramtype=hostIf_UnsignedIntType;
567  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
568  return OK;
569 }
570 
571 
572 /************************************************************
573  * Description : Number of Connected devices and get the
574  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.ConnectedDeviceCnt' value.
575  *
576  * Precondition : Bluetooth stack should be present.
577  * Input :
578 
579  * Return : OK -> Success
580  NOK -> Failure
581  value -> 1..N
582  -> 0: Not Connected devices
583 ************************************************************/
584 int hostIf_DeviceInfoRdk_xBT::getConnectedDeviceCnt(HOSTIF_MsgData_t *stMsgData)
585 {
586  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
587 
588  put_int(stMsgData->paramValue, connectedDevList.m_numOfDevices);
589  stMsgData->paramtype=hostIf_UnsignedIntType;
590  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
591  return OK;
592 }
593 
594 
595 /************************************************************
596  * Description : Name of discovered devices and get the
597  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DiscoveredDevice.{i}.Name' value.
598  *
599  * Precondition : Bluetooth stack should be present.
600  * Input :
601 
602  * Return : OK -> Success
603  NOK -> Failure
604  value -> Name of the discovered devices
605 ************************************************************/
606 int hostIf_DeviceInfoRdk_xBT::getDiscoveredDevice_Name(HOSTIF_MsgData_t *stMsgData)
607 {
608  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
609 
610  stMsgData->paramtype=hostIf_StringType;
611 
612  try {
613  int devIndex = stMsgData->instanceNum;
614  if((devIndex && disDevList.m_numOfDevices) && (devIndex <= disDevList.m_numOfDevices)) {
615  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Discovered Devices (index : %d) Name is \'%s\'.\n", __FUNCTION__, devIndex-1, disDevList.m_deviceProperty[devIndex-1].m_name);
616  strncpy(stMsgData->paramValue, disDevList.m_deviceProperty[devIndex-1].m_name, TR69HOSTIFMGR_MAX_PARAM_LEN);
617  }
618  else
619  {
620  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
621  return NOK;
622  }
623  } catch (const std::exception& e) {
624  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
625  return NOK;
626  }
627 
628  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
629  return OK;
630 }
631 
632 /************************************************************
633  * Description : MAC of Discovered devices and get the
634  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DiscoveredDevice.{i}.MAC' value.
635  *
636  * Precondition : Bluetooth stack should be present.
637  * Input :
638 
639  * Return : OK -> Success
640  NOK -> Failure
641  value -> Mac of the DiscoveredDevice devices
642 ************************************************************/
643 int hostIf_DeviceInfoRdk_xBT::getDiscoveredDevice_MAC(HOSTIF_MsgData_t *stMsgData) {
644  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
645 
646  try {
647  int devIndex = stMsgData->instanceNum;
648  if((devIndex && disDevList.m_numOfDevices) && (devIndex <= disDevList.m_numOfDevices)) {
649 
650  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Discovered Devices (index : %d) MAC is \'%s\'.\n", __FUNCTION__, devIndex-1, disDevList.m_deviceProperty[devIndex-1].m_deviceAddress);
651  strncpy(stMsgData->paramValue, disDevList.m_deviceProperty[devIndex-1].m_deviceAddress, TR69HOSTIFMGR_MAX_PARAM_LEN);
652  }
653  else
654  {
655  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
656  return NOK;
657  }
658  } catch (const std::exception& e) {
659  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
660  return NOK;
661  }
662  stMsgData->paramtype=hostIf_StringType;
663  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
664  return OK;
665 }
666 
667 /************************************************************
668  * Description : DeviceType of Discovered devices and get the
669  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DiscoveredDevice.{i}.DeviceType' value.
670  *
671  * Precondition : Bluetooth stack should be present.
672  * Input :
673 
674  * Return : OK -> Success
675  NOK -> Failure
676  value -> Device Type of the DiscoveredDevice devices
677 ************************************************************/
678 int hostIf_DeviceInfoRdk_xBT::getDiscoveredDevice_DeviceType(HOSTIF_MsgData_t *stMsgData) {
679  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
680 
681  try {
682  int devIndex = stMsgData->instanceNum;
683  if((devIndex && disDevList.m_numOfDevices) && (devIndex <= disDevList.m_numOfDevices)) {
684  const char *pType = BTRMGR_GetDeviceTypeAsString (disDevList.m_deviceProperty[devIndex-1].m_deviceType);
685  if (pType)
686  {
687  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Discovered Devices (index : %d) device type is \'%s\'.\n", __FUNCTION__, devIndex-1, pType);
688  strncpy(stMsgData->paramValue, pType, sizeof(stMsgData->paramValue) -1); //CID:136537 - Buffer size warning
689  stMsgData->paramValue[sizeof(stMsgData->paramValue) -1] = '\0';
690  }
691  else
692  {
693  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth:Failed; Null Name\r\n",__FUNCTION__);
694  return NOK;
695  }
696  }
697  else
698  {
699  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
700  return NOK;
701  }
702  } catch (const std::exception& e) {
703  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
704  return NOK;
705  }
706  stMsgData->paramtype=hostIf_StringType;
707  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
708  return OK;
709 }
710 
711 /************************************************************
712  * Description : Paired status of Discovered devices and get the
713  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DiscoveredDevice.{i}.Paired' value.
714  *
715  * Precondition : Bluetooth stack should be present.
716  * Input :
717 
718  * Return : OK -> Success
719  NOK -> Failure
720  value -> Pair status of the DiscoveredDevice devices
721 ************************************************************/
722 int hostIf_DeviceInfoRdk_xBT::getDiscoveredDevice_Paired(HOSTIF_MsgData_t *stMsgData) {
723  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
724 
725  try {
726  int devIndex = stMsgData->instanceNum;
727  if((devIndex && disDevList.m_numOfDevices) && (devIndex <= disDevList.m_numOfDevices)) {
728  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Discovered Devices (index : %d) Pairing status is \'%d\'.\n", __FUNCTION__, devIndex-1, disDevList.m_deviceProperty[devIndex-1].m_isPairedDevice);
729  put_boolean(stMsgData->paramValue, disDevList.m_deviceProperty[devIndex-1].m_isPairedDevice);
730  }
731  else
732  {
733  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
734  return NOK;
735  }
736  } catch (const std::exception& e) {
737  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
738  return NOK;
739  }
740  stMsgData->paramtype=hostIf_BooleanType;
741  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
742  return OK;
743 }
744 
745 /************************************************************
746  * Description : Manufacturer of Discovered devices and get the
747  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DiscoveredDevice.{i}.DeviceID' value.
748  *
749  * Precondition : Bluetooth stack should be present.
750  * Input :
751 
752  * Return : OK -> Success
753  NOK -> Failure
754  value -> Manufacturer of the Discovered devices
755 ************************************************************/
756 int hostIf_DeviceInfoRdk_xBT::getDiscoveredDevice_DeviceID(HOSTIF_MsgData_t *stMsgData) {
757  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
758 
759  try {
760  int devIndex = stMsgData->instanceNum;
761  stMsgData->paramtype = hostIf_StringType;
762 
763  if((devIndex) && (devIndex <= disDevList.m_numOfDevices)) {
764  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Discovered Devices (index : %d) DeviceID is \'%llu\'.\n", __FUNCTION__, devIndex-1, disDevList.m_deviceProperty[devIndex-1].m_deviceHandle);
765  memset(stMsgData->paramValue, '\0', TR69HOSTIFMGR_MAX_PARAM_LEN);
766  sprintf(stMsgData->paramValue, "%llu", disDevList.m_deviceProperty[devIndex-1].m_deviceHandle);
767  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Discovered Devices (index : %d) Convert DeviceID is \'%s\'.\n", __FUNCTION__, devIndex-1, stMsgData->paramValue);
768 
769  }
770  else
771  {
772  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
773  return NOK;
774  }
775  } catch (const std::exception& e) {
776  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
777  return NOK;
778  }
779 
780  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
781  return OK;
782 }
783 
784 
785 /************************************************************
786  * Description : Manufacturer of Discovered devices and get the
787  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DiscoveredDevice.{i}.Manufacturer' value.
788  *
789  * Precondition : Bluetooth stack should be present.
790  * Input :
791 
792  * Return : OK -> Success
793  NOK -> Failure
794  value -> Manufacturer of the Discovered devices
795 ************************************************************/
796 int hostIf_DeviceInfoRdk_xBT::getDiscoveredDevice_Manufacturer(HOSTIF_MsgData_t *stMsgData) {
797  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
798 
799  try {
800  int devIndex = stMsgData->instanceNum;
801  if((devIndex && disDevList.m_numOfDevices) && (devIndex <= disDevList.m_numOfDevices)) {
802  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Discovered Devices (index : %d) Manufacturer is \'%d\'.\n", __FUNCTION__, devIndex-1, disDevList.m_deviceProperty[devIndex-1].m_vendorID);
803  put_int(stMsgData->paramValue, disDevList.m_deviceProperty[devIndex-1].m_vendorID);
804  }
805  else
806  {
807  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
808  return NOK;
809  }
810  } catch (const std::exception& e) {
811  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
812  return NOK;
813  }
814  stMsgData->paramtype=hostIf_UnsignedIntType;
815  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
816  return OK;
817 }
818 
819 /************************************************************
820  * Description : Connected Status of Discovered devices and get the
821  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DiscoveredDevice.{i}.Connected' value.
822  *
823  * Precondition : Bluetooth stack should be present.
824  * Input :
825 
826  * Return : OK -> Success
827  NOK -> Failure
828  value -> Connected Status of the Discovered devices
829 ************************************************************/
830 int hostIf_DeviceInfoRdk_xBT::getDiscoveredDevice_Connected(HOSTIF_MsgData_t *stMsgData)
831 {
832  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
833  BTRMGR_DevicesProperty_t deviceProperty;
834  memset (&deviceProperty, 0, sizeof (deviceProperty));
835  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
836 
837  try {
838  int devIndex = stMsgData->instanceNum;
839  if((devIndex && disDevList.m_numOfDevices) && (devIndex <= disDevList.m_numOfDevices)) {
840 
841  /* Get the signal level */
842  rc = BTRMGR_GetDeviceProperties(0, disDevList.m_deviceProperty[devIndex-1].m_deviceHandle, &deviceProperty);
843  if (BTRMGR_RESULT_SUCCESS != rc)
844  {
845  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed at BTRMGR \r\n",__FUNCTION__, __LINE__);
846  } //CID:97330 - checked return
847  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Discovered Devices (index : %d) Connection Status is \'%d\'.\n", __FUNCTION__, devIndex-1, deviceProperty.m_isConnected);
848 
849  put_boolean(stMsgData->paramValue, deviceProperty.m_isConnected);
850  }
851  else
852  {
853  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
854  return NOK;
855  }
856  } catch (const std::exception& e) {
857  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
858  return NOK;
859  }
860  stMsgData->paramtype=hostIf_BooleanType;
861  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
862  return OK;
863 }
864 
865 
866 
867 /************************************************************
868  * Description : Name of paired devices and get the
869  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.PairedDevice.{i}.Name' value.
870  *
871  * Precondition : Bluetooth stack should be present.
872  * Input :
873 
874  * Return : OK -> Success
875  NOK -> Failure
876  value -> Name of the paired devices
877 ************************************************************/
878 int hostIf_DeviceInfoRdk_xBT::getPairedDevice_Name(HOSTIF_MsgData_t *stMsgData)
879 {
880  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
881 
882  try {
883  int devIndex = stMsgData->instanceNum;
884  if((devIndex && pairedDevList.m_numOfDevices) && (devIndex <= pairedDevList.m_numOfDevices)) {
885  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Paired Devices (index : %d) Name is \'%s\'.\n", __FUNCTION__, devIndex-1, pairedDevList.m_deviceProperty[devIndex-1].m_name);
886  memset(stMsgData->paramValue, '\0', TR69HOSTIFMGR_MAX_PARAM_LEN);
887  strncpy(stMsgData->paramValue, pairedDevList.m_deviceProperty[devIndex-1].m_name, TR69HOSTIFMGR_MAX_PARAM_LEN);
888  }
889  else
890  {
891  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
892  return NOK;
893  }
894  } catch (const std::exception& e) {
895  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
896  return NOK;
897  }
898  stMsgData->paramtype=hostIf_StringType;
899  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
900  return OK;
901 }
902 
903 /************************************************************
904  * Description : Profile of Paired devices and get the
905  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.PairedDevice.{i}.Profile' value.
906  *
907  * Precondition : Bluetooth stack should be present.
908  * Input :
909 
910  * Return : OK -> Success
911  NOK -> Failure
912  value -> Name of the paired devices
913 ************************************************************/
914 int hostIf_DeviceInfoRdk_xBT::getPairedDevice_Profile(HOSTIF_MsgData_t *stMsgData) {
915  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
916 
917  try {
918  int devIndex = stMsgData->instanceNum;
919  char serviceInfo[TR69HOSTIFMGR_MAX_PARAM_LEN];
920  memset (&serviceInfo, '\0', sizeof(serviceInfo));
921  if((devIndex && pairedDevList.m_numOfDevices) && (devIndex <= pairedDevList.m_numOfDevices)) {
922  for (int i = 0; i < pairedDevList.m_deviceProperty[devIndex-1].m_serviceInfo.m_numOfService; i++)
923  {
924  strcat(serviceInfo, pairedDevList.m_deviceProperty[devIndex-1].m_serviceInfo.m_profileInfo[i].m_profile);
925  if ( (i + 1) < pairedDevList.m_deviceProperty[devIndex-1].m_serviceInfo.m_numOfService)
926  strcat(serviceInfo, ",");
927  }
928 
929  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Paired Devices (index : %d) profile is \'%s\'.\n", __FUNCTION__, devIndex-1, serviceInfo);
930  memset(stMsgData->paramValue, '\0', TR69HOSTIFMGR_MAX_PARAM_LEN);
931  strncpy(stMsgData->paramValue, serviceInfo, sizeof(stMsgData->paramValue) -1); //CID:136585 - Buffer size warning
932  stMsgData->paramValue[sizeof(stMsgData->paramValue) -1] = '\0';
933  }
934  else
935  {
936  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
937  return NOK;
938  }
939  } catch (const std::exception& e) {
940  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
941  return NOK;
942  }
943  stMsgData->paramtype=hostIf_StringType;
944  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
945  return OK;
946 }
947 
948 /************************************************************
949  * Description : MAC of Paired devices and get the
950  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.PairedDevice.{i}.MAC' value.
951  *
952  * Precondition : Bluetooth stack should be present.
953  * Input :
954 
955  * Return : OK -> Success
956  NOK -> Failure
957  value -> Mac of the paired devices
958 ************************************************************/
959 int hostIf_DeviceInfoRdk_xBT::getPairedDevice_MAC(HOSTIF_MsgData_t *stMsgData)
960 {
961  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
962 
963  try {
964  int devIndex = stMsgData->instanceNum;
965  if((devIndex && pairedDevList.m_numOfDevices) && (devIndex <= pairedDevList.m_numOfDevices)) {
966  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Paired Devices (index : %d) MAC is \'%s\'.\n", __FUNCTION__, devIndex-1, pairedDevList.m_deviceProperty[devIndex-1].m_deviceAddress);
967  memset(stMsgData->paramValue, '\0', TR69HOSTIFMGR_MAX_PARAM_LEN);
968  strncpy(stMsgData->paramValue, pairedDevList.m_deviceProperty[devIndex-1].m_deviceAddress, TR69HOSTIFMGR_MAX_PARAM_LEN);
969  }
970  else
971  {
972  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
973  return NOK;
974  }
975  } catch (const std::exception& e) {
976  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
977  return NOK;
978  }
979  stMsgData->paramtype=hostIf_StringType;
980  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
981  return OK;
982 }
983 
984 /************************************************************
985  * Description : Manufacturer of Paired devices and get the
986  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.PairedDevice.{i}.Manufacturer' value.
987  *
988  * Precondition : Bluetooth stack should be present.
989  * Input :
990 
991  * Return : OK -> Success
992  NOK -> Failure
993  value -> Manufacturer of the paired devices
994 ************************************************************/
995 int hostIf_DeviceInfoRdk_xBT::getPairedDevice_Manufacturer(HOSTIF_MsgData_t *stMsgData)
996 {
997  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
998 
999  try {
1000  int devIndex = stMsgData->instanceNum;
1001  if((devIndex && pairedDevList.m_numOfDevices) && (devIndex <= pairedDevList.m_numOfDevices)) {
1002  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Paired Devices (index : %d) Manufacturer is \'%d\'.\n", __FUNCTION__, devIndex-1, pairedDevList.m_deviceProperty[devIndex-1].m_vendorID);
1003  put_int(stMsgData->paramValue, pairedDevList.m_deviceProperty[devIndex-1].m_vendorID);
1004  }
1005  else
1006  {
1007  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
1008  return NOK;
1009  }
1010  } catch (const std::exception& e) {
1011  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
1012  return NOK;
1013  }
1014  stMsgData->paramtype=hostIf_UnsignedIntType;
1015  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1016  return OK;
1017 }
1018 
1019 
1020 /************************************************************
1021  * Description : Manufacturer of Paired devices and get the
1022  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.PairedDevice.{i}.DeviceID' value.
1023  *
1024  * Precondition : Bluetooth stack should be present.
1025  * Input :
1026 
1027  * Return : OK -> Success
1028  NOK -> Failure
1029  value -> DeviceID of the paired devices
1030 ************************************************************/
1031 int hostIf_DeviceInfoRdk_xBT::getPairedDevice_DeviceID(HOSTIF_MsgData_t *stMsgData)
1032 {
1033  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1034 
1035  try {
1036  int devIndex = stMsgData->instanceNum;
1037  stMsgData->paramtype = hostIf_StringType;
1038 
1039  if((devIndex && pairedDevList.m_numOfDevices) && (devIndex <= pairedDevList.m_numOfDevices)) {
1040  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Paired Devices (index : %d) DeviceID is \'%llu\'.\n", __FUNCTION__, devIndex-1, pairedDevList.m_deviceProperty[devIndex-1].m_deviceHandle);
1041  memset(stMsgData->paramValue, '\0', TR69HOSTIFMGR_MAX_PARAM_LEN);
1042  sprintf(stMsgData->paramValue, "%llu", pairedDevList.m_deviceProperty[devIndex-1].m_deviceHandle);
1043  }
1044  else
1045  {
1046  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
1047  return NOK;
1048  }
1049  } catch (const std::exception& e) {
1050  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
1051  return NOK;
1052  }
1053 
1054  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1055  return OK;
1056 }
1057 
1058 
1059 /************************************************************
1060  * Description : Connected Status of Paired devices and get the
1061  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.PairedDevice.{i}.Connected' value.
1062  *
1063  * Precondition : Bluetooth stack should be present.
1064  * Input :
1065 
1066  * Return : OK -> Success
1067  NOK -> Failure
1068  value -> Connected Status of the paired devices
1069 ************************************************************/
1070 int hostIf_DeviceInfoRdk_xBT::getPairedDevice_Connected(HOSTIF_MsgData_t *stMsgData)
1071 {
1072  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1073 
1074  try {
1075  int devIndex = stMsgData->instanceNum;
1076  if((devIndex && pairedDevList.m_numOfDevices) && (devIndex <= pairedDevList.m_numOfDevices)) {
1077  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Paired Devices (index : %d) Connection status is \'%d\'.\n", __FUNCTION__, devIndex-1, pairedDevList.m_deviceProperty[devIndex-1].m_isConnected);
1078  put_boolean(stMsgData->paramValue, pairedDevList.m_deviceProperty[devIndex-1].m_isConnected);
1079  }
1080  else
1081  {
1082  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
1083  return NOK;
1084  }
1085  } catch (const std::exception& e) {
1086  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
1087  return NOK;
1088  }
1089  stMsgData->paramtype=hostIf_BooleanType;
1090  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1091  return OK;
1092 }
1093 
1094 /************************************************************
1095  * Description : DeviceType of Paired devices and get the
1096  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.PairedDevice.{i}.DeviceType' value.
1097  *
1098  * Precondition : Bluetooth stack should be present.
1099  * Input :
1100 
1101  * Return : OK -> Success
1102  NOK -> Failure
1103  value -> Device Type of the Paired devices
1104 ************************************************************/
1105 int hostIf_DeviceInfoRdk_xBT::getPairedDevice_DeviceType(HOSTIF_MsgData_t *stMsgData)
1106 {
1107  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1108 
1109  try {
1110  int devIndex = stMsgData->instanceNum;
1111  if((devIndex && pairedDevList.m_numOfDevices) && (devIndex <= pairedDevList.m_numOfDevices)) {
1112  const char *pType = BTRMGR_GetDeviceTypeAsString (pairedDevList.m_deviceProperty[devIndex-1].m_deviceType);
1113  if (pType)
1114  {
1115  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Paired Devices (index : %d) device type is \'%s\'.\n", __FUNCTION__, devIndex-1, pType);
1116  strncpy(stMsgData->paramValue, pType, sizeof(stMsgData->paramValue) -1); //CID:136581 - Buffer size warning
1117  stMsgData->paramValue[sizeof(stMsgData->paramValue) -1] = '\0';
1118  }
1119  else
1120  {
1121  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed; Null Name\r\n",__FUNCTION__);
1122  return NOK;
1123  }
1124  }
1125  else
1126  {
1127  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
1128  return NOK;
1129  }
1130  } catch (const std::exception& e) {
1131  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
1132  return NOK;
1133  }
1134  stMsgData->paramtype=hostIf_StringType;
1135  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1136  return OK;
1137 }
1138 
1139 /************************************************************
1140  * Description : Name of Connected devices and get the
1141  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.ConnectedDevice.{i}.Name' value.
1142  *
1143  * Precondition : Bluetooth stack should be present.
1144  * Input :
1145 
1146  * Return : OK -> Success
1147  NOK -> Failure
1148  value -> Name of the paired devices
1149 ************************************************************/
1150 int hostIf_DeviceInfoRdk_xBT::getConnectedDevice_Name(HOSTIF_MsgData_t *stMsgData)
1151 {
1152  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1153 
1154  try {
1155  int devIndex = stMsgData->instanceNum;
1156  if((devIndex && connectedDevList.m_numOfDevices) && (devIndex <= connectedDevList.m_numOfDevices)) {
1157  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Connected Devices (index : %d) profile is \'%s\'.\n", __FUNCTION__, devIndex-1, connectedDevList.m_deviceProperty[devIndex-1].m_name);
1158  strncpy(stMsgData->paramValue, connectedDevList.m_deviceProperty[devIndex-1].m_name, TR69HOSTIFMGR_MAX_PARAM_LEN);
1159  }
1160  else
1161  {
1162  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
1163  return NOK;
1164  }
1165  } catch (const std::exception& e) {
1166  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
1167  return NOK;
1168  }
1169  stMsgData->paramtype=hostIf_StringType;
1170  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1171  return OK;
1172 }
1173 
1174 
1175 
1176 /************************************************************
1177  * Description : LowEnergyEnabled of Connected devices and get the
1178  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.ConnectedDevice.{i}.LowEnergyEnabled' value.
1179  *
1180  * Precondition : Bluetooth stack should be present.
1181  * Input :
1182 
1183  * Return : OK -> Success
1184  NOK -> Failure
1185  value -> LowEnergyEnabled of the connected devices
1186 ************************************************************/
1187 #if 0 // Not required
1188 int hostIf_DeviceInfoRdk_xBT::getConnectedDevice_LowEnergyEnabled(HOSTIF_MsgData_t *stMsgData)
1189 {
1190  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1191 
1192  try {
1193  int devIndex = stMsgData->instanceNum;
1194  if((devIndex && connectedDevList.m_numOfDevices) && (devIndex <= connectedDevList.m_numOfDevices)) {
1195  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Connected Device (index : %d) IsLowEnergyEnabled \'%d\'.\n", __FUNCTION__, devIndex-1, connectedDevList.m_deviceProperty[devIndex-1].m_isLowEnergyDevice);
1196  put_int(stMsgData->paramValue, connectedDevList.m_deviceProperty[devIndex-1].m_isLowEnergyDevice);
1197  }
1198  else
1199  {
1200  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
1201  return NOK;
1202  }
1203  } catch (const std::exception& e) {
1204  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
1205  return NOK;
1206  }
1207  stMsgData->paramtype=hostIf_UnsignedIntType;
1208  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1209  return OK;
1210 }
1211 #endif
1212 
1213 /************************************************************
1214  * Description : Active state of Connected devices and get the
1215  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.ConnectedDevice.{i}.Active' value.
1216  *
1217  * Precondition : Bluetooth stack should be present.
1218  * Input :
1219 
1220  * Return : OK -> Success
1221  NOK -> Failure
1222  value -> Active state of the connected devices
1223 ************************************************************/
1224 int hostIf_DeviceInfoRdk_xBT::getConnectedDevice_Active(HOSTIF_MsgData_t *stMsgData)
1225 {
1226  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1227 
1228  try {
1229  int devIndex = stMsgData->instanceNum;
1230  if((devIndex && connectedDevList.m_numOfDevices) && (devIndex <= connectedDevList.m_numOfDevices)) {
1231  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Connected Device (index : %d) active status \'%d\'.\n", __FUNCTION__, devIndex-1, connectedDevList.m_deviceProperty[devIndex-1].m_powerStatus);
1232  if (BTRMGR_DEVICE_POWER_ACTIVE == connectedDevList.m_deviceProperty[devIndex-1].m_powerStatus)
1233  strncpy(stMsgData->paramValue, "ACTIVE", TR69HOSTIFMGR_MAX_PARAM_LEN);
1234  else if (BTRMGR_DEVICE_POWER_LOW == connectedDevList.m_deviceProperty[devIndex-1].m_powerStatus)
1235  strncpy(stMsgData->paramValue, "LOW_POWER", TR69HOSTIFMGR_MAX_PARAM_LEN);
1236  else if (BTRMGR_DEVICE_POWER_STANDBY == connectedDevList.m_deviceProperty[devIndex-1].m_powerStatus)
1237  strncpy(stMsgData->paramValue, "STANDBY", TR69HOSTIFMGR_MAX_PARAM_LEN);
1238  else
1239  strncpy(stMsgData->paramValue, "UNKNOWN", TR69HOSTIFMGR_MAX_PARAM_LEN);
1240  }
1241  else
1242  {
1243  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
1244  return NOK;
1245  }
1246  } catch (const std::exception& e) {
1247  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
1248  return NOK;
1249  }
1250  stMsgData->paramtype=hostIf_StringType;
1251  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1252  return OK;
1253 }
1254 
1255 
1256 /************************************************************
1257 * Description : Manufacturer of Connected devices and get the
1258  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DeviceInfo.Manufacturer' value.
1259  *
1260  * Precondition : Bluetooth stack should be present.
1261  * Input :
1262 
1263  * Return : OK -> Success
1264  NOK -> Failure
1265  value -> DeviceID of the DeviceInfo
1266 ************************************************************/
1267 int hostIf_DeviceInfoRdk_xBT::getDeviceInfo_DeviceID(HOSTIF_MsgData_t *stMsgData)
1268 {
1269  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1270 
1271  try {
1272  stMsgData->paramtype = hostIf_StringType;;
1273  if(handle_devInfo) {
1274  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: The Device ID is \'%llu\'.\n", __FUNCTION__, __LINE__, deviceProperty.m_deviceHandle);
1275  memset(stMsgData->paramValue, '\0', TR69HOSTIFMGR_MAX_PARAM_LEN);
1276  sprintf(stMsgData->paramValue,"%llu",deviceProperty.m_deviceHandle);
1277  }
1278  else
1279  {
1280  RDK_LOG(RDK_LOG_WARN, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed to get, since not Set for '%s.%s'.\r\n", __FUNCTION__,__LINE__, X_BT_ROOT_OBJ, BT_DEV_GETDEVICEINFO_STRING);
1281  }
1282  } catch (const std::exception& e) {
1283  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
1284  return NOK;
1285  }
1286 
1287  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1288  return OK;
1289 }
1290 
1291 
1292 /************************************************************
1293 * Description : Manufacturer of Connected devices and get the
1294  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DeviceInfo.Manufacturer' value.
1295  *
1296  * Precondition : Bluetooth stack should be present.
1297  * Input :
1298 
1299  * Return : OK -> Success
1300  NOK -> Failure
1301  value -> Manufacturer of the paired devices
1302 ************************************************************/
1303 int hostIf_DeviceInfoRdk_xBT::getDeviceInfo_Manufacturer(HOSTIF_MsgData_t *stMsgData)
1304 {
1305  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1306 
1307  try {
1308  if(handle_devInfo) {
1309  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: The Device Manufacturer/vendorID : \'%d\'.\n", __FUNCTION__, __LINE__, deviceProperty.m_vendorID);
1310  put_int(stMsgData->paramValue, deviceProperty.m_vendorID);
1311  }
1312  else
1313  {
1314  RDK_LOG(RDK_LOG_WARN, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed to get, since not Set for '%s.%s'.\r\n", __FUNCTION__,__LINE__, X_BT_ROOT_OBJ, BT_DEV_GETDEVICEINFO_STRING);
1315  }
1316  } catch (const std::exception& e) {
1317  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
1318  return NOK;
1319  }
1320  stMsgData->paramtype=hostIf_IntegerType;
1321  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1322  return OK;
1323 }
1324 
1325 
1326 /************************************************************
1327 * Description : Profile of Connected devices and get the
1328  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DeviceInfo.Profile' value.
1329  *
1330  * Precondition : Bluetooth stack should be present.
1331  * Input :
1332 
1333  * Return : OK -> Success
1334  NOK -> Failure
1335  value -> Profile of the DeviceInfo devices
1336 ************************************************************/
1337 int hostIf_DeviceInfoRdk_xBT::getDeviceInfo_Profile(HOSTIF_MsgData_t *stMsgData)
1338 {
1339  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1340 
1341  stMsgData->paramtype=hostIf_StringType;
1342 
1343  try {
1344 
1345  int numOfService = deviceProperty.m_serviceInfo.m_numOfService;
1346 
1347  if(handle_devInfo && numOfService) {
1348  char serviceInfo[TR69HOSTIFMGR_MAX_PARAM_LEN];
1349  memset (&serviceInfo, '\0', sizeof(serviceInfo));
1350  for (int i = 0; i < deviceProperty.m_serviceInfo.m_numOfService; i++)
1351  {
1352  strcat(serviceInfo, deviceProperty.m_serviceInfo.m_profileInfo[i].m_profile);
1353  if ( (i + 1) < deviceProperty.m_serviceInfo.m_numOfService)
1354  strcat(serviceInfo, ",");
1355  }
1356 
1357  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Profile is \'%s\'.\n", __FUNCTION__, __LINE__, serviceInfo);
1358  strncpy(stMsgData->paramValue, serviceInfo, sizeof(stMsgData->paramValue) -1); //CID:136500 - Buffer size warning
1359  stMsgData->paramValue[sizeof(stMsgData->paramValue) -1] = '\0';
1360  }
1361  else
1362  {
1363 // RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: DeviceProperty.m_serviceInfo.m_numOfService is %d.\r\n",__FUNCTION__, numOfService);
1364  RDK_LOG(RDK_LOG_WARN, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed to get, since not Set for '%s.%s'.\r\n", __FUNCTION__,__LINE__, X_BT_ROOT_OBJ, BT_DEV_GETDEVICEINFO_STRING);
1365  return NOK;
1366  }
1367  } catch (const std::exception& e) {
1368  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
1369  return NOK;
1370  }
1371  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1372  return OK;
1373 }
1374 
1375 
1376 /************************************************************
1377  * Description : MAC of Connected devices and get the
1378  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.ConnectedDevice.{i}.MAC' value.
1379  *
1380  * Precondition : Bluetooth stack should be present.
1381  * Input :
1382 
1383  * Return : OK -> Success
1384  NOK -> Failure
1385  value -> Mac of the connected devices
1386 ************************************************************/
1387 int hostIf_DeviceInfoRdk_xBT::getDeviceInfo_MAC(HOSTIF_MsgData_t *stMsgData)
1388 {
1389  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1390 
1391  try {
1392  if( handle_devInfo) {
1393  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: The Devices MAC is \'%s\'.\n", __FUNCTION__, __LINE__, deviceProperty.m_deviceAddress);
1394  memset(stMsgData->paramValue, '\0', TR69HOSTIFMGR_MAX_PARAM_LEN);
1395  strncpy(stMsgData->paramValue, deviceProperty.m_deviceAddress, TR69HOSTIFMGR_MAX_PARAM_LEN);
1396  }
1397  else
1398  {
1399  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed since not Set for '%s.%s'.\r\n", __FUNCTION__,__LINE__, X_BT_ROOT_OBJ, BT_DEV_GETDEVICEINFO_STRING);
1400 // RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: The Devices MAC is Empty. \n",__FUNCTION__, __LINE__);
1401  }
1402 
1403  } catch (const std::exception& e) {
1404  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
1405  return NOK;
1406  }
1407  stMsgData->paramtype=hostIf_StringType;
1408  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1409  return OK;
1410 }
1411 
1412 
1413 
1414 /************************************************************
1415  * Description : Signal Level of Connected devices and get the
1416  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.ConnectedDevice.{i}.SignalLevel' value.
1417  *
1418  * Precondition : Bluetooth stack should be present.
1419  * Input :
1420 
1421  * Return : OK -> Success
1422  NOK -> Failure
1423  value -> SignalLevel of the connected devices
1424 ************************************************************/
1425 int hostIf_DeviceInfoRdk_xBT::getDeviceInfo_SignalLevel(HOSTIF_MsgData_t *stMsgData)
1426 {
1427  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1428 
1429  try {
1430  if(handle_devInfo)
1431  {
1432  memset(stMsgData->paramValue, '\0', TR69HOSTIFMGR_MAX_PARAM_LEN);
1433  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: The Device signal level \'%d\'.\n", __FUNCTION__, __LINE__, deviceProperty.m_signalLevel);
1434  sprintf(stMsgData->paramValue, "%d", deviceProperty.m_signalLevel);
1435  }
1436  else
1437  {
1438  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed since not Set for '%s.%s'.\r\n", __FUNCTION__,__LINE__, X_BT_ROOT_OBJ, BT_DEV_GETDEVICEINFO_STRING);
1439  }
1440  } catch (const std::exception& e) {
1441  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
1442  return NOK;
1443  }
1444  stMsgData->paramtype = hostIf_StringType;
1445  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1446  return OK;
1447 }
1448 
1449 /************************************************************
1450  * Description : RSSI of Connected devices and get the
1451  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.ConnectedDevice.{i}.RSSI' value.
1452  *
1453  * Precondition : Bluetooth stack should be present.
1454  * Input :
1455 
1456  * Return : OK -> Success
1457  NOK -> Failure
1458  value -> RSSI of the connected devices
1459 ************************************************************/
1460 int hostIf_DeviceInfoRdk_xBT::getDeviceInfo_RSSI (HOSTIF_MsgData_t *stMsgData)
1461 {
1462  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1463 
1464  try {
1465  if(handle_devInfo) {
1466  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: The DeviceInfo RSSI \'%d\'.\n", __FUNCTION__, __LINE__, deviceProperty.m_rssi);
1467  put_int(stMsgData->paramValue, deviceProperty.m_rssi);
1468  }
1469  else {
1470  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed since not Set for '%s.%s'.\r\n", __FUNCTION__,__LINE__, X_BT_ROOT_OBJ, BT_DEV_GETDEVICEINFO_STRING);
1471  }
1472  } catch (const std::exception& e) {
1473  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exception : %s\r\n",__FUNCTION__,__LINE__, e.what());
1474  return NOK;
1475  }
1476  stMsgData->paramtype=hostIf_IntegerType;
1477  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1478  return OK;
1479 }
1480 
1481 /************************************************************
1482  * Description : DeviceType of Connected devices and get the
1483  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.ConnectedDevice.{i}.DeviceType' value.
1484  *
1485  * Precondition : Bluetooth stack should be present.
1486  * Input :
1487 
1488  * Return : OK -> Success
1489  NOK -> Failure
1490  value -> Device Type of the connected devices
1491 ************************************************************/
1492 int hostIf_DeviceInfoRdk_xBT::getConnectedDevice_DeviceType(HOSTIF_MsgData_t *stMsgData) {
1493  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1494 
1495  try {
1496  int devIndex = stMsgData->instanceNum;
1497  if((devIndex && connectedDevList.m_numOfDevices) && (devIndex <= connectedDevList.m_numOfDevices)) {
1498  const char *pType = BTRMGR_GetDeviceTypeAsString (connectedDevList.m_deviceProperty[devIndex-1].m_deviceType);
1499  if (pType)
1500  {
1501  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Connected Devices (index : %d) device type is \'%s\'.\n", __FUNCTION__, devIndex-1, pType);
1502  strncpy(stMsgData->paramValue, pType, sizeof(stMsgData->paramValue) -1); //CID:136567 - Buffer size warning
1503  stMsgData->paramValue[sizeof(stMsgData->paramValue) -1] = '\0';
1504  }
1505  else
1506  {
1507  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed; Null Name\r\n",__FUNCTION__, __LINE__);
1508  return NOK;
1509  }
1510  }
1511  else
1512  {
1513  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, __LINE__, devIndex);
1514  return NOK;
1515  }
1516  } catch (const std::exception& e) {
1517  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exception : %s\r\n",__FUNCTION__, __LINE__, e.what());
1518  return NOK;
1519  }
1520  stMsgData->paramtype=hostIf_StringType;
1521  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1522  return OK;
1523 }
1524 
1525 
1526 /************************************************************
1527  * Description : Name of Connected devices and get the
1528  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.ConnectedDevice.{i}.DeviceID' value.
1529  *
1530  * Precondition : Bluetooth stack should be present.
1531  * Input :
1532 
1533  * Return : OK -> Success
1534  NOK -> Failure
1535  value -> DeviceID of the paired devices
1536 ************************************************************/
1537 int hostIf_DeviceInfoRdk_xBT::getConnectedDevice_DeviceID(HOSTIF_MsgData_t *stMsgData)
1538 {
1539  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1540 
1541  try {
1542  int devIndex = stMsgData->instanceNum;
1543  stMsgData->paramtype = hostIf_StringType;;
1544  if((devIndex && connectedDevList.m_numOfDevices) && (devIndex <= connectedDevList.m_numOfDevices)) {
1545  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s]xBlueTooth: The Connected Devices (index : %d) DeviceID is \'%llu\'.\n", __FUNCTION__, devIndex-1, connectedDevList.m_deviceProperty[devIndex-1].m_deviceHandle);
1546  memset(stMsgData->paramValue, '\0', TR69HOSTIFMGR_MAX_PARAM_LEN);
1547  sprintf(stMsgData->paramValue, "%llu", connectedDevList.m_deviceProperty[devIndex-1].m_deviceHandle);
1548  }
1549  else
1550  {
1551  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s]xBlueTooth: Failed due to wrong device index %d\r\n",__FUNCTION__, devIndex);
1552  return NOK;
1553  }
1554  } catch (const std::exception& e) {
1555  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s]xBlueTooth: Exception : %s\r\n",__FUNCTION__, e.what());
1556  return NOK;
1557  }
1558 
1559  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1560  return OK;
1561 }
1562 
1563 /************************************************************
1564  * Description : Get api for
1565  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.GetDeviceInfo' parameter.
1566  *
1567  * Precondition : Bluetooth stack should be present.
1568  * Input :
1569 
1570  * Return : OK -> Success
1571  NOK -> Failure
1572  value -> OK on successful set or NOK
1573 ************************************************************/
1574 int hostIf_DeviceInfoRdk_xBT::getDeviceInfo (HOSTIF_MsgData_t *stMsgData)
1575 {
1576  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1577 
1578  try {
1579 
1580  if(handle_devInfo) {
1581  memset(stMsgData->paramValue, '\0', TR69HOSTIFMGR_MAX_PARAM_LEN);
1582  sprintf(stMsgData->paramValue, "%llu", deviceProperty.m_deviceHandle);
1583  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: GetDeviceInfo value %llu, converted string is (%s). \r\n", __FUNCTION__,__LINE__,
1584  deviceProperty.m_deviceHandle, stMsgData->paramValue);
1585  }
1586  else
1587  {
1588  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed to return any value, since this is not Set for \"%s.%s\". \r\n",__FUNCTION__, __LINE__, X_BT_ROOT_OBJ, BT_DEV_GETDEVICEINFO_STRING);
1589 
1590  return NOK;
1591  }
1592  } catch (const std::exception& e) {
1593  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exception : %s\r\n",__FUNCTION__,__LINE__, e.what());
1594  return NOK;
1595  }
1596  stMsgData->paramtype=hostIf_StringType;
1597  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1598  return OK;
1599 }
1600 
1601 
1602 /************************************************************
1603  * Description : Set api for
1604  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.GetDeviceInfo' parameter.
1605  *
1606  * Precondition : Bluetooth stack should be present.
1607  * Input :
1608 
1609  * Return : OK -> Success
1610  NOK -> Failure
1611  value -> OK on successful set or NOK
1612  R/W deviceID input parameter. When written
1613  set should call getDeviceInfo and populate
1614 ************************************************************/
1615 int hostIf_DeviceInfoRdk_xBT::setDeviceInfo (HOSTIF_MsgData_t *stMsgData)
1616 {
1617  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1618 
1619  try {
1620 
1621  if(stMsgData->paramValue[0] != '\0') {
1622  BTRMgrDeviceHandle handle = 0;
1623  int base = 16;
1624  char *stopstring = NULL;
1625 
1626  handle = strtoll(stMsgData->paramValue, NULL, 0);
1627 
1628  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Received Set GetDeviceInfo value : %s and converted value as : %llu\r\n",
1629  __FUNCTION__,__LINE__, stMsgData->paramValue, handle);
1630 
1631  memset (&deviceProperty, 0, sizeof (deviceProperty));
1632 
1633  if (BTRMGR_RESULT_SUCCESS != BTRMGR_GetDeviceProperties(0, handle, &deviceProperty))
1634  {
1635  RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed in BTRMGR_GetDeviceProperties for \'%s\'.\n", __FUNCTION__, __LINE__, stMsgData->paramValue);
1636  return NOK;
1637  }
1638  else
1639  {
1640  handle_devInfo = handle;
1641  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Successfully BTRMGR_GetDeviceProperties.\n", __FUNCTION__, __LINE__);
1642  }
1643  }
1644  else
1645  {
1646  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed due to empty GetDeviceInfo value %s\r\n",__FUNCTION__, __LINE__,stMsgData->paramValue);
1647  return NOK;
1648  }
1649  } catch (const std::exception& e) {
1650  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exception : %s\r\n",__FUNCTION__,__LINE__, e.what());
1651  return NOK;
1652  }
1653  stMsgData->paramtype=hostIf_UnsignedLongType;
1654  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1655  return OK;
1656 }
1657 
1658 #ifdef BLE_TILE_PROFILE
1659 /************************************************************
1660  * Description : Set api for
1661  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.setLimitBeaconDetection' parameter.
1662  *
1663  * Precondition : Bluetooth stack should be present.
1664  * Input : stMsgData, params & value to set, true or false
1665 
1666  * Return : OK -> Success
1667  NOK -> Failure
1668  value -> OK on successful set or NOK
1669 ************************************************************/
1670 
1671 int hostIf_DeviceInfoRdk_xBT::setLimitBeaconDetection (HOSTIF_MsgData_t *stMsgData)
1672 {
1673  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1674 
1675  try {
1676 
1677  if(stMsgData->paramValue != NULL) {
1678  unsigned char isLimited = 0;
1679 
1680  RDK_LOG(RDK_LOG_INFO, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Received Set value : %s for LimitBeaconDetection\r\n",
1681  __FUNCTION__,__LINE__, stMsgData->paramValue);
1682 
1683  isLimited = get_int(stMsgData->paramValue);
1684  RDK_LOG(RDK_LOG_INFO, LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: isLimited value : %d for LimitBeaconDetection\r\n", __FUNCTION__,__LINE__, isLimited);
1685 
1686  leLimitBeaconDetection_t param;
1687  memset(&param, 0, sizeof(param));
1688  param.adapterIndex = 0;
1689  param.limitBeaconDetection = isLimited;
1690 
1691  IARM_Result_t retVal = IARM_RESULT_SUCCESS;
1692 
1693  retVal = IARM_Bus_Call(IARM_BUS_BTRLEMGR_NAME, IARM_BUS_LEMGR_API_leSetLimitBeaconDetection, (void *)&param, sizeof(leLimitBeaconDetection_t));
1694  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"\n***********************************\n");
1695  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"\n \"%s\", \"%s\"", IARM_BUS_LEMGR_API_leSetLimitBeaconDetection , param.limitBeaconDetection ? "true" : "false");
1696  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"\n***********************************\n");
1697 
1698  if(retVal == IARM_RESULT_SUCCESS) { // && param.status) {
1699  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Successfully Set the limit beacon detection.\n", __FUNCTION__, __LINE__);
1700  }
1701  }
1702  else
1703  {
1704  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed due to empty LimitBeaconDetection value \r\n",__FUNCTION__, __LINE__);
1705  return NOK;
1706  }
1707  } catch (const std::exception& e) {
1708  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exception : %s\r\n",__FUNCTION__,__LINE__, e.what());
1709  return NOK;
1710  }
1711  stMsgData->paramtype=hostIf_BooleanType;
1712  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1713  return OK;
1714 }
1715 
1716 /************************************************************
1717  * Description : Get api for
1718  * 'Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.LimitBeaconDetection' parameter.
1719  *
1720  * Precondition : Bluetooth stack should be present.
1721  * Input :
1722 
1723  * Return : OK -> Success
1724  NOK -> Failure
1725  value -> OK on successful set or NOK
1726 ************************************************************/
1727 int hostIf_DeviceInfoRdk_xBT::getLimitBeaconDetection (HOSTIF_MsgData_t *stMsgData)
1728 {
1729  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1730  //bool limitBeaconDis = false;
1731  unsigned char isLimited = 0;
1732 
1733  try {
1734  IARM_Result_t retVal = IARM_RESULT_SUCCESS;
1735  leLimitBeaconDetection_t param;
1736  memset(&param, 0, sizeof(param));
1737 
1738  retVal = IARM_Bus_Call(IARM_BUS_BTRLEMGR_NAME, IARM_BUS_LEMGR_API_leGetLimitBeaconDetection, (void *)&param, sizeof(leLimitBeaconDetection_t));
1739  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"\n***********************************\n");
1740  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"\n \"%s\", \"%s\"", IARM_BUS_LEMGR_API_leGetLimitBeaconDetection , param.limitBeaconDetection ? "true" : "false");
1741  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"\n***********************************\n");
1742 
1743  if(retVal == IARM_RESULT_SUCCESS) { // && param.status) {
1744  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Successfully get the limit beacon detection.\n", __FUNCTION__, __LINE__);
1745  }
1746 
1747  isLimited = (param.limitBeaconDetection) ? 1 : 0 ;
1748  RDK_LOG(RDK_LOG_INFO, LOG_TR69HOSTIF,"[%s][AMIT_DEBUG_DD]xBlueTooth: Is beacon detection limited : %d \n", __FUNCTION__, isLimited);
1749  } catch (const std::exception& e) {
1750  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exception : %s\r\n",__FUNCTION__, __LINE__, e.what());
1751  return NOK;
1752  }
1753  put_boolean(stMsgData->paramValue, isLimited);
1754  stMsgData->paramtype=hostIf_BooleanType;
1755  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1756  return OK;
1757 }
1758 #endif
1759 /************************************************************
1760  * Description : This method is to fetch Bluetooth Discovered Devices details.
1761  *
1762  * Precondition : Bluetooth stack should be present.
1763  * Input :
1764 
1765  * Return : OK -> Success
1766  NOK -> Failure
1767  value -> Device Type of the connected devices
1768 ************************************************************/
1769 void hostIf_DeviceInfoRdk_xBT::fetch_Bluetooth_DiscoveredDevicesList()
1770 {
1771  LOG_ENTRY_EXIT;
1772 
1773  static time_t firstExTimeDisList = 0;
1774  time_t currExTime = time (NULL);
1775  if ((currExTime - firstExTimeDisList ) > BTRMGR_QUERY_INTERVAL)
1776  {
1777  memset (&disDevList, '\0', sizeof(disDevList));
1778  if (BTRMGR_RESULT_SUCCESS != BTRMGR_GetDiscoveredDevices(0, &disDevList))
1779  {
1780  RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s]xBlueTooth: Failed in BTRMGR_GetDiscoveredDevices. \n", __FUNCTION__);
1781  }
1782  else if (disDevList.m_numOfDevices > BTRMGR_DEVICE_COUNT_MAX)
1783  {
1784  RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s]xBlueTooth: Invalid device count (%d). \n",
1785  __FUNCTION__, disDevList.m_numOfDevices);
1786  }
1787  else
1788  {
1789  int j = 0;
1790  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF, "[%s]xBlueTooth: Successfully gets the Discovered Devices details. Total count is (%d). \n",
1791  __FUNCTION__, disDevList.m_numOfDevices);
1792  for (; j< disDevList.m_numOfDevices; j++)
1793  {
1794  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF, "%d \t %llu \t %s \t %s\n", j,
1795  disDevList.m_deviceProperty[j].m_deviceHandle,
1796  disDevList.m_deviceProperty[j].m_name,
1797  disDevList.m_deviceProperty[j].m_deviceAddress);
1798  }
1799  }
1800  firstExTimeDisList = time (NULL);
1801  }
1802 
1803  RDK_LOG (RDK_LOG_DEBUG, LOG_TR69HOSTIF, "[%s] disDevList.m_numOfDevices = %hu, noOfDiscoveredDevice = %d\n",
1804  __FUNCTION__, disDevList.m_numOfDevices, noOfDiscoveredDevice);
1805  char objectPath[TR69HOSTIFMGR_MAX_PARAM_LEN];
1806  snprintf (objectPath, TR69HOSTIFMGR_MAX_PARAM_LEN, "%s.", X_BT_DISCOVERED_DEV_OBJ);
1807  sendAddRemoveEvents (mUpdateCallback, disDevList.m_numOfDevices, noOfDiscoveredDevice, objectPath);
1808 }
1809 
1810 /************************************************************
1811  * Description : This method is to fetch Bluetooth Paired Devices details.
1812  *
1813  * Precondition : Bluetooth stack should be present.
1814  * Input :
1815 
1816  * Return : OK -> Success
1817  NOK -> Failure
1818  value -> Device Type of the connected devices
1819 ************************************************************/
1820 void hostIf_DeviceInfoRdk_xBT::fetch_Bluetooth_PairedDevicesList()
1821 {
1822  LOG_ENTRY_EXIT;
1823 
1824  static time_t firstExTimePairedList = 0;
1825  time_t currExTime = time (NULL);
1826  if ((currExTime - firstExTimePairedList ) > BTRMGR_QUERY_INTERVAL)
1827  {
1828  memset (&pairedDevList, 0, sizeof(pairedDevList));
1829 
1830  if (BTRMGR_RESULT_SUCCESS != BTRMGR_GetPairedDevices(0, &pairedDevList))
1831  {
1832  RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s]xBlueTooth: Failed in BTRMGR_GetPairedDevices. \n", __FUNCTION__);
1833  }
1834  else if (pairedDevList.m_numOfDevices > BTRMGR_DEVICE_COUNT_MAX)
1835  {
1836  RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s]xBlueTooth: Invalid device count (%d). \n",
1837  __FUNCTION__, pairedDevList.m_numOfDevices);
1838  }
1839  else
1840  {
1841  int j = 0;
1842  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF, "[%s]xBlueTooth: Successfully get Paired Devices details. Total count is (%d). \n",
1843  __FUNCTION__, pairedDevList.m_numOfDevices);
1844  for (; j< pairedDevList.m_numOfDevices; j++)
1845  {
1846  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF, "%d \t %llu \t %s \t %s\n", j,
1847  pairedDevList.m_deviceProperty[j].m_deviceHandle,
1848  pairedDevList.m_deviceProperty[j].m_name,
1849  pairedDevList.m_deviceProperty[j].m_deviceAddress);
1850  }
1851  }
1852  firstExTimePairedList = time (NULL);
1853  }
1854 
1855  RDK_LOG (RDK_LOG_DEBUG, LOG_TR69HOSTIF, "[%s] pairedDevList.m_numOfDevices = %hu, noOfPairedDevice = %d\n",
1856  __FUNCTION__, pairedDevList.m_numOfDevices, noOfPairedDevice);
1857  char objectPath[TR69HOSTIFMGR_MAX_PARAM_LEN];
1858  snprintf (objectPath, TR69HOSTIFMGR_MAX_PARAM_LEN, "%s.", X_BT_PAIRED_DEV_OBJ);
1859  sendAddRemoveEvents (mUpdateCallback, pairedDevList.m_numOfDevices, noOfPairedDevice, objectPath);
1860 }
1861 
1862 /************************************************************
1863  * Description : This method is to fetch Bluetooth Connected Devices details..
1864  *
1865  * Precondition : Bluetooth stack should be present.
1866  * Input :
1867 
1868  * Return : OK -> Success
1869  NOK -> Failure
1870  value -> Device Type of the connected devices
1871 ************************************************************/
1872 void hostIf_DeviceInfoRdk_xBT::fetch_Bluetooth_ConnectedDevicesList()
1873 {
1874  LOG_ENTRY_EXIT;
1875 
1876  static time_t firstExTimeConnList = 0;
1877  time_t currExTime = time (NULL);
1878  if ((currExTime - firstExTimeConnList ) > BTRMGR_QUERY_INTERVAL)
1879  {
1880  memset (&connectedDevList, 0, sizeof(connectedDevList));
1881 
1882  if (BTRMGR_RESULT_SUCCESS != BTRMGR_GetConnectedDevices(0, &connectedDevList))
1883  {
1884  RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s]xBlueTooth: Failed in BTRMGR_GetConnectedDevices. \n", __FUNCTION__);
1885  }
1886  else if (connectedDevList.m_numOfDevices > BTRMGR_DEVICE_COUNT_MAX)
1887  {
1888  RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s]xBlueTooth: Invalid device count (%d). \n",
1889  __FUNCTION__, connectedDevList.m_numOfDevices);
1890  }
1891  else
1892  {
1893  int j = 0;
1894  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF, "[%s]xBlueTooth: Successfully gets the Connected Devices details. Total count is (%d). \n",
1895  __FUNCTION__, connectedDevList.m_numOfDevices);
1896  for (; j< connectedDevList.m_numOfDevices; j++)
1897  {
1898  RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF, "%d \t %llu \t %s \t %s\n", j,
1899  connectedDevList.m_deviceProperty[j].m_deviceHandle,
1900  connectedDevList.m_deviceProperty[j].m_name,
1901  connectedDevList.m_deviceProperty[j].m_deviceAddress);
1902  }
1903  }
1904  firstExTimeConnList = time (NULL);
1905  }
1906 
1907  RDK_LOG (RDK_LOG_DEBUG, LOG_TR69HOSTIF, "[%s] connectedDevList.m_numOfDevices = %hu, noOfConnectedDevices = %d\n",
1908  __FUNCTION__, connectedDevList.m_numOfDevices, noOfConnectedDevices);
1909  char objectPath[TR69HOSTIFMGR_MAX_PARAM_LEN];
1910  snprintf (objectPath, TR69HOSTIFMGR_MAX_PARAM_LEN, "%s.", X_BT_CONNECTED_DEV_OBJ);
1911  sendAddRemoveEvents (mUpdateCallback, connectedDevList.m_numOfDevices, noOfConnectedDevices, objectPath);
1912 }
1913 
1914 void hostIf_DeviceInfoRdk_xBT::registerUpdateCallback(updateCallback cb)
1915 {
1916  mUpdateCallback = cb;
1917 }
1918 
1919 void hostIf_DeviceInfoRdk_xBT::checkForUpdates()
1920 {
1921  LOG_ENTRY_EXIT;
1922 
1923  if (mUpdateCallback == 0)
1924  return;
1925 
1926  std::lock_guard<std::mutex> lg(m);
1927 
1928  fetch_Bluetooth_DiscoveredDevicesList ();
1929  fetch_Bluetooth_PairedDevicesList ();
1930  fetch_Bluetooth_ConnectedDevicesList ();
1931 }
1932 
1933 #ifdef BLE_TILE_PROFILE
1934 int hostIf_DeviceInfoRdk_xBT::do_Ring_A_Tile(bool enable)
1935 {
1936  if(enable == true) {
1937  leRingATileHandleParam_t param;
1938  memset(&param, 0, sizeof(param));
1939 
1940  snprintf (param.Id, TILE_ID_MAX_SIZE-1,"%s", this->tile_Id.c_str());
1941  snprintf (param.sessionId, SESSION_ID_MAX_SIZE-1,"%s", this->sessionId.c_str());
1942  param.triggerCmd = this->triggerFlag;
1943 
1944  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: BLE Tile: ID : %s \n", __FUNCTION__, __LINE__, param.Id);
1945  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: BLE Tile: Session ID : %s \n", __FUNCTION__, __LINE__, param.sessionId);
1946  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: BLE Tile: Ring Trigger : %d . \n", __FUNCTION__, __LINE__, param.triggerCmd);
1947 
1948  IARM_Result_t retVal = IARM_RESULT_SUCCESS;
1949 
1950  retVal = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRLEMGR_NAME, IARM_BUS_LEMGR_API_leRingATile, (void *)&param, sizeof(leRingATileHandleParam_t ), 15000);
1951  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"\n***********************************\n");
1952  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"\n \"%s\", \"%s\"", IARM_BUS_LEMGR_API_leRingATile , ((param.triggerCmd)?"true":"false"));
1953  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"\n***********************************\n");
1954 
1955  if(retVal == IARM_RESULT_SUCCESS) { // && param.status) {
1956  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Successfully Set the Ring.\n", __FUNCTION__, __LINE__);
1957  this->tile_Id.clear();
1958  this->sessionId.clear();
1959  this->triggerFlag = false;
1960  }
1961  }
1962  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1963  return OK;
1964 }
1965 
1966 int hostIf_DeviceInfoRdk_xBT::process_TileCmdRequest(HOSTIF_MsgData_t *stMsgData)
1967 {
1968  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Entering..\n", __FUNCTION__, __LINE__);
1969 
1970  leTileRequestHandleParam_t param;
1971  memset(&param, 0, sizeof(param));
1972  IARM_Result_t retVal = IARM_RESULT_SUCCESS;
1973  snprintf(param.request, TILE_REQUEST_MAX_SIZE -1, stMsgData->paramValue);
1974 
1975  retVal = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRLEMGR_NAME, IARM_BUS_LEMGR_API_leTileRequest, (void *)&param, sizeof(leTileRequestHandleParam_t ), 15000);
1976 
1977  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"\n***********************************\n");
1978  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"\n \"%s\", \"%s\"\n", IARM_BUS_LEMGR_API_leTileRequest, ((retVal == IARM_RESULT_SUCCESS) ?"Successfully set.":"Failed."));
1979  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"\n***********************************\n");
1980 
1981  if(retVal == IARM_RESULT_SUCCESS) { // && param.status) {
1982  RDK_LOG(RDK_LOG_INFO,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Successfully forwarded Tile.Cmd.Request to btrLeAppMgr..\n", __FUNCTION__, __LINE__);
1983  }
1984  else {
1985  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Failed to process Tile Cmd Request..\n", __FUNCTION__, __LINE__);
1986  return NOK;
1987  }
1988 
1989  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%d]xBlueTooth: Exiting..\n", __FUNCTION__, __LINE__);
1990  return OK;
1991 }
1992 #endif // BLE_TILE_PROFILE
1993 #endif // USE_XRDK_BT_PROFILE
1994 
1995 /* End of doxygen group */
1996 /**
1997  * @}
1998  */
1999 
2000 /* End of file xxx_api.c. */
2001 
2002 
2003 /** @} */
2004 /** @} */
_HostIf_MsgData_t::instanceNum
short instanceNum
Definition: hostIf_tr69ReqHandler.h:176
BTRMGR_IsAdapterDiscoverable
BTRMGR_Result_t BTRMGR_IsAdapterDiscoverable(unsigned char aui8AdapterIdx, unsigned char *pDiscoverable)
This API checks the adapter is discoverable or not.
Definition: btrMgr.c:2894
BTRMGR_Result_t
enum _BTRMGR_Result_t BTRMGR_Result_t
Represents the status of the operation.
IARM_Bus_Call
IARM_Result_t IARM_Bus_Call(const char *ownerName, const char *methodName, void *arg, size_t argLen)
This API is used to Invoke RPC method by its application name and method name.
Definition: iarm_bus.c:57
IARM_Bus_Call_with_IPCTimeout
IARM_Result_t IARM_Bus_Call_with_IPCTimeout(const char *ownerName, const char *methodName, void *arg, size_t argLen, int timeout)
This API is used to Invoke RPC method by its application name and method name with specified timeout ...
_HostIf_MsgData_t
Definition: hostIf_tr69ReqHandler.h:170
btmgr.h
BTRMGR_GetAdapterPowerStatus
BTRMGR_Result_t BTRMGR_GetAdapterPowerStatus(unsigned char aui8AdapterIdx, unsigned char *pPowerStatus)
This API fetches the power status, either 0 or 1.
Definition: btrMgr.c:2790
put_boolean
void put_boolean(char *ptr, bool val)
This function converts the input data to Boolean type.
Definition: hostIf_utils.cpp:191
_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
_HostIf_MsgData_t::paramtype
HostIf_ParamType_t paramtype
Definition: hostIf_tr69ReqHandler.h:177
RDK_LOG
#define RDK_LOG
Definition: rdk_debug.h:258
_HostIf_MsgData_t::faultCode
faultCode_t faultCode
Definition: hostIf_tr69ReqHandler.h:179
_HostIf_MsgData_t::paramName
char paramName[(4 *1024)]
Definition: hostIf_tr69ReqHandler.h:171
_BTRMGR_DiscoveredDevicesList_t
Represents the list of scanned devices.
Definition: btmgr.h:484
BTRMGR_GetDeviceProperties
BTRMGR_Result_t BTRMGR_GetDeviceProperties(unsigned char aui8AdapterIdx, BTRMgrDeviceHandle ahBTRMgrDevHdl, BTRMGR_DevicesProperty_t *pDeviceProperty)
This API returns the device information that includes the device name, mac address,...
Definition: btrMgr.c:3961
BTRMGR_GetConnectedDevices
BTRMGR_Result_t BTRMGR_GetConnectedDevices(unsigned char aui8AdapterIdx, BTRMGR_ConnectedDevicesList_t *pConnectedDevices)
This API returns the list of devices connected.
Definition: btrMgr.c:3845
_HostIf_MsgData_t::paramValue
char paramValue[(4 *1024)]
Definition: hostIf_tr69ReqHandler.h:172
BTRMGR_GetDiscoveredDevices
BTRMGR_Result_t BTRMGR_GetDiscoveredDevices(unsigned char aui8AdapterIdx, BTRMGR_DiscoveredDevicesList_t *pDiscoveredDevices)
This API fetches the list of devices scanned.
Definition: btrMgr.c:3226
_BTRMGR_DevicesProperty_t
Represents the property of the device.
Definition: btmgr.h:400
BTRMGR_GetPairedDevices
BTRMGR_Result_t BTRMGR_GetPairedDevices(unsigned char aui8AdapterIdx, BTRMGR_PairedDevicesList_t *pPairedDevices)
This API returns the list of devices paired.
Definition: btrMgr.c:3556
BTRMGR_GetDeviceTypeAsString
const char * BTRMGR_GetDeviceTypeAsString(BTRMGR_DeviceType_t type)
This API fetches the Device name of the media.
Definition: btrMgr.c:5515
XrdkBlueTooth.h
The header file provides components Xrdk SDCard information APIs.
put_int
void put_int(char *ptr, int val)
This function converts the input data to integer type.
Definition: hostIf_utils.cpp:152