MetaWear C++ API  0.18.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 
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 
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 
93 
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);
118 METAWEAR_API void mbl_mw_settings_set_tx_power(const MblMwMetaWearBoard *board, int8_t tx_power);
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);
147 METAWEAR_API void mbl_mw_settings_add_whitelist_address(const MblMwMetaWearBoard *board, uint8_t index, const MblMwBtleAddress *address);
161 
179 
180 #ifdef __cplusplus
181 }
182 #endif
const int32_t MBL_MW_SETTINGS_POWER_STATUS_UNSUPPORTED
< Values returned if the power or charge statuses are not supported
Definition: settings.h:36
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_set_ad_interval(const MblMwMetaWearBoard *board, uint16_t interval, uint8_t timeout)
struct MblMwMetaWearBoard MblMwMetaWearBoard
Software representation of a physical MetaWear board.
Definition: metawearboard_fwd.h:17
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_add_whitelist_address(const MblMwMetaWearBoard *board, uint8_t index, const MblMwBtleAddress *address)
Adds MAC Addresses for Whitelist filtering.
uint8_t address_type
Types of BLE address: MBL_MW_ADDRESS_TYPE_*.
Definition: settings.h:59
METAWEAR_API MblMwDataSignal * mbl_mw_settings_get_mac_data_signal(const MblMwMetaWearBoard *board)
Retrieves the data signal representing the device GAP (MAC) address.
Forward declaration of the MblMwEvent type.
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_read_current_power_status(MblMwMetaWearBoard *board, void *context, MblMwFnBoardPtrInt handler)
Reads the current power status if available.
METAWEAR_API void mbl_mw_settings_set_device_name(const MblMwMetaWearBoard *board, const uint8_t *device_name, uint8_t len)
Sets the advertisement name.
Macros for identifying exported functions.
Forward declarations for the MblMwMetaWearBoard type.
METAWEAR_API MblMwDataSignal * mbl_mw_settings_get_whitelist_data_signal(MblMwMetaWearBoard *board, uint8_t index)
Adds MAC Addresses for Whitelist filtering.
MblMwWhitelistFilter
Whitelist filter modes.
Definition: settings.h:43
Forward declaration for the MblMwDataSignal type.
const int32_t MBL_MW_SETTINGS_CHARGE_STATUS_UNSUPPORTED
< Values returned if the power or charge statuses are not supported
Definition: settings.h:37
METAWEAR_API void mbl_mw_settings_set_tx_power(const MblMwMetaWearBoard *board, int8_t tx_power)
Sets advertising transmitting power.
BLE MAC Address.
Definition: settings.h:58
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 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_whitelist_filter_mode(const MblMwMetaWearBoard *board, MblMwWhitelistFilter mode)
Sets connection parameters.
const uint8_t MBL_MW_SETTINGS_BATTERY_CHARGE_INDEX
< Indices for component values of the battery data signal, to be used with mbl_mw_datasignal_get_comp...
Definition: settings.h:23
METAWEAR_API MblMwDataSignal * mbl_mw_settings_get_power_status_data_signal(const MblMwMetaWearBoard *board)
Retrieves the data signal representing the power status.
struct MblMwEvent MblMwEvent
Represents an event fired from the MetaWear board.
Definition: event_fwd.h:16
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.
const uint8_t MBL_MW_ADDRESS_TYPE_PUBLIC
Types of BLE addresses.
Definition: settings.h:29
METAWEAR_API void mbl_mw_settings_set_scan_response(const MblMwMetaWearBoard *board, const uint8_t *response, uint8_t len)
Sets scan response.
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
METAWEAR_API void mbl_mw_settings_start_advertising(const MblMwMetaWearBoard *board)
Starts advertising.
#define METAWEAR_API
Indicates the function should be exported to the symbol table.
Definition: dllmarker.h:27
METAWEAR_API MblMwEvent * mbl_mw_settings_get_disconnect_event(const MblMwMetaWearBoard *board)
Retrieves an event pointer representing a disconnect event.
struct MblMwDataSignal MblMwDataSignal
A event fired from the MetaWear board that also contains data.
Definition: datasignal_fwd.h:15