SmartSnippets DA1459x SDK
Files | Data Structures | Macros | Typedefs | Enumerations | Functions

API. More...

Files

file  ble_att.h
 Attribute protocol API.
 
file  ble_attribdb.h
 Helper to manage complex attributes database.
 
file  ble_bufops.h
 Helpers to put and get data from BLE buffers.
 
file  ble_common.h
 Common definitions for BLE API.
 
file  ble_gap.h
 BLE GAP API.
 
file  ble_gatt.h
 Common definitions for GATT API.
 
file  ble_gattc.h
 BLE GATT Client API.
 
file  ble_gattc_util.h
 BLE GATT Client Utilities API.
 
file  ble_gatts.h
 BLE GATT Server API.
 
file  ble_l2cap.h
 LE L2CAP connection oriented channels API.
 
file  ble_storage.h
 BLE persistent storage API.
 
file  ble_uuid.h
 BLE UUID declarations.
 

Data Structures

struct  ble_attribdb_value_t
 
struct  ble_evt_hdr_t
 
struct  bd_address
 
struct  own_address
 
struct  irk_t
 
struct  ble_evt_reset_completed_t
 
struct  gap_adv_ad_struct_t
 
struct  gap_device_t
 
union  gap_device_filter_data_t
 
struct  gap_sec_key_t
 
struct  gap_chnl_map
 
struct  gap_conn_params_t
 
struct  gap_scan_params_t
 
struct  ble_evt_gap_connected_t
 
struct  ble_evt_gap_disconnected_t
 
struct  ble_evt_gap_disconnect_failed_t
 
struct  ble_evt_gap_conn_param_update_req_t
 
struct  ble_evt_gap_conn_param_update_completed_t
 
struct  ble_evt_gap_conn_param_updated_t
 
struct  ble_evt_gap_adv_completed_t
 
struct  ble_evt_gap_adv_report_t
 
struct  ble_evt_gap_scan_completed_t
 
struct  ble_evt_gap_pair_req_t
 
struct  ble_evt_gap_pair_completed_t
 
struct  ble_evt_gap_security_request_t
 
struct  ble_evt_gap_passkey_notify_t
 
struct  ble_evt_gap_passkey_request_t
 
struct  ble_evt_gap_address_resolved_t
 
struct  ble_evt_gap_address_resolution_failed_t
 
struct  ble_evt_gap_sec_level_changed_t
 
struct  ble_evt_gap_set_sec_level_failed_t
 
struct  ble_evt_gap_data_length_changed_t
 
struct  ble_evt_gap_data_length_set_failed_t
 
struct  ble_evt_gap_connection_completed_t
 
struct  ble_evt_gap_ltk_missing_t
 
struct  ble_evt_gap_air_op_bdaddr_t
 
struct  ble_evt_gap_peer_version_t
 
struct  ble_evt_gap_peer_features_t
 
struct  gattc_item_t
 
struct  ble_evt_gattc_browse_svc_t
 
struct  ble_evt_gattc_browse_completed_t
 
struct  ble_evt_gattc_discover_svc_t
 
struct  ble_evt_gattc_discover_include_t
 
struct  ble_evt_gattc_discover_char_t
 
struct  ble_evt_gattc_discover_desc_t
 
struct  ble_evt_gattc_discover_completed_t
 
struct  ble_evt_gattc_read_completed_t
 
struct  ble_evt_gattc_write_completed_t
 
struct  ble_evt_gattc_notification_t
 
struct  ble_evt_gattc_indication_t
 
struct  ble_evt_gattc_mtu_changed_t
 
struct  ble_evt_gatts_read_req_t
 
struct  ble_evt_gatts_write_req_t
 
struct  ble_evt_gatts_prepare_write_req_t
 
struct  ble_evt_gatts_event_sent_t
 
struct  ble_evt_l2cap_connected_t
 
struct  ble_evt_l2cap_connection_failed_t
 
struct  ble_evt_l2cap_connection_req_t
 
struct  ble_evt_l2cap_disconnected_t
 
struct  ble_evt_l2cap_credit_changed_t
 
struct  ble_evt_l2cap_data_ind_t
 
struct  ble_evt_l2cap_sent_t
 

Macros

#define BLE_APP_NOTIFY_MASK   (1 << 0)
 
#define BLE_EVT_CAT_FIRST(CAT)   (CAT << 8)
 
#define LOW_POWER_ALL_PHYS   ( 0x01 )
 
#define HIGH_PERFORMANCE_ALL_PHYS   ( 0x02 )
 
#define BLE_ADV_DATA_LEN_MAX   (ADV_DATA_LEN - 3)
 
#define BLE_NON_CONN_ADV_DATA_LEN_MAX   (ADV_DATA_LEN)
 
#define BLE_SCAN_RSP_LEN_MAX   (SCAN_RSP_DATA_LEN)
 
#define BLE_GAP_CHANNEL_MAP_LEN   (LE_CHNL_MAP_LEN)
 
#define BLE_GAP_MAX_CONNECTED   (dg_configBLE_CONNECTIONS_MAX)
 
#define BLE_GAP_MAX_BONDED   (defaultBLE_MAX_BONDED)
 
#define BLE_ADV_INTERVAL_FROM_MS(MS)   ((MS) * 1000 / 625)
 
#define BLE_ADV_INTERVAL_TO_MS(VAL)   ((VAL) * 625 / 1000)
 
#define BLE_SCAN_INTERVAL_FROM_MS(MS)   ((MS) * 1000 / 625)
 
#define BLE_SCAN_INTERVAL_TO_MS(VAL)   ((VAL) * 625 / 1000)
 
#define BLE_SCAN_WINDOW_FROM_MS(MS)   ((MS) * 1000 / 625)
 
#define BLE_SCAN_WINDOW_TO_MS(VAL)   ((VAL) * 625 / 1000)
 
#define BLE_CONN_EVENT_LENGTH_FROM_MS(MS)   ((MS) * 1000 / 625)
 
#define BLE_CONN_EVENT_LENGTH_TO_MS(VAL)   ((VAL) * 625 / 1000)
 
#define BLE_CONN_INTERVAL_FROM_MS(MS)   ((MS) * 100 / 125)
 
#define BLE_CONN_INTERVAL_TO_MS(VAL)   ((VAL) * 125 / 100)
 
#define BLE_SUPERVISION_TMO_FROM_MS(MS)   ((MS) / 10)
 
#define BLE_SUPERVISION_TMO_TO_MS(VAL)   ((VAL) * 10)
 
#define BLE_CONN_IDX_INVALID   (0xFFFF)
 
#define BLE_RSSI_NOT_AVAILABLE   (127)
 
#define BLE_ENC_KEY_SIZE_MAX   (16)
 
#define GAP_ADV_AD_STRUCT(_ad_data_type, _ad_data_len, _ad_data)
 
#define GAP_ADV_AD_STRUCT_BYTES(_ad_data_type, _ad_data_bytes...)
 
#define GAP_ADV_AD_STRUCT_DECLARE(_ad_data_type, _ad_data_len, _ad_data)
 
#define BLE_STORAGE_KEY_SRV(handle)   (BLE_STORAGE_KEYCAT_SRV | (handle & 0xFFFF))
 
#define BLE_STORAGE_KEY_CLI(handle)   (BLE_STORAGE_KEYCAT_CLI | (handle & 0xFFFF))
 
#define BLE_STORAGE_KEY_APP(app_id, val_id)   (BLE_STORAGE_KEYCAT_APP | ((app_id & 0xFF) << 16) | (val_id & 0xFFFF))
 

Typedefs

typedef enum addr_types addr_type_t
 
typedef enum own_addr_types own_addr_type_t
 
typedef struct bd_address bd_address_t
 
typedef struct own_address own_address_t
 
typedef struct gap_chnl_map gap_chnl_map_t
 
typedef void(* ble_storage_free_cb_t) (void *ptr)
 Callback to free buffer stored in storage. More...
 
typedef uint32_t ble_storage_key_t
 Storage key (for indexing values in storage) More...
 

Enumerations

enum  att_perm_t
 
enum  att_error_t
 
enum  ble_error_t {
  BLE_STATUS_OK = 0x00, BLE_ERROR_FAILED = 0x01, BLE_ERROR_ALREADY_DONE = 0x02, BLE_ERROR_IN_PROGRESS = 0x03,
  BLE_ERROR_INVALID_PARAM = 0x04, BLE_ERROR_NOT_ALLOWED = 0x05, BLE_ERROR_NOT_CONNECTED = 0x06, BLE_ERROR_NOT_SUPPORTED = 0x07,
  BLE_ERROR_NOT_ACCEPTED = 0x08, BLE_ERROR_BUSY = 0x09, BLE_ERROR_TIMEOUT = 0x0A, BLE_ERROR_NOT_SUPPORTED_BY_PEER = 0x0B,
  BLE_ERROR_CANCELED = 0x0C, BLE_ERROR_ENC_KEY_MISSING = 0x0D, BLE_ERROR_INS_RESOURCES = 0x0E, BLE_ERROR_NOT_FOUND = 0x0F,
  BLE_ERROR_L2CAP_NO_CREDITS = 0x10, BLE_ERROR_L2CAP_MTU_EXCEEDED = 0x11, BLE_ERROR_INS_BANDWIDTH = 0x12, BLE_ERROR_LMP_COLLISION = 0x13,
  BLE_ERROR_DIFF_TRANS_COLLISION = 0x14
}
 
enum  ble_hci_error_t {
  BLE_HCI_ERROR_NO_ERROR = 0x00, BLE_HCI_ERROR_UNKNOWN_HCI_COMMAND = 0x01, BLE_HCI_ERROR_UNKNOWN_CONNECTION_ID = 0x02, BLE_HCI_ERROR_HARDWARE_FAILURE = 0x03,
  BLE_HCI_ERROR_PAGE_TIMEOUT = 0x04, BLE_HCI_ERROR_AUTH_FAILURE = 0x05, BLE_HCI_ERROR_PIN_MISSING = 0x06, BLE_HCI_ERROR_MEMORY_CAPA_EXCEED = 0x07,
  BLE_HCI_ERROR_CON_TIMEOUT = 0x08, BLE_HCI_ERROR_CON_LIMIT_EXCEED = 0x09, BLE_HCI_ERROR_SYNC_CON_LIMIT_DEV_EXCEED = 0x0A, BLE_HCI_ERROR_ACL_CON_EXISTS = 0x0B,
  BLE_HCI_ERROR_COMMAND_DISALLOWED = 0x0C, BLE_HCI_ERROR_CONN_REJ_LIMITED_RESOURCES = 0x0D, BLE_HCI_ERROR_CONN_REJ_SECURITY_REASONS = 0x0E, BLE_HCI_ERROR_CONN_REJ_UNACCEPTABLE_BDADDR = 0x0F,
  BLE_HCI_ERROR_CONN_ACCEPT_TIMEOUT_EXCEED = 0x10, BLE_HCI_ERROR_UNSUPPORTED = 0x11, BLE_HCI_ERROR_INVALID_HCI_PARAM = 0x12, BLE_HCI_ERROR_REMOTE_USER_TERM_CON = 0x13,
  BLE_HCI_ERROR_REMOTE_DEV_TERM_LOW_RESOURCES = 0x14, BLE_HCI_ERROR_REMOTE_DEV_POWER_OFF = 0x15, BLE_HCI_ERROR_CON_TERM_BY_LOCAL_HOST = 0x16, BLE_HCI_ERROR_REPEATED_ATTEMPTS = 0x17,
  BLE_HCI_ERROR_PAIRING_NOT_ALLOWED = 0x18, BLE_HCI_ERROR_UNKNOWN_LMP_PDU = 0x19, BLE_HCI_ERROR_UNSUPPORTED_REMOTE_FEATURE = 0x1A, BLE_HCI_ERROR_SCO_OFFSET_REJECTED = 0x1B,
  BLE_HCI_ERROR_SCO_INTERVAL_REJECTED = 0x1C, BLE_HCI_ERROR_SCO_AIR_MODE_REJECTED = 0x1D, BLE_HCI_ERROR_INVALID_LMP_PARAM = 0x1E, BLE_HCI_ERROR_UNSPECIFIED_ERROR = 0x1F,
  BLE_HCI_ERROR_UNSUPPORTED_LMP_PARAM_VALUE = 0x20, BLE_HCI_ERROR_ROLE_CHANGE_NOT_ALLOWED = 0x21, BLE_HCI_ERROR_LMP_RSP_TIMEOUT = 0x22, BLE_HCI_ERROR_LMP_COLLISION = 0x23,
  BLE_HCI_ERROR_LMP_PDU_NOT_ALLOWED = 0x24, BLE_HCI_ERROR_ENC_MODE_NOT_ACCEPT = 0x25, BLE_HCI_ERROR_LINK_KEY_CANT_CHANGE = 0x26, BLE_HCI_ERROR_QOS_NOT_SUPPORTED = 0x27,
  BLE_HCI_ERROR_INSTANT_PASSED = 0x28, BLE_HCI_ERROR_PAIRING_WITH_UNIT_KEY_NOT_SUP = 0x29, BLE_HCI_ERROR_DIFF_TRANSACTION_COLLISION = 0x2A, BLE_HCI_ERROR_QOS_UNACCEPTABLE_PARAM = 0x2C,
  BLE_HCI_ERROR_QOS_REJECTED = 0x2D, BLE_HCI_ERROR_CHANNEL_CLASS_NOT_SUP = 0x2E, BLE_HCI_ERROR_INSUFFICIENT_SECURITY = 0x2F, BLE_HCI_ERROR_PARAM_OUT_OF_MAND_RANGE = 0x30,
  BLE_HCI_ERROR_ROLE_SWITCH_PEND = 0x32, BLE_HCI_ERROR_RESERVED_SLOT_VIOLATION = 0x34, BLE_HCI_ERROR_ROLE_SWITCH_FAIL = 0x35, BLE_HCI_ERROR_EIR_TOO_LARGE = 0x36,
  BLE_HCI_ERROR_SP_NOT_SUPPORTED_HOST = 0x37, BLE_HCI_ERROR_HOST_BUSY_PAIRING = 0x38, BLE_HCI_ERROR_CONN_REJ_NO_SUITABLE_CHANNEL = 0x39, BLE_HCI_ERROR_CONTROLLER_BUSY = 0x3A,
  BLE_HCI_ERROR_UNACCEPTABLE_CONN_INT = 0x3B, BLE_HCI_ERROR_DIRECT_ADV_TO = 0x3C, BLE_HCI_ERROR_TERMINATED_MIC_FAILURE = 0x3D, BLE_HCI_ERROR_CONN_FAILED_TO_BE_EST = 0x3E,
  BLE_HCI_ERROR_MAC_CONNECTION_FAILED = 0x3F, BLE_HCI_ERROR_COARSE_CLK_ADJUST_REJECTED = 0x40
}
 
enum  ble_evt_cat
 
enum  ble_evt_common { BLE_EVT_RESET_COMPLETED = BLE_EVT_CAT_FIRST(BLE_EVT_CAT_COMMON) }
 Common events. More...
 
enum  ble_status_t
 
enum  addr_types { PUBLIC_ADDRESS = 0x00, PRIVATE_ADDRESS = 0x01 }
 
enum  own_addr_types { PUBLIC_STATIC_ADDRESS, PRIVATE_STATIC_ADDRESS, PRIVATE_RANDOM_RESOLVABLE_ADDRESS, PRIVATE_RANDOM_NONRESOLVABLE_ADDRESS }
 
enum  tx_power_level_type_t
 
enum  gap_appearance_t
 
enum  gap_data_type_t {
  GAP_DATA_TYPE_FLAGS = 0x01, GAP_DATA_TYPE_UUID16_LIST_INC = 0x02, GAP_DATA_TYPE_UUID16_LIST = 0x03, GAP_DATA_TYPE_UUID32_LIST_INC = 0x04,
  GAP_DATA_TYPE_UUID32_LIST = 0x05, GAP_DATA_TYPE_UUID128_LIST_INC = 0x06, GAP_DATA_TYPE_UUID128_LIST = 0x07, GAP_DATA_TYPE_SHORT_LOCAL_NAME = 0x08,
  GAP_DATA_TYPE_LOCAL_NAME = 0x09, GAP_DATA_TYPE_TX_POWER_LEVEL = 0x0A, GAP_DATA_TYPE_CLASS_OF_DEVICE = 0x0D, GAP_DATA_TYPE_SP_HASH_C = 0x0E,
  GAP_DATA_TYPE_SP_RANDOMIZER_R = 0x0F, GAP_DATA_TYPE_TK_VALUE = 0x10, GAP_DATA_TYPE_OOB_FLAGS = 0x11, GAP_DATA_TYPE_SLAVE_CONN_INTV = 0x12,
  GAP_DATA_TYPE_UUID16_SOLIC = 0x14, GAP_DATA_TYPE_UUID128_SOLIC = 0x15, GAP_DATA_TYPE_UUID16_SVC_DATA = 0x16, GAP_DATA_TYPE_PUBLIC_ADDRESS = 0x17,
  GAP_DATA_TYPE_RANDOM_ADDRESS = 0x18, GAP_DATA_TYPE_APPEARANCE = 0x19, GAP_DATA_TYPE_ADV_INTERVAL = 0x1A, GAP_DATA_TYPE_LE_BT_ADDR = 0x1B,
  GAP_DATA_TYPE_LE_ROLE = 0x1C, GAP_DATA_TYPE_SPAIR_HASH = 0x1D, GAP_DATA_TYPE_SPAIR_RAND = 0x1E, GAP_DATA_TYPE_UUID32_SOLIC = 0x1F,
  GAP_DATA_TYPE_UUID32_SVC_DATA = 0x20, GAP_DATA_TYPE_UUID128_SVC_DATA = 0x21, GAP_DATA_TYPE_LE_SEC_CONN_CFM_VAL = 0x22, GAP_DATA_TYPE_LE_SEC_CONN_RAND_VAL = 0x23,
  GAP_DATA_TYPE_URI = 0x24, GAP_DATA_TYPE_INDOOR_POSITIONING = 0x25, GAP_DATA_TYPE_TRANSPORT_DISC_DATA = 0x26, GAP_DATA_TYPE_LE_SUPP_FEATURES = 0x27,
  GAP_DATA_TYPE_CHNL_MAP_UPD_IND = 0x28, GAP_DATA_TYPE_PB_ADV = 0x29, GAP_DATA_TYPE_MESH_MESSAGE = 0x2A, GAP_DATA_TYPE_MESH_BEACON = 0x2B,
  GAP_DATA_TYPE_INFO_DATA_3D = 0x3D, GAP_DATA_TYPE_MANUFACTURER_SPEC = 0xFF
}
 
enum  gap_tx_power_t
 
