0

I'm currently looking for a way to list the services exposed by a remote bluetooth device and to enable them.

Normally I would be using the WindowsAPI-functions (or more likely one of the known wrappers) to list the services and to enable them by GUID (SetServiceEnable).

The problem is, that the device is exposing two Services with the same GUID!

Thus using the windowsAPI-functions only enables one of these services. The other service can't be enabled.

I thought perhaps WMI could do the trick, but I'm still new to WMI and couldn't find any

Windows itself is able to enable both, none or a specific service over the servicemenu.

UPDATE The problem I want to solve is to be able to enable either the first or the second service. By now only the first service (which is usually the service I need), but I couldn't find a solution to enable the second service (except by using the Windows UI).

If both services are enabled I have two Commports in devicemanager (SPP).

1 Answer 1

-1

Since I can't add comment/questions (don't have the privilege on stackoverflow yet). Here's my best take.

If I understand correctly, it's invalid to have the service available more than once in the service record, right? Can you right click on the device in Bluetooth Pairing UI and see if you see two services and that you can enable them through the Windows UI? And once you enable them do you see two PNP devnodes under that device in device manager (view by connection) with the corresponding opposite role of the two service you enabled? (I can't try this because I don't know of a device I have with two identical UUIDs.)

As you might already know, when you enable service on a remote device, you are not actually enabling the service on the remote device through the Windows Bluetooth API. What you are doing is telling the core bluetooth component in Windows to generate the corresponding opposite role of the service. (This is what BluetoothSetLocalServiceInfo does.) For example, if the remote device supports A2DP sink, by enabling that service the Bluetooth service on desktop would then register a A2DP source service for that device, which generates a PNP devnode for matching A2DP source drivers to install on that devnode. By disabling that service, the Bluetooth service would then unregister the A2DP source devnode and the PNP devnode would be removed (sort of like unplugging a USB device).

Depending on what profile you are seeing being duplicated, it might not make sense to have two instances of device objects and driver objects that matches on the same mac address of the remote device.

My answer (which is actually not answering your question) is to check if it's even valid for the two services to be enabled in that case on the desktop with the drivers on the desktop that you will be working with. For example, a bundle of A2DP plus HFP would require A2DP and HFP to synchronize certain behavior, such as AVDTP suspend. Depending on the implementation and the drivers, they might not be expecting there are two instances of A2DP driver installed, hence causing the unexpected state of the local drivers.

3
  • Windows itself is able to enable both, none or a specific service over the servicemenu. I didn't have a look at the devicemanager and though. Unfortunately, I'm on holiday right now and won't be able to test anything until next week. By the way: it is a FTDI-bluetooth-chip we use and it exposes two SPP called SPP and AToverSPP. See also update.
    – AlexS
    Jul 3, 2012 at 8:08
  • Then I would think there is a way to do that programmatically too. But why do you think WMI is your solution though? I could be missing something.
    – yuklai
    Jul 4, 2012 at 1:30
  • I think WMI could by one way to do it. But while inspecting the Windows Bluetooth-API I didn't find a way to achieve my goals.
    – AlexS
    Jul 6, 2012 at 6:31

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.