1

Using WASAPI, I am successfully enumerating the output devices using IMMDeviceEnumerator::EnumAudioEndpoints and then eventually I have my IMMDevice. Then I can get the IPropertyStore and see there are variety of properties, but not sure which if any I can use to then work with the SetupDi or CM_Get_Device APIs to try to determine if the endpoint is associated to Bluetooth hardware

This page https://learn.microsoft.com/en-us/windows/win32/coreaudio/device-properties suggests I can get PKEY_Device_InstanceId and PKEY_Device_ContainerId from the property store, but they are not there.

Does anyone have an idea how to proceed here?

6
  • 2
    End all devices using SetupAPI or CfgMgr API. Find your device by comparing InstanceID. Once found, get its parent node, then try to get MAC address of this parent node. If this property is available - your device is Bluetooth one. You can take a look on Bluetooth Framework to find out how it works. Commented Oct 30, 2024 at 6:48
  • @MikePetrichenko this sounds promising but if PKEY_Device_InstanceId is not found on the IMMDevice then is there any workaround? Commented Oct 30, 2024 at 17:34
  • 1
    If you get IMMDevice interface you can call GetId() to get this endpoint ID. Once you have this ID you can use SetupAPI or CfgMgr API to find the same device. I tried to use different methods to get the device details with SetupAPI using given ID but the MMDevice ID is a little bit different from one returned by SetupAPI. So I ended up with simple enumerating all devices with setup API and then check that if MM device ID is in Setup API device ID (substring) then I try to get Device's Bluetooth MAC. If MAC was not found - device is not Bluetooth. If MAC found - device is Bluetooth. Commented Oct 30, 2024 at 18:44
  • Thank you @MikePetrichenko if I get the DEVPKEY_Device_Parent is this how I find the actual Bluetooth device? Then endpoint itself "Speakers (JBL)" does not have any such property, but I can see in Device Manager it's parent object does. However I am having trouble matching the ID provided by DEVPKEY_Device_Parent Commented Oct 31, 2024 at 0:34
  • 1
    That's exactly what I meant: use Setup API or CfgMgr to find a matching device. Parent node - is the Bluetooth device. Commented Oct 31, 2024 at 4:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.