enum  ble_evt_gap {
  BLE_EVT_GAP_CONNECTED = BLE_EVT_CAT_FIRST(BLE_EVT_CAT_GAP), BLE_EVT_GAP_ADV_REPORT, BLE_EVT_GAP_DISCONNECTED, BLE_EVT_GAP_DISCONNECT_FAILED,
  BLE_EVT_GAP_ADV_COMPLETED, BLE_EVT_GAP_SCAN_COMPLETED, BLE_EVT_GAP_CONN_PARAM_UPDATE_REQ, BLE_EVT_GAP_CONN_PARAM_UPDATED,
  BLE_EVT_GAP_PAIR_REQ, BLE_EVT_GAP_PAIR_COMPLETED, BLE_EVT_GAP_SECURITY_REQUEST, BLE_EVT_GAP_PASSKEY_NOTIFY,
  BLE_EVT_GAP_PASSKEY_REQUEST, BLE_EVT_GAP_SEC_LEVEL_CHANGED, BLE_EVT_GAP_ADDRESS_RESOLVED, BLE_EVT_GAP_SET_SEC_LEVEL_FAILED,
  BLE_EVT_GAP_CONN_PARAM_UPDATE_COMPLETED, BLE_EVT_GAP_DATA_LENGTH_CHANGED, BLE_EVT_GAP_DATA_LENGTH_SET_FAILED, BLE_EVT_GAP_CONNECTION_COMPLETED,
  BLE_EVT_GAP_NUMERIC_REQUEST, BLE_EVT_GAP_ADDRESS_RESOLUTION_FAILED, BLE_EVT_GAP_LTK_MISSING, BLE_EVT_GAP_AIR_OP_BDADDR,
  BLE_EVT_GAP_PEER_VERSION, BLE_EVT_GAP_PEER_FEATURES
}
 GAP events. More...
 
enum  gap_device_filter_t {
  GAP_DEVICE_FILTER_ALL, GAP_DEVICE_FILTER_CONNECTED, GAP_DEVICE_FILTER_BONDED, GAP_DEVICE_FILTER_ADDRESS,
  GAP_DEVICE_FILTER_CONN_IDX
}
 
enum  gap_role_t {
  GAP_NO_ROLE = 0x00, GAP_OBSERVER_ROLE = 0x01, GAP_BROADCASTER_ROLE = 0x02, GAP_CENTRAL_ROLE = 0x04,
  GAP_PERIPHERAL_ROLE = 0x08, GAP_ALL_ROLES = (GAP_OBSERVER_ROLE|GAP_BROADCASTER_ROLE|GAP_CENTRAL_ROLE|GAP_PERIPHERAL_ROLE)
}
 
enum  gap_air_op_t { GAP_AIR_OP_ADV = 0x01, GAP_AIR_OP_SCAN = 0x02, GAP_AIR_OP_INITIATE = 0x04 }
 
enum  gap_conn_mode_t { GAP_CONN_MODE_NON_CONN, GAP_CONN_MODE_UNDIRECTED, GAP_CONN_MODE_DIRECTED, GAP_CONN_MODE_DIRECTED_LDC }
 
enum  gap_disc_mode_t { GAP_DISC_MODE_NON_DISCOVERABLE, GAP_DISC_MODE_GEN_DISCOVERABLE, GAP_DISC_MODE_LIM_DISCOVERABLE, GAP_DISC_MODE_BROADCASTER }
 
enum  gap_adv_chnl_t { GAP_ADV_CHANNEL_37 = 0x01, GAP_ADV_CHANNEL_38 = 0x02, GAP_ADV_CHANNEL_39 = 0x04 }
 
enum  adv_filt_pol_t { ADV_ALLOW_SCAN_ANY_CONN_ANY, ADV_ALLOW_SCAN_WLIST_CONN_ANY, ADV_ALLOW_SCAN_ANY_CONN_WLIST, ADV_ALLOW_SCAN_WLIST_CONN_WLIST }
 
enum  {
  GAP_ADV_IND, GAP_ADV_DIRECT_IND, GAP_ADV_SCAN_IND, GAP_ADV_NONCONN_IND,
  GAP_SCAN_RSP
}
 
enum  gap_scan_type_t { GAP_SCAN_ACTIVE, GAP_SCAN_PASSIVE }
 
enum  gap_scan_mode_t { GAP_SCAN_GEN_DISC_MODE, GAP_SCAN_LIM_DISC_MODE, GAP_SCAN_OBSERVER_MODE }
 
enum  gap_auth_t { GAP_AUTH_NO_MITM_NO_BOND = 0x00, GAP_AUTH_NO_MITM_BOND = 0x01, GAP_AUTH_MITM_NO_BOND = 0x04, GAP_AUTH_MITM_BOND = 0x05 }
 
enum  gap_sec_level_t { GAP_SEC_LEVEL_1 = 0x00, GAP_SEC_LEVEL_2 = 0x01, GAP_SEC_LEVEL_3 = 0x02, GAP_SEC_LEVEL_4 = 0x03 }
 
enum  gap_io_cap_t {
  GAP_IO_CAP_DISP_ONLY = 0x00, GAP_IO_CAP_DISP_YES_NO = 0x01, GAP_IO_CAP_KEYBOARD_ONLY = 0x02, GAP_IO_CAP_NO_INPUT_OUTPUT = 0x03,
  GAP_IO_CAP_KEYBOARD_DISP = 0x04
}
 
enum  ble_gap_phy_t { BLE_GAP_PHY_1M = 0x01, BLE_GAP_PHY_2M = 0x02, BLE_GAP_PHY_CODED = 0x03 }
 
enum  ble_gap_phy_pref_t { BLE_GAP_PHY_PREF_AUTO = 0x00, BLE_GAP_PHY_PREF_1M = 0x01, BLE_GAP_PHY_PREF_2M = 0x02, BLE_GAP_PHY_PREF_CODED = 0x04 }
 
enum  gatt_service_t
 
enum  gatt_event_t
 
enum  gatt_prop_t
 
enum  gatt_ccc_t
 
enum  ble_evt_gattc {
  BLE_EVT_GATTC_BROWSE_SVC = BLE_EVT_CAT_FIRST(BLE_EVT_CAT_GATTC), BLE_EVT_GATTC_BROWSE_COMPLETED, BLE_EVT_GATTC_DISCOVER_SVC, BLE_EVT_GATTC_DISCOVER_INCLUDE,
  BLE_EVT_GATTC_DISCOVER_CHAR, BLE_EVT_GATTC_DISCOVER_DESC, BLE_EVT_GATTC_DISCOVER_COMPLETED, BLE_EVT_GATTC_READ_COMPLETED,
  BLE_EVT_GATTC_WRITE_COMPLETED, BLE_EVT_GATTC_NOTIFICATION, BLE_EVT_GATTC_INDICATION, BLE_EVT_GATTC_MTU_CHANGED
}
 
enum  gattc_item_type_t { GATTC_ITEM_TYPE_NONE, GATTC_ITEM_TYPE_INCLUDE, GATTC_ITEM_TYPE_CHARACTERISTIC, GATTC_ITEM_TYPE_DESCRIPTOR }
 
enum  gattc_discovery_type_t { GATTC_DISCOVERY_TYPE_SVC, GATTC_DISCOVERY_TYPE_INCLUDED, GATTC_DISCOVERY_TYPE_CHARACTERISTICS, GATTC_DISCOVERY_TYPE_DESCRIPTORS }
 
enum  gatts_flag_t { GATTS_FLAG_CHAR_READ_REQ = 0x01 }
 
enum  ble_evt_gatts { BLE_EVT_GATTS_READ_REQ = BLE_EVT_CAT_FIRST(BLE_EVT_CAT_GATTS), BLE_EVT_GATTS_WRITE_REQ, BLE_EVT_GATTS_PREPARE_WRITE_REQ, BLE_EVT_GATTS_EVENT_SENT }
 
enum  ble_evt_l2cap {
  BLE_EVT_L2CAP_CONNECTED = BLE_EVT_CAT_FIRST(BLE_EVT_CAT_L2CAP), BLE_EVT_L2CAP_CONNECTION_FAILED, BLE_EVT_L2CAP_CONNECTION_REQ, BLE_EVT_L2CAP_DISCONNECTED,
  BLE_EVT_L2CAP_REMOTE_CREDITS_CHANGED, BLE_EVT_L2CAP_DATA_IND, BLE_EVT_L2CAP_SENT
}
 
enum  ble_l2cap_connection_status {
  BLE_L2CAP_CONNECTION_SUCCESSFUL, BLE_L2CAP_CONNECTION_REFUSED_LE_PSM_NOT_SUPPORTED, BLE_L2CAP_CONNECTION_REFUSED_NO_RESOURCES_AVAILABLE, BLE_L2CAP_CONNECTION_REFUSED_INSUFFICIENT_AUTHENTICATION,
  BLE_L2CAP_CONNECTION_REFUSED_INSUFFICIENT_AUTHORIZATION, BLE_L2CAP_CONNECTION_REFUSED_INSUFFICIENT_ENCRYPTION_KEY_SIZE, BLE_L2CAP_CONNECTION_REFUSED_INSUFFICIENT_ENCRYPTION
}
 

Functions

__STATIC_INLINE uint8_t get_u8 (const uint8_t *buffer)
 Get uint8 from buffer. More...
 
__STATIC_INLINE uint16_t get_u16 (const uint8_t *buffer)
 Get uint16 from buffer. More...
 
__STATIC_INLINE uint32_t get_u32 (const uint8_t *buffer)
 Get uint32 from buffer. More...
 
__STATIC_INLINE uint8_t get_u8_inc (const uint8_t **buffer)
 Get uint8 from buffer and increase pointer. More...
 
__STATIC_INLINE uint16_t get_u16_inc (const uint8_t **buffer)
 Get uint16 from buffer and increase pointer. More...
 
__STATIC_INLINE uint32_t get_u32_inc (const uint8_t **buffer)
 Get uint32 from buffer and increase pointer. More...
 
__STATIC_INLINE void put_u8 (uint8_t *buffer, uint8_t value)
 Put uint8 to buffer. More...
 
__STATIC_INLINE void put_u16 (uint8_t *buffer, uint16_t value)
 Put uint16 to buffer. More...
 
__STATIC_INLINE void put_u32 (uint8_t *buffer, uint32_t value)
 Put uint32 to buffer. More...
 
__STATIC_INLINE void put_u8_inc (uint8_t **buffer, uint8_t value)
 Put uint8 to buffer and increase pointer. More...
 
__STATIC_INLINE void put_u16_inc (uint8_t **buffer, uint16_t value)
 Put uint16 to buffer and increase pointer. More...
 
__STATIC_INLINE void put_u32_inc (uint8_t **buffer, uint32_t value)
 Put uint32 to buffer and increase pointer. More...
 
__STATIC_INLINE void put_data_inc (uint8_t **buffer, uint16_t length, const void *data)
 Put data to buffer and increase pointer. More...
 
__STATIC_INLINE void put_str_inc (uint8_t **buffer, const char *str)
 Put string to buffer and increase pointer. More...
 
ble_error_t ble_register_app (void)
 Register application in BLE framework. More...
 
ble_error_t ble_enable (void)
 Enable BLE module. More...
 
ble_error_t ble_reset (void)
 Reset BLE module. More...
 
ble_error_t ble_central_start (void)
 Start the BLE module as a central device. More...
 
ble_error_t ble_peripheral_start (void)
 Start the BLE module as a peripheral device. More...
 
ble_evt_hdr_tble_get_event (bool wait)
 Get event from BLE event queue. More...
 
bool ble_has_event (void)
 Checks if there's event pending in event queue. More...
 
void ble_handle_event_default (ble_evt_hdr_t *hdr)
 Execute default event handler. More...
 
ble_error_t ble_read_tx_power (uint16_t conn_idx, tx_power_level_type_t type, uint8_t *tx_power)
 Read controller TX power. More...
 
__STATIC_INLINE bool ble_address_cmp (const bd_address_t *addr1, const bd_address_t *addr2)
 Compare two BD Addresses. More...
 
const char * ble_address_to_string (const bd_address_t *address)
 Convert bd_address to string. More...
 
bool ble_address_from_string (const char *str, addr_type_t addr_type, bd_address_t *address)
 Convert string to bd_address. More...
 
ble_error_t ble_set_fem_voltage_trim (uint8_t channel, uint8_t value)
 Set FEM Voltage GPIO values for a specific channel. More...
 
ble_error_t ble_gap_address_get (own_address_t *address)
 Retrieve the currently set BD address. More...
 
ble_error_t ble_gap_address_set (const own_address_t *address, uint16_t renew_dur)
 Set the address of the device. More...
 
ble_error_t ble_gap_device_name_set (const char *name, att_perm_t perm)
 Set the device name used for GAP service. More...
 
ble_error_t ble_gap_device_name_get (char *name, uint8_t *length)
 Get the device name used for GAP service. More...
 
ble_error_t ble_gap_appearance_set (gap_appearance_t appearance, att_perm_t perm)
 Set the appearance used for GAP service. More...
 
ble_error_t ble_gap_appearance_get (gap_appearance_t *appearance)
 Get the appearance used for GAP service. More...
 
ble_error_t ble_gap_per_pref_conn_params_set (const gap_conn_params_t *conn_params)
 Set the peripheral preferred connection parameters used for GAP service. More...
 
ble_error_t ble_gap_per_pref_conn_params_get (gap_conn_params_t *conn_params)
 Get the peripheral preferred connection parameters currently set for GAP service. More...
 
ble_error_t ble_gap_adv_start (gap_conn_mode_t adv_type)
 Start advertising. More...
 
ble_error_t ble_gap_adv_stop (void)
 Stop advertising. More...
 
ble_error_t ble_gap_adv_data_set (uint8_t adv_data_len, const uint8_t *adv_data, uint8_t scan_rsp_data_len, const uint8_t *scan_rsp_data)
 Set advertising Data and scan response data. More...
 
ble_error_t ble_gap_adv_ad_struct_set (size_t ad_len, const gap_adv_ad_struct_t *ad, size_t sd_len, const gap_adv_ad_struct_t *sd)
 Set Advertising Data and Scan Response Data using gap_adv_ad_struct_t type. More...
 
ble_error_t ble_gap_adv_data_get (uint8_t *adv_data_len, uint8_t *adv_data, uint8_t *scan_rsp_data_len, uint8_t *scan_rsp_data)
 Get currently used Advertising Data and Scan Response Data. More...
 
ble_error_t ble_gap_adv_intv_get (uint16_t *adv_intv_min, uint16_t *adv_intv_max)
 Get the currently set advertising interval. More...
 
ble_error_t ble_gap_adv_intv_set (uint16_t adv_intv_min, uint16_t adv_intv_max)
 Set the advertising interval. More...
 
ble_error_t ble_gap_adv_chnl_map_get (uint8_t *chnl_map)
 Get the advertising channel map currently set. More...
 
ble_error_t ble_gap_adv_chnl_map_set (uint8_t chnl_map)
 Set the advertising channel map. More...
 
ble_error_t ble_gap_adv_mode_get (gap_disc_mode_t *adv_mode)
 Get the discoverability mode used for advertising. More...
 
ble_error_t ble_gap_adv_mode_set (gap_disc_mode_t adv_mode)
 Set the discoverability mode used for advertising. More...
 
ble_error_t ble_gap_adv_filt_policy_get (adv_filt_pol_t *filt_policy)
 Get the filtering policy used for advertising. More...
 
ble_error_t ble_gap_adv_filt_policy_set (adv_filt_pol_t filt_policy)
 Set the filtering policy used for advertising. More...
 
ble_error_t ble_gap_adv_direct_address_get (bd_address_t *address)
 Get the peer address used for directed advertising. More...
 
ble_error_t ble_gap_adv_direct_address_set (const bd_address_t *address)
 Set peer address used for directed advertising. More...
 
ble_error_t ble_gap_adv_set_permutation (uint8_t permutation_index)
 Set the permutation order of the primary advertising channels. More...
 
ble_error_t ble_gap_scan_start (gap_scan_type_t type, gap_scan_mode_t mode, uint16_t interval, uint16_t window, bool filt_wlist, bool filt_dupl)
 Start scanning for devices. More...
 
ble_error_t ble_gap_scan_stop (void)
 Stop scanning for devices. More...
 
ble_error_t ble_gap_scan_params_get (gap_scan_params_t *scan_params)
 Get the scan parameters used for connections. More...
 
ble_error_t ble_gap_scan_params_set (const gap_scan_params_t *scan_params)
 Set the scan parameters used for connections. More...
 
ble_error_t ble_gap_connect (const bd_address_t *peer_addr, const gap_conn_params_t *conn_params)
 Connect to a device. More...
 
ble_error_t ble_gap_connect_ce (const bd_address_t *peer_addr, const gap_conn_params_t *conn_params, uint16_t ce_len_min, uint16_t ce_len_max)
 Connect to a device with a defined connection event length. More...
 
ble_error_t ble_gap_connect_cancel (void)
 Cancel an initiated connection. More...
 
ble_error_t ble_gap_disconnect (uint16_t conn_idx, ble_hci_error_t reason)
 Terminate a connection. More...
 
ble_error_t ble_gap_peer_version_get (uint16_t conn_idx)
 Get peer's version. More...
 
ble_error_t ble_gap_peer_features_get (uint16_t conn_idx)
 Get peer's features. More...
 
ble_error_t ble_gap_conn_rssi_get (uint16_t conn_idx, int8_t *conn_rssi)
 Retrieve the RSSI of a connection. More...
 
ble_error_t ble_gap_role_get (gap_role_t *role)
 Get the GAP role currently set. More...
 
ble_error_t ble_gap_role_set (const gap_role_t role)
 Set GAP role. More...
 
ble_error_t ble_gap_mtu_size_get (uint16_t *mtu_size)
 Get MTU size. More...
 
ble_error_t ble_gap_mtu_size_set (uint16_t mtu_size)
 Set MTU size. More...
 
ble_error_t ble_gap_channel_map_get (uint64_t *chnl_map)
 Get the currently set channel map of the device (device has to be configured as central) More...
 
ble_error_t ble_gap_channel_map_set (const uint64_t chnl_map)
 Set the channel map of the device (device has to be configured as central) More...
 
ble_error_t ble_gap_conn_param_update (uint16_t conn_idx, const gap_conn_params_t *conn_params)
 Initiate a connection parameter update. More...
 
ble_error_t ble_gap_conn_param_update_reply (uint16_t conn_idx, bool accept)
 Reply to a connection parameter update request. More...
 
ble_error_t ble_gap_pair (uint16_t conn_idx, bool bond)
 Start pairing. More...
 
ble_error_t ble_gap_pair_reply (uint16_t conn_idx, bool accept, bool bond)
 Respond to a pairing request. More...
 
ble_error_t ble_gap_get_connected (uint8_t *length, uint16_t **conn_idx)
 Get connected devices list. More...
 
ble_error_t ble_gap_get_bonded (uint8_t *length, bd_address_t **addr)
 Get bonded devices list. More...
 
ble_error_t ble_gap_get_io_cap (gap_io_cap_t *io_cap)
 Get the I/O capabilities of the device. More...
 
ble_error_t ble_gap_set_io_cap (gap_io_cap_t io_cap)
 Set the I/O capabilities of the device. More...
 
ble_error_t ble_gap_passkey_reply (uint16_t conn_idx, bool accept, uint32_t passkey)
 Respond to a passkey request. More...
 
ble_error_t ble_gap_get_sec_level (uint16_t conn_idx, gap_sec_level_t *level)
 Get connection security level. More...
 
ble_error_t ble_gap_unpair (const bd_address_t *addr)
 Unpair command. More...
 
ble_error_t ble_gap_set_sec_level (uint16_t conn_idx, gap_sec_level_t level)
 Set connection security level. More...
 
ble_error_t ble_gap_get_devices (gap_device_filter_t filter, gap_device_filter_data_t *filter_data, size_t *length, gap_device_t *gap_devices)
 Return list of known devices. More...
 
ble_error_t ble_gap_get_device_by_addr (const bd_address_t *addr, gap_device_t *gap_device)
 Get device object by device address. More...
 
ble_error_t ble_gap_get_device_by_conn_idx (uint16_t conn_idx, gap_device_t *gap_device)
 Get device object by connection index. More...
 
