BLE API definitions.
Copyright (c) 2018-2021 Microchip Technology Inc. and its subsidiaries.
#include "platform_files.h"
#include "stdlib.h"
#include "string.h"
#include "bm_mode.h"
#include "bm_application_mode.h"
#include "bm_utils.h"
#include "event_mem.h"
#include "ble_api.h"
#include "interface.h"
Macros | |
#define | SERVICE_DISCO_EVENT_BUFFER_LENGTH 127 |
Variables | |
BM_APPLICATION_CMDPKT * | application_cmdpkt = NULL |
uart_read_async_cb_t | ble_uart_receive_async |
uart_write_sync_cb_t | ble_uart_send_sync |
#define SERVICE_DISCO_EVENT_BUFFER_LENGTH 127 |
Referenced by ble_gatt_service_read().
ble_status_t ble_adv_data_set | ( | uint8_t const * | adv_data, |
uint8_t | adv_data_len | ||
) |
ble_status_t ble_adv_param_set | ( | BM_ADV_TYPE | type, |
ble_addr_t * | peer_addr, | ||
uint16_t | interval | ||
) |
References PACKED::addr, ADV_PARAM_DIRECT_ADDR_INDEX, ADV_PARAM_DIRECT_ADDR_TYPE_INDEX, ADV_PARAM_INTERVAL_INDEX_HIGH, ADV_PARAM_INTERVAL_INDEX_LOW, ADV_PARAM_TYPE_INDEX, AT_BLE_ADV_INTERVAL_MAX, AT_BLE_ADV_INTERVAL_MIN, BLE_ADDR_LEN, ble_command_complete_parser(), BLE_INVALID_COMMAND_PARAMETERS, BLE_SUCCESS, BM_ADV_PARAM_SET, BM_ADV_PROPRIETARY_BEACON, BM_APPLICATION_AdvertisementParameterSetPkt(), COMMAND_COMPLETE, interface_cmd_send_wait(), NULL, and PACKED::type.
Referenced by app_adv_param_set(), app_ibeacon_init(), and ble_mgr_adv_start().
ble_status_t ble_adv_start | ( | void | ) |
ble_status_t ble_adv_stop | ( | void | ) |
References ble_command_complete_parser(), BLE_SUCCESS, BM_APPLICATION_AdvertisementEnableSetPkt(), BM_SET_ADV_ENABLE, COMMAND_COMPLETE, and interface_cmd_send_wait().
Referenced by ble_mgr_adv_stop().
ble_status_t ble_cancel_connection | ( | void | ) |
ble_status_t ble_characteristic_attribute_read_request | ( | ble_handle_t | conn_handle, |
ble_handle_t | characteristic_handle, | ||
uint16_t | offset | ||
) |
ble_status_t ble_characteristic_attribute_read_response | ( | ble_handle_t | conn_handle, |
ble_handle_t | characteristic_handle, | ||
uint8_t * | data, | ||
uint16_t | length | ||
) |
ble_status_t ble_characteristic_read | ( | ble_handle_t | conn_handle, |
ble_handle_t | characteristic_handle, | ||
void * | data, | ||
uint16_t * | data_len | ||
) |
ble_status_t ble_characteristic_read_by_uuid | ( | ble_handle_t | conn_handle, |
ble_uuid_t * | characteristic_uuid, | ||
void * | data, | ||
uint16_t * | data_len | ||
) |
ble_status_t ble_characteristic_reliable_write_request_cancel | ( | ble_handle_t | conn_handle | ) |
ble_status_t ble_characteristic_reliable_write_request_execute | ( | ble_handle_t | conn_handle | ) |
ble_status_t ble_characteristic_reliable_write_request_prepare | ( | ble_handle_t | conn_handle, |
ble_handle_t | characteristic_handle, | ||
uint16_t | offset, | ||
uint8_t * | data, | ||
uint16_t | length | ||
) |
ble_status_t ble_characteristic_reliable_write_response_execute | ( | ble_handle_t | conn_handle | ) |
ble_status_t ble_characteristic_reliable_write_response_prepare | ( | ble_handle_t | conn_handle, |
ble_handle_t | characteristic_handle, | ||
uint16_t | offset, | ||
uint8_t * | data, | ||
uint16_t | length | ||
) |
ble_status_t ble_characteristic_value_read | ( | ble_handle_t | characteristic_handle, |
void * | data, | ||
uint16_t * | data_len | ||
) |
|
static |
References BLE_FAILURE, BLE_SUCCESS, BM_CLIENT_CHARACTERISTIC_UUID_READ, event_msg_t::data, event_msg_t::data_len, data_len, event_t::event_msg, and get_received_cmd_frame().
Referenced by ble_characteristic_read_by_uuid().
|
static |
ble_status_t ble_characteristic_value_send | ( | ble_handle_t | conn_handle, |
ble_handle_t | characteristic_handle, | ||
uint8_t * | data, | ||
uint16_t | length | ||
) |
ble_status_t ble_characteristic_value_update | ( | ble_handle_t | characteristic_handle, |
uint8_t * | data, | ||
uint16_t | length | ||
) |
ble_status_t ble_characteristic_write_with_response | ( | ble_handle_t | conn_handle, |
ble_handle_t | characteristic_handle, | ||
uint8_t * | data, | ||
uint16_t | length | ||
) |
References ble_command_complete_parser(), BLE_INVALID_COMMAND_PARAMETERS, BLE_SUCCESS, BM_APPLICATION_ClientCharacteristicHandleWritePkt(), BM_CLIENT_CHARACTERISTIC_WRITE, COMMAND_COMPLETE, interface_cmd_send_wait(), and NULL.
Referenced by ble_mgr_characteristic_indicate_set(), and ble_mgr_characteristic_notify_set().
ble_status_t ble_characteristic_write_without_respose | ( | ble_handle_t | conn_handle, |
ble_handle_t | characteristic_handle, | ||
uint8_t * | data, | ||
uint16_t | length | ||
) |
|
static |
References BLE_COMMAND_DISALLOWED, event_msg_t::data, event_t::event_msg, and get_received_cmd_frame().
Referenced by ble_adv_data_set(), ble_adv_param_set(), ble_adv_start(), ble_adv_stop(), ble_cancel_connection(), ble_characteristic_attribute_read_request(), ble_characteristic_attribute_read_response(), ble_characteristic_reliable_write_request_cancel(), ble_characteristic_reliable_write_request_execute(), ble_characteristic_reliable_write_request_prepare(), ble_characteristic_reliable_write_response_execute(), ble_characteristic_reliable_write_response_prepare(), ble_characteristic_value_send(), ble_characteristic_value_update(), ble_characteristic_write_with_response(), ble_characteristic_write_without_respose(), ble_error_response_send(), ble_pair_device_delete(), ble_pair_device_erase_all(), ble_pair_mode_get(), ble_pair_mode_set(), ble_pair_passkey_clear(), ble_pair_passkey_confirm(), ble_pair_passkey_enter(), ble_pair_passkey_erase_digits(), ble_pair_passkey_reply(), ble_pair_request(), ble_primary_service_characteristics_discover(), ble_primary_service_characteristics_read(), ble_primary_service_read_all(), ble_read_response_send(), ble_scan_param_set(), ble_scan_resp_data_set(), ble_scan_start(), ble_set_connection_params(), ble_set_device_name(), ble_shutdown(), ble_transparent_uart_data_send(), ble_transparent_uart_enable(), ble_update_connection_parameters(), and ble_write_response_send().
ble_status_t ble_create_connection | ( | ble_connection_filter_t | conn_filter, |
ble_addr_t * | address | ||
) |
References PACKED::addr, BLE_INVALID_COMMAND_PARAMETERS, BM_APPLICATION_ConnectDevicePkt(), interface_cmd_send_no_wait(), NULL, and PACKED::type.
Referenced by ble_mgr_adv_report_cb(), and ble_mgr_start_connection().
void ble_disconnect_device | ( | uint8_t | conn_handle | ) |
References BM_APPLICATION_DisconnectDevicePkt(), and interface_cmd_send_no_wait().
ble_status_t ble_error_response_send | ( | ble_handle_t | conn_handle, |
ble_handle_t | characteristic_handle, | ||
uint8_t | req_opcode, | ||
uint8_t | err_code | ||
) |
ble_status_t ble_gatt_service_create | ( | ble_service_t * | ble_service | ) |
References PACKED::additional_desc_count, PACKED::additional_desc_list, BLE_ATT_ATTRIBUTE_VALUE_LEN, BLE_ATTRIB_UUID_LENGTH_2, ble_gatt_service_create_parser(), BLE_INSUFFICIENT_RESOURCES, BLE_INVALID_COMMAND_PARAMETERS, BLE_MAX_SERVICE_BUF_LEN, BLE_SUCCESS, BLE_UUID_128B, BLE_UUID_128B_LEN, BLE_UUID_16B, BLE_UUID_16B_LEN, BM_APPLICATION_ServerCreateService(), ble_client_char_config_desc_t::ccd_included, PACKED::ccd_value, ble_client_char_config_desc_t::ccd_value, PACKED::char_count, CHAR_EXTENDED_PROPERTIES, PACKED::char_handle, PACKED::char_list, CHAR_PRESENTATION_FORMAT, CHAR_USER_DESCRIPTION, PACKED::char_val, CLIENT_CHAR_CONFIGURATION, PACKED::client_config_desc, COMMAND_COMPLETE, PACKED::desc_uuid, PACKED::desc_val_length, PACKED::desc_value, PACKED::description, PACKED::end_handle, PACKED::ep_included, PACKED::exponent, PACKED::ext_properties, PACKED::ext_property, PACKED::extend_property, PACKED::format, PACKED::handle, ble_client_char_config_desc_t::handle, PACKED::init_value, interface_cmd_send_wait(), PACKED::len, PACKED::length, PACKED::name_space, NULL, ble_client_char_config_desc_t::perm, PACKED::perm, PACKED::permission, PACKED::permissions, PACKED::pf_included, PACKED::presentation_format, PACKED::properties, SECONDARY_SERVICE, SERVER_CHAR_CONFIGURATION, PACKED::server_config_desc, PACKED::start_handle, PACKED::type, ble_uuid_t::type, PACKED::type_length, PACKED::ud_length, PACKED::unit, PACKED::user_desc, ble_uuid_t::uuid, PACKED::uuid, ble_uuid_val_t::uuid_128b, ble_uuid_val_t::uuid_16b, UUID_CHARACTERISTIC, UUID_PRIMARY_SERVICE, UUID_SECONDARY_SERVICE, PACKED::value, PACKED::value_handle, and PACKED::value_length.
|
static |
References BLE_FAILURE, BLE_SUCCESS, BM_SERVER_CREATE_SERVICE_REQUEST, event_msg_t::data, event_t::event_msg, and get_received_cmd_frame().
Referenced by ble_gatt_service_create().
ble_status_t ble_gatt_service_read | ( | ble_service_t * | ble_service | ) |
References ble_event_get(), BLE_EVENT_Q_EMPTY, ble_gatt_service_read_parser(), BLE_SUCCESS, BLE_UUID_128B_LEN, BLE_UUID_16B_LEN, BM_APPLICATION_ServerReadService(), BM_CLIENT_DISCOVER_CHARACTERISTICS_DESCRIPTORS_RESULT, BM_CLIENT_DISCOVER_CHARACTERISTICS_RESULT, PACKED::char_count, PACKED::char_handle, PACKED::char_list, PACKED::char_val, PACKED::client_config_desc, COMMAND_COMPLETE, event_msg_t::data, event_t::event_id, event_t::event_msg, PACKED::handle, ble_client_char_config_desc_t::handle, i, interface_cmd_send_wait(), memcpy_inplace_reorder(), NULL, PACKED::properties, SERVICE_DISCO_EVENT_BUFFER_LENGTH, PACKED::uuid, ble_uuid_val_t::uuid_128b, ble_uuid_val_t::uuid_16b, and PACKED::value_handle.
Referenced by main().
|
static |
References BLE_FAILURE, BLE_SUCCESS, BM_SERVER_SERVICE_READ, event_msg_t::data, event_t::event_msg, and get_received_cmd_frame().
Referenced by ble_gatt_service_read().
ble_status_t ble_init | ( | platform_init_t * | platform_init | ) |
References ble_status_report_parser(), BLE_SUCCESS, BM_APPLICATION_Init(), BM_APPLICATION_PatternSetPkt(), BM_APPLICATION_ResetPkt(), BM_MODE_APPLICATION, BM_PATTERN_SET, COMMAND_COMPLETE, i, IDLE_MODE, interface_cmd_send_wait(), interface_cmd_send_wait_time(), interface_event_wait_time(), interface_init(), ble_platform_api_list_t::mode_set, platform_init_t::platform_api_list, and STATUS_REPORT.
Referenced by ble_device_init(), ble_dtm_init(), ble_mgr_device_init(), and main().
ble_status_t ble_pair_device_delete | ( | uint8_t | index | ) |
ble_status_t ble_pair_device_erase_all | ( | void | ) |
ble_status_t ble_pair_mode_get | ( | void | ) |
ble_status_t ble_pair_mode_set | ( | BM_PAIR_MODE | mode | ) |
ble_status_t ble_pair_passkey_clear | ( | ble_handle_t | conn_handle | ) |
ble_status_t ble_pair_passkey_confirm | ( | ble_handle_t | conn_handle, |
ble_pair_confirm_t | confirm | ||
) |
ble_status_t ble_pair_passkey_enter | ( | ble_handle_t | conn_handle, |
uint8_t * | passkey, | ||
uint8_t | length | ||
) |
ble_status_t ble_pair_passkey_erase_digits | ( | ble_handle_t | conn_handle, |
uint8_t | length | ||
) |
ble_status_t ble_pair_passkey_reply | ( | ble_handle_t | conn_handle | ) |
ble_status_t ble_pair_request | ( | ble_handle_t | conn_handle | ) |
ble_status_t ble_primary_service_characteristics_discover | ( | ble_handle_t | conn_handle, |
ble_uuid_t * | service_uuid | ||
) |
References ble_command_complete_parser(), BLE_INVALID_COMMAND_PARAMETERS, BLE_SUCCESS, BLE_UUID_INVALID, BM_APPLICATION_ClientCharacteristicsDiscoverPkt(), BM_CLIENT_DISCOVER_CHARACTERISTICS, COMMAND_COMPLETE, interface_cmd_send_wait(), NULL, ble_uuid_t::type, and ble_uuid_t::uuid.
Referenced by main().
ble_status_t ble_primary_service_characteristics_read | ( | ble_uuid_t * | service_uuid | ) |
ble_status_t ble_primary_service_discover_all | ( | ble_handle_t | conn_handle | ) |
ble_status_t ble_primary_service_read_all | ( | void | ) |
ble_status_t ble_read_response_send | ( | ble_handle_t | conn_handle, |
uint8_t | rsp_type, | ||
uint8_t * | data, | ||
uint16_t | length | ||
) |
ble_status_t ble_rssi_read | ( | uint8_t | conn_handle, |
uint8_t * | rssi | ||
) |
|
static |
References BLE_FAILURE, BLE_SUCCESS, BM_RSSI_READ, event_msg_t::data, event_t::event_msg, and get_received_cmd_frame().
Referenced by ble_rssi_read().
ble_status_t ble_scan_param_set | ( | uint16_t | scan_interval, |
uint16_t | scan_window, | ||
ble_scan_type_t | scan_type | ||
) |
References ble_command_complete_parser(), BLE_INVALID_COMMAND_PARAMETERS, BLE_SCAN_ACTIVE, BLE_SUCCESS, BM_APPLICATION_ScanParameterSetPkt(), BM_SCAN_PARAM_SET, COMMAND_COMPLETE, interface_cmd_send_wait(), MAX_SCAN_INTERVAL, MAX_SCAN_WINDOW, MIN_SCAN_INTERVAL, and MIN_SCAN_WINDOW.
Referenced by ble_mgr_scan_start().
ble_status_t ble_scan_resp_data_set | ( | uint8_t const * | scan_data, |
uint8_t | scan_data_len | ||
) |
References ble_command_complete_parser(), BLE_INVALID_COMMAND_PARAMETERS, BLE_SUCCESS, BM_APPLICATION_ScanDataWritePkt(), BM_SCAN_DATA_WRITE, COMMAND_COMPLETE, interface_cmd_send_wait(), and NULL.
Referenced by app_adv_param_set(), and ble_mgr_adv_start().
ble_status_t ble_scan_start | ( | ble_scan_enable_t | scan_enable, |
ble_scan_duplicate_filter_t | scan_dup_filter | ||
) |
ble_status_t ble_set_connection_params | ( | ble_set_conn_param_t * | conn_params | ) |
References ble_command_complete_parser(), BLE_INVALID_COMMAND_PARAMETERS, BLE_SUCCESS, BM_APPLICATION_ConnParameterSetPkt(), BM_CONN_PARAM_SET, COMMAND_COMPLETE, PACKED::conn_latency, interface_cmd_send_wait(), PACKED::link_sv_to, PACKED::max_conn_interval, PACKED::min_conn_interval, and NULL.
Referenced by main().
ble_status_t ble_set_device_name | ( | const uint8_t * | device_name, |
uint8_t | length | ||
) |
References ble_command_complete_parser(), BLE_INVALID_COMMAND_PARAMETERS, BLE_SUCCESS, BM_APPLICATION_DeviceNameWritePkt(), BM_NAME_WRITE, COMMAND_COMPLETE, interface_cmd_send_wait(), and NULL.
Referenced by ble_device_init().
ble_status_t ble_shutdown | ( | void | ) |
|
static |
References BLE_FAILURE, BLE_SUCCESS, event_msg_t::data, event_t::event_msg, and get_received_cmd_frame().
Referenced by ble_init().
ble_status_t ble_transparent_uart_data_send | ( | ble_handle_t | conn_handle, |
uint8_t * | data, | ||
uint8_t | datalen | ||
) |
ble_status_t ble_transparent_uart_enable | ( | ble_enable_transparent_uart_t * | enable_transparent_uart | ) |
References ble_command_complete_parser(), BLE_INVALID_COMMAND_PARAMETERS, BLE_SUCCESS, BM_APPLICATION_EnableTransparentUartSetPkt(), BM_TRANSPARENT_ENABLE, PACKED::client_transparent_mode, COMMAND_COMPLETE, PACKED::conn_handle, interface_cmd_send_wait(), NULL, and PACKED::server_transparent_cntrl.
Referenced by ble_mgr_transparent_uart_disable(), and ble_mgr_transparent_uart_enable().
ble_status_t ble_update_connection_parameters | ( | uint8_t | conn_handle, |
ble_conn_param_t * | conn_param | ||
) |
References ble_command_complete_parser(), BLE_INVALID_COMMAND_PARAMETERS, BLE_SUCCESS, BM_APPLICATION_ConnectionParameterUpdatePkt(), BM_CONNECTION_PARAM_UPDATE, COMMAND_COMPLETE, PACKED::conn_interval, PACKED::conn_latency, interface_cmd_send_wait(), PACKED::link_sv_to, MAX_CONN_INTERVAL, MAX_SLAVE_LATENCY, MAX_SV_TIMEOUT, MIN_CONN_INTERVAL, MIN_SV_TIMEOUT, and NULL.
ble_status_t ble_write_response_send | ( | ble_handle_t | conn_handle, |
ble_handle_t | attr_handle, | ||
uint8_t | err_code | ||
) |
BM_APPLICATION_CMDPKT* application_cmdpkt = NULL |
uart_read_async_cb_t ble_uart_receive_async |
uart_write_sync_cb_t ble_uart_send_sync |