MetaWear C++ API
0.18.0
C++ implementation of the MetaWear protocol
|
Functions for communicating with an MblMwMetaWearBoard object. More...
#include <stdint.h>
#include "anonymous_datasignal_fwd.h"
#include "metawearboard_fwd.h"
#include "model.h"
#include "module.h"
#include "metawear/platform/btle_connection.h"
#include "metawear/platform/dllmarker.h"
Go to the source code of this file.
Classes | |
struct | MblMwDeviceInformation |
Wrapper class holding characteristics under the Device Information GATT service. More... | |
struct | MblMwModuleInfo |
struct | MblMwDfuDelegate |
Wrapper class containing functions for receiving callbacks throughout the DFU process. More... | |
Functions | |
METAWEAR_API MblMwMetaWearBoard * | mbl_mw_metawearboard_create (const MblMwBtleConnection *connection) |
Creates an instance of the MblMwMetaWearBoard struct. More... | |
METAWEAR_API void | mbl_mw_metawearboard_free (MblMwMetaWearBoard *board) |
Frees the memory allocated for the struct. More... | |
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. More... | |
METAWEAR_API void | mbl_mw_metawearboard_initialize (MblMwMetaWearBoard *board, void *context, MblMwFnBoardPtrInt initialized) |
Initialize the API's internal state. More... | |
METAWEAR_API void | mbl_mw_metawearboard_tear_down (MblMwMetaWearBoard *board) |
Removes all data processors and timers from the MetaWear board. More... | |
METAWEAR_API int32_t | mbl_mw_metawearboard_is_initialized (const MblMwMetaWearBoard *board) |
Checks if the board is initialized. More... | |
METAWEAR_API int32_t | mbl_mw_metawearboard_lookup_module (const MblMwMetaWearBoard *board, MblMwModule module) |
Checks module type i.e. More... | |
METAWEAR_API MblMwModel | mbl_mw_metawearboard_get_model (const MblMwMetaWearBoard *board) |
Determines the board model of the currently connected device. More... | |
METAWEAR_API const char * | mbl_mw_metawearboard_get_model_name (const MblMwMetaWearBoard *board) |
Determines the board model of the currently connected device. More... | |
METAWEAR_API const MblMwDeviceInformation * | mbl_mw_metawearboard_get_device_information (const MblMwMetaWearBoard *board) |
Retrieves supported characteristics from the Device Information service. More... | |
METAWEAR_API MblMwModuleInfo * | mbl_mw_metawearboard_get_module_info (const MblMwMetaWearBoard *board, uint32_t *size) |
Returns information about the onboard modules. More... | |
METAWEAR_API uint8_t * | mbl_mw_metawearboard_serialize (const MblMwMetaWearBoard *board, uint32_t *size) |
Serializes the API state. More... | |
METAWEAR_API int32_t | mbl_mw_metawearboard_deserialize (MblMwMetaWearBoard *board, uint8_t *state, uint32_t size) |
Deserializes API state. More... | |
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 logged, If this task failed, a null pointer will be passed into the anonymous_signals parameter. More... | |
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. More... | |
Variables | |
const int32_t | MBL_MW_MODULE_TYPE_NA = -1 |
Constant signifying a module is not available. | |
Functions for communicating with an MblMwMetaWearBoard object.
METAWEAR_API MblMwMetaWearBoard* mbl_mw_metawearboard_create | ( | const MblMwBtleConnection * | connection | ) |
Creates an instance of the MblMwMetaWearBoard struct.
connection | Connection struct the new MblMwMetaWearBoard variable will use for btle communication |
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 logged, If this task failed, a null pointer will be passed into the anonymous_signals
parameter.
board | Calling object |
context | Pointer to additional data for the callback function |
created | Callback function to be executed once the task is completed. |
METAWEAR_API int32_t mbl_mw_metawearboard_deserialize | ( | MblMwMetaWearBoard * | board, |
uint8_t * | state, | ||
uint32_t | size | ||
) |
Deserializes API state.
This function must be executed before calling mbl_mw_metawearboard_initialize.
board | Board to deserialize |
state | Byte array holding the the information state |
size | Byte array size |
METAWEAR_API void mbl_mw_metawearboard_free | ( | MblMwMetaWearBoard * | board | ) |
Frees the memory allocated for the struct.
board | Pointer to the memory to free |
METAWEAR_API const MblMwDeviceInformation* mbl_mw_metawearboard_get_device_information | ( | const MblMwMetaWearBoard * | board | ) |
Retrieves supported characteristics from the Device Information service.
The memory allocated by the function must be freed by calling mbl_mw_memory_free.
METAWEAR_API MblMwModel mbl_mw_metawearboard_get_model | ( | const MblMwMetaWearBoard * | board | ) |
Determines the board model of the currently connected device.
Only call this function after the board has been initialized.
METAWEAR_API const char* mbl_mw_metawearboard_get_model_name | ( | const MblMwMetaWearBoard * | board | ) |
Determines the board model of the currently connected device.
Only call this function after the board has been initialized.
METAWEAR_API MblMwModuleInfo* mbl_mw_metawearboard_get_module_info | ( | const MblMwMetaWearBoard * | board, |
uint32_t * | size | ||
) |
Returns information about the onboard modules.
board | Calling object |
size | Pointer to where the size of the returned array will be written to |
METAWEAR_API void mbl_mw_metawearboard_initialize | ( | MblMwMetaWearBoard * | board, |
void * | context, | ||
MblMwFnBoardPtrInt | initialized | ||
) |
Initialize the API's internal state.
This function is non-blocking and will alert the caller when the operation is complete.
board | Board to initialize |
context | Pointer to additional data for the callback function |
initialized | Callback function to be executed when the board is initialized |
METAWEAR_API int32_t mbl_mw_metawearboard_is_initialized | ( | const MblMwMetaWearBoard * | board | ) |
Checks if the board is initialized.
board | Board to check |
METAWEAR_API int32_t mbl_mw_metawearboard_lookup_module | ( | const MblMwMetaWearBoard * | board, |
MblMwModule | module | ||
) |
Checks module type i.e.
what kind of accelerometer is being used
board | Board to check |
module | Module to lookup |
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.
board | Calling object |
delegate | Struct the function will forward DFU progress updates to |
filename | Path to firmware bin file |
METAWEAR_API uint8_t* mbl_mw_metawearboard_serialize | ( | const MblMwMetaWearBoard * | board, |
uint32_t * | size | ||
) |
Serializes the API state.
The memory allocated by the function must be freed by calling mbl_mw_memory_free.
board | Board to serialize |
size | Pointer to where the size of the returned byte array will be written to |
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.
You should increase this value if operations such as API initialization, creating timer, loggers, and data processors, and recording commands consistently time out.
board | Board to configure |
response_time_ms | How long to wait for a response, from [0, 4000]ms. Use 0ms for indefinite timeout |
METAWEAR_API void mbl_mw_metawearboard_tear_down | ( | MblMwMetaWearBoard * | board | ) |
Removes all data processors and timers from the MetaWear board.
board | Board to tear down |