19 #include <sys/types.h>
25 #include "btrMgr_logger.h"
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;
34 #ifdef RDK_LOGGER_ENABLED
35 int b_rdk_logger_enabled = 0;
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);
54 char processName[256] =
"";
55 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
57 if (!isBTRMGR_Inited) {
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";
65 if (access(BTRMGR_IARM_DEBUG_OVERRIDE_PATH, F_OK) != -1)
66 pDebugConfig = BTRMGR_IARM_DEBUG_OVERRIDE_PATH;
68 pDebugConfig = BTRMGR_IARM_DEBUG_ACTUAL_PATH;
71 b_rdk_logger_enabled = 1;
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");
79 BTRMGRLOG_INFO (
"IARM Interface Inited Externally\n");
83 isBTRMGR_Iarm_Connected = 1;
84 BTRMGRLOG_INFO (
"IARM Interface Inited Internally-BTRMGR\n");
87 BTRMGRLOG_INFO (
"IARM Interface Connected Externally\n");
93 BTRMGRLOG_INFO (
"IARM Interface Already Inited\n");
95 return BTRMGR_RESULT_SUCCESS;
101 const char *apcProcessName
103 int isRegistered = 0;
104 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
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";
113 if (access(BTRMGR_IARM_DEBUG_OVERRIDE_PATH, F_OK) != -1)
114 pDebugConfig = BTRMGR_IARM_DEBUG_OVERRIDE_PATH;
116 pDebugConfig = BTRMGR_IARM_DEBUG_ACTUAL_PATH;
119 b_rdk_logger_enabled = 1;
123 if (!apcProcessName) {
124 BTRMGRLOG_INFO (
"BTRMGR_INIT has called\n");
127 BTRMGRLOG_INFO (
"apcProcessName = %s\n", apcProcessName);
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;
181 BTRMGRLOG_INFO (
"IARM Interface Inited Register Event Successfully\n");
183 return BTRMGR_RESULT_SUCCESS;
192 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
194 if (m_eventCallbackFunction)
195 m_eventCallbackFunction = NULL;
198 if (isBTRMGR_Inited) {
201 if (isBTRMGR_Iarm_Connected) {
203 isBTRMGR_Iarm_Connected = 0;
206 BTRMGRLOG_ERROR (
"IARM_Bus_Disconnect Failed; RetCode = %d\n", retCode);
210 if (isBTRMGR_Iarm_Inited) {
212 isBTRMGR_Iarm_Inited = 0;
215 BTRMGRLOG_ERROR (
"IARM_Bus_Term Failed; RetCode = %d\n", retCode);
220 BTRMGRLOG_INFO (
"IARM Interface termination Successfully \n");
223 rc = BTRMGR_RESULT_GENERIC_FAILURE;
224 BTRMGRLOG_INFO (
"IARM Interface for BTRMgr is Not Inited Yet..\n");
232 const char *apcProcessName
234 int isRegistered = 0;
235 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
237 if (!apcProcessName) {
238 BTRMGRLOG_ERROR (
"apcProcessName is NULL\n");
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;
294 BTRMGRLOG_INFO (
"IARM Interface UnRegister Event Succesful\n");
296 return BTRMGR_RESULT_SUCCESS;
301 unsigned char* pNumOfAdapters
304 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
305 unsigned char num_of_adapters = 0;
307 if (!pNumOfAdapters) {
308 rc = BTRMGR_RESULT_INVALID_INPUT;
309 BTRMGRLOG_ERROR (
"Input is invalid\n");
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);
320 rc = BTRMGR_RESULT_GENERIC_FAILURE;
321 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
330 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
333 lstAdvtInfo.m_adapterIndex = aui8AdapterIdx;
337 if (IARM_RESULT_SUCCESS == retCode)
339 BTRMGRLOG_INFO(
"Success; Device is now advertising\n");
342 rc = BTRMGR_RESULT_GENERIC_FAILURE;
343 BTRMGRLOG_ERROR(
"Failed; RetCode = %d\n", retCode);
349 BTRMGR_Result_t BTRMGR_LE_StopAdvertisement(
unsigned char aui8AdapterIdx)
352 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
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)
357 BTRMGRLOG_INFO(
"Success; Device has stopped advertising\n");
360 rc = BTRMGR_RESULT_GENERIC_FAILURE;
361 BTRMGRLOG_ERROR(
"Failed; RetCode = %d\n", retCode);
370 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
373 strncpy(lGattValue.m_UUID, aUUID, (BTRMGR_MAX_STR_LEN - 1));
374 lGattValue.aElement = aElement;
375 lGattValue.m_adapterIndex = aui8AdapterIdx;
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);
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);
384 rc = BTRMGR_RESULT_GENERIC_FAILURE;
385 BTRMGRLOG_ERROR(
"Failed; RetCode = %d\n", retCode);
391 BTRMGR_Result_t BTRMGR_LE_SetServiceInfo(
unsigned char aui8AdapterIdx,
char *aUUID,
unsigned char aServiceType)
394 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
397 lGattServiceInfo.m_adapterIndex = aui8AdapterIdx;
398 strncpy(lGattServiceInfo.m_UUID, aUUID, (BTRMGR_MAX_STR_LEN - 1));
399 lGattServiceInfo.m_ServiceType = aServiceType;
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);
403 if (IARM_RESULT_SUCCESS == retCode)
405 BTRMGRLOG_INFO(
"Success; \n");
409 rc = BTRMGR_RESULT_GENERIC_FAILURE;
410 BTRMGRLOG_ERROR(
"Failed; RetCode = %d\n", retCode);
416 BTRMGR_Result_t BTRMGR_LE_SetGattInfo(
unsigned char aui8AdapterIdx,
char *aParentUUID,
char *aUUID,
unsigned short aFlags,
char *aValue,
BTRMGR_LeProperty_t aElement)
419 IARM_Result_t retCode = IARM_RESULT_INVALID_PARAM;
422 if ((NULL != aParentUUID) && (NULL != aUUID))
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;
430 strncpy(lGattCharInfo.m_Value, aValue, (BTRMGR_MAX_STR_LEN - 1));
432 lGattCharInfo.m_Element = aElement;
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);
437 if (IARM_RESULT_SUCCESS == retCode)
439 BTRMGRLOG_INFO(
"Success; \n");
443 rc = BTRMGR_RESULT_GENERIC_FAILURE;
444 BTRMGRLOG_ERROR(
"Failed; RetCode = %d\n", retCode);
452 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
455 strncpy(lGattValue.m_UUID, aUUID, (BTRMGR_MAX_STR_LEN - 1));
456 lGattValue.aElement = aElement;
457 lGattValue.m_adapterIndex = aui8AdapterIdx;
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);
462 if (IARM_RESULT_SUCCESS == retCode) {
464 BTRMGRLOG_INFO(
"Success; Property value is = %s\n", lGattValue.m_Value);
468 rc = BTRMGR_RESULT_GENERIC_FAILURE;
469 BTRMGRLOG_ERROR(
"Failed; RetCode = %d\n", retCode);
477 unsigned char index_of_adapter
480 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
482 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
483 rc = BTRMGR_RESULT_INVALID_INPUT;
484 BTRMGRLOG_ERROR (
"Input is invalid\n");
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");
494 rc = BTRMGR_RESULT_GENERIC_FAILURE;
495 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
503 unsigned char index_of_adapter,
504 unsigned char *pLimited
507 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
510 if((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (NULL == pLimited)) {
511 rc = BTRMGR_RESULT_INVALID_INPUT;
512 BTRMGRLOG_ERROR (
"Input is invalid\n");
516 beaconDetection.m_adapterIndex = index_of_adapter;
519 if (IARM_RESULT_SUCCESS == retCode) {
520 *pLimited = beaconDetection.m_limitBeaconDetection;
521 BTRMGRLOG_INFO (
"Success; Beacon Detection Limited ? %s\n", (*pLimited ?
"true" :
"false"));
524 rc = BTRMGR_RESULT_GENERIC_FAILURE;
525 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
533 unsigned char index_of_adapter,
534 unsigned char limited
538 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
541 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
542 rc = BTRMGR_RESULT_INVALID_INPUT;
543 BTRMGRLOG_ERROR (
"Input is invalid\n");
548 beaconDetection.m_adapterIndex = index_of_adapter;
549 beaconDetection.m_limitBeaconDetection = limited;
553 if (IARM_RESULT_SUCCESS == retCode) {
554 BTRMGRLOG_INFO (
"Success\n");
557 rc = BTRMGR_RESULT_GENERIC_FAILURE;
558 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
566 unsigned char index_of_adapter,
567 const char* pNameOfAdapter
570 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
573 if((NULL == pNameOfAdapter) || (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter)) {
574 rc = BTRMGR_RESULT_INVALID_INPUT;
575 BTRMGRLOG_ERROR (
"Input is invalid\n");
580 adapterSetting.m_adapterIndex = index_of_adapter;
581 strncpy (adapterSetting.m_name, pNameOfAdapter, (BTRMGR_NAME_LEN_MAX - 1));
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");
588 rc = BTRMGR_RESULT_GENERIC_FAILURE;
589 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
597 unsigned char index_of_adapter,
601 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
604 if((NULL == pNameOfAdapter) || (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter)) {
605 rc = BTRMGR_RESULT_INVALID_INPUT;
606 BTRMGRLOG_ERROR (
"Input is invalid\n");
611 adapterSetting.m_adapterIndex = index_of_adapter;
612 memset (adapterSetting.m_name,
'\0', sizeof (adapterSetting.m_name));
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");
620 rc = BTRMGR_RESULT_GENERIC_FAILURE;
621 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
629 unsigned char index_of_adapter,
630 unsigned char power_status
633 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
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");
643 powerStatus.m_adapterIndex = index_of_adapter;
644 powerStatus.m_powerStatus = power_status;
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");
651 rc = BTRMGR_RESULT_GENERIC_FAILURE;
652 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
660 unsigned char index_of_adapter,
661 unsigned char* pPowerStatus
664 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
667 if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (NULL == pPowerStatus)) {
668 rc = BTRMGR_RESULT_INVALID_INPUT;
669 BTRMGRLOG_ERROR (
"Input is invalid\n");
674 powerStatus.m_adapterIndex = index_of_adapter;
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");
682 rc = BTRMGR_RESULT_GENERIC_FAILURE;
683 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
691 unsigned char index_of_adapter,
692 unsigned char discoverable,
696 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
699 if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (discoverable > 1)) {
700 rc = BTRMGR_RESULT_INVALID_INPUT;
701 BTRMGRLOG_ERROR (
"Input is invalid\n");
706 discoverableSetting.m_adapterIndex = index_of_adapter;
707 discoverableSetting.m_isDiscoverable = discoverable;
708 discoverableSetting.m_timeout = timeout;
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");
715 rc = BTRMGR_RESULT_GENERIC_FAILURE;
716 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
725 unsigned char index_of_adapter,
726 unsigned char* pDiscoverable
729 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
732 if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (NULL == pDiscoverable)) {
733 rc = BTRMGR_RESULT_INVALID_INPUT;
734 BTRMGRLOG_ERROR (
"Input is invalid\n");
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");
746 rc = BTRMGR_RESULT_GENERIC_FAILURE;
747 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
756 unsigned char index_of_adapter,
760 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
763 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
764 rc = BTRMGR_RESULT_INVALID_INPUT;
765 BTRMGRLOG_ERROR (
"Input is invalid\n");
770 deviceDiscovery.m_adapterIndex = index_of_adapter;
771 deviceDiscovery.m_setDiscovery = 1;
772 deviceDiscovery.m_enBTRMgrDevOpT= aenBTRMgrDevOpT;
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");
779 rc = BTRMGR_RESULT_GENERIC_FAILURE;
780 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
788 unsigned char index_of_adapter,
792 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
795 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
796 rc = BTRMGR_RESULT_INVALID_INPUT;
797 BTRMGRLOG_ERROR (
"Input is invalid\n");
802 deviceDiscovery.m_adapterIndex = index_of_adapter;
803 deviceDiscovery.m_setDiscovery = 0;
804 deviceDiscovery.m_enBTRMgrDevOpT= aenBTRMgrDevOpT;
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");
811 rc = BTRMGR_RESULT_GENERIC_FAILURE;
812 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
820 unsigned char aui8AdapterIdx,
825 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
829 discoveryStatus.m_adapterIndex = aui8AdapterIdx;
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);
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);
839 rc = BTRMGR_RESULT_GENERIC_FAILURE;
840 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
848 unsigned char index_of_adapter,
852 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
855 if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (NULL == pDiscoveredDevices)) {
856 rc = BTRMGR_RESULT_INVALID_INPUT;
857 BTRMGRLOG_ERROR (
"Input is invalid\n");
862 memset (&discoveredDevices, 0,
sizeof(discoveredDevices));
863 discoveredDevices.m_adapterIndex = index_of_adapter;
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) {
868 BTRMGRLOG_INFO (
"Success\n");
871 rc = BTRMGR_RESULT_GENERIC_FAILURE;
872 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
880 unsigned char index_of_adapter,
881 BTRMgrDeviceHandle handle
884 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
887 if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (0 == handle)) {
888 rc = BTRMGR_RESULT_INVALID_INPUT;
889 BTRMGRLOG_ERROR (
"Input is invalid\n");
894 memset (&newDevice, 0,
sizeof(newDevice));
895 newDevice.m_adapterIndex = index_of_adapter;
896 newDevice.m_deviceHandle = handle;
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");
903 rc = BTRMGR_RESULT_GENERIC_FAILURE;
904 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
912 unsigned char index_of_adapter,
913 BTRMgrDeviceHandle handle
916 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
919 if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (0 == handle)) {
920 rc = BTRMGR_RESULT_INVALID_INPUT;
921 BTRMGRLOG_ERROR (
"Input is invalid\n");
926 memset (&removeDevice, 0,
sizeof(removeDevice));
927 removeDevice.m_adapterIndex = index_of_adapter;
928 removeDevice.m_deviceHandle = handle;
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");
935 rc = BTRMGR_RESULT_GENERIC_FAILURE;
936 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
944 unsigned char index_of_adapter,
948 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
951 if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (NULL == pPairedDevices)) {
952 rc = BTRMGR_RESULT_INVALID_INPUT;
953 BTRMGRLOG_ERROR (
"Input is invalid\n");
958 memset (&pairedDevices, 0,
sizeof(pairedDevices));
959 pairedDevices.m_adapterIndex = index_of_adapter;
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) {
964 BTRMGRLOG_INFO (
"Success\n");
967 rc = BTRMGR_RESULT_GENERIC_FAILURE;
968 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
976 unsigned char index_of_adapter,
977 BTRMgrDeviceHandle handle,
981 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
984 if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (0 == handle)) {
985 rc = BTRMGR_RESULT_INVALID_INPUT;
986 BTRMGRLOG_ERROR (
"Input is invalid\n");
991 connectToDevice.m_adapterIndex = index_of_adapter;
992 connectToDevice.m_connectAs = connectAs;
993 connectToDevice.m_deviceHandle = handle;
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");
1000 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1001 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1009 unsigned char index_of_adapter,
1010 BTRMgrDeviceHandle handle
1013 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1016 if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (0 == handle)) {
1017 rc = BTRMGR_RESULT_INVALID_INPUT;
1018 BTRMGRLOG_ERROR (
"Input is invalid\n");
1023 disConnectToDevice.m_adapterIndex = index_of_adapter;
1024 disConnectToDevice.m_deviceHandle = handle;
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");
1031 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1032 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1041 unsigned char index_of_adapter,
1045 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1048 if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (NULL == pConnectedDevices)) {
1049 rc = BTRMGR_RESULT_INVALID_INPUT;
1050 BTRMGRLOG_ERROR (
"Input is invalid\n");
1055 memset (&connectedDevices, 0,
sizeof(connectedDevices));
1056 connectedDevices.m_adapterIndex = index_of_adapter;
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) {
1061 BTRMGRLOG_INFO (
"Success\n");
1064 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1065 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1073 unsigned char index_of_adapter,
1074 BTRMgrDeviceHandle handle,
1078 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
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");
1088 deviceProperty.m_adapterIndex = index_of_adapter;
1089 deviceProperty.m_deviceHandle = handle;
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) {
1094 BTRMGRLOG_INFO (
"Success\n");
1097 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1098 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1107 unsigned char index_of_adapter,
1108 BTRMgrDeviceHandle handle,
1112 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1115 if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (0 == handle)) {
1116 rc = BTRMGR_RESULT_INVALID_INPUT;
1117 BTRMGRLOG_ERROR (
"Input is invalid\n");
1122 streaming.m_adapterIndex = index_of_adapter;
1123 streaming.m_deviceHandle = handle;
1124 streaming.m_audioPref = streamOutPref;
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");
1131 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1132 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1140 unsigned char index_of_adapter,
1141 BTRMgrDeviceHandle handle
1144 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1147 if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (0 == handle)) {
1148 rc = BTRMGR_RESULT_INVALID_INPUT;
1149 BTRMGRLOG_ERROR (
"Input is invalid\n");
1154 streaming.m_adapterIndex = index_of_adapter;
1155 streaming.m_deviceHandle = handle;
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");
1162 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1163 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1171 unsigned char index_of_adapter,
1172 unsigned char* pStreamingStatus
1175 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1178 if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (NULL == pStreamingStatus)) {
1179 rc = BTRMGR_RESULT_INVALID_INPUT;
1180 BTRMGRLOG_ERROR (
"Input is invalid\n");
1185 status.m_adapterIndex = index_of_adapter;
1186 status.m_streamingStatus = 0;
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");
1194 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1195 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1203 unsigned char index_of_adapter,
1207 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1210 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
1211 rc = BTRMGR_RESULT_INVALID_INPUT;
1212 BTRMGRLOG_ERROR (
"Input is invalid\n");
1217 streamingType.m_adapterIndex = index_of_adapter;
1218 streamingType.m_audioOutType = type;
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");
1225 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1226 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1235 unsigned char ui8AdapterIdx,
1236 BTRMgrDeviceHandle handle,
1240 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1243 if ((BTRMGR_ADAPTER_COUNT_MAX < ui8AdapterIdx) || (0 == handle)) {
1244 rc = BTRMGR_RESULT_INVALID_INPUT;
1245 BTRMGRLOG_ERROR (
"Input is invalid\n");
1250 streaming.m_adapterIndex = ui8AdapterIdx;
1251 streaming.m_deviceHandle = handle;
1252 streaming.m_audioPref = streamOutPref;
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");
1259 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1260 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1268 unsigned char ui8AdapterIdx,
1269 BTRMgrDeviceHandle handle
1272 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1275 if ((BTRMGR_ADAPTER_COUNT_MAX < ui8AdapterIdx) || (0 == handle)) {
1276 rc = BTRMGR_RESULT_INVALID_INPUT;
1277 BTRMGRLOG_ERROR (
"Input is invalid\n");
1282 streaming.m_adapterIndex = ui8AdapterIdx;
1283 streaming.m_deviceHandle = handle;
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");
1290 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1291 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1299 unsigned char ui8AdapterIdx,
1300 unsigned char* pStreamingStatus
1303 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1306 if ((BTRMGR_ADAPTER_COUNT_MAX < ui8AdapterIdx) || (NULL == pStreamingStatus)) {
1307 rc = BTRMGR_RESULT_INVALID_INPUT;
1308 BTRMGRLOG_ERROR (
"Input is invalid\n");
1313 status.m_adapterIndex = ui8AdapterIdx;
1314 status.m_streamingStatus = 0;
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");
1322 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1323 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1331 unsigned char index_of_adapter,
1335 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1338 if ((BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) || (apstBTRMgrEvtRsp == NULL)) {
1339 rc = BTRMGR_RESULT_INVALID_INPUT;
1340 BTRMGRLOG_ERROR (
"Input is invalid\n");
1344 lstBtrMgrIArmEvtResp.m_adapterIndex = index_of_adapter;
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");
1352 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1353 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1362 unsigned char index_of_adapter,
1363 BTRMgrDeviceHandle handle,
1367 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1370 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
1371 rc = BTRMGR_RESULT_INVALID_INPUT;
1372 BTRMGRLOG_ERROR (
"Input is invalid\n");
1377 mediaProperty.m_adapterIndex = index_of_adapter;
1378 mediaProperty.m_deviceHandle = handle;
1379 mediaProperty.m_mediaControlCmd = mediaCtrlCmd;
1382 if (IARM_RESULT_SUCCESS == retCode) {
1383 BTRMGRLOG_INFO (
"Success\n");
1386 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1387 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1396 unsigned char aui8AdapterIdx,
1397 BTRMgrDeviceHandle ahBTRMgrDevHdl,
1399 unsigned char *pui8Volume,
1400 unsigned char *pui8Mute
1404 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1407 if (BTRMGR_ADAPTER_COUNT_MAX < aui8AdapterIdx || NULL == pui8Volume || NULL == pui8Mute) {
1408 rc = BTRMGR_RESULT_INVALID_INPUT;
1409 BTRMGRLOG_ERROR (
"Input is invalid\n");
1414 devvolmut.m_adapterIndex = aui8AdapterIdx;
1415 devvolmut.m_deviceHandle = ahBTRMgrDevHdl;
1416 devvolmut.m_deviceOpType = deviceOpType;
1420 if (IARM_RESULT_SUCCESS == retCode) {
1421 *pui8Volume = devvolmut.m_volume;
1422 *pui8Mute = devvolmut.m_mute;
1423 BTRMGRLOG_INFO (
"Success\n");
1426 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1427 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1436 unsigned char aui8AdapterIdx,
1437 BTRMgrDeviceHandle ahBTRMgrDevHdl,
1439 unsigned char ui8Volume,
1440 unsigned char ui8Mute
1444 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1447 if (BTRMGR_ADAPTER_COUNT_MAX < aui8AdapterIdx || ui8Mute > 1) {
1448 rc = BTRMGR_RESULT_INVALID_INPUT;
1449 BTRMGRLOG_ERROR (
"Input is invalid\n");
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;
1462 if (IARM_RESULT_SUCCESS == retCode) {
1463 BTRMGRLOG_INFO (
"Success\n");
1466 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1467 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1475 unsigned char index_of_adapter,
1476 BTRMgrDeviceHandle handle,
1480 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1483 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter || NULL == mediaTrackInfo) {
1484 rc = BTRMGR_RESULT_INVALID_INPUT;
1485 BTRMGRLOG_ERROR (
"Input is invalid\n");
1490 mediaProperty.m_adapterIndex = index_of_adapter;
1491 mediaProperty.m_deviceHandle = handle;
1495 if (IARM_RESULT_SUCCESS == retCode) {
1497 BTRMGRLOG_INFO (
"Success\n");
1500 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1501 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1509 unsigned char index_of_adapter,
1510 BTRMgrDeviceHandle handle,
1511 BTRMgrMediaElementHandle mediaElementHandle,
1515 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1518 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter || NULL == mediaTrackInfo) {
1519 rc = BTRMGR_RESULT_INVALID_INPUT;
1520 BTRMGRLOG_ERROR (
"Input is invalid\n");
1525 mediaProperty.m_adapterIndex = index_of_adapter;
1526 mediaProperty.m_deviceHandle = handle;
1527 mediaProperty.m_mediaElementHandle = mediaElementHandle;
1531 if (IARM_RESULT_SUCCESS == retCode) {
1533 BTRMGRLOG_INFO (
"Success\n");
1536 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1537 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1545 unsigned char index_of_adapter,
1546 BTRMgrDeviceHandle handle,
1550 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1553 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter || NULL == mediaPositionInfo) {
1554 rc = BTRMGR_RESULT_INVALID_INPUT;
1555 BTRMGRLOG_ERROR (
"Input is invalid\n");
1560 mediaProperty.m_adapterIndex = index_of_adapter;
1561 mediaProperty.m_deviceHandle = handle;
1565 if (IARM_RESULT_SUCCESS == retCode) {
1567 BTRMGRLOG_INFO (
"Success\n");
1570 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1571 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1580 unsigned char index_of_adapter,
1581 BTRMgrDeviceHandle deviceHandle,
1582 BTRMgrMediaElementHandle mediaElementHandle,
1586 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1589 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
1590 rc = BTRMGR_RESULT_INVALID_INPUT;
1591 BTRMGRLOG_ERROR (
"Input is invalid\n");
1596 mediaElementList.m_adapterIndex = index_of_adapter;
1597 mediaElementList.m_deviceHandle = deviceHandle;
1598 mediaElementList.m_mediaElementHandle = mediaElementHandle;
1599 mediaElementList.m_mediaElementType = mediaElementType;
1603 if (IARM_RESULT_SUCCESS == retCode) {
1604 BTRMGRLOG_INFO (
"Success\n");
1607 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1608 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1617 unsigned char index_of_adapter,
1618 BTRMgrDeviceHandle deviceHandle,
1619 BTRMgrMediaElementHandle mediaElementHandle,
1620 unsigned short mediaElementStartIdx,
1621 unsigned short mediaElementEndIdx,
1622 unsigned char mediaElementListDepth,
1627 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1630 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter || !mediaElementListInfo) {
1631 rc = BTRMGR_RESULT_INVALID_INPUT;
1632 BTRMGRLOG_ERROR (
"Input is invalid\n");
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;
1647 if (IARM_RESULT_SUCCESS == retCode) {
1648 BTRMGRLOG_INFO (
"Success\n");
1652 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1653 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1662 unsigned char index_of_adapter,
1663 BTRMgrDeviceHandle deviceHandle,
1664 BTRMgrMediaElementHandle mediaElementHandle,
1669 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1672 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
1673 rc = BTRMGR_RESULT_INVALID_INPUT;
1674 BTRMGRLOG_ERROR (
"Input is invalid\n");
1679 mediaElementList.m_adapterIndex = index_of_adapter;
1680 mediaElementList.m_deviceHandle = deviceHandle;
1681 mediaElementList.m_mediaElementHandle = mediaElementHandle;
1682 mediaElementList.m_mediaElementType = mediaElementType;
1688 if (IARM_RESULT_SUCCESS == retCode) {
1689 BTRMGRLOG_INFO (
"Success\n");
1692 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1693 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1701 BTRMGR_GetLeProperty (
1702 unsigned char index_of_adapter,
1703 BTRMgrDeviceHandle handle,
1704 const char* apBtrUuid,
1706 void* apBtrPropValue
1710 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1713 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter || !apBtrUuid) {
1714 rc = BTRMGR_RESULT_INVALID_INPUT;
1715 BTRMGRLOG_ERROR (
"Input is invalid\n");
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);
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));
1732 case BTRMGR_LE_PROP_DEVICE:
1733 memcpy (apBtrPropValue, &leProperty.m_devicePath,
sizeof(leProperty.m_devicePath)-1);
1735 case BTRMGR_LE_PROP_SERVICE:
1736 memcpy (apBtrPropValue, &leProperty.m_servicePath,
sizeof(leProperty.m_servicePath)-1);
1738 case BTRMGR_LE_PROP_CHAR:
1739 memcpy (apBtrPropValue, &leProperty.m_characteristicPath,
sizeof(leProperty.m_characteristicPath)-1);
1741 case BTRMGR_LE_PROP_VALUE:
1742 memcpy (apBtrPropValue, &leProperty.m_value,
sizeof(leProperty.m_value)-1);
1744 case BTRMGR_LE_PROP_PRIMARY:
1745 *(
unsigned char*)apBtrPropValue = leProperty.m_primary;
1747 case BTRMGR_LE_PROP_NOTIFY:
1748 *(
unsigned char*)apBtrPropValue = leProperty.m_notifying;
1750 case BTRMGR_LE_PROP_FLAGS:
1751 memcpy (apBtrPropValue, &leProperty.m_flags,
sizeof(leProperty.m_flags));
1755 BTRMGRLOG_INFO (
"Success\n");
1758 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1759 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1768 unsigned char index_of_adapter,
1769 BTRMgrDeviceHandle handle,
1770 const char* aBtrLeUuid,
1776 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1779 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter || NULL == aBtrLeUuid) {
1780 rc = BTRMGR_RESULT_INVALID_INPUT;
1781 BTRMGRLOG_ERROR (
"Input is invalid\n");
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);
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);
1798 BTRMGRLOG_INFO (
"Success\n");
1801 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1802 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1811 unsigned char index_of_adapter,
1812 unsigned char aui8ServiceState
1815 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1818 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
1819 rc = BTRMGR_RESULT_INVALID_INPUT;
1820 BTRMGRLOG_ERROR (
"Input is invalid\n");
1825 audioInServiceState.m_adapterIndex = index_of_adapter;
1826 audioInServiceState.m_serviceState = aui8ServiceState;
1830 if (IARM_RESULT_SUCCESS == retCode) {
1831 BTRMGRLOG_INFO (
"Success\n");
1834 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1835 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1843 unsigned char index_of_adapter,
1844 unsigned char aui8ServiceState
1847 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1850 if (BTRMGR_ADAPTER_COUNT_MAX < index_of_adapter) {
1851 rc = BTRMGR_RESULT_INVALID_INPUT;
1852 BTRMGRLOG_ERROR (
"Input is invalid\n");
1857 hidGamePadServiceState.m_adapterIndex = index_of_adapter;
1858 hidGamePadServiceState.m_serviceState = aui8ServiceState;
1862 if (IARM_RESULT_SUCCESS == retCode) {
1863 BTRMGRLOG_INFO (
"Success\n");
1866 rc = BTRMGR_RESULT_GENERIC_FAILURE;
1867 BTRMGRLOG_ERROR (
"Failed; RetCode = %d\n", retCode);
1875 unsigned char aui8AdapterIdx,
1876 char *apDiagElement,
1881 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1886 if (BTRMGR_ADAPTER_COUNT_MAX < aui8AdapterIdx) {
1887 lenBtrMgrResult = BTRMGR_RESULT_INVALID_INPUT;
1888 BTRMGRLOG_ERROR(
"Input is invalid\n");
1889 return lenBtrMgrResult;
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)
1897 strncpy(lDiagInfo.m_DiagInfo, apValue, BTRMGR_MAX_STR_LEN - 1);
1899 BTRMGRLOG_INFO(
"calling BTRMGR_IARM_METHOD_GET_SYS_DIAG_INFO\n");
1902 if (IARM_RESULT_SUCCESS == retCode) {
1903 if (BTRMGR_LE_OP_READ_VALUE == aOpType)
1905 strncpy(apValue, lDiagInfo.m_DiagInfo, BTRMGR_MAX_STR_LEN - 1);
1907 BTRMGRLOG_INFO(
"Success\n");
1910 lenBtrMgrResult = BTRMGR_RESULT_GENERIC_FAILURE;
1911 BTRMGRLOG_ERROR(
"Failed; RetCode = %d\n", retCode);
1914 return lenBtrMgrResult;
1918 BTRMGR_ConnectToWifi(
1919 unsigned char aui8AdapterIdx,
1925 IARM_Result_t retCode = IARM_RESULT_SUCCESS;
1930 if (BTRMGR_ADAPTER_COUNT_MAX < aui8AdapterIdx) {
1931 lenBtrMgrResult = BTRMGR_RESULT_INVALID_INPUT;
1932 BTRMGRLOG_ERROR(
"Input is invalid\n");
1933 return lenBtrMgrResult;
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;
1942 if (IARM_RESULT_SUCCESS == retCode) {
1943 BTRMGRLOG_INFO(
"Success\n");
1946 lenBtrMgrResult = BTRMGR_RESULT_GENERIC_FAILURE;
1947 BTRMGRLOG_ERROR(
"Failed; RetCode = %d\n", retCode);
1950 return lenBtrMgrResult;
1957 if (type == BTRMGR_DEVICE_TYPE_WEARABLE_HEADSET)
1958 return "WEARABLE HEADSET";
1959 else if (type == BTRMGR_DEVICE_TYPE_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)
1971 else if (type == BTRMGR_DEVICE_TYPE_STB)
1973 else if (type == BTRMGR_DEVICE_TYPE_HIFI_AUDIO_DEVICE)
1974 return "HIFI AUDIO DEVICE";
1975 else if (type == BTRMGR_DEVICE_TYPE_VCR)
1977 else if (type == BTRMGR_DEVICE_TYPE_VIDEO_CAMERA)
1978 return "VIDEO CAMERA";
1979 else if (type == BTRMGR_DEVICE_TYPE_CAMCODER)
1981 else if (type == BTRMGR_DEVICE_TYPE_VIDEO_MONITOR)
1982 return "VIDEO MONITOR";
1983 else if (type == BTRMGR_DEVICE_TYPE_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)
1991 else if (type == BTRMGR_DEVICE_TYPE_TILE)
1993 else if ((type == BTRMGR_DEVICE_TYPE_HID) || (type == BTRMGR_DEVICE_TYPE_HID_GAMEPAD))
1994 return "HUMAN INTERFACE DEVICE";
1996 return "UNKNOWN DEVICE";
2001 BTRMGR_RegisterEventCallback (
2002 BTRMGR_EventCallback eventCallback
2006 if (!eventCallback) {
2007 rc = BTRMGR_RESULT_INVALID_INPUT;
2008 BTRMGRLOG_ERROR (
"Input is invalid\n");
2011 m_eventCallbackFunction = eventCallback;
2012 BTRMGRLOG_INFO (
"Success\n");
2023 btrMgrdeviceCallback (
2025 IARM_EventId_t eventId,
2030 if (NULL == pData) {
2031 BTRMGRLOG_ERROR (
"Input is invalid\n");
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) ){
2060 if (BTRMGR_IARM_EVENT_DEVICE_FOUND == eventId) {
2066 if (m_eventCallbackFunction)
2067 m_eventCallbackFunction (newEvent);
2069 BTRMGRLOG_TRACE (
"posted event(%d) from the adapter(%d) to listener successfully\n", newEvent.m_eventType, newEvent.m_adapterIndex);
2071 if (BTRMGR_IARM_EVENT_DEVICE_DISCOVERY_UPDATE == eventId) {
2072 BTRMGRLOG_TRACE(
"Name = %s\n\n", newEvent.m_discoveredDevice.m_name);
2076 BTRMGRLOG_ERROR (
"Event is invalid\n");
2085 btrMgrMediaCallback (
2087 IARM_EventId_t eventId,
2092 if (NULL == pData) {
2093 BTRMGRLOG_ERROR (
"Input is invalid\n");
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) ){
2127 if (m_eventCallbackFunction)
2128 m_eventCallbackFunction (newEvent);
2130 BTRMGRLOG_INFO (
"posted media event(%d) from the adapter(%d) to listener successfully\n", newEvent.m_eventType, newEvent.m_adapterIndex);
2133 BTRMGRLOG_ERROR (
"Event is invalid\n");