MetaWear C++ API  0.20.0
C++ implementation of the MetaWear protocol
Classes | Functions
logging.h File Reference

Controls the onboard logging system. More...

#include <stdint.h>
#include "data.h"
#include "datasignal_fwd.h"
#include "logging_fwd.h"
#include "metawearboard_fwd.h"
#include "metawear/platform/dllmarker.h"

Go to the source code of this file.

Classes

struct  MblMwLogDownloadHandler
 Callback functions for handling notifications from the logger. More...
 
struct  MblMwRawLogDownloadHandler
 Callback functions for handling notifications from the logger. More...
 

Functions

METAWEAR_API void mbl_mw_logging_start (const MblMwMetaWearBoard *board, uint8_t overwrite)
 Starts data logging. More...
 
METAWEAR_API void mbl_mw_logging_stop (const MblMwMetaWearBoard *board)
 Stops data logging. More...
 
METAWEAR_API void mbl_mw_logging_flush_page (const MblMwMetaWearBoard *board)
 Flushes logging data (pending writes) to the MMS memory Should be called for the MMS when done with logging and ready to download data For MMS only. More...
 
METAWEAR_API void mbl_mw_logging_clear_entries (const MblMwMetaWearBoard *board)
 Clear the logger of saved entries. More...
 
METAWEAR_API void mbl_mw_logging_download (MblMwMetaWearBoard *board, uint8_t n_notifies, const MblMwLogDownloadHandler *handler)
 Downloads the log data. More...
 
METAWEAR_API uint8_t mbl_mw_logger_get_id (const MblMwDataLogger *logger)
 Retrieves the id value identifying the logger. More...
 
METAWEAR_API MblMwDataSignalmbl_mw_logger_get_signal (const MblMwDataLogger *logger)
 Retrieves the data signal the logger is recording data for. More...
 
METAWEAR_API MblMwDataLoggermbl_mw_logger_lookup_id (const MblMwMetaWearBoard *board, uint8_t id)
 Looks up the MblMwDataLogger object corresponding to the id. More...
 
METAWEAR_API void mbl_mw_logger_remove (MblMwDataLogger *logger)
 Removes the logger from the board. More...
 
METAWEAR_API void mbl_mw_logger_subscribe (MblMwDataLogger *logger, void *context, MblMwFnData received_data)
 Subscribes to responses from the data logger. More...
 
METAWEAR_API const char * mbl_mw_logger_generate_identifier (const MblMwDataLogger *logger)
 Generates a string identifying the data chain the logger is receiving data from. More...
 
METAWEAR_API MblMwDataSignalmbl_mw_logging_get_length_data_signal (const MblMwMetaWearBoard *board)
 Retrieves a data signal representing the length of the log, including timestamps. More...
 
METAWEAR_API MblMwDataSignalmbl_mw_logging_get_time_data_signal (const MblMwMetaWearBoard *board)
 Retrieves a data signal representing the current logger time state. More...
 
METAWEAR_API uint8_t mbl_mw_logging_get_latest_reset_uid (const MblMwMetaWearBoard *board)
 Get the latest reset_uid read duing connection. More...
 
METAWEAR_API int64_t mbl_mw_logging_get_reference_time (const MblMwMetaWearBoard *board, uint8_t reset_uid)
 Get the device boot time for a given reset_uid. More...
 
METAWEAR_API void mbl_mw_logging_set_reference_time (const MblMwMetaWearBoard *board, uint8_t reset_uid, int64_t reference_epoch)
 Set the device boot time for a given reset_uid. More...
 
METAWEAR_API void mbl_mw_logging_raw_download (MblMwMetaWearBoard *board, uint8_t n_notifies, const MblMwRawLogDownloadHandler *handler)
 Downloads the raw log data. More...
 

Detailed Description

Controls the onboard logging system.

Function Documentation

◆ mbl_mw_logger_generate_identifier()

METAWEAR_API const char* mbl_mw_logger_generate_identifier ( const MblMwDataLogger logger)

Generates a string identifying the data chain the logger is receiving data from.

This string is matched with the output of mbl_mw_anonymous_datasignal_get_identifier. The memory allocated by the function must be freed by calling mbl_mw_memory_free.

Parameters
loggerCalling object

◆ mbl_mw_logger_get_id()

METAWEAR_API uint8_t mbl_mw_logger_get_id ( const MblMwDataLogger logger)

Retrieves the id value identifying the logger.

Parameters
loggerLogger to lookup
Returns
Numerical id of the logger

◆ mbl_mw_logger_get_signal()

METAWEAR_API MblMwDataSignal* mbl_mw_logger_get_signal ( const MblMwDataLogger logger)

