Metawear c# gyro stream stops after a while on windows UWP

I have a simple windows application based from

The gyro stream works fine if the only thing you do is writeline.   

The gryo stops streaming if I try to do anything useful such as...
  • write a file
  • write to a queue
  • write to a collection
  • write to blockingcollections
  • send over a socket
  • start a thread to do some work
In any of the cases above, the stream runs for about 8 minutes or so then stops.   The stream cannot be started back up either.  We have to disconnect, and sometimes even re-pair to the board to get anything useful.  

Any ideas here?   We need to save the data to a file or send it over a socket, graph it etc.   


  • What do you mean when you say it stops streaming?  Does the valueChanged event handler stop being called?  Or, it does but the subscribe delegate no longer get fired?

    Does this problem persist if you try using the UWP template instead of the tutorial solution?
  • Thank you for the reply.  The handler stops being called.   The behavior happens on the Uwp starter app as well.  Strangely enough, the board will still respond and I can blink the light on and off after the gyro stream stops.  But if I try to start the stream again, it never starts.  I have to restart the windows program again.  Sometimes it stops after a few seconds.  Sometimes it goes for several minuaes.
  • Hrm...what could be happening is that the notify characteristic is being killed since the code does not save a reference to it.  I modified the uwp starter app to save a reference to the notify characteristic.  Let me know if this change fixes your issue.

  • Thank You Eric.  As far as I can tell, the changes you have made fixed the issue.
  • same issue, after few seconds gyro stops and start getting exception on notifyhandler. Where to fix this?

  • edited June 2016
    • What exception type is being thrown?
      • What is the exception message?
      • What is the gatt characteristic value?
    • What build of windows are you using?
    • What are the steps to reproduce this error?
    • Does this error occur on other devices?
  • At last I was able to fix issue, As per your advise I kept reference alive of handler which is passed to the method  mbl_mw_datasignal_subscribe(state_signal, rot_handler);
    No more exception occurs and getting gyro data smoothly.
This discussion has been closed.