B
Ben G
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.
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.