Skip to content

Connecting to Bluetooth Services

Peter Foot edited this page Mar 31, 2017 · 1 revision

Connecting to Bluetooth services

Sometimes we don’t want our application to itself send data to/from a remote service but we want instead the local operating system to do so. This is the case for keyboard/mouse/etc with HID, networking with DUN/NAP/PAN/etc, Headset/Handsfree etc.

The short answer in this case is to use BluetoothDeviceInfo.SetServiceState. This is the API equivalent to manually checking the respective checkbox on the “Services” tab of the Device dialog in Bluetooth Control panel.

  • For HID this will allow you to access the input keys/movements via the Windows’ HID API. This is for instance used by the Wiimote project.
  • This should also work for Handsfree and Headset (on Windows 7).
  • It probably won’t work for network connections.

Other platforms

However the SetServiceState API is provided only on desktop Windows with the Microsoft stack. It is not supported at all on Widcomm. We manually try to reproduce this behaviour on CE/WM by editing the Registry and thus only support a few services there, and a reset is normally required. There is good native API support for this on BlueSoleil and it is currently not supported at all on BlueZ.

The other stacks often have native APIs for controlling services. See their API, e.g.

Clone this wiki locally