ble_error_t ble_gap_is_bonded (uint16_t conn_idx, bool *bonded)
 Get bond state of device (by connection index) More...
 
ble_error_t ble_gap_is_addr_bonded (const bd_address_t *addr, bool *bonded)
 Get bond state of device (by address) More...
 
ble_error_t ble_gap_data_length_set (uint16_t conn_idx, uint16_t tx_length, uint16_t tx_time)
 Set the data length used for TX. More...
 
ble_error_t ble_gap_address_resolve (bd_address_t address)
 Resolve a BD address. More...
 
ble_error_t ble_gap_tx_power_set (uint8_t air_operation, gap_tx_power_t tx_power)
 Set TX power for air operations. More...
 
ble_error_t ble_gap_conn_tx_power_set (uint16_t conn_idx, gap_tx_power_t tx_power)
 Set TX power for given connection. More...
 
ble_error_t ble_gattc_browse (uint16_t conn_idx, const att_uuid_t *uuid)
 Browse services on remote GATT server. More...
 
ble_error_t ble_gattc_browse_range (uint16_t conn_idx, uint16_t start_h, uint16_t end_h, const att_uuid_t *uuid)
 Browse services on remote GATT server in a given range. More...
 
ble_error_t ble_gattc_discover_svc (uint16_t conn_idx, const att_uuid_t *uuid)
 Discover services on remote GATT server. More...
 
ble_error_t ble_gattc_discover_include (uint16_t conn_idx, uint16_t start_h, uint16_t end_h)
 Discover included services on remote GATT server. More...
 
ble_error_t ble_gattc_discover_char (uint16_t conn_idx, uint16_t start_h, uint16_t end_h, const att_uuid_t *uuid)
 Discover characteristics on remote GATT server. More...
 
ble_error_t ble_gattc_discover_desc (uint16_t conn_idx, uint16_t start_h, uint16_t end_h)
 Discover descriptors on remote GATT server. More...
 
ble_error_t ble_gattc_read (uint16_t conn_idx, uint16_t handle, uint16_t offset)
 Read attribute from remote GATT server. More...
 
ble_error_t ble_gattc_write (uint16_t conn_idx, uint16_t handle, uint16_t offset, uint16_t length, const uint8_t *value)
 Write attribute to remote GATT server. More...
 
ble_error_t ble_gattc_write_no_resp (uint16_t conn_idx, uint16_t handle, bool signed_write, uint16_t length, const uint8_t *value)
 Write attribute to remote GATT server (without response) More...
 
ble_error_t ble_gattc_write_prepare (uint16_t conn_idx, uint16_t handle, uint16_t offset, uint16_t length, const uint8_t *value)
 Prepare long/reliable write to remote GATT server. More...
 
ble_error_t ble_gattc_write_execute (uint16_t conn_idx, bool commit)
 Execute reliable/long write to remote GATT server. More...
 
ble_error_t ble_gattc_indication_cfm (uint16_t conn_idx, uint16_t handle) __attribute__((deprecated))
 Send confirmation for received indication. More...
 
ble_error_t ble_gattc_get_mtu (uint16_t conn_idx, uint16_t *mtu)
 Get current TX MTU for peer. More...
 
ble_error_t ble_gattc_exchange_mtu (uint16_t conn_idx)
 Exchange MTU. More...
 
void ble_gattc_util_find_init (const ble_evt_gattc_browse_svc_t *evt)
 Initialize browse event iterators. More...
 
const gattc_item_tble_gattc_util_find_characteristic (const att_uuid_t *uuid)
 Find characteristic in browse event. More...
 
const gattc_item_tble_gattc_util_find_descriptor (const att_uuid_t *uuid)
 Find descriptor in browse event. More...
 
__STATIC_INLINE ble_error_t ble_gattc_util_write_ccc (uint16_t conn_idx, uint16_t handle, gatt_ccc_t ccc)
 Write value to CCC descriptor. More...
 
ble_error_t ble_gatts_add_service (const att_uuid_t *uuid, const gatt_service_t type, uint16_t num_attrs)
 Add new GATT service. More...
 
ble_error_t ble_gatts_add_include (uint16_t handle, uint16_t *h_offset)
 Add included service to GATT service. More...
 
ble_error_t ble_gatts_add_characteristic (const att_uuid_t *uuid, gatt_prop_t prop, att_perm_t perm, uint16_t max_len, gatts_flag_t flags, uint16_t *h_offset, uint16_t *h_val_offset)
 Add characteristic to GATT service. More...
 
ble_error_t ble_gatts_add_descriptor (const att_uuid_t *uuid, att_perm_t perm, uint16_t max_len, gatts_flag_t flags, uint16_t *h_offset)
 Add descriptor to GATT service. More...
 
ble_error_t ble_gatts_register_service (uint16_t *handle,...)
 Register service in database. More...
 
ble_error_t ble_gatts_enable_service (uint16_t handle)
 Enable service in database. More...
 
ble_error_t ble_gatts_disable_service (uint16_t handle)
 Disable service in database. More...
 
ble_error_t ble_gatts_get_characteristic_prop (uint16_t handle, gatt_prop_t *prop, att_perm_t *perm)
 Read current characteristic properties and permissions. More...
 
ble_error_t ble_gatts_set_characteristic_prop (uint16_t handle, gatt_prop_t prop, att_perm_t perm)
 Set characteristic properties and permissions. More...
 
ble_error_t ble_gatts_get_value (uint16_t handle, uint16_t *length, void *value)
 Get attribute value. More...
 
ble_error_t ble_gatts_set_value (uint16_t handle, uint16_t length, const void *value)
 Set attribute value. More...
 
ble_error_t ble_gatts_read_cfm (uint16_t conn_idx, uint16_t handle, att_error_t status, uint16_t length, const void *value)
 Respond to an attribute read request. More...
 
ble_error_t ble_gatts_write_cfm (uint16_t conn_idx, uint16_t handle, att_error_t status)
 Respond to an attribute write request. More...
 
ble_error_t ble_gatts_prepare_write_cfm (uint16_t conn_idx, uint16_t handle, uint16_t length, att_error_t status)
 Respond to an attribute prepare write request. More...
 
ble_error_t ble_gatts_send_event (uint16_t conn_idx, uint16_t handle, gatt_event_t type, uint16_t length, const void *value)
 Send a characteristic value notification or indication. More...
 
ble_error_t ble_gatts_service_changed_ind (uint16_t conn_idx, uint16_t start_handle, uint16_t end_handle)
 Send indication of the Service Changed Characteristic. More...
 
__STATIC_INLINE uint16_t ble_gatts_get_num_attr (uint16_t include, uint16_t characteristic, uint16_t descriptor)
 Calculate number of attributes required for service. More...
 
ble_error_t ble_l2cap_listen (uint16_t conn_idx, uint16_t psm, gap_sec_level_t sec_level, uint16_t initial_credits, uint16_t *scid)
 Create a connection oriented channel listening for incoming connections. More...
 
ble_error_t ble_l2cap_listen_defer_setup (uint16_t conn_idx, uint16_t psm, gap_sec_level_t sec_level, uint16_t initial_credits, uint16_t *scid)
 Create a connection oriented channel listening for incoming connections. More...
 
ble_error_t ble_l2cap_connection_cfm (uint16_t conn_idx, uint16_t scid, enum ble_l2cap_connection_status status)
 Accept or reject incoming connection. More...
 
ble_error_t ble_l2cap_stop_listen (uint16_t conn_idx, uint16_t scid)
 Stop listening for incoming connections. More...
 
ble_error_t ble_l2cap_connect (uint16_t conn_idx, uint16_t psm, uint16_t initial_credits, uint16_t *scid)
 Connect a connection oriented channel to remote peer. More...
 
ble_error_t ble_l2cap_disconnect (uint16_t conn_idx, uint16_t scid)
 Disconnect channel. More...
 
ble_error_t ble_l2cap_add_credits (uint16_t conn_idx, uint16_t scid, uint16_t credits)
 Add local credits on channel. More...
 
ble_error_t ble_l2cap_send (uint16_t conn_idx, uint16_t scid, uint16_t length, const void *data)
 Send data on channel. More...
 
ble_error_t ble_l2cap_conn_param_update (uint16_t conn_idx, const gap_conn_params_t *conn_params)
 Initiate a connection parameter update over L2CAP. More...
 
ble_error_t ble_storage_put_i32 (uint16_t conn_idx, ble_storage_key_t key, int32_t value, bool persistent)
 Store signed integer value in storage. More...
 
ble_error_t ble_storage_put_u32 (uint16_t conn_idx, ble_storage_key_t key, uint32_t value, bool persistent)
 Store unsigned integer value in storage. More...
 
ble_error_t ble_storage_put_buffer (uint16_t conn_idx, ble_storage_key_t key, uint16_t length, void *ptr, ble_storage_free_cb_t free_cb, bool persistent)
 Store data buffer in storage. More...
 
ble_error_t ble_storage_put_buffer_copy (uint16_t conn_idx, ble_storage_key_t key, uint16_t length, void *ptr, ble_storage_free_cb_t free_cb, bool persistent)
 Store copy of data buffer in storage. More...
 
ble_error_t ble_storage_get_i8 (uint16_t conn_idx, ble_storage_key_t key, int8_t *value)
 Get int8 value from storage. More...
 
ble_error_t ble_storage_get_u8 (uint16_t conn_idx, ble_storage_key_t key, uint8_t *value)
 Get uint8 value from storage. More...
 
ble_error_t ble_storage_get_i16 (uint16_t conn_idx, ble_storage_key_t key, int16_t *value)
 Get int16 value from storage. More...
 
ble_error_t ble_storage_get_u16 (uint16_t conn_idx, ble_storage_key_t key, uint16_t *value)
 Get uint16 value from storage. More...
 
ble_error_t ble_storage_get_i32 (uint16_t conn_idx, ble_storage_key_t key, int32_t *value)
 Get int32 value from storage. More...
 
ble_error_t ble_storage_get_u32 (uint16_t conn_idx, ble_storage_key_t key, uint32_t *value)
 Get uint32 value from storage. More...
 
ble_error_t ble_storage_get_buffer (uint16_t conn_idx, ble_storage_key_t key, uint16_t *length, void **ptr)
 Get buffer value from storage. More...
 
ble_error_t ble_storage_remove (uint16_t conn_idx, ble_storage_key_t key)
 Remove value from storage. More...
 
ble_error_t ble_storage_remove_all (ble_storage_key_t key)
 Remove value from storage. More...
 
void ble_uuid_create16 (uint16_t uuid16, att_uuid_t *uuid)
 Create 16-bit UUID from integer value. More...
 
void ble_uuid_from_buf (const uint8_t *buf, att_uuid_t *uuid)
 Create UUID from buffer. More...
 
bool ble_uuid_from_string (const char *str, att_uuid_t *uuid)
 Create UUID from string. More...
 
const char * ble_uuid_to_string (const att_uuid_t *uuid)
 Convert UUID to string. More...
 
bool ble_uuid_equal (const att_uuid_t *uuid1, const att_uuid_t *uuid2)
 Check if two UUIDs are equal. More...
 

Detailed Description

API.

Macro Definition Documentation

◆ BLE_ADV_DATA_LEN_MAX

#define BLE_ADV_DATA_LEN_MAX   (ADV_DATA_LEN - 3)

Maximum length of advertising data for connectable advertising packets in bytes (3 bytes reserved for AD flags)

◆ BLE_ADV_INTERVAL_FROM_MS

#define BLE_ADV_INTERVAL_FROM_MS (   MS)    ((MS) * 1000 / 625)

Convert time in milliseconds to advertising interval value

◆ BLE_ADV_INTERVAL_TO_MS

#define BLE_ADV_INTERVAL_TO_MS (   VAL)    ((VAL) * 625 / 1000)

Convert advertising interval value to time in milliseconds

◆ BLE_APP_NOTIFY_MASK

#define BLE_APP_NOTIFY_MASK   (1 << 0)

Notification bitmask for event queue

◆ BLE_CONN_EVENT_LENGTH_FROM_MS

#define BLE_CONN_EVENT_LENGTH_FROM_MS (   MS)    ((MS) * 1000 / 625)

Convert time in milliseconds to connection event length value

◆ BLE_CONN_EVENT_LENGTH_TO_MS

#define BLE_CONN_EVENT_LENGTH_TO_MS (   VAL)    ((VAL) * 625 / 1000)

Convert connection event length value to time in milliseconds

◆ BLE_CONN_IDX_INVALID

#define BLE_CONN_IDX_INVALID   (0xFFFF)

Value for invalid connection index

Portable code should use this value wherever it's required to mark connection index as invalid.

◆ BLE_CONN_INTERVAL_FROM_MS

#define BLE_CONN_INTERVAL_FROM_MS (   MS)    ((MS) * 100 / 125)

Convert time in milliseconds to connection interval value

◆ BLE_CONN_INTERVAL_TO_MS

#define BLE_CONN_INTERVAL_TO_MS (   VAL)    ((VAL) * 125 / 100)

Convert connection interval value to time in milliseconds

◆ BLE_ENC_KEY_SIZE_MAX

#define BLE_ENC_KEY_SIZE_MAX   (16)

Maximum Encryption Key Size

◆ BLE_EVT_CAT_FIRST

#define BLE_EVT_CAT_FIRST (   CAT)    (CAT << 8)

Defines first event id in category

◆ BLE_GAP_CHANNEL_MAP_LEN

#define BLE_GAP_CHANNEL_MAP_LEN   (LE_CHNL_MAP_LEN)

Channel map size in bytes

◆ BLE_GAP_MAX_BONDED

#define BLE_GAP_MAX_BONDED   (defaultBLE_MAX_BONDED)

Maximum number of bonded devices

◆ BLE_GAP_MAX_CONNECTED

#define BLE_GAP_MAX_CONNECTED   (dg_configBLE_CONNECTIONS_MAX)

Maximum number of connected devices

◆ BLE_NON_CONN_ADV_DATA_LEN_MAX

#define BLE_NON_CONN_ADV_DATA_LEN_MAX   (ADV_DATA_LEN)

Maximum length of advertising data for non-connectable advertising packets

◆ BLE_RSSI_NOT_AVAILABLE

#define BLE_RSSI_NOT_AVAILABLE   (127)

RSSI value not available

◆ BLE_SCAN_INTERVAL_FROM_MS

#define BLE_SCAN_INTERVAL_FROM_MS (   MS)    ((MS) * 1000 / 625)

Convert time in milliseconds to scan interval value

◆ BLE_SCAN_INTERVAL_TO_MS

#define BLE_SCAN_INTERVAL_TO_MS (   VAL)    ((VAL) * 625 / 1000)

Convert scan interval value to time in milliseconds

◆ BLE_SCAN_RSP_LEN_MAX

#define BLE_SCAN_RSP_LEN_MAX   (SCAN_RSP_DATA_LEN)

Maximum length of scan response data in bytes

◆ BLE_SCAN_WINDOW_FROM_MS

#define BLE_SCAN_WINDOW_FROM_MS (   MS)    ((MS) * 1000 / 625)

Convert time in milliseconds to scan window value

◆ BLE_SCAN_WINDOW_TO_MS

#define BLE_SCAN_WINDOW_TO_MS (   VAL)    ((VAL) * 625 / 1000)

Convert scan window value to time in milliseconds

◆ BLE_STORAGE_KEY_APP

#define BLE_STORAGE_KEY_APP (   app_id,
  val_id 
)    (BLE_STORAGE_KEYCAT_APP | ((app_id & 0xFF) << 16) | (val_id & 0xFFFF))

Storage key for application-defined values

◆ BLE_STORAGE_KEY_CLI

#define BLE_STORAGE_KEY_CLI (   handle)    (BLE_STORAGE_KEYCAT_CLI | (handle & 0xFFFF))

Storage key for attribute on GATT client (by handle)

◆ BLE_STORAGE_KEY_SRV

#define BLE_STORAGE_KEY_SRV (   handle)    (BLE_STORAGE_KEYCAT_SRV | (handle & 0xFFFF))

Storage key for attribute on GATT server (by handle)

◆ BLE_SUPERVISION_TMO_FROM_MS

#define BLE_SUPERVISION_TMO_FROM_MS (   MS)    ((MS) / 10)

Convert time in milliseconds to supervision timeout value

◆ BLE_SUPERVISION_TMO_TO_MS

#define BLE_SUPERVISION_TMO_TO_MS (   VAL)    ((VAL) * 10)

Convert supervision timeout value to time in milliseconds

◆ GAP_ADV_AD_STRUCT

#define GAP_ADV_AD_STRUCT (   _ad_data_type,
  _ad_data_len,
  _ad_data 
)
Value:
{ .type = (_ad_data_type), \
.len = (_ad_data_len), \
.data = (const uint8_t *)(_ad_data) }

Helper macro to initialize single gap_adv_ad_struct_t object with fixed AD data like in this call example GAP_ADV_AD_STRUCT(GAP_DATA_TYPE_LOCAL_NAME, DEVICE_ADV_NAME_LEN, DEVICE_ADV_NAME)

◆ GAP_ADV_AD_STRUCT_BYTES

#define GAP_ADV_AD_STRUCT_BYTES (   _ad_data_type,
  _ad_data_bytes... 
)
Value:
GAP_ADV_AD_STRUCT(_ad_data_type, \
sizeof((uint8_t[]) { _ad_data_bytes}), \
((uint8_t[]) { _ad_data_bytes}))

Helper macro to initialize single gap_adv_ad_struct_t object by specifying set of individual octets of AD data like this one GAP_ADV_AD_STRUCT_BYTES(GAP_DATA_TYPE_UUID16_LIST, 0x12, 0x18)

◆ GAP_ADV_AD_STRUCT_DECLARE

#define GAP_ADV_AD_STRUCT_DECLARE (   _ad_data_type,
  _ad_data_len,
  _ad_data 
)
Value:
_ad_data_len, \
_ad_data))

Helper macro to instantiate & initialize single gap_adv_ad_struct_t object on stack with AD data returning address of the object.

◆ HIGH_PERFORMANCE_ALL_PHYS

#define HIGH_PERFORMANCE_ALL_PHYS   ( 0x02 )

High Performance (HP) mode

◆ LOW_POWER_ALL_PHYS

#define LOW_POWER_ALL_PHYS   ( 0x01 )

Radio Power Modes Low Power (LP) mode

Typedef Documentation

◆ addr_type_t

typedef enum addr_types addr_type_t

Bluetooth Address type

◆ bd_address_t

typedef struct bd_address bd_address_t

Bluetooth Device address

◆ ble_storage_free_cb_t

typedef void(* ble_storage_free_cb_t) (void *ptr)

Callback to free buffer stored in storage.

Parameters
[in]ptrbuffer

◆ ble_storage_key_t

typedef uint32_t ble_storage_key_t

Storage key (for indexing values in storage)

Storage keys namespace is divided into different category thus should not be hard-coded as raw number, but appropriate macros should be used to ensure no collision between different users of storage, see STORAGE_KEY_SRV(), STORAGE_KEY_CLI() and STORAGE_KEY_APP().

◆ gap_chnl_map_t

typedef struct gap_chnl_map gap_chnl_map_t

Link Layer channel map

◆ own_addr_type_t

Own Device Address type

◆ own_address_t

typedef struct own_address own_address_t

Own Bluetooth Device address

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Advertising report event types

Enumerator
GAP_ADV_IND 

General advertising indication.

GAP_ADV_DIRECT_IND 

Direct connection indication.

GAP_ADV_SCAN_IND 

Scannable advertising indication.

