Partager via


Making a Bluetooth DUN Connection Using Connection Manager (Windows Embedded CE 6.0)

1/6/2010

This topic describes how to establish a Bluetooth Dial-Up Network (DUN) connection using a virtual COM port. The topic also shows how to send phone states from external Bluetooth pairing service and Hands-Free Profile (HFP) modules to Connection Manager.

To create a virtual COM port for a DUN connection

  1. Obtain the Bluetooth device address (BT_ADDR) of the remote Bluetooth-enabled device. For more information about the BT-ADDR, see Internal Representation for Bluetooth Address.

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

    1. Pass a WSAQUERYSET (Bluetooth) structure to WSALookupServiceBegin (Bluetooth) 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.
  3. Create a virtual COM port for the Bluetooth DUN connection.

    1. Assign an unused virtual COM port to this Bluetooth DUN connection.
    2. Create a virtual COM port by calling RegisterDevice.

To send phone states from Bluetooth external modules to Connection Manager

  1. For paired phone states, call the ConnMgrProviderMessage function. Pass PROVMSG_RAS_SETBTPHONEPRESENT for the dwMsg1 parameter and 1 or 0 (zero) for the dwMsg2 parameter.

    Use 1 to indicate that a paired phone is present, and 0 (zero) to indicate it is not present. Pass the virtual COM port number as byte data for the pParams parameter. For more information about PROVMSG_RAS_SETBTPHONEPRESENT, see Connection Manager Messages.

    // Bluetooth phone available:
    ConnMgrProviderMessage( NULL, &IID_CSPBTVoiceExtension, NULL, PROVMSG_RAS_SETBTPHONEPRESENT, 1, (PBYTE)&portNumber, sizeof(UINT8) );
    // Bluetooth phone unvailable:
    ConnMgrProviderMessage( NULL, &IID_CSPBTVoiceExtension, NULL, PROVMSG_RAS_SETBTPHONEPRESENT, 0, NULL, 0);
    
  2. For HFP states call the ConnMgrProviderMessage function. Pass PROVMSG_RAS_SETBTVOICECALLSTATUS for dwMsg1 and the HFP voice call status for dwMsg2.

    Use 1 for the call status to indicate that the Bluetooth phone is in a HFP call, and 0 (zero) to indicate it is not in a HFP call. For more information about PROVMSG_RAS_SETBTVOICECALLSTATUS, see Connection Manager Messages.

    // Bluetooth phone in HFP call:
    ConnMgrProviderMessage( NULL, &IID_CSPBTVoiceExtension, NULL, PROVMSG_RAS_SETBTVOICECALLSTATUS, 1, NULL, 0 );        
    

See Also

Concepts

Connection Manager How-to Topics

Other Resources

Connection Manager Application Development