ble/stack/central.h header reference
[Bluetooth Low Energy library module]
The source code of this header can be browsed online.
Description [link]
this header contains definitions for a Central context stack utility.
Members [link]
Types [link]
- struct ble_central_handler_s
- enum ble_central_mode_e
- struct ble_central_params_s
- struct ble_central_s
- enum ble_central_state_e
Functions [link]
- void ble_central_connect(struct ble_central_s *ctrl, const struct ble_addr_s *addr)
- error_t ble_central_encryption_enable(struct ble_central_s *ctrl)
- struct ble_central_handler_s * ble_central_handler_s_from_base(void *x)
- error_t ble_central_init(struct ble_central_s *ctrl, const struct ble_central_params_s *params, const struct ble_central_handler_s *handler, struct ble_stack_context_s *context)
- void ble_central_mode_set(struct ble_central_s *ctrl, uint8_t mode)
- struct ble_central_s * ble_central_s_from_conn(void *x)
Members detail [link]
#define BLE_STACK_CENTRAL_H [link]
This macro is declared in ble/stack/central.h source file, line 30.
void ble_central_connect(struct ble_central_s *ctrl, const struct ble_addr_s *addr) [link]
This function is declared in ble/stack/central.h source file, line 171.
this function asks the central context to connection to given device as soon as possible.
error_t ble_central_encryption_enable(struct ble_central_s *ctrl) [link]
This function is declared in ble/stack/central.h source file, line 177.
this function tell link-layer to start link encryption if keys are available.
struct ble_central_handler_s [link]
This struct is declared in ble/stack/central.h source file, line 77.
this struct defines the set of functions a central context can call back. They allow the central context to meet caller's expectations.
Field | Description |
---|---|
struct ble_stack_connection_handler_s base; | Connection-specific callbacks |
void (*connection_opened)(struct ble_central_s *ctrl, const struct ble_addr_s *addr) ; | this variable notifies the handler a connection got created to a given device. |
enum ble_scan_filter_policy_e (*device_policy)(struct ble_central_s *ctrl, const struct ble_scan_filter_device_s *device) ; | this variable asks handler about what behavior to adopt with a given device that got scanned. |
void (*state_changed)(struct ble_central_s *ctrl, enum ble_central_state_e state) ; | this variable notifies the handler of new central state. This will typically change on successful connection, connection drop, or mode change. |
struct ble_central_handler_s * ble_central_handler_s_from_base(void *x) [link]
This function is declared in ble/stack/central.h source file, line 105.
error_t ble_central_init(struct ble_central_s *ctrl, const struct ble_central_params_s *params, const struct ble_central_handler_s *handler, struct ble_stack_context_s *context) [link]
This function is declared in ble/stack/central.h source file, line 156.
this function initializes a central stack context.
enum ble_central_mode_e [link]
This enum is declared in ble/stack/central.h source file, line 65.
this enum is a or-mask of device supported actions. Mode should be updated through calls to ble_central_mode_set.
Identifier | Description |
---|---|
BLE_CENTRAL_CONNECTABLE | Central will scan |
BLE_CENTRAL_PAIRABLE | Central will allow pairing requests |
void ble_central_mode_set(struct ble_central_s *ctrl, uint8_t mode) [link]
This function is declared in ble/stack/central.h source file, line 164.
this function sets central mode. If passed mode implies connection is not possible, current connection gets dropped, if any.
struct ble_central_params_s [link]
This struct is declared in ble/stack/central.h source file, line 112.
this struct is the central parameter structure to pass to central state initialization.
Field | Description |
---|---|
enum ble_phy_mode_e phy; | |
uint32_t scan_interval_ms; | Time between two scan window starts |
uint32_t scan_duration_ms; | Time to scan for |
struct ble_gap_preferred_conn_params_s conn; | Initial connection parameters |
struct ble_central_s [link]
This struct is declared in ble/stack/central.h source file, line 133.
this struct is an utility for easy declaration of a typical Central role. This utility uses a stack context as data source, scans for advertising devices, and may connect to them if wanted.
After connection creation, scanning stops util connection closes. To this extent, this utility handles only one concurrent connection.
Field | Description |
---|---|
struct ble_stack_context_s * context; | |
const struct ble_central_handler_s * handler; | |
struct ble_stack_connection_s conn; | |
struct net_layer_s * scan; | |
struct net_layer_s * scan_filter; | |
struct ble_addr_s addr; | |
struct kroutine_s updater; | |
enum ble_central_state_e last_state:8; | |
uint8_t mode; | |
struct ble_gap_preferred_conn_params_s conn_params; | |
struct ble_scanner_param_s params; |
struct ble_central_s * ble_central_s_from_conn(void *x) [link]
This function is declared in ble/stack/central.h source file, line 158.
enum ble_central_state_e [link]
This enum is declared in ble/stack/central.h source file, line 50.
this enum is a list of states a central may be in.
Identifier | Description |
---|---|
BLE_CENTRAL_IDLE | Central is not connected, not scanning |
BLE_CENTRAL_SCANNING | Central is not connected, scanning |
BLE_CENTRAL_PAIRING | Central is connected to a non-paired device |
BLE_CENTRAL_CONNECTED | Central is connected to a paired device |