GAP_ADV_NONCONN_IND 

Non-connectable advertising indication.

GAP_SCAN_RSP 

Active scanning response.

◆ addr_types

enum addr_types

Bluetooth Address type

Enumerator
PUBLIC_ADDRESS 

Public Static Address

PRIVATE_ADDRESS 

Private Random Address

◆ adv_filt_pol_t

Advertising filter policy

Enumerator
ADV_ALLOW_SCAN_ANY_CONN_ANY 

Allow all scan and connect requests.

ADV_ALLOW_SCAN_WLIST_CONN_ANY 

Allow all connect requests and scan requests only from whitelist.

ADV_ALLOW_SCAN_ANY_CONN_WLIST 

Allow all scan requests and connect requests only from whitelist.

ADV_ALLOW_SCAN_WLIST_CONN_WLIST 

Allow scan and connect requests only from whitelist.

◆ att_error_t

Error code for ATT operation (as defined by Core 4.2 specification)

◆ att_perm_t

enum att_perm_t

ATT attribute permission

◆ ble_error_t

BLE error code

Enumerator
BLE_STATUS_OK 

Success

BLE_ERROR_FAILED 

Generic failure

BLE_ERROR_ALREADY_DONE 

Already done

BLE_ERROR_IN_PROGRESS 

Operation already in progress

BLE_ERROR_INVALID_PARAM 

Invalid parameter

BLE_ERROR_NOT_ALLOWED 

Not allowed

BLE_ERROR_NOT_CONNECTED 

Not connected

BLE_ERROR_NOT_SUPPORTED 

Not supported

BLE_ERROR_NOT_ACCEPTED 

Not accepted

BLE_ERROR_BUSY 

Busy

BLE_ERROR_TIMEOUT 

Request timed out

BLE_ERROR_NOT_SUPPORTED_BY_PEER 

Not supported by peer

BLE_ERROR_CANCELED 

Canceled by user

BLE_ERROR_ENC_KEY_MISSING 

encryption key missing

BLE_ERROR_INS_RESOURCES 

insufficient resources

BLE_ERROR_NOT_FOUND 

not found

BLE_ERROR_L2CAP_NO_CREDITS 

no credits available on L2CAP CoC

BLE_ERROR_L2CAP_MTU_EXCEEDED 

MTU exceeded on L2CAP CoC

BLE_ERROR_INS_BANDWIDTH 

Insufficient bandwidth

BLE_ERROR_LMP_COLLISION 

LMP collision

BLE_ERROR_DIFF_TRANS_COLLISION 

Different transaction collision

◆ ble_evt_cat

BLE event categories

◆ ble_evt_common

Common events.

Enumerator
BLE_EVT_RESET_COMPLETED 

BLE has been reset

◆ ble_evt_gap

GAP events.

Enumerator
BLE_EVT_GAP_CONNECTED 

Connection established

BLE_EVT_GAP_ADV_REPORT 

Advertising report

BLE_EVT_GAP_DISCONNECTED 

Disconnection event

BLE_EVT_GAP_DISCONNECT_FAILED 

Disconnect failed event

BLE_EVT_GAP_ADV_COMPLETED 

Advertising operation completed

BLE_EVT_GAP_SCAN_COMPLETED 

Scan operation completed

BLE_EVT_GAP_CONN_PARAM_UPDATE_REQ 

Connection parameter update request from peer

BLE_EVT_GAP_CONN_PARAM_UPDATED 

Connection parameters updated

BLE_EVT_GAP_PAIR_REQ 

Pairing request

BLE_EVT_GAP_PAIR_COMPLETED 

Pairing completed

BLE_EVT_GAP_SECURITY_REQUEST 

Security request from peer

BLE_EVT_GAP_PASSKEY_NOTIFY 

Passkey notification

BLE_EVT_GAP_PASSKEY_REQUEST 

Passkey request

BLE_EVT_GAP_SEC_LEVEL_CHANGED 

Security level changed indication

BLE_EVT_GAP_ADDRESS_RESOLVED 

Random address resolved

BLE_EVT_GAP_SET_SEC_LEVEL_FAILED 

Set security level failed

BLE_EVT_GAP_CONN_PARAM_UPDATE_COMPLETED 

Connection parameters update completed

BLE_EVT_GAP_DATA_LENGTH_CHANGED 

Data length changed

BLE_EVT_GAP_DATA_LENGTH_SET_FAILED 

Data length set failed

BLE_EVT_GAP_CONNECTION_COMPLETED 

Connection operation completed

BLE_EVT_GAP_NUMERIC_REQUEST 

Numeric request

BLE_EVT_GAP_ADDRESS_RESOLUTION_FAILED 

Address resolution failed

BLE_EVT_GAP_LTK_MISSING 

Long Term Key missing

BLE_EVT_GAP_AIR_OP_BDADDR 

Air Operation BD Address

BLE_EVT_GAP_PEER_VERSION 

Peer version

BLE_EVT_GAP_PEER_FEATURES 

Peer features

◆ ble_evt_gattc

GATT Client events

Enumerator
BLE_EVT_GATTC_BROWSE_SVC 

Service found during browsing procedure

BLE_EVT_GATTC_BROWSE_COMPLETED 

Browsing procedure completed

BLE_EVT_GATTC_DISCOVER_SVC 

Service found during discovery

BLE_EVT_GATTC_DISCOVER_INCLUDE 

Included service found during discovery

BLE_EVT_GATTC_DISCOVER_CHAR 

Characteristic found during discovery

BLE_EVT_GATTC_DISCOVER_DESC 

Characteristic descriptor found during discovery

BLE_EVT_GATTC_DISCOVER_COMPLETED 

Discovery completed

BLE_EVT_GATTC_READ_COMPLETED 

Read attribute value completed

BLE_EVT_GATTC_WRITE_COMPLETED 

Write attribute value completed

BLE_EVT_GATTC_NOTIFICATION 

Value notification received

BLE_EVT_GATTC_INDICATION 

value indication received

BLE_EVT_GATTC_MTU_CHANGED 

MTU changes for peer

◆ ble_evt_gatts

GATT Server events

Enumerator
BLE_EVT_GATTS_READ_REQ 

Read request from peer

BLE_EVT_GATTS_WRITE_REQ 

Write request from peer

BLE_EVT_GATTS_PREPARE_WRITE_REQ 

Prepare write request from peer

BLE_EVT_GATTS_EVENT_SENT 

Event (notification or indication) sent

◆ ble_evt_l2cap

LE L2CAP connection oriented channels events

Enumerator
BLE_EVT_L2CAP_CONNECTED 

Channel connected

BLE_EVT_L2CAP_CONNECTION_FAILED 

Channel connection failed

BLE_EVT_L2CAP_CONNECTION_REQ 

Channel connection request

BLE_EVT_L2CAP_DISCONNECTED 

Channel disconnected

BLE_EVT_L2CAP_REMOTE_CREDITS_CHANGED 

Available remote credits changed on channel

BLE_EVT_L2CAP_DATA_IND 

Data received on channel

BLE_EVT_L2CAP_SENT 

Data sent on channel

◆ ble_gap_phy_pref_t

GAP PHY preference

Enumerator
BLE_GAP_PHY_PREF_AUTO 

No PHY preference.

BLE_GAP_PHY_PREF_1M 

Bit rate of 1 megabit per second (Mb/s)

BLE_GAP_PHY_PREF_2M 

Bit rate of 2 megabit per second (Mb/s)

BLE_GAP_PHY_PREF_CODED 

LE Coded PHY (bit rate of 125 or 500 Kbit/s)

◆ ble_gap_phy_t

GAP PHY

Enumerator
BLE_GAP_PHY_1M 

Bit rate of 1 megabit per second (Mb/s)

BLE_GAP_PHY_2M 

Bit rate of 2 megabit per second (Mb/s)

BLE_GAP_PHY_CODED 

LE Coded PHY (bit rate of 125 or 500 Kbit/s)

◆ ble_hci_error_t

BLE HCI error code

Enumerator
BLE_HCI_ERROR_NO_ERROR 

Success

BLE_HCI_ERROR_UNKNOWN_HCI_COMMAND 

Unknown HCI command

BLE_HCI_ERROR_UNKNOWN_CONNECTION_ID 

Unknown connection identifier

BLE_HCI_ERROR_HARDWARE_FAILURE 

Hardware failure

BLE_HCI_ERROR_PAGE_TIMEOUT 

Page timeout

BLE_HCI_ERROR_AUTH_FAILURE 

Authentication failure

BLE_HCI_ERROR_PIN_MISSING 

PIN or key missing

BLE_HCI_ERROR_MEMORY_CAPA_EXCEED 

Memory capacity exceeded

BLE_HCI_ERROR_CON_TIMEOUT 

Connection timeout

BLE_HCI_ERROR_CON_LIMIT_EXCEED 

Connection limit exceeded

BLE_HCI_ERROR_SYNC_CON_LIMIT_DEV_EXCEED 

Synchronous connection limit to a device exceeded

BLE_HCI_ERROR_ACL_CON_EXISTS 

ACL connection already exists

BLE_HCI_ERROR_COMMAND_DISALLOWED 

Command disallowed

BLE_HCI_ERROR_CONN_REJ_LIMITED_RESOURCES 

Connection rejected due to limited resources

BLE_HCI_ERROR_CONN_REJ_SECURITY_REASONS 

Connection rejected due to security reasons

BLE_HCI_ERROR_CONN_REJ_UNACCEPTABLE_BDADDR 

Connection rejected due to unacceptable BD_ADDR

BLE_HCI_ERROR_CONN_ACCEPT_TIMEOUT_EXCEED 

Connection accept timeout exceeded

BLE_HCI_ERROR_UNSUPPORTED 

Unsupported feature or parameter value

BLE_HCI_ERROR_INVALID_HCI_PARAM 

Invalid HCI command parameters

BLE_HCI_ERROR_REMOTE_USER_TERM_CON 

Remote User terminated connection

BLE_HCI_ERROR_REMOTE_DEV_TERM_LOW_RESOURCES 

Remote device terminated connection due to low resources

BLE_HCI_ERROR_REMOTE_DEV_POWER_OFF 

Remote device terminated connection due to power off

BLE_HCI_ERROR_CON_TERM_BY_LOCAL_HOST 

Connection terminated by local host

BLE_HCI_ERROR_REPEATED_ATTEMPTS 

Repeated attempts

BLE_HCI_ERROR_PAIRING_NOT_ALLOWED 

Pairing not allowed

BLE_HCI_ERROR_UNKNOWN_LMP_PDU 

Unknown LMP PDU

BLE_HCI_ERROR_UNSUPPORTED_REMOTE_FEATURE 

Unsupported remote feature / Unsupported LMP feature

BLE_HCI_ERROR_SCO_OFFSET_REJECTED 

SCO offset rejected

BLE_HCI_ERROR_SCO_INTERVAL_REJECTED 

SCO interval rejected

BLE_HCI_ERROR_SCO_AIR_MODE_REJECTED 

SCO air mode rejected

BLE_HCI_ERROR_INVALID_LMP_PARAM 

Invalid LMP parameters / Invalid LL parameters

BLE_HCI_ERROR_UNSPECIFIED_ERROR 

Unspecified error

BLE_HCI_ERROR_UNSUPPORTED_LMP_PARAM_VALUE 

Unsupported LMP parameter value / Unsupported LL parameter value

BLE_HCI_ERROR_ROLE_CHANGE_NOT_ALLOWED 

Role change not allowed

BLE_HCI_ERROR_LMP_RSP_TIMEOUT 

LMP response timeout / LL response timeout

BLE_HCI_ERROR_LMP_COLLISION 

LMP error transaction collision

BLE_HCI_ERROR_LMP_PDU_NOT_ALLOWED 

LMP PDU not allowed

BLE_HCI_ERROR_ENC_MODE_NOT_ACCEPT 

Encryption mode not acceptable

BLE_HCI_ERROR_LINK_KEY_CANT_CHANGE 

Link key cannot be changed

BLE_HCI_ERROR_QOS_NOT_SUPPORTED 

Requested QoS not supported

BLE_HCI_ERROR_INSTANT_PASSED 

Instant passed

BLE_HCI_ERROR_PAIRING_WITH_UNIT_KEY_NOT_SUP 

Pairing with unit key not supported

BLE_HCI_ERROR_DIFF_TRANSACTION_COLLISION 

Different transaction collision

BLE_HCI_ERROR_QOS_UNACCEPTABLE_PARAM 

QoS unacceptable parameter

BLE_HCI_ERROR_QOS_REJECTED 

QoS rejected

BLE_HCI_ERROR_CHANNEL_CLASS_NOT_SUP 

Channel classification not supported

BLE_HCI_ERROR_INSUFFICIENT_SECURITY 

Insufficient security

BLE_HCI_ERROR_PARAM_OUT_OF_MAND_RANGE 

Parameter out of mandatory range

BLE_HCI_ERROR_ROLE_SWITCH_PEND 

Role switch pending

BLE_HCI_ERROR_RESERVED_SLOT_VIOLATION 

Reserved slot violation

BLE_HCI_ERROR_ROLE_SWITCH_FAIL 

Role switch failed

BLE_HCI_ERROR_EIR_TOO_LARGE 

Extended inquiry response too large

BLE_HCI_ERROR_SP_NOT_SUPPORTED_HOST 

Secure simple pairing not supported by host

BLE_HCI_ERROR_HOST_BUSY_PAIRING 

Host busy - pairing

BLE_HCI_ERROR_CONN_REJ_NO_SUITABLE_CHANNEL 

Connection rejected due to no suitable channel found

BLE_HCI_ERROR_CONTROLLER_BUSY 

Controller busy

BLE_HCI_ERROR_UNACCEPTABLE_CONN_INT 

Unacceptable connection parameters

BLE_HCI_ERROR_DIRECT_ADV_TO 

Directed advertising timeout

BLE_HCI_ERROR_TERMINATED_MIC_FAILURE 

Connection terminated due to MIC failure

BLE_HCI_ERROR_CONN_FAILED_TO_BE_EST 

Connection failed to be established

BLE_HCI_ERROR_MAC_CONNECTION_FAILED 

MAC connection failed

BLE_HCI_ERROR_COARSE_CLK_ADJUST_REJECTED 

Coarse clock adjustment rejected but will try to adjust using clock dragging

◆ ble_l2cap_connection_status

Connection confirm status

Enumerator
BLE_L2CAP_CONNECTION_SUCCESSFUL 

Connection successful

BLE_L2CAP_CONNECTION_REFUSED_LE_PSM_NOT_SUPPORTED 

LE PSM not supported

BLE_L2CAP_CONNECTION_REFUSED_NO_RESOURCES_AVAILABLE 

No resources available

BLE_L2CAP_CONNECTION_REFUSED_INSUFFICIENT_AUTHENTICATION 

Insufficient authentication

BLE_L2CAP_CONNECTION_REFUSED_INSUFFICIENT_AUTHORIZATION 

Insufficient authorization

BLE_L2CAP_CONNECTION_REFUSED_INSUFFICIENT_ENCRYPTION_KEY_SIZE 

Insufficient encryption key size

BLE_L2CAP_CONNECTION_REFUSED_INSUFFICIENT_ENCRYPTION 

Insufficient encryption

◆ ble_status_t

BLE stack status

◆ gap_adv_chnl_t

Channels used for advertising

Enumerator
GAP_ADV_CHANNEL_37 

Advertising Channel 37 (2402MHz)

GAP_ADV_CHANNEL_38 

Advertising Channel 38 (2426MHz)

GAP_ADV_CHANNEL_39 

Advertising Channel 39 (2480MHz)

◆ gap_air_op_t

GAP air operation types

Enumerator
GAP_AIR_OP_ADV 

Advertise air operation.

GAP_AIR_OP_SCAN 

Scan air operation.

GAP_AIR_OP_INITIATE 

Initiate air operation.

◆ gap_appearance_t

GAP device external appearance

◆ gap_auth_t

enum gap_auth_t

GAP authentication options

Enumerator
GAP_AUTH_NO_MITM_NO_BOND 

No MITM no bonding.

GAP_AUTH_NO_MITM_BOND 

No MITM bonding.

GAP_AUTH_MITM_NO_BOND 

MITM no bonding.

GAP_AUTH_MITM_BOND 

MITM bonding.

◆ gap_conn_mode_t

GAP connectivity modes

Enumerator
GAP_CONN_MODE_NON_CONN 

Non-connectable mode.

GAP_CONN_MODE_UNDIRECTED 

Undirected mode.

GAP_CONN_MODE_DIRECTED 

Directed mode.

GAP_CONN_MODE_DIRECTED_LDC 

Directed Low Duty Cycle mode.

◆ gap_data_type_t

GAP Advertising Data Types, as defined by Bluetooth Core 4.2 specification

Note
: only data types valid for Advertising Data are included
Enumerator
GAP_DATA_TYPE_FLAGS 

Flags

GAP_DATA_TYPE_UUID16_LIST_INC 

Incomplete List of 16-bit Service Class UUIDs

GAP_DATA_TYPE_UUID16_LIST 

Complete List of 16-bit Service Class UUIDs

GAP_DATA_TYPE_UUID32_LIST_INC 

Incomplete List of 32-bit Service Class UUIDs

GAP_DATA_TYPE_UUID32_LIST 

Complete List of 32-bit Service Class UUIDs

GAP_DATA_TYPE_UUID128_LIST_INC 

Incomplete List of 128-bit Service Class UUIDs

GAP_DATA_TYPE_UUID128_LIST 

Complete List of 128-bit Service Class UUIDs

GAP_DATA_TYPE_SHORT_LOCAL_NAME 

Shortened Local Name

GAP_DATA_TYPE_LOCAL_NAME 

Complete Local Name

GAP_DATA_TYPE_TX_POWER_LEVEL 

Tx Power Level

GAP_DATA_TYPE_CLASS_OF_DEVICE 

Class of Device

GAP_DATA_TYPE_SP_HASH_C 

Simple Pairing Hash C-192

GAP_DATA_TYPE_SP_RANDOMIZER_R 

Simple Pairing Randomizer R-192

GAP_DATA_TYPE_TK_VALUE 

Security Manager TK Value

GAP_DATA_TYPE_OOB_FLAGS 

Security Manager Out of Band Flags

GAP_DATA_TYPE_SLAVE_CONN_INTV 

Slave Connection Interval Range

GAP_DATA_TYPE_UUID16_SOLIC 

List of 16-bit Service Solicitation UUIDs

GAP_DATA_TYPE_UUID128_SOLIC 

List of 128-bit Service Solicitation UUIDs

GAP_DATA_TYPE_UUID16_SVC_DATA 

Service Data - 16-bit UUID

GAP_DATA_TYPE_PUBLIC_ADDRESS 

Public Target Address

GAP_DATA_TYPE_RANDOM_ADDRESS 

Random Target Address

GAP_DATA_TYPE_APPEARANCE 

Appearance

GAP_DATA_TYPE_ADV_INTERVAL 

Advertising Interval

GAP_DATA_TYPE_LE_BT_ADDR 

LE Bluetooth Device Address

GAP_DATA_TYPE_LE_ROLE 

LE Role

GAP_DATA_TYPE_SPAIR_HASH 

Simple Pairing Hash C

GAP_DATA_TYPE_SPAIR_RAND 

Simple Pairing Randomizer R

GAP_DATA_TYPE_UUID32_SOLIC 

List of 32-bit Service Solicitation UUIDs

GAP_DATA_TYPE_UUID32_SVC_DATA 

Service Data - 32-bit UUID

