• In progress
  • Creating a BT COM-Port

    To create a virtual BT-com-port you may use the samples found at:

    • %_WINCEROOT%\public\common\sdk\samples\bl…th\comtest

    • %_WINCEROOT%\public\common\sdk\samples\bl…th\sca

    %_WINCEROOT% is the directory of your platform-builder installation.

    View the readme.txt-files in the sample directory for usage-information.

    View the Windows CE Platform Builder help for details:
    Networking - Wireless → Bl…th → Bl….th Application Development →

    • Registering a BT Service

    • Creating a Connection to a Remote Device Using a Virtual COM Port

    Both samples take these parameters:

    Usage: %s {server | client <target bt_addr>} channel port_index

    Where %s is either comtest or sca.
    server will create a serial BT-port, to which other BT-devices may connect to.
    client will create a serial BT-port and connect to the BT-device specified by target bt_addr.
    channel is the RFCOMM-channel number. Use a value between 1 and 31 or 0xfe to select a availlable channel.
    port_index should be a free COM-port-index not already used by another driver.

    Making it discoverable

    To make the created COM-port discoverable by other BT-devices, your application needs to register a SDP-record for the new COM-port-service. SDP stands for Service-Discovery-Protocoll and is used everytime a BT-device queries for availlable services on another device.

    A SDP-record is not registered by the sca or comtest sample and thus the RFCOMM-service is not seen, although it can be used.

    See the download section for a modified sca-sample.
    Following modifications where made:

    • Added a RegisterSDP() and DeRegisterSDP()-function.

    • Created a SDP-record for RFCOMM-devices (rgbSdpRecordRFCOMM).

    A SDP-record is registered/deregisted with BthNsSetService(..).

    To create a custom SDP-record have a look at the bthnscreate-utility found at %_WINCEROOT%\public\common\sdk\samples\bl...th. The input rec-file to create the rgbSdpRecordRFCOMM-structure is availlable in the download section.

    Example-usage of the modified sca-sample:
    sca server 1 6

    This creates a BT-COM-port on RFCOMM-Channel 1 and associates it with device COM6:.

    Downloads

    Modified SCA-sample: sca.zip
    RFCOMM-REC-file to generate SDP: serial.zip