PC Review


Reply
Thread Tools Rate Thread

Bluetooth - Virtual Com Port

 
 
Ben G
Guest
Posts: n/a
 
      22nd Mar 2007
Hi all,

I’m using Visual Studio 2005, Compact Framework 2.0 and C# to develop an
application which needs to transmit/receive data strings (small – only a
couple of bytes) to/from a Bluetooth serial module, e.g.
(http://www.ezurio.com/products/bism/). I’m a novice in this area and
this is the first Pocket PC application I’ve worked on so your patience
with my query will be appreciated.

From basic research on the net I’ve found there doesn’t appear to be a
built in API to access Bluetooth functionality that I initially hoped
for and to be honest expected. The target platform I’m developing for is
a HP iPAQ which I believe uses the BroadCom/Widcomm stack, the SDK for
this is C++ based and this would mean using P/Invoke calls, I don’t have
any experience of this but it does look to make thinks complicated.

On another topic on this forum I did see that it is possible to
communicate via Bluetooth by using a virtual com port, i.e.

//Create output Bluetooth port
SerialPort oBluetooth = new SerialPort("COM8");
oBluetooth.BaudRate = 38400;
oBluetooth.DataBits = 8;
oBluetooth.Parity = Parity.None;
oBluetooth.StopBits = StopBits.One;

//Connect
try
{
oBluetooth.Open();
oBluetooth.WriteLine("Test String");
oBluetooth.Close();
}
catch (Exception ex)
{
MessageBox.Show("Exception: " + ex.Message + " " + ex.StackTrace);
}

Is it really as simple as doing something like the above? I’ve tested
this example on the Pocket PC and attempted to connect with a Bluetooth
enabled laptop, no errors are reported and Bluetooth activity is
indicated on the laptop. What I’m unsure of however is what is required
on the laptop side to receive and display the data? Do I need some form
of handshaking or is this done by the serial port object? Is there
something I could run on the laptop like a terminal window or do I need
to write a custom application? I’ve been searching on the web for
similar examples but haven’t managed to find very much. I’d appreciate
it if anyone could post advice or links. I’d also welcome comments on
whether using the virtual com port is the right approach for what I’m
trying to do or should I be looking to use a commercial SDK such as
BTAccess (http://www.high-point.com/).

Thanks for your time,
Ben.
 
Reply With Quote
 
 
 
 
Dick Grier
Guest
Posts: n/a
 
      22nd Mar 2007
Hi,

>>

Is it really as simple as doing something like the above?
<<

Yes, in general. I use a BT for similar virtual serial connections.

>>

What I’m unsure of however is what is required
on the laptop side to receive and display the data?
<<

Exactly the same as on the device. Open the virtual serial port and proceed
as though you had a physical connection.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.


 
Reply With Quote
 
Peter Morris
Guest
Posts: n/a
 
      23rd Mar 2007
Franson bluetools are nice components + lots of examples too.


 
Reply With Quote
 
Ben G
Guest
Posts: n/a
 
      23rd Mar 2007
Thanks for your help Dick, I wrote a small application as you suggested
and am now now able to receive data strings sent from the Pocket PC to
the laptop.

I got the right input port on the laptop by trial and error, the Pocket
PC lists them under Bluetooth Settings > Services > Serial Port >
Advanced and the Inbound & Outbound COM Ports can be viewed/modified
there. For future reference is there a similar configuration page
somewhere in Windows XP that shows this information or is it dependant
on the driver used, I'm using Version v4.00.36 of the Bluetooth Stack
for Windows by Toshiba on a Portege M200.

Also, is there a way of knowing if this will be supported by the
Bluetooth serial module device that is being targeted, anything I should
look for in the spec? Although good to get it working with the laptop
I'm still not sure if the virtual COM port approach will work for the
Bluetooth serial module or whether I'll need to do something at a higher
level such as set up a service.

Thanks again,
Ben.

Dick Grier wrote:
> Hi,
>
> Is it really as simple as doing something like the above?
> <<
>
> Yes, in general. I use a BT for similar virtual serial connections.
>
> What I’m unsure of however is what is required
> on the laptop side to receive and display the data?
> <<
>
> Exactly the same as on the device. Open the virtual serial port and proceed
> as though you had a physical connection.
>
> Dick
>

 
Reply With Quote
 
Ben G
Guest
Posts: n/a
 
      23rd Mar 2007
Thanks Peter,

I'm going to persevere with the Virtual COM port for a while yet but I
see there is an evaluation version of the Franson tools I'll try if that
doesn't work out.

Ben.

Peter Morris wrote:
> Franson bluetools are nice components + lots of examples too.
>
>

 
Reply With Quote
 
Dick Grier
Guest
Posts: n/a
 
      23rd Mar 2007
Franson has a 14-day eval of all of their products. If you decide to
purchase a license, contact me. I can get it for you with a 25% discount.

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.


 
Reply With Quote
 
Dick Grier
Guest
Posts: n/a
 
      23rd Mar 2007
Hi,

>>

Also, is there a way of knowing if this will be supported by the
Bluetooth serial module device that is being targeted, anything I should
look for in the spec? Although good to get it working with the laptop
I'm still not sure if the virtual COM port approach will work for the
Bluetooth serial module or whether I'll need to do something at a higher
level such as set up a service.
<<

Bluetooth serial devices will work (at least, they should!). Naturally,
there at BT devices that won't (keyboards, mouse, sound devices, network
devices, etc.). I don't think a service would help. The device driver has
to furnish a Virtual Comport. If it does, fine. If it doesn't, then you
have to use some non-serial APIs that are appropriate to that device type.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Virtual Bluetooth printer port =?Utf-8?B?U2lnZ3k=?= Windows XP General 1 25th Feb 2005 09:58 PM
Bluetooth comms using virtual com port =?Utf-8?B?U3RldmUgU3BlbmNlcg==?= Microsoft Dot NET Framework 1 24th Nov 2004 06:32 PM
Working with a bluetooth virtual com port Steve Custer Microsoft Dot NET Compact Framework 1 3rd Nov 2004 03:19 PM
Create virtual port serie and map bluetooth device to this port Jérôme MATHIEU Windows XP Drivers 0 11th Oct 2004 11:13 AM
bluetooth virtual com port Yan Windows XP Hardware 1 3rd Jan 2004 09:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:48 PM.