Autoconnect

edited November 2016 in C#
Hi, 

I am using Windows 10 and I am writing a code to receive realtime data from the metawear (Meta Motion R – 10 Axis IMU + Sensor Fusion)
 through BLE to  UDP port communication.
The software is going to run on a computer without human supervision, so I need it to be able to automatically reconnect the metawear in case it disconnects.

Based on my experience Windows 10 has only 2 different states for BLE connection: one is "pair" and second is "connect". Even if it knows it is paired, it won't automatically connect by itself. 
Am i correct? Please, prove me wrong ;.)

Thanks a lot!

LB

Comments

  • Win10 attempts to maintain an active connection if there is activity on the Bluetooth LE radio.
  • Hi Eric,

    Thanks for the prompt reply.
    Do you mean that:

    1) Windows will do its best not to disconnect with the device in the first place

    Or

    2) if the device disconnects, but then is available again, windows will be able to reconnect automatically by itself?

    Thanks!
  • Both are true
  • Hi Eric, 

    thanks for the clarification.
    In my experience though if the battery dies out, or if it is unplugged, Windows will not auto reconnect to the device when battery is back in place.
    This is the exact case I was referring about: it's here that I need my code to act and force a reconnection with the Metawear. And this issue has not found any solution, yet. As far as I know.

    Is there any solution I could implement that I am actually missing?



  • edited December 2016
    What code are you using to test this?
  • Hi Eric, 

    thanks for your reply.
    You are really building a sense of community here! ;-)


    What i see is that if the device disconnects it will not reconnect by itself. All the time...
  • What i mean is what is the code that is checking the device disconnected and what code is checking that the connection has been restored (or not).
  • Hi Eric, 

    thanks for the support.
    Further testing seems to indicate that the problem apparently resides on the USB driver, since an error I'm receiving is actually "DRIVER ERROR".
    I ordered a most compatible BT4 USB dongle available, will try again with the new one.

    Will keep you posted if this fix.

    Thanks again!

    Luca
  • Eric,

    while collecting gyro data streaming why sensor get disconnect even battery is full.
    Is there any command or code to check the device is disconnected or connected or restored in Win 10?

    I am doing following steps; let me know if need to refactor it
    1- Record command event to stop gyro streaming and stop led
    2- configure gyro streaming at 100Hz and start gyro
    3- start blinking led
    4- While receiving gyro data saving last time stamp
    5- Also I have created a Timer which is periodically invoking after 10Sec and just comparing the last time stamp with current time. if difference found more than 5-10 sec, I consider the sensor is disconnected and also found led is off.
    - It may disconnected due to battery drain or any other reason. In case of battery I recharge it.
    - Mean while keep trying to reconnect/initialize again and repeat steps 1-2-3. 
This discussion has been closed.