Getting Logs from the Metawear C v3.0

After updating the API to v3.0, it's become unclear how to get download the data from the device to the phone. Clearly I need to use the logging.downloadAsync() function, but I'm confused on how to use the Bolts Framework to get the result. I tried using .continueWith(), .continueWithTask() and .onSuccess() and .onSuccessTask(). The first two were called after the logs were downloaded but the task (of type Task<Void>) has no result. I tried using the .cast() method, but was unable to get a result.

Any help would be appreciated. Thanks!


  • I also discovered that task.isFaulted() returns true, meaning it was unsuccessful.
  • I get this every time: java.lang.RuntimeException: Lost connection while downloading log data
    06-29 22:40:53.260 12360-12373/ W/System.err:     at com.mbientlab.metawear.impl.LoggingImpl.disconnected(
    06-29 22:40:53.260 12360-12373/ W/System.err:     at com.mbientlab.metawear.impl.JseMetaWearBoard$3.onDisconnect(
    06-29 22:40:53.261 12360-12373/ W/System.err:     at com.mbientlab.metawear.impl.JseMetaWearBoard$3.onUnexpectedDisconnect(
    06-29 22:40:53.262 12360-12373/ W/System.err:     at$2.onConnectionStateChange(
    06-29 22:40:53.262 12360-12373/ W/System.err:     at android.bluetooth.BluetoothGatt$1.onClientConnectionState(
    06-29 22:40:53.262 12360-12373/ W/System.err:     at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(
    06-29 22:40:53.262 12360-12373/ W/System.err:     at android.os.Binder.execTransact(

    Is this an issue with the board or possibly something I'm doing wrong?
  • edited June 2017
    The stack trace says you are losing bluetooth connection during the download.  Make sure your board has adequate power and is close to your Android device while downloading.

    Was logging working fine before switching the API?
  • I never got it working with any of the boards I have (I have about 10 of them). So that is a bit strange and seems to me that either I'm doing something wrong or there is an issue with my phone then.
  • Is the subscriber intended to be called when downloading logs or do I have to access the data with the onSuccess() method?
  • What I mean is the subscriber for logging accelerometer data. It seems to be, but it is only ever called 4 times. Which is an improvement over exceptions, but I'm not sure why I'm unable to get any more data than that.
  • Update: It worked all the sudden. I'm a little worried though that it will be robust enough, seeing as it took this long and I didn't make any changes to my code.
  • Also, sorry for all the questions/comments, but is there anyway to know when logging is complete?
  • It's possible the addRouteAsync was failing so no loggers were actually created; you should always have error handling in your Continuations.

    What do you mean by "when logging is complete"?
This discussion has been closed.