PC Review


Reply
Thread Tools Rate Thread

Bluetooth IOException

 
 
Malc
Guest
Posts: n/a
 
      18th Aug 2004
Hi, when I try and open the Bluetooth serial port using Compact Framework
2.0's System.IO.Ports library I get an IOException, however the same code
works fine with the regular serial port. Anyone know a solution?


outPort = new SerialPort("COM8:", 4800, Parity.None, 8,StopBits.One);
outPort.Handshake = Handshake.None;
outPort.Encoding = Encoding.ASCII;

outPort.ReceivedBytesThreshold = 7;
outPort.ReadBufferSize = 7;
outPort.WriteBufferSize = 8;

outPort.ReceivedEvent+=new
SerialReceivedEventHandler(outPort_ReceivedEvent);
try
{
outPort.Open();
}
catch (Exception e) { Console.WriteLine(e.Message);}

This occurs on a iPAQ 5550 and 4150, and the exception occurs after the
Bluetooth browser pops up and I choose the device providing the serial
service. Note it works fine when I do the same thing using
OpenNetCF.IO.Serial. The reason for trying CF 2.0 is OpenNetCF serial
stutters on Bluetooth connections. I mean sometimes it just pauses and no
data received events are thrown for a while. Then when it continues the
data has been buffered and the application lags behind with old data. The
solution was to increase the priority of OpenNetCF's internal data
received thread, but if someone knows how to get past the IOException
under CF 2.0 that would be great.


--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

 
Reply With Quote
 
 
 
 
PeterB
Guest
Posts: n/a
 
      18th Aug 2004
Which version of the OpenNETCF.org Serial API are you using? I had some
problems with data-clogging with the earlier versions (retrieving data from
a BT GPS), but the new version works great (should mention I have removed
some of the, for me, unneccessary parts of the API).

There have been some significant improvements during the last months of that
API, and a performance study made indicated that OpenNETCF's API was faster
than a commercial Serial API in most cases.

/ Peter


"Malc" <(E-Mail Removed)> skrev i meddelandet
news(E-Mail Removed)...
> Hi, when I try and open the Bluetooth serial port using Compact Framework
> 2.0's System.IO.Ports library I get an IOException, however the same code
> works fine with the regular serial port. Anyone know a solution?
>
>
> outPort = new SerialPort("COM8:", 4800, Parity.None, 8,StopBits.One);
> outPort.Handshake = Handshake.None;
> outPort.Encoding = Encoding.ASCII;
>
> outPort.ReceivedBytesThreshold = 7;
> outPort.ReadBufferSize = 7;
> outPort.WriteBufferSize = 8;
>
> outPort.ReceivedEvent+=new
> SerialReceivedEventHandler(outPort_ReceivedEvent);
> try
> {
> outPort.Open();
> }
> catch (Exception e) { Console.WriteLine(e.Message);}
>
> This occurs on a iPAQ 5550 and 4150, and the exception occurs after the
> Bluetooth browser pops up and I choose the device providing the serial
> service. Note it works fine when I do the same thing using
> OpenNetCF.IO.Serial. The reason for trying CF 2.0 is OpenNetCF serial
> stutters on Bluetooth connections. I mean sometimes it just pauses and no
> data received events are thrown for a while. Then when it continues the
> data has been buffered and the application lags behind with old data. The
> solution was to increase the priority of OpenNetCF's internal data
> received thread, but if someone knows how to get past the IOException
> under CF 2.0 that would be great.
>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
>



 
Reply With Quote
 
Peter Foot [MVP]
Guest
Posts: n/a
 
      18th Aug 2004
Does the IOException contain a description or error number which can be used
to narrow down the cause?

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/...ity/newsgroups

