clearLog() seems to be not working
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.
This discussion has been closed.
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:
@wko27
5 seconds should suffice.
Do not hijack threads; post your issues in a separate thread along with your code and steps to reproduce.