mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-02 13:30:59 +02:00
Update IDF libs to 9314bf0
This commit is contained in:
@ -21,6 +21,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
//#include <stdlib.h>
|
||||
#include "sdkconfig.h"
|
||||
|
||||
typedef void *(*alloc_fn)(size_t size);
|
||||
typedef void (*free_fn)(void *ptr);
|
||||
|
@ -75,8 +75,9 @@ typedef struct {
|
||||
/** Bluetooth Error Status */
|
||||
/** We need to build on this */
|
||||
|
||||
/* relate to ESP_BT_STATUS_xxx in esp_bt_defs.h */
|
||||
typedef enum {
|
||||
BT_STATUS_SUCCESS,
|
||||
BT_STATUS_SUCCESS = 0,
|
||||
BT_STATUS_FAIL,
|
||||
BT_STATUS_NOT_READY,
|
||||
BT_STATUS_NOMEM,
|
||||
@ -87,7 +88,12 @@ typedef enum {
|
||||
BT_STATUS_UNHANDLED,
|
||||
BT_STATUS_AUTH_FAILURE,
|
||||
BT_STATUS_RMT_DEV_DOWN,
|
||||
BT_STATUS_AUTH_REJECTED
|
||||
BT_STATUS_AUTH_REJECTED,
|
||||
BT_STATUS_INVALID_STATIC_RAND_ADDR,
|
||||
BT_STATUS_PENDING,
|
||||
BT_STATUS_UNACCEPT_CONN_INTERVAL,
|
||||
BT_STATUS_PARAM_OUT_OF_RANGE,
|
||||
BT_STATUS_TIMEOUT,
|
||||
} bt_status_t;
|
||||
|
||||
#ifndef CPU_LITTLE_ENDIAN
|
||||
|
@ -577,7 +577,11 @@
|
||||
|
||||
/* The number of security records for peer devices. 100 AS Default*/
|
||||
#ifndef BTM_SEC_MAX_DEVICE_RECORDS
|
||||
#define BTM_SEC_MAX_DEVICE_RECORDS 8 // 100
|
||||
#if SMP_INCLUDED == TRUE
|
||||
#define BTM_SEC_MAX_DEVICE_RECORDS 15 // 100
|
||||
#else
|
||||
#define BTM_SEC_MAX_DEVICE_RECORDS 8
|
||||
#endif /* SMP_INCLUDED == TRUE */
|
||||
#endif
|
||||
|
||||
/* The number of security records for services. 32 AS Default*/
|
||||
@ -729,7 +733,7 @@
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#define MAX_L2CAP_CHANNELS 8
|
||||
#else
|
||||
#define MAX_L2CAP_CHANNELS 2 //Not support to create l2cap channels in the BLE only mode in this bluedroid version(6.0)
|
||||
#define MAX_L2CAP_CHANNELS MAX_ACL_CONNECTIONS //This is used in the BLE client when start connected with the peer device
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#endif
|
||||
|
||||
@ -953,6 +957,13 @@
|
||||
#define BLE_LLT_INCLUDED TRUE
|
||||
#endif
|
||||
|
||||
/* Added this marco to fixed the android 7.0 will lead to update connection parameters
|
||||
collision when the slave sent the HCI_BLE_UPD_LL_CONN_PARAMS comment to the controller
|
||||
request the master to update connection parameters directly. */
|
||||
#ifndef BLE_SLAVE_UPD_CONN_PARAMS
|
||||
#define BLE_SLAVE_UPD_CONN_PARAMS FALSE
|
||||
#endif
|
||||
|
||||
#ifndef ATT_INCLUDED
|
||||
#define ATT_INCLUDED TRUE
|
||||
#endif
|
||||
|
@ -54,7 +54,7 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
|
||||
}
|
||||
|
||||
#ifdef BTTRC_DUMP_BUFFER
|
||||
#define BTTRC_DUMP_BUFFER(_prefix, _data, _len) trc_dump_buffer(_data, _len)
|
||||
#define BTTRC_DUMP_BUFFER(_prefix, _data, _len) trc_dump_buffer(_prefix, _data, _len)
|
||||
#else
|
||||
#define BTTRC_DUMP_BUFFER(_prefix, _data, _len)
|
||||
#endif
|
||||
|
@ -58,6 +58,7 @@ typedef bool BOOLEAN;
|
||||
*/
|
||||
#define BT_EVT_MASK 0xFF00
|
||||
#define BT_SUB_EVT_MASK 0x00FF
|
||||
#define BT_STATIC_RAND_ADDR_MASK 0xC0
|
||||
/* To Bluetooth Upper Layers */
|
||||
/************************************/
|
||||
#define BT_EVT_TO_BTU_L2C_EVT 0x0900 /* L2CAP event */
|
||||
|
@ -402,6 +402,8 @@ typedef void (tBTA_SET_ADV_DATA_CMPL_CBACK) (tBTA_STATUS status);
|
||||
|
||||
typedef void (tBTA_START_ADV_CMPL_CBACK) (tBTA_STATUS status);
|
||||
|
||||
typedef tBTM_SET_PKT_DATA_LENGTH_CBACK tBTA_SET_PKT_DATA_LENGTH_CBACK;
|
||||
|
||||
/* advertising channel map */
|
||||
#define BTA_BLE_ADV_CHNL_37 BTM_BLE_ADV_CHNL_37
|
||||
#define BTA_BLE_ADV_CHNL_38 BTM_BLE_ADV_CHNL_38
|
||||
@ -718,6 +720,10 @@ typedef UINT8 tBTA_DM_BLE_CONN_TYPE;
|
||||
|
||||
typedef BOOLEAN (tBTA_DM_BLE_SEL_CBACK)(BD_ADDR random_bda, UINT8 *p_remote_name);
|
||||
|
||||
typedef tBTM_LE_UPDATE_CONN_PRAMS tBTA_LE_UPDATE_CONN_PRAMS;
|
||||
typedef tBTM_UPDATE_CONN_PARAM_CBACK tBTA_UPDATE_CONN_PARAM_CBACK;
|
||||
|
||||
|
||||
/* Structure associated with BTA_DM_BLE_SEC_REQ_EVT */
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr; /* peer address */
|
||||
@ -1067,6 +1073,7 @@ typedef void (tBTA_DM_EXEC_CBACK) (void *p_param);
|
||||
/* Encryption callback*/
|
||||
typedef void (tBTA_DM_ENCRYPT_CBACK) (BD_ADDR bd_addr, tBTA_TRANSPORT transport, tBTA_STATUS result);
|
||||
|
||||
/* relate to ESP_BLE_SEC_xxx in esp_gatt_defs.h */
|
||||
#if BLE_INCLUDED == TRUE
|
||||
#define BTA_DM_BLE_SEC_NONE BTM_BLE_SEC_NONE
|
||||
#define BTA_DM_BLE_SEC_ENCRYPT BTM_BLE_SEC_ENCRYPT
|
||||
@ -2009,7 +2016,7 @@ extern void BTA_DmSetEncryption(BD_ADDR bd_addr, tBTA_TRANSPORT transport,
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleObserve(BOOLEAN start, UINT8 duration,
|
||||
extern void BTA_DmBleObserve(BOOLEAN start, UINT32 duration,
|
||||
tBTA_DM_SEARCH_CBACK *p_results_cb,
|
||||
tBTA_START_STOP_SCAN_CMPL_CBACK *p_start_stop_scan_cb);
|
||||
|
||||
@ -2201,7 +2208,18 @@ extern void BTA_BleDisableAdvInstance(UINT8 inst_id);
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int,
|
||||
UINT16 max_int, UINT16 latency, UINT16 timeout);
|
||||
UINT16 max_int, UINT16 latency, UINT16 timeout, tBTA_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleDisconnect
|
||||
**
|
||||
** Description This function is to disconnect the ble connection
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleDisconnect(BD_ADDR bd_addr);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -2212,7 +2230,7 @@ extern void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int,
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleSetDataLength(BD_ADDR remote_device, UINT16 tx_data_length);
|
||||
extern void BTA_DmBleSetDataLength(BD_ADDR remote_device, UINT16 tx_data_length, tBTA_SET_PKT_DATA_LENGTH_CBACK *p_set_pkt_data_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -55,6 +55,7 @@ typedef struct {
|
||||
UINT8 inst_id; /* instance ID */
|
||||
} __attribute__((packed)) tBTA_GATT_ID;
|
||||
|
||||
/* relate to ESP_GATT_xxx in esp_gatt_def.h */
|
||||
/* Success code and error codes */
|
||||
#define BTA_GATT_OK GATT_SUCCESS
|
||||
#define BTA_GATT_INVALID_HANDLE GATT_INVALID_HANDLE /* 0x0001 */
|
||||
@ -94,14 +95,19 @@ typedef struct {
|
||||
#define BTA_GATT_NOT_ENCRYPTED GATT_NOT_ENCRYPTED /* 0x8e */
|
||||
#define BTA_GATT_CONGESTED GATT_CONGESTED /* 0x8f */
|
||||
|
||||
#define BTA_GATT_DUP_REG 0x90 /* 0x90 */
|
||||
#define BTA_GATT_ALREADY_OPEN 0x91 /* 0x91 */
|
||||
#define BTA_GATT_CANCEL 0x92 /* 0x92 */
|
||||
#define BTA_GATT_DUP_REG GATT_DUP_REG /* 0x90 */
|
||||
#define BTA_GATT_ALREADY_OPEN GATT_ALREADY_OPEN /* 0x91 */
|
||||
#define BTA_GATT_CANCEL GATT_CANCEL /* 0x92 */
|
||||
|
||||
/* 0xE0 ~ 0xFC reserved for future use */
|
||||
#define BTA_GATT_CCC_CFG_ERR GATT_CCC_CFG_ERR /* 0xFD Client Characteristic Configuration Descriptor Improperly Configured */
|
||||
#define BTA_GATT_PRC_IN_PROGRESS GATT_PRC_IN_PROGRESS /* 0xFE Procedure Already in progress */
|
||||
#define BTA_GATT_OUT_OF_RANGE GATT_OUT_OF_RANGE /* 0xFFAttribute value out of range */
|
||||
#define BTA_GATT_STACK_RSP GATT_STACK_RSP /* 0xE0 */
|
||||
#define BTA_GATT_APP_RSP GATT_APP_RSP /* 0xE1 */
|
||||
//Error caused by customer application or stack bug
|
||||
#define BTA_GATT_UNKNOWN_ERROR GATT_UNKNOWN_ERROR /* 0XEF */
|
||||
|
||||
#define BTA_GATT_CCC_CFG_ERR GATT_CCC_CFG_ERR /* 0xFD Client Characteristic Configuration Descriptor Improperly Configured */
|
||||
#define BTA_GATT_PRC_IN_PROGRESS GATT_PRC_IN_PROGRESS /* 0xFE Procedure Already in progress */
|
||||
#define BTA_GATT_OUT_OF_RANGE GATT_OUT_OF_RANGE /* 0xFFAttribute value out of range */
|
||||
|
||||
typedef UINT8 tBTA_GATT_STATUS;
|
||||
|
||||
@ -144,6 +150,8 @@ typedef UINT8 tBTA_GATT_STATUS;
|
||||
#define BTA_GATTC_SCAN_FLT_PARAM_EVT 32 /* Param filter event */
|
||||
#define BTA_GATTC_SCAN_FLT_STATUS_EVT 33 /* Filter status event */
|
||||
#define BTA_GATTC_ADV_VSC_EVT 34 /* ADV VSC event */
|
||||
#define BTA_GATTC_CONNECT_EVT 35 /* GATTC CONNECT event */
|
||||
#define BTA_GATTC_DISCONNECT_EVT 36 /* GATTC DISCONNECT event */
|
||||
|
||||
typedef UINT8 tBTA_GATTC_EVT;
|
||||
|
||||
@ -188,6 +196,7 @@ typedef struct {
|
||||
#define BTA_GATTC_TYPE_WRITE_NO_RSP GATT_WRITE_NO_RSP
|
||||
typedef UINT8 tBTA_GATTC_WRITE_TYPE;
|
||||
|
||||
/* relate to ESP_GATT_CONN_xxx in esp_gatt_defs.h */
|
||||
#define BTA_GATT_CONN_UNKNOWN 0
|
||||
#define BTA_GATT_CONN_L2C_FAILURE GATT_CONN_L2C_FAILURE /* general l2cap resource failure */
|
||||
#define BTA_GATT_CONN_TIMEOUT GATT_CONN_TIMEOUT /* 0x08 connection timeout */
|
||||
@ -240,6 +249,7 @@ typedef struct {
|
||||
|
||||
} tBTA_GATTC_MULTI;
|
||||
|
||||
/* relate to ESP_GATT_xxx in esp_gatt_def.h */
|
||||
#define BTA_GATT_AUTH_REQ_NONE GATT_AUTH_REQ_NONE
|
||||
#define BTA_GATT_AUTH_REQ_NO_MITM GATT_AUTH_REQ_NO_MITM /* unauthenticated encryption */
|
||||
#define BTA_GATT_AUTH_REQ_MITM GATT_AUTH_REQ_MITM /* authenticated encryption */
|
||||
@ -371,6 +381,20 @@ typedef struct {
|
||||
BD_ADDR remote_bda;
|
||||
} tBTA_GATTC_ENC_CMPL_CB;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATT_STATUS status;
|
||||
UINT16 conn_id;
|
||||
tBTA_GATTC_IF client_if;
|
||||
BD_ADDR remote_bda;
|
||||
} tBTA_GATTC_CONNECT;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATT_STATUS status;
|
||||
UINT16 conn_id;
|
||||
tBTA_GATTC_IF client_if;
|
||||
BD_ADDR remote_bda;
|
||||
} tBTA_GATTC_DISCONNECT;
|
||||
|
||||
typedef union {
|
||||
tBTA_GATT_STATUS status;
|
||||
|
||||
@ -378,7 +402,9 @@ typedef union {
|
||||
tBTA_GATTC_SRVC_RES srvc_res; /* discovery result */
|
||||
tBTA_GATTC_REG reg_oper; /* registration data */
|
||||
tBTA_GATTC_OPEN open;
|
||||
tBTA_GATTC_CONNECT connect;
|
||||
tBTA_GATTC_CLOSE close;
|
||||
tBTA_GATTC_DISCONNECT disconnect;
|
||||
tBTA_GATTC_READ read; /* read attribute/descriptor data */
|
||||
tBTA_GATTC_WRITE write; /* write complete data */
|
||||
tBTA_GATTC_EXEC_CMPL exec_cmpl; /* execute complete */
|
||||
@ -418,7 +444,7 @@ typedef void (tBTA_GATTC_CBACK)(tBTA_GATTC_EVT event, tBTA_GATTC *p_data);
|
||||
#define BTA_GATTS_CLOSE_EVT 18
|
||||
#define BTA_GATTS_LISTEN_EVT 19
|
||||
#define BTA_GATTS_CONGEST_EVT 20
|
||||
#define BTA_GATTS_SET_ATTR_VAL_EVT 21
|
||||
#define BTA_GATTS_SET_ATTR_VAL_EVT 23
|
||||
|
||||
typedef UINT8 tBTA_GATTS_EVT;
|
||||
typedef tGATT_IF tBTA_GATTS_IF;
|
||||
@ -489,6 +515,7 @@ typedef tGATT_VALUE tBTA_GATT_VALUE;
|
||||
/* attribute response data */
|
||||
typedef tGATTS_RSP tBTA_GATTS_RSP;
|
||||
|
||||
/* relate to ESP_GATT_PREP_WRITE_xxx in esp_gatt_defs.h */
|
||||
/* attribute request data from the client */
|
||||
#define BTA_GATT_PREP_WRITE_CANCEL 0x00
|
||||
#define BTA_GATT_PREP_WRITE_EXEC 0x01
|
||||
@ -573,6 +600,21 @@ typedef struct {
|
||||
tBTA_GATT_STATUS status; /* notification/indication status */
|
||||
} tBTA_GATTS_CONF;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATT_STATUS status;
|
||||
UINT16 conn_id; /* connection ID */
|
||||
} tBTA_GATTS_CLOSE;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATT_STATUS status;
|
||||
tBTA_GATTS_IF server_if;
|
||||
} tBTA_GATTS_OPEN;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATT_STATUS status;
|
||||
tBTA_GATTS_IF server_if;
|
||||
} tBTA_GATTS_CANCEL_OPEN;
|
||||
|
||||
/* GATTS callback data */
|
||||
typedef union {
|
||||
tBTA_GATTS_REG_OPER reg_oper;
|
||||
@ -587,8 +629,20 @@ typedef union {
|
||||
tBTA_GATTS_CONN conn; /* BTA_GATTS_CONN_EVT */
|
||||
tBTA_GATTS_CONGEST congest; /* BTA_GATTS_CONGEST_EVT callback data */
|
||||
tBTA_GATTS_CONF confirm; /* BTA_GATTS_CONF_EVT callback data */
|
||||
tBTA_GATTS_CLOSE close; /* BTA_GATTS_CLOSE_EVT callback data */
|
||||
tBTA_GATTS_OPEN open; /* BTA_GATTS_OPEN_EVT callback data */
|
||||
tBTA_GATTS_CANCEL_OPEN cancel_open; /* tBTA_GATTS_CANCEL_OPEN callback data */
|
||||
|
||||
} tBTA_GATTS;
|
||||
|
||||
/* GATTC wait for service change ccc timer callback data */
|
||||
typedef struct {
|
||||
UINT16 conn_id;
|
||||
BD_ADDR remote_bda;
|
||||
UINT8 count;
|
||||
UINT8 last_status;
|
||||
}tBTA_GATTC_WAIT_CCC_TIMER;
|
||||
|
||||
/* GATTS enable callback function */
|
||||
typedef void (tBTA_GATTS_ENB_CBACK)(tBTA_GATT_STATUS status);
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "bta_gatt_api.h"
|
||||
#include "bta_gattc_ci.h"
|
||||
#include "bta_gattc_co.h"
|
||||
|
||||
#include "gki.h"
|
||||
|
||||
/*****************************************************************************
|
||||
@ -82,7 +81,11 @@ typedef UINT16 tBTA_GATTC_INT_EVT;
|
||||
|
||||
/* max known devices GATTC can support */
|
||||
#ifndef BTA_GATTC_KNOWN_SR_MAX
|
||||
#define BTA_GATTC_KNOWN_SR_MAX 3 // 10
|
||||
#if (GATT_MAX_PHY_CHANNEL > 3)
|
||||
#define BTA_GATTC_KNOWN_SR_MAX GATT_MAX_PHY_CHANNEL
|
||||
#else
|
||||
#define BTA_GATTC_KNOWN_SR_MAX 3 // The origin value is 10
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BTA_GATTC_CONN_MAX GATT_MAX_PHY_CHANNEL
|
||||
@ -380,6 +383,9 @@ typedef struct {
|
||||
typedef struct {
|
||||
BOOLEAN in_use;
|
||||
BD_ADDR remote_bda;
|
||||
TIMER_LIST_ENT service_change_ccc_timer; /* wait for discovering remote device's service change ccc handle */
|
||||
BOOLEAN ccc_timer_used; /* service_change_ccc_timer started */
|
||||
BOOLEAN service_change_ccc_written; /* has written remote device's service change ccc */
|
||||
} tBTA_GATTC_CONN;
|
||||
|
||||
enum {
|
||||
@ -404,6 +410,16 @@ typedef struct {
|
||||
UINT16 sdp_conn_id;
|
||||
} tBTA_GATTC_CB;
|
||||
|
||||
typedef enum {
|
||||
SERVICE_CHANGE_CCC_WRITTEN_SUCCESS = 0,
|
||||
SERVICE_CHANGE_CACHE_NOT_FOUND,
|
||||
SERVICE_CHANGE_SERVICE_NOT_FOUND,
|
||||
SERVICE_CHANGE_CHAR_NOT_FOUND,
|
||||
SERVICE_CHANGE_CCC_NOT_FOUND,
|
||||
SERVICE_CHANGE_WRITE_CCC_FAILED
|
||||
}tBTA_GATTC_FIND_SERVICE_CB;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** Global data
|
||||
*****************************************************************************/
|
||||
@ -441,7 +457,8 @@ extern void bta_gattc_cancel_open_ok(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p
|
||||
extern void bta_gattc_cancel_open_error(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
|
||||
extern void bta_gattc_conn(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
|
||||
extern void bta_gattc_conncback(tBTA_GATTC_RCB *p_rcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_disconncback(tBTA_GATTC_RCB *p_rcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_close(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_close_fail(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_disc_close(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
@ -468,6 +485,10 @@ extern void bta_gattc_init_bk_conn(tBTA_GATTC_API_OPEN *p_data, tBTA_GATTC_RCB *
|
||||
extern void bta_gattc_cancel_bk_conn(tBTA_GATTC_API_CANCEL_OPEN *p_data);
|
||||
extern void bta_gattc_send_open_cback( tBTA_GATTC_RCB *p_clreg, tBTA_GATT_STATUS status,
|
||||
BD_ADDR remote_bda, UINT16 conn_id, tBTA_TRANSPORT transport, UINT16 mtu);
|
||||
extern void bta_gattc_send_connect_cback( tBTA_GATTC_RCB *p_clreg, tBTA_GATT_STATUS status,
|
||||
BD_ADDR remote_bda, UINT16 conn_id);
|
||||
extern void bta_gattc_send_disconnect_cback( tBTA_GATTC_RCB *p_clreg, tBTA_GATT_STATUS status,
|
||||
BD_ADDR remote_bda, UINT16 conn_id);
|
||||
extern void bta_gattc_process_api_refresh(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg);
|
||||
extern void bta_gattc_cfg_mtu(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
#if BLE_INCLUDED == TRUE
|
||||
|
@ -89,6 +89,9 @@ bt_status_t btc_storage_add_ble_bonding_key( bt_bdaddr_t *remote_bd_addr,
|
||||
uint8_t key_type,
|
||||
uint8_t key_length);
|
||||
|
||||
bool btc_compare_le_key_value(const uint8_t key_type, const size_t key_len, const tBTA_LE_KEY_VALUE *key_vaule,
|
||||
bt_bdaddr_t bd_addr);
|
||||
|
||||
void btc_save_ble_bonding_keys(void);
|
||||
|
||||
bt_status_t btc_in_fetch_bonded_ble_device(const char *remote_bd_addr, int add,
|
||||
@ -99,6 +102,8 @@ bt_status_t btc_storage_get_ble_bonding_key(bt_bdaddr_t *remote_bd_addr,
|
||||
char *key_value,
|
||||
int key_length);
|
||||
|
||||
bool btc_storage_compare_address_key_value(uint8_t key_type, void *key_value, int key_length);
|
||||
|
||||
bt_status_t btc_storage_add_ble_local_key(char *key,
|
||||
uint8_t key_type,
|
||||
uint8_t key_length);
|
||||
|
@ -49,6 +49,7 @@ int btc_config_clear(void);
|
||||
|
||||
// TODO(zachoverflow): Eww...we need to move these out. These are peer specific, not config general.
|
||||
bool btc_get_address_type(const BD_ADDR bd_addr, int *p_addr_type);
|
||||
bool btc_compare_address_key_value(char *key_type, void *key_value, int key_length);
|
||||
bool btc_get_device_type(const BD_ADDR bd_addr, int *p_device_type);
|
||||
|
||||
#endif
|
||||
|
@ -39,6 +39,7 @@ typedef enum {
|
||||
BTC_GAP_BLE_SECURITY_RSP_EVT,
|
||||
BTC_GAP_BLE_PASSKEY_REPLY_EVT,
|
||||
BTC_GAP_BLE_CONFIRM_REPLY_EVT,
|
||||
BTC_GAP_BLE_DISCONNECT_EVT,
|
||||
} btc_gap_ble_act_t;
|
||||
|
||||
/* btc_ble_gap_args_t */
|
||||
@ -115,6 +116,12 @@ typedef union {
|
||||
esp_bd_addr_t bd_addr;
|
||||
bool accept;
|
||||
} enc_comfirm_replay;
|
||||
|
||||
//BTC_GAP_BLE_DISCONNECT_EVT
|
||||
struct disconnect_args {
|
||||
esp_bd_addr_t remote_device;
|
||||
} disconnect;
|
||||
|
||||
} btc_ble_gap_args_t;
|
||||
|
||||
void btc_gap_ble_call_handler(btc_msg_t *msg);
|
||||
|
@ -41,7 +41,8 @@ typedef enum {
|
||||
BTC_GATTC_ACT_PREPARE_WRITE_CHAR_DESCR,
|
||||
BTC_GATTC_ACT_EXECUTE_WRITE,
|
||||
BTC_GATTC_ACT_REG_FOR_NOTIFY,
|
||||
BTC_GATTC_ACT_UNREG_FOR_NOTIFY
|
||||
BTC_GATTC_ACT_UNREG_FOR_NOTIFY,
|
||||
BTC_GATTC_ACT_CACHE_REFRESH,
|
||||
} btc_gattc_act_t;
|
||||
|
||||
/* btc_ble_gattc_args_t */
|
||||
@ -186,6 +187,10 @@ typedef union {
|
||||
esp_gatt_srvc_id_t service_id;
|
||||
esp_gatt_id_t char_id;
|
||||
} unreg_for_notify;
|
||||
//BTC_GATTC_ACT_CACHE_REFRESH,
|
||||
struct cache_refresh_arg {
|
||||
esp_bd_addr_t remote_bda;
|
||||
} cache_refresh;
|
||||
} btc_ble_gattc_args_t;
|
||||
|
||||
void btc_gattc_call_handler(btc_msg_t *msg);
|
||||
|
@ -67,7 +67,9 @@ enum {
|
||||
BTM_SUCCESS_NO_SECURITY, /* 17 security passed, no security set */
|
||||
BTM_FAILED_ON_SECURITY, /* 18 security failed */
|
||||
BTM_REPEATED_ATTEMPTS, /* 19 repeated attempts for LE security requests */
|
||||
BTM_MODE4_LEVEL4_NOT_SUPPORTED /* 20 Secure Connections Only Mode can't be supported */
|
||||
BTM_MODE4_LEVEL4_NOT_SUPPORTED, /* 20 Secure Connections Only Mode can't be supported */
|
||||
BTM_PEER_LE_DATA_LEN_UNSUPPORTED, /* 21 peer setting data length is unsupported*/
|
||||
BTM_CONTROL_LE_DATA_LEN_UNSUPPORTED /* 22 controller setting data length is unsupported*/
|
||||
};
|
||||
|
||||
typedef uint8_t tBTM_STATUS;
|
||||
@ -129,6 +131,19 @@ enum {
|
||||
|
||||
typedef UINT8 tBTM_DEV_STATUS;
|
||||
|
||||
typedef struct {
|
||||
UINT16 rx_len;
|
||||
UINT16 tx_len;
|
||||
}tBTM_LE_SET_PKT_DATA_LENGTH_PARAMS;
|
||||
|
||||
typedef struct {
|
||||
UINT16 min_conn_int;
|
||||
UINT16 max_conn_int;
|
||||
UINT16 conn_int;
|
||||
UINT16 slave_latency;
|
||||
UINT16 supervision_tout;
|
||||
}tBTM_LE_UPDATE_CONN_PRAMS;
|
||||
|
||||
|
||||
typedef void (tBTM_DEV_STATUS_CB) (tBTM_DEV_STATUS status);
|
||||
|
||||
@ -156,6 +171,11 @@ typedef void (tBTM_VSC_CMPL_CB) (tBTM_VSC_CMPL *p1);
|
||||
*/
|
||||
typedef UINT8 (tBTM_FILTER_CB) (BD_ADDR bd_addr, DEV_CLASS dc);
|
||||
|
||||
typedef void (tBTM_UPDATE_CONN_PARAM_CBACK) (UINT8 status, BD_ADDR bd_addr, tBTM_LE_UPDATE_CONN_PRAMS *update_conn_params);
|
||||
|
||||
typedef void (tBTM_SET_PKT_DATA_LENGTH_CBACK) (UINT8 status, tBTM_LE_SET_PKT_DATA_LENGTH_PARAMS *data_length_params);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** DEVICE DISCOVERY - Inquiry, Remote Name, Discovery, Class of Device
|
||||
*****************************************************************************/
|
||||
@ -1350,6 +1370,7 @@ enum {
|
||||
};
|
||||
typedef UINT8 tBTM_SP_EVT;
|
||||
|
||||
/* relate to ESP_IO_CAP_xxx in esp_gap_ble_api.h */
|
||||
#define BTM_IO_CAP_OUT 0 /* DisplayOnly */
|
||||
#define BTM_IO_CAP_IO 1 /* DisplayYesNo */
|
||||
#define BTM_IO_CAP_IN 2 /* KeyboardOnly */
|
||||
@ -1531,6 +1552,7 @@ typedef void (tBTM_BOND_CANCEL_CMPL_CALLBACK) (tBTM_STATUS result);
|
||||
|
||||
/* LE related event and data structure
|
||||
*/
|
||||
/* relate to ESP_LE_KEY_xxx in esp_gap_ble_api.h */
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
#define BTM_LE_IO_REQ_EVT SMP_IO_CAP_REQ_EVT /* received IO_CAPABILITY_REQUEST event */
|
||||
#define BTM_LE_SEC_REQUEST_EVT SMP_SEC_REQUEST_EVT /* security request event */
|
||||
@ -1562,6 +1584,8 @@ typedef UINT8 tBTM_LE_EVT;
|
||||
#define BTM_LE_KEY_LCSRK (SMP_SEC_KEY_TYPE_CSRK << 4) /* local CSRK has been deliver to peer */
|
||||
#endif ///BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
|
||||
typedef UINT8 tBTM_LE_KEY_TYPE;
|
||||
|
||||
/* relate to ESP_LE_AUTH_xxx in esp_gap_ble_api.h */
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
#define BTM_LE_AUTH_REQ_NO_BOND SMP_AUTH_NO_BOND /* 0 */
|
||||
#define BTM_LE_AUTH_REQ_BOND SMP_AUTH_GEN_BOND /* 1 << 0 */
|
||||
|
@ -179,7 +179,7 @@ typedef UINT8 tBTM_BLE_SFP;
|
||||
|
||||
/* default supervision timeout */
|
||||
#ifndef BTM_BLE_CONN_TIMEOUT_DEF
|
||||
#define BTM_BLE_CONN_TIMEOUT_DEF 2000
|
||||
#define BTM_BLE_CONN_TIMEOUT_DEF 600
|
||||
#endif
|
||||
|
||||
/* minimum acceptable connection interval */
|
||||
@ -310,6 +310,7 @@ typedef void (tBTM_RAND_ENC_CB) (tBTM_RAND_ENC *p1);
|
||||
|
||||
typedef UINT32 tBTM_BLE_AD_MASK;
|
||||
|
||||
/* relate to ESP_BLE_AD_TYPE_xxx in esp_gap_ble_api.h */
|
||||
#define BTM_BLE_AD_TYPE_FLAG HCI_EIR_FLAGS_TYPE /* 0x01 */
|
||||
#define BTM_BLE_AD_TYPE_16SRV_PART HCI_EIR_MORE_16BITS_UUID_TYPE /* 0x02 */
|
||||
#define BTM_BLE_AD_TYPE_16SRV_CMPL HCI_EIR_COMPLETE_16BITS_UUID_TYPE /* 0x03 */
|
||||
@ -1190,7 +1191,7 @@ tBTM_STATUS BTM_BleWriteScanRspRaw(UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_le
|
||||
**
|
||||
*******************************************************************************/
|
||||
//extern
|
||||
tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT8 duration,
|
||||
tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT32 duration,
|
||||
tBTM_INQ_RESULTS_CB *p_results_cb, tBTM_CMPL_CB *p_cmpl_cb);
|
||||
|
||||
|
||||
@ -1532,6 +1533,8 @@ UINT16 BTM_BleReadDiscoverability();
|
||||
//extern
|
||||
UINT16 BTM_BleReadConnectability ();
|
||||
|
||||
void BTM_Recovery_Pre_State(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_ReadDevInfo
|
||||
|
@ -101,6 +101,15 @@ typedef UINT8 tBTM_BLE_SEC_REQ_ACT;
|
||||
#define BTM_VSC_CHIP_CAPABILITY_L_VERSION 55
|
||||
#define BTM_VSC_CHIP_CAPABILITY_M_VERSION 95
|
||||
|
||||
typedef enum {
|
||||
BTM_BLE_SCANNING,
|
||||
BTM_BLE_SCAN_PENDING,
|
||||
BTM_BLE_STOP_SCAN,
|
||||
BTM_BLE_ADVERTISING,
|
||||
BTM_BLE_ADV_PENDING,
|
||||
BTM_BLE_STOP_ADV,
|
||||
}tBTM_BLE_GAP_STATE;
|
||||
|
||||
typedef struct {
|
||||
UINT16 data_mask;
|
||||
UINT8 *p_flags;
|
||||
@ -155,7 +164,7 @@ typedef struct {
|
||||
|
||||
TIMER_LIST_ENT inq_timer_ent;
|
||||
BOOLEAN scan_rsp;
|
||||
UINT8 state; /* Current state that the inquiry process is in */
|
||||
tBTM_BLE_GAP_STATE state; /* Current state that the inquiry process is in */
|
||||
INT8 tx_power;
|
||||
} tBTM_BLE_INQ_CB;
|
||||
|
||||
|
@ -115,7 +115,9 @@ UINT8 conn_addr_type; /* local device address type for this co
|
||||
BD_ADDR active_remote_addr; /* remote address used on this connection */
|
||||
UINT8 active_remote_addr_type; /* local device address type for this connection */
|
||||
BD_FEATURES peer_le_features; /* Peer LE Used features mask for the device */
|
||||
|
||||
tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb;
|
||||
tBTM_SET_PKT_DATA_LENGTH_CBACK *p_set_pkt_data_cback;
|
||||
tBTM_LE_SET_PKT_DATA_LENGTH_PARAMS data_length_params;
|
||||
#endif
|
||||
|
||||
} tACL_CONN;
|
||||
@ -847,8 +849,10 @@ typedef struct {
|
||||
TIMER_LIST_ENT pairing_tle; /* Timer for pairing process */
|
||||
UINT16 disc_handle; /* for legacy devices */
|
||||
UINT8 disc_reason; /* for legacy devices */
|
||||
tBTM_SEC_SERV_REC sec_serv_rec[BTM_SEC_MAX_SERVICE_RECORDS];
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#if SMP_INCLUDED == TRUE || CLASSIC_BT_INCLUDED == TRUE
|
||||
tBTM_SEC_SERV_REC sec_serv_rec[BTM_SEC_MAX_SERVICE_RECORDS];
|
||||
#endif // SMP_INCLUDED == TRUE || CLASSIC_BT_ENABLED == TRUE
|
||||
tBTM_SEC_DEV_REC sec_dev_rec[BTM_SEC_MAX_DEVICE_RECORDS];
|
||||
tBTM_SEC_SERV_REC *p_out_serv;
|
||||
tBTM_MKEY_CALLBACK *mkey_cback;
|
||||
@ -930,6 +934,7 @@ void btm_cont_rswitch (tACL_CONN *p,
|
||||
UINT8 hci_status);
|
||||
|
||||
UINT8 btm_handle_to_acl_index (UINT16 hci_handle);
|
||||
tACL_CONN *btm_handle_to_acl (UINT16 hci_handle);
|
||||
void btm_read_link_policy_complete (UINT8 *p);
|
||||
void btm_read_rssi_complete (UINT8 *p);
|
||||
void btm_read_tx_power_complete (UINT8 *p, BOOLEAN is_ble);
|
||||
|
@ -143,6 +143,8 @@ typedef void (*tBTU_EVENT_CALLBACK)(BT_HDR *p_hdr);
|
||||
/* eL2CAP Info Request and other proto cmds timer */
|
||||
#define BTU_TTYPE_L2CAP_FCR_ACK 78
|
||||
#define BTU_TTYPE_L2CAP_INFO 79
|
||||
/* L2CAP update connection parameters timer */
|
||||
#define BTU_TTYPE_L2CAP_UPDA_CONN_PARAMS 80
|
||||
|
||||
#define BTU_TTYPE_MCA_CCB_RSP 98
|
||||
|
||||
@ -161,6 +163,8 @@ typedef void (*tBTU_EVENT_CALLBACK)(BT_HDR *p_hdr);
|
||||
|
||||
#define BTU_TTYPE_UCD_TO 108
|
||||
|
||||
|
||||
|
||||
/* This is the inquiry response information held by BTU, and available
|
||||
** to applications.
|
||||
*/
|
||||
|
@ -66,6 +66,10 @@ bool config_has_section(const config_t *config, const char *section);
|
||||
// Returns false otherwise. |config|, |section|, and |key| must not be NULL.
|
||||
bool config_has_key(const config_t *config, const char *section, const char *key);
|
||||
|
||||
// Returns true if the config file has a key named |key| and the key_value.
|
||||
// Returns false otherwise. |config|, |key|, and |key_value| must not be NULL.
|
||||
bool config_has_key_in_section(config_t *config, char *key, char *key_value);
|
||||
|
||||
// Returns the integral value for a given |key| in |section|. If |section|
|
||||
// or |key| do not exist, or the value cannot be fully converted to an integer,
|
||||
// this function returns |def_value|. |config|, |section|, and |key| must not
|
||||
|
@ -22,14 +22,28 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* relate to BT_STATUS_xxx in bt_def.h */
|
||||
/// Status Return Value
|
||||
typedef enum {
|
||||
ESP_BT_STATUS_SUCCESS = 0, /* Successful operation. */
|
||||
ESP_BT_STATUS_FAILURE = 1, /* Generic failure. */
|
||||
ESP_BT_STATUS_PENDING = 2, /* API cannot be completed right now */
|
||||
ESP_BT_STATUS_BUSY = 3,
|
||||
ESP_BT_STATUS_NO_RESOURCES = 4,
|
||||
ESP_BT_STATUS_WRONG_MODE = 5,
|
||||
ESP_BT_STATUS_SUCCESS = 0, /* relate to BT_STATUS_SUCCESS in bt_def.h */
|
||||
ESP_BT_STATUS_FAIL, /* relate to BT_STATUS_FAIL in bt_def.h */
|
||||
ESP_BT_STATUS_NOT_READY, /* relate to BT_STATUS_NOT_READY in bt_def.h */
|
||||
ESP_BT_STATUS_NOMEM, /* relate to BT_STATUS_NOMEM in bt_def.h */
|
||||
ESP_BT_STATUS_BUSY, /* relate to BT_STATUS_BUSY in bt_def.h */
|
||||
ESP_BT_STATUS_DONE = 5, /* relate to BT_STATUS_DONE in bt_def.h */
|
||||
ESP_BT_STATUS_UNSUPPORTED, /* relate to BT_STATUS_UNSUPPORTED in bt_def.h */
|
||||
ESP_BT_STATUS_PARM_INVALID, /* relate to BT_STATUS_PARM_INVALID in bt_def.h */
|
||||
ESP_BT_STATUS_UNHANDLED, /* relate to BT_STATUS_UNHANDLED in bt_def.h */
|
||||
ESP_BT_STATUS_AUTH_FAILURE, /* relate to BT_STATUS_AUTH_FAILURE in bt_def.h */
|
||||
ESP_BT_STATUS_RMT_DEV_DOWN = 10, /* relate to BT_STATUS_RMT_DEV_DOWN in bt_def.h */
|
||||
ESP_BT_STATUS_AUTH_REJECTED, /* relate to BT_STATUS_AUTH_REJECTED in bt_def.h */
|
||||
ESP_BT_STATUS_INVALID_STATIC_RAND_ADDR, /* relate to BT_STATUS_INVALID_STATIC_RAND_ADDR in bt_def.h */
|
||||
ESP_BT_STATUS_PENDING, /* relate to BT_STATUS_PENDING in bt_def.h */
|
||||
ESP_BT_STATUS_UNACCEPT_CONN_INTERVAL, /* relate to BT_UNACCEPT_CONN_INTERVAL in bt_def.h */
|
||||
ESP_BT_STATUS_PARAM_OUT_OF_RANGE, /* relate to BT_PARAM_OUT_OF_RANGE in bt_def.h */
|
||||
ESP_BT_STATUS_TIMEOUT, /* relate to BT_STATUS_TIMEOUT in bt_def.h */
|
||||
ESP_BT_STATUS_PEER_LE_DATA_LEN_UNSUPPORTED, /* relate to BTM_PEER_LE_DATA_LEN_UNSUPPORTED in btm_api.h */
|
||||
ESP_BT_STATUS_CONTROL_LE_DATA_LEN_UNSUPPORTED,/* relate to BTM_CONTROL_LE_DATA_LEN_UNSUPPORTED in btm_api.h */
|
||||
} esp_bt_status_t;
|
||||
|
||||
|
||||
@ -86,13 +100,13 @@ typedef enum {
|
||||
} esp_ble_addr_type_t;
|
||||
|
||||
/// Used to exchange the encrytyption key in the init key & response key
|
||||
#define ESP_BLE_ENC_KEY_MASK (1 << 0)
|
||||
#define ESP_BLE_ENC_KEY_MASK (1 << 0) /* relate to BTM_BLE_ENC_KEY_MASK in btm_api.h */
|
||||
/// Used to exchange the IRK key in the init key & response key
|
||||
#define ESP_BLE_ID_KEY_MASK (1 << 1)
|
||||
#define ESP_BLE_ID_KEY_MASK (1 << 1) /* relate to BTM_BLE_ID_KEY_MASK in btm_api.h */
|
||||
/// Used to exchange the CSRK key in the init key & response key
|
||||
#define ESP_BLE_CSR_KEY_MASK (1 << 2)
|
||||
#define ESP_BLE_CSR_KEY_MASK (1 << 2) /* relate to BTM_BLE_CSR_KEY_MASK in btm_api.h */
|
||||
/// Used to exchange the link key(this key just used in the BLE & BR/EDR coexist mode) in the init key & response key
|
||||
#define ESP_BLE_LINK_KEY_MASK (1 << 3)
|
||||
#define ESP_BLE_LINK_KEY_MASK (1 << 3) /* relate to BTM_BLE_LINK_KEY_MASK in btm_api.h */
|
||||
|
||||
/// Minimum of the application id
|
||||
#define ESP_APP_ID_MIN 0x0000
|
||||
|
@ -38,31 +38,34 @@ extern "C" {
|
||||
* @}
|
||||
*/
|
||||
|
||||
#define ESP_LE_KEY_NONE 0
|
||||
#define ESP_LE_KEY_PENC (1 << 0) /*!< encryption key, encryption information of peer device */
|
||||
#define ESP_LE_KEY_PID (1 << 1) /*!< identity key of the peer device */
|
||||
#define ESP_LE_KEY_PCSRK (1 << 2) /*!< peer SRK */
|
||||
#define ESP_LE_KEY_PLK (1 << 3) /*!< Link key*/
|
||||
#define ESP_LE_KEY_LLK (ESP_LE_KEY_PLK << 4)
|
||||
#define ESP_LE_KEY_LENC (ESP_LE_KEY_PENC << 4) /*!< master role security information:div */
|
||||
#define ESP_LE_KEY_LID (ESP_LE_KEY_PID << 4) /*!< master device ID key */
|
||||
#define ESP_LE_KEY_LCSRK (ESP_LE_KEY_PCSRK << 4) /*!< local CSRK has been deliver to peer */
|
||||
typedef uint8_t esp_ble_key_type_t;
|
||||
/* relate to BTM_LE_KEY_xxx in btm_api.h */
|
||||
#define ESP_LE_KEY_NONE 0 /* relate to BTM_LE_KEY_NONE in btm_api.h */
|
||||
#define ESP_LE_KEY_PENC (1 << 0) /*!< encryption key, encryption information of peer device */ /* relate to BTM_LE_KEY_PENC in btm_api.h */
|
||||
#define ESP_LE_KEY_PID (1 << 1) /*!< identity key of the peer device */ /* relate to BTM_LE_KEY_PID in btm_api.h */
|
||||
#define ESP_LE_KEY_PCSRK (1 << 2) /*!< peer SRK */ /* relate to BTM_LE_KEY_PCSRK in btm_api.h */
|
||||
#define ESP_LE_KEY_PLK (1 << 3) /*!< Link key*/ /* relate to BTM_LE_KEY_PLK in btm_api.h */
|
||||
#define ESP_LE_KEY_LLK (ESP_LE_KEY_PLK << 4) /* relate to BTM_LE_KEY_LLK in btm_api.h */
|
||||
#define ESP_LE_KEY_LENC (ESP_LE_KEY_PENC << 4) /*!< master role security information:div */ /* relate to BTM_LE_KEY_LENC in btm_api.h */
|
||||
#define ESP_LE_KEY_LID (ESP_LE_KEY_PID << 4) /*!< master device ID key */ /* relate to BTM_LE_KEY_LID in btm_api.h */
|
||||
#define ESP_LE_KEY_LCSRK (ESP_LE_KEY_PCSRK << 4) /*!< local CSRK has been deliver to peer */ /* relate to BTM_LE_KEY_LCSRK in btm_api.h */
|
||||
typedef uint8_t esp_ble_key_type_t;
|
||||
|
||||
#define ESP_LE_AUTH_NO_BOND 0x00 /*!< 0*/
|
||||
#define ESP_LE_AUTH_BOND 0x01 /*!< 1 << 0 */
|
||||
#define ESP_LE_AUTH_REQ_MITM (1 << 2) /*!< 1 << 2 */
|
||||
#define ESP_LE_AUTH_REQ_SC_ONLY (1 << 3) /*!< 1 << 3 */
|
||||
#define ESP_LE_AUTH_REQ_SC_BOND (ESP_LE_AUTH_BOND | ESP_LE_AUTH_REQ_SC_ONLY) /*!< 1001 */
|
||||
#define ESP_LE_AUTH_REQ_SC_MITM (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY) /*!< 1100 */
|
||||
#define ESP_LE_AUTH_REQ_SC_MITM_BOND (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY | ESP_LE_AUTH_BOND) /*!< 1101 */
|
||||
/* relate to BTM_LE_AUTH_xxx in btm_api.h */
|
||||
#define ESP_LE_AUTH_NO_BOND 0x00 /*!< 0*/ /* relate to BTM_LE_AUTH_NO_BOND in btm_api.h */
|
||||
#define ESP_LE_AUTH_BOND 0x01 /*!< 1 << 0 */ /* relate to BTM_LE_AUTH_BOND in btm_api.h */
|
||||
#define ESP_LE_AUTH_REQ_MITM (1 << 2) /*!< 1 << 2 */ /* relate to BTM_LE_AUTH_REQ_MITM in btm_api.h */
|
||||
#define ESP_LE_AUTH_REQ_SC_ONLY (1 << 3) /*!< 1 << 3 */ /* relate to BTM_LE_AUTH_REQ_SC_ONLY in btm_api.h */
|
||||
#define ESP_LE_AUTH_REQ_SC_BOND (ESP_LE_AUTH_BOND | ESP_LE_AUTH_REQ_SC_ONLY) /*!< 1001 */ /* relate to BTM_LE_AUTH_REQ_SC_BOND in btm_api.h */
|
||||
#define ESP_LE_AUTH_REQ_SC_MITM (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY) /*!< 1100 */ /* relate to BTM_LE_AUTH_REQ_SC_MITM in btm_api.h */
|
||||
#define ESP_LE_AUTH_REQ_SC_MITM_BOND (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY | ESP_LE_AUTH_BOND) /*!< 1101 */ /* relate to BTM_LE_AUTH_REQ_SC_MITM_BOND in btm_api.h */
|
||||
typedef uint8_t esp_ble_auth_req_t; /*!< combination of the above bit pattern */
|
||||
|
||||
#define ESP_IO_CAP_OUT 0 /*!< DisplayOnly */
|
||||
#define ESP_IO_CAP_IO 1 /*!< DisplayYesNo */
|
||||
#define ESP_IO_CAP_IN 2 /*!< KeyboardOnly */
|
||||
#define ESP_IO_CAP_NONE 3 /*!< NoInputNoOutput */
|
||||
#define ESP_IO_CAP_KBDISP 4 /*!< Keyboard display */
|
||||
/* relate to BTM_IO_CAP_xxx in btm_api.h */
|
||||
#define ESP_IO_CAP_OUT 0 /*!< DisplayOnly */ /* relate to BTM_IO_CAP_OUT in btm_api.h */
|
||||
#define ESP_IO_CAP_IO 1 /*!< DisplayYesNo */ /* relate to BTM_IO_CAP_IO in btm_api.h */
|
||||
#define ESP_IO_CAP_IN 2 /*!< KeyboardOnly */ /* relate to BTM_IO_CAP_IN in btm_api.h */
|
||||
#define ESP_IO_CAP_NONE 3 /*!< NoInputNoOutput */ /* relate to BTM_IO_CAP_NONE in btm_api.h */
|
||||
#define ESP_IO_CAP_KBDISP 4 /*!< Keyboard display */ /* relate to BTM_IO_CAP_KBDISP in btm_api.h */
|
||||
typedef uint8_t esp_ble_io_cap_t; /*!< combination of the io capability */
|
||||
|
||||
|
||||
@ -87,6 +90,9 @@ typedef enum {
|
||||
ESP_GAP_BLE_NC_REQ_EVT, /* Numeric Comparison request event */
|
||||
ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT, /*!< When stop adv complete, the event comes */
|
||||
ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT, /*!< When stop scan complete, the event comes */
|
||||
ESP_GAP_BLE_SET_STATIC_RAND_ADDR_EVT, /*!< When set the static rand address complete, the event comes */
|
||||
ESP_GAP_BLE_UPDATE_CONN_PARAMS_EVT, /*!< When update connection parameters complete, the event comes */
|
||||
ESP_GAP_BLE_SET_PKT_LENGTH_COMPLETE_EVT, /*!< When set pkt lenght complete, the event comes */
|
||||
} esp_gap_ble_cb_event_t;
|
||||
|
||||
/// Advertising data maximum length
|
||||
@ -94,33 +100,45 @@ typedef enum {
|
||||
/// Scan response data maximum length
|
||||
#define ESP_BLE_SCAN_RSP_DATA_LEN_MAX 31
|
||||
|
||||
/* relate to BTM_BLE_AD_TYPE_xxx in btm_ble_api.h */
|
||||
/// The type of advertising data(not adv_type)
|
||||
typedef enum {
|
||||
ESP_BLE_AD_TYPE_FLAG = 0x01,
|
||||
ESP_BLE_AD_TYPE_16SRV_PART = 0x02,
|
||||
ESP_BLE_AD_TYPE_16SRV_CMPL = 0x03,
|
||||
ESP_BLE_AD_TYPE_32SRV_PART = 0x04,
|
||||
ESP_BLE_AD_TYPE_32SRV_CMPL = 0x05,
|
||||
ESP_BLE_AD_TYPE_128SRV_PART = 0x06,
|
||||
ESP_BLE_AD_TYPE_128SRV_CMPL = 0x07,
|
||||
ESP_BLE_AD_TYPE_NAME_SHORT = 0x08,
|
||||
ESP_BLE_AD_TYPE_NAME_CMPL = 0x09,
|
||||
ESP_BLE_AD_TYPE_TX_PWR = 0x0A,
|
||||
ESP_BLE_AD_TYPE_DEV_CLASS = 0x0D,
|
||||
ESP_BLE_AD_TYPE_SM_TK = 0x10,
|
||||
ESP_BLE_AD_TYPE_SM_OOB_FLAG = 0x11,
|
||||
ESP_BLE_AD_TYPE_INT_RANGE = 0x12,
|
||||
ESP_BLE_AD_TYPE_SOL_SRV_UUID = 0x14,
|
||||
ESP_BLE_AD_TYPE_128SOL_SRV_UUID = 0x15,
|
||||
ESP_BLE_AD_TYPE_SERVICE_DATA = 0x16,
|
||||
ESP_BLE_AD_TYPE_PUBLIC_TARGET = 0x17,
|
||||
ESP_BLE_AD_TYPE_RANDOM_TARGET = 0x18,
|
||||
ESP_BLE_AD_TYPE_APPEARANCE = 0x19,
|
||||
ESP_BLE_AD_TYPE_ADV_INT = 0x1A,
|
||||
ESP_BLE_AD_TYPE_32SOL_SRV_UUID = 0x1B,
|
||||
ESP_BLE_AD_TYPE_32SERVICE_DATA = 0x1C,
|
||||
ESP_BLE_AD_TYPE_128SERVICE_DATA = 0x1D,
|
||||
ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE = 0xFF,
|
||||
ESP_BLE_AD_TYPE_FLAG = 0x01, /* relate to BTM_BLE_AD_TYPE_FLAG in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_16SRV_PART = 0x02, /* relate to BTM_BLE_AD_TYPE_16SRV_PART in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_16SRV_CMPL = 0x03, /* relate to BTM_BLE_AD_TYPE_16SRV_CMPL in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_32SRV_PART = 0x04, /* relate to BTM_BLE_AD_TYPE_32SRV_PART in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_32SRV_CMPL = 0x05, /* relate to BTM_BLE_AD_TYPE_32SRV_CMPL in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_128SRV_PART = 0x06, /* relate to BTM_BLE_AD_TYPE_128SRV_PART in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_128SRV_CMPL = 0x07, /* relate to BTM_BLE_AD_TYPE_128SRV_CMPL in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_NAME_SHORT = 0x08, /* relate to BTM_BLE_AD_TYPE_NAME_SHORT in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_NAME_CMPL = 0x09, /* relate to BTM_BLE_AD_TYPE_NAME_CMPL in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_TX_PWR = 0x0A, /* relate to BTM_BLE_AD_TYPE_TX_PWR in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_DEV_CLASS = 0x0D, /* relate to BTM_BLE_AD_TYPE_DEV_CLASS in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SM_TK = 0x10, /* relate to BTM_BLE_AD_TYPE_SM_TK in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SM_OOB_FLAG = 0x11, /* relate to BTM_BLE_AD_TYPE_SM_OOB_FLAG in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_INT_RANGE = 0x12, /* relate to BTM_BLE_AD_TYPE_INT_RANGE in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SOL_SRV_UUID = 0x14, /* relate to BTM_BLE_AD_TYPE_SOL_SRV_UUID in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_128SOL_SRV_UUID = 0x15, /* relate to BTM_BLE_AD_TYPE_128SOL_SRV_UUID in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SERVICE_DATA = 0x16, /* relate to BTM_BLE_AD_TYPE_SERVICE_DATA in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_PUBLIC_TARGET = 0x17, /* relate to BTM_BLE_AD_TYPE_PUBLIC_TARGET in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_RANDOM_TARGET = 0x18, /* relate to BTM_BLE_AD_TYPE_RANDOM_TARGET in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_APPEARANCE = 0x19, /* relate to BTM_BLE_AD_TYPE_APPEARANCE in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_ADV_INT = 0x1A, /* relate to BTM_BLE_AD_TYPE_ADV_INT in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_LE_DEV_ADDR = 0x1b, /* relate to BTM_BLE_AD_TYPE_LE_DEV_ADDR in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_LE_ROLE = 0x1c, /* relate to BTM_BLE_AD_TYPE_LE_ROLE in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SPAIR_C256 = 0x1d, /* relate to BTM_BLE_AD_TYPE_SPAIR_C256 in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SPAIR_R256 = 0x1e, /* relate to BTM_BLE_AD_TYPE_SPAIR_R256 in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_32SOL_SRV_UUID = 0x1f, /* relate to BTM_BLE_AD_TYPE_32SOL_SRV_UUID in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_32SERVICE_DATA = 0x20, /* relate to BTM_BLE_AD_TYPE_32SERVICE_DATA in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_128SERVICE_DATA = 0x21, /* relate to BTM_BLE_AD_TYPE_128SERVICE_DATA in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_LE_SECURE_CONFIRM = 0x22, /* relate to BTM_BLE_AD_TYPE_LE_SECURE_CONFIRM in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_LE_SECURE_RANDOM = 0x23, /* relate to BTM_BLE_AD_TYPE_LE_SECURE_RANDOM in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_URI = 0x24, /* relate to BTM_BLE_AD_TYPE_URI in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_INDOOR_POSITION = 0x25, /* relate to BTM_BLE_AD_TYPE_INDOOR_POSITION in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_TRANS_DISC_DATA = 0x26, /* relate to BTM_BLE_AD_TYPE_TRANS_DISC_DATA in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_LE_SUPPORT_FEATURE = 0x27, /* relate to BTM_BLE_AD_TYPE_LE_SUPPORT_FEATURE in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_CHAN_MAP_UPDATE = 0x28, /* relate to BTM_BLE_AD_TYPE_CHAN_MAP_UPDATE in btm_ble_api.h */
|
||||
ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE = 0xFF, /* relate to BTM_BLE_AD_MANUFACTURER_SPECIFIC_TYPE in btm_ble_api.h */
|
||||
} esp_ble_adv_data_type;
|
||||
|
||||
/// Advertising mode
|
||||
@ -153,19 +171,20 @@ typedef enum {
|
||||
} esp_ble_adv_filter_t;
|
||||
|
||||
|
||||
/* relate to BTA_DM_BLE_SEC_xxx in bta_api.h */
|
||||
typedef enum {
|
||||
ESP_BLE_SEC_NONE,
|
||||
ESP_BLE_SEC_ENCRYPT,
|
||||
ESP_BLE_SEC_ENCRYPT_NO_MITM,
|
||||
ESP_BLE_SEC_ENCRYPT_MITM,
|
||||
ESP_BLE_SEC_NONE = 0, /* relate to BTA_DM_BLE_SEC_NONE in bta_api.h */
|
||||
ESP_BLE_SEC_ENCRYPT, /* relate to BTA_DM_BLE_SEC_ENCRYPT in bta_api.h */
|
||||
ESP_BLE_SEC_ENCRYPT_NO_MITM, /* relate to BTA_DM_BLE_SEC_ENCRYPT_NO_MITM in bta_api.h */
|
||||
ESP_BLE_SEC_ENCRYPT_MITM, /* relate to BTA_DM_BLE_SEC_ENCRYPT_MITM in bta_api.h */
|
||||
}esp_ble_sec_act_t;
|
||||
|
||||
typedef enum {
|
||||
ESP_BLE_SM_PASSKEY,
|
||||
ESP_BLE_SM_PASSKEY = 0,
|
||||
ESP_BLE_SM_AUTHEN_REQ_MODE,
|
||||
ESP_BLE_SM_IOCAP_MODE,
|
||||
ESP_BLE_SM_SET_INIT_KEY,
|
||||
ESP_BLE_SM_SET_RSP_KEK,
|
||||
ESP_BLE_SM_SET_RSP_KEY,
|
||||
ESP_BLE_SM_MAX_KEY_SIZE,
|
||||
} esp_ble_sm_param_t;
|
||||
|
||||
@ -255,6 +274,15 @@ typedef struct {
|
||||
Time Range: 100 msec to 32 seconds */
|
||||
} esp_ble_conn_update_params_t;
|
||||
|
||||
/**
|
||||
* @brief BLE pkt date length keys
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t rx_len; /*!< pkt rx data length value */
|
||||
uint16_t tx_len; /*!< pkt tx data length value */
|
||||
}esp_ble_pkt_data_length_params_t;
|
||||
|
||||
/**
|
||||
* @brief BLE encryption keys
|
||||
*/
|
||||
@ -364,7 +392,7 @@ typedef struct {
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
esp_bd_addr_t bd_addr; /*!< BD address peer device. */
|
||||
esp_bd_addr_t bd_addr; /*!< BD address peer device. */
|
||||
bool key_present; /*!< Valid link key value in key element */
|
||||
esp_link_key key; /*!< Link key associated with peer device. */
|
||||
uint8_t key_type; /*!< The type of Link Key */
|
||||
@ -485,6 +513,32 @@ typedef union {
|
||||
struct ble_adv_stop_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate adv stop operation success status */
|
||||
} adv_stop_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SET_STATIC_RAND_ADDR_EVT
|
||||
*/
|
||||
struct ble_set_rand_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate set static rand address operation success status */
|
||||
} set_rand_addr_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_STATIC_RAND_ADDR_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_UPDATE_CONN_PARAMS_EVT
|
||||
*/
|
||||
struct ble_update_conn_params_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate update connection parameters success status */
|
||||
esp_bd_addr_t bda; /*!< Bluetooth device address */
|
||||
uint16_t min_int; /*!< Min connection interval */
|
||||
uint16_t max_int; /*!< Max connection interval */
|
||||
uint16_t latency; /*!< Slave latency for the connection in number of connection events. Range: 0x0000 to 0x01F3 */
|
||||
uint16_t conn_int; /*!< Current connection interval */
|
||||
uint16_t timeout; /*!< Supervision timeout for the LE Link. Range: 0x000A to 0x0C80.
|
||||
Mandatory Range: 0x000A to 0x0C80 Time = N * 10 msec */
|
||||
}update_conn_params; /*!< Event parameter of ESP_GAP_BLE_UPDATE_CONN_PARAMS_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SET_PKT_LENGTH_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_pkt_data_length_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate the set pkt data length operation success status */
|
||||
esp_ble_pkt_data_length_params_t params; /*!< pkt data length value */
|
||||
} pkt_data_lenth_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_PKT_LENGTH_COMPLETE_EVT */
|
||||
} esp_ble_gap_cb_param_t;
|
||||
|
||||
/**
|
||||
@ -699,7 +753,7 @@ esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_d
|
||||
* @param[out] len : the length of the param value
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gap_set_security_param(esp_ble_sm_param_t param_type,
|
||||
@ -724,8 +778,8 @@ esp_err_t esp_ble_gap_security_rsp(esp_bd_addr_t bd_addr, bool accept);
|
||||
*
|
||||
* @param[in] bd_addr : the address of the peer device need to encryption
|
||||
* @param[in] sec_act : This is the security action to indicate
|
||||
* what kind of BLE security level is required for
|
||||
* the BLE link if the BLE is supported
|
||||
* what kind of BLE security level is required for
|
||||
* the BLE link if the BLE is supported
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
@ -760,6 +814,17 @@ esp_err_t esp_ble_passkey_reply(esp_bd_addr_t bd_addr, bool accept, uint32_t pas
|
||||
*/
|
||||
esp_err_t esp_ble_confirm_reply(esp_bd_addr_t bd_addr, bool accept);
|
||||
|
||||
/**
|
||||
* @brief This function is to disconnect the physical connection of the peer device
|
||||
*
|
||||
* @param[in] remote_device : BD address of the peer device
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gap_disconnect(esp_bd_addr_t remote_device);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -153,75 +153,81 @@ extern "C" {
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* relate to BTA_GATT_PREP_WRITE_xxx in bta_gatt_api.h */
|
||||
/// Attribute write data type from the client
|
||||
typedef enum {
|
||||
ESP_GATT_PREP_WRITE_CANCEL = 0x00, /*!< Prepare write cancel */
|
||||
ESP_GATT_PREP_WRITE_EXEC = 0x01, /*!< Prepare write execute */
|
||||
ESP_GATT_PREP_WRITE_CANCEL = 0x00, /*!< Prepare write cancel */ /* relate to BTA_GATT_PREP_WRITE_CANCEL in bta_gatt_api.h */
|
||||
ESP_GATT_PREP_WRITE_EXEC = 0x01, /*!< Prepare write execute */ /* relate to BTA_GATT_PREP_WRITE_EXEC in bta_gatt_api.h */
|
||||
} esp_gatt_prep_write_type;
|
||||
|
||||
/* relate to BTA_GATT_xxx in bta_gatt_api.h */
|
||||
/**
|
||||
* @brief GATT success code and error codes
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_OK = 0x0,
|
||||
ESP_GATT_INVALID_HANDLE = 0x01, /* 0x0001 */
|
||||
ESP_GATT_READ_NOT_PERMIT = 0x02, /* 0x0002 */
|
||||
ESP_GATT_WRITE_NOT_PERMIT = 0x03, /* 0x0003 */
|
||||
ESP_GATT_INVALID_PDU = 0x04, /* 0x0004 */
|
||||
ESP_GATT_INSUF_AUTHENTICATION = 0x05, /* 0x0005 */
|
||||
ESP_GATT_REQ_NOT_SUPPORTED = 0x06, /* 0x0006 */
|
||||
ESP_GATT_INVALID_OFFSET = 0x07, /* 0x0007 */
|
||||
ESP_GATT_INSUF_AUTHORIZATION = 0x08, /* 0x0008 */
|
||||
ESP_GATT_PREPARE_Q_FULL = 0x09, /* 0x0009 */
|
||||
ESP_GATT_NOT_FOUND = 0x0a, /* 0x000a */
|
||||
ESP_GATT_NOT_LONG = 0x0b, /* 0x000b */
|
||||
ESP_GATT_INSUF_KEY_SIZE = 0x0c, /* 0x000c */
|
||||
ESP_GATT_INVALID_ATTR_LEN = 0x0d, /* 0x000d */
|
||||
ESP_GATT_ERR_UNLIKELY = 0x0e, /* 0x000e */
|
||||
ESP_GATT_INSUF_ENCRYPTION = 0x0f, /* 0x000f */
|
||||
ESP_GATT_UNSUPPORT_GRP_TYPE = 0x10, /* 0x0010 */
|
||||
ESP_GATT_INSUF_RESOURCE = 0x11, /* 0x0011 */
|
||||
|
||||
ESP_GATT_NO_RESOURCES = 0x80, /* 0x80 */
|
||||
ESP_GATT_INTERNAL_ERROR = 0x81, /* 0x81 */
|
||||
ESP_GATT_WRONG_STATE = 0x82, /* 0x82 */
|
||||
ESP_GATT_DB_FULL = 0x83, /* 0x83 */
|
||||
ESP_GATT_BUSY = 0x84, /* 0x84 */
|
||||
ESP_GATT_ERROR = 0x85, /* 0x85 */
|
||||
ESP_GATT_CMD_STARTED = 0x86, /* 0x86 */
|
||||
ESP_GATT_ILLEGAL_PARAMETER = 0x87, /* 0x87 */
|
||||
ESP_GATT_PENDING = 0x88, /* 0x88 */
|
||||
ESP_GATT_AUTH_FAIL = 0x89, /* 0x89 */
|
||||
ESP_GATT_MORE = 0x8a, /* 0x8a */
|
||||
ESP_GATT_INVALID_CFG = 0x8b, /* 0x8b */
|
||||
ESP_GATT_SERVICE_STARTED = 0x8c, /* 0x8c */
|
||||
ESP_GATT_ENCRYPED_MITM = ESP_GATT_OK,
|
||||
ESP_GATT_ENCRYPED_NO_MITM = 0x8d, /* 0x8d */
|
||||
ESP_GATT_NOT_ENCRYPTED = 0x8e, /* 0x8e */
|
||||
ESP_GATT_CONGESTED = 0x8f, /* 0x8f */
|
||||
ESP_GATT_DUP_REG = 0x90, /* 0x90 */
|
||||
ESP_GATT_ALREADY_OPEN = 0x91, /* 0x91 */
|
||||
ESP_GATT_CANCEL = 0x92, /* 0x92 */
|
||||
ESP_GATT_OK = 0x0, /* relate to BTA_GATT_OK in bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_HANDLE = 0x01, /* 0x0001 */ /* relate to BTA_GATT_INVALID_HANDLE in bta_gatt_api.h */
|
||||
ESP_GATT_READ_NOT_PERMIT = 0x02, /* 0x0002 */ /* relate to BTA_GATT_READ_NOT_PERMIT in bta_gatt_api.h */
|
||||
ESP_GATT_WRITE_NOT_PERMIT = 0x03, /* 0x0003 */ /* relate to BTA_GATT_WRITE_NOT_PERMIT in bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_PDU = 0x04, /* 0x0004 */ /* relate to BTA_GATT_INVALID_PDU in bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_AUTHENTICATION = 0x05, /* 0x0005 */ /* relate to BTA_GATT_INSUF_AUTHENTICATION in bta_gatt_api.h */
|
||||
ESP_GATT_REQ_NOT_SUPPORTED = 0x06, /* 0x0006 */ /* relate to BTA_GATT_REQ_NOT_SUPPORTED in bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_OFFSET = 0x07, /* 0x0007 */ /* relate to BTA_GATT_INVALID_OFFSET in bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_AUTHORIZATION = 0x08, /* 0x0008 */ /* relate to BTA_GATT_INSUF_AUTHORIZATION in bta_gatt_api.h */
|
||||
ESP_GATT_PREPARE_Q_FULL = 0x09, /* 0x0009 */ /* relate to BTA_GATT_PREPARE_Q_FULL in bta_gatt_api.h */
|
||||
ESP_GATT_NOT_FOUND = 0x0a, /* 0x000a */ /* relate to BTA_GATT_NOT_FOUND in bta_gatt_api.h */
|
||||
ESP_GATT_NOT_LONG = 0x0b, /* 0x000b */ /* relate to BTA_GATT_NOT_LONG in bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_KEY_SIZE = 0x0c, /* 0x000c */ /* relate to BTA_GATT_INSUF_KEY_SIZE in bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_ATTR_LEN = 0x0d, /* 0x000d */ /* relate to BTA_GATT_INVALID_ATTR_LEN in bta_gatt_api.h */
|
||||
ESP_GATT_ERR_UNLIKELY = 0x0e, /* 0x000e */ /* relate to BTA_GATT_ERR_UNLIKELY in bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_ENCRYPTION = 0x0f, /* 0x000f */ /* relate to BTA_GATT_INSUF_ENCRYPTION in bta_gatt_api.h */
|
||||
ESP_GATT_UNSUPPORT_GRP_TYPE = 0x10, /* 0x0010 */ /* relate to BTA_GATT_UNSUPPORT_GRP_TYPE in bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_RESOURCE = 0x11, /* 0x0011 */ /* relate to BTA_GATT_INSUF_RESOURCE in bta_gatt_api.h */
|
||||
|
||||
ESP_GATT_NO_RESOURCES = 0x80, /* 0x80 */ /* relate to BTA_GATT_NO_RESOURCES in bta_gatt_api.h */
|
||||
ESP_GATT_INTERNAL_ERROR = 0x81, /* 0x81 */ /* relate to BTA_GATT_INTERNAL_ERROR in bta_gatt_api.h */
|
||||
ESP_GATT_WRONG_STATE = 0x82, /* 0x82 */ /* relate to BTA_GATT_WRONG_STATE in bta_gatt_api.h */
|
||||
ESP_GATT_DB_FULL = 0x83, /* 0x83 */ /* relate to BTA_GATT_DB_FULL in bta_gatt_api.h */
|
||||
ESP_GATT_BUSY = 0x84, /* 0x84 */ /* relate to BTA_GATT_BUSY in bta_gatt_api.h */
|
||||
ESP_GATT_ERROR = 0x85, /* 0x85 */ /* relate to BTA_GATT_ERROR in bta_gatt_api.h */
|
||||
ESP_GATT_CMD_STARTED = 0x86, /* 0x86 */ /* relate to BTA_GATT_CMD_STARTED in bta_gatt_api.h */
|
||||
ESP_GATT_ILLEGAL_PARAMETER = 0x87, /* 0x87 */ /* relate to BTA_GATT_ILLEGAL_PARAMETER in bta_gatt_api.h */
|
||||
ESP_GATT_PENDING = 0x88, /* 0x88 */ /* relate to BTA_GATT_PENDING in bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_FAIL = 0x89, /* 0x89 */ /* relate to BTA_GATT_AUTH_FAIL in bta_gatt_api.h */
|
||||
ESP_GATT_MORE = 0x8a, /* 0x8a */ /* relate to BTA_GATT_MORE in bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_CFG = 0x8b, /* 0x8b */ /* relate to BTA_GATT_INVALID_CFG in bta_gatt_api.h */
|
||||
ESP_GATT_SERVICE_STARTED = 0x8c, /* 0x8c */ /* relate to BTA_GATT_SERVICE_STARTED in bta_gatt_api.h */
|
||||
ESP_GATT_ENCRYPED_MITM = ESP_GATT_OK, /* relate to BTA_GATT_ENCRYPED_MITM in bta_gatt_api.h */
|
||||
ESP_GATT_ENCRYPED_NO_MITM = 0x8d, /* 0x8d */ /* relate to BTA_GATT_ENCRYPED_NO_MITM in bta_gatt_api.h */
|
||||
ESP_GATT_NOT_ENCRYPTED = 0x8e, /* 0x8e */ /* relate to BTA_GATT_NOT_ENCRYPTED in bta_gatt_api.h */
|
||||
ESP_GATT_CONGESTED = 0x8f, /* 0x8f */ /* relate to BTA_GATT_CONGESTED in bta_gatt_api.h */
|
||||
ESP_GATT_DUP_REG = 0x90, /* 0x90 */ /* relate to BTA_GATT_DUP_REG in bta_gatt_api.h */
|
||||
ESP_GATT_ALREADY_OPEN = 0x91, /* 0x91 */ /* relate to BTA_GATT_ALREADY_OPEN in bta_gatt_api.h */
|
||||
ESP_GATT_CANCEL = 0x92, /* 0x92 */ /* relate to BTA_GATT_CANCEL in bta_gatt_api.h */
|
||||
/* 0xE0 ~ 0xFC reserved for future use */
|
||||
ESP_GATT_CCC_CFG_ERR = 0xfd, /* 0xFD Client Characteristic Configuration Descriptor Improperly Configured */
|
||||
ESP_GATT_PRC_IN_PROGRESS = 0xfe, /* 0xFE Procedure Already in progress */
|
||||
ESP_GATT_OUT_OF_RANGE = 0xff, /* 0xFFAttribute value out of range */
|
||||
ESP_GATT_STACK_RSP = 0xe0, /* 0xe0 */ /* relate to BTA_GATT_STACK_RSP in bta_gatt_api.h */
|
||||
ESP_GATT_APP_RSP = 0xe1, /* 0xe1 */ /* relate to BTA_GATT_APP_RSP in bta_gatt_api.h */
|
||||
//Error caused by customer application or stack bug
|
||||
ESP_GATT_UNKNOWN_ERROR = 0xef, /* 0xef */ /* relate to BTA_GATT_UNKNOWN_ERROR in bta_gatt_api.h */
|
||||
ESP_GATT_CCC_CFG_ERR = 0xfd, /* 0xFD Client Characteristic Configuration Descriptor Improperly Configured */ /* relate to BTA_GATT_CCC_CFG_ERR in bta_gatt_api.h */
|
||||
ESP_GATT_PRC_IN_PROGRESS = 0xfe, /* 0xFE Procedure Already in progress */ /* relate to BTA_GATT_PRC_IN_PROGRESS in bta_gatt_api.h */
|
||||
ESP_GATT_OUT_OF_RANGE = 0xff, /* 0xFFAttribute value out of range */ /* relate to BTA_GATT_OUT_OF_RANGE in bta_gatt_api.h */
|
||||
} esp_gatt_status_t;
|
||||
|
||||
/* relate to BTA_GATT_CONN_xxx in bta_gatt_api.h */
|
||||
/**
|
||||
* @brief Gatt Connection reason enum
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_CONN_UNKNOWN = 0, /*!< Gatt connection unknown */
|
||||
ESP_GATT_CONN_L2C_FAILURE = 1, /*!< General L2cap failure */
|
||||
ESP_GATT_CONN_TIMEOUT = 0x08, /*!< Connection timeout */
|
||||
ESP_GATT_CONN_TERMINATE_PEER_USER = 0x13, /*!< Connection terminate by peer user */
|
||||
ESP_GATT_CONN_TERMINATE_LOCAL_HOST = 0x16, /*!< Connectionterminated by local host */
|
||||
ESP_GATT_CONN_FAIL_ESTABLISH = 0x3e, /*!< Connection fail to establish */
|
||||
ESP_GATT_CONN_LMP_TIMEOUT = 0x22, /*!< Connection fail for LMP response tout */
|
||||
ESP_GATT_CONN_CONN_CANCEL = 0x0100, /*!< L2CAP connection cancelled */
|
||||
ESP_GATT_CONN_NONE = 0x0101 /*!< No connection to cancel */
|
||||
ESP_GATT_CONN_UNKNOWN = 0, /*!< Gatt connection unknown */ /* relate to BTA_GATT_CONN_UNKNOWN in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_L2C_FAILURE = 1, /*!< General L2cap failure */ /* relate to BTA_GATT_CONN_L2C_FAILURE in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TIMEOUT = 0x08, /*!< Connection timeout */ /* relate to BTA_GATT_CONN_TIMEOUT in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TERMINATE_PEER_USER = 0x13, /*!< Connection terminate by peer user */ /* relate to BTA_GATT_CONN_TERMINATE_PEER_USER in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TERMINATE_LOCAL_HOST = 0x16, /*!< Connectionterminated by local host */ /* relate to BTA_GATT_CONN_TERMINATE_LOCAL_HOST in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_FAIL_ESTABLISH = 0x3e, /*!< Connection fail to establish */ /* relate to BTA_GATT_CONN_FAIL_ESTABLISH in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_LMP_TIMEOUT = 0x22, /*!< Connection fail for LMP response tout */ /* relate to BTA_GATT_CONN_LMP_TIMEOUT in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_CONN_CANCEL = 0x0100, /*!< L2CAP connection cancelled */ /* relate to BTA_GATT_CONN_CONN_CANCEL in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_NONE = 0x0101 /*!< No connection to cancel */ /* relate to BTA_GATT_CONN_NONE in bta_gatt_api.h */
|
||||
} esp_gatt_conn_reason_t;
|
||||
|
||||
/**
|
||||
@ -241,42 +247,43 @@ typedef struct {
|
||||
bool is_primary; /*!< This service is primary or not */
|
||||
} __attribute__((packed)) esp_gatt_srvc_id_t;
|
||||
|
||||
/* relate to BTA_GATT_AUTH_REQ_xxx in bta_gatt_api.h */
|
||||
/**
|
||||
* @brief Gatt authentication request type
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_AUTH_REQ_NONE = 0,
|
||||
ESP_GATT_AUTH_REQ_NO_MITM = 1, /* unauthenticated encryption */
|
||||
ESP_GATT_AUTH_REQ_MITM = 2, /* authenticated encryption */
|
||||
ESP_GATT_AUTH_REQ_SIGNED_NO_MITM = 3,
|
||||
ESP_GATT_AUTH_REQ_SIGNED_MITM = 4,
|
||||
ESP_GATT_AUTH_REQ_NONE = 0, /* relate to BTA_GATT_AUTH_REQ_NONE in bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_NO_MITM = 1, /* unauthenticated encryption */ /* relate to BTA_GATT_AUTH_REQ_NO_MITM in bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_MITM = 2, /* authenticated encryption */ /* relate to BTA_GATT_AUTH_REQ_MITM in bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_SIGNED_NO_MITM = 3, /* relate to BTA_GATT_AUTH_REQ_SIGNED_NO_MITM in bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_SIGNED_MITM = 4, /* relate to BTA_GATT_AUTH_REQ_SIGNED_MITM in bta_gatt_api.h */
|
||||
} esp_gatt_auth_req_t;
|
||||
|
||||
/* relate to BTA_GATT_PERM_xxx in bta_gatt_api.h */
|
||||
/**
|
||||
* @brief Attribute permissions
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_PERM_READ = (1 << 0), /* bit 0 - 0x0001 */
|
||||
ESP_GATT_PERM_READ_ENCRYPTED = (1 << 1), /* bit 1 - 0x0002 */
|
||||
ESP_GATT_PERM_READ_ENC_MITM = (1 << 2), /* bit 2 - 0x0004 */
|
||||
ESP_GATT_PERM_WRITE = (1 << 4), /* bit 4 - 0x0010 */
|
||||
ESP_GATT_PERM_WRITE_ENCRYPTED = (1 << 5), /* bit 5 - 0x0020 */
|
||||
ESP_GATT_PERM_WRITE_ENC_MITM = (1 << 6), /* bit 6 - 0x0040 */
|
||||
ESP_GATT_PERM_WRITE_SIGNED = (1 << 7), /* bit 7 - 0x0080 */
|
||||
ESP_GATT_PERM_WRITE_SIGNED_MITM = (1 << 8), /* bit 8 - 0x0100 */
|
||||
} esp_gatt_perm_t;
|
||||
#define ESP_GATT_PERM_READ (1 << 0) /* bit 0 - 0x0001 */ /* relate to BTA_GATT_PERM_READ in bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_READ_ENCRYPTED (1 << 1) /* bit 1 - 0x0002 */ /* relate to BTA_GATT_PERM_READ_ENCRYPTED in bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_READ_ENC_MITM (1 << 2) /* bit 2 - 0x0004 */ /* relate to BTA_GATT_PERM_READ_ENC_MITM in bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE (1 << 4) /* bit 4 - 0x0010 */ /* relate to BTA_GATT_PERM_WRITE in bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_ENCRYPTED (1 << 5) /* bit 5 - 0x0020 */ /* relate to BTA_GATT_PERM_WRITE_ENCRYPTED in bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_ENC_MITM (1 << 6) /* bit 6 - 0x0040 */ /* relate to BTA_GATT_PERM_WRITE_ENC_MITM in bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_SIGNED (1 << 7) /* bit 7 - 0x0080 */ /* relate to BTA_GATT_PERM_WRITE_SIGNED in bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_SIGNED_MITM (1 << 8) /* bit 8 - 0x0100 */ /* relate to BTA_GATT_PERM_WRITE_SIGNED_MITM in bta_gatt_api.h */
|
||||
typedef uint16_t esp_gatt_perm_t;
|
||||
|
||||
/* relate to BTA_GATT_CHAR_PROP_BIT_xxx in bta_gatt_api.h */
|
||||
/* definition of characteristic properties */
|
||||
typedef enum {
|
||||
ESP_GATT_CHAR_PROP_BIT_BROADCAST = (1 << 0), /* 0x01 */
|
||||
ESP_GATT_CHAR_PROP_BIT_READ = (1 << 1), /* 0x02 */
|
||||
ESP_GATT_CHAR_PROP_BIT_WRITE_NR = (1 << 2), /* 0x04 */
|
||||
ESP_GATT_CHAR_PROP_BIT_WRITE = (1 << 3), /* 0x08 */
|
||||
ESP_GATT_CHAR_PROP_BIT_NOTIFY = (1 << 4), /* 0x10 */
|
||||
ESP_GATT_CHAR_PROP_BIT_INDICATE = (1 << 5), /* 0x20 */
|
||||
ESP_GATT_CHAR_PROP_BIT_AUTH = (1 << 6), /* 0x40 */
|
||||
ESP_GATT_CHAR_PROP_BIT_EXT_PROP = (1 << 7), /* 0x80 */
|
||||
} esp_gatt_char_prop_t;
|
||||
#define ESP_GATT_CHAR_PROP_BIT_BROADCAST (1 << 0) /* 0x01 */ /* relate to BTA_GATT_CHAR_PROP_BIT_BROADCAST in bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_READ (1 << 1) /* 0x02 */ /* relate to BTA_GATT_CHAR_PROP_BIT_READ in bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_WRITE_NR (1 << 2) /* 0x04 */ /* relate to BTA_GATT_CHAR_PROP_BIT_WRITE_NR in bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_WRITE (1 << 3) /* 0x08 */ /* relate to BTA_GATT_CHAR_PROP_BIT_WRITE in bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_NOTIFY (1 << 4) /* 0x10 */ /* relate to BTA_GATT_CHAR_PROP_BIT_NOTIFY in bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_INDICATE (1 << 5) /* 0x20 */ /* relate to BTA_GATT_CHAR_PROP_BIT_INDICATE in bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_AUTH (1 << 6) /* 0x40 */ /* relate to BTA_GATT_CHAR_PROP_BIT_AUTH in bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_EXT_PROP (1 << 7) /* 0x80 */ /* relate to BTA_GATT_CHAR_PROP_BIT_EXT_PROP in bta_gatt_api.h */
|
||||
typedef uint8_t esp_gatt_char_prop_t;
|
||||
|
||||
/// GATT maximum attribute length
|
||||
#define ESP_GATT_MAX_ATTR_LEN 600 //as same as GATT_MAX_ATTR_LEN
|
||||
|
@ -25,45 +25,47 @@ extern "C" {
|
||||
|
||||
/// GATT Client callback function events
|
||||
typedef enum {
|
||||
ESP_GATTC_REG_EVT = 0, /*!< When GATT client is registered, the event comes */
|
||||
ESP_GATTC_UNREG_EVT = 1, /*!< When GATT client is unregistered, the event comes */
|
||||
ESP_GATTC_OPEN_EVT = 2, /*!< When GATT connection is set up, the event comes */
|
||||
ESP_GATTC_READ_CHAR_EVT = 3, /*!< When GATT characteristic is read, the event comes */
|
||||
ESP_GATTC_WRITE_CHAR_EVT = 4, /*!< When GATT characteristic write operation completes, the event comes */
|
||||
ESP_GATTC_CLOSE_EVT = 5, /*!< When GATT connection is closed, the event comes */
|
||||
ESP_GATTC_SEARCH_CMPL_EVT = 6, /*!< When GATT service discovery is completed, the event comes */
|
||||
ESP_GATTC_SEARCH_RES_EVT = 7, /*!< When GATT service discovery result is got, the event comes */
|
||||
ESP_GATTC_READ_DESCR_EVT = 8, /*!< When GATT characteristic descriptor read completes, the event comes */
|
||||
ESP_GATTC_WRITE_DESCR_EVT = 9, /*!< When GATT characteristic descriptor write completes, the event comes */
|
||||
ESP_GATTC_NOTIFY_EVT = 10, /*!< When GATT notification or indication arrives, the event comes */
|
||||
ESP_GATTC_PREP_WRITE_EVT = 11, /*!< When GATT prepare-write operation completes, the event comes */
|
||||
ESP_GATTC_EXEC_EVT = 12, /*!< When write execution completes, the event comes */
|
||||
ESP_GATTC_ACL_EVT = 13, /*!< When ACL connection is up, the event comes */
|
||||
ESP_GATTC_CANCEL_OPEN_EVT = 14, /*!< When GATT client ongoing connection is cancelled, the event comes */
|
||||
ESP_GATTC_SRVC_CHG_EVT = 15, /*!< When "service changed" occurs, the event comes */
|
||||
ESP_GATTC_ENC_CMPL_CB_EVT = 17, /*!< When encryption procedure completes, the event comes */
|
||||
ESP_GATTC_CFG_MTU_EVT = 18, /*!< When configuration of MTU completes, the event comes */
|
||||
ESP_GATTC_ADV_DATA_EVT = 19, /*!< When advertising of data, the event comes */
|
||||
ESP_GATTC_MULT_ADV_ENB_EVT = 20, /*!< When multi-advertising is enabled, the event comes */
|
||||
ESP_GATTC_MULT_ADV_UPD_EVT = 21, /*!< When multi-advertising parameters are updated, the event comes */
|
||||
ESP_GATTC_MULT_ADV_DATA_EVT = 22, /*!< When multi-advertising data arrives, the event comes */
|
||||
ESP_GATTC_MULT_ADV_DIS_EVT = 23, /*!< When multi-advertising is disabled, the event comes */
|
||||
ESP_GATTC_CONGEST_EVT = 24, /*!< When GATT connection congestion comes, the event comes */
|
||||
ESP_GATTC_BTH_SCAN_ENB_EVT = 25, /*!< When batch scan is enabled, the event comes */
|
||||
ESP_GATTC_BTH_SCAN_CFG_EVT = 26, /*!< When batch scan storage is configured, the event comes */
|
||||
ESP_GATTC_BTH_SCAN_RD_EVT = 27, /*!< When Batch scan read event is reported, the event comes */
|
||||
ESP_GATTC_BTH_SCAN_THR_EVT = 28, /*!< When Batch scan threshold is set, the event comes */
|
||||
ESP_GATTC_BTH_SCAN_PARAM_EVT = 29, /*!< When Batch scan parameters are set, the event comes */
|
||||
ESP_GATTC_BTH_SCAN_DIS_EVT = 30, /*!< When Batch scan is disabled, the event comes */
|
||||
ESP_GATTC_SCAN_FLT_CFG_EVT = 31, /*!< When Scan filter configuration completes, the event comes */
|
||||
ESP_GATTC_SCAN_FLT_PARAM_EVT = 32, /*!< When Scan filter parameters are set, the event comes */
|
||||
ESP_GATTC_SCAN_FLT_STATUS_EVT = 33, /*!< When Scan filter status is reported, the event comes */
|
||||
ESP_GATTC_ADV_VSC_EVT = 34, /*!< When advertising vendor spec content event is reported, the event comes */
|
||||
ESP_GATTC_GET_CHAR_EVT = 35, /*!< When characteristic is got from GATT server, the event comes */
|
||||
ESP_GATTC_GET_DESCR_EVT = 36, /*!< When characteristic descriptor is got from GATT server, the event comes */
|
||||
ESP_GATTC_GET_INCL_SRVC_EVT = 37, /*!< When included service is got from GATT server, the event comes */
|
||||
ESP_GATTC_REG_FOR_NOTIFY_EVT = 38, /*!< When register for notification of a service completes, the event comes */
|
||||
ESP_GATTC_UNREG_FOR_NOTIFY_EVT = 39, /*!< When unregister for notification of a service completes, the event comes */
|
||||
ESP_GATTC_REG_EVT = 0, /*!< When GATT client is registered, the event comes */
|
||||
ESP_GATTC_UNREG_EVT = 1, /*!< When GATT client is unregistered, the event comes */
|
||||
ESP_GATTC_OPEN_EVT = 2, /*!< When GATT virtual connection is set up, the event comes */
|
||||
ESP_GATTC_READ_CHAR_EVT = 3, /*!< When GATT characteristic is read, the event comes */
|
||||
ESP_GATTC_WRITE_CHAR_EVT = 4, /*!< When GATT characteristic write operation completes, the event comes */
|
||||
ESP_GATTC_CLOSE_EVT = 5, /*!< When GATT virtual connection is closed, the event comes */
|
||||
ESP_GATTC_SEARCH_CMPL_EVT = 6, /*!< When GATT service discovery is completed, the event comes */
|
||||
ESP_GATTC_SEARCH_RES_EVT = 7, /*!< When GATT service discovery result is got, the event comes */
|
||||
ESP_GATTC_READ_DESCR_EVT = 8, /*!< When GATT characteristic descriptor read completes, the event comes */
|
||||
ESP_GATTC_WRITE_DESCR_EVT = 9, /*!< When GATT characteristic descriptor write completes, the event comes */
|
||||
ESP_GATTC_NOTIFY_EVT = 10, /*!< When GATT notification or indication arrives, the event comes */
|
||||
ESP_GATTC_PREP_WRITE_EVT = 11, /*!< When GATT prepare-write operation completes, the event comes */
|
||||
ESP_GATTC_EXEC_EVT = 12, /*!< When write execution completes, the event comes */
|
||||
ESP_GATTC_ACL_EVT = 13, /*!< When ACL connection is up, the event comes */
|
||||
ESP_GATTC_CANCEL_OPEN_EVT = 14, /*!< When GATT client ongoing connection is cancelled, the event comes */
|
||||
ESP_GATTC_SRVC_CHG_EVT = 15, /*!< When "service changed" occurs, the event comes */
|
||||
ESP_GATTC_ENC_CMPL_CB_EVT = 17, /*!< When encryption procedure completes, the event comes */
|
||||
ESP_GATTC_CFG_MTU_EVT = 18, /*!< When configuration of MTU completes, the event comes */
|
||||
ESP_GATTC_ADV_DATA_EVT = 19, /*!< When advertising of data, the event comes */
|
||||
ESP_GATTC_MULT_ADV_ENB_EVT = 20, /*!< When multi-advertising is enabled, the event comes */
|
||||
ESP_GATTC_MULT_ADV_UPD_EVT = 21, /*!< When multi-advertising parameters are updated, the event comes */
|
||||
ESP_GATTC_MULT_ADV_DATA_EVT = 22, /*!< When multi-advertising data arrives, the event comes */
|
||||
ESP_GATTC_MULT_ADV_DIS_EVT = 23, /*!< When multi-advertising is disabled, the event comes */
|
||||
ESP_GATTC_CONGEST_EVT = 24, /*!< When GATT connection congestion comes, the event comes */
|
||||
ESP_GATTC_BTH_SCAN_ENB_EVT = 25, /*!< When batch scan is enabled, the event comes */
|
||||
ESP_GATTC_BTH_SCAN_CFG_EVT = 26, /*!< When batch scan storage is configured, the event comes */
|
||||
ESP_GATTC_BTH_SCAN_RD_EVT = 27, /*!< When Batch scan read event is reported, the event comes */
|
||||
ESP_GATTC_BTH_SCAN_THR_EVT = 28, /*!< When Batch scan threshold is set, the event comes */
|
||||
ESP_GATTC_BTH_SCAN_PARAM_EVT = 29, /*!< When Batch scan parameters are set, the event comes */
|
||||
ESP_GATTC_BTH_SCAN_DIS_EVT = 30, /*!< When Batch scan is disabled, the event comes */
|
||||
ESP_GATTC_SCAN_FLT_CFG_EVT = 31, /*!< When Scan filter configuration completes, the event comes */
|
||||
ESP_GATTC_SCAN_FLT_PARAM_EVT = 32, /*!< When Scan filter parameters are set, the event comes */
|
||||
ESP_GATTC_SCAN_FLT_STATUS_EVT = 33, /*!< When Scan filter status is reported, the event comes */
|
||||
ESP_GATTC_ADV_VSC_EVT = 34, /*!< When advertising vendor spec content event is reported, the event comes */
|
||||
ESP_GATTC_GET_CHAR_EVT = 35, /*!< When characteristic is got from GATT server, the event comes */
|
||||
ESP_GATTC_GET_DESCR_EVT = 36, /*!< When characteristic descriptor is got from GATT server, the event comes */
|
||||
ESP_GATTC_GET_INCL_SRVC_EVT = 37, /*!< When included service is got from GATT server, the event comes */
|
||||
ESP_GATTC_REG_FOR_NOTIFY_EVT = 38, /*!< When register for notification of a service completes, the event comes */
|
||||
ESP_GATTC_UNREG_FOR_NOTIFY_EVT = 39, /*!< When unregister for notification of a service completes, the event comes */
|
||||
ESP_GATTC_CONNECT_EVT = 40, /*!< When the ble physical connection is set up, the event comes */
|
||||
ESP_GATTC_DISCONNECT_EVT = 41, /*!< When the ble physical connection disconnected, the event comes */
|
||||
} esp_gattc_cb_event_t;
|
||||
|
||||
/// Maximum Transmission Unit used in GATT
|
||||
@ -133,15 +135,22 @@ typedef union {
|
||||
* @brief ESP_GATTC_READ_CHAR_EVT, ESP_GATTC_READ_DESCR_EVT
|
||||
*/
|
||||
struct gattc_read_char_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
esp_gatt_srvc_id_t srvc_id; /*!< Service id, include service uuid and other information */
|
||||
esp_gatt_id_t char_id; /*!< Characteristic id, include characteristic uuid and other information */
|
||||
esp_gatt_id_t descr_id; /*!< Descriptor id, include descriptor uuid and other information */
|
||||
uint8_t *value; /*!< Characteristic value */
|
||||
uint16_t value_type; /*!< Characteristic value type */
|
||||
uint16_t value_len; /*!< Characteristic value length */
|
||||
} read; /*!< Gatt client callback param of ESP_GATTC_READ_CHAR_EVT */
|
||||
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
esp_gatt_srvc_id_t srvc_id; /*!< Service id, include service uuid and other information */
|
||||
esp_gatt_id_t char_id; /*!< Characteristic id, include characteristic uuid and other information */
|
||||
esp_gatt_id_t descr_id; /*!< Descriptor id, include descriptor uuid and other information */
|
||||
uint8_t *value; /*!< Characteristic value */
|
||||
uint16_t value_type; /*!< Characteristic value type, there is two value for this type:
|
||||
ESP_GATTC_READ_VALUE_TYPE_VALUE(0x0000) and
|
||||
ESP_GATTC_READ_VALUE_TYPE_AGG_FORMAT(0x2905).
|
||||
If the value is ESP_GATTC_READ_VALUE_TYPE_VALUE means it is a generally
|
||||
value type, and if is the type of ESP_GATTC_READ_VALUE_TYPE_AGG_FORMAT,
|
||||
the unit of the value will indicate in the Characteristic
|
||||
aggregate format descriptor */
|
||||
uint16_t value_len; /*!< Characteristic value length */
|
||||
} read; /*!< Gatt client callback param of ESP_GATTC_READ_CHAR_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_WRITE_CHAR_EVT, ESP_GATTC_PREP_WRITE_EVT, ESP_GATTC_WRITE_DESCR_EVT
|
||||
@ -241,6 +250,23 @@ typedef union {
|
||||
esp_gatt_id_t char_id; /*!< Characteristic id, include characteristic uuid and other information */
|
||||
} unreg_for_notify; /*!< Gatt client callback param of ESP_GATTC_UNREG_FOR_NOTIFY_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_CONNECT_EVT
|
||||
*/
|
||||
struct gattc_connect_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
} connect; /*!< Gatt client callback param of ESP_GATTC_CONNECT_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_DISCONNECT_EVT
|
||||
*/
|
||||
struct gattc_disconnect_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
} disconnect; /*!< Gatt client callback param of ESP_GATTC_DISCONNECT_EVT */
|
||||
|
||||
} esp_ble_gattc_cb_param_t; /*!< GATT client callback parameter union type */
|
||||
|
||||
@ -311,7 +337,10 @@ esp_err_t esp_ble_gattc_open(esp_gatt_if_t gattc_if, esp_bd_addr_t remote_bda, b
|
||||
|
||||
|
||||
/**
|
||||
* @brief Close a connection to a GATT server.
|
||||
* @brief Close a virtual connection to a GATT server. gattc maybe have multiple virtual GATT server connections when multiple app_id registed,
|
||||
* this API only close one virtual GATT server connection. if there exist other virtual GATT server connections,
|
||||
* it does not disconnect the physical connection.
|
||||
* if you want to disconnect the physical connection directly, you can use esp_ble_gap_disconnect(esp_bd_addr_t remote_device).
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id: connection ID to be closed.
|
||||
@ -629,6 +658,19 @@ esp_gatt_status_t esp_ble_gattc_unregister_for_notify (esp_gatt_if_t gattc_if,
|
||||
esp_gatt_srvc_id_t *srvc_id,
|
||||
esp_gatt_id_t *char_id);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Refresh the server cache store in the gattc stack of the remote device
|
||||
*
|
||||
* @param[in] remote_bda: remote device BD address.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_cache_refresh(esp_bd_addr_t remote_bda);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -208,12 +208,25 @@ typedef union {
|
||||
/**
|
||||
* @brief ESP_GATTS_OPEN_EVT
|
||||
*/
|
||||
struct gatts_open_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
} open; /*!< Gatt server callback param of ESP_GATTS_OPEN_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTS_CANCEL_OPEN_EVT
|
||||
*/
|
||||
struct gatts_cancel_open_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
} cancel_open; /*!< Gatt server callback param of ESP_GATTS_CANCEL_OPEN_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTS_CLOSE_EVT
|
||||
*/
|
||||
struct gatts_close_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
} close; /*!< Gatt server callback param of ESP_GATTS_CLOSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTS_LISTEN_EVT
|
||||
*/
|
||||
|
@ -46,7 +46,6 @@
|
||||
#define GATT_INSUF_RESOURCE 0x11
|
||||
|
||||
|
||||
#define GATT_ILLEGAL_PARAMETER 0x87
|
||||
#define GATT_NO_RESOURCES 0x80
|
||||
#define GATT_INTERNAL_ERROR 0x81
|
||||
#define GATT_WRONG_STATE 0x82
|
||||
@ -54,6 +53,7 @@
|
||||
#define GATT_BUSY 0x84
|
||||
#define GATT_ERROR 0x85
|
||||
#define GATT_CMD_STARTED 0x86
|
||||
#define GATT_ILLEGAL_PARAMETER 0x87
|
||||
#define GATT_PENDING 0x88
|
||||
#define GATT_AUTH_FAIL 0x89
|
||||
#define GATT_MORE 0x8a
|
||||
@ -63,15 +63,21 @@
|
||||
#define GATT_ENCRYPED_NO_MITM 0x8d
|
||||
#define GATT_NOT_ENCRYPTED 0x8e
|
||||
#define GATT_CONGESTED 0x8f
|
||||
#define GATT_STACK_RSP 0x90
|
||||
#define GATT_APP_RSP 0x91
|
||||
//Error caused by customer application or stack bug
|
||||
#define GATT_ESP_ERROR 0X9f
|
||||
|
||||
#define GATT_DUP_REG 0x90
|
||||
#define GATT_ALREADY_OPEN 0x91
|
||||
#define GATT_CANCEL 0x92
|
||||
|
||||
/* 0xE0 ~ 0xFC reserved for future use */
|
||||
#define GATT_STACK_RSP 0xE0
|
||||
#define GATT_APP_RSP 0xE1
|
||||
//Error caused by customer application or stack bug
|
||||
#define GATT_UNKNOWN_ERROR 0XEF
|
||||
|
||||
#define GATT_CCC_CFG_ERR 0xFD /* Client Characteristic Configuration Descriptor Improperly Configured */
|
||||
#define GATT_PRC_IN_PROGRESS 0xFE /* Procedure Already in progress */
|
||||
#define GATT_OUT_OF_RANGE 0xFF /* Attribute value out of range */
|
||||
|
||||
typedef UINT8 tGATT_STATUS;
|
||||
|
||||
|
||||
|
@ -53,9 +53,10 @@
|
||||
#define L2CAP_DELAY_CHECK_SM4 2 /* 2 seconds */
|
||||
#define L2CAP_WAIT_INFO_RSP_TOUT 3 /* 3 seconds */
|
||||
#define L2CAP_WAIT_UNPARK_TOUT 2 /* 2 seconds */
|
||||
#define L2CAP_LINK_INFO_RESP_TOUT 2 /* 2 seconds */
|
||||
#define L2CAP_LINK_INFO_RESP_TOUT 2 /* 2 seconds */
|
||||
#define L2CAP_UPDATE_CONN_PARAM_TOUT 6 /* 6 seconds */
|
||||
#define L2CAP_BLE_LINK_CONNECT_TOUT 30 /* 30 seconds */
|
||||
#define L2CAP_BLE_CONN_PARAM_UPD_TOUT 30 /* 30 seconds */
|
||||
#define L2CAP_BLE_CONN_PARAM_UPD_TOUT 30 /* 30 seconds */
|
||||
|
||||
/* quick timer uses millisecond unit */
|
||||
#define L2CAP_DEFAULT_RETRANS_TOUT 2000 /* 2000 milliseconds */
|
||||
@ -353,6 +354,7 @@ typedef struct t_l2c_linkcb {
|
||||
|
||||
tL2C_CCB *p_pending_ccb; /* ccb of waiting channel during link disconnect */
|
||||
TIMER_LIST_ENT info_timer_entry; /* Timer entry for info resp timeout evt */
|
||||
TIMER_LIST_ENT upda_con_timer; /* Timer entry for update connection parametr */
|
||||
BD_ADDR remote_bd_addr; /* The BD address of the remote */
|
||||
|
||||
UINT8 link_role; /* Master or slave */
|
||||
@ -404,6 +406,7 @@ typedef struct t_l2c_linkcb {
|
||||
|
||||
UINT16 min_interval; /* parameters as requested by peripheral */
|
||||
UINT16 max_interval;
|
||||
UINT16 conn_int;
|
||||
UINT16 latency;
|
||||
UINT16 timeout;
|
||||
|
||||
@ -728,7 +731,8 @@ extern void l2cble_conn_comp (UINT16 handle, UINT8 role, BD_ADDR bda, tBLE_ADDR_
|
||||
extern BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb);
|
||||
extern void l2cble_notify_le_connection (BD_ADDR bda);
|
||||
extern void l2c_ble_link_adjust_allocation (void);
|
||||
extern void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status);
|
||||
extern void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status, UINT16 conn_interval,
|
||||
UINT16 conn_latency, UINT16 conn_timeout);
|
||||
|
||||
#if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE)
|
||||
extern void l2cble_process_rc_param_request_evt(UINT16 handle, UINT16 int_min, UINT16 int_max,
|
||||
@ -738,6 +742,7 @@ extern void l2cble_process_rc_param_request_evt(UINT16 handle, UINT16 int_min, U
|
||||
extern void l2cble_update_data_length(tL2C_LCB *p_lcb);
|
||||
extern void l2cble_set_fixed_channel_tx_data_length(BD_ADDR remote_bda, UINT16 fix_cid,
|
||||
UINT16 tx_mtu);
|
||||
extern void l2c_send_update_conn_params_cb(tL2C_LCB *p_lcb, UINT8 status);
|
||||
extern void l2cble_process_data_length_change_event(UINT16 handle, UINT16 tx_data_len,
|
||||
UINT16 rx_data_len);
|
||||
|
||||
|
@ -62,11 +62,14 @@ enum {
|
||||
#define BTC_TASK_PRIO (configMAX_PRIORITIES - 6)
|
||||
#define BTC_TASK_QUEUE_NUM 60
|
||||
|
||||
void btu_task_post(uint32_t sig);
|
||||
void hci_host_task_post(void);
|
||||
void hci_hal_h4_task_post(void);
|
||||
void hci_drv_task_post(void);
|
||||
void bt_alarm_task_post(void);
|
||||
|
||||
#define TASK_POST_NON_BLOCKING (0)
|
||||
#define TASK_POST_BLOCKING (portMAX_DELAY)
|
||||
typedef uint32_t task_post_t; /* Timeout of task post return, unit TICK */
|
||||
|
||||
void btu_task_post(uint32_t sig, task_post_t timeout);
|
||||
void hci_host_task_post(task_post_t timeout);
|
||||
void hci_hal_h4_task_post(task_post_t timeout);
|
||||
|
||||
|
||||
#endif /* __THREAD_H__ */
|
||||
|
Reference in New Issue
Block a user