Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bluetooth virtual serial ports

30 views
Skip to first unread message

JimmyBluetooth

unread,
Sep 26, 2005, 2:34:05 PM9/26/05
to
NOTE: This question is a cross-post from microsoft.public.platformsdk.shell.
The original post was on 9/21/05 and had not received any response as of
9/26/05.

I'm writing a C++ application that communicates with a Bluetooth device, and
that device restricts me to using the serial port profile. Using the
Platform SDK Bluetooth APIs (defined in BluetoothAPIs.h) on Windows XP
Service Pack 2, my application is able to programmatically discover, pair
with, and connect to a Bluetooth device without any user intervention at all.
My problem lies in trying to determine which virtual serial port a given
Bluetooth device gets mapped to.

To connect to the serial port service on my Bluetooth device, my code makes
the following call:

GUID service = SerialPortServiceClass_UUID; // from bthdef.h
lastError = BluetoothSetServiceState( radioHandle, &bluetoothDeviceInfo,
&service, BLUETOOTH_SERVICE_ENABLE );

When that function is called, Windows automatically creates a virtual serial
port for my application to use for outgoing communication with my Bluetooth
device. Great! That saves me the hassle of calling RegisterDevice. There's
only one problem -- which virtual serial port just got created? (It's not
always COM7 or COM8.)

But the problem gets more complicated. Imagine that the user quits my
application, comes back a couple of hours later, and starts my application up
again. At this point, I can programmatically go through and find out that
Bluetooth device X has been connected before and has been authenticated
(paired). But which virtual serial port should I open to communicate with
device X? Obviously this information is stored somewhere, because it is
presented when I open Control Panel->Bluetooth Devices->COM Ports. But how
can my application access that information?

In short, the task is to start with a BLUETOOTH_DEVICE_INFO structure and
end up with a virtual serial port number. What functions do I need to call
to access that information?

JimmyBluetooth

unread,
Oct 4, 2005, 9:01:03 PM10/4/05
to
This question has been answered in the
microsoft.public.win32.programmer.networks group. See the topic "Bluetooth
virtual serial ports" on 9/29/2005.
0 new messages