MetaWear C++ API  0.18.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);
73 METAWEAR_API void mbl_mw_logging_download(MblMwMetaWearBoard* board, uint8_t n_notifies, const MblMwLogDownloadHandler* handler);
74 
105 METAWEAR_API void mbl_mw_logger_subscribe(MblMwDataLogger* logger, void *context, MblMwFnData received_data);
137 METAWEAR_API int64_t mbl_mw_logging_get_reference_time(const MblMwMetaWearBoard *board, uint8_t reset_uid);
145 METAWEAR_API void mbl_mw_logging_set_reference_time(const MblMwMetaWearBoard *board, uint8_t reset_uid, int64_t reference_epoch);
146 
147 
151 typedef struct {
155  void *context;
164  void (*received_entry)(void *context, uint8_t entry_id, uint8_t reset_uid, uint32_t entry_tick, uint32_t data);
171  void (*received_progress_update)(void *context, uint32_t entries_left, uint32_t total_entries);
179  void (*logging_page_completed)(void *context, const MblMwMetaWearBoard* caller, MblMwFnBoardPtr ready);
181 
188 METAWEAR_API void mbl_mw_logging_raw_download(MblMwMetaWearBoard* board, uint8_t n_notifies, const MblMwRawLogDownloadHandler* handler);
189 
190 
191 #ifdef __cplusplus
192 }
193 #endif
METAWEAR_API void mbl_mw_logging_download(MblMwMetaWearBoard *board, uint8_t n_notifies, const MblMwLogDownloadHandler *handler)
Downloads the log data.
METAWEAR_API MblMwDataSignal * mbl_mw_logger_get_signal(const MblMwDataLogger *logger)
Retrieves the data signal the logger is recording data for.
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.
void * context
Pointer to additional data for the callback functions.
Definition: logging.h:28
struct MblMwMetaWearBoard MblMwMetaWearBoard
Software representation of a physical MetaWear board.
Definition: metawearboard_fwd.h:17
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 MblMwDataSignal * mbl_mw_logging_get_length_data_signal(const MblMwMetaWearBoard *board)
Retrieves a data signal representing the length of the log, including timestamps. ...
Functions and types for data received from an MblMwDataSignal.
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 uint8_t mbl_mw_logging_get_latest_reset_uid(const MblMwMetaWearBoard *board)
Get the latest reset_uid read duing connection.
void * context
Pointer to additional data for the callback functions.
Definition: logging.h:155
Macros for identifying exported functions.
void(* MblMwFnData)(void *context, const MblMwData *data)
Definition for callback functions that handle data from an MblMwDataSignal.
Definition: data.h:51
Forward declarations for the MblMwMetaWearBoard type.
Forward declaration for the MblMwDataSignal type.
METAWEAR_API void mbl_mw_logging_clear_entries(const MblMwMetaWearBoard *board)
Clear the logger of saved entries.
METAWEAR_API void mbl_mw_logging_stop(const MblMwMetaWearBoard *board)
Stops data logging.
METAWEAR_API void mbl_mw_logger_remove(MblMwDataLogger *logger)
Removes the logger from the board.
Forward declaration of the MblMwDataLogger type.
METAWEAR_API uint8_t mbl_mw_logger_get_id(const MblMwDataLogger *logger)
Retrieves the id value identifying the logger.
void(* MblMwFnBoardPtr)(const MblMwMetaWearBoard *board)
Definition for callback functions that accept an MblMwMetaWearBoard pointer.
Definition: metawearboard_fwd.h:32
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_logging_raw_download(MblMwMetaWearBoard *board, uint8_t n_notifies, const MblMwRawLogDownloadHandler *handler)
Downloads the raw log data.
Callback functions for handling notifications from the logger.
Definition: logging.h:151
METAWEAR_API void mbl_mw_logging_start(const MblMwMetaWearBoard *board, uint8_t overwrite)
Starts data logging.
METAWEAR_API MblMwDataLogger * mbl_mw_logger_lookup_id(const MblMwMetaWearBoard *board, uint8_t id)
Looks up the MblMwDataLogger object corresponding to the id.
struct MblMwDataLogger MblMwDataLogger
Logs data from an MblMwDataSignal type letting users retrieve the data at a later time...
Definition: logging_fwd.h:14
METAWEAR_API MblMwDataSignal * mbl_mw_logging_get_time_data_signal(const MblMwMetaWearBoard *board)
Retrieves a data signal representing the current logger time state.
#define METAWEAR_API
Indicates the function should be exported to the symbol table.
Definition: dllmarker.h:27
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:24
struct MblMwDataSignal MblMwDataSignal
A event fired from the MetaWear board that also contains data.
Definition: datasignal_fwd.h:15