GAP_DATA_TYPE_UUID128_SVC_DATA 

Service Data - 128-bit UUID

GAP_DATA_TYPE_LE_SEC_CONN_CFM_VAL 

LE Secure Connections Confirmation Value

GAP_DATA_TYPE_LE_SEC_CONN_RAND_VAL 

LE Secure Connections Random Value

GAP_DATA_TYPE_URI 

URI

GAP_DATA_TYPE_INDOOR_POSITIONING 

Indoor Positioning

GAP_DATA_TYPE_TRANSPORT_DISC_DATA 

Transport Discovery Data

GAP_DATA_TYPE_LE_SUPP_FEATURES 

LE Supported Features

GAP_DATA_TYPE_CHNL_MAP_UPD_IND 

Channel Map Update Indication

GAP_DATA_TYPE_PB_ADV 

PB-ADV

GAP_DATA_TYPE_MESH_MESSAGE 

Mesh Message

GAP_DATA_TYPE_MESH_BEACON 

Mesh Beacon

GAP_DATA_TYPE_INFO_DATA_3D 

3D Information Data

GAP_DATA_TYPE_MANUFACTURER_SPEC 

Manufacturer Specific Data

◆ gap_device_filter_t

Device filter type

See also
ble_gap_get_devices
Enumerator
GAP_DEVICE_FILTER_ALL 

All known devices.

GAP_DEVICE_FILTER_CONNECTED 

All connected devices.

GAP_DEVICE_FILTER_BONDED 

All bonded devices.

GAP_DEVICE_FILTER_ADDRESS 

Device with matching address.

GAP_DEVICE_FILTER_CONN_IDX 

Device with matching connection index.

◆ gap_disc_mode_t

GAP discoverability modes

Enumerator
GAP_DISC_MODE_NON_DISCOVERABLE 

Non-Discoverable mode.

GAP_DISC_MODE_GEN_DISCOVERABLE 

General-Discoverable mode.

GAP_DISC_MODE_LIM_DISCOVERABLE 

Limited-Discoverable mode.

GAP_DISC_MODE_BROADCASTER 

Broadcaster mode.

◆ gap_io_cap_t

GAP Input/Output capabilities

Enumerator
GAP_IO_CAP_DISP_ONLY 

Display only.

GAP_IO_CAP_DISP_YES_NO 

Display yes no.

GAP_IO_CAP_KEYBOARD_ONLY 

Keyboard only.

GAP_IO_CAP_NO_INPUT_OUTPUT 

No input no output.

GAP_IO_CAP_KEYBOARD_DISP 

Keyboard display.

◆ gap_role_t

enum gap_role_t

GAP roles

Enumerator
GAP_NO_ROLE 

No role.

GAP_OBSERVER_ROLE 

Observer role.

GAP_BROADCASTER_ROLE 

Broadcaster role.

GAP_CENTRAL_ROLE 

Central role.

GAP_PERIPHERAL_ROLE 

Peripheral role.

GAP_ALL_ROLES 

All roles.

◆ gap_scan_mode_t

Scanning modes

Enumerator
GAP_SCAN_GEN_DISC_MODE 

General-Discoverable mode.

GAP_SCAN_LIM_DISC_MODE 

Limited-Discoverable mode.

GAP_SCAN_OBSERVER_MODE 

Observer mode.

◆ gap_scan_type_t

Scanning types

Enumerator
GAP_SCAN_ACTIVE 

Active Scan type.

GAP_SCAN_PASSIVE 

Passive Scan type.

◆ gap_sec_level_t

GAP security levels

Enumerator
GAP_SEC_LEVEL_1 

No security.

GAP_SEC_LEVEL_2 

Unauthenticated pairing with encryption.

GAP_SEC_LEVEL_3 

Authenticated pairing with encryption.

GAP_SEC_LEVEL_4 

Authenticated LE Secure Connections pairing with encryption using a 128-bit strength encryption key

◆ gap_tx_power_t

GAP TX power levels

◆ gatt_ccc_t

enum gatt_ccc_t

GATT Client Characteristic Configuration bitmask values

◆ gatt_event_t

GATT event type

◆ gatt_prop_t

GATT characteristic properties

◆ gatt_service_t

GATT service type

◆ gattc_discovery_type_t

Discovery type

Enumerator
GATTC_DISCOVERY_TYPE_SVC 

discovery services type

GATTC_DISCOVERY_TYPE_INCLUDED 

discovery included services type

GATTC_DISCOVERY_TYPE_CHARACTERISTICS 

discovery characteristics type

GATTC_DISCOVERY_TYPE_DESCRIPTORS 

discovery descriptors type

◆ gattc_item_type_t

Service item type

Enumerator
GATTC_ITEM_TYPE_NONE 

invalid or unknown item

GATTC_ITEM_TYPE_INCLUDE 

included service

GATTC_ITEM_TYPE_CHARACTERISTIC 

characteristic

GATTC_ITEM_TYPE_DESCRIPTOR 

characteristic description

◆ gatts_flag_t

GATT Server flags

Enumerator
GATTS_FLAG_CHAR_READ_REQ 

enable BLE_EVT_GATTS_READ_REQ for attribute

◆ own_addr_types

Own Device Address type

Enumerator
PUBLIC_STATIC_ADDRESS 

Public Static Address

PRIVATE_STATIC_ADDRESS 

Private Static Address

PRIVATE_RANDOM_RESOLVABLE_ADDRESS 

Private Random Resolvable Address

PRIVATE_RANDOM_NONRESOLVABLE_ADDRESS 

Private Random Non-resolvable Address

◆ tx_power_level_type_t

TX Power Level

Function Documentation

◆ ble_address_cmp()

__STATIC_INLINE bool ble_address_cmp ( const bd_address_t addr1,
const bd_address_t addr2 
)

Compare two BD Addresses.

Parameters
[in]addr11st address
[in]addr22nd address
Returns
true if addr1 and addr2 are the same, false otherwise

◆ ble_address_from_string()

bool ble_address_from_string ( const char *  str,
addr_type_t  addr_type,
bd_address_t address 
)

Convert string to bd_address.

Parameters
[in]straddress as a string
[in]addr_typeaddress type
[out]addressconverted address
Returns
converted address as a bd_address

◆ ble_address_to_string()

const char* ble_address_to_string ( const bd_address_t address)

Convert bd_address to string.

Note
The returned pointer should not be freed since it points to internal static buffer.
Parameters
[in]addressaddress to convert
Returns
converted address as a string

◆ ble_central_start()

ble_error_t ble_central_start ( void  )

Start the BLE module as a central device.

Returns
status code

◆ ble_enable()

ble_error_t ble_enable ( void  )

Enable BLE module.

Returns
status code

◆ ble_gap_address_get()

ble_error_t ble_gap_address_get ( own_address_t address)

Retrieve the currently set BD address.

This API call is used to retrieve the currently set BD address of the device.

Note
Value 00:00:00:00:00:00 will be returned when the own address of the device is not yet valid. This may happen when the application has set a private random address using ble_gap_address_set() and before such an address has been generated by the BLE stack (which will typically happen when the next air operation is started). The application will receive a BLE_EVT_GAP_AIR_OP_BDADDR event when the private random address has been generated. Subsequent calls to ble_gap_address_get() will return a valid own address.
Parameters
[out]addressBuffer to store the BD address
Returns
result code

◆ ble_gap_address_resolve()

ble_error_t ble_gap_address_resolve ( bd_address_t  address)

Resolve a BD address.

Resolve a BD address using the set of IRKs stored in BLE storage.

Parameters
[in]addressBD address to resolve (has to be resolvable private address)

◆ ble_gap_address_set()

ble_error_t ble_gap_address_set ( const own_address_t address,
uint16_t  renew_dur 
)

Set the address of the device.

This API call is used to set the BD address of the device. If the address type is not PRIVATE_STATIC_ADDRESS the address passed is ignored (public static is set either in NVPARAM or using defaultBLE_STATIC_ADDRESS and private random addresses are automatically generated by the BLE stack every renew_dur seconds).

Note
When the address of a peripheral device is set to be non-resolvable, then the advertising type has to be non-connectable.
This API function has to be called prior to creating the attribute database of the device. This is because the device configuration is going to be modified, which will result in clearing the current attribute database (if it exists).
Parameters
[in]addressPointer to the address to be set
[in]renew_durRandom address renew duration in seconds (valid range is 1 to 3600 seconds)
Returns
result code

◆ ble_gap_adv_ad_struct_set()

ble_error_t ble_gap_adv_ad_struct_set ( size_t  ad_len,
const gap_adv_ad_struct_t ad,
size_t  sd_len,
const gap_adv_ad_struct_t sd 
)

Set Advertising Data and Scan Response Data using gap_adv_ad_struct_t type.

This API call sets advertising and scan response data. The function is to be a wrapper to ble_gap_adv_data_set() API. Internally it makes validation and then transforms inputs advertising data before it reuses call to ble_gap_adv_data_set(). The API uses as input gap_adv_ad_struct_t data type that logically expressing AD Data format that conforms to Bluetooth Core Specification [Core 5.0, Vol 3, Part C, 11] Such individual input objects can be easily instantiated by making call to helper macros GAP_ADV_AD_STRUCT(), GAP_ADV_AD_STRUCT_BYTES() and GAP_ADV_AD_STRUCT_DECLARE(). Such objects can be used separately or can be aggregated into an array to feed the API input.

Parameters
[in]ad_lenNumber of Advertising Data objects
[in]adPointer to Advertising Data object(s)
[in]sd_lenNumber of Scan Response Data objects
[in]sdPointer to Scan Response Data object(s)
Returns
result code

◆ ble_gap_adv_chnl_map_get()

ble_error_t ble_gap_adv_chnl_map_get ( uint8_t *  chnl_map)

Get the advertising channel map currently set.

Note
chnl_map will be constructed using the members of gap_adv_chnl_t: GAP_ADV_CHANNEL_37, GAP_ADV_CHANNEL_38, GAP_ADV_CHANNEL_39.
Parameters
[out]chnl_mapChannel map currently used for advertising
Returns
result code

◆ ble_gap_adv_chnl_map_set()

ble_error_t ble_gap_adv_chnl_map_set ( uint8_t  chnl_map)

Set the advertising channel map.

Note
This function has to be called prior to an advertising start (
See also
ble_gap_adv_start()) and it will not modify the channel map of an ongoing advertising operation.
Note
chnl_map must be constructed using the members of gap_adv_chnl_t: GAP_ADV_CHANNEL_37, GAP_ADV_CHANNEL_38, GAP_ADV_CHANNEL_39.
Parameters
[in]chnl_mapChannel map used for advertising
Returns
result code

◆ ble_gap_adv_data_get()

ble_error_t ble_gap_adv_data_get ( uint8_t *  adv_data_len,
uint8_t *  adv_data,
uint8_t *  scan_rsp_data_len,
uint8_t *  scan_rsp_data 
)

Get currently used Advertising Data and Scan Response Data.

Get the Advertising Data and Scan Response Data currently used. This can be used while an advertising operation is in progress. adv_data_len and scan_rsp_data_len can be set to 0 to get the length of the currently set advertising data and scan response data before allocating any buffers.

Parameters
[in,out]adv_data_lenEmpty buffer size on input, length of advertising data set on output
[in]adv_dataPointer to the empty buffer the advertising aata should be copied into
[in,out]scan_rsp_data_lenEmpty buffer size on input, length of scan response data set on output
[in]scan_rsp_dataPointer to the empty buffer the scan response data should be copied into
Returns
result code

◆ ble_gap_adv_data_set()

ble_error_t ble_gap_adv_data_set ( uint8_t  adv_data_len,
const uint8_t *  adv_data,
uint8_t  scan_rsp_data_len,
const uint8_t *  scan_rsp_data 
)

Set advertising Data and scan response data.

This API call is used to modify the advertising data and scan response Data used. It can be used while an advertising operation is in progress. If an advertising operation is not in progress, the new Advertising Data and/or new Scan Response Data will be used the next time function ble_gap_adv_start() is called. The maximum Advertising Data length for undirected connectable advertising is BLE_ADV_DATA_LEN_MAX bytes (31 minus 3 that are reserved to set the Advertising Data type flags - which shall not be set in Advertising Data using this function). The equivalent max length for non-connectable advertising is BLE_NON_CONN_ADV_DATA_LEN_MAX bytes.

Parameters
[in]adv_data_lenLength of the Advertising Data
[in]adv_dataPointer to the Advertising Data
[in]scan_rsp_data_lenLength of the Scan Response Data
[in]scan_rsp_dataPointer to the Scan Response Data
Returns
result code

◆ ble_gap_adv_direct_address_get()

ble_error_t ble_gap_adv_direct_address_get ( bd_address_t address)

Get the peer address used for directed advertising.

Parameters
[out]addressPeer address used for directed advertising
Returns
result code

◆ ble_gap_adv_direct_address_set()

ble_error_t ble_gap_adv_direct_address_set ( const bd_address_t address)

Set peer address used for directed advertising.

Note
This function has to be called prior to an advertising start (
See also
ble_gap_adv_start()) and it will not modify the direct address used for an ongoing advertising operation.
Parameters
[in]addressPeer address used for directed advertising
Returns
result code

◆ ble_gap_adv_filt_policy_get()

ble_error_t ble_gap_adv_filt_policy_get ( adv_filt_pol_t filt_policy)

Get the filtering policy used for advertising.

Parameters
[out]filt_policyFiltering policy used for advertising
Returns
result code

◆ ble_gap_adv_filt_policy_set()

ble_error_t ble_gap_adv_filt_policy_set ( adv_filt_pol_t  filt_policy)

Set the filtering policy used for advertising.

Note
This function has to be called prior to an advertising start (
See also
ble_gap_adv_start()) and it will not modify the filtering policy of an ongoing advertising operation.
Parameters
[in]filt_policyFiltering policy used for advertising
Returns
result code

◆ ble_gap_adv_intv_get()

ble_error_t ble_gap_adv_intv_get ( uint16_t *  adv_intv_min,
uint16_t *  adv_intv_max 
)

Get the currently set advertising interval.

Get the minimum and maximum advertising intervals currently set.

Parameters
[out]adv_intv_minMinimum interval in steps of 0.625ms
[out]adv_intv_maxMaximum interval in steps of 0.625ms
Returns
result code

◆ ble_gap_adv_intv_set()

ble_error_t ble_gap_adv_intv_set ( uint16_t  adv_intv_min,
uint16_t  adv_intv_max 
)

Set the advertising interval.

Set the minimum and maximum interval to be used for advertising. Intervals are set in steps of 0.625ms. Allowed values for intervals span from 0x20 (20ms) to 0x4000 (10.24s), while for non-connectable advertising the range is 0xA0 (100ms) to 0x4000 (10.24s).

Note
This function has to be called prior to an advertising start (
See also
ble_gap_adv_start()) and it will not modify the advertising interval of an ongoing advertising operation.
Parameters
[in]adv_intv_minMinimum interval in steps of 0.625ms
[in]adv_intv_maxMaximum interval in steps of 0.625ms
Returns
result code

◆ ble_gap_adv_mode_get()

ble_error_t ble_gap_adv_mode_get ( gap_disc_mode_t adv_mode)

Get the discoverability mode used for advertising.

Parameters
[out]adv_modeDiscoverability mode
Returns
result code

◆ ble_gap_adv_mode_set()

ble_error_t ble_gap_adv_mode_set ( gap_disc_mode_t  adv_mode)

Set the discoverability mode used for advertising.

Note
This function has to be called prior to an advertising start (
See also
ble_gap_adv_start()) and it will not modify the discoverability mode of an ongoing advertising operation.
Parameters
[in]adv_modeDiscoverability mode used for advertising
Returns
result code

◆ ble_gap_adv_set_permutation()

ble_error_t ble_gap_adv_set_permutation ( uint8_t  permutation_index)

Set the permutation order of the primary advertising channels.

This function sets the order of the primary advertising channels to be used in subsequent advertising events. There are 6 (3!) possible permutations for the arrangement of the channels. The permutations are indexed by their position in lexicographical increasing order.

Parameters
[in]permutation_indexA valid permutation index (0 <= index <= 5), as defined in the following table: permutation_index | channel order -----------------—+------------— 0 | 37, 38, 39 1 | 37, 39, 38 2 | 38, 37, 39 3 | 38, 39, 37 4 | 39, 37, 38 5 | 39, 38, 37
Returns
The result code and additionally BLE_ERROR_INVALID_PARAM if the permutation index is not within [0..5].

◆ ble_gap_adv_start()

ble_error_t ble_gap_adv_start ( gap_conn_mode_t  adv_type)

Start advertising.

This API call is used to start an advertising air operation. If adv_type is set to be GAP_CONN_MODE_NON_CONN or GAP_CONN_MODE_UNDIRECTED, the air operation will go on until it is stopped using ble_gap_adv_stop(). If adv_type is set to be GAP_CONN_MODE_DIRECTED or GAP_CONN_MODE_DIRECTED_LDC (low duty cycle advertising), the air operation will automatically stop after 1.28s. In both cases, upon advertising completion, a BLE_EVT_GAP_ADV_COMPLETED event will be sent to the application.

Parameters
[in]adv_typeType of advertising
Returns
result code

◆ ble_gap_adv_stop()

ble_error_t ble_gap_adv_stop ( void  )

Stop advertising.

This API call is used to stop a previously started advertising air operation. If advertising is successfully stopped, the application will receive a BLE_EVT_GAP_ADV_COMPLETED with status set to BLE_ERROR_CANCELED.

Returns
result code

◆ ble_gap_appearance_get()

ble_error_t ble_gap_appearance_get ( gap_appearance_t appearance)

Get the appearance used for GAP service.

Parameters
[in]appearancePointer to where the appearance value should be stored
Returns
result code

◆ ble_gap_appearance_set()

ble_error_t ble_gap_appearance_set ( gap_appearance_t  appearance,
att_perm_t  perm 
)

Set the appearance used for GAP service.

Note
This API function has to be called prior to creating the attribute database of the device. This is because the device configuration is going to be modified, which will result in clearing the current attribute database (if it exists).
Parameters
[in]appearanceAppearance value
[in]permAppearance attribute write permission
Returns
result code

◆ ble_gap_channel_map_get()

ble_error_t ble_gap_channel_map_get ( uint64_t *  chnl_map)

Get the currently set channel map of the device (device has to be configured as central)

This API call is used to retrieve the channel map currently set for the device. The channel map consists of 37 bits. The n-th bit (in the range 0 to 36) contains the value for the link layer channel index n. A bit equal to 0 indicates that the corresponding channel is unused, and a bit equal to 1 indicates that the corresponding channel is used. The most significant bits are reserved and shall be set to 0.

Parameters
[out]chnl_mapChannel map (only the 37 least significant bits are used)
Returns
result code

◆ ble_gap_channel_map_set()

ble_error_t ble_gap_channel_map_set ( const uint64_t  chnl_map)

Set the channel map of the device (device has to be configured as central)

This API call is used to modify the channel map of the device. The device has to be central to have the ability to change the channel map. The channel map consists of 37 bits. The n-th bit (in the range 0 to 36) contains the value for the link layer channel index n. A bit equal to 0 indicates that the corresponding channel is unused, and a bit equal to 1 indicates that the corresponding channel is used. The most significant bits are reserved and shall be set to 0.

Parameters
[in]chnl_mapChannel map (only the 37 least significant bits are used)
Returns
result code

◆ ble_gap_conn_param_update()

