Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ SetupDienumDeviceInterface不返回蓝牙设备的接口_C++_Visual Studio_Bluetooth_Windows 10_Bluetooth Lowenergy - Fatal编程技术网

C++ SetupDienumDeviceInterface不返回蓝牙设备的接口

C++ SetupDienumDeviceInterface不返回蓝牙设备的接口,c++,visual-studio,bluetooth,windows-10,bluetooth-lowenergy,C++,Visual Studio,Bluetooth,Windows 10,Bluetooth Lowenergy,当我们的程序到达这个for循环时,setupDienumDeviceInterface立即返回false,因此永远不会运行for循环。这表明SetupDienumDeviceInterface没有找到蓝牙设备的接口,即使我们通过应用程序bluetooth LE Explorer检查了设备是否与计算机配对。我们已经检查了AGuid是否是设备的正确UUID。我们正在使用Windows10上的VisualStudioCommunity2017和BluetoothAPI.h。如何让SetupDienum

当我们的程序到达这个for循环时,setupDienumDeviceInterface立即返回false,因此永远不会运行for循环。这表明SetupDienumDeviceInterface没有找到蓝牙设备的接口,即使我们通过应用程序bluetooth LE Explorer检查了设备是否与计算机配对。我们已经检查了AGuid是否是设备的正确UUID。我们正在使用Windows10上的VisualStudioCommunity2017和BluetoothAPI.h。如何让SetupDienumDeviceInterface返回设备的接口

句柄GetBLEHandle(\uu在GUID AGuid中)

{


很可能您的GUID错误 我也有同样的问题

我指出了类的GUID,而不是接口。 我使用了{e0cbf06c-cd8b-4647-bb8a-263b43f0f974}

但是我需要 {0850302A-B344-4fda-9BE9-90576B8D46F0}


尝试以下操作:)

是的,你说的是错误的GUID。我们在使用尝试订阅的服务的服务GUID时解决了问题。我们通过连接Windows应用商店中的Bluetooth LE Explorer应用程序找到了服务GUID,并将该GUID复制到了我们的代码中。此注释帮助我最终枚举了inte我不明白的是,如果不使用该应用程序首先获取服务guid,我们应该如何做
HDEVINFO hDI;

SP_DEVICE_INTERFACE_DATA did;

SP_DEVINFO_DATA dd;

GUID BluetoothInterfaceGUID = AGuid;

HANDLE hComm = NULL;


hDI = SetupDiGetClassDevs(&BluetoothInterfaceGUID, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);

if (hDI == INVALID_HANDLE_VALUE) return NULL;

did.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);

dd.cbSize = sizeof(SP_DEVINFO_DATA);



for (DWORD i = 0; SetupDiEnumDeviceInterfaces(hDI, NULL, &BluetoothInterfaceGUID, i, &did); i++) {