RDK Documentation (Open Sourced RDK Components)
btmgr_iarm_external_interface.c
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 #include <sys/types.h>
20 #include <unistd.h>
21 #include <stdlib.h>
22 #include <string.h>
23 
24 #include "btmgr.h"
25 #include "btrMgr_logger.h"
26 #include "btmgr_iarm_interface.h"
27 
28 
29 static unsigned char isBTRMGR_Inited = 0;
30 static unsigned char isBTRMGR_Iarm_Inited = 0;
31 static unsigned char isBTRMGR_Iarm_Connected = 0;
32 static BTRMGR_EventCallback m_eventCallbackFunction = NULL;
33 
34 #ifdef RDK_LOGGER_ENABLED
35 int b_rdk_logger_enabled = 0;
36 #endif
37 
38 static void btrMgrdeviceCallback(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
39 static void btrMgrMediaCallback(const char *owner, IARM_EventId_t eventId, void *data, size_t len);
40 
41 
42 /**********************/
43 /* Private Interfaces */
44 /**********************/
45 
46 
47 /*********************/
48 /* Public Interfaces */
49 /*********************/
52  void
53 ) {
54  char processName[256] = "";
55  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
56 
57  if (!isBTRMGR_Inited) {
58  isBTRMGR_Inited = 1;
59 #ifdef RDK_LOGGER_ENABLED
60  const char* pDebugConfig = NULL;
61  const char* BTRMGR_IARM_DEBUG_ACTUAL_PATH = "/etc/debug.ini";
62  const char* BTRMGR_IARM_DEBUG_OVERRIDE_PATH = "/opt/debug.ini";
63 
64  /* Init the logger */
65  if (access(BTRMGR_IARM_DEBUG_OVERRIDE_PATH, F_OK) != -1)
66  pDebugConfig = BTRMGR_IARM_DEBUG_OVERRIDE_PATH;
67  else
68  pDebugConfig = BTRMGR_IARM_DEBUG_ACTUAL_PATH;
69 
70  if (0 == rdk_logger_init(pDebugConfig))
71  b_rdk_logger_enabled = 1;
72 #endif
73  sprintf (processName, "BTRMgr-User-%u", getpid());
74  if (IARM_RESULT_SUCCESS == (retCode = IARM_Bus_Init((const char*) &processName))) {
75  isBTRMGR_Iarm_Inited = 1;
76  BTRMGRLOG_INFO ("IARM Interface Inited Successfully\n");
77  }
78  else {
79  BTRMGRLOG_INFO ("IARM Interface Inited Externally\n");
80  }
81 
82  if (IARM_RESULT_SUCCESS == (retCode = IARM_Bus_Connect())) {
83  isBTRMGR_Iarm_Connected = 1;
84  BTRMGRLOG_INFO ("IARM Interface Inited Internally-BTRMGR\n");
85  }
86  else {
87  BTRMGRLOG_INFO ("IARM Interface Connected Externally\n");
88  }
89 
91  }
92  else
93  BTRMGRLOG_INFO ("IARM Interface Already Inited\n");
94 
95  return BTRMGR_RESULT_SUCCESS;
96 }
97 
98 
101  const char *apcProcessName
102 ) {
103  int isRegistered = 0;
104  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
105 
106 #ifdef RDK_LOGGER_ENABLED
107  if (!b_rdk_logger_enabled) {
108  const char* pDebugConfig = NULL;
109  const char* BTRMGR_IARM_DEBUG_ACTUAL_PATH = "/etc/debug.ini";
110  const char* BTRMGR_IARM_DEBUG_OVERRIDE_PATH = "/opt/debug.ini";
111 
112  /* Init the logger */
113  if (access(BTRMGR_IARM_DEBUG_OVERRIDE_PATH, F_OK) != -1)
114  pDebugConfig = BTRMGR_IARM_DEBUG_OVERRIDE_PATH;
115  else
116  pDebugConfig = BTRMGR_IARM_DEBUG_ACTUAL_PATH;
117 
118  if (0 == rdk_logger_init(pDebugConfig))
119  b_rdk_logger_enabled = 1;
120  }
121 #endif
122 
123  if (!apcProcessName) {
124  BTRMGRLOG_INFO ("BTRMGR_INIT has called\n");
125  }
126  else {
127  BTRMGRLOG_INFO ("apcProcessName = %s\n", apcProcessName);
128  retCode = IARM_Bus_IsConnected(apcProcessName, &isRegistered);
129  if ((retCode != IARM_RESULT_SUCCESS) || (isRegistered == 0)) {
130  BTRMGRLOG_ERROR ("IARM_Bus_IsConnected Failure (%s); RetCode = %d\n",apcProcessName, retCode);
131  return BTRMGR_RESULT_GENERIC_FAILURE;
132  }
133  }
134 
135  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_OUT_OF_RANGE, btrMgrdeviceCallback);
136  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_DISCOVERY_STARTED, btrMgrdeviceCallback);
137  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_DISCOVERY_UPDATE, btrMgrdeviceCallback);
138  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_DISCOVERY_COMPLETE, btrMgrdeviceCallback);
139  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_PAIRING_COMPLETE, btrMgrdeviceCallback);
140  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_UNPAIRING_COMPLETE, btrMgrdeviceCallback);
141  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_CONNECTION_COMPLETE, btrMgrdeviceCallback);
142  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_DISCONNECT_COMPLETE, btrMgrdeviceCallback);
143  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_PAIRING_FAILED, btrMgrdeviceCallback);
144  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_UNPAIRING_FAILED, btrMgrdeviceCallback);
145  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_CONNECTION_FAILED, btrMgrdeviceCallback);
146  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_DISCONNECT_FAILED, btrMgrdeviceCallback);
147  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_RECEIVED_EXTERNAL_PAIR_REQUEST, btrMgrdeviceCallback);
148  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_RECEIVED_EXTERNAL_CONNECT_REQUEST, btrMgrdeviceCallback);
149  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_RECEIVED_EXTERNAL_PLAYBACK_REQUEST, btrMgrdeviceCallback);
150  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_FOUND, btrMgrdeviceCallback);
151  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_TRACK_STARTED, btrMgrMediaCallback);
152  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_TRACK_PLAYING, btrMgrMediaCallback);
153  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_TRACK_PAUSED, btrMgrMediaCallback);
154  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_TRACK_STOPPED, btrMgrMediaCallback);
155  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_TRACK_POSITION, btrMgrMediaCallback);
156  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_TRACK_CHANGED, btrMgrMediaCallback);
157  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYBACK_ENDED, btrMgrMediaCallback);
158  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_OP_READY, btrMgrdeviceCallback);
159  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_OP_INFORMATION, btrMgrdeviceCallback);
160  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_NAME, btrMgrMediaCallback);
161  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_VOLUME, btrMgrMediaCallback);
162  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_EQUALIZER_OFF, btrMgrMediaCallback);
163  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_EQUALIZER_ON, btrMgrMediaCallback);
164  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_SHUFFLE_OFF, btrMgrMediaCallback);
165  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_SHUFFLE_ALLTRACKS, btrMgrMediaCallback);
166  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_SHUFFLE_GROUP, btrMgrMediaCallback);
167  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_REPEAT_OFF, btrMgrMediaCallback);
168  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_REPEAT_SINGLETRACK, btrMgrMediaCallback);
169  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_REPEAT_ALLTRACKS, btrMgrMediaCallback);
170  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_REPEAT_GROUP, btrMgrMediaCallback);
171  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_ALBUM_INFO, btrMgrMediaCallback);
172  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_ARTIST_INFO, btrMgrMediaCallback);
173  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_GENRE_INFO, btrMgrMediaCallback);
174  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_COMPILATION_INFO, btrMgrMediaCallback);
175  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYLIST_INFO, btrMgrMediaCallback);
176  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_TRACKLIST_INFO, btrMgrMediaCallback);
177  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_MUTE, btrMgrMediaCallback);
178  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_UNMUTE, btrMgrMediaCallback);
179  IARM_Bus_RegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_MEDIA_STATUS, btrMgrdeviceCallback);
180 
181  BTRMGRLOG_INFO ("IARM Interface Inited Register Event Successfully\n");
182 
183  return BTRMGR_RESULT_SUCCESS;
184 }
185 
186 
189  void
190 ) {
191  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
192  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
193 
194  if (m_eventCallbackFunction)
195  m_eventCallbackFunction = NULL;
196 
197 
198  if (isBTRMGR_Inited) {
200 
201  if (isBTRMGR_Iarm_Connected) {
202  if (IARM_RESULT_SUCCESS == (retCode = IARM_Bus_Disconnect())) {
203  isBTRMGR_Iarm_Connected = 0;
204  }
205  else {
206  BTRMGRLOG_ERROR ("IARM_Bus_Disconnect Failed; RetCode = %d\n", retCode);
207  }
208  }
209 
210  if (isBTRMGR_Iarm_Inited) {
211  if (IARM_RESULT_SUCCESS == (retCode = IARM_Bus_Term())) {
212  isBTRMGR_Iarm_Inited = 0;
213  }
214  else {
215  BTRMGRLOG_ERROR ("IARM_Bus_Term Failed; RetCode = %d\n", retCode);
216  }
217  }
218 
219  isBTRMGR_Inited = 0;
220  BTRMGRLOG_INFO ("IARM Interface termination Successfully \n");
221  }
222  else {
223  rc = BTRMGR_RESULT_GENERIC_FAILURE;
224  BTRMGRLOG_INFO ("IARM Interface for BTRMgr is Not Inited Yet..\n");
225  }
226 
227  return rc;
228 }
229 
232  const char *apcProcessName
233 ) {
234  int isRegistered = 0;
235  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
236 
237  if (!apcProcessName) {
238  BTRMGRLOG_ERROR ("apcProcessName is NULL\n");
239  }
240  else {
241  retCode = IARM_Bus_IsConnected(apcProcessName, &isRegistered);
242  if (retCode != IARM_RESULT_SUCCESS || isRegistered == 0 ) {
243  BTRMGRLOG_ERROR ("IARM_Bus_IsConnected Failure; RetCode = %d\n", retCode);
244  return BTRMGR_RESULT_GENERIC_FAILURE;
245  }
246  }
247 
248  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_TRACKLIST_INFO);
249  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYLIST_INFO);
250  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_COMPILATION_INFO);
251  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_GENRE_INFO);
252  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_ARTIST_INFO);
253  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_ALBUM_INFO);
254  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_REPEAT_GROUP);
255  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_REPEAT_ALLTRACKS);
256  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_REPEAT_SINGLETRACK);
257  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_REPEAT_OFF);
258  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_SHUFFLE_GROUP);
259  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_SHUFFLE_ALLTRACKS);
260  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_SHUFFLE_OFF);
261  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_EQUALIZER_ON);
262  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_EQUALIZER_OFF);
263  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_VOLUME);
264  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_NAME);
265  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_OP_INFORMATION);
266  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_OP_READY);
267  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYBACK_ENDED);
268  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_TRACK_CHANGED);
269  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_TRACK_POSITION);
270  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_TRACK_STOPPED);
271  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_TRACK_PAUSED);
272  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_TRACK_PLAYING);
273  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_TRACK_STARTED);
274  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_FOUND);
275  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_RECEIVED_EXTERNAL_PLAYBACK_REQUEST);
276  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_RECEIVED_EXTERNAL_CONNECT_REQUEST);
277  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_RECEIVED_EXTERNAL_PAIR_REQUEST);
278  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_DISCONNECT_FAILED);
279  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_CONNECTION_FAILED);
280  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_UNPAIRING_FAILED);
281  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_PAIRING_FAILED);
282  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_DISCONNECT_COMPLETE);
283  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_CONNECTION_COMPLETE);
284  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_UNPAIRING_COMPLETE);
285  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_PAIRING_COMPLETE);
286  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_DISCOVERY_COMPLETE);
287  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_DISCOVERY_UPDATE);
288  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_DISCOVERY_STARTED);
289  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_OUT_OF_RANGE);
290  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_MUTE);
291  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_MEDIA_PLAYER_UNMUTE);
292  IARM_Bus_UnRegisterEventHandler(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_EVENT_DEVICE_MEDIA_STATUS);
293 
294  BTRMGRLOG_INFO ("IARM Interface UnRegister Event Succesful\n");
295 
296  return BTRMGR_RESULT_SUCCESS;
297 }
298 
301  unsigned char* pNumOfAdapters
302 ) {
303  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
304  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
305  unsigned char num_of_adapters = 0;
306 
307  if (!pNumOfAdapters) {
308  rc = BTRMGR_RESULT_INVALID_INPUT;
309  BTRMGRLOG_ERROR ("Input is invalid\n");
310  return rc;
311  }
312 
313 
314  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_NUMBER_OF_ADAPTERS, (void *)&num_of_adapters, sizeof(num_of_adapters), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
315  if (IARM_RESULT_SUCCESS == retCode) {
316  *pNumOfAdapters = num_of_adapters;
317  BTRMGRLOG_INFO ("Success; Number of Adapters = %d\n", num_of_adapters);
318  }
319  else {
320  rc = BTRMGR_RESULT_GENERIC_FAILURE;
321  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
322  }
323 
324  return rc;
325 }
326 
327 BTRMGR_Result_t BTRMGR_LE_StartAdvertisement(unsigned char aui8AdapterIdx, BTRMGR_LeCustomAdvertisement_t *pstBTMGR_LeCustomAdvt)
328 {
329  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
330  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
331  BTRMGR_IARMAdvtInfo_t lstAdvtInfo;
332 
333  lstAdvtInfo.m_adapterIndex = aui8AdapterIdx;
334  memcpy(&lstAdvtInfo.m_CustAdvt, pstBTMGR_LeCustomAdvt, sizeof(BTRMGR_LeCustomAdvertisement_t));
335 
336  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_LE_START_ADVERTISEMENT, (void *)&lstAdvtInfo, sizeof(BTRMGR_IARMAdvtInfo_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
337  if (IARM_RESULT_SUCCESS == retCode)
338  {
339  BTRMGRLOG_INFO("Success; Device is now advertising\n");
340  }
341  else {
342  rc = BTRMGR_RESULT_GENERIC_FAILURE;
343  BTRMGRLOG_ERROR("Failed; RetCode = %d\n", retCode);
344  }
345 
346  return rc;
347 }
348 
349 BTRMGR_Result_t BTRMGR_LE_StopAdvertisement(unsigned char aui8AdapterIdx)
350 {
351  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
352  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
353 
354  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_LE_STOP_ADVERTISEMENT, (void*)&aui8AdapterIdx, sizeof(unsigned char), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
355  if (IARM_RESULT_SUCCESS == retCode)
356  {
357  BTRMGRLOG_INFO("Success; Device has stopped advertising\n");
358  }
359  else {
360  rc = BTRMGR_RESULT_GENERIC_FAILURE;
361  BTRMGRLOG_ERROR("Failed; RetCode = %d\n", retCode);
362  }
363 
364  return rc;
365 }
366 
367 BTRMGR_Result_t BTRMGR_LE_GetPropertyValue(unsigned char aui8AdapterIdx, char *aUUID, char *aValue, BTRMGR_LeProperty_t aElement)
368 {
369  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
370  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
371  BTRMGR_IARMGATTValue_t lGattValue;
372 
373  strncpy(lGattValue.m_UUID, aUUID, (BTRMGR_MAX_STR_LEN - 1));
374  lGattValue.aElement = aElement;
375  lGattValue.m_adapterIndex = aui8AdapterIdx;
376 
377  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_LE_GET_PROP_VALUE, (void *)&lGattValue, sizeof(lGattValue), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
378 
379  if (IARM_RESULT_SUCCESS == retCode) {
380  strncpy(aValue, lGattValue.m_Value, (BTRMGR_MAX_STR_LEN - 1));
381  BTRMGRLOG_INFO("Success; Property value is = %s\n", lGattValue.m_Value);
382  }
383  else {
384  rc = BTRMGR_RESULT_GENERIC_FAILURE;
385  BTRMGRLOG_ERROR("Failed; RetCode = %d\n", retCode);
386  }
387 
388  return rc;
389 }
390 
391 BTRMGR_Result_t BTRMGR_LE_SetServiceInfo(unsigned char aui8AdapterIdx, char *aUUID, unsigned char aServiceType)
392 {
393  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
394  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
395  BTRMGR_IARMGATTServiceInfo_t lGattServiceInfo = {};
396 
397  lGattServiceInfo.m_adapterIndex = aui8AdapterIdx;
398  strncpy(lGattServiceInfo.m_UUID, aUUID, (BTRMGR_MAX_STR_LEN - 1));
399  lGattServiceInfo.m_ServiceType = aServiceType;
400 
401  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_LE_SET_GATT_SERVICE_INFO, (void *)&lGattServiceInfo, sizeof(lGattServiceInfo), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
402 
403  if (IARM_RESULT_SUCCESS == retCode)
404  {
405  BTRMGRLOG_INFO("Success; \n");
406  }
407  else
408  {
409  rc = BTRMGR_RESULT_GENERIC_FAILURE;
410  BTRMGRLOG_ERROR("Failed; RetCode = %d\n", retCode);
411  }
412 
413  return rc;
414 }
415 
416 BTRMGR_Result_t BTRMGR_LE_SetGattInfo(unsigned char aui8AdapterIdx, char *aParentUUID, char *aUUID, unsigned short aFlags, char *aValue, BTRMGR_LeProperty_t aElement)
417 {
418  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
419  IARM_Result_t retCode = IARM_RESULT_INVALID_PARAM;
420  BTRMGR_IARMGATTInfo_t lGattCharInfo = {};
421 
422  if ((NULL != aParentUUID) && (NULL != aUUID))
423  {
424  lGattCharInfo.m_adapterIndex = aui8AdapterIdx;
425  strncpy(lGattCharInfo.m_ParentUUID, aParentUUID, (BTRMGR_MAX_STR_LEN - 1));
426  strncpy(lGattCharInfo.m_UUID, aUUID, (BTRMGR_MAX_STR_LEN - 1));
427  lGattCharInfo.m_Flags = aFlags;
428  if (NULL != aValue)
429  {
430  strncpy(lGattCharInfo.m_Value, aValue, (BTRMGR_MAX_STR_LEN - 1));
431  }
432  lGattCharInfo.m_Element = aElement;
433 
434  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_LE_SET_GATT_CHAR_INFO, (void *)&lGattCharInfo, sizeof(lGattCharInfo), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
435  }
436 
437  if (IARM_RESULT_SUCCESS == retCode)
438  {
439  BTRMGRLOG_INFO("Success; \n");
440  }
441  else
442  {
443  rc = BTRMGR_RESULT_GENERIC_FAILURE;
444  BTRMGRLOG_ERROR("Failed; RetCode = %d\n", retCode);
445  }
446 
447  return rc;
448 }
449 
450 BTRMGR_Result_t BTRMGR_LE_SetGattPropertyValue(unsigned char aui8AdapterIdx, char *aUUID, char *aValue, BTRMGR_LeProperty_t aElement) {
451  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
452  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
453  BTRMGR_IARMGATTValue_t lGattValue;
454 
455  strncpy(lGattValue.m_UUID, aUUID, (BTRMGR_MAX_STR_LEN - 1));
456  lGattValue.aElement = aElement;
457  lGattValue.m_adapterIndex = aui8AdapterIdx;
458 
459  strncpy(lGattValue.m_Value, aValue, (BTRMGR_MAX_STR_LEN - 1));
460  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_LE_SET_GATT_PROPERTY_VALUE, (void *)&lGattValue, sizeof(lGattValue), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
461 
462  if (IARM_RESULT_SUCCESS == retCode) {
463 
464  BTRMGRLOG_INFO("Success; Property value is = %s\n", lGattValue.m_Value);
465  }
466 
467  else {
468  rc = BTRMGR_RESULT_GENERIC_FAILURE;
469  BTRMGRLOG_ERROR("Failed; RetCode = %d\n", retCode);
470  }
471 
472  return rc;
473 }
474 
477  unsigned char index_of_adapter
478 ) {
479  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
480  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
481 
482  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
483  rc = BTRMGR_RESULT_INVALID_INPUT;
484  BTRMGRLOG_ERROR ("Input is invalid\n");
485  return rc;
486  }
487 
488 
489  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_RESET_ADAPTER, (void *)&index_of_adapter, sizeof(index_of_adapter), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
490  if (IARM_RESULT_SUCCESS == retCode) {
491  BTRMGRLOG_INFO ("Success\n");
492  }
493  else {
494  rc = BTRMGR_RESULT_GENERIC_FAILURE;
495  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
496  }
497 
498  return rc;
499 }
500 
503  unsigned char index_of_adapter,
504  unsigned char *pLimited
505 ) {
506  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
507  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
508  BTRMGR_IARMBeaconDetection_t beaconDetection;
509 
510  if((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (NULL == pLimited)) {
511  rc = BTRMGR_RESULT_INVALID_INPUT;
512  BTRMGRLOG_ERROR ("Input is invalid\n");
513  return rc;
514  }
515 
516  beaconDetection.m_adapterIndex = index_of_adapter;
517 
518  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_LIMIT_BEACON_DETECTION, (void *)&beaconDetection, sizeof(BTRMGR_IARMBeaconDetection_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
519  if (IARM_RESULT_SUCCESS == retCode) {
520  *pLimited = beaconDetection.m_limitBeaconDetection;
521  BTRMGRLOG_INFO ("Success; Beacon Detection Limited ? %s\n", (*pLimited ? "true" : "false"));
522  }
523  else {
524  rc = BTRMGR_RESULT_GENERIC_FAILURE;
525  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
526  }
527 
528  return rc;
529 }
530 
533  unsigned char index_of_adapter,
534  unsigned char limited
535 ) {
536 
537  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
538  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
539  BTRMGR_IARMBeaconDetection_t beaconDetection;
540 
541  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
542  rc = BTRMGR_RESULT_INVALID_INPUT;
543  BTRMGRLOG_ERROR ("Input is invalid\n");
544  return rc;
545  }
546 
547  memset (&beaconDetection, 0, sizeof(BTRMGR_IARMBeaconDetection_t));
548  beaconDetection.m_adapterIndex = index_of_adapter;
549  beaconDetection.m_limitBeaconDetection = limited;
550 
551  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_SET_LIMIT_BEACON_DETECTION, (void*)&beaconDetection, sizeof(BTRMGR_IARMBeaconDetection_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
552 
553  if (IARM_RESULT_SUCCESS == retCode) {
554  BTRMGRLOG_INFO ("Success\n");
555  }
556  else {
557  rc = BTRMGR_RESULT_GENERIC_FAILURE;
558  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
559  }
560 
561  return rc;
562 }
563 
566  unsigned char index_of_adapter,
567  const char* pNameOfAdapter
568 ) {
569  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
570  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
571  BTRMGR_IARMAdapterName_t adapterSetting;
572 
573  if((NULL == pNameOfAdapter) || (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter)) {
574  rc = BTRMGR_RESULT_INVALID_INPUT;
575  BTRMGRLOG_ERROR ("Input is invalid\n");
576  return rc;
577  }
578 
579 
580  adapterSetting.m_adapterIndex = index_of_adapter;
581  strncpy (adapterSetting.m_name, pNameOfAdapter, (BTRMGR_NAME_LEN_MAX - 1));
582 
583  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_SET_ADAPTER_NAME, (void *)&adapterSetting, sizeof(adapterSetting), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
584  if (IARM_RESULT_SUCCESS == retCode) {
585  BTRMGRLOG_INFO ("Success\n");
586  }
587  else {
588  rc = BTRMGR_RESULT_GENERIC_FAILURE;
589  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
590  }
591 
592  return rc;
593 }
594 
597  unsigned char index_of_adapter,
598  char* pNameOfAdapter
599 ) {
600  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
601  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
602  BTRMGR_IARMAdapterName_t adapterSetting;
603 
604  if((NULL == pNameOfAdapter) || (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter)) {
605  rc = BTRMGR_RESULT_INVALID_INPUT;
606  BTRMGRLOG_ERROR ("Input is invalid\n");
607  return rc;
608  }
609 
610 
611  adapterSetting.m_adapterIndex = index_of_adapter;
612  memset (adapterSetting.m_name, '\0', sizeof (adapterSetting.m_name));
613 
614  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_ADAPTER_NAME, (void *)&adapterSetting, sizeof(adapterSetting), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
615  if (IARM_RESULT_SUCCESS == retCode) {
616  strncpy (pNameOfAdapter, adapterSetting.m_name, (BTRMGR_NAME_LEN_MAX - 1));
617  BTRMGRLOG_INFO ("Success\n");
618  }
619  else {
620  rc = BTRMGR_RESULT_GENERIC_FAILURE;
621  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
622  }
623 
624  return rc;
625 }
626 
629  unsigned char index_of_adapter,
630  unsigned char power_status
631 ) {
632  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
633  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
634  BTRMGR_IARMAdapterPower_t powerStatus;
635 
636  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (power_status > 1)) {
637  rc = BTRMGR_RESULT_INVALID_INPUT;
638  BTRMGRLOG_ERROR ("Input is invalid\n");
639  return rc;
640  }
641 
642 
643  powerStatus.m_adapterIndex = index_of_adapter;
644  powerStatus.m_powerStatus = power_status;
645 
646  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_SET_ADAPTER_POWERSTATUS, (void *)&powerStatus, sizeof(powerStatus), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
647  if (IARM_RESULT_SUCCESS == retCode) {
648  BTRMGRLOG_INFO ("Success\n");
649  }
650  else {
651  rc = BTRMGR_RESULT_GENERIC_FAILURE;
652  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
653  }
654 
655  return rc;
656 }
657 
660  unsigned char index_of_adapter,
661  unsigned char* pPowerStatus
662 ) {
663  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
664  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
665  BTRMGR_IARMAdapterPower_t powerStatus;
666 
667  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (NULL == pPowerStatus)) {
668  rc = BTRMGR_RESULT_INVALID_INPUT;
669  BTRMGRLOG_ERROR ("Input is invalid\n");
670  return rc;
671  }
672 
673 
674  powerStatus.m_adapterIndex = index_of_adapter;
675 
676  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_ADAPTER_POWERSTATUS, (void *)&powerStatus, sizeof(powerStatus), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
677  if (IARM_RESULT_SUCCESS == retCode) {
678  *pPowerStatus = powerStatus.m_powerStatus;
679  BTRMGRLOG_INFO ("Success\n");
680  }
681  else {
682  rc = BTRMGR_RESULT_GENERIC_FAILURE;
683  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
684  }
685 
686  return rc;
687 }
688 
691  unsigned char index_of_adapter,
692  unsigned char discoverable,
693  int timeout
694 ) {
695  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
696  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
697  BTRMGR_IARMAdapterDiscoverable_t discoverableSetting;
698 
699  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (discoverable > 1)) {
700  rc = BTRMGR_RESULT_INVALID_INPUT;
701  BTRMGRLOG_ERROR ("Input is invalid\n");
702  return rc;
703  }
704 
705 
706  discoverableSetting.m_adapterIndex = index_of_adapter;
707  discoverableSetting.m_isDiscoverable = discoverable;
708  discoverableSetting.m_timeout = timeout;
709 
710  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_SET_ADAPTER_DISCOVERABLE, (void *)&discoverableSetting, sizeof(discoverableSetting), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
711  if (IARM_RESULT_SUCCESS == retCode) {
712  BTRMGRLOG_INFO ("Success\n");
713  }
714  else {
715  rc = BTRMGR_RESULT_GENERIC_FAILURE;
716  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
717  }
718 
719  return rc;
720 }
721 
722 
725  unsigned char index_of_adapter,
726  unsigned char* pDiscoverable
727 ) {
728  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
729  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
730  BTRMGR_IARMAdapterDiscoverable_t discoverableSetting;
731 
732  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (NULL == pDiscoverable)) {
733  rc = BTRMGR_RESULT_INVALID_INPUT;
734  BTRMGRLOG_ERROR ("Input is invalid\n");
735  return rc;
736  }
737 
738 
739  discoverableSetting.m_adapterIndex = index_of_adapter;
740  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_IS_ADAPTER_DISCOVERABLE, (void *)&discoverableSetting, sizeof(discoverableSetting), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
741  if (IARM_RESULT_SUCCESS == retCode) {
742  *pDiscoverable = discoverableSetting.m_isDiscoverable;
743  BTRMGRLOG_INFO ("Success\n");
744  }
745  else {
746  rc = BTRMGR_RESULT_GENERIC_FAILURE;
747  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
748  }
749 
750  return rc;
751 }
752 
753 
756  unsigned char index_of_adapter,
757  BTRMGR_DeviceOperationType_t aenBTRMgrDevOpT
758 ) {
759  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
760  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
761  BTRMGR_IARMAdapterDiscover_t deviceDiscovery;
762 
763  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
764  rc = BTRMGR_RESULT_INVALID_INPUT;
765  BTRMGRLOG_ERROR ("Input is invalid\n");
766  return rc;
767  }
768 
769 
770  deviceDiscovery.m_adapterIndex = index_of_adapter;
771  deviceDiscovery.m_setDiscovery = 1; /* TRUE */
772  deviceDiscovery.m_enBTRMgrDevOpT= aenBTRMgrDevOpT;
773 
774  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_CHANGE_DEVICE_DISCOVERY_STATUS, (void *)&deviceDiscovery, sizeof(deviceDiscovery), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
775  if (IARM_RESULT_SUCCESS == retCode) {
776  BTRMGRLOG_INFO ("Success\n");
777  }
778  else {
779  rc = BTRMGR_RESULT_GENERIC_FAILURE;
780  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
781  }
782 
783  return rc;
784 }
785 
788  unsigned char index_of_adapter,
789  BTRMGR_DeviceOperationType_t aenBTRMgrDevOpT
790 ) {
791  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
792  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
793  BTRMGR_IARMAdapterDiscover_t deviceDiscovery;
794 
795  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
796  rc = BTRMGR_RESULT_INVALID_INPUT;
797  BTRMGRLOG_ERROR ("Input is invalid\n");
798  return rc;
799  }
800 
801 
802  deviceDiscovery.m_adapterIndex = index_of_adapter;
803  deviceDiscovery.m_setDiscovery = 0; /* FALSE */
804  deviceDiscovery.m_enBTRMgrDevOpT= aenBTRMgrDevOpT;
805 
806  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_CHANGE_DEVICE_DISCOVERY_STATUS, (void *)&deviceDiscovery, sizeof(deviceDiscovery), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
807  if (IARM_RESULT_SUCCESS == retCode) {
808  BTRMGRLOG_INFO ("Success\n");
809  }
810  else {
811  rc = BTRMGR_RESULT_GENERIC_FAILURE;
812  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
813  }
814 
815  return rc;
816 }
817 
820  unsigned char aui8AdapterIdx,
821  BTRMGR_DiscoveryStatus_t *isDiscoveryInProgress,
822  BTRMGR_DeviceOperationType_t *aenBTRMgrDevOpT
823 ) {
824  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
825  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
826  BTRMGR_IARMDiscoveryStatus_t discoveryStatus;
827 
828  memset (&discoveryStatus, 0, sizeof(BTRMGR_IARMDiscoveryStatus_t));
829  discoveryStatus.m_adapterIndex = aui8AdapterIdx;
830 
831  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_DISCOVERY_STATUS, (void *)&discoveryStatus, sizeof(discoveryStatus), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
832 
833  if (IARM_RESULT_SUCCESS == retCode) {
834  *isDiscoveryInProgress = discoveryStatus.m_discoveryInProgress;
835  *aenBTRMgrDevOpT = discoveryStatus.m_discoveryType;
836  BTRMGRLOG_INFO ("Success; Discovery State = %d\n", discoveryStatus.m_discoveryInProgress);
837  }
838  else {
839  rc = BTRMGR_RESULT_GENERIC_FAILURE;
840  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
841  }
842 
843  return rc;
844 }
845 
848  unsigned char index_of_adapter,
849  BTRMGR_DiscoveredDevicesList_t* pDiscoveredDevices
850 ) {
851  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
852  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
853  BTRMGR_IARMDiscoveredDevices_t discoveredDevices;
854 
855  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (NULL == pDiscoveredDevices)) {
856  rc = BTRMGR_RESULT_INVALID_INPUT;
857  BTRMGRLOG_ERROR ("Input is invalid\n");
858  return rc;
859  }
860 
861 
862  memset (&discoveredDevices, 0, sizeof(discoveredDevices));
863  discoveredDevices.m_adapterIndex = index_of_adapter;
864 
865  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_DISCOVERED_DEVICES, (void *)&discoveredDevices, sizeof(discoveredDevices), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
866  if (IARM_RESULT_SUCCESS == retCode) {
867  memcpy (pDiscoveredDevices, &discoveredDevices.m_devices, sizeof(BTRMGR_DiscoveredDevicesList_t));
868  BTRMGRLOG_INFO ("Success\n");
869  }
870  else {
871  rc = BTRMGR_RESULT_GENERIC_FAILURE;
872  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
873  }
874 
875  return rc;
876 }
877 
880  unsigned char index_of_adapter,
881  BTRMgrDeviceHandle handle
882 ) {
883  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
884  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
885  BTRMGR_IARMPairDevice_t newDevice;
886 
887  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (0 == handle)) {
888  rc = BTRMGR_RESULT_INVALID_INPUT;
889  BTRMGRLOG_ERROR ("Input is invalid\n");
890  return rc;
891  }
892 
893 
894  memset (&newDevice, 0, sizeof(newDevice));
895  newDevice.m_adapterIndex = index_of_adapter;
896  newDevice.m_deviceHandle = handle;
897 
898  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_PAIR_DEVICE, (void *)&newDevice, sizeof(newDevice), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
899  if (IARM_RESULT_SUCCESS == retCode) {
900  BTRMGRLOG_INFO ("Success\n");
901  }
902  else {
903  rc = BTRMGR_RESULT_GENERIC_FAILURE;
904  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
905  }
906 
907  return rc;
908 }
909 
912  unsigned char index_of_adapter,
913  BTRMgrDeviceHandle handle
914 ) {
915  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
916  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
917  BTRMGR_IARMPairDevice_t removeDevice;
918 
919  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (0 == handle)) {
920  rc = BTRMGR_RESULT_INVALID_INPUT;
921  BTRMGRLOG_ERROR ("Input is invalid\n");
922  return rc;
923  }
924 
925 
926  memset (&removeDevice, 0, sizeof(removeDevice));
927  removeDevice.m_adapterIndex = index_of_adapter;
928  removeDevice.m_deviceHandle = handle;
929 
930  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_UNPAIR_DEVICE, (void *)&removeDevice, sizeof(removeDevice), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
931  if (IARM_RESULT_SUCCESS == retCode) {
932  BTRMGRLOG_INFO ("Success\n");
933  }
934  else {
935  rc = BTRMGR_RESULT_GENERIC_FAILURE;
936  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
937  }
938 
939  return rc;
940 }
941 
944  unsigned char index_of_adapter,
945  BTRMGR_PairedDevicesList_t* pPairedDevices
946 ) {
947  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
948  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
949  BTRMGR_IARMPairedDevices_t pairedDevices;
950 
951  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (NULL == pPairedDevices)) {
952  rc = BTRMGR_RESULT_INVALID_INPUT;
953  BTRMGRLOG_ERROR ("Input is invalid\n");
954  return rc;
955  }
956 
957 
958  memset (&pairedDevices, 0, sizeof(pairedDevices));
959  pairedDevices.m_adapterIndex = index_of_adapter;
960 
961  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_PAIRED_DEVICES, (void *)&pairedDevices, sizeof(pairedDevices), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
962  if (IARM_RESULT_SUCCESS == retCode) {
963  memcpy (pPairedDevices, &pairedDevices.m_devices, sizeof(BTRMGR_PairedDevicesList_t));
964  BTRMGRLOG_INFO ("Success\n");
965  }
966  else {
967  rc = BTRMGR_RESULT_GENERIC_FAILURE;
968  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
969  }
970 
971  return rc;
972 }
973 
976  unsigned char index_of_adapter,
977  BTRMgrDeviceHandle handle,
979 ) {
980  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
981  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
982  BTRMGR_IARMConnectDevice_t connectToDevice;
983 
984  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (0 == handle)) {
985  rc = BTRMGR_RESULT_INVALID_INPUT;
986  BTRMGRLOG_ERROR ("Input is invalid\n");
987  return rc;
988  }
989 
990 
991  connectToDevice.m_adapterIndex = index_of_adapter;
992  connectToDevice.m_connectAs = connectAs;
993  connectToDevice.m_deviceHandle = handle;
994 
995  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_CONNECT_TO_DEVICE, (void *)&connectToDevice, sizeof(connectToDevice), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
996  if (IARM_RESULT_SUCCESS == retCode) {
997  BTRMGRLOG_INFO ("Success\n");
998  }
999  else {
1000  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1001  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1002  }
1003 
1004  return rc;
1005 }
1006 
1009  unsigned char index_of_adapter,
1010  BTRMgrDeviceHandle handle
1011 ) {
1012  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1013  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1014  BTRMGR_IARMConnectDevice_t disConnectToDevice;
1015 
1016  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (0 == handle)) {
1017  rc = BTRMGR_RESULT_INVALID_INPUT;
1018  BTRMGRLOG_ERROR ("Input is invalid\n");
1019  return rc;
1020  }
1021 
1022 
1023  disConnectToDevice.m_adapterIndex = index_of_adapter;
1024  disConnectToDevice.m_deviceHandle = handle;
1025 
1026  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_DISCONNECT_FROM_DEVICE, (void *)&disConnectToDevice, sizeof(disConnectToDevice), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1027  if (IARM_RESULT_SUCCESS == retCode) {
1028  BTRMGRLOG_INFO ("Success\n");
1029  }
1030  else {
1031  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1032  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1033  }
1034 
1035  return rc;
1036 }
1037 
1038 
1041  unsigned char index_of_adapter,
1042  BTRMGR_ConnectedDevicesList_t* pConnectedDevices
1043 ) {
1044  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1045  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1046  BTRMGR_IARMConnectedDevices_t connectedDevices;
1047 
1048  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (NULL == pConnectedDevices)) {
1049  rc = BTRMGR_RESULT_INVALID_INPUT;
1050  BTRMGRLOG_ERROR ("Input is invalid\n");
1051  return rc;
1052  }
1053 
1054 
1055  memset (&connectedDevices, 0, sizeof(connectedDevices));
1056  connectedDevices.m_adapterIndex = index_of_adapter;
1057 
1058  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_CONNECTED_DEVICES, (void *)&connectedDevices, sizeof(connectedDevices), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1059  if (IARM_RESULT_SUCCESS == retCode) {
1060  memcpy (pConnectedDevices, &connectedDevices.m_devices, sizeof(BTRMGR_ConnectedDevicesList_t));
1061  BTRMGRLOG_INFO ("Success\n");
1062  }
1063  else {
1064  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1065  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1066  }
1067 
1068  return rc;
1069 }
1070 
1073  unsigned char index_of_adapter,
1074  BTRMgrDeviceHandle handle,
1075  BTRMGR_DevicesProperty_t* pDeviceProperty
1076 ) {
1077  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1078  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1079  BTRMGR_IARMDDeviceProperty_t deviceProperty;
1080 
1081  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (0 == handle) || (NULL == pDeviceProperty)) {
1082  rc = BTRMGR_RESULT_INVALID_INPUT;
1083  BTRMGRLOG_ERROR ("Input is invalid\n");
1084  return rc;
1085  }
1086 
1087 
1088  deviceProperty.m_adapterIndex = index_of_adapter;
1089  deviceProperty.m_deviceHandle = handle;
1090 
1091  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_DEVICE_PROPERTIES, (void *)&deviceProperty, sizeof(deviceProperty), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1092  if (IARM_RESULT_SUCCESS == retCode) {
1093  memcpy (pDeviceProperty, &deviceProperty.m_deviceProperty, sizeof(BTRMGR_DevicesProperty_t));
1094  BTRMGRLOG_INFO ("Success\n");
1095  }
1096  else {
1097  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1098  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1099  }
1100 
1101  return rc;
1102 }
1103 
1104 
1107  unsigned char index_of_adapter,
1108  BTRMgrDeviceHandle handle,
1109  BTRMGR_DeviceOperationType_t streamOutPref
1110 ) {
1111  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1112  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1113  BTRMGR_IARMStreaming_t streaming;
1114 
1115  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (0 == handle)) {
1116  rc = BTRMGR_RESULT_INVALID_INPUT;
1117  BTRMGRLOG_ERROR ("Input is invalid\n");
1118  return rc;
1119  }
1120 
1121 
1122  streaming.m_adapterIndex = index_of_adapter;
1123  streaming.m_deviceHandle = handle;
1124  streaming.m_audioPref = streamOutPref;
1125 
1126  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_START_AUDIO_STREAMING_OUT, (void *)&streaming, sizeof(streaming), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1127  if (IARM_RESULT_SUCCESS == retCode) {
1128  BTRMGRLOG_INFO ("Success\n");
1129  }
1130  else {
1131  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1132  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1133  }
1134 
1135  return rc;
1136 }
1137 
1140  unsigned char index_of_adapter,
1141  BTRMgrDeviceHandle handle
1142 ) {
1143  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1144  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1145  BTRMGR_IARMStreaming_t streaming;
1146 
1147  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (0 == handle)) {
1148  rc = BTRMGR_RESULT_INVALID_INPUT;
1149  BTRMGRLOG_ERROR ("Input is invalid\n");
1150  return rc;
1151  }
1152 
1153 
1154  streaming.m_adapterIndex = index_of_adapter;
1155  streaming.m_deviceHandle = handle;
1156 
1157  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_STOP_AUDIO_STREAMING_OUT, (void*) &streaming, sizeof(streaming), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1158  if (IARM_RESULT_SUCCESS == retCode) {
1159  BTRMGRLOG_INFO ("Success\n");
1160  }
1161  else {
1162  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1163  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1164  }
1165 
1166  return rc;
1167 }
1168 
1171  unsigned char index_of_adapter,
1172  unsigned char* pStreamingStatus
1173 ) {
1174  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1175  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1177 
1178  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (NULL == pStreamingStatus)) {
1179  rc = BTRMGR_RESULT_INVALID_INPUT;
1180  BTRMGRLOG_ERROR ("Input is invalid\n");
1181  return rc;
1182  }
1183 
1184 
1185  status.m_adapterIndex = index_of_adapter;
1186  status.m_streamingStatus = 0;
1187 
1188  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_IS_AUDIO_STREAMING_OUT, (void *)&status, sizeof(status), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1189  if (IARM_RESULT_SUCCESS == retCode) {
1190  *pStreamingStatus = status.m_streamingStatus;
1191  BTRMGRLOG_INFO ("Success\n");
1192  }
1193  else {
1194  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1195  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1196  }
1197 
1198  return rc;
1199 }
1200 
1203  unsigned char index_of_adapter,
1205 ) {
1206  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1207  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1208  BTRMGR_IARMStreamingType_t streamingType;
1209 
1210  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
1211  rc = BTRMGR_RESULT_INVALID_INPUT;
1212  BTRMGRLOG_ERROR ("Input is invalid\n");
1213  return rc;
1214  }
1215 
1216 
1217  streamingType.m_adapterIndex = index_of_adapter;
1218  streamingType.m_audioOutType = type;
1219 
1220  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_SET_AUDIO_STREAM_OUT_TYPE, (void *)&streamingType, sizeof(streamingType), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1221  if (IARM_RESULT_SUCCESS == retCode) {
1222  BTRMGRLOG_INFO ("Success\n");
1223  }
1224  else {
1225  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1226  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1227  }
1228 
1229  return rc;
1230 }
1231 
1232 
1235  unsigned char ui8AdapterIdx,
1236  BTRMgrDeviceHandle handle,
1237  BTRMGR_DeviceOperationType_t streamOutPref
1238 ) {
1239  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1240  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1241  BTRMGR_IARMStreaming_t streaming;
1242 
1243  if ((BTRMGR_ADAPTER_COUNT_MAX < ui8AdapterIdx) || (0 == handle)) {
1244  rc = BTRMGR_RESULT_INVALID_INPUT;
1245  BTRMGRLOG_ERROR ("Input is invalid\n");
1246  return rc;
1247  }
1248 
1249 
1250  streaming.m_adapterIndex = ui8AdapterIdx;
1251  streaming.m_deviceHandle = handle;
1252  streaming.m_audioPref = streamOutPref;
1253 
1254  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_START_AUDIO_STREAMING_IN, (void *)&streaming, sizeof(streaming), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1255  if (IARM_RESULT_SUCCESS == retCode) {
1256  BTRMGRLOG_INFO ("Success\n");
1257  }
1258  else {
1259  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1260  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1261  }
1262 
1263  return rc;
1264 }
1265 
1268  unsigned char ui8AdapterIdx,
1269  BTRMgrDeviceHandle handle
1270 ) {
1271  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1272  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1273  BTRMGR_IARMStreaming_t streaming;
1274 
1275  if ((BTRMGR_ADAPTER_COUNT_MAX < ui8AdapterIdx) || (0 == handle)) {
1276  rc = BTRMGR_RESULT_INVALID_INPUT;
1277  BTRMGRLOG_ERROR ("Input is invalid\n");
1278  return rc;
1279  }
1280 
1281 
1282  streaming.m_adapterIndex = ui8AdapterIdx;
1283  streaming.m_deviceHandle = handle;
1284 
1285  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_STOP_AUDIO_STREAMING_IN, (void*) &streaming, sizeof(streaming), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1286  if (IARM_RESULT_SUCCESS == retCode) {
1287  BTRMGRLOG_INFO ("Success\n");
1288  }
1289  else {
1290  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1291  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1292  }
1293 
1294  return rc;
1295 }
1296 
1299  unsigned char ui8AdapterIdx,
1300  unsigned char* pStreamingStatus
1301 ) {
1302  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1303  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1305 
1306  if ((BTRMGR_ADAPTER_COUNT_MAX < ui8AdapterIdx) || (NULL == pStreamingStatus)) {
1307  rc = BTRMGR_RESULT_INVALID_INPUT;
1308  BTRMGRLOG_ERROR ("Input is invalid\n");
1309  return rc;
1310  }
1311 
1312 
1313  status.m_adapterIndex = ui8AdapterIdx;
1314  status.m_streamingStatus = 0;
1315 
1316  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_IS_AUDIO_STREAMING_IN, (void *)&status, sizeof(status), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1317  if (IARM_RESULT_SUCCESS == retCode) {
1318  *pStreamingStatus = status.m_streamingStatus;
1319  BTRMGRLOG_INFO ("Success\n");
1320  }
1321  else {
1322  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1323  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1324  }
1325 
1326  return rc;
1327 }
1328 
1331  unsigned char index_of_adapter,
1332  BTRMGR_EventResponse_t* apstBTRMgrEvtRsp
1333 ) {
1334  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1335  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1336  BTRMGR_IARMEventResp_t lstBtrMgrIArmEvtResp;
1337 
1338  if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (apstBTRMgrEvtRsp == NULL)) {
1339  rc = BTRMGR_RESULT_INVALID_INPUT;
1340  BTRMGRLOG_ERROR ("Input is invalid\n");
1341  return rc;
1342  }
1343 
1344  lstBtrMgrIArmEvtResp.m_adapterIndex = index_of_adapter;
1345  memcpy(&lstBtrMgrIArmEvtResp.m_stBTRMgrEvtRsp, apstBTRMgrEvtRsp, sizeof(BTRMGR_EventResponse_t));
1346 
1347  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_SET_EVENT_RESPONSE, (void *)&lstBtrMgrIArmEvtResp, sizeof(lstBtrMgrIArmEvtResp), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1348  if (IARM_RESULT_SUCCESS == retCode) {
1349  BTRMGRLOG_INFO ("Success\n");
1350  }
1351  else {
1352  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1353  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1354  }
1355 
1356  return rc;
1357 }
1358 
1359 
1362  unsigned char index_of_adapter,
1363  BTRMgrDeviceHandle handle,
1364  BTRMGR_MediaControlCommand_t mediaCtrlCmd
1365 ) {
1366  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1367  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1368  BTRMGR_IARMMediaProperty_t mediaProperty;
1369 
1370  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
1371  rc = BTRMGR_RESULT_INVALID_INPUT;
1372  BTRMGRLOG_ERROR ("Input is invalid\n");
1373  return rc;
1374  }
1375 
1376  memset (&mediaProperty, 0, sizeof(BTRMGR_IARMMediaProperty_t));
1377  mediaProperty.m_adapterIndex = index_of_adapter;
1378  mediaProperty.m_deviceHandle = handle;
1379  mediaProperty.m_mediaControlCmd = mediaCtrlCmd;
1380 
1381  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_MEDIA_CONTROL, (void*)&mediaProperty, sizeof(BTRMGR_IARMMediaProperty_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1382  if (IARM_RESULT_SUCCESS == retCode) {
1383  BTRMGRLOG_INFO ("Success\n");
1384  }
1385  else {
1386  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1387  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1388  }
1389 
1390  return rc;
1391 }
1392 
1393 
1396  unsigned char aui8AdapterIdx,
1397  BTRMgrDeviceHandle ahBTRMgrDevHdl,
1398  BTRMGR_DeviceOperationType_t deviceOpType,
1399  unsigned char *pui8Volume,
1400  unsigned char *pui8Mute
1401 ) {
1402 
1403  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1404  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1406 
1407  if (BTRMGR_ADAPTER_COUNT_MAX < aui8AdapterIdx || NULL == pui8Volume || NULL == pui8Mute) {
1408  rc = BTRMGR_RESULT_INVALID_INPUT;
1409  BTRMGRLOG_ERROR ("Input is invalid\n");
1410  return rc;
1411  }
1412 
1413  memset (&devvolmut, 0, sizeof(BTRMGR_IARMDeviceVolumeMute_t));
1414  devvolmut.m_adapterIndex = aui8AdapterIdx;
1415  devvolmut.m_deviceHandle = ahBTRMgrDevHdl;
1416  devvolmut.m_deviceOpType = deviceOpType;
1417 
1418  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_DEVICE_VOLUME_MUTE_INFO, (void*)&devvolmut, sizeof(BTRMGR_IARMMediaProperty_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1419 
1420  if (IARM_RESULT_SUCCESS == retCode) {
1421  *pui8Volume = devvolmut.m_volume;
1422  *pui8Mute = devvolmut.m_mute;
1423  BTRMGRLOG_INFO ("Success\n");
1424  }
1425  else {
1426  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1427  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1428  }
1429 
1430  return rc;
1431 }
1432 
1433 
1436  unsigned char aui8AdapterIdx,
1437  BTRMgrDeviceHandle ahBTRMgrDevHdl,
1438  BTRMGR_DeviceOperationType_t deviceOpType,
1439  unsigned char ui8Volume,
1440  unsigned char ui8Mute
1441 ) {
1442 
1443  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1444  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1446 
1447  if (BTRMGR_ADAPTER_COUNT_MAX < aui8AdapterIdx || ui8Mute > 1) {
1448  rc = BTRMGR_RESULT_INVALID_INPUT;
1449  BTRMGRLOG_ERROR ("Input is invalid\n");
1450  return rc;
1451  }
1452 
1453  memset (&devvolmut, 0, sizeof(BTRMGR_IARMDeviceVolumeMute_t));
1454  devvolmut.m_adapterIndex = aui8AdapterIdx;
1455  devvolmut.m_deviceHandle = ahBTRMgrDevHdl;
1456  devvolmut.m_deviceOpType = deviceOpType;
1457  devvolmut.m_volume = ui8Volume;
1458  devvolmut.m_mute = ui8Mute;
1459 
1460  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_SET_DEVICE_VOLUME_MUTE_INFO, (void*)&devvolmut, sizeof(BTRMGR_IARMMediaProperty_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1461 
1462  if (IARM_RESULT_SUCCESS == retCode) {
1463  BTRMGRLOG_INFO ("Success\n");
1464  }
1465  else {
1466  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1467  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1468  }
1469 
1470  return rc;
1471 }
1472 
1475  unsigned char index_of_adapter,
1476  BTRMgrDeviceHandle handle,
1477  BTRMGR_MediaTrackInfo_t* mediaTrackInfo
1478 ) {
1479  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1480  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1481  BTRMGR_IARMMediaProperty_t mediaProperty;
1482 
1483  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter || NULL == mediaTrackInfo) {
1484  rc = BTRMGR_RESULT_INVALID_INPUT;
1485  BTRMGRLOG_ERROR ("Input is invalid\n");
1486  return rc;
1487  }
1488 
1489  memset (&mediaProperty, 0, sizeof(BTRMGR_IARMMediaProperty_t));
1490  mediaProperty.m_adapterIndex = index_of_adapter;
1491  mediaProperty.m_deviceHandle = handle;
1492 
1493  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_MEDIA_TRACK_INFO, (void*)&mediaProperty, sizeof(BTRMGR_IARMMediaProperty_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1494 
1495  if (IARM_RESULT_SUCCESS == retCode) {
1496  memcpy (mediaTrackInfo, &mediaProperty.m_mediaTrackInfo, sizeof(BTRMGR_MediaTrackInfo_t));
1497  BTRMGRLOG_INFO ("Success\n");
1498  }
1499  else {
1500  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1501  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1502  }
1503 
1504  return rc;
1505 }
1506 
1509  unsigned char index_of_adapter,
1510  BTRMgrDeviceHandle handle,
1511  BTRMgrMediaElementHandle mediaElementHandle,
1512  BTRMGR_MediaTrackInfo_t* mediaTrackInfo
1513 ) {
1514  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1515  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1516  BTRMGR_IARMMediaProperty_t mediaProperty;
1517 
1518  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter || NULL == mediaTrackInfo) {
1519  rc = BTRMGR_RESULT_INVALID_INPUT;
1520  BTRMGRLOG_ERROR ("Input is invalid\n");
1521  return rc;
1522  }
1523 
1524  memset (&mediaProperty, 0, sizeof(BTRMGR_IARMMediaProperty_t));
1525  mediaProperty.m_adapterIndex = index_of_adapter;
1526  mediaProperty.m_deviceHandle = handle;
1527  mediaProperty.m_mediaElementHandle = mediaElementHandle;
1528 
1529  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_MEDIA_ELEMENT_TRACK_INFO, (void*)&mediaProperty, sizeof(BTRMGR_IARMMediaProperty_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1530 
1531  if (IARM_RESULT_SUCCESS == retCode) {
1532  memcpy (mediaTrackInfo, &mediaProperty.m_mediaTrackInfo, sizeof(BTRMGR_MediaTrackInfo_t));
1533  BTRMGRLOG_INFO ("Success\n");
1534  }
1535  else {
1536  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1537  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1538  }
1539 
1540  return rc;
1541 }
1542 
1545  unsigned char index_of_adapter,
1546  BTRMgrDeviceHandle handle,
1547  BTRMGR_MediaPositionInfo_t* mediaPositionInfo
1548 ) {
1549  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1550  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1551  BTRMGR_IARMMediaProperty_t mediaProperty;
1552 
1553  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter || NULL == mediaPositionInfo) {
1554  rc = BTRMGR_RESULT_INVALID_INPUT;
1555  BTRMGRLOG_ERROR ("Input is invalid\n");
1556  return rc;
1557  }
1558 
1559  memset (&mediaProperty, 0, sizeof(BTRMGR_IARMMediaProperty_t));
1560  mediaProperty.m_adapterIndex = index_of_adapter;
1561  mediaProperty.m_deviceHandle = handle;
1562 
1563  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_MEDIA_CURRENT_POSITION, (void*)&mediaProperty, sizeof(BTRMGR_IARMMediaProperty_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1564 
1565  if (IARM_RESULT_SUCCESS == retCode) {
1566  memcpy (mediaPositionInfo, &mediaProperty.m_mediaPositionInfo, sizeof(BTRMGR_MediaPositionInfo_t));
1567  BTRMGRLOG_INFO ("Success\n");
1568  }
1569  else {
1570  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1571  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1572  }
1573 
1574  return rc;
1575 }
1576 
1577 
1580  unsigned char index_of_adapter,
1581  BTRMgrDeviceHandle deviceHandle,
1582  BTRMgrMediaElementHandle mediaElementHandle,
1583  BTRMGR_MediaElementType_t mediaElementType
1584 ) {
1585  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1586  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1587  BTRMGR_IARMMediaElementListInfo_t mediaElementList;
1588 
1589  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
1590  rc = BTRMGR_RESULT_INVALID_INPUT;
1591  BTRMGRLOG_ERROR ("Input is invalid\n");
1592  return rc;
1593  }
1594 
1595  memset (&mediaElementList, 0, sizeof(BTRMGR_IARMMediaElementListInfo_t));
1596  mediaElementList.m_adapterIndex = index_of_adapter;
1597  mediaElementList.m_deviceHandle = deviceHandle;
1598  mediaElementList.m_mediaElementHandle = mediaElementHandle;
1599  mediaElementList.m_mediaElementType = mediaElementType;
1600 
1601  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_SET_MEDIA_ELEMENT_ACTIVE, (void*)&mediaElementList, sizeof(BTRMGR_IARMMediaElementListInfo_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1602 
1603  if (IARM_RESULT_SUCCESS == retCode) {
1604  BTRMGRLOG_INFO ("Success\n");
1605  }
1606  else {
1607  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1608  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1609  }
1610 
1611  return rc;
1612 }
1613 
1614 
1617  unsigned char index_of_adapter,
1618  BTRMgrDeviceHandle deviceHandle,
1619  BTRMgrMediaElementHandle mediaElementHandle,
1620  unsigned short mediaElementStartIdx,
1621  unsigned short mediaElementEndIdx,
1622  unsigned char mediaElementListDepth,
1623  BTRMGR_MediaElementType_t mediaElementType,
1624  BTRMGR_MediaElementListInfo_t* mediaElementListInfo
1625 ) {
1626  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1627  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1628  BTRMGR_IARMMediaElementListInfo_t mediaElementList;
1629 
1630  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter || !mediaElementListInfo) {
1631  rc = BTRMGR_RESULT_INVALID_INPUT;
1632  BTRMGRLOG_ERROR ("Input is invalid\n");
1633  return rc;
1634  }
1635 
1636  memset (&mediaElementList, 0, sizeof(BTRMGR_IARMMediaElementListInfo_t));
1637  mediaElementList.m_adapterIndex = index_of_adapter;
1638  mediaElementList.m_deviceHandle = deviceHandle;
1639  mediaElementList.m_mediaElementHandle = mediaElementHandle;
1640  mediaElementList.m_mediaElementStartIdx = mediaElementStartIdx;
1641  mediaElementList.m_mediaElementEndIdx = mediaElementEndIdx;
1642  mediaElementList.m_mediaElementListDepth= mediaElementListDepth;
1643  mediaElementList.m_mediaElementType = mediaElementType;
1644 
1645  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_MEDIA_ELEMENT_LIST, (void*)&mediaElementList, sizeof(BTRMGR_IARMMediaElementListInfo_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1646 
1647  if (IARM_RESULT_SUCCESS == retCode) {
1648  BTRMGRLOG_INFO ("Success\n");
1649  memcpy (mediaElementListInfo, &mediaElementList.m_mediaTrackListInfo, sizeof(BTRMGR_MediaElementListInfo_t));
1650  }
1651  else {
1652  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1653  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1654  }
1655 
1656  return rc;
1657 }
1658 
1659 
1662  unsigned char index_of_adapter,
1663  BTRMgrDeviceHandle deviceHandle,
1664  BTRMgrMediaElementHandle mediaElementHandle,
1665  BTRMGR_MediaElementType_t mediaElementType
1666 
1667 ) {
1668  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1669  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1670  BTRMGR_IARMMediaElementListInfo_t mediaElementList;
1671 
1672  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
1673  rc = BTRMGR_RESULT_INVALID_INPUT;
1674  BTRMGRLOG_ERROR ("Input is invalid\n");
1675  return rc;
1676  }
1677 
1678  memset (&mediaElementList, 0, sizeof(BTRMGR_IARMMediaElementListInfo_t));
1679  mediaElementList.m_adapterIndex = index_of_adapter;
1680  mediaElementList.m_deviceHandle = deviceHandle;
1681  mediaElementList.m_mediaElementHandle = mediaElementHandle;
1682  mediaElementList.m_mediaElementType = mediaElementType;
1683 
1684 
1685 
1686  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_SELECT_MEDIA_ELEMENT, (void*)&mediaElementList, sizeof(BTRMGR_IARMMediaElementListInfo_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1687 
1688  if (IARM_RESULT_SUCCESS == retCode) {
1689  BTRMGRLOG_INFO ("Success\n");
1690  }
1691  else {
1692  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1693  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1694  }
1695 
1696  return rc;
1697 }
1698 
1699 
1701 BTRMGR_GetLeProperty (
1702  unsigned char index_of_adapter,
1703  BTRMgrDeviceHandle handle,
1704  const char* apBtrUuid,
1705  BTRMGR_LeProperty_t aenLeProperty,
1706  void* apBtrPropValue
1707 ) {
1708 
1709  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1710  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1711  BTRMGR_IARMLeProperty_t leProperty;
1712 
1713  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter || !apBtrUuid) {
1714  rc = BTRMGR_RESULT_INVALID_INPUT;
1715  BTRMGRLOG_ERROR ("Input is invalid\n");
1716  return rc;
1717  }
1718 
1719  memset (&leProperty, 0, sizeof(BTRMGR_IARMLeProperty_t));
1720  leProperty.m_adapterIndex = index_of_adapter;
1721  leProperty.m_deviceHandle = handle;
1722  leProperty.m_enLeProperty = aenLeProperty;
1723  strncpy(leProperty.m_propUuid, apBtrUuid, BTRMGR_MAX_STR_LEN-1);
1724 
1725  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_LE_PROPERTY, (void*)&leProperty, sizeof(BTRMGR_IARMLeProperty_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1726 
1727  if (IARM_RESULT_SUCCESS == retCode) {
1728  switch (aenLeProperty) {
1729  case BTRMGR_LE_PROP_UUID:
1730  memcpy (apBtrPropValue, &leProperty.m_uuidList, sizeof(leProperty.m_uuidList));
1731  break;
1732  case BTRMGR_LE_PROP_DEVICE:
1733  memcpy (apBtrPropValue, &leProperty.m_devicePath, sizeof(leProperty.m_devicePath)-1);
1734  break;
1735  case BTRMGR_LE_PROP_SERVICE:
1736  memcpy (apBtrPropValue, &leProperty.m_servicePath, sizeof(leProperty.m_servicePath)-1);
1737  break;
1738  case BTRMGR_LE_PROP_CHAR:
1739  memcpy (apBtrPropValue, &leProperty.m_characteristicPath, sizeof(leProperty.m_characteristicPath)-1);
1740  break;
1741  case BTRMGR_LE_PROP_VALUE:
1742  memcpy (apBtrPropValue, &leProperty.m_value, sizeof(leProperty.m_value)-1);
1743  break;
1744  case BTRMGR_LE_PROP_PRIMARY:
1745  *(unsigned char*)apBtrPropValue = leProperty.m_primary;
1746  break;
1747  case BTRMGR_LE_PROP_NOTIFY:
1748  *(unsigned char*)apBtrPropValue = leProperty.m_notifying;
1749  break;
1750  case BTRMGR_LE_PROP_FLAGS:
1751  memcpy (apBtrPropValue, &leProperty.m_flags, sizeof(leProperty.m_flags));
1752  default:
1753  break;
1754  }
1755  BTRMGRLOG_INFO ("Success\n");
1756  }
1757  else {
1758  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1759  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1760  }
1761 
1762  return rc;
1763 }
1764 
1765 
1768  unsigned char index_of_adapter,
1769  BTRMgrDeviceHandle handle,
1770  const char* aBtrLeUuid,
1771  BTRMGR_LeOp_t aLeOpType,
1772  char* aLeOpArg,
1773  char* rOpResult
1774 ) {
1775  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1776  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1777  BTRMGR_IARMLeOp_t leOp;
1778 
1779  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter || NULL == aBtrLeUuid) {
1780  rc = BTRMGR_RESULT_INVALID_INPUT;
1781  BTRMGRLOG_ERROR ("Input is invalid\n");
1782  return rc;
1783  }
1784 
1785  memset (&leOp, 0, sizeof(BTRMGR_IARMLeOp_t));
1786  leOp.m_adapterIndex = index_of_adapter;
1787  leOp.m_deviceHandle = handle;
1788  leOp.m_leOpType = aLeOpType;
1789  strncpy(leOp.m_opArg, aLeOpArg, BTRMGR_MAX_STR_LEN-1);
1790  strncpy(leOp.m_uuid, aBtrLeUuid, BTRMGR_MAX_STR_LEN-1);
1791 
1792  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_PERFORM_LE_OP, (void*)&leOp, sizeof(BTRMGR_IARMLeOp_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1793 
1794  if (IARM_RESULT_SUCCESS == retCode) {
1795  if (BTRMGR_LE_OP_READ_VALUE == aLeOpType) {
1796  memcpy(rOpResult, leOp.m_opRes, BTRMGR_MAX_STR_LEN - 1);
1797  }
1798  BTRMGRLOG_INFO ("Success\n");
1799  }
1800  else {
1801  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1802  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1803  }
1804 
1805  return rc;
1806 }
1807 
1808 
1811  unsigned char index_of_adapter,
1812  unsigned char aui8ServiceState
1813 ) {
1814  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1815  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1816  BTRMGR_IARMAudioInServiceState_t audioInServiceState;
1817 
1818  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
1819  rc = BTRMGR_RESULT_INVALID_INPUT;
1820  BTRMGRLOG_ERROR ("Input is invalid\n");
1821  return rc;
1822  }
1823 
1824  memset (&audioInServiceState, 0, sizeof(BTRMGR_IARMAudioInServiceState_t));
1825  audioInServiceState.m_adapterIndex = index_of_adapter;
1826  audioInServiceState.m_serviceState = aui8ServiceState;
1827 
1828  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_SET_AUDIO_IN_SERVICE_STATE, (void*)&audioInServiceState, sizeof(BTRMGR_IARMAudioInServiceState_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1829 
1830  if (IARM_RESULT_SUCCESS == retCode) {
1831  BTRMGRLOG_INFO ("Success\n");
1832  }
1833  else {
1834  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1835  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1836  }
1837 
1838  return rc;
1839 }
1840 
1843  unsigned char index_of_adapter,
1844  unsigned char aui8ServiceState
1845 ) {
1846  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
1847  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1848  BTRMGR_IARMHidGamePadServiceState_t hidGamePadServiceState;
1849 
1850  if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
1851  rc = BTRMGR_RESULT_INVALID_INPUT;
1852  BTRMGRLOG_ERROR ("Input is invalid\n");
1853  return rc;
1854  }
1855 
1856  memset (&hidGamePadServiceState, 0, sizeof(BTRMGR_IARMHidGamePadServiceState_t));
1857  hidGamePadServiceState.m_adapterIndex = index_of_adapter;
1858  hidGamePadServiceState.m_serviceState = aui8ServiceState;
1859 
1860  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_SET_HID_GAMEPAD_SERVICE_STATE, (void*)&hidGamePadServiceState, sizeof(BTRMGR_IARMHidGamePadServiceState_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1861 
1862  if (IARM_RESULT_SUCCESS == retCode) {
1863  BTRMGRLOG_INFO ("Success\n");
1864  }
1865  else {
1866  rc = BTRMGR_RESULT_GENERIC_FAILURE;
1867  BTRMGRLOG_ERROR ("Failed; RetCode = %d\n", retCode);
1868  }
1869 
1870  return rc;
1871 }
1872 
1874 BTRMGR_SysDiagInfo(
1875  unsigned char aui8AdapterIdx,
1876  char *apDiagElement,
1877  char *apValue,
1878  BTRMGR_LeOp_t aOpType
1879 ) {
1880  BTRMGR_Result_t lenBtrMgrResult = BTRMGR_RESULT_SUCCESS;
1881  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1882  BTRMGR_IARMDiagInfo_t lDiagInfo;
1883 
1884  memset(&lDiagInfo, 0, sizeof(BTRMGR_IARMDiagInfo_t));
1885 
1886  if (BTRMGR_ADAPTER_COUNT_MAX < aui8AdapterIdx) {
1887  lenBtrMgrResult = BTRMGR_RESULT_INVALID_INPUT;
1888  BTRMGRLOG_ERROR("Input is invalid\n");
1889  return lenBtrMgrResult;
1890  }
1891 
1892  lDiagInfo.m_adapterIndex = aui8AdapterIdx;
1893  strncpy(lDiagInfo.m_UUID, apDiagElement, BTRMGR_MAX_STR_LEN - 1);
1894  lDiagInfo.m_OpType = aOpType;
1895  if (BTRMGR_LE_OP_WRITE_VALUE == aOpType)
1896  {
1897  strncpy(lDiagInfo.m_DiagInfo, apValue, BTRMGR_MAX_STR_LEN - 1);
1898  }
1899  BTRMGRLOG_INFO("calling BTRMGR_IARM_METHOD_GET_SYS_DIAG_INFO\n");
1900  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_GET_SYS_DIAG_INFO, (void*)&lDiagInfo, sizeof(BTRMGR_IARMDiagInfo_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1901 
1902  if (IARM_RESULT_SUCCESS == retCode) {
1903  if (BTRMGR_LE_OP_READ_VALUE == aOpType)
1904  {
1905  strncpy(apValue, lDiagInfo.m_DiagInfo, BTRMGR_MAX_STR_LEN - 1);
1906  }
1907  BTRMGRLOG_INFO("Success\n");
1908  }
1909  else {
1910  lenBtrMgrResult = BTRMGR_RESULT_GENERIC_FAILURE;
1911  BTRMGRLOG_ERROR("Failed; RetCode = %d\n", retCode);
1912  }
1913 
1914  return lenBtrMgrResult;
1915 }
1916 
1918 BTRMGR_ConnectToWifi(
1919  unsigned char aui8AdapterIdx,
1920  char *apSSID,
1921  char *apPassword,
1922  int aSecMode
1923 ) {
1924  BTRMGR_Result_t lenBtrMgrResult = BTRMGR_RESULT_SUCCESS;
1925  IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1926  BTRMGR_IARMWifiConnectInfo_t lWifiInfo;
1927 
1928  memset(&lWifiInfo, 0, sizeof(BTRMGR_IARMWifiConnectInfo_t));
1929 
1930  if (BTRMGR_ADAPTER_COUNT_MAX < aui8AdapterIdx) {
1931  lenBtrMgrResult = BTRMGR_RESULT_INVALID_INPUT;
1932  BTRMGRLOG_ERROR("Input is invalid\n");
1933  return lenBtrMgrResult;
1934  }
1935 
1936  lWifiInfo.m_adapterIndex = aui8AdapterIdx;
1937  strncpy(lWifiInfo.m_SSID, apSSID, BTRMGR_MAX_STR_LEN - 1);
1938  strncpy(lWifiInfo.m_Password, apPassword, BTRMGR_MAX_STR_LEN - 1);
1939  lWifiInfo.m_SecMode = aSecMode;
1940  retCode = IARM_Bus_Call_with_IPCTimeout(IARM_BUS_BTRMGR_NAME, BTRMGR_IARM_METHOD_WIFI_CONNECT_INFO, (void*)&lWifiInfo, sizeof(BTRMGR_IARMWifiConnectInfo_t), BTRMGR_IARM_METHOD_CALL_TIMEOUT_DEFAULT_MS);
1941 
1942  if (IARM_RESULT_SUCCESS == retCode) {
1943  BTRMGRLOG_INFO("Success\n");
1944  }
1945  else {
1946  lenBtrMgrResult = BTRMGR_RESULT_GENERIC_FAILURE;
1947  BTRMGRLOG_ERROR("Failed; RetCode = %d\n", retCode);
1948  }
1949 
1950  return lenBtrMgrResult;
1951 }
1952 
1953 const char*
1955  BTRMGR_DeviceType_t type
1956 ) {
1957  if (type == BTRMGR_DEVICE_TYPE_WEARABLE_HEADSET)
1958  return "WEARABLE HEADSET";
1959  else if (type == BTRMGR_DEVICE_TYPE_HANDSFREE)
1960  return "HANDSFREE";
1961  else if (type == BTRMGR_DEVICE_TYPE_MICROPHONE)
1962  return "MICROPHONE";
1963  else if (type == BTRMGR_DEVICE_TYPE_LOUDSPEAKER)
1964  return "LOUDSPEAKER";
1965  else if (type == BTRMGR_DEVICE_TYPE_HEADPHONES)
1966  return "HEADPHONES";
1967  else if (type == BTRMGR_DEVICE_TYPE_PORTABLE_AUDIO)
1968  return "PORTABLE AUDIO DEVICE";
1969  else if (type == BTRMGR_DEVICE_TYPE_CAR_AUDIO)
1970  return "CAR AUDIO";
1971  else if (type == BTRMGR_DEVICE_TYPE_STB)
1972  return "STB";
1973  else if (type == BTRMGR_DEVICE_TYPE_HIFI_AUDIO_DEVICE)
1974  return "HIFI AUDIO DEVICE";
1975  else if (type == BTRMGR_DEVICE_TYPE_VCR)
1976  return "VCR";
1977  else if (type == BTRMGR_DEVICE_TYPE_VIDEO_CAMERA)
1978  return "VIDEO CAMERA";
1979  else if (type == BTRMGR_DEVICE_TYPE_CAMCODER)
1980  return "CAMCODER";
1981  else if (type == BTRMGR_DEVICE_TYPE_VIDEO_MONITOR)
1982  return "VIDEO MONITOR";
1983  else if (type == BTRMGR_DEVICE_TYPE_TV)
1984  return "TV";
1985  else if (type == BTRMGR_DEVICE_TYPE_VIDEO_CONFERENCE)
1986  return "VIDEO CONFERENCING";
1987  else if (type == BTRMGR_DEVICE_TYPE_SMARTPHONE)
1988  return "SMARTPHONE";
1989  else if (type == BTRMGR_DEVICE_TYPE_TABLET)
1990  return "TABLET";
1991  else if (type == BTRMGR_DEVICE_TYPE_TILE)
1992  return "LE TILE";
1993  else if ((type == BTRMGR_DEVICE_TYPE_HID) || (type == BTRMGR_DEVICE_TYPE_HID_GAMEPAD))
1994  return "HUMAN INTERFACE DEVICE";
1995  else
1996  return "UNKNOWN DEVICE";
1997 }
1998 
1999 
2001 BTRMGR_RegisterEventCallback (
2002  BTRMGR_EventCallback eventCallback
2003 ) {
2004  BTRMGR_Result_t rc = BTRMGR_RESULT_SUCCESS;
2005 
2006  if (!eventCallback) {
2007  rc = BTRMGR_RESULT_INVALID_INPUT;
2008  BTRMGRLOG_ERROR ("Input is invalid\n");
2009  }
2010  else {
2011  m_eventCallbackFunction = eventCallback;
2012  BTRMGRLOG_INFO ("Success\n");
2013  }
2014 
2015  return rc;
2016 }
2017 
2018 
2019 /**********************/
2020 /* Incoming Callbacks */
2021 /**********************/
2022 static void
2023 btrMgrdeviceCallback (
2024  const char* owner,
2025  IARM_EventId_t eventId,
2026  void* pData,
2027  size_t len
2028 ) {
2029 
2030  if (NULL == pData) {
2031  BTRMGRLOG_ERROR ("Input is invalid\n");
2032  }
2033  else {
2034  BTRMGR_EventMessage_t *pReceivedEvent = (BTRMGR_EventMessage_t*)pData;
2035  BTRMGR_EventMessage_t newEvent;
2036 
2037  if ((BTRMGR_IARM_EVENT_DEVICE_OUT_OF_RANGE == eventId) ||
2038  (BTRMGR_IARM_EVENT_DEVICE_DISCOVERY_STARTED == eventId) ||
2039  (BTRMGR_IARM_EVENT_DEVICE_DISCOVERY_UPDATE == eventId) ||
2040  (BTRMGR_IARM_EVENT_DEVICE_DISCOVERY_COMPLETE == eventId) ||
2041  (BTRMGR_IARM_EVENT_DEVICE_PAIRING_COMPLETE == eventId) ||
2042  (BTRMGR_IARM_EVENT_DEVICE_UNPAIRING_COMPLETE == eventId) ||
2043  (BTRMGR_IARM_EVENT_DEVICE_CONNECTION_COMPLETE == eventId) ||
2044  (BTRMGR_IARM_EVENT_DEVICE_DISCONNECT_COMPLETE == eventId) ||
2045  (BTRMGR_IARM_EVENT_DEVICE_PAIRING_FAILED == eventId) ||
2046  (BTRMGR_IARM_EVENT_DEVICE_UNPAIRING_FAILED == eventId) ||
2047  (BTRMGR_IARM_EVENT_DEVICE_CONNECTION_FAILED == eventId) ||
2048  (BTRMGR_IARM_EVENT_DEVICE_DISCONNECT_FAILED == eventId) ||
2049  (BTRMGR_IARM_EVENT_RECEIVED_EXTERNAL_PAIR_REQUEST == eventId) ||
2050  (BTRMGR_IARM_EVENT_RECEIVED_EXTERNAL_CONNECT_REQUEST == eventId) ||
2051  (BTRMGR_IARM_EVENT_RECEIVED_EXTERNAL_PLAYBACK_REQUEST == eventId) ||
2052  (BTRMGR_IARM_EVENT_DEVICE_OP_READY == eventId) ||
2053  (BTRMGR_IARM_EVENT_DEVICE_OP_INFORMATION == eventId) ||
2054  (BTRMGR_IARM_EVENT_DEVICE_MEDIA_STATUS == eventId) ||
2055  (BTRMGR_IARM_EVENT_DEVICE_FOUND == eventId) ){
2056 
2057  memcpy (&newEvent, pReceivedEvent, sizeof(BTRMGR_EventMessage_t));
2058 
2059 
2060  if (BTRMGR_IARM_EVENT_DEVICE_FOUND == eventId) {
2061  //TODO: Delay posting device found event to XRE by 3 secs
2062  //TODO: Should be part of btrMgr not the ext-interface
2063  sleep(3);
2064  }
2065 
2066  if (m_eventCallbackFunction)
2067  m_eventCallbackFunction (newEvent);
2068 
2069  BTRMGRLOG_TRACE ("posted event(%d) from the adapter(%d) to listener successfully\n", newEvent.m_eventType, newEvent.m_adapterIndex);
2070 
2071  if (BTRMGR_IARM_EVENT_DEVICE_DISCOVERY_UPDATE == eventId) {
2072  BTRMGRLOG_TRACE("Name = %s\n\n", newEvent.m_discoveredDevice.m_name);
2073  }
2074  }
2075  else {
2076  BTRMGRLOG_ERROR ("Event is invalid\n");
2077  }
2078  }
2079 
2080  return;
2081 }
2082 
2083 
2084 static void
2085 btrMgrMediaCallback (
2086  const char* owner,
2087  IARM_EventId_t eventId,
2088  void* pData,
2089  size_t len
2090 ) {
2091 
2092  if (NULL == pData) {
2093  BTRMGRLOG_ERROR ("Input is invalid\n");
2094  }
2095  else {
2096  BTRMGR_EventMessage_t *pReceivedEvent = (BTRMGR_EventMessage_t*)pData;
2097  BTRMGR_EventMessage_t newEvent;
2098 
2099  if ((BTRMGR_IARM_EVENT_MEDIA_TRACK_STARTED == eventId) ||
2100  (BTRMGR_IARM_EVENT_MEDIA_TRACK_PLAYING == eventId) ||
2101  (BTRMGR_IARM_EVENT_MEDIA_TRACK_PAUSED == eventId) ||
2102  (BTRMGR_IARM_EVENT_MEDIA_TRACK_STOPPED == eventId) ||
2103  (BTRMGR_IARM_EVENT_MEDIA_TRACK_POSITION == eventId) ||
2104  (BTRMGR_IARM_EVENT_MEDIA_TRACK_CHANGED == eventId) ||
2105  (BTRMGR_IARM_EVENT_MEDIA_PLAYBACK_ENDED == eventId) ||
2106  (BTRMGR_IARM_EVENT_MEDIA_PLAYER_NAME == eventId) ||
2107  (BTRMGR_IARM_EVENT_MEDIA_PLAYER_VOLUME == eventId) ||
2108  (BTRMGR_IARM_EVENT_MEDIA_PLAYER_EQUALIZER_OFF == eventId) ||
2109  (BTRMGR_IARM_EVENT_MEDIA_PLAYER_EQUALIZER_ON == eventId) ||
2110  (BTRMGR_IARM_EVENT_MEDIA_PLAYER_SHUFFLE_OFF == eventId) ||
2111  (BTRMGR_IARM_EVENT_MEDIA_PLAYER_SHUFFLE_ALLTRACKS == eventId) ||
2112  (BTRMGR_IARM_EVENT_MEDIA_PLAYER_SHUFFLE_GROUP == eventId) ||
2113  (BTRMGR_IARM_EVENT_MEDIA_PLAYER_REPEAT_OFF == eventId) ||
2114  (BTRMGR_IARM_EVENT_MEDIA_PLAYER_REPEAT_SINGLETRACK == eventId) ||
2115  (BTRMGR_IARM_EVENT_MEDIA_PLAYER_REPEAT_ALLTRACKS == eventId) ||
2116  (BTRMGR_IARM_EVENT_MEDIA_PLAYER_REPEAT_GROUP == eventId) ||
2117  (BTRMGR_IARM_EVENT_MEDIA_ALBUM_INFO == eventId) ||
2118  (BTRMGR_IARM_EVENT_MEDIA_ARTIST_INFO == eventId) ||
2119  (BTRMGR_IARM_EVENT_MEDIA_GENRE_INFO == eventId) ||
2120  (BTRMGR_IARM_EVENT_MEDIA_COMPILATION_INFO == eventId) ||
2121  (BTRMGR_IARM_EVENT_MEDIA_PLAYLIST_INFO == eventId) ||
2122  (BTRMGR_IARM_EVENT_MEDIA_TRACKLIST_INFO == eventId) ||
2123  (BTRMGR_IARM_EVENT_MEDIA_PLAYER_MUTE == eventId) ||
2124  (BTRMGR_IARM_EVENT_MEDIA_PLAYER_UNMUTE == eventId) ){
2125  memcpy (&newEvent, pReceivedEvent, sizeof(BTRMGR_EventMessage_t));
2126 
2127  if (m_eventCallbackFunction)
2128  m_eventCallbackFunction (newEvent);
2129 
2130  BTRMGRLOG_INFO ("posted media event(%d) from the adapter(%d) to listener successfully\n", newEvent.m_eventType, newEvent.m_adapterIndex);
2131  }
2132  else {
2133  BTRMGRLOG_ERROR ("Event is invalid\n");
2134  }
2135  }
2136  return;
2137 }
2138 
BTRMGR_GetMediaCurrentPosition
BTRMGR_Result_t BTRMGR_GetMediaCurrentPosition(unsigned char index_of_adapter, BTRMgrDeviceHandle handle, BTRMGR_MediaPositionInfo_t *mediaPositionInfo)
This API fetches the current position and total duration of the media.
Definition: btmgr_iarm_external_interface.c:1544
BTRMGR_DeInit
BTRMGR_Result_t BTRMGR_DeInit(void)
This API invokes the deinit function of bluetooth core and persistant interface module.
Definition: btmgr_iarm_external_interface.c:188
BTRMGR_SetAdapterName
BTRMGR_Result_t BTRMGR_SetAdapterName(unsigned char index_of_adapter, const char *pNameOfAdapter)
This API is used to set the new name to the bluetooth adapter.
Definition: btmgr_iarm_external_interface.c:565
IARM_Bus_Term
IARM_Result_t IARM_Bus_Term(void)
This API is used to terminate the IARM-Bus library.
BTRMGR_UnpairDevice
BTRMGR_Result_t BTRMGR_UnpairDevice(unsigned char index_of_adapter, BTRMgrDeviceHandle handle)
This API is used to remove the pairing information of the device selected.
Definition: btmgr_iarm_external_interface.c:911
_BTRMGR_IARMDeviceVolumeMute_t
Definition: btmgr_iarm_interface.h:226
_BTRMGR_IARMBeaconDetection_t
Definition: btmgr_iarm_interface.h:146
_BTRMGR_IARMAdapterDiscoverable_t
Definition: btmgr_iarm_interface.h:172
_BTRMGR_IARMGATTValue_t
Definition: btmgr_iarm_interface.h:309
_BTRMGR_IARMPairDevice_t
Definition: btmgr_iarm_interface.h:156
_BTRMGR_IARMPairedDevices_t
Definition: btmgr_iarm_interface.h:195
BTRMGR_SetAdapterDiscoverable
BTRMGR_Result_t BTRMGR_SetAdapterDiscoverable(unsigned char index_of_adapter, unsigned char discoverable, int timeout)
This API is to make the adapter discoverable until the given timeout.
Definition: btmgr_iarm_external_interface.c:690
BTRMGR_GetMediaTrackInfo
BTRMGR_Result_t BTRMGR_GetMediaTrackInfo(unsigned char index_of_adapter, BTRMgrDeviceHandle handle, BTRMGR_MediaTrackInfo_t *mediaTrackInfo)
This API fetches the media track info like title, genre, duration, number of tracks,...
Definition: btmgr_iarm_external_interface.c:1474
BTRMGR_IsAdapterDiscoverable
BTRMGR_Result_t BTRMGR_IsAdapterDiscoverable(unsigned char index_of_adapter, unsigned char *pDiscoverable)
This API checks the adapter is discoverable or not.
Definition: btmgr_iarm_external_interface.c:724
_BTRMGR_IARMDiscoveredDevices_t
Definition: btmgr_iarm_interface.h:190
BTRMGR_PairDevice
BTRMGR_Result_t BTRMGR_PairDevice(unsigned char index_of_adapter, BTRMgrDeviceHandle handle)
This API is used to pair the device that you wish to pair.
Definition: btmgr_iarm_external_interface.c:879
BTRMGR_Result_t
enum _BTRMGR_Result_t BTRMGR_Result_t
Represents the status of the operation.
BTRMGR_DeviceType_t
enum _BTRMGR_DeviceType_t BTRMGR_DeviceType_t
Represents the bluetooth device types.
_BTRMGR_IARMStreamingStatus_t
Definition: btmgr_iarm_interface.h:211
_BTRMGR_MediaElementListInfo_t
Represents Media Element List.
Definition: btmgr.h:517
BTRMGR_PerformLeOp
BTRMGR_Result_t BTRMGR_PerformLeOp(unsigned char index_of_adapter, BTRMgrDeviceHandle handle, const char *aBtrLeUuid, BTRMGR_LeOp_t aLeOpType, char *aLeOpArg, char *rOpResult)
This API performs LE operations on the specified bluetooth adapter.
Definition: btmgr_iarm_external_interface.c:1767
_BTRMGR_IARMConnectedDevices_t
Definition: btmgr_iarm_interface.h:200
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 ...
_BTRMGR_LeCustomAdvertisement_t
Structure for the custom advertisement payload.
Definition: btmgr.h:616
btmgr.h
_BTRMGR_IARMAdapterDiscover_t
Definition: btmgr_iarm_interface.h:178
_BTRMGR_IARMDiscoveryStatus_t
Definition: btmgr_iarm_interface.h:293
BTRMGR_DeviceOperationType_t
enum _BTRMGR_DeviceOperationType_t BTRMGR_DeviceOperationType_t
Represents the operation type for bluetooth device.
IARM_Bus_RegisterEventHandler
IARM_Result_t IARM_Bus_RegisterEventHandler(const char *ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler)
This API register to listen to event and provide the callback function for event notification....
Definition: iarmMgrMocks.cpp:43
BTRMGR_GetAdapterPowerStatus
BTRMGR_Result_t BTRMGR_GetAdapterPowerStatus(unsigned char index_of_adapter, unsigned char *pPowerStatus)
This API fetches the power status, either 0 or 1.
Definition: btmgr_iarm_external_interface.c:659
BTRMGR_RegisterForCallbacks
BTRMGR_Result_t BTRMGR_RegisterForCallbacks(const char *apcProcessName)
This API registers all the IARM call backs for BTRMGR and Third party Clients.
Definition: btmgr_iarm_external_interface.c:100
BTRMGR_MediaControl
BTRMGR_Result_t BTRMGR_MediaControl(unsigned char index_of_adapter, BTRMgrDeviceHandle handle, BTRMGR_MediaControlCommand_t mediaCtrlCmd)
This API is used to perform the media control operations.
Definition: btmgr_iarm_external_interface.c:1361
BTRMGR_StartAudioStreamingOut
BTRMGR_Result_t BTRMGR_StartAudioStreamingOut(unsigned char index_of_adapter, BTRMgrDeviceHandle handle, BTRMGR_DeviceOperationType_t streamOutPref)
This API initates the streaming from the device with the selected operation type.
Definition: btmgr_iarm_external_interface.c:1106
BTRMGR_StartDeviceDiscovery
BTRMGR_Result_t BTRMGR_StartDeviceDiscovery(unsigned char index_of_adapter, BTRMGR_DeviceOperationType_t aenBTRMgrDevOpT)
This API initiates the scanning process.
Definition: btmgr_iarm_external_interface.c:755
BTRMGR_GetLimitBeaconDetection
BTRMGR_Result_t BTRMGR_GetLimitBeaconDetection(unsigned char index_of_adapter, unsigned char *pLimited)
This API Gets Beacon Detection status on the specified bluetooth adapter.
Definition: btmgr_iarm_external_interface.c:502
_BTRMGR_PairedDevicesList_t
Represents the list of paired devices.
Definition: btmgr.h:476
_BTRMGR_IARMAdapterPower_t
Definition: btmgr_iarm_interface.h:167
_BTRMGR_IARMMediaProperty_t
Definition: btmgr_iarm_interface.h:234
BTRMGR_GetNumberOfAdapters
BTRMGR_Result_t BTRMGR_GetNumberOfAdapters(unsigned char *pNumOfAdapters)
This API returns the number of bluetooth adapters available.
Definition: btmgr_iarm_external_interface.c:300
IARM_Bus_Disconnect
IARM_Result_t IARM_Bus_Disconnect(void)
This API disconnect Application from IARM Bus so the application will not receive any IARM event or R...
BTRMGR_DisconnectFromDevice
BTRMGR_Result_t BTRMGR_DisconnectFromDevice(unsigned char index_of_adapter, BTRMgrDeviceHandle handle)
This API terminates the current connection.
Definition: btmgr_iarm_external_interface.c:1008
BTRMGR_SelectMediaElement
BTRMGR_Result_t BTRMGR_SelectMediaElement(unsigned char index_of_adapter, BTRMgrDeviceHandle deviceHandle, BTRMgrMediaElementHandle mediaElementHandle, BTRMGR_MediaElementType_t mediaElementType)
This API performs operation based on the element type selected.
Definition: btmgr_iarm_external_interface.c:1661
IARM_Bus_IsConnected
IARM_Result_t IARM_Bus_IsConnected(const char *memberName, int *isRegistered)
This API is used to check if the current process is registered with IARM.
BTRMGR_UnRegisterFromCallbacks
BTRMGR_Result_t BTRMGR_UnRegisterFromCallbacks(const char *apcProcessName)
This API Unregisters all the IARM call backs for BTRMGR and Third party Clients.
Definition: btmgr_iarm_external_interface.c:231
BTRMGR_SetMediaElementActive
BTRMGR_Result_t BTRMGR_SetMediaElementActive(unsigned char index_of_adapter, BTRMgrDeviceHandle deviceHandle, BTRMgrMediaElementHandle mediaElementHandle, BTRMGR_MediaElementType_t mediaElementType)
This API sets the mentioned media element list active/in_scope for further operations on it.
Definition: btmgr_iarm_external_interface.c:1579
_BTRMGR_IARMWifiConnectInfo_t
Definition: btmgr_iarm_interface.h:343
_BTRMGR_ConnectedDevicesList_t
Represents the connected devices list.
Definition: btmgr.h:468
_BTRMGR_IARMEventResp_t
Definition: btmgr_iarm_interface.h:221
_BTRMGR_IARMLeOp_t
Definition: btmgr_iarm_interface.h:284
BTRMGR_GetAdapterName
BTRMGR_Result_t BTRMGR_GetAdapterName(unsigned char index_of_adapter, char *pNameOfAdapter)
This API fetches the bluetooth adapter name.
Definition: btmgr_iarm_external_interface.c:596
BTRMGR_GetDiscoveryStatus
BTRMGR_Result_t BTRMGR_GetDiscoveryStatus(unsigned char aui8AdapterIdx, BTRMGR_DiscoveryStatus_t *isDiscoveryInProgress, BTRMGR_DeviceOperationType_t *aenBTRMgrDevOpT)
This API gives the discovery status.
Definition: btmgr_iarm_external_interface.c:819
BTRMGR_StopAudioStreamingIn
BTRMGR_Result_t BTRMGR_StopAudioStreamingIn(unsigned char ui8AdapterIdx, BTRMgrDeviceHandle handle)
This API termines the audio streaming.
Definition: btmgr_iarm_external_interface.c:1267
BTRMGR_StopAudioStreamingOut
BTRMGR_Result_t BTRMGR_StopAudioStreamingOut(unsigned char index_of_adapter, BTRMgrDeviceHandle handle)
This API terminates the streaming from the device.
Definition: btmgr_iarm_external_interface.c:1139
BTRMGR_SetDeviceVolumeMute
BTRMGR_Result_t BTRMGR_SetDeviceVolumeMute(unsigned char aui8AdapterIdx, BTRMgrDeviceHandle ahBTRMgrDevHdl, BTRMGR_DeviceOperationType_t deviceOpType, unsigned char ui8Volume, unsigned char ui8Mute)
This API is used to set the media volume and mute data.
Definition: btmgr_iarm_external_interface.c:1435
_BTRMGR_IARMGATTInfo_t
Definition: btmgr_iarm_interface.h:322
_BTRMGR_EventMessage_t
Represents the event message info.
Definition: btmgr.h:576
_BTRMGR_DiscoveredDevicesList_t
Represents the list of scanned devices.
Definition: btmgr.h:484
BTRMGR_GetDeviceProperties
BTRMGR_Result_t BTRMGR_GetDeviceProperties(unsigned char index_of_adapter, BTRMgrDeviceHandle handle, BTRMGR_DevicesProperty_t *pDeviceProperty)
This API returns the device information that includes the device name, mac address,...
Definition: btmgr_iarm_external_interface.c:1072
BTRMGR_MediaControlCommand_t
enum _BTRMGR_MediaControlCommand_t BTRMGR_MediaControlCommand_t
Represents the commands to control the media files.
BTRMGR_SetLimitBeaconDetection
BTRMGR_Result_t BTRMGR_SetLimitBeaconDetection(unsigned char index_of_adapter, unsigned char limited)
This API Sets Beacon Detection status on the specified bluetooth adapter.
Definition: btmgr_iarm_external_interface.c:532
BTRMGR_GetConnectedDevices
BTRMGR_Result_t BTRMGR_GetConnectedDevices(unsigned char index_of_adapter, BTRMGR_ConnectedDevicesList_t *pConnectedDevices)
This API returns the list of devices connected.
Definition: btmgr_iarm_external_interface.c:1040
BTRMGR_SetAdapterPowerStatus
BTRMGR_Result_t BTRMGR_SetAdapterPowerStatus(unsigned char index_of_adapter, unsigned char power_status)
This API sets the bluetooth adapter power to ON/OFF.
Definition: btmgr_iarm_external_interface.c:628
BTRMGR_SetAudioInServiceState
BTRMGR_Result_t BTRMGR_SetAudioInServiceState(unsigned char index_of_adapter, unsigned char aui8ServiceState)
This API Enable/Disables Audio-In on the specified bluetooth adapter.
Definition: btmgr_iarm_external_interface.c:1810
BTRMGR_ConnectToDevice
BTRMGR_Result_t BTRMGR_ConnectToDevice(unsigned char index_of_adapter, BTRMgrDeviceHandle handle, BTRMGR_DeviceOperationType_t connectAs)
This API connects the device as audio sink/headset/audio src based on the device type specified.
Definition: btmgr_iarm_external_interface.c:975
_BTRMGR_IARMConnectDevice_t
Definition: btmgr_iarm_interface.h:161
BTRMGR_StartAudioStreamingIn
BTRMGR_Result_t BTRMGR_StartAudioStreamingIn(unsigned char ui8AdapterIdx, BTRMgrDeviceHandle handle, BTRMGR_DeviceOperationType_t streamOutPref)
This API starts the audio streaming.
Definition: btmgr_iarm_external_interface.c:1234
BTRMGR_ResetAdapter
BTRMGR_Result_t BTRMGR_ResetAdapter(unsigned char index_of_adapter)
This API is designed to reset the bluetooth adapter.
Definition: btmgr_iarm_external_interface.c:476
_BTRMGR_IARMAdvtInfo_t
Definition: btmgr_iarm_interface.h:331
BTRMGR_GetDiscoveredDevices
BTRMGR_Result_t BTRMGR_GetDiscoveredDevices(unsigned char index_of_adapter, BTRMGR_DiscoveredDevicesList_t *pDiscoveredDevices)
This API fetches the list of devices scanned.
Definition: btmgr_iarm_external_interface.c:847
_BTRMGR_DevicesProperty_t
Represents the property of the device.
Definition: btmgr.h:400
BTRMGR_GetPairedDevices
BTRMGR_Result_t BTRMGR_GetPairedDevices(unsigned char index_of_adapter, BTRMGR_PairedDevicesList_t *pPairedDevices)
This API returns the list of devices paired.
Definition: btmgr_iarm_external_interface.c:943
BTRMGR_GetDeviceVolumeMute
BTRMGR_Result_t BTRMGR_GetDeviceVolumeMute(unsigned char aui8AdapterIdx, BTRMgrDeviceHandle ahBTRMgrDevHdl, BTRMGR_DeviceOperationType_t deviceOpType, unsigned char *pui8Volume, unsigned char *pui8Mute)
This API is used to fetch the media volume and mute data.
Definition: btmgr_iarm_external_interface.c:1395
BTRMGR_GetMediaElementList
BTRMGR_Result_t BTRMGR_GetMediaElementList(unsigned char index_of_adapter, BTRMgrDeviceHandle deviceHandle, BTRMgrMediaElementHandle mediaElementHandle, unsigned short mediaElementStartIdx, unsigned short mediaElementEndIdx, unsigned char mediaElementListDepth, BTRMGR_MediaElementType_t mediaElementType, BTRMGR_MediaElementListInfo_t *mediaElementListInfo)
This API gets the media element list.
Definition: btmgr_iarm_external_interface.c:1616
_BTRMGR_IARMStreamingType_t
Definition: btmgr_iarm_interface.h:216
_BTRMGR_IARMDiagInfo_t
Definition: btmgr_iarm_interface.h:336
IARM_Bus_Connect
IARM_Result_t IARM_Bus_Connect(void)
This API is used to connect application to the IARM bus daemon. After connected, the application can ...
Definition: iarmMgrMocks.cpp:33
BTRMGR_LeProperty_t
enum _BTRMGR_LeProperty_t BTRMGR_LeProperty_t
Represents LE properties.
BTRMGR_StopDeviceDiscovery
BTRMGR_Result_t BTRMGR_StopDeviceDiscovery(unsigned char index_of_adapter, BTRMGR_DeviceOperationType_t aenBTRMgrDevOpT)
This API terminates the scanning process.
Definition: btmgr_iarm_external_interface.c:787
_BTRMGR_IARMHidGamePadServiceState_t
Definition: btmgr_iarm_interface.h:304
BTRMGR_GetMediaElementTrackInfo
BTRMGR_Result_t BTRMGR_GetMediaElementTrackInfo(unsigned char index_of_adapter, BTRMgrDeviceHandle handle, BTRMgrMediaElementHandle mediaElementHandle, BTRMGR_MediaTrackInfo_t *mediaTrackInfo)
This API fetches the media track info like title, genre, duration, number of tracks,...
Definition: btmgr_iarm_external_interface.c:1508
_BTRMGR_IARMGATTServiceInfo_t
Definition: btmgr_iarm_interface.h:316
_BTRMGR_IARMMediaElementListInfo_t
Definition: btmgr_iarm_interface.h:246
BTRMGR_IsAudioStreamingIn
BTRMGR_Result_t BTRMGR_IsAudioStreamingIn(unsigned char ui8AdapterIdx, unsigned char *pStreamingStatus)
This API returns the audio streaming status.
Definition: btmgr_iarm_external_interface.c:1298
_BTRMGR_IARMAudioInServiceState_t
Definition: btmgr_iarm_interface.h:299
IARM_Bus_UnRegisterEventHandler
IARM_Result_t IARM_Bus_UnRegisterEventHandler(const char *ownerName, IARM_EventId_t eventId)
This API is used to Remove ALL handlers registered for the given event. This API remove the all the e...
BTRMGR_StreamOut_Type_t
enum _BTRMGR_StreamOut_Type_t BTRMGR_StreamOut_Type_t
Represents the stream output types.
BTRMGR_GetDeviceTypeAsString
const char * BTRMGR_GetDeviceTypeAsString(BTRMGR_DeviceType_t type)
This API fetches the Device name of the media.
Definition: btmgr_iarm_external_interface.c:1954
_BTRMGR_IARMLeProperty_t
Definition: btmgr_iarm_interface.h:265
_BTRMGR_EventResponse_t
Represents the event response.
Definition: btmgr.h:591
BTRMGR_SetEventResponse
BTRMGR_Result_t BTRMGR_SetEventResponse(unsigned char index_of_adapter, BTRMGR_EventResponse_t *apstBTRMgrEvtRsp)
This API handles the events received.
Definition: btmgr_iarm_external_interface.c:1330
_BTRMGR_MediaPositionInfo_t
Represents the media position info.
Definition: btmgr.h:359
rdk_logger_init
rdk_Error rdk_logger_init(const char *debugConfigFile)
Initialize the logger. Sets up the environment variable storage by parsing debug configuration file t...
Definition: rdk_logger_init.c:57
BTRMGR_SetAudioStreamingOutType
BTRMGR_Result_t BTRMGR_SetAudioStreamingOutType(unsigned char index_of_adapter, BTRMGR_StreamOut_Type_t type)
This API is to set the audio type as primary or secondary.
Definition: btmgr_iarm_external_interface.c:1202
_BTRMGR_MediaTrackInfo_t
Represents the media track info.
Definition: btmgr.h:346
BTRMGR_LeOp_t
enum _BTRMGR_LeOp_t BTRMGR_LeOp_t
Represents the Low energy operations.
IARM_Bus_Init
IARM_Result_t IARM_Bus_Init(const char *name)
This API is used to initialize the IARM-Bus library.
Definition: iarmMgrMocks.cpp:38
_BTRMGR_IARMAdapterName_t
Definition: btmgr_iarm_interface.h:151
btmgr_iarm_interface.h
BTRMGR_SetHidGamePadServiceState
BTRMGR_Result_t BTRMGR_SetHidGamePadServiceState(unsigned char index_of_adapter, unsigned char aui8ServiceState)
This API Enable/Disables Hid GamePad on the specified bluetooth adapter.
Definition: btmgr_iarm_external_interface.c:1842
BTRMGR_Init
BTRMGR_Result_t BTRMGR_Init(void)
This API initializes the bluetooth manager.
Definition: btmgr_iarm_external_interface.c:51
_BTRMGR_IARMStreaming_t
Definition: btmgr_iarm_interface.h:205
BTRMGR_DiscoveryStatus_t
enum _BTRMGR_DiscoveryStatus_t BTRMGR_DiscoveryStatus_t
Represents the bluetooth Discovery Status.
BTRMGR_IsAudioStreamingOut
BTRMGR_Result_t BTRMGR_IsAudioStreamingOut(unsigned char index_of_adapter, unsigned char *pStreamingStatus)
This API returns the stream out status.
Definition: btmgr_iarm_external_interface.c:1170
BTRMGR_MediaElementType_t
enum _BTRMGR_MediaElementType_t BTRMGR_MediaElementType_t
Represents Media Element Types.
_BTRMGR_IARMDDeviceProperty_t
Definition: btmgr_iarm_interface.h:184