Author Topic: enabling auto re-connection between MS Windows PC and Instrument w Windows CE  (Read 3305 times)

Offline johnmbailey

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
I have been struggling with a project that has been hindered by bluetooth stack compatibility and other issues for quite some time, and I believe that the WCL might be my answer.  I am working a .NET project where I use BT SPP to connect a MS Windows Tablet to an instrument that runs Windows CE.  I am hoping to automate connection / re-connection, as the device sometimes goes out of range and must be re-paired.  Since I use the BT Serial connection to transmit data from the instrument to the tablet as data is being collected, if the connection is lost (temporarily out of range), I need to know so that I can obtain the missed data when the connection is re-established.  When the connection is re-established, I can either repeat the test by the instrument or ideally the data would be held in que if the connection is lost and then sent once it was re-established.

My questions are:
1. What should I verify in the manufacturers existing BT functionality to see what other options might be available to interface with my Tablet using the WCL?
2. Since I have no control of the Windows CE instrument code, and can only 'Ask' the manufacturer to make any changes, how much control can I obtain with the WCL to enable the auto-reconnection?
3. What would you suggest as the best approaches to obtaining a reliable connection with auto re-connection etc if I cannot obtain changes by the instrument manufacturer?
4. What would you suggest as the best approaches to obtaining a reliable connection with auto re-connection etc if the manufacturer can make minor changes to code on their instrument?  What should I verify in their existing functionality?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3053
  • Karma: 1000
    • Soft Service Company
Hello,

All looks simple.

Usualy you do not need to repair with a device after it is disconnected as once paired a device stays paired. However, some devices require to repairing. Any way it is easy to do with WCL. WCL supports 2 pairing methods: manual and automatic.

With manual pairing you have to call Pair method to pair with a device (wclBluetoothDevice.Pair). Take a look on the BluetoothDiscovery demo application to find out how to use manual pairing.

With automatic pairing you use wclAuthenticator and when a device requires pairing wclAuthenticator fires an event.

Actualy iy does not matter how your application pairs with device. You use wclClient (take a look on the BluetoothConnection demo application) to connect to your device. Once connected you can exchange data with it. After device disconnects OnDisconnect event fires (after disconnected device does not send any data so I guess it simple skeeps the data or store it in internal memory, do not know how manufacturer implemented that). As soon as OnDisconnect fires you can try to reconnect to your device. Or you ca start monitoring (BluetoothDiscovery demo shows how to monitor for Bluetooth devices) for your device. As it appears back you can connect to it again.

So all is simple.

Offline johnmbailey

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
That sounds like this will resolve the connection / re-connection challenges.  Is there a procedure or method of detecting when a connection is lost, so something can be done to restore the connection before significant transfer data is missed or so the instrument operator can be told to retake the shot after the connection is restored?  Basically the instrument sends test data about every 2 minutes or so, and the data consists of a string of 512 characters or less, so I need some way of knowing the status of the BT port connection.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3053
  • Karma: 1000
    • Soft Service Company
As I wrote when connection lost OnDisconnect event fires. As it fired you can try to reconnect. In any way, when connection lost you can not receive any data util reconnect
« Last Edit: March 27, 2013, 05:47:32 AM by Mike Petrichenko »

 

Sitemap 1 2 3 4 5 6 7 8 9