MetaWear C++ API  0.20.0
C++ implementation of the MetaWear protocol
settings.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <stdint.h>
9 
10 #include "datasignal_fwd.h"
11 #include "event_fwd.h"
12 #include "metawearboard_fwd.h"
13 
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
23  MBL_MW_SETTINGS_BATTERY_CHARGE_INDEX = 1;
25 
29 const uint8_t MBL_MW_ADDRESS_TYPE_PUBLIC = 0,
30  MBL_MW_ADDRESS_TYPE_RANDOM_STATIC = 1,
31  MBL_MW_ADDRESS_TYPE_PRIVATE_RESOLVABLE = 2,
32  MBL_MW_ADDRESS_TYPE_PRIVATE_NON_RESOLVABLE = 3;
33 
37  MBL_MW_SETTINGS_CHARGE_STATUS_UNSUPPORTED = -1;
39 
43 typedef enum {
44  MBL_MW_WHITELIST_FILTER_ALLOW_FROM_ANY = 0,
45  MBL_MW_WHITELIST_FILTER_SCAN_REQUESTS = 1,
46  MBL_MW_WHITELIST_FILTER_CONNECTION_REQUESTS = 2,
47  MBL_MW_WHITELIST_FILTER_SCAN_AND_CONNECTION_REQUESTS = 3
49 
50 typedef enum {
51  MBL_MW_BLE_AD_TYPE_CONNECTED_UNDIRECTED = 0,
52  MBL_MW_BLE_AD_TYPE_CONNECTED_DIRECTED = 1
53 } MblMwBleAdType;
54 
58 typedef struct {
59  uint8_t address_type;
60  uint8_t address[6];
62 
100 METAWEAR_API void mbl_mw_settings_set_device_name(const MblMwMetaWearBoard *board, const uint8_t *device_name, uint8_t len);
104 METAWEAR_API void mbl_mw_settings_set_ad_interval(const MblMwMetaWearBoard *board, uint16_t interval, uint8_t timeout);
112 METAWEAR_API void mbl_mw_settings_set_ad_parameters(const MblMwMetaWearBoard *board, uint16_t interval, uint8_t timeout, MblMwBleAdType type);
130 METAWEAR_API void mbl_mw_settings_set_scan_response(const MblMwMetaWearBoard *board, const uint8_t *response, uint8_t len);
139 METAWEAR_API void mbl_mw_settings_set_connection_parameters(const MblMwMetaWearBoard *board, float min_conn_interval, float max_conn_interval,
140  uint16_t latency, uint16_t timeout);
191 
192 #ifdef __cplusplus
193 }
194 #endif
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
Forward declaration of the MblMwEvent type.
struct MblMwEvent MblMwEvent
Represents an event fired from the MetaWear board.
Definition: event_fwd.h:16
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
METAWEAR_API void mbl_mw_settings_set_connection_parameters(const MblMwMetaWearBoard *board, float min_conn_interval, float max_conn_interval, uint16_t latency, uint16_t timeout)
Sets connection parameters.
METAWEAR_API void mbl_mw_settings_set_scan_response(const MblMwMetaWearBoard *board, const uint8_t *response, uint8_t len)
Sets scan response.
METAWEAR_API MblMwDataSignal * mbl_mw_settings_get_charge_status_data_signal(const MblMwMetaWearBoard *board)
Retrieves the data signal representing the charge status.
METAWEAR_API void mbl_mw_settings_set_tx_power(const MblMwMetaWearBoard *board, int8_t tx_power)
Sets advertising transmitting power.
METAWEAR_API MblMwDataSignal * mbl_mw_settings_get_power_status_data_signal(const MblMwMetaWearBoard *board)
Retrieves the data signal representing the power status.
METAWEAR_API MblMwEvent * mbl_mw_settings_get_disconnect_event(const MblMwMetaWearBoard *board)
Retrieves an event pointer representing a disconnect event.
METAWEAR_API void mbl_mw_settings_set_ad_parameters(const MblMwMetaWearBoard *board, uint16_t interval, uint8_t timeout, MblMwBleAdType type)
Configures Bluetooth LE ad parameters.
METAWEAR_API void mbl_mw_settings_read_current_power_status(MblMwMetaWearBoard *board, void *context, MblMwFnBoardPtrInt handler)
Reads the current power status if available.
const uint8_t MBL_MW_ADDRESS_TYPE_PUBLIC
Types of BLE addresses.
Definition: settings.h:29
METAWEAR_API void mbl_mw_settings_set_device_name(const MblMwMetaWearBoard *board, const uint8_t *device_name, uint8_t len)
Sets the advertisement name Can be used to rename the device.
const uint8_t MBL_MW_SETTINGS_BATTERY_VOLTAGE_INDEX
< Indices for component values of the battery data signal, to be used with mbl_mw_datasignal_get_comp...
Definition: settings.h:22
MblMwWhitelistFilter
Whitelist filter modes.
Definition: settings.h:43
METAWEAR_API void mbl_mw_settings_set_ad_interval(const MblMwMetaWearBoard *board, uint16_t interval, uint8_t timeout)
METAWEAR_API void mbl_mw_settings_enable_3V_regulator(const MblMwMetaWearBoard *board, uint8_t enable)
Turns on the 3V regulator Needed if IOs / peripherals need 3V power from the MetaSensor For MMS only,...
METAWEAR_API MblMwDataSignal * mbl_mw_settings_get_battery_state_data_signal(const MblMwMetaWearBoard *board)
Retrieves the data signal representing battery state.
METAWEAR_API void mbl_mw_settings_read_current_charge_status(MblMwMetaWearBoard *board, void *context, MblMwFnBoardPtrInt handler)
Reads the current charge status.
METAWEAR_API void mbl_mw_settings_start_advertising(const MblMwMetaWearBoard *board)
Starts advertising.
METAWEAR_API void mbl_mw_settings_add_whitelist_address(const MblMwMetaWearBoard *board, uint8_t index, const MblMwBtleAddress *address)
Adds MAC Addresses for Whitelist filtering.
METAWEAR_API MblMwDataSignal * mbl_mw_settings_get_whitelist_data_signal(MblMwMetaWearBoard *board, uint8_t index)
Adds MAC Addresses for Whitelist filtering.
METAWEAR_API uint8_t mbl_mw_settings_get_firmware_build_id(const MblMwMetaWearBoard *board)
Retrieves the firmware build id, used for identifying custom firmware build variants.
METAWEAR_API void mbl_mw_settings_set_whitelist_filter_mode(const MblMwMetaWearBoard *board, MblMwWhitelistFilter mode)
Sets connection parameters.
METAWEAR_API MblMwDataSignal * mbl_mw_settings_get_mac_data_signal(const MblMwMetaWearBoard *board)
Retrieves the data signal representing the device GAP (MAC) address.
const int32_t MBL_MW_SETTINGS_POWER_STATUS_UNSUPPORTED
< Values returned if the power or charge statuses are not supported
Definition: settings.h:36
BLE MAC Address.
Definition: settings.h:58
uint8_t address_type
Types of BLE address: MBL_MW_ADDRESS_TYPE_*.
Definition: settings.h:59