Microchip® Advanced Software Framework

ble_api.c File Reference

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
 

Functions

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)
 
ble_status_t ble_adv_start (void)
 
ble_status_t ble_adv_stop (void)
 
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 ble_status_t ble_characteristic_value_read_by_uuid_parser (void *data, uint16_t *data_len)
 
static ble_status_t ble_characteristic_value_read_parser (void *data, uint16_t *data_len)
 
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)
 
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 ble_status_t ble_command_complete_parser (BM_APPLICATION_CMD_OPCODE cmd_id)
 
ble_status_t ble_create_connection (ble_connection_filter_t conn_filter, ble_addr_t *address)
 
void ble_disconnect_device (uint8_t conn_handle)
 
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)
 
static ble_status_t ble_gatt_service_create_parser (uint16_t *handle)
 
ble_status_t ble_gatt_service_read (ble_service_t *ble_service)
 
static ble_status_t ble_gatt_service_read_parser (uint16_t *handle)
 
ble_status_t ble_init (platform_init_t *platform_init)
 
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 ()
 
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)
 
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 ble_status_t ble_rssi_read_parser (uint8_t *rssi)
 
ble_status_t ble_scan_param_set (uint16_t scan_interval, uint16_t scan_window, ble_scan_type_t scan_type)
 
ble_status_t ble_scan_resp_data_set (uint8_t const *scan_data, uint8_t scan_data_len)
 
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)
 
ble_status_t ble_set_device_name (const uint8_t *device_name, uint8_t length)
 
ble_status_t ble_shutdown (void)
 
static ble_status_t ble_status_report_parser (bledk3_status_t status_mode)
 
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)
 
ble_status_t ble_update_connection_parameters (uint8_t conn_handle, ble_conn_param_t *conn_param)
 
ble_status_t ble_write_response_send (ble_handle_t conn_handle, ble_handle_t attr_handle, uint8_t err_code)
 

Variables

BM_APPLICATION_CMDPKTapplication_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_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_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_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 ble_status_t ble_characteristic_value_read_by_uuid_parser ( void *  data,
uint16_t *  data_len 
)
static
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 ble_status_t ble_command_complete_parser ( BM_APPLICATION_CMD_OPCODE  cmd_id)
static
void ble_disconnect_device ( uint8_t  conn_handle)
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 ble_status_t ble_gatt_service_create_parser ( uint16_t *  handle)
static
static ble_status_t ble_gatt_service_read_parser ( uint16_t *  handle)
static
static ble_status_t ble_rssi_read_parser ( uint8_t *  rssi)
static
static ble_status_t ble_status_report_parser ( bledk3_status_t  status_mode)
static

BM_APPLICATION_CMDPKT* application_cmdpkt = NULL
uart_read_async_cb_t ble_uart_receive_async
uart_write_sync_cb_t ble_uart_send_sync