Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions include/btmgr.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in include/btmgr.h

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'include/btmgr.h' (Match: rdk/components/generic/bluetooth_mgr/rdk/components/generic/bluetooth_mgr/1812, 1434 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/bluetooth_mgr/+archive/RDK-DEV-1812.tar.gz, file: include/btmgr.h)

Check failure on line 3 in include/btmgr.h

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'include/btmgr.h' (Match: rdk/components/generic/bluetooth_mgr/rdk/components/generic/bluetooth_mgr/2006, 1453 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/bluetooth_mgr/+archive/rdk-dev-2006.tar.gz, file: include/btmgr.h)
*
* Copyright 2016 RDK Management
*
Expand Down Expand Up @@ -1022,6 +1022,17 @@
*/
BTRMGR_Result_t BTRMGR_GetDeviceBatteryLevel (unsigned char aui8AdapterIdx, BTRMgrDeviceHandle ahBTRMgrDevHdl,unsigned char * pDeviceBatteryLevel);

/**
* @brief This API initates or reports the gamepad connections from the device with operation type.
*
* @param[in] aui8AdapterIdx Index of bluetooth adapter.
* @param[in] aenBTRMgrDevConT Device opeartion type.
*
* @return Returns the status of the operation.
* @retval eBTRMgrSuccess on success, appropriate error code otherwise.
*/
BTRMGR_Result_t BTRMGR_ConnectGamepads_StartUp(unsigned char aui8AdapterIdx, BTRMGR_DeviceOperationType_t aenBTRMgrDevConT);

