MetaWear C++ API  0.13.4
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 
37 typedef enum {
38  MBL_MW_WHITELIST_FILTER_ALLOW_FROM_ANY = 0,
39  MBL_MW_WHITELIST_FILTER_SCAN_REQUESTS = 1,
40  MBL_MW_WHITELIST_FILTER_CONNECTION_REQUESTS = 2,
41  MBL_MW_WHITELIST_FILTER_SCAN_AND_CONNECTION_REQUESTS = 3
43 
44 typedef enum {
45  MBL_MW_BLE_AD_TYPE_CONNECTED_UNDIRECTED = 0,
46  MBL_MW_BLE_AD_TYPE_CONNECTED_DIRECTED = 1
47 } MblMwBleAdType;
48 
52 typedef struct {
53  uint8_t address_type;
54  uint8_t address[6];
56 
75 
82 METAWEAR_API void mbl_mw_settings_set_device_name(const MblMwMetaWearBoard *board, const uint8_t *device_name, uint8_t len);
86 METAWEAR_API void mbl_mw_settings_set_ad_interval(const MblMwMetaWearBoard *board, uint16_t interval, uint8_t timeout);
94 METAWEAR_API void mbl_mw_settings_set_ad_parameters(const MblMwMetaWearBoard *board, uint16_t interval, uint8_t timeout, MblMwBleAdType type);
100 METAWEAR_API void mbl_mw_settings_set_tx_power(const MblMwMetaWearBoard *board, int8_t tx_power);
112 METAWEAR_API void mbl_mw_settings_set_scan_response(const MblMwMetaWearBoard *board, const uint8_t *response, uint8_t len);
121 METAWEAR_API void mbl_mw_settings_set_connection_parameters(const MblMwMetaWearBoard *board, float min_conn_interval, float max_conn_interval,
122  uint16_t latency, uint16_t timeout);
129 METAWEAR_API void mbl_mw_settings_add_whitelist_address(const MblMwMetaWearBoard *board, uint8_t index, const MblMwBtleAddress *address);
143 
144 #ifdef __cplusplus
145 }
146 #endif
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:53
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_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:37
Forward declaration for the MblMwDataSignal type.
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:52
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
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