Bluetooth using COM8 in .NET 2.0

T

Toke Eskildsen

I'm developing an application for an iPaq Pocket PC 5550, that uses a
Holux GPSlim 236 GPS-unit. I'm using C# and Visual Studio 2005 b2.

I want to receive data from the GPS unit using Bluetooth. The iPaq used
the Widcom/Broadcom-stack, so I know that direct Bluetooth requires the
drivers from Broadcom or BTAccess. Right now, I just want to use the
virtual COM-port.


When I try to connect to COM8, the iPaq asks me to select a Bluetooth-
device. I select the Holux GPS and my program throws an IOException at
SerialStream.QinIOError() at SerialStream.CheckResult() at
SerialStream.SetBufferSizes() at SerialPort.Open().


The relevant code is very simple:

SerialPort port = new SerialPort("COM8");
port.BaudRate = 38400;
port.DataBits = 8;
port.Parity = Parity.None;
port.StopBits = StopBits.One;
try {
port.Open();
}
catch (Exception ex) {
datastr = "Exception: " + ex.Message + " " + ex.StackTrace;
}

I've tried using vxHpc http://www.cam.com/vxhpc.html to make a "Direct
Connect - Async" to "Bluetooth Null Modem". That worked as it should,
so it seems that the GPS and the iPaq Bluetooth are fine.

Any ideas as to why the simple SerialPort-example doesn't work?
 
T

Tim Johnson

Are you using the SerialPort class from OpenNetCF for CF v1.0, or the
built-in one from Microsoft in CF v2.0? A bunch of us have recently found a
bug in the OpenNetCF version, and the fix is described here:

http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=5751

If it's the Microsoft/CF2.0 version I don't know what the problem might be.

Also, for bluetooth's com port you don't really need to set the baud rate
etc, the driver handles all that at whatever data rate the bluetooth radio
supports.
--

Tim Johnson
High Point Software, Inc.
www.high-point.com
(503) 312-8625
 
T

Toke Eskildsen

Tim Johnson said:
Are you using the SerialPort class from OpenNetCF for CF v1.0, or
the built-in one from Microsoft in CF v2.0?

I'm using the built-in. I would prefer to continue doing so, as it
makes debugging easier: I have a simple GUI made for Windows XP that
uses some of the classes from the Pocket PC application.

My code for receiving GPS data through the virtual COM-port works fine
on Windows XP, but maybe that's because the pairing of Bluetooth-units
with virtual COM-ports works differently there?

Deadlines are looming, so I'll try and see if I can get OpenNetCF to
work under CF 2.0, instead of pursuing the more elegant solution. I'll
switch back, if I find out how to fix the error I get. Thanks for the
hint about the bug.
Also, for bluetooth's com port you don't really need to set the
baud rate etc, the driver handles all that at whatever data rate
the bluetooth radio supports.

Thanks.
 
P

Peter Foot [MVP]

Do you have any GPS software on the device which you can test to see if it
can open and read from the same com port successfully?

Peter
 
T

Toke Eskildsen

Peter Foot said:
Do you have any GPS software on the device which you can test to
see if it can open and read from the same com port successfully?

Yes, it works just fine.

Since I read Tim's post, I've tried using the serial-component from
OpenNETCF. After I applied the corrections, Tim linked to, I was able
to open a connection to the GPS and receive data from it.

I would still prefer to do it with the standard CF 2.0 API from
Microsoft, but OpenNETCF will do for now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top