Logging download speed
Hi,
I'm using the Logging module to store accelerometer's data, until the user decides to download them. I'm using multiple MetaWears R, and I start the downloadAsync
method on both metawears, in two different threads (so both downloads are done "at the same time"). Upon receiving data from each download, I save the accelerometers data received in a dedicated csv file depending on the metawear (which shouldn't slow the communication much.)
After testing it a few times, it seems my downloads take longer on my app, than if I download the logs with the MetaBase app. (up to being two times slower than when using the metabase app, which ends up being really too long when logging for long periods of time.)
I didn't find anything related to download speed within the SDK documentation, so I'm assuming it's not tweakable... Would you have any idea about how to speed up the download speed to match the MetaBase app's performances ? Here's my code for the download :
Logging logging = board.getModule(Logging.class);
Accelerometer accelerometer = board.getModule(Accelerometer.class);
accelerometer.stop();
accelerometer.acceleration().stop();
logging.stop();
// Open a csv file for this MetaWearBoard, in which data will be written
logging.downloadAsync(100, new Logging.LogDownloadUpdateHandler() {
@Override
public void receivedUpdate(long nEntriesLeft, long totalEntries) {
// Can build an update percentage
}
}, new Logging.LogDownloadErrorHandler() {
@Override
public void receivedError(Logging.DownloadError errorType, byte logId, Calendar timestamp, byte[] data) {
// Forward error if necessary
}
}).continueWith(new Continuation<Void, Task<Void>>() {
@Override
public Task<Void> then(Task<Void> download) throws Exception {
//Close the csv file
if (download.isFaulted() || download.isCancelled()) {
// Error during the downloadAsync request, forward error
} else {
// Download completed, clear the metawear and forward success
logging.clearEntries();
board.tearDown();
}
return null;
}
});
Comments
Read the 2nd paragraph of this section:
https://mbientlab.com/androiddocs/latest/advanced_features.html#high-frequency-streaming
Thank you for the link. I did ignore this section since I thought it was only about High-Frequency streaming, which I'm not using, so my bad ! I will test it out !