ble_error_t ble_gap_conn_param_update ( uint16_t  conn_idx,
const gap_conn_params_t conn_params 
)

Initiate a connection parameter update.

This call can be used by both the master and the slave of the connection to initiate a connection parameter update. For the master of the connection, the new connection parameters will be applied immediately. For the slave of the connection, a connection parameter update request will be send to the master. If the master accepts the connection parameters, it will be in charge of applying them (which will result in a BLE_EVT_GAP_CONN_PARAM_UPDATED event message to the slave that initiated the connection parameter update process). If 40s elapse without a response from the master, the connection will be terminated.

Parameters
[in]conn_idxConnection index
[in]conn_paramsConnection parameters
Returns
result code

◆ ble_gap_conn_param_update_reply()

ble_error_t ble_gap_conn_param_update_reply ( uint16_t  conn_idx,
bool  accept 
)

Reply to a connection parameter update request.

This call should be used to reply to a connection parameter update request event (BLE_EVT_GAP_CONN_PARAM_UPDATE_REQ) message.

Parameters
[in]conn_idxConnection index
[in]acceptAccept flag (1 to accept, 0 to reject)
Returns
result code

◆ ble_gap_conn_rssi_get()

ble_error_t ble_gap_conn_rssi_get ( uint16_t  conn_idx,
int8_t *  conn_rssi 
)

Retrieve the RSSI of a connection.

This call retrieves the RSSI of an established connection. Value BLE_RSSI_NOT_AVAILABLE of parameter conn_rssi informs that RSSI is not available.

Parameters
[in]conn_idxConnection index
[out]conn_rssiConnection RSSI
Returns
result code

◆ ble_gap_conn_tx_power_set()

ble_error_t ble_gap_conn_tx_power_set ( uint16_t  conn_idx,
gap_tx_power_t  tx_power 
)

Set TX power for given connection.

Set the TX power level to be used for a given connection.

Warning
This function is non-blocking and it returns as soon as a message towards lower layers has been queued. Currently there is no infrastructure to inform the application when the new TX power level has become effective.
Parameters
[in]conn_idxConnection index
[in]tx_powerTX power level (see gap_tx_power_t for available options)

◆ ble_gap_connect()

ble_error_t ble_gap_connect ( const bd_address_t peer_addr,
const gap_conn_params_t conn_params 
)

Connect to a device.

This call initiates a direct connection procedure to a specified device. The application will get a BLE_EVT_GAP_CONNECTED event when the connection is established and a BLE_EVT_GAP_CONNECTION_COMPLETED event when the connection procedure is completed either successfully or with error (in the second case, BLE_EVT_GAP_CONNECTED will not be received).

Parameters
[in]peer_addrPointer to the BD address of the peer device.
[in]conn_paramsPointer to the connection parameters to be used.
Returns
result code

◆ ble_gap_connect_cancel()

ble_error_t ble_gap_connect_cancel ( void  )

Cancel an initiated connection.

This call cancels a previously started connection procedure using ble_gap_connect(). The application will receive a BLE_EVT_GAP_CONNECTION_COMPLETED event with status set to BLE_ERROR_CANCELED if the connection procedure is successfully canceled.

Returns
result code

◆ ble_gap_connect_ce()

ble_error_t ble_gap_connect_ce ( const bd_address_t peer_addr,
const gap_conn_params_t conn_params,
uint16_t  ce_len_min,
uint16_t  ce_len_max 
)

Connect to a device with a defined connection event length.

This is an extension to ble_gap_connect(). It initiates a direct connection procedure to a specified device. The application will get a BLE_EVT_GAP_CONNECTED event when the connection is established and a BLE_EVT_GAP_CONNECTION_COMPLETED event when the connection procedure is completed either successfully or with error (in the second case, BLE_EVT_GAP_CONNECTED will not be received). Compared to ble_gap_connect(), this allows setting the minimum and maximum lengths for the connection event when used by the master of the connection (ce_len_min and ce_len_max will be ignored when used by the slave of the connection).

Parameters
[in]peer_addrPointer to the BD address of the peer device.
[in]conn_paramsPointer to the connection parameters to be used.
[in]ce_len_minMinimum connection event length (in steps of 0.625us)
[in]ce_len_maxMaximum connection event length (in steps of 0.625us)
Returns
result code

◆ ble_gap_data_length_set()

ble_error_t ble_gap_data_length_set ( uint16_t  conn_idx,
uint16_t  tx_length,
uint16_t  tx_time 
)

Set the data length used for TX.

This function will set the maximum transmit data channel PDU payload length and time depending on the conn_idx provided. If conn_idx is set to BLE_CONN_IDX_INVALID then this API sets the preferred TX data length and time for subsequent connections. If conn_idx corresponds to an existing connection, it will set the TX data length and time for the specific connection (and possibly will initiate a Data Length Update procedure as defined in Bluetooth Core v_4.2).

