I am developing for Windows Desktop. I want to get the devices in range and to show then as a list to the user.
This is the code I am using:
HBLUETOOTH_DEVICE_FIND founded_device;
BLUETOOTH_DEVICE_INFO device_info;
device_info.dwSize = sizeof(device_info);
BLUETOOTH_DEVICE_SEARCH_PARAMS search_criteria;
search_criteria.dwSize = sizeof(BLUETOOTH_DEVICE_SEARCH_PARAMS);
search_criteria.fReturnAuthenticated = FALSE;
search_criteria.fReturnRemembered = FALSE;
search_criteria.fReturnConnected = TRUE;
search_criteria.fReturnUnknown = FALSE;
search_criteria.fIssueInquiry = FALSE;
search_criteria.cTimeoutMultiplier = 0;
founded_device = BluetoothFindFirstDevice(&search_criteria, &device_info);
if (founded_device == NULL)
{
_tprintf(TEXT("Error: \n%s\n"), getErrorMessage(WSAGetLastError(), error));
return -1;
}
do
{
_tprintf(TEXT("founded device: %s\n"), device_info.szName);
} while (BluetoothFindNextDevice(founded_device, &device_info));
return 0;
My problem is that in the list of devices in range I always get the remembered devices. even if fReturnRemembered is set to false.
I need to find a way to get only the devices in range without the remembered devices.
currently what I am doing is, I am trying to open a socket and try to communicate, but is there any other way?