"Malc" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> Hi, when I try and open the Bluetooth serial port using Compact Framework
> 2.0's System.IO.Ports library I get an IOException, however the same code
> works fine with the regular serial port. Anyone know a solution?
>
>
> outPort = new SerialPort("COM8:", 4800, Parity.None, 8,StopBits.One);
> outPort.Handshake = Handshake.None;
> outPort.Encoding = Encoding.ASCII;
>
> outPort.ReceivedBytesThreshold = 7;
> outPort.ReadBufferSize = 7;
> outPort.WriteBufferSize = 8;
>
> outPort.ReceivedEvent+=new
> SerialReceivedEventHandler(outPort_ReceivedEvent);
> try
> {
> outPort.Open();
> }
> catch (Exception e) { Console.WriteLine(e.Message);}
>
> This occurs on a iPAQ 5550 and 4150, and the exception occurs after the
> Bluetooth browser pops up and I choose the device providing the serial
> service. Note it works fine when I do the same thing using
> OpenNetCF.IO.Serial. The reason for trying CF 2.0 is OpenNetCF serial
> stutters on Bluetooth connections. I mean sometimes it just pauses and no
> data received events are thrown for a while. Then when it continues the
> data has been buffered and the application lags behind with old data. The
> solution was to increase the priority of OpenNetCF's internal data
> received thread, but if someone knows how to get past the IOException
> under CF 2.0 that would be great.
>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
>



 
Reply With Quote
 
Malc
Guest
Posts: n/a
 
      18th Aug 2004
Thanks for the respose.

I was using the version from the source browser on 12th of August. I'll
take a look closer at the source and see if I can see anything that might
cause the clogging. Also if you could perhaphs mail me your version so I
could compare them that would be excellent.


On Wed, 18 Aug 2004 11:08:11 +0200, PeterB <(E-Mail Removed)> wrote:

> Which version of the OpenNETCF.org Serial API are you using? I had some
> problems with data-clogging with the earlier versions (retrieving data
> from
> a BT GPS), but the new version works great (should mention I have removed
> some of the, for me, unneccessary parts of the API).
>
> There have been some significant improvements during the last months of
> that
> API, and a performance study made indicated that OpenNETCF's API was
> faster
> than a commercial Serial API in most cases.
>
> / Peter
>
>
> "Malc" <(E-Mail Removed)> skrev i meddelandet
> news(E-Mail Removed)...
>> Hi, when I try and open the Bluetooth serial port using Compact
>> Framework
>> 2.0's System.IO.Ports library I get an IOException, however the same
>> code
>> works fine with the regular serial port. Anyone know a solution?
>>
>>
>> outPort = new SerialPort("COM8:", 4800, Parity.None, 8,StopBits.One);
>> outPort.Handshake = Handshake.None;
>> outPort.Encoding = Encoding.ASCII;
>>
>> outPort.ReceivedBytesThreshold = 7;
>> outPort.ReadBufferSize = 7;
>> outPort.WriteBufferSize = 8;
>>
>> outPort.ReceivedEvent+=new
>> SerialReceivedEventHandler(outPort_ReceivedEvent);
>> try
>> {
>> outPort.Open();
>> }
>> catch (Exception e) { Console.WriteLine(e.Message);}
>>
>> This occurs on a iPAQ 5550 and 4150, and the exception occurs after the
>> Bluetooth browser pops up and I choose the device providing the serial
>> service. Note it works fine when I do the same thing using
>> OpenNetCF.IO.Serial. The reason for trying CF 2.0 is OpenNetCF serial
>> stutters on Bluetooth connections. I mean sometimes it just pauses and
>> no
>> data received events are thrown for a while. Then when it continues the
>> data has been buffered and the application lags behind with old data.
>> The
>> solution was to increase the priority of OpenNetCF's internal data
>> received thread, but if someone knows how to get past the IOException
>> under CF 2.0 that would be great.
>>
>>
>> --
>> Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
>>

>
>




--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

 
Reply With Quote
 
PeterB
Guest
Posts: n/a
 
      18th Aug 2004
What's the data transmission speed you are trying to achieve?

The things I changed, which was also changed in the newer versions of
OpenNETCF's Serial API, was:

1. The data read into the buffer (CommAPI.ReadFile(...) ) in the port object
was increased to a variable amount from the static1 byte at a time. The
newer serial API (which you have if you downloaded it 12th of August) should
have this.

2. Removed Line Status Checking since I didn't use that and it included a
bunch of if-statements in the performance critical thread loop.

I am not sure 2. helped that much, the major bottleneck was 1.

Have a look at the code section mentioned in 1. and see if there is anything
you can do there. I would also recommend trying different ReceiveBuffer
sizes. 7 sounds a bit small to me.. have you tried catching any overflow
exceptions etc?

I could send you my code, the problem is I use a hybrid of the old version
of OpenNETCF's API and the new one.... (one day I'll clean up my mess ).
For instance, I am not using the FIFO-structures but instead the old byte[]
buffer for caching my received data. Let me know if you want the hack anyway
;-)

