Data Structures | |
struct | _ble_common_event_cb_t |
struct | _ble_gap_event_cb_t |
struct | _ble_gatt_client_event_cb_t |
struct | _ble_gatt_server_event_cb_t |
struct | _ble_gatt_transparent_event_cb_t |
struct | _ble_pairing_event_cb_t |
struct | ble_mgr_adv_report_event_t |
Advertisement report event data. More... | |
struct | ble_mgr_adv_report_match_param_t |
Macros | |
#define | DEFAULT_SCAN_INTERVAL 0x0010 |
#define | DEFAULT_SCAN_WINDOW 0x0010 |
#define | MAX_ADV_PAYLOAD_LEN 31 |
#define | MAX_ADV_REPORT_EVENT_LIST 20 |
#define | MAX_COMMON_EVENT_SUBSCRIBERS 3 |
#define | MAX_EVENT_PAYLOAD_SIZE 1024 |
#define | MAX_EVENT_SIZE 10 |
#define | MAX_GAP_EVENT_SUBSCRIBERS 3 |
#define | MAX_GATT_CLIENT_EVENT_SUBSCRIBERS 3 |
#define | MAX_GATT_SERVER_EVENT_SUBSCRIBERS 3 |
#define | MAX_GATT_TRANSPARENT_SUBSCRIBERS 3 |
#define | MAX_PAIRING_SUBSCRIBERS 3 |
Typedefs | |
typedef struct _ble_common_event_cb_t | ble_common_event_cb_t |
typedef ble_status_t(* | ble_event_callback_t )(event_msg_t *message) |
BLE Event callback generic type. More... | |
typedef struct _ble_gap_event_cb_t | ble_gap_event_cb_t |
typedef struct _ble_gatt_client_event_cb_t | ble_gatt_client_event_cb_t |
typedef struct _ble_gatt_server_event_cb_t | ble_gatt_server_event_cb_t |
typedef struct _ble_gatt_transparent_event_cb_t | ble_gatt_transparent_event_cb_t |
typedef enum Advertisement_Data_Type | ble_mgr_adv_data_type |
typedef struct _ble_pairing_event_cb_t | ble_pairing_event_cb_t |
Functions | |
ble_status_t | ble_mgr_adv_start (const uint8_t *adv_data, uint8_t adv_data_length, const uint8_t *scan_data, uint8_t scan_data_len) |
Set advertisement data, scan response data, advertisement parameters and start advertisement. More... | |
ble_status_t | ble_mgr_adv_stop (void) |
Stops ongoing advertisement. More... | |
ble_status_t | ble_mgr_characteristic_indicate_set (ble_handle_t conn_handle, uint16_t desc_handle, bool enabled) |
Enable/disable characteristic indication. More... | |
ble_status_t | ble_mgr_characteristic_notify_set (ble_handle_t conn_handle, uint16_t desc_handle, bool enabled) |
Enable/disable characteristic notification. More... | |
bool | ble_mgr_check_match_param (ble_mgr_adv_report_event_t *adv_report) |
Check against the matching parameter set by the user, it could be BLE address, RSSI threshold or advertisement payload. More... | |
ble_status_t | ble_mgr_device_init (void) |
Initialize platform, callback events and BLE interface. More... | |
bool | ble_mgr_events_register_callback (ble_mgr_event_t event_type, const void *ble_event_handler) |
Register callback functions for BLE events. More... | |
event_status_t | ble_mgr_get_event (event_t *event) |
Get BLE events and process them. More... | |
void | ble_mgr_peripheral_device_match_params (ble_mgr_adv_report_match_param_t *match_param) |
Sets a matching parameter to find and connect with the device. More... | |
ble_status_t | ble_mgr_scan_start (void) |
Sets BLE scan parameters and starts scanning. More... | |
ble_status_t | ble_mgr_scan_stop (void) |
Stops the ongoing BLE scan. More... | |
ble_status_t | ble_mgr_start_connection (ble_addr_t *address) |
Initiate a connection based on remote device address. More... | |
ble_status_t | ble_mgr_transparent_uart_disable (ble_handle_t conn_handle) |
Disables transparentUART with remote device. More... | |
ble_status_t | ble_mgr_transparent_uart_enable (ble_handle_t conn_handle) |
Enables transparentUART with remote device. More... | |
ble_status_t | ble_mgr_transparent_uart_send (ble_handle_t conn_handle, const uint8_t *data, uint8_t datalen) |
Sends transparentUART data to remote device. More... | |
#define DEFAULT_SCAN_INTERVAL 0x0010 |
Referenced by ble_mgr_scan_start().
#define DEFAULT_SCAN_WINDOW 0x0010 |
Referenced by ble_mgr_scan_start().
#define MAX_ADV_PAYLOAD_LEN 31 |
#define MAX_ADV_REPORT_EVENT_LIST 20 |
#define MAX_COMMON_EVENT_SUBSCRIBERS 3 |
Referenced by ble_mgr_event_manager(), and ble_mgr_events_register_callback().
#define MAX_EVENT_PAYLOAD_SIZE 1024 |
#define MAX_EVENT_SIZE 10 |
#define MAX_GAP_EVENT_SUBSCRIBERS 3 |
#define MAX_GATT_CLIENT_EVENT_SUBSCRIBERS 3 |
Referenced by ble_mgr_event_manager(), and ble_mgr_events_register_callback().
#define MAX_GATT_SERVER_EVENT_SUBSCRIBERS 3 |
Referenced by ble_mgr_event_manager(), and ble_mgr_events_register_callback().
#define MAX_GATT_TRANSPARENT_SUBSCRIBERS 3 |
Referenced by ble_mgr_event_manager(), and ble_mgr_events_register_callback().
#define MAX_PAIRING_SUBSCRIBERS 3 |
Referenced by ble_mgr_event_manager(), and ble_mgr_events_register_callback().
typedef struct _ble_common_event_cb_t ble_common_event_cb_t |
ble_event_callback_t |
BLE Event callback generic type.
typedef struct _ble_gap_event_cb_t ble_gap_event_cb_t |
typedef struct _ble_gatt_client_event_cb_t ble_gatt_client_event_cb_t |
typedef struct _ble_gatt_server_event_cb_t ble_gatt_server_event_cb_t |
typedef struct _ble_gatt_transparent_event_cb_t ble_gatt_transparent_event_cb_t |
typedef enum Advertisement_Data_Type ble_mgr_adv_data_type |
typedef struct _ble_pairing_event_cb_t ble_pairing_event_cb_t |
enum ble_mgr_event_t |
BLE Manager event type.
This event types are used to subscribe the Group of BLE Event callbacks or un-subscribe the group of BLE Event callbacks
enum ble_mgr_state_t |
ble_status_t ble_mgr_adv_start | ( | const uint8_t * | adv_data, |
uint8_t | adv_data_length, | ||
const uint8_t * | scan_resp_data, | ||
uint8_t | scan_reap_data_len | ||
) |
Set advertisement data, scan response data, advertisement parameters and start advertisement.
adv_data | Advertisement data. |
adv_data_length | Advertisement data length. |
scan_resp_data | Scan response data. |
scan_reap_data_len | Scan response data length. |
References ble_adv_data_set(), ble_adv_param_set(), ble_adv_start(), BLE_INVALID_COMMAND_PARAMETERS, ble_mgr_state, BLE_MGR_STATE_ADVERTISING, ble_scan_resp_data_set(), BLE_SUCCESS, BM_ADV_CONNECTABLE_UNDIRECTED, DBG_LOG, and NULL.
Referenced by app_disconnected_cb(), and main().
ble_status_t ble_mgr_adv_stop | ( | void | ) |
Stops ongoing advertisement.
None. |
References ble_adv_stop(), BLE_SUCCESS, and DBG_LOG.
Referenced by main().
ble_status_t ble_mgr_characteristic_indicate_set | ( | ble_handle_t | conn_handle, |
uint16_t | desc_handle, | ||
bool | enabled | ||
) |
Enable/disable characteristic indication.
conn_handle | Connection handle. |
desc_handle | Client characteristic config descriptor handle. |
enabled | Enable/disable the indication. |
References ble_characteristic_write_with_response(), BLE_GATT_INDICATE, and BLE_GATT_NONE.
ble_status_t ble_mgr_characteristic_notify_set | ( | ble_handle_t | conn_handle, |
uint16_t | desc_handle, | ||
bool | enabled | ||
) |
Enable/disable characteristic notification.
conn_handle | Connection handle. |
desc_handle | Client characteristic config descriptor handle. |
enabled | Enable/disable the notification. |
References ble_characteristic_write_with_response(), BLE_GATT_NONE, and BLE_GATT_NOTIFY.
Referenced by main().
bool ble_mgr_check_match_param | ( | ble_mgr_adv_report_event_t * | adv_report | ) |
Check against the matching parameter set by the user, it could be BLE address, RSSI threshold or advertisement payload.
adv_report | Advertisement report info got from scanning operation. |
References ble_mgr_adv_report_event_t::addr, ble_mgr_adv_report_match_param_t::addr, BLE_MATCHING_PARAM_ADDRESS, BLE_MATCHING_PARAM_PAYLOAD, BLE_MATCHING_PARAM_RSSI, ble_mgr_adv_report_event_t::data, ble_mgr_adv_report_match_param_t::data, ble_mgr_adv_report_match_param_t::data_len, ble_mgr_adv_report_match_param_t::data_start, ble_mgr_adv_report_match_param_t::matching_param, ble_mgr_adv_report_event_t::rssi, and ble_mgr_adv_report_match_param_t::rssi.
Referenced by ble_mgr_adv_report_cb().
ble_status_t ble_mgr_device_init | ( | void | ) |
Initialize platform, callback events and BLE interface.
None. |
References ble_init(), ble_mgr_init(), BLE_SUCCESS, BM_MODE_Init(), DBG_LOG, and platform_init().
Referenced by main().
bool ble_mgr_events_register_callback | ( | ble_mgr_event_t | event_type, |
const void * | ble_event_handler | ||
) |
Register callback functions for BLE events.
event_type | Type of event, like GAP, GATT-Client, GATT-Server... etc. |
ble_event_handler | Function pointer to group of event handler callbacks. |
scan_resp_data | Scan response data. |
scan_reap_data_len | Scan response data length. |
References BLE_COMMON_EVENT_TYPE, BLE_GAP_EVENT_TYPE, BLE_GATT_CLIENT_EVENT_TYPE, BLE_GATT_SERVER_EVENT_TYPE, BLE_GATT_TP_EVENT_TYPE, BLE_PAIRING_EVENT_TYPE, MAX_COMMON_EVENT_SUBSCRIBERS, MAX_GAP_EVENT_SUBSCRIBERS, MAX_GATT_CLIENT_EVENT_SUBSCRIBERS, MAX_GATT_SERVER_EVENT_SUBSCRIBERS, MAX_GATT_TRANSPARENT_SUBSCRIBERS, MAX_PAIRING_SUBSCRIBERS, and NULL.
Referenced by app_init(), and ble_mgr_init().
event_status_t ble_mgr_get_event | ( | event_t * | event | ) |
Get BLE events and process them.
event | Carries event ID, parameters and length. |
References ble_event_get(), BLE_EVENT_SUCCESS, and ble_mgr_event_manager().
Referenced by main().
void ble_mgr_peripheral_device_match_params | ( | ble_mgr_adv_report_match_param_t * | match_param | ) |
Sets a matching parameter to find and connect with the device.
match_param | Matching parameter, it could be BLE address, RSSI threshold or advertisement payload. |
Referenced by main().
ble_status_t ble_mgr_scan_start | ( | void | ) |
Sets BLE scan parameters and starts scanning.
None. |
References ble_mgr_state, BLE_MGR_STATE_SCANNING, BLE_SCAN_ACTIVE, BLE_SCAN_DUPLICATE_FILTER_ENABLED, BLE_SCAN_ENABLED, ble_scan_param_set(), ble_scan_start(), BLE_SUCCESS, DBG_LOG, DEFAULT_SCAN_INTERVAL, and DEFAULT_SCAN_WINDOW.
Referenced by app_disconnected_cb(), and main().
ble_status_t ble_mgr_scan_stop | ( | void | ) |
Stops the ongoing BLE scan.
None. |
References ble_mgr_state, BLE_MGR_STATE_INIT, BLE_SCAN_DISABLED, BLE_SCAN_DUPLICATE_FILTER_ENABLED, ble_scan_start(), BLE_SUCCESS, and DBG_LOG.
Referenced by app_disconnected_cb(), and main().
ble_status_t ble_mgr_start_connection | ( | ble_addr_t * | address | ) |
Initiate a connection based on remote device address.
address | Address of remote device. |
References BLE_CONN_WHITELIST_FILTER_DISABLED, ble_create_connection(), BLE_SUCCESS, and DBG_LOG.
ble_status_t ble_mgr_transparent_uart_disable | ( | ble_handle_t | conn_handle | ) |
Disables transparentUART with remote device.
conn_handle | Connection handle of remote device. |
References BLE_SUCCESS, ble_transparent_uart_enable(), PACKED::conn_handle, and DBG_LOG.
Referenced by app_disconnected_cb().
ble_status_t ble_mgr_transparent_uart_enable | ( | ble_handle_t | conn_handle | ) |
Enables transparentUART with remote device.
conn_handle | Connection handle of remote device. |
References BLE_SUCCESS, ble_transparent_uart_enable(), PACKED::conn_handle, and DBG_LOG.
Referenced by app_connected_cb().
ble_status_t ble_mgr_transparent_uart_send | ( | ble_handle_t | conn_handle, |
const uint8_t * | data, | ||
uint8_t | datalen | ||
) |
Sends transparentUART data to remote device.
conn_handle | Connection handle of remote device. |
data | Data that needs to be sent to remote device. |
datalen | Length of data that needs to be sent to remote device. |
References BLE_SUCCESS, ble_transparent_uart_data_send(), DBG_LOG, and DBG_LOG_CONT.
Referenced by app_send_transparent_uart_data().