.NET Components for Mobility

Exceptions in serial communication via Bluetooth

Last post 11-27-2007 3:57 AM by Achim Oetringhaus. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-19-2007 7:18 AM

    Exceptions in serial communication via Bluetooth

    Hello, I am using 32feet.NET, .NET Compact 2.0 (SP1), Windows Mobile 5.0. I am writing a PDA-based control application for a measuring device. The PDA has built-in Bluetooth (Microsoft stack), the device has a RS232 port with a Bluetooth dongle. RS232 settings are 9.600 baud, 8N1, no handshake (device does not support any). Data throughput is low, less than 100 bytes per second.

    Protocol manner: The PDA periodically inquires various settings from the device. Occasionally, a setting is changed.

    32feet.NET is used to create a BluetoothSerialPort which is opened and used through the System.IO.Ports.SerialPort class.

    The application runs fine for a couple of minutes, sometimes even for an hour, but suddenly the PDA stops transmitting and a System.IO.IOException is thrown from the System library. Exactly spoken:

            System.IO.Ports.SerialStream.Write(byte[] array, int offset, int count, int timeout)

    calls

            WinIOError ()

     after failure of WriteFileNative(). I see this from the call stack when the exception is thrown but I cannot determine what leads to this condition.

    When I use a wired RS232 connection instead of Bluetooth, everything is stable.

    Does anyone have a hint for me what might be the problem or where I should look for it?

    Any more information needed? Then ask.

     Thanks for your help

     Achim Oetringhaus

     

  • 09-22-2007 10:43 AM In reply to

    Re: Exceptions in serial communication via Bluetooth

    I guess something goes wrong with the low level Bluetooth connection, but its hard to tell.  Maybe you could try creating a sockets connection to the serial-port server (use BluetoothClient and connect to SerialPort) rather than use the virtual serial port.  Hopefully the error from it would be more useful than 'IO error', maybe including a useful Winsock error code.  Might we worth trying a simple test program anyway...

    Alan J. McFarlane
    http://www.alanjmcf.me.uk/
    Please follow-up in the newsgroup for the benefit of all.
    Have I helped? Consider visiting my Amazon wishlist, see my homepage.
  • 10-01-2007 2:56 AM In reply to

    Re: Exceptions in serial communication via Bluetooth

    Hello Alan, thank you for your answer and sorry for my late reply - I had some days off. I am going to try what you pointed out and then report here. Regards Achim Oetringhaus
  • 11-27-2007 3:57 AM In reply to

    Re: Exceptions in serial communication via Bluetooth

    Hello, I have some new facts to discuss:

    1. I have installed a virtual serial port on the Bluetooth settings of the operating system and have used this instead of the 32feet BluetoothSerialPort. Same problems, full communication crash after a couple of minutes. So, I don't believe it's a problem with the 32feet library.

    2. I have received another PDA which uses the Widcomm stack instead of Microsoft. I turned directly to a virtual port on the operating system, and its running fine!

    First conclusion: There might be a problem when WM5, Microsoft Bluetooth and .NET CF 2.0 are working together. With Widcomm Bluetooth, the toolchain works better.

    Has anybody else seen a similar thing?

    Regards,
    Achim
Page 1 of 1 (4 items)
Copyright © 2001-2008 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.