35 #ifndef __BT_GAP_LE_H__ 36 #define __BT_GAP_LE_H__ 199 #include "bt_system.h" 209 #define BT_GAP_LE_SMP_DISPLAY_ONLY 0x00 211 #define BT_GAP_LE_SMP_DISPLAY_YES_NO 0x01 214 #define BT_GAP_LE_SMP_KEYBOARD_ONLY 0x02 216 #define BT_GAP_LE_SMP_NO_INPUT_NO_OUTPUT 0x03 218 #define BT_GAP_LE_SMP_KEYBOARD_DISPLAY 0x04 220 #define BT_GAP_LE_SMP_IO_CAPABILITY_NUM 0x05 221 typedef uint8_t bt_gap_le_smp_io_capability_t; 223 #define BT_GAP_LE_SMP_OOB_DATA_NOT_PRESENTED 0x00 224 #define BT_GAP_LE_SMP_OOB_DATA_PRESENTED 0x01 225 typedef uint8_t bt_gap_le_smp_oob_data_flag_t; 227 #define BT_GAP_LE_SMP_AUTH_REQ_NO_BONDING 0x00 228 #define BT_GAP_LE_SMP_AUTH_REQ_BONDING (0x01 << 0) 229 #define BT_GAP_LE_SMP_AUTH_REQ_MITM (0x01 << 2) 230 #define BT_GAP_LE_SMP_AUTH_REQ_SECURE_CONNECTION (0x01 << 3) 231 typedef uint8_t bt_gap_le_smp_auth_req_t; 233 #define BT_GAP_LE_SMP_KEY_DISTRIBUTE_ENCKEY (0x01 << 0) 234 #define BT_GAP_LE_SMP_KEY_DISTRIBUTE_IDKEY (0x01 << 1) 235 #define BT_GAP_LE_SMP_KEY_DISTRIBUTE_SIGN (0x01 << 2) 236 typedef uint8_t bt_gap_le_smp_key_distribute_t; 238 #define BT_GAP_LE_SMP_JUST_WORKS_MASK (0x1 << 0) 239 #define BT_GAP_LE_SMP_AUTHENTICATION_MASK BT_GAP_LE_SECURITY_AUTHENTICATION_MASK 240 #define BT_GAP_LE_SMP_PASSKEY_INPUT_MASK (0x1 << 2) 241 #define BT_GAP_LE_SMP_PASSKEY_DISPLAY_MASK (0x1 << 3) 242 #define BT_GAP_LE_SMP_LESC_MASK BT_GAP_LE_SECURITY_LESC_MASK 243 #define BT_GAP_LE_SMP_PASSKEY_MASK (0x1 << 5) 244 #define BT_GAP_LE_SMP_OOB_MASK (0x1 << 6) 245 #define BT_GAP_LE_SMP_NUMERIC_COMPARISON_MASK (0x1 << 7) 247 #define BT_GAP_LE_SMP_JUST_WORKS BT_GAP_LE_SMP_JUST_WORKS_MASK 248 #define BT_GAP_LE_SMP_PASSKEY_INPUT (BT_GAP_LE_SMP_PASSKEY_MASK | BT_GAP_LE_SMP_PASSKEY_INPUT_MASK | BT_GAP_LE_SMP_AUTHENTICATION_MASK) 249 #define BT_GAP_LE_SMP_PASSKEY_DISPLAY (BT_GAP_LE_SMP_PASSKEY_MASK | BT_GAP_LE_SMP_PASSKEY_DISPLAY_MASK | BT_GAP_LE_SMP_AUTHENTICATION_MASK) 250 #define BT_GAP_LE_SMP_OOB (BT_GAP_LE_SMP_OOB_MASK | BT_GAP_LE_SMP_AUTHENTICATION_MASK) 252 #define BT_GAP_LE_SMP_LESC_JUST_WORKS (BT_GAP_LE_SMP_JUST_WORKS_MASK | BT_GAP_LE_SMP_LESC_MASK) 253 #define BT_GAP_LE_SMP_LESC_PASSKEY_INPUT (BT_GAP_LE_SMP_PASSKEY_MASK | BT_GAP_LE_SMP_PASSKEY_INPUT_MASK | BT_GAP_LE_SMP_AUTHENTICATION_MASK | BT_GAP_LE_SMP_LESC_MASK) 254 #define BT_GAP_LE_SMP_LESC_PASSKEY_DISPLAY (BT_GAP_LE_SMP_PASSKEY_MASK | BT_GAP_LE_SMP_PASSKEY_DISPLAY_MASK | BT_GAP_LE_SMP_AUTHENTICATION_MASK | BT_GAP_LE_SMP_LESC_MASK) 255 #define BT_GAP_LE_SMP_LESC_OOB (BT_GAP_LE_SMP_OOB_MASK | BT_GAP_LE_SMP_AUTHENTICATION_MASK | BT_GAP_LE_SMP_LESC_MASK) 256 #define BT_GAP_LE_SMP_LESC_NUMERIC_COMPARISON (BT_GAP_LE_SMP_NUMERIC_COMPARISON_MASK | BT_GAP_LE_SMP_AUTHENTICATION_MASK | BT_GAP_LE_SMP_LESC_MASK) 257 typedef uint8_t bt_gap_le_smp_pairing_method_t; 260 #define BT_GAP_LE_SET_RANDOM_ADDRESS_CNF (BT_MODULE_GAP | 0x0003) 261 #define BT_GAP_LE_SET_WHITE_LIST_CNF (BT_MODULE_GAP | 0x0004) 262 #define BT_GAP_LE_SET_ADVERTISING_IND (BT_MODULE_GAP | 0x0005) 263 #define BT_GAP_LE_SET_ADVERTISING_CNF (BT_MODULE_GAP | 0x0006) 264 #define BT_GAP_LE_SET_SCAN_CNF (BT_MODULE_GAP | 0x0007) 265 #define BT_GAP_LE_ADVERTISING_REPORT_IND (BT_MODULE_GAP | 0x0008) 266 #define BT_GAP_LE_CONNECT_CNF (BT_MODULE_GAP | 0x0009) 267 #define BT_GAP_LE_CONNECT_IND (BT_MODULE_GAP | 0x000a) 268 #define BT_GAP_LE_CONNECT_CANCEL_CNF (BT_MODULE_GAP | 0x000b) 269 #define BT_GAP_LE_DISCONNECT_CNF (BT_MODULE_GAP | 0x000c) 270 #define BT_GAP_LE_DISCONNECT_IND (BT_MODULE_GAP | 0x000d) 271 #define BT_GAP_LE_CONNECTION_UPDATE_CNF (BT_MODULE_GAP | 0x000e) 272 #define BT_GAP_LE_CONNECTION_UPDATE_IND (BT_MODULE_GAP | 0x000f) 273 #define BT_GAP_LE_READ_RSSI_CNF (BT_MODULE_GAP | 0x0011) 274 #define BT_GAP_LE_UPDATE_DATA_LENGTH_CNF (BT_MODULE_GAP | 0x0012) 275 #define BT_GAP_LE_BONDING_REPLY_REQ_IND (BT_MODULE_GAP | 0x0015) 276 #define BT_GAP_LE_BONDING_COMPLETE_IND (BT_MODULE_GAP | 0x0016) 277 #define BT_GAP_LE_SET_RESOLVING_LIST_CNF (BT_MODULE_GAP | 0x0017) 278 #define BT_GAP_LE_SET_ADDRESS_RESOLUTION_ENABLE_CNF (BT_MODULE_GAP | 0x0018) 279 #define BT_GAP_LE_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT_CNF (BT_MODULE_GAP | 0x0019) 280 #define BT_GAP_LE_SET_TX_POWER_CNF (BT_MODULE_GAP | 0x0020) 281 #ifdef __BT_MULTI_ADV__ 282 #define BT_GAP_LE_START_MULTIPLE_ADVERTISING_CNF (BT_MODULE_GAP | 0x0021) 283 #define BT_GAP_LE_STOP_MULTIPLE_ADVERTISING_CNF (BT_MODULE_GAP | 0x0022) 286 #define BT_GAP_LE_BQB_DISCONNECT_REQ_IND (BT_MODULE_GAP | 0xFFFF) 292 #define BT_GAP_LE_ADV_REPORT_EVT_TYPE_ADV_IND 0x00 293 #define BT_GAP_LE_ADV_REPORT_EVT_TYPE_ADV_DIRECT_IND 0x01 294 #define BT_GAP_LE_ADV_REPORT_EVT_TYPE_ADV_SCAN_IND 0x02 295 #define BT_GAP_LE_ADV_REPORT_EVT_TYPE_ADV_NONCONN_IND 0x03 296 #define BT_GAP_LE_ADV_REPORT_EVT_TYPE_ADV_SCAN_RSP 0x04 297 typedef uint8_t bt_gap_le_adv_report_evt_type_t; 302 #define BT_GAP_LE_AD_TYPE_FLAG 0x01 303 #define BT_GAP_LE_AD_TYPE_16_BIT_UUID_PART 0x02 304 #define BT_GAP_LE_AD_TYPE_16_BIT_UUID_COMPLETE 0x03 305 #define BT_GAP_LE_AD_TYPE_32_BIT_UUID_PART 0x04 306 #define BT_GAP_LE_AD_TYPE_32_BIT_UUID_COMPLETE 0x05 307 #define BT_GAP_LE_AD_TYPE_128_BIT_UUID_PART 0x06 308 #define BT_GAP_LE_AD_TYPE_128_BIT_UUID_COMPLETE 0x07 309 #define BT_GAP_LE_AD_TYPE_NAME_SHORT 0x08 310 #define BT_GAP_LE_AD_TYPE_NAME_COMPLETE 0x09 311 #define BT_GAP_LE_AD_TYPE_TX_POWER 0x0A 312 #define BT_GAP_LE_AD_TYPE_COD 0x0D 313 #define BT_GAP_LE_AD_TYPE_SM_TK 0x10 314 #define BT_GAP_LE_AD_TYPE_SM_OOB_FLAG 0x11 315 #define BT_GAP_LE_AD_TYPE_SLAVE_CONNECTION_INTERVAL_RANGE 0x12 316 #define BT_GAP_LE_AD_TYPE_16_BIT_SOLICITATION_UUID 0x14 317 #define BT_GAP_LE_AD_TYPE_128_BIT_SOLICITATION_UUID 0x15 318 #define BT_GAP_LE_AD_TYPE_SERVICE_DATA 0x16 319 #define BT_GAP_LE_AD_TYPE_16_BIT_UUID_DATA 0x16 320 #define BT_GAP_LE_AD_TYPE_PUBLIC_TARGET_ADDRESS 0x17 321 #define BT_GAP_LE_AD_TYPE_RANDOM_TARGET_ADDRESS 0x18 322 #define BT_GAP_LE_AD_TYPE_APPEARANCE 0x19 323 #define BT_GAP_LE_AD_TYPE_ADV_INTERVAL 0x1A 324 #define BT_GAP_LE_AD_TYPE_LE_BT_DEVICE_ADDRESS 0x1B 325 #define BT_GAP_LE_AD_TYPE_LE_ROLE 0x1C 326 #define BT_GAP_LE_AD_TYPE_32_BIT_SOLICITATION_UUID 0x1F 327 #define BT_GAP_LE_AD_TYPE_32_BIT_UUID_DATA 0x20 328 #define BT_GAP_LE_AD_TYPE_128_BIT_UUID_DATA 0x21 329 #define BT_GAP_LE_AD_TYPE_MANUFACTURER_SPECIFIC 0xFF 331 #define BT_GAP_LE_AD_FLAG_LIMITED_DISCOVERABLE (0x01 << 0) 332 #define BT_GAP_LE_AD_FLAG_GENERAL_DISCOVERABLE (0x01 << 1) 333 #define BT_GAP_LE_AD_FLAG_BR_EDR_NOT_SUPPORTED (0x01 << 2) 335 #define BT_GAP_LE_DIRECT_ADDR_TYPE_INVALID 0 337 #define BT_GAP_LE_SECURITY_UNAUTH_MASK 0x0 338 #define BT_GAP_LE_SECURITY_AUTHORIZATION_MASK (0x1 << 0) 339 #define BT_GAP_LE_SECURITY_AUTHENTICATION_MASK (0x1 << 1) 340 #define BT_GAP_LE_SECURITY_ENCRYPTION_MASK (0x1 << 2) 341 #define BT_GAP_LE_SECURITY_SIGN_MASK (0x1 << 3) 342 #define BT_GAP_LE_SECURITY_LESC_MASK (0x1 << 4) 343 #define BT_GAP_LE_SECURITY_BONDED_MASK (0x1 << 5) 344 typedef uint8_t bt_gap_le_security_mode_t; 346 #define BT_GAP_LE_CLEAR_WHITE_LIST 0x2010 347 #define BT_GAP_LE_ADD_TO_WHITE_LIST 0x2011 348 #define BT_GAP_LE_REMOVE_FROM_WHITE_LIST 0x2012 349 typedef uint32_t bt_gap_le_set_white_list_op_t; 354 #define BT_GAP_LE_SECURITY_MODE1_1 (BT_GAP_LE_SECURITY_UNAUTH_MASK) 355 #define BT_GAP_LE_SECURITY_MODE1_2 (BT_GAP_LE_SECURITY_UNAUTH_MASK | BT_GAP_LE_SECURITY_ENCRYPTION_MASK) 356 #define BT_GAP_LE_SECURITY_MODE1_3 (BT_GAP_LE_SECURITY_AUTHENTICATION_MASK | BT_GAP_LE_SECURITY_ENCRYPTION_MASK) 357 #define BT_GAP_LE_SECURITY_MODE1_4 (BT_GAP_LE_SECURITY_LESC_MASK | BT_GAP_LE_SECURITY_AUTHENTICATION_MASK | BT_GAP_LE_SECURITY_ENCRYPTION_MASK) 358 #define BT_GAP_LE_SECURITY_MODE2_1 (BT_GAP_LE_SECURITY_UNAUTH_MASK | BT_GAP_LE_SECURITY_SIGN_MASK) 359 #define BT_GAP_LE_SECURITY_MODE2_2 (BT_GAP_LE_SECURITY_AUTHENTICATION_MASK | BT_GAP_LE_SECURITY_SIGN_MASK) 378 uint8_t maximum_encryption_key_size;
446 uint32_t sign_counter;
447 uint32_t gattc_sign_counter;
460 bool sc_only_mode_req;
485 uint16_t conn_interval;
486 uint16_t conn_latency;
487 uint16_t supervision_timeout;
488 uint8_t master_clock_accuracy;
496 uint16_t interval_min;
497 uint16_t interval_max;
498 uint16_t slave_latency;
499 uint16_t timeout_multiplier;
510 uint16_t conn_interval;
511 uint16_t conn_latency;
512 uint16_t supervision_timeout;
522 const uint16_t is_previously_bonded;
533 #ifdef __BT_MULTI_ADV__ 539 } bt_gap_le_start_multiple_advertising_cnf_t;
541 typedef bt_gap_le_start_multiple_advertising_cnf_t bt_gap_le_stop_multiple_advertising_cnf_t;
550 uint32_t passkey_display: 20;
559 uint32_t passkey: 20;
560 bool nc_value_matched;
588 bt_addr_t local_resolvable_private_address;
805 #ifdef __BT_MULTI_ADV__ 815 bt_status_t bt_gap_le_stop_multiple_advertising(uint8_t instance);
846 uint8_t bt_gap_le_get_max_multiple_advertising_instances(
void);
bt_status_t bt_gap_le_set_address_resolution_enable(bool enable)
This function enables or disables the address resolution.
bt_status_t bt_gap_le_read_rssi(const bt_hci_cmd_read_rssi_t *handle)
This function reads the RSSI value of the specific connection.
uint32_t bt_gap_le_set_resolving_list_op_t
Operation type of the set resolving list.
Definition: bt_hci.h:224
For more information about the pairing configuration, please refer to the Bluetooth core specificatio...
Definition: bt_gap_le.h:387
LE set transmit power command.
Definition: bt_hci.h:398
LE set scan enable command.
Definition: bt_hci.h:329
Indication to request bonding information.
Definition: bt_gap_le.h:472
LE set scan response data command.
Definition: bt_hci.h:300
void bt_gap_le_set_advertising_cnf_t
Advertising confirmation.
Definition: bt_gap_le.h:458
LE set advertising parameters command.
Definition: bt_hci.h:282
bt_status_t bt_gap_le_set_tx_power(const bt_hci_cmd_le_set_tx_power_t *param)
This function sets the radio transmission power for a given connection.
Bond reply.
Definition: bt_gap_le.h:562
bt_status_t bt_gap_le_update_data_length(const bt_hci_cmd_le_set_data_length_t *param)
This function updates the data length used for a given connection.
LE local key information.
Definition: bt_gap_le.h:439
Disconnect command.
Definition: bt_hci.h:243
uint16_t bt_handle_t
Define the connection handle type.
Definition: bt_type.h:85
This structure defines the associated parameter type in the callback for BT_GAP_LE_CONNECT_IND event...
Definition: bt_gap_le.h:496
bt_gap_le_local_config_req_ind_t * bt_gap_le_get_local_config(void)
This is a user-defined API that returns the local configuration.
Bonding information.
Definition: bt_gap_le.h:395
Received connection update parameters from the remote device.
Definition: bt_gap_le.h:501
Disconnect complete event information.
Definition: bt_hci.h:461
uint8_t const * bt_bd_addr_ptr_t
A pointer to the bt_bd_addr_t.
Definition: bt_type.h:181
bt_status_t bt_gap_le_bonding_reply(uint32_t handle, bt_gap_le_bonding_reply_t const *const rsp)
This function replies to the BT_GAP_LE_BONDING_REPLY_REQ_IND message.
bt_status_t bt_gap_le_set_advertising(const bt_hci_cmd_le_set_advertising_enable_t *enable, const bt_hci_cmd_le_set_advertising_parameters_t *param, const bt_hci_cmd_le_set_advertising_data_t *data, const bt_hci_cmd_le_set_scan_response_data_t *scan_rsp)
This function sets the advertising.
uint8_t bt_role_t
Define the role type.
Definition: bt_type.h:98
This structure defines the associated parameter type in the callback for BT_GAP_LE_BONDING_REPLY_REQ_...
Definition: bt_gap_le.h:553
uint8_t bt_gap_le_smp_oob_data_flag_t
Indicates if the Out-of-Band data is received or not.
Definition: bt_gap_le.h:231
LE set advertising enable command.
Definition: bt_hci.h:308
bt_status_t bt_gap_le_get_connection_information(bt_handle_t conn_handle, bt_gap_le_connection_information_t *conn_info)
This function gets the connection information according to the connection handle. ...
Indication to request the local configuration.
Definition: bt_gap_le.h:464
bt_status_t bt_gap_le_connect(const bt_hci_cmd_le_create_connection_t *param)
This function creates the link layer connection.
bool bt_gap_le_is_connection_update_request_accepted(bt_handle_t handle, bt_gap_le_connection_update_param_t *connection_parameter)
This is a user-defined API that returns whether to accept connection parameter update request...
uint8_t bt_gap_le_smp_pairing_method_t
The final pairing method.
Definition: bt_gap_le.h:263
bt_status_t bt_gap_le_set_resolving_list(bt_gap_le_set_resolving_list_op_t op, const void *device)
This function adds, removes or clears a device from the resolving list.
bt_gap_le_local_key_t * bt_gap_le_get_local_key(void)
This is a user-defined API that returns the special and new local keys.
uint8_t bt_gap_le_adv_report_evt_type_t
The type of advertising report event.
Definition: bt_gap_le.h:303
bt_status_t bt_gap_le_cancel_connection(void)
This function cancels the link layer connection.
This structure defines the associated parameter type in the callback for BT_GAP_LE_CONNECTION_UPDATE_...
Definition: bt_gap_le.h:514
Signing information.
Definition: bt_gap_le.h:428
uint8_t bt_gap_le_smp_io_capability_t
Device I/O capability.
Definition: bt_gap_le.h:227
bt_status_t bt_gap_le_set_scan(const bt_hci_cmd_le_set_scan_enable_t *enable, const bt_hci_cmd_le_set_scan_parameters_t *param)
This function sets the scan.
LE set scan parameters command.
Definition: bt_hci.h:320
bt_gap_le_bonding_info_t * bt_gap_le_get_bonding_info(const bt_addr_t remote_addr)
This is a user-defined API that returns the bonding information.
Identity address information.
Definition: bt_gap_le.h:420
LE create connection command.
Definition: bt_hci.h:347
bt_status_t bt_gap_le_disconnect(const bt_hci_cmd_disconnect_t *param)
This function disconnects the link layer connection.
uint32_t bt_gap_le_set_white_list_op_t
The operation type to the white list.
Definition: bt_gap_le.h:355
bt_status_t bt_gap_le_get_pairing_config(bt_gap_le_bonding_start_ind_t *ind)
This is a user-defined API that gets the pairing configuration.
This structure defines the associated parameter type in the callback for BT_GAP_LE_ADVERTISING_REPORT...
Definition: bt_gap_le.h:585
Bonding start indication.
Definition: bt_gap_le.h:526
uint8_t bt_gap_le_smp_key_distribute_t
The key to distribute.
Definition: bt_gap_le.h:242
uint8_t bt_bd_addr_t[6]
Address type, defined in Bluetooth core specification version 4.2.
Definition: bt_type.h:180
Identity information.
Definition: bt_gap_le.h:412
bt_status_t bt_gap_le_bond(uint32_t handle, bt_gap_le_smp_pairing_config_t const *const pairing_config)
This function starts the pairing procedure.
int32_t bt_status_t
Define the status type, returned from the APIs, and defined as BT_STATUS_XXX.
Definition: bt_type.h:173
uint8_t bt_gap_le_smp_auth_req_t
Authentication requirement.
Definition: bt_gap_le.h:237
bt_status_t bt_gap_le_set_resolvable_private_address_timeout(uint32_t timeout)
This function sets the resolvable private address timeout value.
bt_hci_evt_disconnect_complete_t bt_gap_le_disconnect_ind_t
This structure defines the associated parameter type in the callback for BT_GAP_LE_DISCONNECT_IND eve...
Definition: bt_gap_le.h:521
LE bonding information structure.
Definition: bt_gap_le.h:456
This structure defines the Bluetooth address.
Definition: bt_type.h:215
This structure defines the associated parameter type in the callback for BT_GAP_LE_BONDING_COMPLETE_I...
Definition: bt_gap_le.h:535
bt_status_t bt_gap_le_set_white_list(bt_gap_le_set_white_list_op_t op, const bt_addr_t *address)
This function adds, removes or clears a device from the white list.
Master identification.
Definition: bt_gap_le.h:404
uint8_t bt_gap_le_security_mode_t
The security mode of the device.
Definition: bt_gap_le.h:350
uint8_t bt_key_t[16]
Define the SM key type.
Definition: bt_type.h:91
bt_status_t bt_gap_le_set_random_address(bt_bd_addr_ptr_t random_addr)
This function sets a random address.
bt_bd_addr_ptr_t bt_gap_le_get_random_address(void)
This function gets the random address.
bt_status_t bt_gap_le_update_connection_parameter(const bt_hci_cmd_le_connection_update_t *param)
This function updates the connection parameter.
LE set data length command.
Definition: bt_hci.h:389
LE connection update command.
Definition: bt_hci.h:374
LE set advertising data command.
Definition: bt_hci.h:291