Parameters
[in]conn_idxConnection index (if set to BLE_CONN_IDX_INVALID then the API will set the preferred data length for new connections)
[in]tx_lengthLength for TX data channel PDU payload in octets
[in]tx_timeTime for TX data channel PDU payload (if set to 0 it will be calculated based on the tx_length (with regard to Bluetooth Core v_4.2)
Note
The application will receive one of the following events as response to this API: BLE_EVT_GAP_DATA_LENGTH_CHANGED if data length has been changed BLE_EVT_GAP_DATA_LENGTH_SET_FAILED with error code if data length could not be set
If data length is not changed (i.e. if it is set by application to a value larger than the peer's previously reported RX length) no event will be sent to application. Even though ble_gap_data_length_set() be successfully completed, the data length has not changed.

◆ ble_gap_device_name_get()

ble_error_t ble_gap_device_name_get ( char *  name,
uint8_t *  length 
)

Get the device name used for GAP service.

Parameters
[in]namePointer to empty buffer where the device name (NULL-terminated) shall be placed.
[in,out]lengthEmpty buffer size on input, set length of the ble parameter device name on output.
Returns
result code

◆ ble_gap_device_name_set()

ble_error_t ble_gap_device_name_set ( const char *  name,
att_perm_t  perm 
)

Set the device name used for GAP service.

Note
This API function has to be called prior to creating the attribute database of the device. This is because the device configuration is going to be modified, which will result in clearing the current attribute database (if it exists).
Parameters
[in]namePointer to the device name
[in]permDevice name attribute write permission
Returns
result code

◆ ble_gap_disconnect()

ble_error_t ble_gap_disconnect ( uint16_t  conn_idx,
ble_hci_error_t  reason 
)

Terminate a connection.

This call initiates a disconnection procedure on an established link.

Parameters
[in]conn_idxConnection index
[in]reasonReason for disconnection.
Returns
result code
Note
Valid reasons for initiating a disconnection are: BLE_HCI_ERROR_AUTH_FAILURE BLE_HCI_ERROR_REMOTE_USER_TERM_CON BLE_HCI_ERROR_REMOTE_DEV_TERM_LOW_RESOURCES BLE_HCI_ERROR_REMOTE_DEV_POWER_OFF BLE_HCI_ERROR_UNSUPPORTED_REMOTE_FEATURE BLE_HCI_ERROR_PAIRING_WITH_UNIT_KEY_NOT_SUP BLE_HCI_ERROR_UNACCEPTABLE_CONN_INT If API is called with a different reason, disconnection will fail with return status BLE_ERROR_INVALID_PARAM.
After calling this function, the application will receive one of the following messages: BLE_EVT_GAP_DISCONNECTED when the disconnection procedure was successful. BLE_EVT_GAP_DISCONNECT_FAILED with error status when the disconnection procedure failed.

◆ ble_gap_get_bonded()

ble_error_t ble_gap_get_bonded ( uint8_t *  length,
bd_address_t **  addr 
)

Get bonded devices list.

Addresses for currently bonded devices are returned in addr buffer which is allocated internally and should be freed by called when not needed.

Parameters
[out]lengthLength of returned array
[out]addrArray of bonded addresses

◆ ble_gap_get_connected()

ble_error_t ble_gap_get_connected ( uint8_t *  length,
uint16_t **  conn_idx 
)

Get connected devices list.

Connection indexes for currently connected devices are returned in conn_idx buffer which is allocated internally and should be freed by called when not needed.

Parameters
[out]lengthLength of returned array
[out]conn_idxArray of connections indexes

◆ ble_gap_get_device_by_addr()

ble_error_t ble_gap_get_device_by_addr ( const bd_address_t addr,
gap_device_t gap_device 
)

Get device object by device address.

Parameters
[in]addrDevice address
[out]gap_deviceDevice object
Returns
BLE_STATUS_OK if found, BLE_ERROR_NOT_FOUND otherwise

◆ ble_gap_get_device_by_conn_idx()

ble_error_t ble_gap_get_device_by_conn_idx ( uint16_t  conn_idx,
gap_device_t gap_device 
)

Get device object by connection index.

Parameters
[in]conn_idxConnection index
[out]gap_deviceDevice object
Returns
BLE_STATUS_OK if found, BLE_ERROR_NOT_FOUND otherwise

◆ ble_gap_get_devices()

ble_error_t ble_gap_get_devices ( gap_device_filter_t  filter,
gap_device_filter_data_t filter_data,
size_t *  length,
gap_device_t gap_devices 
)

Return list of known devices.

Parameters
[in]filterdevice list filter to be applied
[in]filter_dataadditional data for filtering (depends on filter)
[in,out]lengthlength of devices list (maximum allowed as input, number of returned as output)
[out]gap_devicesreturned devices
Returns
result code

◆ ble_gap_get_io_cap()

ble_error_t ble_gap_get_io_cap ( gap_io_cap_t io_cap)

Get the I/O capabilities of the device.

Get the currently set Input/Output Capabilities of the device (combined with the peer's I/O capabilities, this will determine which pairing algorithm will be used).

Parameters
[out]io_capIO capabilities

◆ ble_gap_get_sec_level()

ble_error_t ble_gap_get_sec_level ( uint16_t  conn_idx,
gap_sec_level_t level 
)

Get connection security level.

Get the currently established security level on a connection.

Parameters
[in]conn_idxConnection index
[out]levelConnection security level

◆ ble_gap_is_addr_bonded()

ble_error_t ble_gap_is_addr_bonded ( const bd_address_t addr,
bool *  bonded 
)

Get bond state of device (by address)

Parameters
[in]addrDevice address
[out]bondedFlag specifying if the device is bonded
Returns
result code

◆ ble_gap_is_bonded()

ble_error_t ble_gap_is_bonded ( uint16_t  conn_idx,
bool *  bonded 
)

Get bond state of device (by connection index)

Parameters
[in]conn_idxConnection index
[out]bondedFlag specifying if the device is bonded
Returns
result code

◆ ble_gap_mtu_size_get()

ble_error_t ble_gap_mtu_size_get ( uint16_t *  mtu_size)

Get MTU size.

This call retrieves the Maximum Protocol Unit size that is used in exchange MTU transactions with peers.

Parameters
[out]mtu_sizeMTU size
Returns
result code

◆ ble_gap_mtu_size_set()

ble_error_t ble_gap_mtu_size_set ( uint16_t  mtu_size)

Set MTU size.

This call sets the Maximum Protocol Unit size that will be used in exchange MTU transactions with peers.

Note
This API function has to be called prior to creating the attribute database of the device. This is because the device configuration is going to be modified, which will result in clearing the current attribute database (if it exists).
Parameters
[in]mtu_sizeMTU size
Returns
result code

◆ ble_gap_pair()

ble_error_t ble_gap_pair ( uint16_t  conn_idx,
bool  bond 
)

Start pairing.

This call starts a pairing or bonding procedure. Depending on whether the device is master or slave on the connection, it will send a pairing or a security request respectively.

Parameters
[in]conn_idxConnection index
[in]bondWhether it starts pairing or bonding procedure
Returns
BLE_STATUS_OK if request has been send successfully. BLE_ERROR_FAILED if request hasn't been send successfully BLE_ERROR_ALREADY_DONE if device is already paired or bonded respectively BLE_ERROR_INS_RESOURCES if there is BLE_GAP_MAX_BONDED number of bonded devices

◆ ble_gap_pair_reply()

ble_error_t ble_gap_pair_reply ( uint16_t  conn_idx,
bool  accept,
bool  bond 
)

Respond to a pairing request.

The application should use this function to respond to a BLE_EVT_GAP_PAIR_REQ event.

Parameters
[in]conn_idxConnection index
[in]acceptAccept flag
[in]bondBonding flag
Returns
BLE_STATUS_OK if reply has been send successfully. BLE_ERROR_FAILED if reply hasn't been send successfully BLE_ERROR_INS_RESOURCES if there is BLE_GAP_MAX_BONDED number of bonded devices

◆ ble_gap_passkey_reply()

ble_error_t ble_gap_passkey_reply ( uint16_t  conn_idx,
bool  accept,
uint32_t  passkey 
)

Respond to a passkey request.

Respond to a BLE_EVT_GAP_PASSKEY_REQUEST event.

Parameters
[in]conn_idxConnection index
[in]acceptAccept flag
[in]passkeyPasskey entered by user

◆ ble_gap_peer_features_get()

ble_error_t ble_gap_peer_features_get ( uint16_t  conn_idx)

Get peer's features.

This call initiates a Feature Exchange procedure or retrieves the already exchanged peer's features on an established connection. Peer's features will be delivered to the application via BLE_EVT_GAP_PEER_FEATURES event.

Note
For a mapping between bit values and features, see [Vol 6] Part B, Section 4.6 in Bluetooth Core_v5.0.pdf, or look under "BLE supported features" in co_bt.h.
Parameters
[in]conn_idxConnection index
Returns
result code

◆ ble_gap_peer_version_get()

ble_error_t ble_gap_peer_version_get ( uint16_t  conn_idx)

Get peer's version.

This call initiates a Version Exchange procedure or retrieves the already exchanged peer's version on an established connection. Peer's version will be delivered to the application via BLE_EVT_GAP_PEER_VERSION event.

Parameters
[in]conn_idxConnection index
Returns
result code

◆ ble_gap_per_pref_conn_params_get()

ble_error_t ble_gap_per_pref_conn_params_get ( gap_conn_params_t conn_params)

Get the peripheral preferred connection parameters currently set for GAP service.

Parameters
[in]conn_paramsPointer to where the preferred connection parameters shall be stored.
Returns
result code

◆ ble_gap_per_pref_conn_params_set()

ble_error_t ble_gap_per_pref_conn_params_set ( const gap_conn_params_t conn_params)

Set the peripheral preferred connection parameters used for GAP service.

Note
This API function has to be called prior to creating the attribute database of the device. This is because the device configuration is going to be modified, which will result in clearing the current attribute database (if it exists).
Parameters
[in]conn_paramsPreferred connection parameters.
Returns
result code

◆ ble_gap_role_get()

ble_error_t ble_gap_role_get ( gap_role_t role)

Get the GAP role currently set.

This call gets the currently set GAP role of the device.

Parameters
[out]roleGAP role
Returns
result code

◆ ble_gap_role_set()

ble_error_t ble_gap_role_set ( const gap_role_t  role)

Set GAP role.

This call sets the GAP role of the device.

Note
If an air operation is in progress, this function will return with BLE_ERROR_NOT_ALLOWED status.
This API function has to be called prior to creating the attribute database of the device. This is because the device configuration is going to be modified, which will result in clearing the current attribute database (if it exists).
Parameters
[in]roleGAP role
Returns
result code

◆ ble_gap_scan_params_get()

ble_error_t ble_gap_scan_params_get ( gap_scan_params_t scan_params)

Get the scan parameters used for connections.

This call retrieves the scan parameters used when a connection is initiated.

Parameters
[out]scan_paramsPointer to the structure where the scan parameters will be stored.
Returns
result code

◆ ble_gap_scan_params_set()

ble_error_t ble_gap_scan_params_set ( const gap_scan_params_t scan_params)

Set the scan parameters used for connections.

This call sets the scan parameters used for initiated connections. This call won't change the scan parameters of a connection attempt which is in progress (the scan parameters will be set for the next connection attempt).

Note
This call should be used prior to ble_gap_connect(). If a connection attempt is in progress, one should cancel it using the ble_gap_connect_cancel() call, set the desired scan parameters, and call ble_gap_connect() again.
Parameters
[in]scan_paramsPointer to the scan parameters structure
Returns
result code

◆ ble_gap_scan_start()

ble_error_t ble_gap_scan_start ( gap_scan_type_t  type,
gap_scan_mode_t  mode,
uint16_t  interval,
uint16_t  window,
bool  filt_wlist,
bool  filt_dupl 
)

Start scanning for devices.

This call initiates a scan procedure. The scan duration depends on the scan mode selected. In General-discoverable and Limited-discoverable modes, the scan will stop after 10s of activity. In Observer mode, the scan operation will continue until it is stopped using ble_gap_scan_stop(). The scan interval and window can be set in steps of 0.625ms. Allowed values for interval span in the range of 0x4 (2.5ms) to 0x4000 (10.24s).

Parameters
[in]typeActive or passive scanning
[in]modeScan for General-discoverable, Limited-discoverable or for all devices
[in]intervalScan interval in steps of 0.625ms
[in]windowScan window in steps of 0.625ms
[in]filt_wlistEnable or disable white list filtering
[in]filt_duplEnable or disable filtering of duplicates
Returns
result code

◆ ble_gap_scan_stop()

ble_error_t ble_gap_scan_stop ( void  )

Stop scanning for devices.

This call stops a scan procedure previously started using ble_gap_scan_start().

Returns
result code

◆ ble_gap_set_io_cap()

ble_error_t ble_gap_set_io_cap ( gap_io_cap_t  io_cap)

Set the I/O capabilities of the device.

Set the Input/Output Capabilities of the device (combined with the peer's I/O capabilities, this will determine which pairing algorithm will be used).

Parameters
[in]io_capnew IO capabilities

◆ ble_gap_set_sec_level()

ble_error_t ble_gap_set_sec_level ( uint16_t  conn_idx,
gap_sec_level_t  level 
)

Set connection security level.

Use this function to set the security level for a connection. If the device is already bonded, it will use the existing LTK or request a new bonding. If the device is not bonded, it will create a pairing or a security request (depending on whether the device is master or slave on the connection) with the bond flag set to false.

Parameters
[in]conn_idxConnection index
[in]levelNew security level
Returns
result code

◆ ble_gap_tx_power_set()

ble_error_t ble_gap_tx_power_set ( uint8_t  air_operation,
gap_tx_power_t  tx_power 
)

Set TX power for air operations.

Set the TX power level to be used for advertising, scanning and/or initiating a connection. This TX power level setting will be also used for the connection that may be established as a result of the air operation.

Warning
This function is non-blocking and it returns as soon as a message towards lower layers has been queued. Currently there is no infrastructure to inform the application when the new TX power level has become effective.
Parameters
[in]air_operationAir operation(s) (combine gap_air_op_t available options)
[in]tx_powerTX power level (see gap_tx_power_t for available options)

◆ ble_gap_unpair()

ble_error_t ble_gap_unpair ( const bd_address_t addr)

Unpair command.

Use this function to unpair a device. This will also remove the device bond data from BLE storage.

Parameters
[in]addrRemote device address
Returns
result code

◆ ble_gattc_browse()

ble_error_t ble_gattc_browse ( uint16_t  conn_idx,
const att_uuid_t *  uuid 
)

Browse services on remote GATT server.

This will automatically discover all characteristics and descriptors of a service. To discover services only, use ble_gattc_discover_svc() instead.

BLE_EVT_GATTC_BROWSE_SVC will be sent for each service found. Once completed BLE_EVT_GATTC_BROWSE_COMPLETED will be sent.

If uuid is NULL, all services are returned.

Parameters
[in]conn_idxconnection index
[in]uuidoptional service UUID
Returns
result code
See also
ble_gattc_discover_svc()
ble_gattc_browse_range()

◆ ble_gattc_browse_range()

ble_error_t ble_gattc_browse_range ( uint16_t  conn_idx,
uint16_t  start_h,
uint16_t  end_h,
const att_uuid_t *  uuid 
)

Browse services on remote GATT server in a given range.

This will automatically discover all characteristics and descriptors of a service in the range between start_h and end_h.

BLE_EVT_GATTC_BROWSE_SVC will be sent for each service found. Once completed BLE_EVT_GATTC_BROWSE_COMPLETED will be sent.

If uuid is NULL, all services in range are returned.

Parameters
[in]conn_idxconnection index
[in]start_hbeginning of browse range
[in]end_hend of browse range
[in]uuidoptional service UUID
Returns
result code
See also
ble_gattc_discover_svc()
ble_gattc_browse()

◆ ble_gattc_discover_char()

ble_error_t ble_gattc_discover_char ( uint16_t  conn_idx,
uint16_t  start_h,
uint16_t  end_h,
const att_uuid_t *  uuid 
)

Discover characteristics on remote GATT server.

BLE_EVT_GATTC_DISCOVER_CHAR will be sent for each characteristic found. Once completed BLE_EVT_GATTC_DISCOVER_COMPLETED will be sent.

If uuid is NULL, all characteristics are returned.

Parameters
[in]conn_idxconnection index
[in]start_hstart handle of service to discover
[in]end_hend handle of service to discover
[in]uuidoptional characteristic UUID
Returns
result code
See also
ble_gattc_discover_desc()

◆ ble_gattc_discover_desc()

ble_error_t ble_gattc_discover_desc ( uint16_t  conn_idx,
uint16_t  start_h,
uint16_t  end_h 
)

Discover descriptors on remote GATT server.

BLE_EVT_GATTC_DISCOVER_DESC will be sent for each descriptor found. Once completed BLE_EVT_GATTC_DISCOVER_COMPLETED will be sent.

Parameters
[in]conn_idxconnection index
[in]start_hstart handle of characteristic to discover
[in]end_hend handle of characteristic to discover
Returns
result code

◆ ble_gattc_discover_include()

ble_error_t ble_gattc_discover_include ( uint16_t  conn_idx,
uint16_t  start_h,
uint16_t  end_h 
)

Discover included services on remote GATT server.

BLE_EVT_GATTC_DISCOVER_INCLUDE will be sent for each included service found. Once completed BLE_EVT_GATTC_DISCOVER_COMPLETED will be sent.

Parameters
[in]conn_idxconnection index
[in]start_hstart handle of service to discover
[in]end_hend handle of service to discover
Returns
result code

◆ ble_gattc_discover_svc()

ble_error_t ble_gattc_discover_svc ( uint16_t  conn_idx,
const att_uuid_t *  uuid 
)

Discover services on remote GATT server.

BLE_EVT_GATTC_DISCOVER_SVC will be sent for each service found. Once completed BLE_EVT_GATTC_DISCOVER_COMPLETED will be sent.

If uuid is NULL, all services are returned.

Parameters
[in]conn_idxconnection index
[in]uuidoptional service UUID
Returns
result code
See also
ble_gattc_browse()
ble_gattc_discover_char()
ble_gattc_discover_desc()

◆ ble_gattc_exchange_mtu()

ble_error_t ble_gattc_exchange_mtu ( uint16_t  conn_idx)

Exchange MTU.

This call will start an MTU exchange procedure with the MTU previously set using ble_gap_mtu_size_set(). If the MTU has been changed during the negotiation, a BLE_EVT_GATTC_MTU_CHANGED event will be sent to the application.

Parameters
[in]conn_idxconnection index
Returns
result code

◆ ble_gattc_get_mtu()

ble_error_t ble_gattc_get_mtu ( uint16_t  conn_idx,
uint16_t *  mtu 
)

Get current TX MTU for peer.

Parameters
[in]conn_idxconnection index
[out]mtucurrent MTU
Returns
result code

◆ ble_gattc_indication_cfm()

ble_error_t ble_gattc_indication_cfm ( uint16_t  conn_idx,
uint16_t  handle 
)

Send confirmation for received indication.

Parameters
[in]conn_idxconnection index
[in]handleattribute handle
Returns
result code
Deprecated:
This function is deprecated because all indications are confirmed by the BLE framework immediately after reception. To avoid sending wrong confirmations calling this function has no effect.

◆ ble_gattc_read()

ble_error_t ble_gattc_read ( uint16_t  conn_idx,
uint16_t  handle,
uint16_t  offset 
)

Read attribute from remote GATT server.

This uses either the "Read Characteristic Value" procedure or the "Read Characteristic Descriptor" procedure, depending on the attribute pointed by handle. If offset is non-zero or the attribute length is larger than the MTU, the "Read Long Characteristic Value" procedure or the "Read Long Characteristic Descriptor" procedure will be used respectively. The complete attribute value will be returned in the BLE_EVT_GATTC_READ_COMPLETED event.

Parameters
[in]conn_idxconnection index
[in]handleattribute handle
[in]offsetvalue offset to start with
Returns
result code

◆ ble_gattc_util_find_characteristic()

const gattc_item_t* ble_gattc_util_find_characteristic ( const att_uuid_t *  uuid)

Find characteristic in browse event.

This call will return the first characteristic from the event which matches the given UUID (in case uuid is NULL, the first characteristic will be returned). Subsequent calls with the same given uuid will return subsequent characteristics matching the same criteria or NULL if no more matching characteristics are found.

ble_gattc_util_find_init() must be called prior to calling this function.

Subsequent calls with different uuid will restart searching from the first characteristic.

The returned item will always have the GATTC_ITEM_TYPE_CHARACTERISTIC type.

Parameters
[in]uuidoptional UUID of characteristic
Returns
found item
See also
ble_gattc_util_find_init()

◆ ble_gattc_util_find_descriptor()

const gattc_item_t* ble_gattc_util_find_descriptor ( const att_uuid_t *  uuid)

Find descriptor in browse event.

This call will return the first descriptor from the event which matches the given UUID (if uuid is NULL, the first descriptor will be returned). Subsequent calls with the same given uuid will return subsequent descriptors matching the same criteria or NULL if no more matching descriptors are found.

ble_gattc_util_find_characteristic() must be called and the specified characteristic must be found prior to calling this function.

Subsequent calls with different uuid will restart searching from the first descriptor.

Returned item will always have the GATTC_ITEM_TYPE_DESCRIPTOR type.

Parameters
[in]uuidoptional UUID of descriptor
Returns
found item
See also
ble_gattc_util_find_characteristic()

◆ ble_gattc_util_find_init()

void ble_gattc_util_find_init ( const ble_evt_gattc_browse_svc_t evt)

Initialize browse event iterators.

This call will initialize internal structures to iterate over BLE_EVT_GATTC_BROWSE_SVC. After this call the application can use ble_gattc_util_find_characteristic() to get a characteristic from the event. evt instance should be valid as long as the iterator is used since only weak reference is stored internally.

Parameters
[in]evtinstance of event

◆ ble_gattc_util_write_ccc()

__STATIC_INLINE ble_error_t ble_gattc_util_write_ccc ( uint16_t  conn_idx,
uint16_t  handle,
gatt_ccc_t  ccc 
)

Write value to CCC descriptor.

This function writes a Client Characteristic Configuration Descriptor value to a given handle.

Parameters
[in]conn_idxconnection index
[in]handleCCC descriptor handle
[in]cccvalue to be written
Returns
status of GATT write operation

◆ ble_gattc_write()

ble_error_t ble_gattc_write ( uint16_t  conn_idx,
uint16_t  handle,
uint16_t  offset,
uint16_t  length,
const uint8_t *  value 
)

Write attribute to remote GATT server.

This uses either the "Write Characteristic Value" procedure or the "Write Characteristic Descriptor" procedure, depending on the attribute pointed by handle. If offset is non-zero or the attribute length is larger than the MTU, the "Write Long Characteristic Value" procedure or the "Write Long Characteristic Descriptor" procedure will be used respectively.

The application will receive a BLE_EVT_GATTC_WRITE_COMPLETED event when the write operation is completed.

Parameters
[in]conn_idxconnection index
[in]handleattribute handle
[in]offsetvalue offset to start with
[in]lengthvalue length
[in]valuevalue data
Returns
result code

◆ ble_gattc_write_execute()

ble_error_t ble_gattc_write_execute ( uint16_t  conn_idx,
bool  commit 
)

Execute reliable/long write to remote GATT server.

In order to cancel prepared requests, commit shall be set to false.

The application will receive a BLE_EVT_GATTC_WRITE_COMPLETED event when write queue is executed. The handle parameter of this event will be set to 0.

Parameters
[in]conn_idxconnection index
[in]committrue if data shall be written, false otherwise
Returns
result code

◆ ble_gattc_write_no_resp()

ble_error_t ble_gattc_write_no_resp ( uint16_t  conn_idx,
uint16_t  handle,
bool  signed_write,
uint16_t  length,
const uint8_t *  value 
)

Write attribute to remote GATT server (without response)

If signed_write is set to false, the "Write Without Response" procedure will be used. If signed_write is set to true, the "Signed Write Without Response" procedure will be used on a link which is not encrypted or will fall back to the "Write Without Response" procedure on a link that is already encrypted.

The application will receive a BLE_EVT_GATTC_WRITE_COMPLETED event when the write operation is performed.

Parameters
[in]conn_idxconnection index
[in]handleattribute handle
[in]signed_writetrue if signed write should be used if possible/applicable
[in]lengthvalue length
[in]valuevalue data
Returns
result code

◆ ble_gattc_write_prepare()

ble_error_t ble_gattc_write_prepare ( uint16_t  conn_idx,
uint16_t  handle,
uint16_t  offset,
uint16_t  length,
const uint8_t *  value 
)

Prepare long/reliable write to remote GATT server.

The application will receive a BLE_EVT_GATTC_WRITE_COMPLETED event when the write operation is queued.

Parameters
[in]conn_idxconnection index
[in]handleattribute handle
[in]offsetvalue offset
[in]lengthvalue length
[in]valuevalue data
Returns
result code

◆ ble_gatts_add_characteristic()

ble_error_t ble_gatts_add_characteristic ( const att_uuid_t *  uuid,
gatt_prop_t  prop,
att_perm_t  perm,
uint16_t  max_len,
gatts_flag_t  flags,
uint16_t *  h_offset,
uint16_t *  h_val_offset 
)

Add characteristic to GATT service.

This adds a characteristic declaration to the service added by ble_gatts_add_service().

The application will receive a BLE_EVT_GATTS_WRITE_REQ event every time a value is written by the peer to the attribute. In order for application to receive also a BLE_EVT_GATTS_READ_REQ event every time the attribute's value is read by peer, flags shall be set to GATTS_FLAG_CHAR_READ_REQ.

Note
If an Extended Characteristic Properties Descriptor is to be added to this characteristic, extended properties shall be added to prop. It will be used later to set the correct descriptor's value.
Parameters
[in]uuidcharacteristic UUID
[in]propcharacteristic properties
[in]permcharacteristic value attribute permissions
[in]max_lenmaximum length of characteristic value
[in]flagsadditional settings for characteristic
[out]h_offsetattribute offset (relative to service handle)
[out]h_val_offsetvalue attribute offset (relative to service handle)
Returns
result code

◆ ble_gatts_add_descriptor()

ble_error_t ble_gatts_add_descriptor ( const att_uuid_t *  uuid,
att_perm_t  perm,
uint16_t  max_len,
gatts_flag_t  flags,
uint16_t *  h_offset 
)

Add descriptor to GATT service.

This adds a characteristic declaration to the service added by ble_gatts_add_service().

The application will receive a BLE_EVT_GATTS_WRITE_REQ event every time the attribute is written by the peer. In order for application to receive also a BLE_EVT_GATTS_READ_REQ event every time the attribute is read by the peer, flags shall be set to GATTS_FLAG_CHAR_READ_REQ.

Note
For some descriptors the BLE_EVT_GATTS_READ_REQ event will be sent regardless of the flags value. This applies e.g. to the Client Characteristic Configuration descriptor.
In case of the Extended Characteristic Properties Descriptor, the descriptor's value will be updated based on the properties passed using ble_gatts_add_characteristic().
Parameters
[in]uuiddescriptor UUID
[in]permdescriptor attribute permissions
[in]max_lenmaximum length of descriptor value
[in]flagsadditional settings for descriptor
[out]h_offsetattribute offset (relative to service handle)
Returns
result code

◆ ble_gatts_add_include()

ble_error_t ble_gatts_add_include ( uint16_t  handle,
uint16_t *  h_offset 
)

Add included service to GATT service.

This adds an included service declaration to the service added by ble_gatts_add_service().

Parameters
[in]handleincluded service handle
[out]h_offsetattribute offset (relative to service handle)
Returns
result code

◆ ble_gatts_add_service()

ble_error_t ble_gatts_add_service ( const att_uuid_t *  uuid,
const gatt_service_t  type,
uint16_t  num_attrs 
)

Add new GATT service.

This initiates the addition of a new service to ATT database. Subsequent calls to ble_gatts_add_include(), ble_gatts_add_characteristic() and ble_gatts_add_descriptor() will add attributes to the service added by this call. All of these calls should be in the same order as attributes should be added to the database.

The Service is added to the database and enabled once ble_gatts_register_service() is called after all attributes have been added.

Parameters
[in]uuidservice UUID
[in]typeservice type
[in]num_attrsnumber of attributes to be added
Returns
result code
See also
ble_gatts_add_include()
ble_gatts_add_characteristic()
ble_gatts_add_descriptor()
ble_gatts_register_service()
ble_gatts_get_num_attr()

◆ ble_gatts_disable_service()

ble_error_t ble_gatts_disable_service ( uint16_t  handle)

Disable service in database.

This makes a service invisible to clients. Once registered, services are always enabled by default. Since this function may change the database structure, application shall ensure that the Service Changed characteristic is enabled in the database (bit 0x20 is set in defaultBLE_ATT_DB_CONFIGURATION) and indicated if necessary.

Parameters
[in]handleservice start handle
Returns
result code
See also
ble_gatts_service_changed_ind()

◆ ble_gatts_enable_service()

ble_error_t ble_gatts_enable_service ( uint16_t  handle)

Enable service in database.

This makes a service visible to clients. Once registered, services are always enabled by default. Since this function may change the database structure, the application shall ensure that the Service Changed characteristic is enabled in the database (bit 0x20 is set in defaultBLE_ATT_DB_CONFIGURATION) and indicated if necessary.

Parameters
[in]handleservice start handle
Returns
result code
See also
ble_gatts_service_changed_ind()

◆ ble_gatts_get_characteristic_prop()

ble_error_t ble_gatts_get_characteristic_prop ( uint16_t  handle,
gatt_prop_t prop,
att_perm_t perm 
)

Read current characteristic properties and permissions.

Parameters
[in]handlecharacteristic value handle
[out]propcharacteristic properties
[out]permcharacteristic permissions
Returns
result code
See also
ble_gatts_set_characteristic_prop()

◆ ble_gatts_get_num_attr()

__STATIC_INLINE uint16_t ble_gatts_get_num_attr ( uint16_t  include,
uint16_t  characteristic,
uint16_t  descriptor 
)

Calculate number of attributes required for service.

Parameters
[in]includenumber of included services
[in]characteristicnumber of characteristics
[in]descriptornumber of descriptors
Returns
number of attributes required

◆ ble_gatts_get_value()

ble_error_t ble_gatts_get_value ( uint16_t  handle,
uint16_t *  length,
void *  value 
)

Get attribute value.

This retrieves an attribute's value from the database. Up to size bytes are copied to val buffer. The value returned in size is the total attribute value length and may be larger than the supplied size. This information can be used by the application to allocate a larger buffer that fits the complete attribute value.

Parameters
[in]handleattribute handle
[in,out]lengthinput buffer size or attribute value length
[out]valuebuffer to store attribute value
Returns
result code

◆ ble_gatts_prepare_write_cfm()

ble_error_t ble_gatts_prepare_write_cfm ( uint16_t  conn_idx,
uint16_t  handle,
uint16_t  length,
att_error_t  status 
)

Respond to an attribute prepare write request.

The application should use this function to respond to a BLE_EVT_GATTS_PREPARE_WRITE_REQ event.

Parameters
[in]conn_idxconnection index
[in]handleattribute handle
[in]lengthattribute value length
[in]statusoperation status
Returns
result code

◆ ble_gatts_read_cfm()

ble_error_t ble_gatts_read_cfm ( uint16_t  conn_idx,
uint16_t  handle,
att_error_t  status,
uint16_t  length,
const void *  value 
)

Respond to an attribute read request.

The application should use this function to respond to a BLE_EVT_GATTS_READ_REQ event.

Parameters
[in]conn_idxconnection index
[in]handleattribute handle
[in]statusoperation status
[in]lengthattribute value length
[in]valueattribute value
Returns
result code

◆ ble_gatts_register_service()

ble_error_t ble_gatts_register_service ( uint16_t *  handle,
  ... 
)

Register service in database.

This adds all attributes previously added to the service to the attribute database.

handle can be used to calculate the actual handle values for offset values returned in h_offset and h_val_offset parameters. A series of pointers to offset values can be specified as arguments in order for this function to update them automatically.

Parameters
[out]handleservice handle
[out]...attributes offsets to be translated (shall end with 0)
Returns
result code

◆ ble_gatts_send_event()

ble_error_t ble_gatts_send_event ( uint16_t  conn_idx,
uint16_t  handle,
gatt_event_t  type,
uint16_t  length,
const void *  value 
)

Send a characteristic value notification or indication.

Send an indication or a notification of an attribute's value to a connected peer.

The application will receive a BLE_EVT_GATTS_EVENT_SENT event when the notification is successfully sent over the air.

Note
The characteristic must have either the GATT_PROP_NOTIFY or the GATT_PROP_INDICATE property.
If a disconnection happens after calling this function or the notification cannot be successfully sent over the air due to e.g. a bad connection, the BLE_EVT_GATTS_EVENT_SENT event may not be received.
Parameters
[in]conn_idxconnection index
[in]handlecharacteristic value handle
[in]typeindication or notification
[in]lengthcharacteristic value length
[in]valuecharacteristic value
Returns
result code

◆ ble_gatts_service_changed_ind()

ble_error_t ble_gatts_service_changed_ind ( uint16_t  conn_idx,
uint16_t  start_handle,
uint16_t  end_handle 
)

Send indication of the Service Changed Characteristic.

This should be called only if the Service Changed Characteristic is enabled in the attribute database configuration (bit 0x20 is set in defaultBLE_ATT_DB_CONFIGURATION).

Parameters
[in]conn_idxconnection index
[in]start_handlestart handle of affected database region
[in]end_handleend handle of affected database region
Returns
result code

◆ ble_gatts_set_characteristic_prop()

ble_error_t ble_gatts_set_characteristic_prop ( uint16_t  handle,
gatt_prop_t  prop,
att_perm_t  perm 
)

Set characteristic properties and permissions.

As mandated by Core Specification version 4.1, characteristic declarations shall not change while a bond with any device exists on the server. THe application shall ensure it does not use this API to change the characteristic properties while such bond exists.

Parameters
[in]handlecharacteristic value handle
[in]propcharacteristic properties
[in]permcharacteristic permissions
Returns
result code
See also
ble_gatts_get_characteristic_prop()

◆ ble_gatts_set_value()

ble_error_t ble_gatts_set_value ( uint16_t  handle,
uint16_t  length,
const void *  value 
)

Set attribute value.

This sets an attribute's value in the internal database. Any read request from any peer will have this value returned. In order for an attribute to have different values for each peer, the application should store them locally and use BLE_EVT_GATTS_READ_REQ to handle read requests for a given attribute.

Parameters
[in]handleattribute handle
[in]lengthattribute value length
[in]valueattribute value
Returns
result code

◆ ble_gatts_write_cfm()

ble_error_t ble_gatts_write_cfm ( uint16_t  conn_idx,
uint16_t  handle,
att_error_t  status 
)

Respond to an attribute write request.

The application should use this function to respond to a BLE_EVT_GATTS_WRITE_REQ event.

Note
The application shall also use this to confirm write requests for characteristics with the "Write Without Response" property set.
Parameters
[in]conn_idxconnection index
[in]handleattribute handle
[in]statusoperation status
Returns
result code

◆ ble_get_event()

ble_evt_hdr_t* ble_get_event ( bool  wait)

Get event from BLE event queue.

Parameters
[in]waitif true, function will block until there is event in queue
Returns
event buffer or NULL if no event was retrieved

◆ ble_handle_event_default()

void ble_handle_event_default ( ble_evt_hdr_t hdr)

Execute default event handler.

It's recommended for application to call this for any event it does not handle. This avoids situation when BLE stack is waiting for response on event which application does not handle.

Parameters
[in]hdrevent buffer

◆ ble_has_event()

bool ble_has_event ( void  )

Checks if there's event pending in event queue.

Returns
true if there is at least one event waiting in queue, false otherwise

◆ ble_l2cap_add_credits()

ble_error_t ble_l2cap_add_credits ( uint16_t  conn_idx,
uint16_t  scid,
uint16_t  credits 
)

Add local credits on channel.

Application should monitor contents of local_credits_consumed member of BLE_EVT_L2CAP_DATA_IND event and give back appropriate number of local credits when processing of incoming data is completed.

Parameters
[in]conn_idxConnection index
[in]scidSource CID
[in]creditsNumber of credits to be added
Returns
result code

◆ ble_l2cap_conn_param_update()

ble_error_t ble_l2cap_conn_param_update ( uint16_t  conn_idx,
const gap_conn_params_t conn_params 
)

Initiate a connection parameter update over L2CAP.

This call can be used only by the slave of a connection to initiate a connection parameter request to the master over L2CAP, instead of using ble_gap_conn_param_update() which triggers the connection parameter request procedure. Successful connection parameters update will result in a BLE_EVT_GAP_CONN_PARAM_UPDATED event message. Unsuccessful connection parameters update (connection parameters rejected by the master) will not result in any event message to the application.

Parameters
[in]conn_idxConnection index
[in]conn_paramsPointer to the connection parameters
Returns
result code
Deprecated:
Switch to
See also
ble_gap_conn_param_update(), which has the same prototype.

◆ ble_l2cap_connect()

ble_error_t ble_l2cap_connect ( uint16_t  conn_idx,
uint16_t  psm,
uint16_t  initial_credits,
uint16_t *  scid 
)

Connect a connection oriented channel to remote peer.

Parameters
[in]conn_idxConnection index
[in]psmLE Protocol/Service Multiplexer
[in]initial_creditsInitial credits on channel
[out]scidSource CID for created channel
Returns
result code
See also
ble_l2cap_disconnect()

◆ ble_l2cap_connection_cfm()

ble_error_t ble_l2cap_connection_cfm ( uint16_t  conn_idx,
uint16_t  scid,
enum ble_l2cap_connection_status  status 
)

Accept or reject incoming connection.

Accepted connection will be signaled using BLE_EVT_L2CAP_CONNECTED event.

Parameters
[in]conn_idxConnection index
[in]scidSource CID for created channel
[in]statusStatus of operation
Returns
result code
See also
ble_l2cap_listen_defer_setup()

◆ ble_l2cap_disconnect()

ble_error_t ble_l2cap_disconnect ( uint16_t  conn_idx,
uint16_t  scid 
)

Disconnect channel.

scid should identify channel which was received in BLE_EVT_L2CAP_CONNECTED event.

Parameters
[in]conn_idxConnection index
[in]scidSource CID for channel to be disconnected
Returns
result code

◆ ble_l2cap_listen()

ble_error_t ble_l2cap_listen ( uint16_t  conn_idx,
uint16_t  psm,
gap_sec_level_t  sec_level,
uint16_t  initial_credits,
uint16_t *  scid 
)

Create a connection oriented channel listening for incoming connections.

Incoming connection will be signaled using BLE_EVT_L2CAP_CONNECTED event.

Note
It's possible to have only single connection using given PSM (either incoming or outgoing).
Parameters
[in]conn_idxConnection index
[in]psmLE Protocol/Service Multiplexer
[in]sec_levelChannel security
[in]initial_creditsInitial credits on channel
[out]scidSource CID for created channel
Returns
result code
See also
ble_l2cap_stop_listen()

◆ ble_l2cap_listen_defer_setup()

ble_error_t ble_l2cap_listen_defer_setup ( uint16_t  conn_idx,
uint16_t  psm,
gap_sec_level_t  sec_level,
uint16_t  initial_credits,
uint16_t *  scid 
)

Create a connection oriented channel listening for incoming connections.

Incoming connection will be signaled using BLE_EVT_L2CAP_CONNECTION_REQ event.

Note
It's possible to have only single connection using given PSM (either incoming or outgoing).
Parameters
[in]conn_idxConnection index
[in]psmLE Protocol/Service Multiplexer
[in]sec_levelChannel security
[in]initial_creditsInitial credits on channel
[out]scidSource CID for created channel
Returns
result code
See also
ble_l2cap_stop_listen()

◆ ble_l2cap_send()

ble_error_t ble_l2cap_send ( uint16_t  conn_idx,
uint16_t  scid,
uint16_t  length,
const void *  data 
)

Send data on channel.

Parameters
[in]conn_idxConnection index
[in]scidSource CID
[in]lengthLength of data to be sent
[in]dataData to be sent
Returns
result code

◆ ble_l2cap_stop_listen()

ble_error_t ble_l2cap_stop_listen ( uint16_t  conn_idx,
uint16_t  scid 
)

Stop listening for incoming connections.

scid should identify channel previously created with ble_l2cap_listen().

Parameters
[in]conn_idxConnection index
[in]scidSource CID for channel to stop listening on
Returns
result code

◆ ble_peripheral_start()

ble_error_t ble_peripheral_start ( void  )

Start the BLE module as a peripheral device.

Returns
status code

◆ ble_read_tx_power()

ble_error_t ble_read_tx_power ( uint16_t  conn_idx,
tx_power_level_type_t  type,
uint8_t *  tx_power 
)

Read controller TX power.

Parameters
[in]conn_idxconnection index
[in]typetype of TX power
[out]tx_powerreturned tx_power in case of success
Returns
status code

◆ ble_register_app()

ble_error_t ble_register_app ( void  )

Register application in BLE framework.

Returns
status code

◆ ble_reset()

ble_error_t ble_reset ( void  )

Reset BLE module.

Returns
status code

◆ ble_set_fem_voltage_trim()

ble_error_t ble_set_fem_voltage_trim ( uint8_t  channel,
uint8_t  value 
)

Set FEM Voltage GPIO values for a specific channel.

This sets the values of the 3 FEM voltage trim GPIOs. Bit X, X in[0, 2] of this value corresponds to the desired state for the respective GPIO.

Note
The 3 GPIOs must be configured through the FEM driver, using the dg_configFEM_SKY66112_11_ANT_TRIM_X_PORT/PIN, X in [0, 2] macros for this to work.
Parameters
[in]channelThe BLE physical channel to configure the GPIOs for, as defined by channel = (freq - 2402)/2, where freq is the channel frequency.
[in]valueThe 3-bit value to be configured
Returns
status code

◆ ble_storage_get_buffer()

ble_error_t ble_storage_get_buffer ( uint16_t  conn_idx,
ble_storage_key_t  key,
uint16_t *  length,
void **  ptr 
)

Get buffer value from storage.

This has unpredictable result when used with key which stores signed or unsigned value, no sanity checks are performed. Value of value is not changed if key is not found in storage.

Parameters
[in]conn_idxconnection index
[in]keystorage key (attribute handle)
[out]lengthlength of returned buffer
[out]ptrpointer to buffer
Returns
error code

◆ ble_storage_get_i16()

ble_error_t ble_storage_get_i16 ( uint16_t  conn_idx,
ble_storage_key_t  key,
int16_t *  value 
)

Get int16 value from storage.

This has unpredictable result when used with key which stores unsigned value or buffer, no sanity checks are performed. Value of value is not changed if key is not found in storage.

Parameters
[in]conn_idxconnection index
[in]keystorage key (attribute handle)
[out]valuevalue
Returns
error code

◆ ble_storage_get_i32()

ble_error_t ble_storage_get_i32 ( uint16_t  conn_idx,
ble_storage_key_t  key,
int32_t *  value 
)

Get int32 value from storage.

This has unpredictable result when used with key which stores unsigned value or buffer, no sanity checks are performed. Value of value is not changed if key is not found in storage.

Parameters
[in]conn_idxconnection index
[in]keystorage key (attribute handle)
[out]valuevalue
Returns
error code

◆ ble_storage_get_i8()

ble_error_t ble_storage_get_i8 ( uint16_t  conn_idx,
ble_storage_key_t  key,
int8_t *  value 
)

Get int8 value from storage.

This has unpredictable result when used with key which stores unsigned value or buffer, no sanity checks are performed. Value of value is not changed if key is not found in storage.

Parameters
[in]conn_idxconnection index
[in]keystorage key (attribute handle)
[out]valuevalue
Returns
error code

◆ ble_storage_get_u16()

ble_error_t ble_storage_get_u16 ( uint16_t  conn_idx,
ble_storage_key_t  key,
uint16_t *  value 
)

Get uint16 value from storage.

This has unpredictable result when used with key which stores signed value or buffer, no sanity checks are performed. Value of value is not changed if key is not found in storage.

Parameters
[in]conn_idxconnection index
[in]keystorage key (attribute handle)
[out]valuevalue
Returns
error code

◆ ble_storage_get_u32()

ble_error_t ble_storage_get_u32 ( uint16_t  conn_idx,
ble_storage_key_t  key,
uint32_t *  value 
)

Get uint32 value from storage.

This has unpredictable result when used with key which stores signed value or buffer, no sanity checks are performed. Value of value is not changed if key is not found in storage.

Parameters
[in]conn_idxconnection index
[in]keystorage key (attribute handle)
[out]valuevalue
Returns
error code

◆ ble_storage_get_u8()

ble_error_t ble_storage_get_u8 ( uint16_t  conn_idx,
ble_storage_key_t  key,
uint8_t *  value 
)

Get uint8 value from storage.

This has unpredictable result when used with key which stores signed value or buffer, no sanity checks are performed. Value of value is not changed if key is not found in storage.

Parameters
[in]conn_idxconnection index
[in]keystorage key (attribute handle)
[out]valuevalue
Returns
error code

◆ ble_storage_put_buffer()

ble_error_t ble_storage_put_buffer ( uint16_t  conn_idx,
ble_storage_key_t  key,
uint16_t  length,
void *  ptr,
ble_storage_free_cb_t  free_cb,
bool  persistent 
)

Store data buffer in storage.

length shall be non-zero. Buffer pointed by ptr is owned by storage after calling this function and shall not be freed by application. It will be freed automatically when value is removed from storage. Optional free_cb callback can be provided if buffer stores data which shall be handled in a special way, i.e. pointers to other buffers.

Note
While key can be an arbitrary value, it's recommended to use values within service attribute handles range to avoid collision with other services or applications.
Parameters
[in]conn_idxconnection index
[in]keystorage key (attribute handle)
[in]lengthlength of buffer
[in]ptrbuffer pointer
[in]free_cbcallback to free buffer
[in]persistentif true, value will be persistent for bonded devices
Returns
error code

◆ ble_storage_put_buffer_copy()

ble_error_t ble_storage_put_buffer_copy ( uint16_t  conn_idx,
ble_storage_key_t  key,
uint16_t  length,
void *  ptr,
ble_storage_free_cb_t  free_cb,
bool  persistent 
)

Store copy of data buffer in storage.

This is identical to ble_storage_put_buffer() except it makes copy of buffer pointed by ptr.

Parameters
[in]conn_idxconnection index
[in]keystorage key (attribute handle)
[in]lengthlength of buffer
[in]ptrbuffer pointer
[in]free_cbcallback to free buffer
[in]persistentif true, value will be persistent for bonded devices
Returns
error code

◆ ble_storage_put_i32()

ble_error_t ble_storage_put_i32 ( uint16_t  conn_idx,
ble_storage_key_t  key,
int32_t  value,
bool  persistent 
)

Store signed integer value in storage.

Note
While key can be an arbitrary value, it's recommended to use values within service attribute handles range to avoid collision with other services or applications.
Parameters
[in]conn_idxconnection index
[in]keystorage key (attribute handle)
[in]valuevalue to be stored
[in]persistentif true, value will be persistent for bonded devices
Returns
error code

◆ ble_storage_put_u32()

ble_error_t ble_storage_put_u32 ( uint16_t  conn_idx,
ble_storage_key_t  key,
uint32_t  value,
bool  persistent 
)

Store unsigned integer value in storage.

Note
While key can be an arbitrary value, it's recommended to use values within service attribute handles range to avoid collision with other services or applications.
Parameters
[in]conn_idxconnection index
[in]keystorage key (attribute handle)
[in]valuevalue to be stored
[in]persistentif true, value will be persistent for bonded devices
Returns
error code

◆ ble_storage_remove()

ble_error_t ble_storage_remove ( uint16_t  conn_idx,
ble_storage_key_t  key 
)

Remove value from storage.

Parameters
[in]conn_idxconnection index
[in]keystorage key (attribute handle)
Returns
error code

◆ ble_storage_remove_all()

ble_error_t ble_storage_remove_all ( ble_storage_key_t  key)

Remove value from storage.

This function removes value in all devices where it is stored.

Parameters
[in]keystorage key (attribute handle)
Returns
error code

◆ ble_uuid_create16()

void ble_uuid_create16 ( uint16_t  uuid16,
att_uuid_t *  uuid 
)

Create 16-bit UUID from integer value.

Parameters
[in]uuid16value
[out]uuidUUID

◆ ble_uuid_equal()

bool ble_uuid_equal ( const att_uuid_t *  uuid1,
const att_uuid_t *  uuid2 
)

Check if two UUIDs are equal.

Parameters
[in]uuid11st uuid
[in]uuid22nd uuid
Returns
true if both UUIDs are equal, false otherwise

◆ ble_uuid_from_buf()

void ble_uuid_from_buf ( const uint8_t *  buf,
att_uuid_t *  uuid 
)

Create UUID from buffer.

buf shall have proper length (16 bytes) and endianess (little-endian) Created UUID is 16-bit in case it's Bluetooth UUID or 128-bit otherwise.

Parameters
[in]bufbuffer
[out]uuidUUID

◆ ble_uuid_from_string()

bool ble_uuid_from_string ( const char *  str,
att_uuid_t *  uuid 
)

Create UUID from string.

str shall be UUID in canonical form (aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee) or 16-bit Bluetooth UUID. Created UUID is 16-bit in case it is Bluetooth UUID, otherwise it's 128-bit.

Parameters
[in]strstring
[out]uuidUUID
Returns
true if conversion is successful, false otherwise

◆ ble_uuid_to_string()

const char* ble_uuid_to_string ( const att_uuid_t *  uuid)

Convert UUID to string.

Convert UUID (16-bit or 128-bit case) to UUID string - (0xaaaa) or canonical form (aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee). The result is pointer to static buffer.

Parameters
[in]uuidUUID
Returns
UUID string

◆ get_u16()

__STATIC_INLINE uint16_t get_u16 ( const uint8_t *  buffer)

Get uint16 from buffer.

Parameters
[in]bufferdata buffer
Returns
value

◆ get_u16_inc()

__STATIC_INLINE uint16_t get_u16_inc ( const uint8_t **  buffer)

Get uint16 from buffer and increase pointer.

Parameters
[in,out]bufferdata buffer
Returns
value

◆ get_u32()

__STATIC_INLINE uint32_t get_u32 ( const uint8_t *  buffer)

Get uint32 from buffer.

Parameters
[in]bufferdata buffer
Returns
value

◆ get_u32_inc()

__STATIC_INLINE uint32_t get_u32_inc ( const uint8_t **  buffer)

Get uint32 from buffer and increase pointer.

Parameters
[in,out]bufferdata buffer
Returns
value

◆ get_u8()

__STATIC_INLINE uint8_t get_u8 ( const uint8_t *  buffer)

Get uint8 from buffer.

Parameters
[in]bufferdata buffer
Returns
value

◆ get_u8_inc()

__STATIC_INLINE uint8_t get_u8_inc ( const uint8_t **  buffer)

Get uint8 from buffer and increase pointer.

Parameters
[in,out]bufferdata buffer
Returns
value

◆ put_data_inc()

__STATIC_INLINE void put_data_inc ( uint8_t **  buffer,
uint16_t  length,
const void *  data 
)

Put data to buffer and increase pointer.

Parameters
[in,out]bufferdata buffer
[in]lengthlength of data to put
[in]datadata to put

◆ put_str_inc()

__STATIC_INLINE void put_str_inc ( uint8_t **  buffer,
const char *  str 
)

Put string to buffer and increase pointer.

Parameters
[in,out]bufferdata buffer
[in]strstring to put

◆ put_u16()

__STATIC_INLINE void put_u16 ( uint8_t *  buffer,
uint16_t  value 
)

Put uint16 to buffer.

Parameters
[in,out]bufferdata buffer
[in]valuevalue to put

◆ put_u16_inc()

__STATIC_INLINE void put_u16_inc ( uint8_t **  buffer,
uint16_t  value 
)

Put uint16 to buffer and increase pointer.

Parameters
[in,out]bufferdata buffer
[in]valuevalue to put

◆ put_u32()

__STATIC_INLINE void put_u32 ( uint8_t *  buffer,
uint32_t  value 
)

Put uint32 to buffer.

Parameters
[in,out]bufferdata buffer
[in]valuevalue to put

◆ put_u32_inc()

__STATIC_INLINE void put_u32_inc ( uint8_t **  buffer,
uint32_t  value 
)

Put uint32 to buffer and increase pointer.

Parameters
[in,out]bufferdata buffer
[in]valuevalue to put

◆ put_u8()

__STATIC_INLINE void put_u8 ( uint8_t *  buffer,
uint8_t  value 
)

Put uint8 to buffer.

Parameters
[in,out]bufferdata buffer
[in]valuevalue to put

◆ put_u8_inc()

__STATIC_INLINE void put_u8_inc ( uint8_t **  buffer,
uint8_t  value 
)

Put uint8 to buffer and increase pointer.

Parameters
[in,out]bufferdata buffer
[in]valuevalue to put
gap_adv_ad_struct_t
Definition: ble_gap.h:366
GAP_ADV_AD_STRUCT
#define GAP_ADV_AD_STRUCT(_ad_data_type, _ad_data_len, _ad_data)
Definition: ble_gap.h:376