Logging

Mbientlab boards are equipped with flash memory that can store data if there is no connection with an Android device. While the RouteComponent directs data to the logger, the ILogging interface provides the functions for controlling and configuring the logger.

using MbientLab.MetaWear.Core;

ILogging logging = metawear.GetModule<ILogging>();

Start the Logger

To start logging, call the Start method. If you wish to overwrite existing entries, pass true to the method. When you are done logging, call Stop.

// start logging, if log is full, no new data will be added
logging.Start(false);

// start logging, if log is full, overrite existing data
logging.Start(overwrite: true);

// stop the logger
logging.Stop();

Downloading Data

When you are ready to retrieve the data, call DownloadAsync. There are variants of downloadAsync that provide progress updates and error handing during the download.

// download log data and send 100 progress updates during the download
await logging.DownloadAsync(100, (nEntries, totalEntries) =>
    Console.WriteLine("Progress Update = " + nEntriesLeft + "/" + totalEntries)
);
Console.WriteLine("Download completed");