mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-01 13:00:59 +02:00
Update IDF to c4e65d6
This commit is contained in:
@ -665,6 +665,12 @@
|
||||
#define L2CAP_CLIENT_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
/* The maximum number of simultaneous applications that can register with LE L2CAP. */
|
||||
#ifndef BLE_MAX_L2CAP_CLIENTS
|
||||
#define BLE_MAX_L2CAP_CLIENTS 15
|
||||
#endif
|
||||
|
||||
|
||||
/* The maximum number of simultaneous links that L2CAP can support. Up to 7*/
|
||||
#ifndef MAX_ACL_CONNECTIONS
|
||||
#define MAX_L2CAP_LINKS 5
|
||||
|
@ -406,6 +406,12 @@ typedef tBTM_SET_PKT_DATA_LENGTH_CBACK tBTA_SET_PKT_DATA_LENGTH_CBACK;
|
||||
|
||||
typedef tBTM_SET_LOCAL_PRIVACY_CBACK tBTA_SET_LOCAL_PRIVACY_CBACK;
|
||||
|
||||
typedef tBTM_CMPL_CB tBTA_CMPL_CB;
|
||||
|
||||
typedef tBTM_TX_POWER_RESULTS tBTA_TX_POWER_RESULTS;
|
||||
|
||||
typedef tBTM_RSSI_RESULTS tBTA_RSSI_RESULTS;
|
||||
|
||||
/* 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
|
||||
@ -1404,6 +1410,12 @@ extern void BTA_DisableTestMode(void);
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmSetDeviceName(char *p_name);
|
||||
|
||||
extern void BTA_DmUpdateWhiteList(BOOLEAN add_remove, BD_ADDR remote_addr);
|
||||
|
||||
extern void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb);
|
||||
|
||||
extern void BTA_DmBleReadRSSI(BD_ADDR remote_addr, tBTA_CMPL_CB *cmpl_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmSetVisibility
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "bta_api.h"
|
||||
#include "gatt_api.h"
|
||||
#include "list.h"
|
||||
|
||||
#ifndef BTA_GATT_INCLUDED
|
||||
#warning BTA_GATT_INCLUDED not defined
|
||||
@ -43,6 +44,34 @@
|
||||
#define BTA_GATT_DEBUG FALSE
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
BTGATT_DB_PRIMARY_SERVICE,
|
||||
BTGATT_DB_SECONDARY_SERVICE,
|
||||
BTGATT_DB_CHARACTERISTIC,
|
||||
BTGATT_DB_DESCRIPTOR,
|
||||
BTGATT_DB_INCLUDED_SERVICE,
|
||||
}bt_gatt_db_attribute_type_t;
|
||||
|
||||
typedef enum {
|
||||
GATT_OP_GET_SVC_BY_UUID,
|
||||
GATT_OP_GET_ALL_CHAR,
|
||||
GATT_OP_GET_ALL_DESCRI,
|
||||
GATT_OP_GET_CHAR_BY_UUID,
|
||||
GATT_OP_GET_DESCRI_BY_UUID,
|
||||
GATT_OP_GET_DESCRI_BY_HANDLE,
|
||||
GATT_OP_GET_INCLUDE_SVC,
|
||||
}bt_gatt_get_db_op_t;
|
||||
|
||||
typedef struct {
|
||||
bt_gatt_db_attribute_type_t type;
|
||||
UINT16 attribute_handle;
|
||||
UINT16 start_handle;
|
||||
UINT16 end_handle;
|
||||
UINT16 id;
|
||||
UINT8 properties;
|
||||
bt_uuid_t uuid;
|
||||
}btgatt_db_element_t;
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants and data types
|
||||
*****************************************************************************/
|
||||
@ -104,7 +133,7 @@ typedef struct {
|
||||
#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 */
|
||||
|
||||
/* 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 */
|
||||
@ -213,41 +242,13 @@ typedef struct {
|
||||
BOOLEAN is_primary;
|
||||
} tBTA_GATT_SRVC_ID;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATT_SRVC_ID srvc_id;
|
||||
tBTA_GATT_ID char_id;
|
||||
} tBTA_GATTC_CHAR_ID;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATTC_CHAR_ID char_id;
|
||||
tBTA_GATT_ID descr_id;
|
||||
} tBTA_GATTC_CHAR_DESCR_ID;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATT_SRVC_ID srvc_id;
|
||||
tBTA_GATT_SRVC_ID incl_svc_id;
|
||||
} tBTA_GATTC_INCL_SVC_ID;
|
||||
|
||||
#define BTA_GATT_TYPE_CHAR 0
|
||||
#define BTA_GATT_TYPE_CHAR_DESCR 1
|
||||
typedef UINT8 tBTA_GATT_ID_TYPE;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATT_ID_TYPE id_type;
|
||||
union {
|
||||
tBTA_GATTC_CHAR_ID char_id;
|
||||
tBTA_GATTC_CHAR_DESCR_ID char_descr_id;
|
||||
|
||||
} id_value;
|
||||
} tBTA_GATTC_ATTR_ID;
|
||||
|
||||
#define BTA_GATTC_MULTI_MAX GATT_MAX_READ_MULTI_HANDLES
|
||||
|
||||
typedef struct {
|
||||
UINT8 num_attr;
|
||||
tBTA_GATTC_ATTR_ID id_list[BTA_GATTC_MULTI_MAX];
|
||||
|
||||
} tBTA_GATTC_MULTI;
|
||||
UINT16 handles[BTA_GATTC_MULTI_MAX];
|
||||
}tBTA_GATTC_MULTI;
|
||||
|
||||
/* relate to ESP_GATT_xxx in esp_gatt_def.h */
|
||||
#define BTA_GATT_AUTH_REQ_NONE GATT_AUTH_REQ_NONE
|
||||
@ -275,44 +276,28 @@ typedef struct {
|
||||
UINT8 id;
|
||||
UINT8 prop; /* used when attribute type is characteristic */
|
||||
BOOLEAN is_primary; /* used when attribute type is service */
|
||||
} tBTA_GATTC_NV_ATTR;
|
||||
UINT16 incl_srvc_handle; /* used when attribute type is included service */
|
||||
}tBTA_GATTC_NV_ATTR;
|
||||
|
||||
/* callback data structure */
|
||||
typedef struct {
|
||||
tBTA_GATT_STATUS status;
|
||||
tBTA_GATTC_IF client_if;
|
||||
// btla-specific ++
|
||||
tBT_UUID app_uuid;
|
||||
// btla-specific --
|
||||
} tBTA_GATTC_REG;
|
||||
|
||||
typedef struct {
|
||||
UINT8 num_pres_fmt; /* number of presentation format aggregated*/
|
||||
tBTA_GATTC_CHAR_DESCR_ID pre_format[BTA_GATTC_MULTI_MAX];
|
||||
} tBTA_GATT_CHAR_AGGRE_VALUE;
|
||||
|
||||
typedef union {
|
||||
tBTA_GATT_CHAR_AGGRE_VALUE aggre_value;
|
||||
tBTA_GATT_UNFMT unformat;
|
||||
|
||||
} tBTA_GATT_READ_VAL;
|
||||
}tBTA_GATTC_REG;
|
||||
|
||||
typedef struct {
|
||||
UINT16 conn_id;
|
||||
tBTA_GATT_STATUS status;
|
||||
tBTA_GATT_SRVC_ID srvc_id;
|
||||
tBTA_GATT_ID char_id;
|
||||
tBTA_GATT_ID descr_type;
|
||||
tBTA_GATT_READ_VAL *p_value;
|
||||
} tBTA_GATTC_READ;
|
||||
UINT16 handle;
|
||||
tBTA_GATT_UNFMT *p_value;
|
||||
}tBTA_GATTC_READ;
|
||||
|
||||
typedef struct {
|
||||
UINT16 conn_id;
|
||||
tBTA_GATT_STATUS status;
|
||||
tBTA_GATT_SRVC_ID srvc_id;
|
||||
tBTA_GATT_ID char_id;
|
||||
tBTA_GATT_ID descr_type;
|
||||
} tBTA_GATTC_WRITE;
|
||||
UINT16 handle;
|
||||
}tBTA_GATTC_WRITE;
|
||||
|
||||
typedef struct {
|
||||
UINT16 conn_id;
|
||||
@ -326,8 +311,10 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
UINT16 conn_id;
|
||||
tBTA_GATT_SRVC_ID service_uuid;
|
||||
} tBTA_GATTC_SRVC_RES;
|
||||
UINT16 start_handle;
|
||||
UINT16 end_handle;
|
||||
tBTA_GATT_ID service_uuid;
|
||||
}tBTA_GATTC_SRVC_RES;
|
||||
|
||||
typedef struct {
|
||||
UINT16 conn_id;
|
||||
@ -355,8 +342,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
UINT16 conn_id;
|
||||
BD_ADDR bda;
|
||||
tBTA_GATTC_CHAR_ID char_id;
|
||||
tBTA_GATT_ID descr_type;
|
||||
UINT16 handle;
|
||||
UINT16 len;
|
||||
UINT8 value[BTA_GATT_MAX_ATTR_LEN];
|
||||
BOOLEAN is_notify;
|
||||
@ -367,14 +353,12 @@ typedef struct {
|
||||
BOOLEAN congested; /* congestion indicator */
|
||||
} tBTA_GATTC_CONGEST;
|
||||
|
||||
// btla-specific ++
|
||||
typedef struct {
|
||||
tBTA_GATT_STATUS status;
|
||||
tBTA_GATTC_IF client_if;
|
||||
UINT16 conn_id;
|
||||
BD_ADDR remote_bda;
|
||||
} tBTA_GATTC_OPEN_CLOSE;
|
||||
// btla-specific --
|
||||
}tBTA_GATTC_OPEN_CLOSE;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATTC_IF client_if;
|
||||
@ -395,6 +379,8 @@ typedef struct {
|
||||
BD_ADDR remote_bda;
|
||||
} tBTA_GATTC_DISCONNECT;
|
||||
|
||||
|
||||
|
||||
typedef union {
|
||||
tBTA_GATT_STATUS status;
|
||||
|
||||
@ -541,33 +527,26 @@ typedef struct {
|
||||
typedef struct {
|
||||
tBTA_GATTS_IF server_if;
|
||||
tBTA_GATT_STATUS status;
|
||||
// btla-specific ++
|
||||
tBT_UUID uuid;
|
||||
// btla-specific --
|
||||
} tBTA_GATTS_REG_OPER;
|
||||
}tBTA_GATTS_REG_OPER;
|
||||
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATTS_IF server_if;
|
||||
UINT16 service_id;
|
||||
// btla-specific ++
|
||||
UINT16 svc_instance;
|
||||
BOOLEAN is_primary;
|
||||
tBTA_GATT_STATUS status;
|
||||
tBT_UUID uuid;
|
||||
// btla-specific --
|
||||
} tBTA_GATTS_CREATE;
|
||||
}tBTA_GATTS_CREATE;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATTS_IF server_if;
|
||||
UINT16 service_id;
|
||||
UINT16 attr_id;
|
||||
tBTA_GATT_STATUS status;
|
||||
// btla-specific ++
|
||||
tBT_UUID char_uuid;
|
||||
// btla-specific --
|
||||
} tBTA_GATTS_ADD_RESULT;
|
||||
|
||||
}tBTA_GATTS_ADD_RESULT;
|
||||
typedef struct{
|
||||
tBTA_GATTS_IF server_if;
|
||||
UINT16 service_id;
|
||||
@ -614,7 +593,6 @@ 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;
|
||||
@ -648,6 +626,41 @@ typedef void (tBTA_GATTS_ENB_CBACK)(tBTA_GATT_STATUS status);
|
||||
|
||||
/* Server callback function */
|
||||
typedef void (tBTA_GATTS_CBACK)(tBTA_GATTS_EVT event, tBTA_GATTS *p_data);
|
||||
typedef struct
|
||||
{
|
||||
tBT_UUID uuid;
|
||||
BOOLEAN is_primary;
|
||||
UINT16 handle;
|
||||
UINT16 s_handle;
|
||||
UINT16 e_handle;
|
||||
list_t *characteristics; /* list of tBTA_GATTC_CHARACTERISTIC */
|
||||
list_t *included_svc; /* list of tBTA_GATTC_INCLUDED_SVC */
|
||||
} __attribute__((packed)) tBTA_GATTC_SERVICE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
tBT_UUID uuid;
|
||||
UINT16 handle;
|
||||
tBTA_GATT_CHAR_PROP properties;
|
||||
tBTA_GATTC_SERVICE *service; /* owning service*/
|
||||
list_t *descriptors; /* list of tBTA_GATTC_DESCRIPTOR */
|
||||
} __attribute__((packed)) tBTA_GATTC_CHARACTERISTIC;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
tBT_UUID uuid;
|
||||
UINT16 handle;
|
||||
tBTA_GATTC_CHARACTERISTIC *characteristic; /* owning characteristic */
|
||||
} __attribute__((packed)) tBTA_GATTC_DESCRIPTOR;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
tBT_UUID uuid;
|
||||
UINT16 handle;
|
||||
UINT16 incl_srvc_s_handle;
|
||||
tBTA_GATTC_SERVICE *owning_service; /* owning service*/
|
||||
tBTA_GATTC_SERVICE *included_service;
|
||||
} __attribute__((packed)) tBTA_GATTC_INCLUDED_SVC;
|
||||
|
||||
/*****************************************************************************
|
||||
** External Function Declarations
|
||||
@ -770,175 +783,114 @@ extern void BTA_GATTC_ServiceSearchRequest(UINT16 conn_id, tBT_UUID *p_srvc_uuid
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_GATTC_GetFirstChar
|
||||
** Function BTA_GATTC_GetServices
|
||||
**
|
||||
** Description This function is called to find the first charatceristic of the
|
||||
** service on the given server.
|
||||
** Description This function is called to find the services on the given server.
|
||||
**
|
||||
** Parameters conn_id: connection ID which identify the server.
|
||||
** p_srvc_id: the service ID of which the characteristic is belonged to.
|
||||
** p_char_uuid_cond: Characteristic UUID, if NULL find the first available
|
||||
** characteristic.
|
||||
** p_char_result: output parameter which will store the GATT
|
||||
** characteristic ID.
|
||||
** p_property: output parameter to carry the characteristic property.
|
||||
**
|
||||
** Returns returns status.
|
||||
** Returns returns list_t of tBTA_GATTC_SERVICE or NULL.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_GATT_STATUS BTA_GATTC_GetFirstChar (UINT16 conn_id,
|
||||
tBTA_GATT_SRVC_ID *p_srvc_id,
|
||||
tBT_UUID *p_char_uuid_cond,
|
||||
tBTA_GATTC_CHAR_ID *p_char_result,
|
||||
tBTA_GATT_CHAR_PROP *p_property);
|
||||
extern const list_t* BTA_GATTC_GetServices(UINT16 conn_id);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_GATTC_GetNextChar
|
||||
** Function BTA_GATTC_GetCharacteristic
|
||||
**
|
||||
** Description This function is called to find the next charatceristic of the
|
||||
** service on the given server.
|
||||
** Description This function is called to find the characteristic on the given server.
|
||||
**
|
||||
** Parameters conn_id: connection ID which identify the server.
|
||||
** p_start_char_id: start the characteristic search from the next record
|
||||
** after the one identified by char_id.
|
||||
** p_char_uuid_cond: Characteristic UUID, if NULL find the first available
|
||||
** characteristic.
|
||||
** p_char_result: output parameter which will store the GATT
|
||||
** characteristic ID.
|
||||
** p_property: output parameter, characteristic property.
|
||||
** handle: characteristic handle
|
||||
**
|
||||
** Returns returns status.
|
||||
** Returns returns pointer to tBTA_GATTC_CHARACTERISTIC or NULL.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_GATT_STATUS BTA_GATTC_GetNextChar (UINT16 conn_id,
|
||||
tBTA_GATTC_CHAR_ID *p_start_char_id,
|
||||
tBT_UUID *p_char_uuid_cond,
|
||||
tBTA_GATTC_CHAR_ID *p_char_result,
|
||||
tBTA_GATT_CHAR_PROP *p_property);
|
||||
extern const tBTA_GATTC_CHARACTERISTIC* BTA_GATTC_GetCharacteristic(UINT16 conn_id, UINT16 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_GATTC_GetFirstCharDescr
|
||||
** Function BTA_GATTC_GetDescriptor
|
||||
**
|
||||
** Description This function is called to find the first charatceristic descriptor of the
|
||||
** charatceristic on the given server.
|
||||
** Description This function is called to find the characteristic on the given server.
|
||||
**
|
||||
** Parameters conn_id: connection ID which identify the server.
|
||||
** p_char_id: the characteristic ID of which the descriptor is belonged to.
|
||||
** p_descr_uuid_cond: Characteristic Descr UUID, if NULL find the first available
|
||||
** characteristic.
|
||||
** p_descr_result: output parameter which will store the GATT
|
||||
** characteristic descriptor ID.
|
||||
** handle: descriptor handle
|
||||
**
|
||||
** Returns returns status.
|
||||
** Returns returns pointer to tBTA_GATTC_DESCRIPTOR or NULL.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_GATT_STATUS BTA_GATTC_GetFirstCharDescr (UINT16 conn_id, tBTA_GATTC_CHAR_ID *p_char_id,
|
||||
tBT_UUID *p_descr_uuid_cond,
|
||||
tBTA_GATTC_CHAR_DESCR_ID *p_descr_result);
|
||||
extern const tBTA_GATTC_DESCRIPTOR* BTA_GATTC_GetDescriptor(UINT16 conn_id, UINT16 handle);
|
||||
|
||||
extern void BTA_GATTC_GetServiceWithUUID(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
|
||||
extern void BTA_GATTC_GetAllChar(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
|
||||
extern void BTA_GATTC_GetAllDescriptor(UINT16 conn_id, UINT16 char_handle,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
|
||||
extern void BTA_GATTC_GetCharByUUID(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, tBT_UUID char_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
|
||||
extern void BTA_GATTC_GetDescrByUUID(UINT16 conn_id, uint16_t start_handle, uint16_t end_handle,
|
||||
tBT_UUID char_uuid, tBT_UUID descr_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
|
||||
extern void BTA_GATTC_GetDescrByCharHandle(UINT16 conn_id, UINT16 char_handle, tBT_UUID descr_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
|
||||
extern void BTA_GATTC_GetIncludeService(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
tBT_UUID *incl_uuid, btgatt_db_element_t **db, int *count);
|
||||
|
||||
extern void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count);
|
||||
|
||||
extern void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_GATTC_GetNextCharDescr
|
||||
** Function BTA_GATTC_GetGattDb
|
||||
**
|
||||
** Description This function is called to find the next charatceristic of the
|
||||
** service on the given server.
|
||||
** Description This function is called to get gatt db.
|
||||
**
|
||||
** Parameters conn_id: connection ID which identify the server.
|
||||
** p_start_descr_id: start the characteristic search from the next record
|
||||
** after the one identified by p_start_descr_id.
|
||||
** p_descr_uuid_cond: Characteristic descriptor UUID, if NULL find
|
||||
** the first available characteristic descriptor.
|
||||
** p_descr_result: output parameter which will store the GATT
|
||||
** characteristic descriptor ID.
|
||||
**
|
||||
** Returns returns status.
|
||||
** db: output parameter which will contain gatt db copy.
|
||||
** Caller is responsible for freeing it.
|
||||
** count: number of elements in db.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_GATT_STATUS BTA_GATTC_GetNextCharDescr (UINT16 conn_id,
|
||||
tBTA_GATTC_CHAR_DESCR_ID *p_start_descr_id,
|
||||
tBT_UUID *p_descr_uuid_cond,
|
||||
tBTA_GATTC_CHAR_DESCR_ID *p_descr_result);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_GATTC_GetFirstIncludedService
|
||||
**
|
||||
** Description This function is called to find the first included service of the
|
||||
** service on the given server.
|
||||
**
|
||||
** Parameters conn_id: connection ID which identify the server.
|
||||
** p_srvc_id: the service ID of which the included service is belonged to.
|
||||
** p_uuid_cond: include service UUID, if NULL find the first available
|
||||
** included service.
|
||||
** p_result: output parameter which will store the GATT ID
|
||||
** of the included service found.
|
||||
**
|
||||
** Returns returns status.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_GATT_STATUS BTA_GATTC_GetFirstIncludedService(UINT16 conn_id,
|
||||
tBTA_GATT_SRVC_ID *p_srvc_id,
|
||||
tBT_UUID *p_uuid_cond,
|
||||
tBTA_GATTC_INCL_SVC_ID *p_result);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_GATTC_GetNextIncludedService
|
||||
**
|
||||
** Description This function is called to find the next included service of the
|
||||
** service on the given server.
|
||||
**
|
||||
** Parameters conn_id: connection ID which identify the server.
|
||||
** p_start_id: start the search from the next record
|
||||
** after the one identified by p_start_id.
|
||||
** p_uuid_cond: Included service UUID, if NULL find the first available
|
||||
** included service.
|
||||
** p_result: output parameter which will store the GATT ID
|
||||
** of the included service found.
|
||||
**
|
||||
** Returns returns status.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_GATT_STATUS BTA_GATTC_GetNextIncludedService(UINT16 conn_id,
|
||||
tBTA_GATTC_INCL_SVC_ID *p_start_id,
|
||||
tBT_UUID *p_uuid_cond,
|
||||
tBTA_GATTC_INCL_SVC_ID *p_result);
|
||||
extern void BTA_GATTC_GetGattDb(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_GATTC_ReadCharacteristic
|
||||
**
|
||||
** Description This function is called to read a service's characteristics of
|
||||
** the given characteritisc ID.
|
||||
** Description This function is called to read a characteristics value
|
||||
**
|
||||
** Parameters conn_id - connection ID.
|
||||
** p_char_id - characteritic ID to read.
|
||||
** Parameters conn_id - connectino ID.
|
||||
** handle - characteritic handle to read.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_GATTC_ReadCharacteristic (UINT16 conn_id,
|
||||
tBTA_GATTC_CHAR_ID *p_char_id,
|
||||
tBTA_GATT_AUTH_REQ auth_req);
|
||||
void BTA_GATTC_ReadCharacteristic(UINT16 conn_id, UINT16 handle, tBTA_GATT_AUTH_REQ auth_req);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_GATTC_ReadCharDescr
|
||||
**
|
||||
** Description This function is called to read a characteristics descriptor.
|
||||
** Description This function is called to read a descriptor value.
|
||||
**
|
||||
** Parameters conn_id - connection ID.
|
||||
** p_char_descr_id - characteritic descriptor ID to read.
|
||||
** handle - descriptor handle to read.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_GATTC_ReadCharDescr (UINT16 conn_id,
|
||||
tBTA_GATTC_CHAR_DESCR_ID *p_char_descr_id,
|
||||
tBTA_GATT_AUTH_REQ auth_req);
|
||||
void BTA_GATTC_ReadCharDescr (UINT16 conn_id, UINT16 handle, tBTA_GATT_AUTH_REQ auth_req);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -947,40 +899,40 @@ extern void BTA_GATTC_ReadCharDescr (UINT16 conn_id,
|
||||
** Description This function is called to write characteristic value.
|
||||
**
|
||||
** Parameters conn_id - connection ID.
|
||||
** p_char_id - characteristic ID to write.
|
||||
** write_type - type of write.
|
||||
** handle - characteristic handle to write.
|
||||
** write_type - type of write.
|
||||
** len: length of the data to be written.
|
||||
** p_value - the value to be written.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_GATTC_WriteCharValue (UINT16 conn_id,
|
||||
tBTA_GATTC_CHAR_ID *p_char_id,
|
||||
tBTA_GATTC_WRITE_TYPE write_type,
|
||||
UINT16 len,
|
||||
UINT8 *p_value,
|
||||
tBTA_GATT_AUTH_REQ auth_req);
|
||||
void BTA_GATTC_WriteCharValue ( UINT16 conn_id,
|
||||
UINT16 handle,
|
||||
tBTA_GATTC_WRITE_TYPE write_type,
|
||||
UINT16 len,
|
||||
UINT8 *p_value,
|
||||
tBTA_GATT_AUTH_REQ auth_req);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_GATTC_WriteCharDescr
|
||||
**
|
||||
** Description This function is called to write characteristic descriptor value.
|
||||
** Description This function is called to write descriptor value.
|
||||
**
|
||||
** Parameters conn_id - connection ID
|
||||
** p_char_descr_id - characteristic descriptor ID to write.
|
||||
** write_type - type of write.
|
||||
** handle - descriptor handle to write.
|
||||
** write_type - type of write.
|
||||
** p_value - the value to be written.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_GATTC_WriteCharDescr (UINT16 conn_id,
|
||||
tBTA_GATTC_CHAR_DESCR_ID *p_char_descr_id,
|
||||
tBTA_GATTC_WRITE_TYPE write_type,
|
||||
tBTA_GATT_UNFMT *p_data,
|
||||
tBTA_GATT_AUTH_REQ auth_req);
|
||||
void BTA_GATTC_WriteCharDescr (UINT16 conn_id,
|
||||
UINT16 handle,
|
||||
tBTA_GATTC_WRITE_TYPE write_type,
|
||||
tBTA_GATT_UNFMT *p_data,
|
||||
tBTA_GATT_AUTH_REQ auth_req);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -989,12 +941,12 @@ extern void BTA_GATTC_WriteCharDescr (UINT16 conn_id,
|
||||
** Description This function is called to send handle value confirmation.
|
||||
**
|
||||
** Parameters conn_id - connection ID.
|
||||
** p_char_id - characteristic ID to confrim.
|
||||
** handle - characteristic handle to confirm.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_GATTC_SendIndConfirm (UINT16 conn_id, tBTA_GATTC_CHAR_ID *p_char_id);
|
||||
extern void BTA_GATTC_SendIndConfirm (UINT16 conn_id, UINT16 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -1002,17 +954,16 @@ extern void BTA_GATTC_SendIndConfirm (UINT16 conn_id, tBTA_GATTC_CHAR_ID *p_char
|
||||
**
|
||||
** Description This function is called to register for notification of a service.
|
||||
**
|
||||
** Parameters client_if - client interface.
|
||||
** remote_bda - target GATT server.
|
||||
** p_char_id - pointer to GATT characteristic ID.
|
||||
** Parameters client_if - client interface.
|
||||
** remote_bda - target GATT server.
|
||||
** handle - GATT characteristic handle.
|
||||
**
|
||||
** Returns OK if registration succeed, otherwise failed.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_GATT_STATUS BTA_GATTC_RegisterForNotifications (tBTA_GATTC_IF client_if,
|
||||
BD_ADDR remote_bda,
|
||||
tBTA_GATTC_CHAR_ID *p_char_id);
|
||||
|
||||
BD_ADDR remote_bda,
|
||||
UINT16 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -1022,14 +973,14 @@ extern tBTA_GATT_STATUS BTA_GATTC_RegisterForNotifications (tBTA_GATTC_IF c
|
||||
**
|
||||
** Parameters client_if - client interface.
|
||||
** remote_bda - target GATT server.
|
||||
** p_char_id - pointer to a GATT characteristic ID.
|
||||
** handle - GATT characteristic handle.
|
||||
**
|
||||
** Returns OK if deregistration succeed, otherwise failed.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_GATT_STATUS BTA_GATTC_DeregisterForNotifications (tBTA_GATTC_IF client_if,
|
||||
BD_ADDR remote_bda,
|
||||
tBTA_GATTC_CHAR_ID *p_char_id);
|
||||
BD_ADDR remote_bda,
|
||||
UINT16 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -1038,16 +989,16 @@ extern tBTA_GATT_STATUS BTA_GATTC_DeregisterForNotifications (tBTA_GATTC_IF
|
||||
** Description This function is called to prepare write a characteristic value.
|
||||
**
|
||||
** Parameters conn_id - connection ID.
|
||||
** p_char_id - GATT characteritic ID of the service.
|
||||
** handle - GATT characteritic handle.
|
||||
** offset - offset of the write value.
|
||||
** len: length of the data to be written.
|
||||
** len - length of the data to be written.
|
||||
** p_value - the value to be written.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_GATTC_PrepareWrite (UINT16 conn_id,
|
||||
tBTA_GATTC_CHAR_ID *p_char_id,
|
||||
UINT16 handle,
|
||||
UINT16 offset,
|
||||
UINT16 len,
|
||||
UINT8 *p_value,
|
||||
@ -1069,7 +1020,7 @@ extern void BTA_GATTC_PrepareWrite (UINT16 conn_id,
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_GATTC_PrepareWriteCharDescr (UINT16 conn_id,
|
||||
tBTA_GATTC_CHAR_DESCR_ID *p_char_descr_id,
|
||||
UINT16 handle,
|
||||
UINT16 offset,
|
||||
tBTA_GATT_UNFMT *p_data,
|
||||
tBTA_GATT_AUTH_REQ auth_req);
|
||||
@ -1360,9 +1311,9 @@ extern void BTA_GATTS_StopService(UINT16 service_id);
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_GATTS_HandleValueIndication (UINT16 conn_id, UINT16 attr_id,
|
||||
UINT16 data_len,
|
||||
UINT8 *p_data,
|
||||
BOOLEAN need_confirm);
|
||||
UINT16 data_len,
|
||||
UINT8 *p_data,
|
||||
BOOLEAN need_confirm);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -58,12 +58,6 @@ enum {
|
||||
BTA_GATTC_OP_CMPL_EVT,
|
||||
BTA_GATTC_INT_DISCONN_EVT,
|
||||
|
||||
/* for cache loading/saving */
|
||||
BTA_GATTC_START_CACHE_EVT,
|
||||
BTA_GATTC_CI_CACHE_OPEN_EVT,
|
||||
BTA_GATTC_CI_CACHE_LOAD_EVT,
|
||||
BTA_GATTC_CI_CACHE_SAVE_EVT,
|
||||
|
||||
BTA_GATTC_INT_START_IF_EVT,
|
||||
BTA_GATTC_API_REG_EVT,
|
||||
BTA_GATTC_API_DEREG_EVT,
|
||||
@ -74,6 +68,8 @@ enum {
|
||||
};
|
||||
typedef UINT16 tBTA_GATTC_INT_EVT;
|
||||
|
||||
#define BTA_GATTC_SERVICE_CHANGED_LEN 4
|
||||
|
||||
/* max client application GATTC can support */
|
||||
#ifndef BTA_GATTC_CL_MAX
|
||||
#define BTA_GATTC_CL_MAX 3 // 32
|
||||
@ -95,7 +91,7 @@ typedef UINT16 tBTA_GATTC_INT_EVT;
|
||||
#endif
|
||||
|
||||
#define BTA_GATTC_WRITE_PREPARE GATT_WRITE_PREPARE
|
||||
|
||||
#define BTA_GATTC_INVALID_HANDLE 0
|
||||
|
||||
/* internal strucutre for GATTC register API */
|
||||
typedef struct {
|
||||
@ -125,17 +121,15 @@ typedef tBTA_GATTC_API_OPEN tBTA_GATTC_API_CANCEL_OPEN;
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_GATT_AUTH_REQ auth_req;
|
||||
tBTA_GATT_SRVC_ID srvc_id;
|
||||
tBTA_GATT_ID char_id;
|
||||
tBTA_GATT_ID *p_descr_type;
|
||||
UINT16 handle;
|
||||
tBTA_GATTC_EVT cmpl_evt;
|
||||
} tBTA_GATTC_API_READ;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_GATT_AUTH_REQ auth_req;
|
||||
tBTA_GATT_SRVC_ID srvc_id;
|
||||
tBTA_GATT_ID char_id;
|
||||
tBTA_GATT_ID *p_descr_type;
|
||||
UINT16 handle;
|
||||
tBTA_GATTC_EVT cmpl_evt;
|
||||
tBTA_GATTC_WRITE_TYPE write_type;
|
||||
UINT16 offset;
|
||||
UINT16 len;
|
||||
@ -149,8 +143,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_GATT_SRVC_ID srvc_id;
|
||||
tBTA_GATT_ID char_id;
|
||||
UINT16 handle;
|
||||
} tBTA_GATTC_API_CONFIRM;
|
||||
|
||||
typedef tGATT_CL_COMPLETE tBTA_GATTC_CMPL;
|
||||
@ -171,8 +164,8 @@ typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_GATT_AUTH_REQ auth_req;
|
||||
UINT8 num_attr;
|
||||
tBTA_GATTC_ATTR_ID *p_id_list;
|
||||
} tBTA_GATTC_API_READ_MULTI;
|
||||
UINT16 handles[GATT_MAX_READ_MULTI_HANDLES];
|
||||
}tBTA_GATTC_API_READ_MULTI;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
@ -215,9 +208,6 @@ typedef union {
|
||||
tBTA_GATTC_API_READ_MULTI api_read_multi;
|
||||
tBTA_GATTC_API_CFG_MTU api_mtu;
|
||||
tBTA_GATTC_OP_CMPL op_cmpl;
|
||||
tBTA_GATTC_CI_EVT ci_open;
|
||||
tBTA_GATTC_CI_EVT ci_save;
|
||||
tBTA_GATTC_CI_LOAD ci_load;
|
||||
tBTA_GATTC_INT_CONN int_conn;
|
||||
tBTA_GATTC_ENC_CMPL enc_cmpl;
|
||||
|
||||
@ -230,43 +220,13 @@ typedef union {
|
||||
|
||||
|
||||
/* GATT server cache on the client */
|
||||
typedef union {
|
||||
UINT8 uuid128[LEN_UUID_128];
|
||||
UINT16 uuid16;
|
||||
} tBTA_GATTC_UUID;
|
||||
|
||||
typedef struct gattc_attr_cache {
|
||||
tBTA_GATTC_UUID *p_uuid;
|
||||
struct gattc_attr_cache *p_next;
|
||||
UINT16 uuid_len;
|
||||
UINT16 attr_handle;
|
||||
UINT8 inst_id;
|
||||
tBTA_GATT_CHAR_PROP property; /* if characteristic, it is char property;
|
||||
if included service, flag primary,
|
||||
if descriptor, not used */
|
||||
tBTA_GATTC_ATTR_TYPE attr_type;
|
||||
// btla-specific ++
|
||||
} __attribute__((packed)) tBTA_GATTC_CACHE_ATTR;
|
||||
// btla-specific --
|
||||
|
||||
typedef struct gattc_svc_cache {
|
||||
tBTA_GATT_SRVC_ID service_uuid;
|
||||
tBTA_GATTC_CACHE_ATTR *p_attr;
|
||||
tBTA_GATTC_CACHE_ATTR *p_last_attr;
|
||||
UINT16 s_handle;
|
||||
UINT16 e_handle;
|
||||
struct gattc_svc_cache *p_next;
|
||||
tBTA_GATTC_CACHE_ATTR *p_cur_char;
|
||||
// btla-specific ++
|
||||
} __attribute__((packed)) tBTA_GATTC_CACHE;
|
||||
// btla-specific --
|
||||
|
||||
typedef struct {
|
||||
tBT_UUID uuid;
|
||||
UINT16 s_handle;
|
||||
UINT16 e_handle;
|
||||
// this field is set only for characteristic
|
||||
UINT16 char_decl_handle;
|
||||
BOOLEAN is_primary;
|
||||
UINT8 srvc_inst_id;
|
||||
tBTA_GATT_CHAR_PROP property;
|
||||
} tBTA_GATTC_ATTR_REC;
|
||||
|
||||
@ -299,11 +259,7 @@ typedef struct {
|
||||
|
||||
UINT8 state;
|
||||
|
||||
tBTA_GATTC_CACHE *p_srvc_cache;
|
||||
tBTA_GATTC_CACHE *p_cur_srvc;
|
||||
fixed_queue_t *cache_buffer; /* buffer queue used for storing the cache data */
|
||||
UINT8 *p_free; /* starting point to next available byte */
|
||||
UINT16 free_byte; /* number of available bytes in server cache buffer */
|
||||
list_t *p_srvc_cache; /* list of tBTA_GATTC_SERVICE */
|
||||
UINT8 update_count; /* indication received */
|
||||
UINT8 num_clcb; /* number of associated CLCB */
|
||||
|
||||
@ -314,7 +270,7 @@ typedef struct {
|
||||
UINT8 next_avail_idx;
|
||||
UINT8 total_srvc;
|
||||
UINT8 total_char;
|
||||
|
||||
UINT16 total_attr;
|
||||
UINT8 srvc_hdl_chg; /* service handle change indication pending */
|
||||
UINT16 attr_index; /* cahce NV saving/loading attribute index */
|
||||
|
||||
@ -328,8 +284,8 @@ typedef struct {
|
||||
typedef struct {
|
||||
BOOLEAN in_use;
|
||||
BD_ADDR remote_bda;
|
||||
tBTA_GATTC_CHAR_ID char_id;
|
||||
} tBTA_GATTC_NOTIF_REG;
|
||||
UINT16 handle;
|
||||
}tBTA_GATTC_NOTIF_REG;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATTC_CBACK *p_cback;
|
||||
@ -403,11 +359,7 @@ typedef struct {
|
||||
|
||||
tBTA_GATTC_CLCB clcb[BTA_GATTC_CLCB_MAX];
|
||||
tBTA_GATTC_SERV known_server[BTA_GATTC_KNOWN_SR_MAX];
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
tSDP_DISCOVERY_DB *p_sdp_db;
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
UINT16 sdp_conn_id;
|
||||
} tBTA_GATTC_CB;
|
||||
}tBTA_GATTC_CB;
|
||||
|
||||
typedef enum {
|
||||
SERVICE_CHANGE_CCC_WRITTEN_SUCCESS = 0,
|
||||
@ -474,10 +426,7 @@ extern void bta_gattc_confirm(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_execute(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_read_multi(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_ci_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_ci_load(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_ci_close(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_ci_save(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_cache_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_ignore_op_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_restart_discover(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_msg);
|
||||
extern void bta_gattc_init_bk_conn(tBTA_GATTC_API_OPEN *p_data, tBTA_GATTC_RCB *p_clreg);
|
||||
@ -509,20 +458,13 @@ extern tBTA_GATTC_CLCB *bta_gattc_find_int_disconn_clcb(tBTA_GATTC_DATA *p_msg);
|
||||
|
||||
extern BOOLEAN bta_gattc_enqueue(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
|
||||
extern UINT16 bta_gattc_id2handle(tBTA_GATTC_SERV *p_srcb, tBTA_GATT_SRVC_ID *p_service_id, tBTA_GATT_ID *p_char_id, tBTA_GATT_ID *p_descr_uuid);
|
||||
extern BOOLEAN bta_gattc_handle2id(tBTA_GATTC_SERV *p_srcb, UINT16 handle, tBTA_GATT_SRVC_ID *service_id, tBTA_GATT_ID *char_id, tBTA_GATT_ID *p_type);
|
||||
extern BOOLEAN bta_gattc_uuid_compare (tBT_UUID *p_src, tBT_UUID *p_tar, BOOLEAN is_precise);
|
||||
extern void bta_gattc_pack_attr_uuid(tBTA_GATTC_CACHE_ATTR *p_attr, tBT_UUID *p_uuid);
|
||||
extern BOOLEAN bta_gattc_uuid_compare (const tBT_UUID *p_src, const tBT_UUID *p_tar, BOOLEAN is_precise);
|
||||
extern BOOLEAN bta_gattc_check_notif_registry(tBTA_GATTC_RCB *p_clreg, tBTA_GATTC_SERV *p_srcb, tBTA_GATTC_NOTIFY *p_notify);
|
||||
extern tBTA_GATT_STATUS bta_gattc_pack_read_cb_data(tBTA_GATTC_SERV *p_srcb, tBT_UUID *p_descr_uuid, tGATT_VALUE *p_attr, tBTA_GATT_READ_VAL *p_value);
|
||||
extern BOOLEAN bta_gattc_mark_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR_PTR remote_bda, BOOLEAN add, BOOLEAN is_listen);
|
||||
extern BOOLEAN bta_gattc_check_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR remote_bda, UINT8 role);
|
||||
extern UINT8 bta_gattc_num_reg_app(void);
|
||||
extern void bta_gattc_clear_notif_registration(UINT16 conn_id);
|
||||
extern tBTA_GATTC_SERV *bta_gattc_find_srvr_cache(BD_ADDR bda);
|
||||
extern BOOLEAN bta_gattc_charid_compare(tBTA_GATTC_CHAR_ID *p_src, tBTA_GATTC_CHAR_ID *p_tar);
|
||||
extern BOOLEAN bta_gattc_srvcid_compare(tBTA_GATT_SRVC_ID *p_src, tBTA_GATT_SRVC_ID *p_tar);
|
||||
extern void bta_gattc_cpygattid(tBTA_GATT_ID *p_des, tBTA_GATT_ID *p_src);
|
||||
extern void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV *p_srcb, UINT16 conn_id, UINT16 start_handle, UINT16 end_handle);
|
||||
extern tBTA_GATTC_SERV * bta_gattc_find_srvr_cache(BD_ADDR bda);
|
||||
|
||||
/* discovery functions */
|
||||
extern void bta_gattc_disc_res_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_DISC_RES *p_data);
|
||||
@ -530,17 +472,41 @@ extern void bta_gattc_disc_cmpl_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type
|
||||
extern tBTA_GATT_STATUS bta_gattc_discover_procedure(UINT16 conn_id, tBTA_GATTC_SERV *p_server_cb, UINT8 disc_type);
|
||||
extern tBTA_GATT_STATUS bta_gattc_discover_pri_service(UINT16 conn_id, tBTA_GATTC_SERV *p_server_cb, UINT8 disc_type);
|
||||
extern void bta_gattc_search_service(tBTA_GATTC_CLCB *p_clcb, tBT_UUID *p_uuid);
|
||||
extern tBTA_GATT_STATUS bta_gattc_query_cache(UINT16 conn_id, UINT8 query_type, tBTA_GATT_SRVC_ID *p_srvc_id,
|
||||
tBTA_GATT_ID *p_start_rec, tBT_UUID *p_uuid_cond,
|
||||
tBTA_GATT_ID *p_output, void *p_param);
|
||||
extern tBTA_GATT_STATUS bta_gattc_init_cache(tBTA_GATTC_SERV *p_srvc_cb);
|
||||
extern void bta_gattc_rebuild_cache(tBTA_GATTC_SERV *p_srcv, UINT16 num_attr, tBTA_GATTC_NV_ATTR *p_attr, UINT16 attr_index);
|
||||
extern BOOLEAN bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id);
|
||||
extern const list_t* bta_gattc_get_services(UINT16 conn_id);
|
||||
extern const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle(UINT16 conn_id, UINT16 handle);
|
||||
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle);
|
||||
extern tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic(UINT16 conn_id, UINT16 handle);
|
||||
extern tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle);
|
||||
extern void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count);
|
||||
extern void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count);
|
||||
extern void bta_gattc_get_service_with_uuid(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **svc_db,
|
||||
int *count);
|
||||
|
||||
extern void bta_gattc_get_db_with_opration(UINT16 conn_id,
|
||||
bt_gatt_get_db_op_t op,
|
||||
UINT16 char_handle,
|
||||
tBT_UUID *incl_uuid,
|
||||
tBT_UUID *char_uuid,
|
||||
tBT_UUID *descr_uuid,
|
||||
UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **char_db,
|
||||
int *count);
|
||||
|
||||
extern void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, int *count);
|
||||
|
||||
extern tBTA_GATT_STATUS bta_gattc_init_cache(tBTA_GATTC_SERV *p_srvc_cb);
|
||||
extern void bta_gattc_rebuild_cache(tBTA_GATTC_SERV *p_srcv, UINT16 num_attr, tBTA_GATTC_NV_ATTR *attr);
|
||||
extern void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id);
|
||||
extern void bta_gattc_reset_discover_st(tBTA_GATTC_SERV *p_srcb, tBTA_GATT_STATUS status);
|
||||
|
||||
extern tBTA_GATTC_CONN *bta_gattc_conn_alloc(BD_ADDR remote_bda);
|
||||
extern tBTA_GATTC_CONN *bta_gattc_conn_find(BD_ADDR remote_bda);
|
||||
extern tBTA_GATTC_CONN *bta_gattc_conn_find_alloc(BD_ADDR remote_bda);
|
||||
extern BOOLEAN bta_gattc_conn_dealloc(BD_ADDR remote_bda);
|
||||
|
||||
extern bool bta_gattc_cache_load(tBTA_GATTC_CLCB *p_clcb);
|
||||
extern void bta_gattc_cache_reset(BD_ADDR server_bda);
|
||||
|
||||
#endif /* BTA_GATTC_INT_H */
|
||||
|
@ -23,52 +23,25 @@
|
||||
#define BTC_LE_LOCAL_KEY_DHK (1<<2)
|
||||
#define BTC_LE_LOCAL_KEY_ER (1<<3)
|
||||
|
||||
#define BTC_BLE_STORAGE_DEV_TYPE_STR "DevType"
|
||||
#define BTC_BLE_STORAGE_ADDR_TYPE_STR "AddrType"
|
||||
#define BTC_BLE_STORAGE_LINK_KEY_STR "LinkKey"
|
||||
#define BTC_BLE_STORAGE_LE_KEY_PENC_STR "LE_KEY_PENC"
|
||||
#define BTC_BLE_STORAGE_LE_KEY_PID_STR "LE_KEY_PID"
|
||||
#define BTC_BLE_STORAGE_LE_KEY_PCSRK_STR "LE_KEY_PCSRK"
|
||||
#define BTC_BLE_STORAGE_LE_KEY_LENC_STR "LE_KEY_LENC"
|
||||
#define BTC_BLE_STORAGE_LE_KEY_LID_STR "LE_KEY_LID"
|
||||
#define BTC_BLE_STORAGE_LE_KEY_LCSRK_STR "LE_KEY_LCSRK"
|
||||
|
||||
#define BTC_BLE_STORAGE_LOCAL_ADAPTER_STR "Adapter"
|
||||
#define BTC_BLE_STORAGE_LE_LOCAL_KEY_IR_STR "LE_LOCAL_KEY_IR"
|
||||
#define BTC_BLE_STORAGE_LE_LOCAL_KEY_IRK_STR "LE_LOCAL_KEY_IRK"
|
||||
#define BTC_BLE_STORAGE_LE_LOCAL_KEY_DHK_STR "LE_LOCAL_KEY_DHK"
|
||||
#define BTC_BLE_STORAGE_LE_LOCAL_KEY_ER_STR "LE_LOCAL_KEY_ER"
|
||||
|
||||
/************************************************************************************
|
||||
** Local type definitions
|
||||
************************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t num_devices;
|
||||
bt_bdaddr_t devices[BTM_SEC_MAX_DEVICE_RECORDS];
|
||||
} btc_bonded_devices_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool is_penc_key_rcvd;
|
||||
tBTM_LE_PENC_KEYS penc_key; /* received peer encryption key */
|
||||
bool is_pcsrk_key_rcvd;
|
||||
tBTM_LE_PCSRK_KEYS pcsrk_key; /* received peer device SRK */
|
||||
bool is_pid_key_rcvd;
|
||||
tBTM_LE_PID_KEYS pid_key; /* peer device ID key */
|
||||
bool is_lenc_key_rcvd;
|
||||
tBTM_LE_LENC_KEYS lenc_key; /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/
|
||||
bool is_lcsrk_key_rcvd;
|
||||
tBTM_LE_LCSRK_KEYS lcsrk_key; /* local device CSRK = d1(ER,DIV,1)*/
|
||||
bool is_lidk_key_rcvd; /* local identity key received */
|
||||
} btc_dm_ble_cb_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bt_bdaddr_t static_bdaddr;
|
||||
BD_ADDR bd_addr;
|
||||
btc_dm_ble_cb_t ble;
|
||||
} btc_dm_pairing_cb_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t ir[BT_OCTET16_LEN];
|
||||
uint8_t irk[BT_OCTET16_LEN];
|
||||
uint8_t dhk[BT_OCTET16_LEN];
|
||||
}btc_dm_local_key_id_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool is_er_rcvd;
|
||||
uint8_t er[BT_OCTET16_LEN];
|
||||
bool is_id_keys_rcvd;
|
||||
btc_dm_local_key_id_t id_keys; /* ID kyes */
|
||||
}btc_dm_local_key_cb_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BT_OCTET16 sp_c;
|
||||
@ -77,63 +50,37 @@ typedef struct
|
||||
} btc_dm_oob_cb_t;
|
||||
|
||||
|
||||
extern btc_dm_pairing_cb_t pairing_cb;
|
||||
extern btc_dm_local_key_cb_t ble_local_key_cb;
|
||||
extern btc_bonded_devices_t bonded_devices;
|
||||
void btc_storage_save(void);
|
||||
|
||||
bt_status_t btc_storage_load_bonded_ble_devices(void);
|
||||
bt_status_t btc_storage_add_ble_bonding_key( bt_bdaddr_t *remote_bd_addr, char *key, uint8_t key_type, uint8_t key_length);
|
||||
|
||||
bt_status_t btc_get_bonded_ble_devices_list(esp_ble_bond_dev_t *bond_dev);
|
||||
|
||||
bt_status_t btc_in_fetch_bonded_ble_devices(int add);
|
||||
|
||||
void btc_dm_remove_ble_bonding_keys(void);
|
||||
|
||||
bt_status_t btc_storage_add_ble_bonding_key( bt_bdaddr_t *remote_bd_addr,
|
||||
char *key,
|
||||
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,
|
||||
btc_bonded_devices_t *p_bonded_devices);
|
||||
|
||||
bt_status_t btc_storage_get_ble_bonding_key(bt_bdaddr_t *remote_bd_addr,
|
||||
uint8_t key_type,
|
||||
char *key_value,
|
||||
int key_length);
|
||||
|
||||
bool btc_storage_compare_address_key_value(bt_bdaddr_t *remote_bd_addr,
|
||||
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);
|
||||
bt_status_t btc_storage_get_ble_bonding_key(bt_bdaddr_t *remote_bd_addr, uint8_t key_type, char *key_value, int key_length);
|
||||
|
||||
bt_status_t btc_storage_remove_ble_bonding_keys(bt_bdaddr_t *remote_bd_addr);
|
||||
|
||||
bt_status_t btc_storage_clear_bond_devices(void);
|
||||
bool btc_storage_compare_address_key_value(bt_bdaddr_t *remote_bd_addr, 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);
|
||||
|
||||
bt_status_t btc_storage_remove_ble_local_keys(void);
|
||||
|
||||
bt_status_t btc_storage_get_ble_local_key(uint8_t key_type,
|
||||
char *key_value,
|
||||
int key_len);
|
||||
bt_status_t btc_storage_get_ble_local_key(uint8_t key_type, char *key_value, int key_len);
|
||||
|
||||
bt_status_t btc_storage_get_remote_addr_type(bt_bdaddr_t *remote_bd_addr,
|
||||
int *addr_type);
|
||||
bt_status_t btc_storage_get_remote_addr_type(bt_bdaddr_t *remote_bd_addr, int *addr_type);
|
||||
|
||||
bt_status_t btc_storage_set_remote_addr_type(bt_bdaddr_t *remote_bd_addr, uint8_t addr_type, bool flush);
|
||||
|
||||
bt_status_t btc_storage_remove_remote_addr_type(bt_bdaddr_t *remote_bd_addr, bool flush);
|
||||
|
||||
bt_status_t btc_storage_set_ble_dev_type(bt_bdaddr_t *bd_addr, bool flush);
|
||||
|
||||
bt_status_t btc_storage_remove_ble_dev_type(bt_bdaddr_t *remote_bd_addr, bool flush);
|
||||
|
||||
bt_status_t btc_storage_load_bonded_ble_devices(void);
|
||||
|
||||
bt_status_t btc_storage_get_bonded_ble_devices_list(esp_ble_bond_dev_t *bond_dev, int dev_num);
|
||||
|
||||
int btc_storage_get_num_ble_bond_devices(void);
|
||||
|
||||
bt_status_t btc_storage_set_remote_addr_type(bt_bdaddr_t *remote_bd_addr,
|
||||
uint8_t addr_type);
|
||||
|
||||
void btc_dm_load_ble_local_keys(void);
|
||||
|
||||
void btc_dm_get_ble_local_keys(tBTA_DM_BLE_LOCAL_KEY_MASK *p_key_mask, BT_OCTET16 er,
|
||||
tBTA_BLE_LOCAL_ID_KEYS *p_id_keys);
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#endif ///__BTC_BLE_STORAGE_H__
|
||||
#endif ///__BTC_BLE_STORAGE_H__
|
||||
|
@ -20,8 +20,6 @@
|
||||
|
||||
#include "bt_types.h"
|
||||
|
||||
#define BTC_LE_DEV_TYPE "DevType"
|
||||
|
||||
typedef struct btc_config_section_iter_t btc_config_section_iter_t;
|
||||
|
||||
bool btc_config_init(void);
|
||||
@ -46,7 +44,6 @@ const btc_config_section_iter_t *btc_config_section_end(void);
|
||||
const btc_config_section_iter_t *btc_config_section_next(const btc_config_section_iter_t *section);
|
||||
const char *btc_config_section_name(const btc_config_section_iter_t *section);
|
||||
|
||||
void btc_config_save(void);
|
||||
void btc_config_flush(void);
|
||||
int btc_config_clear(void);
|
||||
|
||||
@ -55,4 +52,7 @@ bool btc_get_address_type(const BD_ADDR bd_addr, int *p_addr_type);
|
||||
bool btc_compare_address_key_value(const char *section, char *key_type, void *key_value, int key_length);
|
||||
bool btc_get_device_type(const BD_ADDR bd_addr, int *p_device_type);
|
||||
|
||||
void btc_config_lock(void);
|
||||
void btc_config_unlock(void);
|
||||
|
||||
#endif
|
||||
|
@ -29,6 +29,45 @@ typedef union {
|
||||
tBTA_DM_SEC sec;
|
||||
} btc_dm_sec_args_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool is_penc_key_rcvd;
|
||||
tBTM_LE_PENC_KEYS penc_key; /* received peer encryption key */
|
||||
bool is_pcsrk_key_rcvd;
|
||||
tBTM_LE_PCSRK_KEYS pcsrk_key; /* received peer device SRK */
|
||||
bool is_pid_key_rcvd;
|
||||
tBTM_LE_PID_KEYS pid_key; /* peer device ID key */
|
||||
bool is_lenc_key_rcvd;
|
||||
tBTM_LE_LENC_KEYS lenc_key; /* local encryption reproduction keys LTK = = d1(ER,DIV,0)*/
|
||||
bool is_lcsrk_key_rcvd;
|
||||
tBTM_LE_LCSRK_KEYS lcsrk_key; /* local device CSRK = d1(ER,DIV,1)*/
|
||||
bool is_lidk_key_rcvd; /* local identity key received */
|
||||
} btc_dm_ble_cb_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bt_bdaddr_t static_bdaddr;
|
||||
BD_ADDR bd_addr;
|
||||
btc_dm_ble_cb_t ble;
|
||||
} btc_dm_pairing_cb_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t ir[BT_OCTET16_LEN];
|
||||
uint8_t irk[BT_OCTET16_LEN];
|
||||
uint8_t dhk[BT_OCTET16_LEN];
|
||||
} btc_dm_local_key_id_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool is_er_rcvd;
|
||||
uint8_t er[BT_OCTET16_LEN];
|
||||
bool is_id_keys_rcvd;
|
||||
btc_dm_local_key_id_t id_keys; /* ID kyes */
|
||||
} btc_dm_local_key_cb_t;
|
||||
|
||||
|
||||
|
||||
// void btc_dm_call_handler(btc_msg_t *msg);
|
||||
void btc_dm_sec_evt(tBTA_DM_SEC_EVT event, tBTA_DM_SEC *data);
|
||||
void btc_dm_sec_cb_handler(btc_msg_t *msg);
|
||||
@ -37,4 +76,11 @@ void btc_dm_sec_arg_deep_copy(btc_msg_t *msg, void *dst, void *src);
|
||||
bt_status_t btc_dm_enable_service(tBTA_SERVICE_ID service_id);
|
||||
bt_status_t btc_dm_disable_service(tBTA_SERVICE_ID service_id);
|
||||
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
void btc_dm_load_ble_local_keys(void);
|
||||
|
||||
void btc_dm_get_ble_local_keys(tBTA_DM_BLE_LOCAL_KEY_MASK *p_key_mask, BT_OCTET16 er,
|
||||
tBTA_BLE_LOCAL_ID_KEYS *p_id_keys);
|
||||
#endif
|
||||
|
||||
#endif /* __BTC_DM_H__ */
|
||||
|
@ -31,9 +31,12 @@ typedef enum {
|
||||
BTC_GAP_BLE_ACT_SET_PKT_DATA_LEN,
|
||||
BTC_GAP_BLE_ACT_SET_RAND_ADDRESS,
|
||||
BTC_GAP_BLE_ACT_CONFIG_LOCAL_PRIVACY,
|
||||
BTC_GAP_BLE_ACT_UPDATE_WHITE_LIST,
|
||||
BTC_GAP_BLE_ACT_SET_CONN_PARAMS,
|
||||
BTC_GAP_BLE_ACT_SET_DEV_NAME,
|
||||
BTC_GAP_BLE_ACT_CFG_ADV_DATA_RAW,
|
||||
BTC_GAP_BLE_ACT_CFG_SCAN_RSP_DATA_RAW,
|
||||
BTC_GAP_BLE_ACT_READ_RSSI,
|
||||
BTC_GAP_BLE_SET_ENCRYPTION_EVT,
|
||||
BTC_GAP_BLE_SET_SECURITY_PARAM_EVT,
|
||||
BTC_GAP_BLE_SECURITY_RSP_EVT,
|
||||
@ -41,8 +44,6 @@ typedef enum {
|
||||
BTC_GAP_BLE_CONFIRM_REPLY_EVT,
|
||||
BTC_GAP_BLE_DISCONNECT_EVT,
|
||||
BTC_GAP_BLE_REMOVE_BOND_DEV_EVT,
|
||||
BTC_GAP_BLE_CLEAR_BOND_DEV_EVT,
|
||||
BTC_GAP_BLE_GET_BOND_DEV_EVT,
|
||||
} btc_gap_ble_act_t;
|
||||
|
||||
/* btc_ble_gap_args_t */
|
||||
@ -81,7 +82,25 @@ typedef union {
|
||||
//BTC_GAP_BLE_ACT_CONFIG_LOCAL_PRIVACY,
|
||||
struct cfg_local_privacy_args {
|
||||
bool privacy_enable;
|
||||
} cfg_local_privacy;
|
||||
} cfg_local_privacy;
|
||||
//BTC_GAP_BLE_ACT_UPDATE_WHITE_LIST
|
||||
struct update_white_list_args {
|
||||
bool add_remove;
|
||||
esp_bd_addr_t remote_bda;
|
||||
}update_white_list;
|
||||
//BTC_GAP_BLE_ACT_SET_CONN_PARAMS
|
||||
struct set_conn_params_args {
|
||||
esp_bd_addr_t bd_addr;
|
||||
uint16_t min_conn_int;
|
||||
uint16_t max_conn_int;
|
||||
uint16_t slave_latency;
|
||||
uint16_t supervision_tout;
|
||||
}set_conn_params;
|
||||
//BTC_GAP_BLE_ACT_SET_DEV_NAME,
|
||||
struct set_dev_name_args {
|
||||
#define ESP_GAP_DEVICE_NAME_MAX (32)
|
||||
char device_name[ESP_GAP_DEVICE_NAME_MAX + 1];
|
||||
} set_dev_name;
|
||||
//BTC_GAP_BLE_ACT_CFG_ADV_DATA_RAW,
|
||||
struct config_adv_data_raw_args {
|
||||
uint8_t *raw_adv;
|
||||
@ -127,11 +146,15 @@ typedef union {
|
||||
struct remove_bond_device_args {
|
||||
esp_bd_addr_t bd_addr;
|
||||
} remove_bond_device;
|
||||
//BTC_GAP_BLE_ACT_READ_RSSI
|
||||
struct read_rssi_args {
|
||||
esp_bd_addr_t remote_addr;
|
||||
} read_rssi;
|
||||
} btc_ble_gap_args_t;
|
||||
|
||||
void btc_gap_ble_call_handler(btc_msg_t *msg);
|
||||
void btc_gap_ble_cb_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_get_whitelist_size(uint16_t *length);
|
||||
void btc_gap_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
void btc_gap_ble_arg_deep_free(btc_msg_t *msg);
|
||||
void btc_gap_ble_cb_deep_free(btc_msg_t *msg);
|
||||
|
@ -27,13 +27,8 @@ typedef enum {
|
||||
BTC_GATTC_ACT_CLOSE,
|
||||
BTC_GATTC_ACT_CFG_MTU,
|
||||
BTC_GATTC_ACT_SEARCH_SERVICE,
|
||||
BTC_GATTC_ACT_GET_FIRST_CHAR,
|
||||
BTC_GATTC_ACT_GET_NEXT_CHAR,
|
||||
BTC_GATTC_ACT_GET_FIRST_DESCR,
|
||||
BTC_GATTC_ACT_GET_NEXT_DESCR,
|
||||
BTC_GATTC_ACT_GET_FIRST_INCL_SERVICE,
|
||||
BTC_GATTC_ACT_GET_NEXT_INCL_SERVICE,
|
||||
BTC_GATTC_ACT_READ_CHAR,
|
||||
BTC_GATTC_ACT_READ_MULTIPLE_CHAR,
|
||||
BTC_GATTC_ACT_READ_CHAR_DESCR,
|
||||
BTC_GATTC_ACT_WRITE_CHAR,
|
||||
BTC_GATTC_ACT_WRITE_CHAR_DESCR,
|
||||
@ -75,82 +70,67 @@ typedef union {
|
||||
bool filter_uuid_enable;
|
||||
esp_bt_uuid_t filter_uuid;
|
||||
} search_srvc;
|
||||
//BTC_GATTC_ACT_GET_FIRST_CHAR,
|
||||
struct get_first_char_arg {
|
||||
//BTC_GATTC_ACT_GET_CHAR,
|
||||
struct get_char_arg {
|
||||
uint16_t conn_id;
|
||||
esp_gatt_srvc_id_t service_id;
|
||||
} get_first_char;
|
||||
//BTC_GATTC_ACT_GET_NEXT_CHAR,
|
||||
struct get_next_char_arg {
|
||||
uint16_t handle;
|
||||
} get_char;
|
||||
//BTC_GATTC_ACT_GET_DESCR,
|
||||
struct get_descr_arg {
|
||||
uint16_t conn_id;
|
||||
esp_gatt_srvc_id_t service_id;
|
||||
esp_gatt_id_t char_id;
|
||||
} get_next_char;
|
||||
//BTC_GATTC_ACT_GET_FIRST_DESCR,
|
||||
struct get_first_descr_arg {
|
||||
uint16_t conn_id;
|
||||
esp_gatt_srvc_id_t service_id;
|
||||
esp_gatt_id_t char_id;
|
||||
} get_first_descr;
|
||||
//BTC_GATTC_ACT_GET_NEXT_DESCR,
|
||||
struct get_next_descr_arg {
|
||||
uint16_t conn_id;
|
||||
esp_gatt_srvc_id_t service_id;
|
||||
esp_gatt_id_t char_id;
|
||||
esp_gatt_id_t descr_id;
|
||||
} get_next_descr;
|
||||
uint16_t handle;
|
||||
} get_descr;
|
||||
//BTC_GATTC_ACT_GET_FIRST_INCL_SERVICE,
|
||||
struct get_first_incl_srvc_arg {
|
||||
uint16_t conn_id;
|
||||
esp_gatt_srvc_id_t service_id;
|
||||
uint16_t handle;
|
||||
} get_first_incl_srvc;
|
||||
//BTC_GATTC_ACT_GET_NEXT_INCL_SERVICE,
|
||||
struct get_next_incl_srvc_arg {
|
||||
uint16_t conn_id;
|
||||
esp_gatt_srvc_id_t service_id;
|
||||
esp_gatt_srvc_id_t start_service_id;
|
||||
uint16_t handle;
|
||||
} get_next_incl_srvc;
|
||||
//BTC_GATTC_ACT_READ_CHAR,
|
||||
struct read_char_arg {
|
||||
uint16_t conn_id;
|
||||
esp_gatt_srvc_id_t service_id;
|
||||
esp_gatt_id_t char_id;
|
||||
uint16_t handle;
|
||||
esp_gatt_auth_req_t auth_req;
|
||||
} read_char;
|
||||
//BTC_GATTC_ACT_READ_MULTIPLE_CHAR
|
||||
struct read_multiple_arg {
|
||||
uint16_t conn_id;
|
||||
uint8_t num_attr;
|
||||
uint16_t handles[ESP_GATT_MAX_READ_MULTI_HANDLES];
|
||||
esp_gatt_auth_req_t auth_req;
|
||||
} read_multiple;
|
||||
//BTC_GATTC_ACT_READ_CHAR_DESCR,
|
||||
struct read_descr_arg {
|
||||
uint16_t conn_id;
|
||||
esp_gatt_srvc_id_t service_id;
|
||||
esp_gatt_id_t char_id;
|
||||
esp_gatt_id_t descr_id;
|
||||
uint16_t handle;
|
||||
esp_gatt_auth_req_t auth_req;
|
||||
} read_descr;
|
||||
//BTC_GATTC_ACT_WRITE_CHAR,
|
||||
struct write_char_arg {
|
||||
uint16_t conn_id;
|
||||
uint16_t value_len;
|
||||
esp_gatt_srvc_id_t service_id;
|
||||
esp_gatt_id_t char_id;
|
||||
uint16_t handle;
|
||||
uint8_t *value;
|
||||
esp_gatt_write_type_t write_type;
|
||||
esp_gatt_write_type_t write_type;
|
||||
esp_gatt_auth_req_t auth_req;
|
||||
} write_char;
|
||||
//BTC_GATTC_ACT_WRITE_CHAR_DESCR,
|
||||
struct write_descr_arg {
|
||||
uint16_t conn_id;
|
||||
uint16_t value_len;
|
||||
esp_gatt_srvc_id_t service_id;
|
||||
esp_gatt_id_t char_id;
|
||||
esp_gatt_id_t descr_id;
|
||||
uint16_t handle;
|
||||
uint8_t *value;
|
||||
esp_gatt_write_type_t write_type;
|
||||
esp_gatt_write_type_t write_type;
|
||||
esp_gatt_auth_req_t auth_req;
|
||||
} write_descr;
|
||||
//BTC_GATTC_ACT_PREPARE_WRITE,
|
||||
struct prep_write_arg {
|
||||
uint16_t conn_id;
|
||||
esp_gatt_srvc_id_t service_id;
|
||||
esp_gatt_id_t char_id;
|
||||
uint16_t handle;
|
||||
uint16_t offset;
|
||||
uint16_t value_len;
|
||||
uint8_t *value;
|
||||
@ -159,9 +139,7 @@ typedef union {
|
||||
//BTC_GATTC_ACT_PREPARE_WRITE_CHAR_DESCR,
|
||||
struct prep_write_descr_arg {
|
||||
uint16_t conn_id;
|
||||
esp_gatt_srvc_id_t service_id;
|
||||
esp_gatt_id_t char_id;
|
||||
esp_gatt_id_t descr_id;
|
||||
uint16_t handle;
|
||||
uint16_t offset;
|
||||
uint16_t value_len;
|
||||
uint8_t *value;
|
||||
@ -176,15 +154,13 @@ typedef union {
|
||||
struct reg_for_notify_arg {
|
||||
esp_gatt_if_t gattc_if;
|
||||
esp_bd_addr_t remote_bda;
|
||||
esp_gatt_srvc_id_t service_id;
|
||||
esp_gatt_id_t char_id;
|
||||
uint16_t handle;
|
||||
} reg_for_notify;
|
||||
//BTC_GATTC_ACT_UNREG_FOR_NOTIFY
|
||||
struct unreg_for_notify_arg {
|
||||
esp_gatt_if_t gattc_if;
|
||||
esp_bd_addr_t remote_bda;
|
||||
esp_gatt_srvc_id_t service_id;
|
||||
esp_gatt_id_t char_id;
|
||||
uint16_t handle;
|
||||
} unreg_for_notify;
|
||||
//BTC_GATTC_ACT_CACHE_REFRESH,
|
||||
struct cache_refresh_arg {
|
||||
@ -195,5 +171,56 @@ typedef union {
|
||||
void btc_gattc_call_handler(btc_msg_t *msg);
|
||||
void btc_gattc_cb_handler(btc_msg_t *msg);
|
||||
void btc_gattc_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc_uuid,
|
||||
esp_gattc_service_elem_t *result,
|
||||
uint16_t *count, uint16_t offset);
|
||||
esp_gatt_status_t btc_ble_gattc_get_all_char(uint16_t conn_id,
|
||||
uint16_t start_handle,
|
||||
uint16_t end_handle,
|
||||
esp_gattc_char_elem_t *result,
|
||||
uint16_t *count, uint16_t offset);
|
||||
esp_gatt_status_t btc_ble_gattc_get_all_descr(uint16_t conn_id,
|
||||
uint16_t char_handle,
|
||||
esp_gattc_descr_elem_t *result,
|
||||
uint16_t *count, uint16_t offset);
|
||||
esp_gatt_status_t btc_ble_gattc_get_char_by_uuid(uint16_t conn_id,
|
||||
uint16_t start_handle,
|
||||
uint16_t end_handle,
|
||||
esp_bt_uuid_t char_uuid,
|
||||
esp_gattc_char_elem_t *result,
|
||||
uint16_t *count);
|
||||
esp_gatt_status_t btc_ble_gattc_get_descr_by_uuid(uint16_t conn_id,
|
||||
uint16_t start_handle,
|
||||
uint16_t end_handle,
|
||||
esp_bt_uuid_t char_uuid,
|
||||
esp_bt_uuid_t descr_uuid,
|
||||
esp_gattc_descr_elem_t *result,
|
||||
uint16_t *count);
|
||||
|
||||
esp_gatt_status_t btc_ble_gattc_get_descr_by_char_handle(uint16_t conn_id,
|
||||
uint16_t char_handle,
|
||||
esp_bt_uuid_t descr_uuid,
|
||||
esp_gattc_descr_elem_t *result,
|
||||
uint16_t *count);
|
||||
|
||||
esp_gatt_status_t btc_ble_gattc_get_include_service(uint16_t conn_id,
|
||||
uint16_t start_handle,
|
||||
uint16_t end_handle,
|
||||
esp_bt_uuid_t *incl_uuid,
|
||||
esp_gattc_incl_svc_elem_t *result,
|
||||
uint16_t *count);
|
||||
|
||||
esp_gatt_status_t btc_ble_gattc_get_attr_count(uint16_t conn_id,
|
||||
esp_gatt_db_attr_type_t type,
|
||||
uint16_t start_handle,
|
||||
uint16_t end_handle,
|
||||
uint16_t char_handle,
|
||||
uint16_t *count);
|
||||
|
||||
esp_gatt_status_t btc_ble_gattc_get_db(uint16_t conn_id, uint16_t start_handle, uint16_t end_handle,
|
||||
esp_gattc_db_elem_t *db, uint16_t *count);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __BTC_GATTC_H__ */
|
||||
|
@ -19,6 +19,12 @@
|
||||
#include "bt_defs.h"
|
||||
#include "bt_types.h"
|
||||
|
||||
|
||||
#define BTC_STORAGE_DEV_CLASS_STR "DevClass"
|
||||
#define BTC_STORAGE_LINK_KEY_STR "LinkKey" /* same as the ble */
|
||||
#define BTC_STORAGE_LINK_KEY_TYPE_STR "LinkKeyType"
|
||||
#define BTC_STORAGE_PIN_LENGTH_STR "PinLength"
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_storage_add_bonded_device
|
||||
|
@ -2833,6 +2833,11 @@ tBTM_STATUS BTM_ReadRSSI (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb);
|
||||
tBTM_STATUS BTM_ReadTxPower (BD_ADDR remote_bda,
|
||||
tBT_TRANSPORT transport, tBTM_CMPL_CB *p_cb);
|
||||
|
||||
tBTM_STATUS BTM_BleReadAdvTxPower(tBTM_CMPL_CB *p_cb);
|
||||
|
||||
void BTM_BleGetWhiteListSize(uint16_t *length);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_ReadLinkQuality
|
||||
|
@ -416,6 +416,15 @@ void btm_sco_chk_pend_rolechange (UINT16 hci_handle);
|
||||
** Define structure for Security Service Record.
|
||||
** A record exists for each service registered with the Security Manager
|
||||
*/
|
||||
#define BTM_SEC_OUT_FLAGS (BTM_SEC_OUT_AUTHENTICATE | BTM_SEC_OUT_ENCRYPT | BTM_SEC_OUT_AUTHORIZE)
|
||||
#define BTM_SEC_IN_FLAGS (BTM_SEC_IN_AUTHENTICATE | BTM_SEC_IN_ENCRYPT | BTM_SEC_IN_AUTHORIZE)
|
||||
|
||||
#define BTM_SEC_OUT_LEVEL4_FLAGS (BTM_SEC_OUT_AUTHENTICATE | BTM_SEC_OUT_ENCRYPT | \
|
||||
BTM_SEC_OUT_MITM | BTM_SEC_MODE4_LEVEL4)
|
||||
|
||||
#define BTM_SEC_IN_LEVEL4_FLAGS (BTM_SEC_IN_AUTHENTICATE | BTM_SEC_IN_ENCRYPT | \
|
||||
BTM_SEC_IN_MITM | BTM_SEC_MODE4_LEVEL4)
|
||||
|
||||
typedef struct {
|
||||
UINT32 mx_proto_id; /* Service runs over this multiplexer protocol */
|
||||
UINT32 orig_mx_chan_id; /* Channel on the multiplexer protocol */
|
||||
@ -878,6 +887,15 @@ typedef struct{
|
||||
}tBTM_CallbackFunc;
|
||||
|
||||
extern tBTM_CallbackFunc conn_param_update_cb;
|
||||
/* security action for L2CAP COC channels */
|
||||
#define BTM_SEC_OK 1
|
||||
#define BTM_SEC_ENCRYPT 2 /* encrypt the link with current key */
|
||||
#define BTM_SEC_ENCRYPT_NO_MITM 3 /* unauthenticated encryption or better */
|
||||
#define BTM_SEC_ENCRYPT_MITM 4 /* authenticated encryption */
|
||||
#define BTM_SEC_ENC_PENDING 5 /* wait for link encryption pending */
|
||||
|
||||
typedef UINT8 tBTM_SEC_ACTION;
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
@ -1082,6 +1100,10 @@ BOOLEAN btm_sec_is_a_bonded_dev (BD_ADDR bda);
|
||||
void btm_consolidate_dev(tBTM_SEC_DEV_REC *p_target_rec);
|
||||
BOOLEAN btm_sec_is_le_capable_dev (BD_ADDR bda);
|
||||
BOOLEAN btm_ble_init_pseudo_addr (tBTM_SEC_DEV_REC *p_dev_rec, BD_ADDR new_pseudo_addr);
|
||||
extern BOOLEAN btm_ble_start_sec_check(BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originator,
|
||||
tBTM_SEC_CALLBACK *p_callback, void *p_ref_data);
|
||||
extern tBTM_SEC_SERV_REC *btm_sec_find_first_serv (CONNECTION_TYPE conn_type, UINT16 psm);
|
||||
|
||||
#endif /* BLE_INCLUDED */
|
||||
|
||||
tINQ_DB_ENT *btm_inq_db_new (BD_ADDR p_bda);
|
||||
|
@ -66,8 +66,13 @@ typedef uint8_t esp_link_key[ESP_BT_OCTET16_LEN]; /* Link Key */
|
||||
/// Default GATT interface id
|
||||
#define ESP_DEFAULT_GATT_IF 0xff
|
||||
|
||||
/// Default BLE connection param, if the value doesn't be overwritten
|
||||
#define ESP_BLE_CONN_PARAM_UNDEF 0xffff /* use this value when a specific value not to be overwritten */
|
||||
#define ESP_BLE_CONN_INT_MIN 0x0006 /*!< relate to BTM_BLE_CONN_INT_MIN in btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_INT_MAX 0x0C80 /*!< relate to BTM_BLE_CONN_INT_MAX in btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_LATENCY_MAX 500 /*!< relate to ESP_BLE_CONN_LATENCY_MAX in btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_SUP_TOUT_MIN 0x000A /*!< relate to BTM_BLE_CONN_SUP_TOUT_MIN in btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_SUP_TOUT_MAX 0x0C80 /*!< relate to ESP_BLE_CONN_SUP_TOUT_MAX in btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_PARAM_UNDEF 0xffff /* use this value when a specific value not to be overwritten */ /* relate to ESP_BLE_CONN_PARAM_UNDEF in btm_ble_api.h */
|
||||
#define ESP_BLE_SCAN_PARAM_UNDEF 0xffffffff /* relate to ESP_BLE_SCAN_PARAM_UNDEF in btm_ble_api.h */
|
||||
|
||||
/// Check the param is valid or not
|
||||
#define ESP_BLE_IS_VALID_PARAM(x, min, max) (((x) >= (min) && (x) <= (max)) || ((x) == ESP_BLE_CONN_PARAM_UNDEF))
|
||||
|
@ -68,7 +68,6 @@ typedef uint8_t esp_ble_auth_req_t; /*!< combination of the above bit
|
||||
#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 */
|
||||
|
||||
|
||||
/// GAP BLE callback event type
|
||||
typedef enum {
|
||||
ESP_GAP_BLE_ADV_DATA_SET_COMPLETE_EVT = 0, /*!< When advertising data set complete, the event comes */
|
||||
@ -97,6 +96,7 @@ typedef enum {
|
||||
ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT, /*!< When remove the bond device complete, the event comes */
|
||||
ESP_GAP_BLE_CLEAR_BOND_DEV_COMPLETE_EVT, /*!< When clear the bond device clear complete, the event comes */
|
||||
ESP_GAP_BLE_GET_BOND_DEV_COMPLETE_EVT, /*!< When get the bond device list complete, the event comes */
|
||||
ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT, /*!< When read the rssi complete, the event comes */
|
||||
ESP_GAP_BLE_EVT_MAX,
|
||||
} esp_gap_ble_cb_event_t;
|
||||
|
||||
@ -569,7 +569,7 @@ typedef union {
|
||||
*/
|
||||
struct ble_local_privacy_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate the set local privacy operation success status */
|
||||
} local_privacy_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_LOCAL_PRIVACY_COMPLETE_EVT */
|
||||
} local_privacy_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_LOCAL_PRIVACY_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT
|
||||
*/
|
||||
@ -591,6 +591,15 @@ typedef union {
|
||||
uint8_t dev_num; /*!< Indicate the get number device in the bond list */
|
||||
esp_ble_bond_dev_t *bond_dev; /*!< the pointer to the bond device Structure */
|
||||
}get_bond_dev_cmpl; /*!< Event parameter of ESP_GAP_BLE_GET_BOND_DEV_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_read_rssi_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate the read adv tx power operation success status */
|
||||
int8_t rssi; /*!< The ble remote device rssi value, the range is from -127 to 20, the unit is dbm,
|
||||
if the RSSI cannot be read, the RSSI metric shall be set to 127. */
|
||||
esp_bd_addr_t remote_addr; /*!< The remote device address */
|
||||
} read_rssi_cmpl; /*!< Event parameter of ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT */
|
||||
} esp_ble_gap_cb_param_t;
|
||||
|
||||
/**
|
||||
@ -742,6 +751,48 @@ esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr);
|
||||
*/
|
||||
esp_err_t esp_ble_gap_config_local_privacy (bool privacy_enable);
|
||||
|
||||
/**
|
||||
* @brief Add or remove device from white list
|
||||
*
|
||||
* @param[in] add_remove: the value is true if added the ble device to the white list, and false remove to the white list.
|
||||
* @param[in] remote_bda: the remote device address add/remove from the white list.
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gap_update_whitelist(bool add_remove, esp_bd_addr_t remote_bda);
|
||||
|
||||
/**
|
||||
* @brief Get the whitelist size in the controller
|
||||
*
|
||||
* @param[out] length: the white list length.
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gap_get_whitelist_size(uint16_t *length);
|
||||
|
||||
/**
|
||||
* @brief This function is called to set the preferred connection
|
||||
* parameters when default connection parameter is not desired before connecting.
|
||||
* This API can only be used in the master role.
|
||||
*
|
||||
* @param[in] bd_addr: BD address of the peripheral
|
||||
* @param[in] min_conn_int: minimum preferred connection interval
|
||||
* @param[in] max_conn_int: maximum preferred connection interval
|
||||
* @param[in] slave_latency: preferred slave latency
|
||||
* @param[in] supervision_tout: preferred supervision timeout
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gap_set_prefer_conn_params(esp_bd_addr_t bd_addr,
|
||||
uint16_t min_conn_int, uint16_t max_conn_int,
|
||||
uint16_t slave_latency, uint16_t supervision_tout);
|
||||
|
||||
/**
|
||||
* @brief Set device name to the local device
|
||||
@ -796,7 +847,20 @@ esp_err_t esp_ble_gap_config_adv_data_raw(uint8_t *raw_data, uint32_t raw_data_l
|
||||
*/
|
||||
esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_data_len);
|
||||
|
||||
/**
|
||||
* @brief This function is called to read the RSSI of remote device.
|
||||
* The address of link policy results are returned in the gap callback function with
|
||||
* ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT event.
|
||||
*
|
||||
* @param[in] remote_addr : The remote connection device address.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*/
|
||||
esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr);
|
||||
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
/**
|
||||
* @brief Set a GAP security parameter value. Overrides the default value.
|
||||
*
|
||||
@ -879,24 +943,32 @@ esp_err_t esp_ble_confirm_reply(esp_bd_addr_t bd_addr, bool accept);
|
||||
esp_err_t esp_ble_remove_bond_device(esp_bd_addr_t bd_addr);
|
||||
|
||||
/**
|
||||
* @brief Removes all of the device from the security database list of
|
||||
* peer device. It manages unpairing event while connected.
|
||||
* @brief Get the device number from the security database list of peer device.
|
||||
* It will return the device bonded number immediately.
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
* @return - >= 0 : bonded devices number.
|
||||
* - < 0 : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_clear_bond_device_list(void);
|
||||
int esp_ble_get_bond_device_num(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the device from the security database list of peer device.
|
||||
* It will return the device bonded information from the ESP_GAP_BLE_GET_BOND_DEV_COMPLETE_EVT event.
|
||||
* It will return the device bonded information immediately.
|
||||
* @param[inout] dev_num: Indicate the dev_list array(buffer) size as input.
|
||||
* If dev_num is large enough, it means the actual number as output.
|
||||
* Suggest that dev_num value equal to esp_ble_get_bond_device_num().
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
* @param[out] dev_list: an array(buffer) of `esp_ble_bond_dev_t` type. Use for storing the bonded devices address.
|
||||
* The dev_list should be allocated by who call this API.
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_get_bond_device_list(void);
|
||||
esp_err_t esp_ble_get_bond_device_list(int *dev_num, esp_ble_bond_dev_t *dev_list);
|
||||
|
||||
#endif /* #if (SMP_INCLUDED == TRUE) */
|
||||
|
||||
/**
|
||||
* @brief This function is to disconnect the physical connection of the peer device
|
||||
|
@ -27,6 +27,7 @@ extern "C" {
|
||||
#define ESP_GATT_ILLEGAL_HANDLE 0
|
||||
/// GATT attribute max handle
|
||||
#define ESP_GATT_ATTR_HANDLE_MAX 100
|
||||
#define ESP_GATT_MAX_READ_MULTI_HANDLES 10 /* Max attributes to read in one request */
|
||||
|
||||
|
||||
/**@{
|
||||
@ -294,12 +295,12 @@ typedef uint8_t esp_gatt_char_prop_t;
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t uuid_length; /*!< UUID length */
|
||||
uint8_t *uuid_p; /*!< UUID value */
|
||||
uint16_t perm; /*!< Attribute permission */
|
||||
uint16_t max_length; /*!< Maximum length of the element*/
|
||||
uint16_t length; /*!< Current length of the element*/
|
||||
uint8_t *value; /*!< Element value array*/
|
||||
uint16_t uuid_length; /*!< UUID length */
|
||||
uint8_t *uuid_p; /*!< UUID value */
|
||||
uint16_t perm; /*!< Attribute permission */
|
||||
uint16_t max_length; /*!< Maximum length of the element*/
|
||||
uint16_t length; /*!< Current length of the element*/
|
||||
uint8_t *value; /*!< Element value array*/
|
||||
} esp_attr_desc_t;
|
||||
|
||||
|
||||
@ -313,8 +314,8 @@ typedef struct
|
||||
/**
|
||||
* @brief if auto_rsp set to ESP_GATT_RSP_BY_APP, means the response of Write/Read operation will by replied by application.
|
||||
if auto_rsp set to ESP_GATT_AUTO_RSP, means the response of Write/Read operation will be replied by GATT stack automatically.
|
||||
*/
|
||||
uint8_t auto_rsp;
|
||||
*/
|
||||
uint8_t auto_rsp;
|
||||
} esp_attr_control_t;
|
||||
|
||||
|
||||
@ -323,8 +324,8 @@ typedef struct
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
esp_attr_control_t attr_control; /*!< The attribute control type*/
|
||||
esp_attr_desc_t att_desc; /*!< The attribute type*/
|
||||
esp_attr_control_t attr_control; /*!< The attribute control type */
|
||||
esp_attr_desc_t att_desc; /*!< The attribute type */
|
||||
} esp_gatts_attr_db_t;
|
||||
|
||||
|
||||
@ -333,9 +334,9 @@ typedef struct
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t attr_max_len; /*!< attribute max value length */
|
||||
uint16_t attr_len; /*!< attribute current value length */
|
||||
uint8_t *attr_value; /*!< the pointer to attribute value */
|
||||
uint16_t attr_max_len; /*!< attribute max value length */
|
||||
uint16_t attr_len; /*!< attribute current value length */
|
||||
uint8_t *attr_value; /*!< the pointer to attribute value */
|
||||
} esp_attr_value_t;
|
||||
|
||||
|
||||
@ -344,22 +345,19 @@ typedef struct
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t start_hdl; /*!< Gatt start handle value of included service */
|
||||
uint16_t end_hdl; /*!< Gatt end handle value of included service */
|
||||
uint16_t uuid; /*!< Gatt attribute value UUID of included service */
|
||||
} esp_gatts_incl_svc_desc_t; /*!< Gatt include service entry element */
|
||||
uint16_t start_hdl; /*!< Gatt start handle value of included service */
|
||||
uint16_t end_hdl; /*!< Gatt end handle value of included service */
|
||||
uint16_t uuid; /*!< Gatt attribute value UUID of included service */
|
||||
} esp_gatts_incl_svc_desc_t; /*!< Gatt include service entry element */
|
||||
|
||||
/**
|
||||
* @brief Gatt include 128 bit service entry element
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t start_hdl; /*!< Gatt start handle value of included 128 bit service */
|
||||
uint16_t end_hdl; /*!< Gatt end handle value of included 128 bit service */
|
||||
} esp_gatts_incl128_svc_desc_t; /*!< Gatt include 128 bit service entry element */
|
||||
|
||||
|
||||
|
||||
uint16_t start_hdl; /*!< Gatt start handle value of included 128 bit service */
|
||||
uint16_t end_hdl; /*!< Gatt end handle value of included 128 bit service */
|
||||
} esp_gatts_incl128_svc_desc_t; /*!< Gatt include 128 bit service entry element */
|
||||
|
||||
/// Gatt attribute value
|
||||
typedef struct {
|
||||
@ -388,6 +386,75 @@ typedef enum {
|
||||
|
||||
typedef uint8_t esp_gatt_if_t; /*!< Gatt interface type, different application on GATT client use different gatt_if */
|
||||
|
||||
/**
|
||||
* @brief the type of attribute element
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_DB_PRIMARY_SERVICE, /*!< Gattc primary service attribute type in the cache */
|
||||
ESP_GATT_DB_SECONDARY_SERVICE, /*!< Gattc secondary service attribute type in the cache */
|
||||
ESP_GATT_DB_CHARACTERISTIC, /*!< Gattc characteristic attribute type in the cache */
|
||||
ESP_GATT_DB_DESCRIPTOR, /*!< Gattc characteristic descriptor attribute type in the cache */
|
||||
ESP_GATT_DB_INCLUDED_SERVICE, /*!< Gattc include service attribute type in the cache */
|
||||
ESP_GATT_DB_ALL, /*!< Gattc all the attribute (primary service & secondary service & include service & char & descriptor) type in the cache */
|
||||
} esp_gatt_db_attr_type_t; /*!< Gattc attribute type element */
|
||||
|
||||
/**
|
||||
* @brief read multiple attribute
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t num_attr; /*!< The number of the attribute */
|
||||
uint16_t handles[ESP_GATT_MAX_READ_MULTI_HANDLES]; /*!< The handles list */
|
||||
} esp_gattc_multi_t; /*!< The gattc multiple read element */
|
||||
|
||||
/**
|
||||
* @brief data base attribute element
|
||||
*/
|
||||
typedef struct {
|
||||
esp_gatt_db_attr_type_t type; /*!< The attribute type */
|
||||
uint16_t attribute_handle; /*!< The attribute handle, it's valid for all of the type */
|
||||
uint16_t start_handle; /*!< The service start handle, it's valid only when the type = ESP_GATT_DB_PRIMARY_SERVICE or ESP_GATT_DB_SECONDARY_SERVICE */
|
||||
uint16_t end_handle; /*!< The service end handle, it's valid only when the type = ESP_GATT_DB_PRIMARY_SERVICE or ESP_GATT_DB_SECONDARY_SERVICE */
|
||||
esp_gatt_char_prop_t properties; /*!< The characteristic properties, it's valid only when the type = ESP_GATT_DB_CHARACTERISTIC */
|
||||
esp_bt_uuid_t uuid; /*!< The attribute uuid, it's valid for all of the type */
|
||||
} esp_gattc_db_elem_t; /*!< The gattc service data base element in the cache */
|
||||
|
||||
/**
|
||||
* @brief service element
|
||||
*/
|
||||
typedef struct {
|
||||
bool is_primary; /*!< The service flag, ture if the service is primary service, else is secondly service */
|
||||
uint16_t start_handle; /*!< The start handle of the service */
|
||||
uint16_t end_handle; /*!< The end handle of the service */
|
||||
esp_bt_uuid_t uuid; /*!< The uuid of the service */
|
||||
} esp_gattc_service_elem_t; /*!< The gattc service element */
|
||||
|
||||
/**
|
||||
* @brief characteristic element
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t char_handle; /*!< The characteristic handle */
|
||||
esp_gatt_char_prop_t properties; /*!< The characteristic properties */
|
||||
esp_bt_uuid_t uuid; /*!< The characteristic uuid */
|
||||
} esp_gattc_char_elem_t; /*!< The gattc characteristic element */
|
||||
|
||||
/**
|
||||
* @brief descriptor element
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t handle; /*!< The characteristic descriptor handle */
|
||||
esp_bt_uuid_t uuid; /*!< The characteristic descriptor uuid */
|
||||
} esp_gattc_descr_elem_t; /*!< The gattc descriptor type element */
|
||||
|
||||
/**
|
||||
* @brief include service element
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t handle; /*!< The include service current attribute handle */
|
||||
uint16_t incl_srvc_s_handle; /*!< The start hanlde of the service which has been included */
|
||||
esp_bt_uuid_t uuid; /*!< The include service uuid */
|
||||
} esp_gattc_incl_svc_elem_t; /*!< The gattc inclue service element */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -59,9 +59,6 @@ typedef enum {
|
||||
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 */
|
||||
@ -74,57 +71,59 @@ typedef enum {
|
||||
*/
|
||||
typedef union {
|
||||
/**
|
||||
* @brief ESP_GATTC_REG_EVT
|
||||
*/
|
||||
struct gattc_reg_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t app_id; /*!< Application id which input in register API */
|
||||
} reg; /*!< Gatt client callback param of ESP_GATTC_REG_EVT */
|
||||
* @brief ESP_GATTC_REG_EVT
|
||||
*/
|
||||
struct gattc_reg_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t app_id; /*!< Application id which input in register API */
|
||||
} reg; /*!< Gatt client callback param of ESP_GATTC_REG_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_OPEN_EVT
|
||||
*/
|
||||
struct gattc_open_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 */
|
||||
uint16_t mtu; /*!< MTU size */
|
||||
} open; /*!< Gatt client callback param of ESP_GATTC_OPEN_EVT */
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
uint16_t mtu; /*!< MTU size */
|
||||
} open; /*!< Gatt client callback param of ESP_GATTC_OPEN_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_CLOSE_EVT
|
||||
*/
|
||||
struct gattc_close_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 */
|
||||
esp_gatt_conn_reason_t reason; /*!< The reason of gatt connection close */
|
||||
} close; /*!< Gatt client callback param of ESP_GATTC_CLOSE_EVT */
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
esp_gatt_conn_reason_t reason; /*!< The reason of gatt connection close */
|
||||
} close; /*!< Gatt client callback param of ESP_GATTC_CLOSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_CFG_MTU_EVT
|
||||
*/
|
||||
struct gattc_cfg_mtu_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
uint16_t mtu; /*!< MTU size */
|
||||
} cfg_mtu; /*!< Gatt client callback param of ESP_GATTC_CFG_MTU_EVT */
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
uint16_t mtu; /*!< MTU size */
|
||||
} cfg_mtu; /*!< Gatt client callback param of ESP_GATTC_CFG_MTU_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_SEARCH_CMPL_EVT
|
||||
*/
|
||||
struct gattc_search_cmpl_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
} search_cmpl; /*!< Gatt client callback param of ESP_GATTC_SEARCH_CMPL_EVT */
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
} search_cmpl; /*!< Gatt client callback param of ESP_GATTC_SEARCH_CMPL_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_SEARCH_RES_EVT
|
||||
*/
|
||||
struct gattc_search_res_evt_param {
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
esp_gatt_srvc_id_t srvc_id; /*!< Service id, include service uuid and other information */
|
||||
} search_res; /*!< Gatt client callback param of ESP_GATTC_SEARCH_RES_EVT */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
uint16_t start_handle; /*!< Service start handle */
|
||||
uint16_t end_handle; /*!< Service end handle */
|
||||
esp_gatt_id_t srvc_id; /*!< Service id, include service uuid and other information */
|
||||
} search_res; /*!< Gatt client callback param of ESP_GATTC_SEARCH_RES_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_READ_CHAR_EVT, ESP_GATTC_READ_DESCR_EVT
|
||||
@ -133,17 +132,8 @@ typedef union {
|
||||
|
||||
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 */
|
||||
uint16_t handle; /*!< Characteristic handle */
|
||||
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 */
|
||||
|
||||
@ -151,99 +141,60 @@ typedef union {
|
||||
* @brief ESP_GATTC_WRITE_CHAR_EVT, ESP_GATTC_PREP_WRITE_EVT, ESP_GATTC_WRITE_DESCR_EVT
|
||||
*/
|
||||
struct gattc_write_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 */
|
||||
} write; /*!< Gatt client callback param of ESP_GATTC_WRITE_DESCR_EVT */
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
uint16_t handle; /*!< The Characteristic or descriptor handle */
|
||||
} write; /*!< Gatt client callback param of ESP_GATTC_WRITE_DESCR_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_EXEC_EVT
|
||||
*/
|
||||
struct gattc_exec_cmpl_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
} exec_cmpl; /*!< Gatt client callback param of ESP_GATTC_EXEC_EVT */
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
} exec_cmpl; /*!< Gatt client callback param of ESP_GATTC_EXEC_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_NOTIFY_EVT
|
||||
*/
|
||||
struct gattc_notify_evt_param {
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
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 */
|
||||
uint16_t value_len; /*!< Notify attribute value */
|
||||
uint8_t *value; /*!< Notify attribute value */
|
||||
bool is_notify; /*!< True means notify, false means indicate */
|
||||
} notify; /*!< Gatt client callback param of ESP_GATTC_NOTIFY_EVT */
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
uint16_t handle; /*!< The Characteristic or descriptor handle */
|
||||
uint16_t value_len; /*!< Notify attribute value */
|
||||
uint8_t *value; /*!< Notify attribute value */
|
||||
bool is_notify; /*!< True means notify, false means indicate */
|
||||
} notify; /*!< Gatt client callback param of ESP_GATTC_NOTIFY_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_SRVC_CHG_EVT
|
||||
*/
|
||||
struct gattc_srvc_chg_evt_param {
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
} srvc_chg; /*!< Gatt client callback param of ESP_GATTC_SRVC_CHG_EVT */
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
} srvc_chg; /*!< Gatt client callback param of ESP_GATTC_SRVC_CHG_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_CONGEST_EVT
|
||||
*/
|
||||
struct gattc_congest_evt_param {
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
bool congested; /*!< Congested or not */
|
||||
} congest; /*!< Gatt client callback param of ESP_GATTC_CONGEST_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_GET_CHAR_EVT
|
||||
*/
|
||||
struct gattc_get_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_char_prop_t char_prop; /*!< Characteristic property */
|
||||
} get_char; /*!< Gatt client callback param of ESP_GATTC_GET_CHAR_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_GET_DESCR_EVT
|
||||
*/
|
||||
struct gattc_get_descr_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 */
|
||||
} get_descr; /*!< Gatt client callback param of ESP_GATTC_GET_DESCR_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_GET_INCL_SRVC_EVT
|
||||
*/
|
||||
struct gattc_get_incl_srvc_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_srvc_id_t incl_srvc_id;/*!< Included service id, include service uuid and other information */
|
||||
} get_incl_srvc; /*!< Gatt client callback param of ESP_GATTC_GET_INCL_SRVC_EVT */
|
||||
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
bool congested; /*!< Congested or not */
|
||||
} congest; /*!< Gatt client callback param of ESP_GATTC_CONGEST_EVT */
|
||||
/**
|
||||
* @brief ESP_GATTC_REG_FOR_NOTIFY_EVT
|
||||
*/
|
||||
struct gattc_reg_for_notify_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
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 */
|
||||
} reg_for_notify; /*!< Gatt client callback param of ESP_GATTC_REG_FOR_NOTIFY_EVT */
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t handle; /*!< The characteristic or descriptor handle */
|
||||
} reg_for_notify; /*!< Gatt client callback param of ESP_GATTC_REG_FOR_NOTIFY_EVT */
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief ESP_GATTC_UNREG_FOR_NOTIFY_EVT
|
||||
*/
|
||||
struct gattc_unreg_for_notify_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
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 */
|
||||
} unreg_for_notify; /*!< Gatt client callback param of ESP_GATTC_UNREG_FOR_NOTIFY_EVT */
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint16_t handle; /*!< The characteristic or descriptor handle */
|
||||
} unreg_for_notify; /*!< Gatt client callback param of ESP_GATTC_UNREG_FOR_NOTIFY_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_CONNECT_EVT
|
||||
@ -263,7 +214,7 @@ typedef union {
|
||||
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 */
|
||||
} esp_ble_gattc_cb_param_t; /*!< GATT client callback parameter union type */
|
||||
|
||||
/**
|
||||
* @brief GATT Client callback function type
|
||||
@ -383,76 +334,233 @@ esp_err_t esp_ble_gattc_send_mtu_req (esp_gatt_if_t gattc_if, uint16_t conn_id);
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_search_service(esp_gatt_if_t gattc_if, uint16_t conn_id, esp_bt_uuid_t *filter_uuid);
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function is called to find the first characteristic of the
|
||||
* service on the given server.
|
||||
* @brief Find all the service with the given service uuid in the gattc cache, if the svc_uuid is NULL, find all the service.
|
||||
* Note: It just get service from local cache, won't get from remote devices. If want to get it from remote device, need
|
||||
* to used the esp_ble_gattc_search_service.
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id: connection ID which identify the server.
|
||||
* @param[in] srvc_id: service ID
|
||||
* @param[in] start_char_id: the start characteristic ID
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_get_characteristic(esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
esp_gatt_srvc_id_t *srvc_id,
|
||||
esp_gatt_id_t *start_char_id);
|
||||
|
||||
/**
|
||||
* @brief This function is called to find the descriptor of the
|
||||
* service on the given server.
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id: connection ID which identify the server.
|
||||
* @param[in] srvc_id: the service ID of which the characteristic is belonged to.
|
||||
* @param[in] char_id: Characteristic ID, if NULL find the first available
|
||||
* characteristic.
|
||||
* @param[in] start_descr_id: the start descriptor id
|
||||
* @param[in] svc_uuid: the pointer to the service uuid.
|
||||
* @param[out] result: The pointer to the service whith has been found in the gattc cache.
|
||||
* @param[inout] count: input the number of service want to find,
|
||||
* it will output the number of service has been found in the gattc cache with the given service uuid.
|
||||
* @param[in] offset: Offset of the service position to get.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_get_descriptor(esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
esp_gatt_srvc_id_t *srvc_id,
|
||||
esp_gatt_id_t *char_id,
|
||||
esp_gatt_id_t *start_descr_id);
|
||||
|
||||
esp_gatt_status_t esp_ble_gattc_get_service(esp_gatt_if_t gattc_if, uint16_t conn_id, esp_bt_uuid_t *svc_uuid,
|
||||
esp_gattc_service_elem_t *result, uint16_t *count, uint16_t offset);
|
||||
|
||||
/**
|
||||
* @brief This function is called to find the first characteristic of the
|
||||
* service on the given server.
|
||||
* @brief Find all the characteristic with the given service in the gattc cache
|
||||
* Note: It just get characteristic from local cache, won't get from remote devices.
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id: connection ID which identify the server.
|
||||
* @param[in] srvc_id: the service ID of which the characteristic is belonged to.
|
||||
* @param[in] start_incl_srvc_id: the start include service id
|
||||
* @param[in] start_handle: the attribute start handle.
|
||||
* @param[in] end_handle: the attribute end handle
|
||||
* @param[out] result: The pointer to the charateristic in the service.
|
||||
* @param[inout] count: input the number of characteristic want to find,
|
||||
* it will output the number of characteristic has been found in the gattc cache with the given service.
|
||||
* @param[in] offset: Offset of the characteristic position to get.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_get_included_service(esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
esp_gatt_srvc_id_t *srvc_id,
|
||||
esp_gatt_srvc_id_t *start_incl_srvc_id);
|
||||
esp_gatt_status_t esp_ble_gattc_get_all_char(esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
uint16_t start_handle,
|
||||
uint16_t end_handle,
|
||||
esp_gattc_char_elem_t *result,
|
||||
uint16_t *count, uint16_t offset);
|
||||
|
||||
/**
|
||||
* @brief Find all the descriptor with the given characteristic in the gattc cache
|
||||
* Note: It just get descriptor from local cache, won't get from remote devices.
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id: connection ID which identify the server.
|
||||
* @param[in] char_handle: the given characteristic handle
|
||||
* @param[out] result: The pointer to the descriptor in the characteristic.
|
||||
* @param[inout] count: input the number of descriptor want to find,
|
||||
* it will output the number of descriptor has been found in the gattc cache with the given characteristic.
|
||||
* @param[in] offset: Offset of the descriptor position to get.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_gatt_status_t esp_ble_gattc_get_all_descr(esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
uint16_t char_handle,
|
||||
esp_gattc_descr_elem_t *result,
|
||||
uint16_t *count, uint16_t offset);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Find the characteristic with the given characteristic uuid in the gattc cache
|
||||
* Note: It just get characteristic from local cache, won't get from remote devices.
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id: connection ID which identify the server.
|
||||
* @param[in] start_handle: the attribute start handle
|
||||
* @param[in] end_handle: the attribute end handle
|
||||
* @param[in] char_uuid: the characteristic uuid
|
||||
* @param[out] result: The pointer to the characteristic in the service.
|
||||
* @param[inout] count: input the number of characteristic want to find,
|
||||
* it will output the number of characteristic has been found in the gattc cache with the given service.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_gatt_status_t esp_ble_gattc_get_char_by_uuid(esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
uint16_t start_handle,
|
||||
uint16_t end_handle,
|
||||
esp_bt_uuid_t char_uuid,
|
||||
esp_gattc_char_elem_t *result,
|
||||
uint16_t *count);
|
||||
|
||||
/**
|
||||
* @brief Find the descriptor with the given characteristic uuid in the gattc cache
|
||||
* Note: It just get descriptor from local cache, won't get from remote devices.
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id: connection ID which identify the server.
|
||||
* @param[in] start_handle: the attribute start handle
|
||||
* @param[in] end_handle: the attribute end handle
|
||||
* @param[in] char_uuid: the characteristic uuid.
|
||||
* @param[in] descr_uuid: the descriptor uuid.
|
||||
* @param[out] result: The pointer to the descriptor in the given characteristic.
|
||||
* @param[inout] count: input the number of descriptor want to find,
|
||||
* it will output the number of descriptor has been found in the gattc cache with the given characteristic.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_gatt_status_t esp_ble_gattc_get_descr_by_uuid(esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
uint16_t start_handle,
|
||||
uint16_t end_handle,
|
||||
esp_bt_uuid_t char_uuid,
|
||||
esp_bt_uuid_t descr_uuid,
|
||||
esp_gattc_descr_elem_t *result,
|
||||
uint16_t *count);
|
||||
|
||||
/**
|
||||
* @brief Find the descriptor with the given characteristic handle in the gattc cache
|
||||
* Note: It just get descriptor from local cache, won't get from remote devices.
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id: connection ID which identify the server.
|
||||
* @param[in] char_handle: the characteristic handle.
|
||||
* @param[in] descr_uuid: the descriptor uuid.
|
||||
* @param[out] result: The pointer to the descriptor in the given characteristic.
|
||||
* @param[inout] count: input the number of descriptor want to find,
|
||||
* it will output the number of descriptor has been found in the gattc cache with the given characteristic.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_gatt_status_t esp_ble_gattc_get_descr_by_char_handle(esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
uint16_t char_handle,
|
||||
esp_bt_uuid_t descr_uuid,
|
||||
esp_gattc_descr_elem_t *result,
|
||||
uint16_t *count);
|
||||
|
||||
/**
|
||||
* @brief Find the include service with the given service handle in the gattc cache
|
||||
* Note: It just get include service from local cache, won't get from remote devices.
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id: connection ID which identify the server.
|
||||
* @param[in] start_handle: the attribute start handle
|
||||
* @param[in] end_handle: the attribute end handle
|
||||
* @param[in] incl_uuid: the include service uuid
|
||||
* @param[out] result: The pointer to the include service in the given service.
|
||||
* @param[inout] count: input the number of include service want to find,
|
||||
* it will output the number of include service has been found in the gattc cache with the given service.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_gatt_status_t esp_ble_gattc_get_include_service(esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
uint16_t start_handle,
|
||||
uint16_t end_handle,
|
||||
esp_bt_uuid_t *incl_uuid,
|
||||
esp_gattc_incl_svc_elem_t *result,
|
||||
uint16_t *count);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Find the attribute count with the given service or characteristic in the gattc cache
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id: connection ID which identify the server.
|
||||
* @param[in] type: the attribute type.
|
||||
* @param[in] start_handle: the attribute start handle, if the type is ESP_GATT_DB_DESCRIPTOR, this parameter should be ignore
|
||||
* @param[in] end_handle: the attribute end handle, if the type is ESP_GATT_DB_DESCRIPTOR, this parameter should be ignore
|
||||
* @param[in] char_handle: the characteristic handle, this parameter valid when the type is ESP_GATT_DB_DESCRIPTOR. If the type
|
||||
* isn't ESP_GATT_DB_DESCRIPTOR, this parameter should be ignore.
|
||||
* @param[out] count: output the number of attribute has been found in the gattc cache with the given attribute type.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_gatt_status_t esp_ble_gattc_get_attr_count(esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
esp_gatt_db_attr_type_t type,
|
||||
uint16_t start_handle,
|
||||
uint16_t end_handle,
|
||||
uint16_t char_handle,
|
||||
uint16_t *count);
|
||||
|
||||
/**
|
||||
* @brief This function is called to get the GATT database.
|
||||
* Note: It just get attribute data base from local cache, won't get from remote devices.
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] start_handle: the attribute start handle
|
||||
* @param[in] end_handle: the attribute end handle
|
||||
* @param[in] conn_id: connection ID which identify the server.
|
||||
* @param[in] db: output parameter which will contain the GATT database copy.
|
||||
* Caller is responsible for freeing it.
|
||||
* @param[in] count: number of elements in database.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_gatt_status_t esp_ble_gattc_get_db(esp_gatt_if_t gattc_if, uint16_t conn_id, uint16_t start_handle, uint16_t end_handle,
|
||||
esp_gattc_db_elem_t *db, uint16_t *count);
|
||||
|
||||
/**
|
||||
* @brief This function is called to read a service's characteristics of
|
||||
* the given characteristic ID
|
||||
* the given characteristic handle
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id : connection ID.
|
||||
* @param[in] srvc_id : service ID.
|
||||
* @param[in] char_id : characteristic ID to read.
|
||||
* @param[in] handle : characteritic handle to read.
|
||||
* @param[in] auth_req : authenticate request type
|
||||
*
|
||||
* @return
|
||||
@ -460,11 +568,28 @@ esp_err_t esp_ble_gattc_get_included_service(esp_gatt_if_t gattc_if,
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_read_char (esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
esp_gatt_srvc_id_t *srvc_id,
|
||||
esp_gatt_id_t *char_id,
|
||||
esp_gatt_auth_req_t auth_req);
|
||||
esp_err_t esp_ble_gattc_read_char (esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
uint16_t handle,
|
||||
esp_gatt_auth_req_t auth_req);
|
||||
|
||||
/**
|
||||
* @brief This function is called to read multiple characteristic or
|
||||
* characteristic descriptors.
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id : connection ID.
|
||||
* @param[in] read_multi : pointer to the read multiple parameter.
|
||||
* @param[in] auth_req : authenticate request type
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_read_multiple(esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id, esp_gattc_multi_t *read_multi,
|
||||
esp_gatt_auth_req_t auth_req);
|
||||
|
||||
|
||||
/**
|
||||
@ -472,9 +597,7 @@ esp_err_t esp_ble_gattc_read_char (esp_gatt_if_t gattc_if,
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id : connection ID.
|
||||
* @param[in] srvc_id : service ID.
|
||||
* @param[in] char_id : characteristic ID to read.
|
||||
* @param[in] descr_id : characteristic descriptor ID to read.
|
||||
* @param[in] handle : descriptor handle to read.
|
||||
* @param[in] auth_req : authenticate request type
|
||||
*
|
||||
* @return
|
||||
@ -483,11 +606,9 @@ esp_err_t esp_ble_gattc_read_char (esp_gatt_if_t gattc_if,
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_read_char_descr (esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
esp_gatt_srvc_id_t *srvc_id,
|
||||
esp_gatt_id_t *char_id,
|
||||
esp_gatt_id_t *descr_id,
|
||||
esp_gatt_auth_req_t auth_req);
|
||||
uint16_t conn_id,
|
||||
uint16_t handle,
|
||||
esp_gatt_auth_req_t auth_req);
|
||||
|
||||
|
||||
/**
|
||||
@ -495,8 +616,7 @@ esp_err_t esp_ble_gattc_read_char_descr (esp_gatt_if_t gattc_if,
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id : connection ID.
|
||||
* @param[in] srvc_id : service ID.
|
||||
* @param[in] char_id : characteristic ID to write.
|
||||
* @param[in] handle : characteristic handle to write.
|
||||
* @param[in] value_len: length of the value to be written.
|
||||
* @param[in] value : the value to be written.
|
||||
* @param[in] write_type : the type of attribute write operation.
|
||||
@ -509,11 +629,10 @@ esp_err_t esp_ble_gattc_read_char_descr (esp_gatt_if_t gattc_if,
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_write_char( esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
esp_gatt_srvc_id_t *srvc_id,
|
||||
esp_gatt_id_t *char_id,
|
||||
uint16_t handle,
|
||||
uint16_t value_len,
|
||||
uint8_t *value,
|
||||
esp_gatt_write_type_t write_type,
|
||||
esp_gatt_write_type_t write_type,
|
||||
esp_gatt_auth_req_t auth_req);
|
||||
|
||||
|
||||
@ -522,9 +641,7 @@ esp_err_t esp_ble_gattc_write_char( esp_gatt_if_t gattc_if,
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id : connection ID
|
||||
* @param[in] srvc_id : service ID.
|
||||
* @param[in] char_id : characteristic ID.
|
||||
* @param[in] descr_id : characteristic descriptor ID to write.
|
||||
* @param[in] handle : descriptor hadle to write.
|
||||
* @param[in] value_len: length of the value to be written.
|
||||
* @param[in] value : the value to be written.
|
||||
* @param[in] write_type : the type of attribute write operation.
|
||||
@ -537,9 +654,7 @@ esp_err_t esp_ble_gattc_write_char( esp_gatt_if_t gattc_if,
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_write_char_descr (esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
esp_gatt_srvc_id_t *srvc_id,
|
||||
esp_gatt_id_t *char_id,
|
||||
esp_gatt_id_t *descr_id,
|
||||
uint16_t handle,
|
||||
uint16_t value_len,
|
||||
uint8_t *value,
|
||||
esp_gatt_write_type_t write_type,
|
||||
@ -551,8 +666,7 @@ esp_err_t esp_ble_gattc_write_char_descr (esp_gatt_if_t gattc_if,
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id : connection ID.
|
||||
* @param[in] srvc_id : service ID.
|
||||
* @param[in] char_id : GATT characteristic ID of the service.
|
||||
* @param[in] handle : charateristic handle to prepare write.
|
||||
* @param[in] offset : offset of the write value.
|
||||
* @param[in] value_len: length of the value to be written.
|
||||
* @param[in] value : the value to be written.
|
||||
@ -563,10 +677,9 @@ esp_err_t esp_ble_gattc_write_char_descr (esp_gatt_if_t gattc_if,
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_prepare_write(esp_gatt_if_t gattc_if,
|
||||
esp_err_t esp_ble_gattc_prepare_write(esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
esp_gatt_srvc_id_t *srvc_id,
|
||||
esp_gatt_id_t *char_id,
|
||||
uint16_t handle,
|
||||
uint16_t offset,
|
||||
uint16_t value_len,
|
||||
uint8_t *value,
|
||||
@ -578,9 +691,7 @@ esp_err_t esp_ble_gattc_prepare_write(esp_gatt_if_t gattc_if,
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id : connection ID.
|
||||
* @param[in] srvc_id : service ID.
|
||||
* @param[in] char_id : GATT characteristic ID of the service.
|
||||
* @param[in] descr_id : characteristic descriptor ID to write.
|
||||
* @param[in] handle : characteristic descriptor hanlde to prepare write.
|
||||
* @param[in] offset : offset of the write value.
|
||||
* @param[in] value_len: length of the value to be written.
|
||||
* @param[in] value : the value to be written.
|
||||
@ -593,9 +704,7 @@ esp_err_t esp_ble_gattc_prepare_write(esp_gatt_if_t gattc_if,
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_prepare_write_char_descr(esp_gatt_if_t gattc_if,
|
||||
uint16_t conn_id,
|
||||
esp_gatt_srvc_id_t *srvc_id,
|
||||
esp_gatt_id_t *char_id,
|
||||
esp_gatt_id_t *descr_id,
|
||||
uint16_t handle,
|
||||
uint16_t offset,
|
||||
uint16_t value_len,
|
||||
uint8_t *value,
|
||||
@ -622,8 +731,7 @@ esp_err_t esp_ble_gattc_execute_write (esp_gatt_if_t gattc_if, uint16_t conn_id,
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] server_bda : target GATT server.
|
||||
* @param[in] srvc_id : pointer to GATT service ID.
|
||||
* @param[in] char_id : pointer to GATT characteristic ID.
|
||||
* @param[in] handle : GATT characteristic handle.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: registration succeeds
|
||||
@ -631,9 +739,8 @@ esp_err_t esp_ble_gattc_execute_write (esp_gatt_if_t gattc_if, uint16_t conn_id,
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gattc_if,
|
||||
esp_bd_addr_t server_bda,
|
||||
esp_gatt_srvc_id_t *srvc_id,
|
||||
esp_gatt_id_t *char_id);
|
||||
esp_bd_addr_t server_bda,
|
||||
uint16_t handle);
|
||||
|
||||
|
||||
/**
|
||||
@ -641,8 +748,7 @@ esp_err_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gattc_if,
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] server_bda : target GATT server.
|
||||
* @param[in] srvc_id : pointer to GATT service ID.
|
||||
* @param[in] char_id : pointer to GATT characteristic ID.
|
||||
* @param[in] handle : GATT characteristic handle.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: unregister succeeds
|
||||
@ -650,9 +756,8 @@ esp_err_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gattc_if,
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_unregister_for_notify (esp_gatt_if_t gattc_if,
|
||||
esp_bd_addr_t server_bda,
|
||||
esp_gatt_srvc_id_t *srvc_id,
|
||||
esp_gatt_id_t *char_id);
|
||||
esp_bd_addr_t server_bda,
|
||||
uint16_t handle);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include "bt_types.h"
|
||||
#include "allocator.h"
|
||||
#include "fixed_queue.h"
|
||||
#include "osi.h"
|
||||
#include "future.h"
|
||||
///// LEGACY DEFINITIONS /////
|
||||
|
@ -124,6 +124,8 @@ typedef UINT8 tL2CAP_CHNL_DATA_RATE;
|
||||
*/
|
||||
#define L2C_INVALID_PSM(psm) (((psm) & 0x0101) != 0x0001)
|
||||
#define L2C_IS_VALID_PSM(psm) (((psm) & 0x0101) == 0x0001)
|
||||
#define L2C_IS_VALID_LE_PSM(psm) (((psm) > 0x0000) && ((psm) < 0x0100))
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** Type Definitions
|
||||
@ -164,6 +166,17 @@ typedef struct {
|
||||
UINT16 flags; /* bit 0: 0-no continuation, 1-continuation */
|
||||
} tL2CAP_CFG_INFO;
|
||||
|
||||
/* Define a structure to hold the configuration parameter for LE L2CAP connection
|
||||
** oriented channels.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
UINT16 mtu;
|
||||
UINT16 mps;
|
||||
UINT16 credits;
|
||||
} tL2CAP_LE_CFG_INFO;
|
||||
|
||||
|
||||
/* L2CAP channel configured field bitmap */
|
||||
#define L2CAP_CH_CFG_MASK_MTU 0x0001
|
||||
#define L2CAP_CH_CFG_MASK_QOS 0x0002
|
||||
@ -486,6 +499,72 @@ extern BOOLEAN L2CA_DisconnectReq (UINT16 cid);
|
||||
extern BOOLEAN L2CA_DisconnectRsp (UINT16 cid);
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function L2CA_RegisterLECoc
|
||||
**
|
||||
** Description Other layers call this function to register for L2CAP
|
||||
** Connection Oriented Channel.
|
||||
**
|
||||
** Returns PSM to use or zero if error. Typically, the PSM returned
|
||||
** is the same as was passed in, but for an outgoing-only
|
||||
** connection to a dynamic PSM, a "virtual" PSM is returned
|
||||
** and should be used in the calls to L2CA_ConnectLECocReq()
|
||||
** and BTM_SetSecurityLevel().
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 L2CA_RegisterLECoc (UINT16 psm, tL2CAP_APPL_INFO *p_cb_info);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function L2CA_DeregisterLECoc
|
||||
**
|
||||
** Description Other layers call this function to deregister for L2CAP
|
||||
** Connection Oriented Channel.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void L2CA_DeregisterLECoc (UINT16 psm);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function L2CA_ConnectLECocReq
|
||||
**
|
||||
** Description Higher layers call this function to create an L2CAP LE COC.
|
||||
** Note that the connection is not established at this time, but
|
||||
** connection establishment gets started. The callback function
|
||||
** will be invoked when connection establishes or fails.
|
||||
**
|
||||
** Returns the CID of the connection, or 0 if it failed to start
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 L2CA_ConnectLECocReq (UINT16 psm, BD_ADDR p_bd_addr, tL2CAP_LE_CFG_INFO *p_cfg);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function L2CA_ConnectLECocRsp
|
||||
**
|
||||
** Description Higher layers call this function to accept an incoming
|
||||
** L2CAP LE COC connection, for which they had gotten an connect
|
||||
** indication callback.
|
||||
**
|
||||
** Returns TRUE for success, FALSE for failure
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN L2CA_ConnectLECocRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid, UINT16 result,
|
||||
UINT16 status, tL2CAP_LE_CFG_INFO *p_cfg);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function L2CA_GetPeerLECocConfig
|
||||
**
|
||||
** Description Get peers configuration for LE Connection Oriented Channel.
|
||||
**
|
||||
** Return value: TRUE if peer is connected
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN L2CA_GetPeerLECocConfig (UINT16 lcid, tL2CAP_LE_CFG_INFO* peer_cfg);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -34,6 +34,17 @@
|
||||
|
||||
#define L2CAP_MIN_MTU 48 /* Minimum acceptable MTU is 48 bytes */
|
||||
|
||||
/* LE credit based L2CAP connection parameters */
|
||||
#define L2CAP_LE_MIN_MTU 23
|
||||
#define L2CAP_LE_MIN_MPS 23
|
||||
#define L2CAP_LE_MAX_MPS 65533
|
||||
#define L2CAP_LE_MIN_CREDIT 0
|
||||
#define L2CAP_LE_MAX_CREDIT 65535
|
||||
#define L2CAP_LE_DEFAULT_MTU 512
|
||||
#define L2CAP_LE_DEFAULT_MPS 23
|
||||
#define L2CAP_LE_DEFAULT_CREDIT 1
|
||||
|
||||
|
||||
/* Timeouts. Since L2CAP works off a 1-second list, all are in seconds.
|
||||
*/
|
||||
#define L2CAP_LINK_ROLE_SWITCH_TOUT 10 /* 10 seconds */
|
||||
@ -240,6 +251,17 @@ typedef struct {
|
||||
tL2CAP_APPL_INFO api;
|
||||
} tL2C_RCB;
|
||||
|
||||
typedef void (tL2CAP_SEC_CBACK) (BD_ADDR bd_addr, tBT_TRANSPORT trasnport,
|
||||
void *p_ref_data, tBTM_STATUS result);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT16 psm;
|
||||
tBT_TRANSPORT transport;
|
||||
BOOLEAN is_originator;
|
||||
tL2CAP_SEC_CBACK *p_callback;
|
||||
void *p_ref_data;
|
||||
}tL2CAP_SEC_DATA;
|
||||
|
||||
#ifndef L2CAP_CBB_DEFAULT_DATA_RATE_BUFF_QUOTA
|
||||
#define L2CAP_CBB_DEFAULT_DATA_RATE_BUFF_QUOTA 100
|
||||
@ -252,6 +274,8 @@ typedef struct {
|
||||
typedef struct t_l2c_ccb {
|
||||
BOOLEAN in_use; /* TRUE when in use, FALSE when not */
|
||||
tL2C_CHNL_STATE chnl_state; /* Channel state */
|
||||
tL2CAP_LE_CFG_INFO local_conn_cfg; /* Our config for ble conn oriented channel */
|
||||
tL2CAP_LE_CFG_INFO peer_conn_cfg; /* Peer device config ble conn oriented channel */
|
||||
|
||||
struct t_l2c_ccb *p_next_ccb; /* Next CCB in the chain */
|
||||
struct t_l2c_ccb *p_prev_ccb; /* Previous CCB in the chain */
|
||||
@ -400,7 +424,8 @@ typedef struct t_l2c_linkcb {
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
tBLE_ADDR_TYPE ble_addr_type;
|
||||
UINT16 tx_data_len; /* tx data length used in data length extension */
|
||||
|
||||
fixed_queue_t *le_sec_pending_q; /* LE coc channels waiting for security check completion */
|
||||
UINT8 sec_act;
|
||||
#define L2C_BLE_CONN_UPDATE_DISABLE 0x1 /* disable update connection parameters */
|
||||
#define L2C_BLE_NEW_CONN_PARAM 0x2 /* new connection parameter to be set */
|
||||
#define L2C_BLE_UPDATE_PENDING 0x4 /* waiting for connection update finished */
|
||||
@ -488,6 +513,7 @@ typedef struct {
|
||||
UINT16 ble_round_robin_quota; /* Round-robin link quota */
|
||||
UINT16 ble_round_robin_unacked; /* Round-robin unacked */
|
||||
BOOLEAN ble_check_round_robin; /* Do a round robin check */
|
||||
tL2C_RCB ble_rcb_pool[BLE_MAX_L2CAP_CLIENTS]; /* Registration info pool */
|
||||
#endif
|
||||
|
||||
tL2CA_ECHO_DATA_CB *p_echo_data_cb; /* Echo data callback */
|
||||
@ -632,6 +658,12 @@ BOOLEAN l2c_ucd_process_event(tL2C_CCB *p_ccb, UINT16 event, void *p_data);
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
extern void l2cu_send_peer_ble_par_req (tL2C_LCB *p_lcb, UINT16 min_int, UINT16 max_int, UINT16 latency, UINT16 timeout);
|
||||
extern void l2cu_send_peer_ble_par_rsp (tL2C_LCB *p_lcb, UINT16 reason, UINT8 rem_id);
|
||||
extern void l2cu_reject_ble_connection (tL2C_LCB *p_lcb, UINT8 rem_id, UINT16 result);
|
||||
extern void l2cu_send_peer_ble_credit_based_conn_res (tL2C_CCB *p_ccb, UINT16 result);
|
||||
extern void l2cu_send_peer_ble_credit_based_conn_req (tL2C_CCB *p_ccb);
|
||||
extern void l2cu_send_peer_ble_flow_control_credit(tL2C_CCB *p_ccb, UINT16 credit_value);
|
||||
extern void l2cu_send_peer_ble_credit_based_disconn_req(tL2C_CCB *p_ccb);
|
||||
|
||||
#endif
|
||||
|
||||
extern BOOLEAN l2cu_initialize_fixed_ccb (tL2C_LCB *p_lcb, UINT16 fixed_cid, tL2CAP_FCR_OPTS *p_fcr);
|
||||
@ -649,6 +681,9 @@ extern void l2cu_send_feature_req (tL2C_CCB *p_ccb);
|
||||
extern tL2C_RCB *l2cu_allocate_rcb (UINT16 psm);
|
||||
extern tL2C_RCB *l2cu_find_rcb_by_psm (UINT16 psm);
|
||||
extern void l2cu_release_rcb (tL2C_RCB *p_rcb);
|
||||
extern tL2C_RCB *l2cu_allocate_ble_rcb (UINT16 psm);
|
||||
extern tL2C_RCB *l2cu_find_ble_rcb_by_psm (UINT16 psm);
|
||||
|
||||
|
||||
extern UINT8 l2cu_process_peer_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
|
||||
extern void l2cu_process_peer_cfg_rsp (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
|
||||
@ -748,6 +783,13 @@ extern void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status, UINT16
|
||||
UINT16 conn_latency, UINT16 conn_timeout);
|
||||
extern void l2cble_get_conn_param_format_err_from_contoller(UINT8 status, UINT16 handle);
|
||||
|
||||
extern void l2cble_credit_based_conn_req (tL2C_CCB *p_ccb);
|
||||
extern void l2cble_credit_based_conn_res (tL2C_CCB *p_ccb, UINT16 result);
|
||||
extern void l2cble_send_peer_disc_req(tL2C_CCB *p_ccb);
|
||||
extern void l2cble_send_flow_control_credit(tL2C_CCB *p_ccb, UINT16 credit_value);
|
||||
extern BOOLEAN l2ble_sec_access_req(BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originator, tL2CAP_SEC_CBACK *p_callback, void *p_ref_data);
|
||||
|
||||
|
||||
#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,
|
||||
UINT16 latency, UINT16 timeout);
|
||||
|
@ -41,6 +41,10 @@
|
||||
|
||||
#define L2CAP_CMD_BLE_UPDATE_REQ 0x12
|
||||
#define L2CAP_CMD_BLE_UPDATE_RSP 0x13
|
||||
#define L2CAP_CMD_BLE_CREDIT_BASED_CONN_REQ 0x14
|
||||
#define L2CAP_CMD_BLE_CREDIT_BASED_CONN_RES 0x15
|
||||
#define L2CAP_CMD_BLE_FLOW_CTRL_CREDIT 0x16
|
||||
|
||||
|
||||
|
||||
/* Define some packet and header lengths
|
||||
@ -70,6 +74,11 @@
|
||||
#define L2CAP_CMD_BLE_UPD_REQ_LEN 8 /* Min and max interval, latency, tout */
|
||||
#define L2CAP_CMD_BLE_UPD_RSP_LEN 2 /* Result */
|
||||
|
||||
#define L2CAP_CMD_BLE_CREDIT_BASED_CONN_REQ_LEN 10 /* LE_PSM, SCID, MTU, MPS, Init Credit */
|
||||
#define L2CAP_CMD_BLE_CREDIT_BASED_CONN_RES_LEN 10 /* DCID, MTU, MPS, Init credit, Result */
|
||||
#define L2CAP_CMD_BLE_FLOW_CTRL_CREDIT_LEN 4 /* CID, Credit */
|
||||
|
||||
|
||||
|
||||
/* Define the packet boundary flags
|
||||
*/
|
||||
|
Reference in New Issue
Block a user