Retrieves the data signal the logger is recording data for.

Parameters
loggerLogger to lookup
Returns
Pointer to owning MblMwDataSignal object

◆ mbl_mw_logger_lookup_id()

METAWEAR_API MblMwDataLogger* mbl_mw_logger_lookup_id ( const MblMwMetaWearBoard board,
uint8_t  id 
)

Looks up the MblMwDataLogger object corresponding to the id.

Parameters
boardBoard to search on
idNumerical id to lookup
Returns
Logger object identified by the id, null if no object is found

◆ mbl_mw_logger_remove()

METAWEAR_API void mbl_mw_logger_remove ( MblMwDataLogger logger)

Removes the logger from the board.

Parameters
loggerlogger to remove

◆ mbl_mw_logger_subscribe()

METAWEAR_API void mbl_mw_logger_subscribe ( MblMwDataLogger logger,
void *  context,
MblMwFnData  received_data 
)

Subscribes to responses from the data logger.

Parameters
loggerLogger to subscribe to
contextPointer to additional data for the callback function
received_dataCallback function to handle data received from the logger

◆ mbl_mw_logging_clear_entries()

METAWEAR_API void mbl_mw_logging_clear_entries ( const MblMwMetaWearBoard board)

Clear the logger of saved entries.

Parameters
boardBoard to remove entries from

◆ mbl_mw_logging_download()

METAWEAR_API void mbl_mw_logging_download ( MblMwMetaWearBoard board,
uint8_t  n_notifies,
const MblMwLogDownloadHandler handler 
)

Downloads the log data.

Parameters
boardBoard to download the log data from
n_notifiesHow many progress updates to send
handlerHandler for processing logger responses

◆ mbl_mw_logging_flush_page()

METAWEAR_API void mbl_mw_logging_flush_page ( const MblMwMetaWearBoard board)

Flushes logging data (pending writes) to the MMS memory Should be called for the MMS when done with logging and ready to download data For MMS only.

Parameters
boardBoard to stop logging

◆ mbl_mw_logging_get_latest_reset_uid()

METAWEAR_API uint8_t mbl_mw_logging_get_latest_reset_uid ( const MblMwMetaWearBoard board)

Get the latest reset_uid read duing connection.

Parameters
boardBoard to get reset_uid from
Returns
value of reset_uid

◆ mbl_mw_logging_get_length_data_signal()

METAWEAR_API MblMwDataSignal* mbl_mw_logging_get_length_data_signal ( const MblMwMetaWearBoard board)

Retrieves a data signal representing the length of the log, including timestamps.

Parameters
boardBoard to get reset_uid from

◆ mbl_mw_logging_get_reference_time()

METAWEAR_API int64_t mbl_mw_logging_get_reference_time ( const MblMwMetaWearBoard board,
uint8_t  reset_uid 
)

Get the device boot time for a given reset_uid.

This reference time is automatically calulated at connection time.

Parameters
boardBoard to use
reset_uidReset id
Returns
Number of milliseconds since epoch that the given reset_uid occured

◆ mbl_mw_logging_get_time_data_signal()

METAWEAR_API MblMwDataSignal* mbl_mw_logging_get_time_data_signal ( const MblMwMetaWearBoard board)

Retrieves a data signal representing the current logger time state.

This includes the reset_uid and time of boot.

Parameters
boardBoard to get time from

◆ mbl_mw_logging_raw_download()

METAWEAR_API void mbl_mw_logging_raw_download ( MblMwMetaWearBoard board,
uint8_t  n_notifies,
const MblMwRawLogDownloadHandler handler 
)

Downloads the raw log data.

Parameters
boardBoard to download the log data from
n_notifiesHow many progress updates to send
handlerHandler for processing logger responses

◆ mbl_mw_logging_set_reference_time()

METAWEAR_API void mbl_mw_logging_set_reference_time ( const MblMwMetaWearBoard board,
uint8_t  reset_uid,
int64_t  reference_epoch 
)

Set the device boot time for a given reset_uid.

This reference time is used to calcuated real timestamps from logged data.

Parameters
boardBoard to use
reset_uidReset id
reference_epochNew reference epoch (in milliseconds) to use

◆ mbl_mw_logging_start()

METAWEAR_API void mbl_mw_logging_start ( const MblMwMetaWearBoard board,
uint8_t  overwrite 
)

Starts data logging.

Parameters
boardBoard to log data on
overwriteNon-zero if older entries will be overwritten

◆ mbl_mw_logging_stop()

METAWEAR_API void mbl_mw_logging_stop ( const MblMwMetaWearBoard board)

Stops data logging.

Parameters
boardBoard to stop logging