WinXP/MFC:蓝牙枚举:重置设备列表?
我正在查看一组需要使用的蓝牙设备。它们有一组已知的 MAC 地址,因此我可以从枚举列表中挑选它们。我在让系统向我提供当前列表时遇到问题。
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);
我循环浏览设备列表并挑选出已识别的设备。
看来我必须重新运行控制面板小程序才能刷新可发现的设备,否则我会得到似乎是“记住”的列表(而不是本地、未配对和打开的设备的实际列表) 。
建议?
使用XP/VC2008/MFC
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
FWIW:如果您想重置列表,请使用以下代码:
FWIW: If you want to reset the list, use this code: