Making a Bluetooth DUN Connection Without Using HFP or the Pairing Service

10/16/2008

Applies to Windows Embedded NavReadyUpdate 954747

By default, to use Connection Manager for establishing a data connection over Bluetooth Dial-up Networking (DUN), you must also include the Bluetooth Hands-Free Profile (HFP) (SYSGEN_BTH_HF) and Bluetooth Pairing Service (SYSGEN_BTH_PAIRSVC) operating-system (OS) components in your OS design. This is because Connection Manager expects the Bluetooth HFP profile to be active when it creates a Bluetooth DUN connection. However, this requirement might be inconvenient for OEMs who otherwise do not have to have these components, or who want to include a third-party HFP component instead.

With Windows Embedded NavReady Update 954747, you can do the following:

  • Use Connection Manager to establish and manage a Bluetooth DUN connection even if HFP is not active on the portable navigation device (PND).
  • Include third-party Bluetooth HFP modules in your OS design, which will interoperate with Connection Manager.

To make sure that third-party Bluetooth HFP modules interoperate correctly with Connection Manager, you must add code to your OS design to do the following:

  1. Implement code that sends the current phone state to Connection Manager so that it is aware of whether a hands-free call on a paired phone is currently active during an attempt to create a Bluetooth DUN connection.
  2. Implement code that updates RasBook entries so that Connection Manager has the information that is required to create Bluetooth DUN connections.

The following procedures in this topic describe how to complete these two tasks.

To send phone states from Bluetooth source code to Connection Manager

  1. From your Bluetooth Pairing source code, write code to pulse BTPHONE_PHONEPRESENT_EVENT by using CreateEvent and PulseEvent. When the paired phone is connected, set the event data to TRUE by using SetEventData. When the pairing relationship to a phone is removed, set the event data to FALSE. For more information, see Connection Manager Events.

  2. From your third-party HFP component code, write code to signal HFPPHONE_VOICEACTIVE_EVENT by using CreateEvent and PulseEvent. When the paired phone is currently engaged in a hands-free call (either in an ongoing call or dialing a phone number), set the event data to TRUE by using SetEventData. When the phone call is disconnected, set the event data to FALSE. For more information, see Connection Manager Events.

To update RasBook entries for Bluetooth DUN

  1. Complete the Bluetooth pairing procedure by using your custom Bluetooth Pairing source code.

  2. Obtain the Bluetooth Device Address (BT_ADDR) of the remote Bluetooth-enabled device that you want to query. During the pairing procedure, the Bluetooth pairing code can determine the Bluetooth device address and write it to a custom registry key. You can determine this value by reading the appropriate registry key.

  3. By using Service Discovery Protocol (SDP) APIs, obtain the RF COMM port number for the DUN profile.

    1. Pass a WSAQUERYSET structure to WSALookupServiceBegin, in order to begin an SDP inquiry for Bluetooth DUN using BthNsLookupServiceBegin and BthNsLookupServiceNext. For more information, see Configuring WSAQUERYSET for Service Discovery.
    2. Parse the SDP record and retrieve the RF COMM channel number.
    3. Process the SDP attributes by using ISdpStream, ISdpRecord, and ISdpNodeContainer COM interfaces. For more information, see Searching SDP Attributes Using COM Interfaces.
  4. Create a virtual COM port for the Bluetooth DUN connection.

    1. Assign an unused virtual COM port that you will use for this Bluetooth DUN connection.
    2. Create a virtual COM port by calling RegisterDevice.
  5. Update the RAS book entries to reflect the correct virtual COM port number by using RasGetEntryProperties and RasSetEntryProperties.

See Also

Reference

Connection Manager Events

Other Resources

Connection Manager Application Development for Portable Navigation Devices