Click here to Skip to main content
15,882,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
This seems like it should be simple but I'm having problem correlating multiple services for a device. I need to read characteristics for
I have multiple devices, each has a custom service as well as implementations for some of the generic services.
I thought that if I enumerated based on my custom service, BluetoothGATTGetServices would return all of it's associated services...nope
C++
hDevInfo = SetupDiGetClassDevs( NULL, 0, 0, DIGCF_PRESENT | DIGCF_ALLCLASSES | DIGCF_DEVICEINTERFACE );
for ( DWORD j = 0; SetupDiEnumDeviceInterfaces( hDevInfo, NULL, &MyService, j, &did ); ++j )
      {
...
       m_Handle = CreateFile(
            pInterfaceDetailData->DevicePath,
            GENERIC_READ,
            FILE_SHARE_READ | FILE_SHARE_WRITE,
            NULL,
            OPEN_EXISTING,
            0,
            NULL );
...
USHORT numServices;
  hr = BluetoothGATTGetServices( hLEDevice, serviceBufferCount, pServiceBuffer, &numServices, BLUETOOTH_GATT_FLAG_NONE );


numServices always just gives me MyService but not any of the generic interfaces it implements.



Any ideas?

What I have tried:

I have tried multiple things without any luck. If I use SetupDiEnumDeviceInfo to enumerate the devices and then use the SP_DEVINFO_DATA of a device that I decide is mine based on it's friendly name in the call to SetupDiEnumDeviceInterfaces, I am not able to retrieve any interfaces at all.

I have also gone down the road of just pulling out all of the interfaces than trying to associate them later but am having a hard time finding something at the interface level that will tell me which device it actually is associated with
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900