clearLog() seems to be not working

edited March 2018 in Android

Dear mbientLab team,

I use Android SDK 3.4.0 and fw 1.3.7.

i want the log to be cleared the first time I connect to a MetaWear R. To do so I call this method:

private void clearLog() {

    if(logging != null) {
        logging.clearEntries();

        board.disconnectAsync().onSuccess(task -> {
            Log.i(getId(), "Log cleared!");
            loggingCleared = true;
            setState(SensorState.DISCONNECTED);
            return null;
        });
    }
    else {
        Log.w(getId(), "Try to call clearLog on null Logging module!");
    }
}

in this fashion:

board.connectAsync()
.onSuccess(task -> {
if(! loggingCleared) {
clearLog();
return Task.cancelled();
}
else {
return task;
}
})

However, the log is not empty when I start downloading.

Comments

  • Add a delay after calling clearEntries. Looking at the Logging interface again, that function should be an asynchronous task.

    You also don't need to disconnect anymore.

  • @Eric how long should that delay be approximately? 1 second? 5 seconds?

    There's no way to check the size of the log entries without downloading the data, right? I can open a separate
    thread, but I'm running into issues where I start the logger, stop it after ~90 seconds, then configure routes to stream logged data. Various outcomes of the download include:

    1. download doesn't find any entries in the log
    2. download receives exactly 1 entry out of 1 entry
    3. data is downloaded but contains a few seconds of data (~12) instead of the full ~90 seconds I requested
    4. data is logged, but only shows data for accelerometer and gyroscope streams (set to 400 hz), not for battery life (which uses a timer task triggering every 30 seconds)
  • @wko27

    5 seconds should suffice.
    Do not hijack threads; post your issues in a separate thread along with your code and steps to reproduce.

This discussion has been closed.