Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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

  • %_WINCEROOT%\public\common\sdk\samples\bluetooth\comtest

  • %_WINCEROOT%\public\common\sdk\samples\bluetooth\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 → Bluetooth → Bluetooth Application Development →

  • Registering a Bluetooth 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 bluetooth-port, to which other bluetooth-devices may connect to.
client will create a serial bluetooth-port and connect to the bluetooth-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 bluetooth-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 bluetooth-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\bluetooth. 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 bluetooth-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

  • No labels