30#ifndef BTA_GATT_INCLUDED
31#define BTA_GATT_INCLUDED FALSE
35#if ((BLE_INCLUDED == FALSE) && (BTA_GATT_INCLUDED == TRUE))
36#undef BTA_GATT_INCLUDED
37#define BTA_GATT_INCLUDED FALSE
42#define BTA_GATT_DEBUG FALSE
59#define BTA_GATT_OK GATT_SUCCESS
60#define BTA_GATT_INVALID_HANDLE GATT_INVALID_HANDLE
61#define BTA_GATT_READ_NOT_PERMIT GATT_READ_NOT_PERMIT
62#define BTA_GATT_WRITE_NOT_PERMIT GATT_WRITE_NOT_PERMIT
63#define BTA_GATT_INVALID_PDU GATT_INVALID_PDU
64#define BTA_GATT_INSUF_AUTHENTICATION GATT_INSUF_AUTHENTICATION
65#define BTA_GATT_REQ_NOT_SUPPORTED GATT_REQ_NOT_SUPPORTED
66#define BTA_GATT_INVALID_OFFSET GATT_INVALID_OFFSET
67#define BTA_GATT_INSUF_AUTHORIZATION GATT_INSUF_AUTHORIZATION
68#define BTA_GATT_PREPARE_Q_FULL GATT_PREPARE_Q_FULL
69#define BTA_GATT_NOT_FOUND GATT_NOT_FOUND
70#define BTA_GATT_NOT_LONG GATT_NOT_LONG
71#define BTA_GATT_INSUF_KEY_SIZE GATT_INSUF_KEY_SIZE
72#define BTA_GATT_INVALID_ATTR_LEN GATT_INVALID_ATTR_LEN
73#define BTA_GATT_ERR_UNLIKELY GATT_ERR_UNLIKELY
74#define BTA_GATT_INSUF_ENCRYPTION GATT_INSUF_ENCRYPTION
75#define BTA_GATT_UNSUPPORT_GRP_TYPE GATT_UNSUPPORT_GRP_TYPE
76#define BTA_GATT_INSUF_RESOURCE GATT_INSUF_RESOURCE
79#define BTA_GATT_ILLEGAL_PARAMETER GATT_ILLEGAL_PARAMETER
80#define BTA_GATT_NO_RESOURCES GATT_NO_RESOURCES
81#define BTA_GATT_INTERNAL_ERROR GATT_INTERNAL_ERROR
82#define BTA_GATT_WRONG_STATE GATT_WRONG_STATE
83#define BTA_GATT_DB_FULL GATT_DB_FULL
84#define BTA_GATT_BUSY GATT_BUSY
85#define BTA_GATT_ERROR GATT_ERROR
86#define BTA_GATT_CMD_STARTED GATT_CMD_STARTED
87#define BTA_GATT_PENDING GATT_PENDING
88#define BTA_GATT_AUTH_FAIL GATT_AUTH_FAIL
89#define BTA_GATT_MORE GATT_MORE
90#define BTA_GATT_INVALID_CFG GATT_INVALID_CFG
91#define BTA_GATT_DUP_REG 0x008c
92#define BTA_GATT_ALREADY_OPEN 0x008d
93typedef UINT8 tBTA_GATT_STATUS;
95#define BTA_GATT_INVALID_CONN_ID GATT_INVALID_CONN_ID
99#define BTA_GATTC_REG_EVT 0
100#define BTA_GATTC_DEREG_EVT 1
101#define BTA_GATTC_OPEN_EVT 2
102#define BTA_GATTC_READ_CHAR_EVT 3
103#define BTA_GATTC_WRITE_CHAR_EVT 4
104#define BTA_GATTC_CLOSE_EVT 5
105#define BTA_GATTC_SEARCH_CMPL_EVT 6
106#define BTA_GATTC_SEARCH_RES_EVT 7
107#define BTA_GATTC_READ_DESCR_EVT 8
108#define BTA_GATTC_WRITE_DESCR_EVT 9
109#define BTA_GATTC_NOTIF_EVT 10
110#define BTA_GATTC_PREP_WRITE_EVT 11
111#define BTA_GATTC_EXEC_EVT 12
112#define BTA_GATTC_ACL_EVT 13
113#define BTA_GATTC_CANCEL_OPEN_EVT 14
114#define BTA_GATTC_SRVC_CHG_EVT 15
115typedef UINT8 tBTA_GATTC_EVT;
117typedef tGATT_IF tBTA_GATTC_IF;
128#define BTA_GATT_CLT_CONFIG_NONE GATT_CLT_CONFIG_NONE
129#define BTA_GATT_CLT_CONFIG_NOTIFICATION GATT_CLT_CONFIG_NOTIFICATION
130#define BTA_GATT_CLT_CONFIG_INDICATION GATT_CLT_CONFIG_INDICATION
131typedef UINT16 tBTA_GATT_CLT_CHAR_CONFIG;
135#define BTA_GATT_SVR_CONFIG_NONE GATT_SVR_CONFIG_NONE
136#define BTA_GATT_SVR_CONFIG_BROADCAST GATT_SVR_CONFIG_BROADCAST
137typedef UINT16 tBTA_GATT_SVR_CHAR_CONFIG;
141#define BTA_GATT_AGGR_HANDLE_NUM_MAX 10
145 UINT16 handle_list[BTA_GATT_AGGR_HANDLE_NUM_MAX];
155#define BTA_GATT_MAX_ATTR_LEN GATT_MAX_ATTR_LEN
157#define BTA_GATTC_TYPE_WRITE GATT_WRITE
158#define BTA_GATTC_TYPE_WRITE_NO_RSP GATT_WRITE_NO_RSP
159typedef UINT8 tBTA_GATTC_WRITE_TYPE;
161#define BTA_GATT_CONN_UNKNOWN 0
162#define BTA_GATT_CONN_NO_RESOURCES GATT_CONN_NO_RESOURCES
163#define BTA_GATT_CONN_TIMEOUT GATT_CONN_TIMEOUT
164#define BTA_GATT_CONN_TERMINATE_PEER_USER GATT_CONN_TERMINATE_PEER_USER
165#define BTA_GATT_CONN_TERMINATE_LOCAL_HOST GATT_CONN_TERMINATE_LOCAL_HOST
166#define BTA_GATT_CONN_FAIL_ESTABLISH GATT_CONN_FAIL_ESTABLISH
167#define BTA_GATT_CONN_LMP_TIMEOUT GATT_CONN_LMP_TIMEOUT
168#define BTA_GATT_CONN_CANCEL GATT_CONN_CANCEL
169#define BTA_GATT_CONN_NONE 0x0101
170typedef UINT16 tBTA_GATT_REASON;
196#define BTA_GATT_TYPE_CHAR 0
197#define BTA_GATT_TYPE_CHAR_DESCR 1
198typedef UINT8 tBTA_GATT_ID_TYPE;
202 tBTA_GATT_ID_TYPE id_type;
211#define BTA_GATTC_MULTI_MAX GATT_MAX_READ_MULTI_HANDLES
220#define BTA_GATT_AUTH_REQ_NONE GATT_AUTH_REQ_NONE
221#define BTA_GATT_AUTH_REQ_NO_MITM GATT_AUTH_REQ_NO_MITM
222#define BTA_GATT_AUTH_REQ_MITM GATT_AUTH_REQ_MITM
223#define BTA_GATT_AUTH_REQ_SIGNED_NO_MITM GATT_AUTH_REQ_SIGNED_NO_MITM
224#define BTA_GATT_AUTH_REQ_SIGNED_MITM GATT_AUTH_REQ_SIGNED_MITM
226typedef tGATT_AUTH_REQ tBTA_GATT_AUTH_REQ;
230 BTA_GATTC_ATTR_TYPE_INCL_SRVC,
231 BTA_GATTC_ATTR_TYPE_CHAR,
232 BTA_GATTC_ATTR_TYPE_CHAR_DESCR,
233 BTA_GATTC_ATTR_TYPE_SRVC
235typedef UINT8 tBTA_GATTC_ATTR_TYPE;
252 tBTA_GATT_STATUS status;
253 tBTA_GATTC_IF client_if;
275 tBTA_GATT_STATUS status;
285 tBTA_GATT_STATUS status;
294 tBTA_GATT_STATUS status;
300 tBTA_GATT_STATUS status;
312 tBTA_GATT_STATUS status;
314 tBTA_GATTC_IF client_if;
320 tBTA_GATT_STATUS status;
322 tBTA_GATTC_IF client_if;
324 tBTA_GATT_REASON reason;
334 UINT8 value[BTA_GATT_MAX_ATTR_LEN];
341 tBTA_GATT_STATUS status;
342 tBTA_GATTC_IF client_if;
350 tBTA_GATT_STATUS status;
365typedef void (tBTA_GATTC_CBACK)(tBTA_GATTC_EVT event,
tBTA_GATTC *p_data);
370#define BTA_GATTS_REG_EVT 0
371#define BTA_GATTS_READ_EVT GATTS_REQ_TYPE_READ
372#define BTA_GATTS_WRITE_EVT GATTS_REQ_TYPE_WRITE
373#define BTA_GATTS_EXEC_WRITE_EVT GATTS_REQ_TYPE_WRITE_EXEC
374#define BTA_GATTS_MTU_EVT GATTS_REQ_TYPE_MTU
375#define BTA_GATTS_CONF_EVT GATTS_REQ_TYPE_CONF
376#define BTA_GATTS_DEREG_EVT 6
377#define BTA_GATTS_CREATE_EVT 7
378#define BTA_GATTS_ADD_INCL_SRVC_EVT 8
379#define BTA_GATTS_ADD_CHAR_EVT 9
380#define BTA_GATTS_ADD_CHAR_DESCR_EVT 10
381#define BTA_GATTS_DELELTE_EVT 11
382#define BTA_GATTS_START_EVT 12
383#define BTA_GATTS_STOP_EVT 13
384#define BTA_GATTS_CONNECT_EVT 14
385#define BTA_GATTS_DISCONNECT_EVT 15
386#define BTA_GATTS_OPEN_EVT 16
387#define BTA_GATTS_CANCEL_OPEN_EVT 17
388#define BTA_GATTS_CLOSE_EVT 18
390typedef UINT8 tBTA_GATTS_EVT;
391typedef tGATT_IF tBTA_GATTS_IF;
395#define BTA_GATT_PERM_READ GATT_PERM_READ
396#define BTA_GATT_PERM_READ_ENCRYPTED GATT_PERM_READ_ENCRYPTED
397#define BTA_GATT_PERM_READ_ENC_MITM GATT_PERM_READ_ENC_MITM
398#define BTA_GATT_PERM_WRITE GATT_PERM_WRITE
399#define BTA_GATT_PERM_WRITE_ENCRYPTED GATT_PERM_WRITE_ENCRYPTED
400#define BTA_GATT_PERM_WRITE_ENC_MITM GATT_PERM_WRITE_ENC_MITM
401#define BTA_GATT_PERM_WRITE_SIGNED GATT_PERM_WRITE_SIGNED
402#define BTA_GATT_PERM_WRITE_SIGNED_MITM GATT_PERM_WRITE_SIGNED_MITM
403typedef UINT16 tBTA_GATT_PERM;
405#define BTA_GATTS_INVALID_APP 0xff
407#define BTA_GATTS_INVALID_IF 0
410#define BTA_GATT_CHAR_PROP_BIT_BROADCAST GATT_CHAR_PROP_BIT_BROADCAST
411#define BTA_GATT_CHAR_PROP_BIT_READ GATT_CHAR_PROP_BIT_READ
412#define BTA_GATT_CHAR_PROP_BIT_WRITE_NR GATT_CHAR_PROP_BIT_WRITE_NR
413#define BTA_GATT_CHAR_PROP_BIT_WRITE GATT_CHAR_PROP_BIT_WRITE
414#define BTA_GATT_CHAR_PROP_BIT_NOTIFY GATT_CHAR_PROP_BIT_NOTIFY
415#define BTA_GATT_CHAR_PROP_BIT_INDICATE GATT_CHAR_PROP_BIT_INDICATE
416#define BTA_GATT_CHAR_PROP_BIT_AUTH GATT_CHAR_PROP_BIT_AUTH
417#define BTA_GATT_CHAR_PROP_BIT_EXT_PROP GATT_CHAR_PROP_BIT_EXT_PROP
418typedef UINT8 tBTA_GATT_CHAR_PROP;
420#ifndef BTA_GATTC_CHAR_DESCR_MAX
421#define BTA_GATTC_CHAR_DESCR_MAX 7
436#define BTA_GATTS_SRV_CHG_CMD_ADD_CLIENT GATTS_SRV_CHG_CMD_ADD_CLIENT
437#define BTA_GATTS_SRV_CHG_CMD_UPDATE_CLIENT GATTS_SRV_CHG_CMD_UPDATE_CLIENT
438#define BTA_GATTS_SRV_CHG_CMD_REMOVE_CLIENT GATTS_SRV_CHG_CMD_REMOVE_CLIENT
439#define BTA_GATTS_SRV_CHG_CMD_READ_NUM_CLENTS GATTS_SRV_CHG_CMD_READ_NUM_CLENTS
440#define BTA_GATTS_SRV_CHG_CMD_READ_CLENT GATTS_SRV_CHG_CMD_READ_CLENT
441typedef tGATTS_SRV_CHG_CMD tBTA_GATTS_SRV_CHG_CMD;
449 BTA_GATT_TRANSPORT_LE,
450 BTA_GATT_TRANSPORT_BR_EDR,
451 BTA_GATT_TRANSPORT_LE_BR_EDR
453typedef UINT8 tBTA_GATT_TRANSPORT;
462#define BTA_GATT_PREP_WRITE_CANCEL 0x00
463#define BTA_GATT_PREP_WRITE_EXEC 0x01
464typedef tGATT_EXEC_FLAG tBTA_GATT_EXEC_FLAG;
480 tBTA_GATTS_REQ_DATA *p_data;
485 tBTA_GATTS_IF server_if;
486 tBTA_GATT_STATUS status;
495 tBTA_GATTS_IF server_if;
500 tBTA_GATT_STATUS status;
507 tBTA_GATTS_IF server_if;
510 tBTA_GATT_STATUS status;
518 tBTA_GATTS_IF server_if;
520 tBTA_GATT_STATUS status;
526 tBTA_GATTS_IF server_if;
529 tBTA_GATT_REASON reason;
538 tBTA_GATT_STATUS status;
549typedef void (tBTA_GATTS_CBACK)(tBTA_GATTS_EVT event,
tBTA_GATTS *p_data);
576BTA_API
extern void BTA_GATTC_AppRegister(
tBT_UUID *p_app_uuid, tBTA_GATTC_CBACK *p_client_cb);
590BTA_API
extern void BTA_GATTC_AppDeregister (tBTA_GATTC_IF client_if);
606BTA_API
extern void BTA_GATTC_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, BOOLEAN is_direct);
622BTA_API
extern void BTA_GATTC_CancelOpen(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, BOOLEAN is_direct);
635BTA_API
extern void BTA_GATTC_Close(UINT16 conn_id);
653BTA_API
extern void BTA_GATTC_ServiceSearchRequest(UINT16 conn_id,
tBT_UUID *p_srvc_uuid);
673BTA_API
extern tBTA_GATT_STATUS BTA_GATTC_GetFirstChar (UINT16 conn_id,
677 tBTA_GATT_CHAR_PROP *p_property);
698BTA_API
extern tBTA_GATT_STATUS BTA_GATTC_GetNextChar (UINT16 conn_id,
702 tBTA_GATT_CHAR_PROP *p_property);
721BTA_API
extern tBTA_GATT_STATUS BTA_GATTC_GetFirstCharDescr (UINT16 conn_id,
tBTA_GATTC_CHAR_ID *p_char_id,
743BTA_API
extern tBTA_GATT_STATUS BTA_GATTC_GetNextCharDescr (UINT16 conn_id,
766BTA_API
extern tBTA_GATT_STATUS BTA_GATTC_GetFirstIncludedService(UINT16 conn_id,
789BTA_API
extern tBTA_GATT_STATUS BTA_GATTC_GetNextIncludedService(UINT16 conn_id,
807BTA_API
extern void BTA_GATTC_ReadCharacteristic (UINT16 conn_id,
809 tBTA_GATT_AUTH_REQ auth_req);
823BTA_API
extern void BTA_GATTC_ReadCharDescr (UINT16 conn_id,
825 tBTA_GATT_AUTH_REQ auth_req);
842BTA_API
extern void BTA_GATTC_WriteCharValue (UINT16 conn_id,
844 tBTA_GATTC_WRITE_TYPE write_type,
847 tBTA_GATT_AUTH_REQ auth_req);
863BTA_API
extern void BTA_GATTC_WriteCharDescr (UINT16 conn_id,
865 tBTA_GATTC_WRITE_TYPE write_type,
867 tBTA_GATT_AUTH_REQ auth_req);
881BTA_API
extern void BTA_GATTC_SendIndConfirm (UINT16 conn_id,
tBTA_GATTC_CHAR_ID *p_char_id);
896BTA_API
extern tBTA_GATT_STATUS BTA_GATTC_RegisterForNotifications (tBTA_GATTC_IF client_if,
914BTA_API
extern tBTA_GATT_STATUS BTA_GATTC_DeregisterForNotifications (tBTA_GATTC_IF client_if,
933BTA_API
extern void BTA_GATTC_PrepareWrite (UINT16 conn_id,
938 tBTA_GATT_AUTH_REQ auth_req);
952BTA_API
extern void BTA_GATTC_ExecuteWrite (UINT16 conn_id, BOOLEAN is_execute);
967BTA_API
extern void BTA_GATTC_ReadMultiple(UINT16 conn_id,
tBTA_GATTC_MULTI *p_read_multi,
968 tBTA_GATT_AUTH_REQ auth_req);
989 BTA_API
extern void BTA_GATTS_AppRegister(
tBT_UUID *p_app_uuid, tBTA_GATTS_CBACK *p_cback);
1003 BTA_API
extern void BTA_GATTS_AppDeregister(tBTA_GATTS_IF server_if);
1024 BTA_API
extern void BTA_GATTS_CreateService(tBTA_GATTS_IF server_if,
tBT_UUID *p_service_uuid,
1025 UINT8 inst, UINT16 num_handle, BOOLEAN is_primary);
1042 BTA_API
extern void BTA_GATTS_AddIncludeService(UINT16 service_id, UINT16 included_service_id);
1059 BTA_API
extern void BTA_GATTS_AddCharacteristic (UINT16 service_id,
tBT_UUID *p_char_uuid,
1060 tBTA_GATT_PERM perm, tBTA_GATT_CHAR_PROP property);
1079 BTA_API
extern void BTA_GATTS_AddCharDescriptor (UINT16 service_id,
1080 tBTA_GATT_PERM perm,
1095 BTA_API
extern void BTA_GATTS_DeleteService(UINT16 service_id);
1109 BTA_API
extern void BTA_GATTS_StartService(UINT16 service_id, tBTA_GATT_TRANSPORT sup_transport);
1122 BTA_API
extern void BTA_GATTS_StopService(UINT16 service_id);
1139 BTA_API
extern void BTA_GATTS_HandleValueIndication (UINT16 conn_id, UINT16 attr_id,
1142 BOOLEAN need_confirm);
1158 BTA_API
extern void BTA_GATTS_SendRsp (UINT16 conn_id, UINT32 trans_id,
1159 tBTA_GATT_STATUS status, tBTA_GATTS_RSP *p_msg);
1178 BTA_API
extern void BTA_GATTS_Open(tBTA_GATTS_IF server_if, BD_ADDR remote_bda, BOOLEAN is_direct);
1195 BTA_API
extern void BTA_GATTS_CancelOpen(tBTA_GATTS_IF server_if, BD_ADDR remote_bda, BOOLEAN is_direct);
1209 BTA_API
extern void BTA_GATTS_Close(UINT16 conn_id);