/**
* @brief This API initates the streaming from the device with default operation type.
*
Expand Down
84 changes: 84 additions & 0 deletions src/ifce/btrMgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
BTRMGR_STARTUP_AUD_RETRY,
} enBTRMGRStartupAudio;

// Move to private header ?

Check failure on line 139 in src/ifce/btrMgr.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'src/ifce/btrMgr.c' (Match: rdk/components/generic/bluetooth_mgr/rdk/components/generic/bluetooth_mgr/1902, 10390 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/bluetooth_mgr/+archive/rdk-dev-1902.tar.gz, file: src/ifce/btrMgr.c)

Check failure on line 139 in src/ifce/btrMgr.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'src/ifce/btrMgr.c' (Match: rdk/components/generic/bluetooth_mgr/rdk/components/generic/bluetooth_mgr/2009, 10652 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/bluetooth_mgr/+archive/RDK-DEV-2009.tar.gz, file: src/ifce/btrMgr.c)

Check failure on line 139 in src/ifce/btrMgr.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'src/ifce/btrMgr.c' (Match: rdk/components/generic/bluetooth_mgr/rdk/components/generic/bluetooth_mgr/2011, 10652 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/bluetooth_mgr/+archive/RDK-DEV-2011.tar.gz, file: src/ifce/btrMgr.c)
typedef struct _stBTRMgrStreamingInfo {
tBTRMgrAcHdl hBTRMgrAcHdl;
tBTRMgrSoHdl hBTRMgrSoHdl;
Expand Down Expand Up @@ -5946,6 +5946,87 @@
}
}
#ifndef LE_MODE
BTRMGR_Result_t
BTRMGR_ConnectGamepads_StartUp (
unsigned char aui8AdapterIdx,
BTRMGR_DeviceOperationType_t aenBTRMgrDevConT
) {
BTRMGR_Result_t lenBtrMgrResult = BTRMGR_RESULT_SUCCESS;
int auth;
stBTRCoreDevStatusCBInfo stRecreatedEvent = { 0 };
BTRMGR_EventMessage_t lstEventMessage;

char lcPowerState[BTRMGR_LE_STR_LEN_MAX] = {'\0'};
BTRMGR_SysDiagChar_t lpcPowerString = BTRMGR_SYS_DIAG_POWERSTATE;

if (eBTRMgrSuccess == BTRMGR_SD_GetData(ghBTRMgrSdHdl, lpcPowerString, lcPowerState)) {
if(strncmp(lcPowerState, BTRMGR_SYS_DIAG_PWRST_ON, strlen(BTRMGR_SYS_DIAG_PWRST_ON) != 0))
{
BTRMGRLOG_ERROR("Power state is %s no need to try connecting device as it will connect once ON\n", lcPowerState);
return BTRMGR_RESULT_GENERIC_FAILURE;
}
else
{
BTRMGRLOG_INFO("Power state is ON\n");
}
}
else
{
BTRMGRLOG_ERROR("Could not get power state\n");
}

BTRMGR_GetPairedDevices (aui8AdapterIdx, &gListOfPairedDevices);
for (unsigned char i = 0; i < gListOfPairedDevices.m_numOfDevices; i++)
{
stBTRCoreBTDevice stDeviceInfo = { 0 };
btrMgr_GetDeviceDetails(gListOfPairedDevices.m_deviceProperty[i].m_deviceHandle, &stDeviceInfo);
if (stDeviceInfo.bDeviceConnected
&& (gListOfPairedDevices.m_deviceProperty[i].m_deviceType == BTRMGR_DEVICE_TYPE_HID
|| gListOfPairedDevices.m_deviceProperty[i].m_deviceType ==BTRMGR_DEVICE_TYPE_HID_GAMEPAD)
&& (!btrMgr_IsDeviceRdkRcu(&gListOfPairedDevices.m_deviceProperty[i].m_serviceInfo, stDeviceInfo.ui16DevAppearanceBleSpec)))
{
strncpy(stRecreatedEvent.deviceName, stDeviceInfo.pcDeviceName, BTRMGR_NAME_LEN_MAX - 1);
strncpy(stRecreatedEvent.deviceAddress, stDeviceInfo.pcDeviceAddress, BTRMGR_NAME_LEN_MAX - 1);
stRecreatedEvent.deviceId = stDeviceInfo.tDeviceId;
stRecreatedEvent.eDeviceClass = stDeviceInfo.enDeviceType;
stRecreatedEvent.eDeviceType = stDeviceInfo.enDeviceType;
stRecreatedEvent.isPaired = 1;
stRecreatedEvent.ui32VendorId = stDeviceInfo.ui32ModaliasVendorId;
stRecreatedEvent.ui32ProductId = stDeviceInfo.ui32ModaliasProductId;
stRecreatedEvent.ui32DeviceId = stDeviceInfo.ui32ModaliasDeviceId;
stRecreatedEvent.ui16DevAppearanceBleSpec = stDeviceInfo.ui16DevAppearanceBleSpec;
stRecreatedEvent.eDevicePrevState = enBTRCoreDevStPaired;
stRecreatedEvent.eDeviceCurrState = enBTRCoreDevStConnected;


//recreate event that would have been received from the connectCb
btrMgr_IncomingConnectionAuthentication(&stRecreatedEvent, &auth);

if (!auth)
continue;

btrMgr_MapDevstatusInfoToEventInfo ((void *)&stRecreatedEvent, &lstEventMessage, BTRMGR_EVENT_DEVICE_FOUND);
lstEventMessage.m_pairedDevice.m_deviceType = BTRMGR_DEVICE_TYPE_HID;
btrMgr_SetDevConnected(lstEventMessage.m_pairedDevice.m_deviceHandle, 1);
BTRCore_newBatteryLevelDevice(ghBTRCoreHdl);

BTRMGRLOG_DEBUG("Posting Device Found Event ..\n");

if (gbGamepadStandbyMode && ((lstEventMessage.m_pairedDevice.m_deviceType == BTRMGR_DEVICE_TYPE_HID) ||
(lstEventMessage.m_pairedDevice.m_deviceType == BTRMGR_DEVICE_TYPE_HID_GAMEPAD)))
{
BTRMGRLOG_WARN("Device is in standby mode, we won't post to the upper layers if a device is found\n");
continue;
}
if (gfpcBBTRMgrEventOut) {
gfpcBBTRMgrEventOut(lstEventMessage);
}
}
}

return lenBtrMgrResult;
}

BTRMGR_Result_t
BTRMGR_StartAudioStreamingOut_StartUp (
unsigned char aui8AdapterIdx,
Expand Down Expand Up @@ -9009,6 +9090,9 @@
if( BTRMGR_StartAudioStreamingOut_StartUp(lui8AdapterIdx, BTRMGR_DEVICE_OP_TYPE_AUDIO_OUTPUT) != BTRMGR_RESULT_SUCCESS) {
BTRMGRLOG_ERROR ("ConnPwrStChange - BTRMGR_StartAudioStreamingOut_StartUp Failed!\n");
}
if( BTRMGR_ConnectGamepads_StartUp(lui8AdapterIdx, BTRMGR_DEVICE_OP_TYPE_HID) != BTRMGR_RESULT_SUCCESS) {
BTRMGRLOG_ERROR ("ConnPwrStChange - BTRMGR_ConnectGamepads_StartUp Failed!\n");
}
}

#endif
Expand Down
5 changes: 5 additions & 0 deletions src/main/btrMgr_main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in src/main/btrMgr_main.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'src/main/btrMgr_main.c' (Match: rdk/components/generic/bluetooth_mgr/rdk/components/generic/bluetooth_mgr/2006, 169 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/bluetooth_mgr/+archive/rdk-dev-2006.tar.gz, file: src/main/btrMgr_main.c)
*
* Copyright 2016 RDK Management
*
Expand Down Expand Up @@ -108,6 +108,11 @@
lenBtrMgrSoResult = BTRMGR_StartAudioStreamingOut_StartUp(0, BTRMGR_DEVICE_OP_TYPE_AUDIO_OUTPUT);
printf ("BTRMGR_StartAudioStreamingOut_StartUp - %d\n", lenBtrMgrSoResult);
fflush(stdout);

lenBtrMgrSoResult = BTRMGR_ConnectGamepads_StartUp(0, BTRMGR_DEVICE_OP_TYPE_HID);
printf ("BTRMGR_StartAudioStreamingOut_StartUp - %d\n", lenBtrMgrSoResult);
fflush(stdout);

#endif

#if defined(ENABLE_SD_NOTIFY)
Expand Down
Loading