MetaWear C++ API  0.20.0
C++ implementation of the MetaWear protocol
logging.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <stdint.h>
9 
10 #include "data.h"
11 #include "datasignal_fwd.h"
12 #include "logging_fwd.h"
13 #include "metawearboard_fwd.h"
14 
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
24 typedef struct {
28  void *context;
35  void (*received_progress_update)(void *context, uint32_t entries_left, uint32_t total_entries);
44  void (*received_unknown_entry)(void *context, uint8_t id, int64_t epoch, const uint8_t* data, uint8_t length);
50 
56 METAWEAR_API void mbl_mw_logging_start(const MblMwMetaWearBoard* board, uint8_t overwrite);
80 METAWEAR_API void mbl_mw_logging_download(MblMwMetaWearBoard* board, uint8_t n_notifies, const MblMwLogDownloadHandler* handler);
111 METAWEAR_API void mbl_mw_logger_subscribe(MblMwDataLogger* logger, void *context, MblMwFnData received_data);
143 METAWEAR_API int64_t mbl_mw_logging_get_reference_time(const MblMwMetaWearBoard *board, uint8_t reset_uid);
151 METAWEAR_API void mbl_mw_logging_set_reference_time(const MblMwMetaWearBoard *board, uint8_t reset_uid, int64_t reference_epoch);
152 
156 typedef struct {
160  void *context;
169  void (*received_entry)(void *context, uint8_t entry_id, uint8_t reset_uid, uint32_t entry_tick, uint32_t data);
176  void (*received_progress_update)(void *context, uint32_t entries_left, uint32_t total_entries);
184  void (*logging_page_completed)(void *context, const MblMwMetaWearBoard* caller, MblMwFnBoardPtr ready);
186 
194 
195 
196 #ifdef __cplusplus
197 }
198 #endif
Functions and types for data received from an MblMwDataSignal.
void(* MblMwFnData)(void *context, const MblMwData *data)
Definition for callback functions that handle data from an MblMwDataSignal.
Definition: data.h:52
Forward declaration for the MblMwDataSignal type.
struct MblMwDataSignal MblMwDataSignal
A event fired from the MetaWear board that also contains data.
Definition: datasignal_fwd.h:15
Macros for identifying exported functions.
#define METAWEAR_API
Indicates the function should be exported to the symbol table
Definition: dllmarker.h:27
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.
METAWEAR_API MblMwDataLogger * mbl_mw_logger_lookup_id(const MblMwMetaWearBoard *board, uint8_t id)
Looks up the MblMwDataLogger object corresponding to the id.
METAWEAR_API void mbl_mw_logging_raw_download(MblMwMetaWearBoard *board, uint8_t n_notifies, const MblMwRawLogDownloadHandler *handler)
Downloads the raw log data.
METAWEAR_API void mbl_mw_logging_stop(const MblMwMetaWearBoard *board)
Stops data logging.
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.
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.
METAWEAR_API void mbl_mw_logging_download(MblMwMetaWearBoard *board, uint8_t n_notifies, const MblMwLogDownloadHandler *handler)
Downloads the log data.
METAWEAR_API uint8_t mbl_mw_logging_get_latest_reset_uid(const MblMwMetaWearBoard *board)
Get the latest reset_uid read duing connection.
METAWEAR_API void mbl_mw_logging_clear_entries(const MblMwMetaWearBoard *board)
Clear the logger of saved entries.
METAWEAR_API void mbl_mw_logger_subscribe(MblMwDataLogger *logger, void *context, MblMwFnData received_data)
Subscribes to responses from the data logger.
METAWEAR_API void mbl_mw_logger_remove(MblMwDataLogger *logger)
Removes the logger from the board.
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 l...
METAWEAR_API uint8_t mbl_mw_logger_get_id(const MblMwDataLogger *logger)
Retrieves the id value identifying the logger.
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.
METAWEAR_API MblMwDataSignal * mbl_mw_logging_get_time_data_signal(const MblMwMetaWearBoard *board)
Retrieves a data signal representing the current logger time state.
METAWEAR_API void mbl_mw_logging_start(const MblMwMetaWearBoard *board, uint8_t overwrite)
Starts data logging.
METAWEAR_API MblMwDataSignal * mbl_mw_logger_get_signal(const MblMwDataLogger *logger)
Retrieves the data signal the logger is recording data for.
Forward declaration of the MblMwDataLogger type.
struct MblMwDataLogger MblMwDataLogger
Logs data from an MblMwDataSignal type letting users retrieve the data at a later time.
Definition: logging_fwd.h:14
Forward declarations for the MblMwMetaWearBoard type.
struct MblMwMetaWearBoard MblMwMetaWearBoard
Software representation of a physical MetaWear board.
Definition: metawearboard_fwd.h:17
void(* MblMwFnBoardPtr)(const MblMwMetaWearBoard *board)
Definition for callback functions that accept an MblMwMetaWearBoard pointer.
Definition: metawearboard_fwd.h:31
Callback functions for handling notifications from the logger.
Definition: logging.h:24
void * context
Pointer to additional data for the callback functions.
Definition: logging.h:28
MblMwFnData received_unhandled_entry
Called when a log entry has been received but has no MblMwFnData pointer to forward the data to.
Definition: logging.h:48
Callback functions for handling notifications from the logger.
Definition: logging.h:156
void * context
Pointer to additional data for the callback functions.
Definition: logging.h:160