MetaWear C++ API  0.20.0
C++ implementation of the MetaWear protocol
metawearboard.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <stdint.h>
9 
11 #include "metawearboard_fwd.h"
12 #include "model.h"
13 #include "module.h"
14 
17 
19 const int32_t MBL_MW_MODULE_TYPE_NA = -1;
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
30 typedef struct {
31  const char* manufacturer;
32  const char* model_number;
33  const char* serial_number;
34  const char* firmware_revision;
35  const char* hardware_revision;
37 
38 typedef struct {
39  const char* name;
40  const uint8_t* extra;
41  uint8_t extra_len;
42  uint8_t present;
43  uint8_t implementation;
44  uint8_t revision;
46 
126 METAWEAR_API uint8_t* mbl_mw_metawearboard_serialize(const MblMwMetaWearBoard* board, uint32_t* size);
135 METAWEAR_API int32_t mbl_mw_metawearboard_deserialize(MblMwMetaWearBoard* board, uint8_t* state, uint32_t size);
144 
148 typedef struct {
149  void *context;
150  void (*on_dfu_started)(void *context);
151  void (*on_dfu_cancelled)(void *context);
152  void (*on_transfer_percentage)(void *context, int32_t percentage);
153  void (*on_successful_file_transferred)(void *context);
154  void (*on_error)(void *context, const char *errorMessage);
156 
163 METAWEAR_API void mbl_mw_metawearboard_perform_dfu(MblMwMetaWearBoard *board, const MblMwDfuDelegate *delegate, const char *filename);
164 
165 #ifdef __cplusplus
166 }
167 #endif
Forward declaration for the MblMwAnonymousDataSignal type.
void(* MblMwFnAnonSignalArray)(void *context, MblMwMetaWearBoard *board, MblMwAnonymousDataSignal **anonymous_signals, uint32_t size)
Definition for callback functions that accept an MblMwMetaWearBoard pointer, MblMwAnonymousDataSignal...
Definition: anonymous_datasignal_fwd.h:27
Platform agnostic wrappers for Bluetooth Low Energy communication.
Macros for identifying exported functions.
#define METAWEAR_API
Indicates the function should be exported to the symbol table
Definition: dllmarker.h:27
const int32_t MBL_MW_MODULE_TYPE_NA
Constant signifying a module is not available.
Definition: metawearboard.h:19
METAWEAR_API void mbl_mw_metawearboard_set_time_for_response(MblMwMetaWearBoard *board, uint16_t response_time_ms)
Sets how long the API should wait before a required response is received.
METAWEAR_API MblMwModel mbl_mw_metawearboard_get_model(const MblMwMetaWearBoard *board)
Determines the board model of the currently connected device.
METAWEAR_API void mbl_mw_metawearboard_initialize(MblMwMetaWearBoard *board, void *context, MblMwFnBoardPtrInt initialized)
Initialize the API's internal state.
METAWEAR_API void mbl_mw_metawearboard_create_anonymous_datasignals(MblMwMetaWearBoard *board, void *context, MblMwFnAnonSignalArray created)
Reads the current state of the board and creates anonymous data signals based on what data is being l...
METAWEAR_API int32_t mbl_mw_metawearboard_lookup_module(const MblMwMetaWearBoard *board, MblMwModule module)
Checks module type i.e.
METAWEAR_API void mbl_mw_metawearboard_free(MblMwMetaWearBoard *board)
Frees the memory allocated for the struct.
METAWEAR_API int32_t mbl_mw_metawearboard_deserialize(MblMwMetaWearBoard *board, uint8_t *state, uint32_t size)
Deserializes API state.
METAWEAR_API const MblMwDeviceInformation * mbl_mw_metawearboard_get_device_information(const MblMwMetaWearBoard *board)
Retrieves supported characteristics from the Device Information service.
METAWEAR_API void mbl_mw_metawearboard_perform_dfu(MblMwMetaWearBoard *board, const MblMwDfuDelegate *delegate, const char *filename)
Starts the DFU process and updloads the given file to the device.
METAWEAR_API uint8_t * mbl_mw_metawearboard_serialize(const MblMwMetaWearBoard *board, uint32_t *size)
Serializes the API state.
METAWEAR_API const char * mbl_mw_metawearboard_get_model_name(const MblMwMetaWearBoard *board)
Determines the board model of the currently connected device.
METAWEAR_API MblMwModuleInfo * mbl_mw_metawearboard_get_module_info(const MblMwMetaWearBoard *board, uint32_t *size)
Returns information about the onboard modules.
METAWEAR_API MblMwMetaWearBoard * mbl_mw_metawearboard_create(const MblMwBtleConnection *connection)
Creates an instance of the MblMwMetaWearBoard struct.
METAWEAR_API void mbl_mw_metawearboard_tear_down(MblMwMetaWearBoard *board)
Removes all data processors and timers from the MetaWear board.
METAWEAR_API int32_t mbl_mw_metawearboard_is_initialized(const MblMwMetaWearBoard *board)
Checks if the board is initialized.
Forward declarations for the MblMwMetaWearBoard type.
struct MblMwMetaWearBoard MblMwMetaWearBoard
Software representation of a physical MetaWear board.
Definition: metawearboard_fwd.h:17
void(* MblMwFnBoardPtrInt)(void *context, MblMwMetaWearBoard *board, int32_t value)
Definition for callback functions that accept an MblMwMetaWearBoard pointer and an int32.
Definition: metawearboard_fwd.h:26
MblMwModel
Available MetaWear models.
Definition: model.h:11
MblMwModule
Sensors or peripherals supported by the firmware.
Definition: module.h:12
Wrapper class containing functions for communicating with the MetaWear through a Bluetooth Low Energy...
Definition: btle_connection.h:49
Wrapper class holding characteristics under the Device Information GATT service.
Definition: metawearboard.h:30
const char * manufacturer
Device's manufacturer name, characteristic 0x2A29.
Definition: metawearboard.h:31
const char * hardware_revision
Revision of the hardware on the device, characteristic 0x2A27.
Definition: metawearboard.h:35
const char * model_number
Model number assigned by MbientLab, characteristic 0x2A24.
Definition: metawearboard.h:32
const char * serial_number
Device's serial number, characteristic 0x2A25.
Definition: metawearboard.h:33
const char * firmware_revision
Revision of the firmware on the device, characteristic 0x2A26.
Definition: metawearboard.h:34
Wrapper class containing functions for receiving callbacks throughout the DFU process.
Definition: metawearboard.h:148
Definition: metawearboard.h:38