Anyway, I am receiving data from a BT GPS, and the transmission speed isn't
that fast so I don't have any experience with super fast BT connections...

regards,

Peter



"Malc" <(E-Mail Removed)> skrev i meddelandet
news(E-Mail Removed)...
> Thanks for the respose.
>
> I was using the version from the source browser on 12th of August. I'll
> take a look closer at the source and see if I can see anything that might
> cause the clogging. Also if you could perhaphs mail me your version so I
> could compare them that would be excellent.
>
>
> On Wed, 18 Aug 2004 11:08:11 +0200, PeterB <(E-Mail Removed)> wrote:
>
> > Which version of the OpenNETCF.org Serial API are you using? I had some
> > problems with data-clogging with the earlier versions (retrieving data
> > from
> > a BT GPS), but the new version works great (should mention I have

removed
> > some of the, for me, unneccessary parts of the API).
> >
> > There have been some significant improvements during the last months of
> > that
> > API, and a performance study made indicated that OpenNETCF's API was
> > faster
> > than a commercial Serial API in most cases.
> >
> > / Peter
> >
> >
> > "Malc" <(E-Mail Removed)> skrev i meddelandet
> > news(E-Mail Removed)...
> >> Hi, when I try and open the Bluetooth serial port using Compact
> >> Framework
> >> 2.0's System.IO.Ports library I get an IOException, however the same
> >> code
> >> works fine with the regular serial port. Anyone know a solution?
> >>
> >>
> >> outPort = new SerialPort("COM8:", 4800, Parity.None, 8,StopBits.One);
> >> outPort.Handshake = Handshake.None;
> >> outPort.Encoding = Encoding.ASCII;
> >>
> >> outPort.ReceivedBytesThreshold = 7;
> >> outPort.ReadBufferSize = 7;
> >> outPort.WriteBufferSize = 8;
> >>
> >> outPort.ReceivedEvent+=new
> >> SerialReceivedEventHandler(outPort_ReceivedEvent);
> >> try
> >> {
> >> outPort.Open();
> >> }
> >> catch (Exception e) { Console.WriteLine(e.Message);}
> >>
> >> This occurs on a iPAQ 5550 and 4150, and the exception occurs after the
> >> Bluetooth browser pops up and I choose the device providing the serial
> >> service. Note it works fine when I do the same thing using
> >> OpenNetCF.IO.Serial. The reason for trying CF 2.0 is OpenNetCF serial
> >> stutters on Bluetooth connections. I mean sometimes it just pauses and
> >> no
> >> data received events are thrown for a while. Then when it continues the
> >> data has been buffered and the application lags behind with old data.
> >> The
> >> solution was to increase the priority of OpenNetCF's internal data
> >> received thread, but if someone knows how to get past the IOException
> >> under CF 2.0 that would be great.


>



 
Reply With Quote
 
New Member
Join Date: Oct 2006
Posts: 1
 
      5th Oct 2006
The same problem here.. I've tried this code on a hp ipaq hx4705 and it worked fine.
When i tried in a hp ipaq h5500 it is thrown an IOException
Just Don't know what is the problem...
this.Port = new SerialPort("COM8",4800);
this.Port.Handshake = Handshake.None;
this.Port.Parity = Parity.None;
this.Port.StopBits = StopBits.One;
this.Port.DataReceived += new SerialDataReceivedEventHandler(Port_DataReceived);
while (!OK)
{
try
{
this.OK = false;
this.Port.Open();
this.OK = true;
}
catch (Exception ex){}
}


PLEASE HELP!!!!!!!!!!!!!!!!!!
 
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
unhandled IOException Hegde G G Windows Vista Security 2 23rd Jun 2007 04:18 PM
IOException - No message Jon Brunson Microsoft Dot NET Compact Framework 6 18th Apr 2006 11:07 AM
IOException!!!!!! =?Utf-8?B?VGhheW5hbm4=?= Microsoft Dot NET 7 19th May 2005 07:20 AM
IOException =?Utf-8?B?U2l2YXJhag==?= Microsoft Dot NET Framework 1 25th Mar 2004 04:02 PM
System.IO.IOException Krissy Microsoft ASP .NET 2 31st Jul 2003 03:57 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:33 AM.