Im looking at a group of Bluetooth devices that I need to work with. They have a known bank of MAC addresses so I can pick them out of the enumerated list. Im running into problems getting the system to provide me with a current list.
BLUETOOTH_RADIO_INFO radioInfo;
radioInfo.dwSize = sizeof(radioInfo);
HRESULT hr = ::BluetoothGetRadioInfo(hRadio, &radioInfo);
BLUETOOTH_DEVICE_SEARCH_PARAMS deviceSearchParams;
memset(&deviceSearchParams, 0, sizeof(deviceSearchParams));
deviceSearchParams.dwSize = sizeof(deviceSearchParams);
deviceSearchParams.fReturnAuthenticated = false;
deviceSearchParams.fReturnRemembered = false;
deviceSearchParams.fReturnUnknown = true;
deviceSearchParams.fReturnConnected = false;
deviceSearchParams.hRadio = hRadio;
HANDLE hDeviceFind = ::BluetoothFindFirstDevice(&deviceSearchParams, &deviceInfo);
I loop through the device list and pick out the recognized units.
It seems that I have to rerun the control panel applet in order to refresh the discoverable devices or else I get what appears to be a ‘remembered’ list (rather than the actual list of devices that are local, non-paired and turned on).
Suggestions?
Using XP/VC2008/MFC
FWIW: If you want to reset the list, use this code: