GATT Interface Functions
GATT_IF API Brief
Application |
Brief |
|---|---|
read GATT service include information |
|
read GATT service data |
|
read GATT characters data |
|
register a GATT service |
|
unregister a GATT service |
|
GATT server send notify |
|
GATT server send indicate |
|
read GATT server specific attribute data |
GATT_IF API Reference
Header File
Functions
-
int16_t btif_gatts_attr_read_included(btif_att_chan_info_t *p_att_chan, const void *p_attr, uint8_t *p_buf, uint16_t len, uint16_t offset, uint16_t svs_end_handle)
btif_gatts_attr_read_included brief description
read GATT service include information
- 参数:
p_att_chan – [in] ATT L2CAP channel information struct
p_attr – [in] buffer for GATT service include information
p_buf – [out] buffer data for read result
len – [in] data length of p_buf try to get
offset – [in] offset for p_attr
svs_end_handle – [in] service end index
- 返回值:
> – 0 data length
other – error index (0 - @ERR_INVALID_OFFSET)
- 返回:
read length or error index
-
int16_t btif_gatt_server_rd_service(btif_att_chan_info_t *p_att_chan, const void *p_attr, uint8_t *buf, uint16_t len, uint16_t offset, uint16_t svs_end_handle)
btif_gatt_server_rd_service brief description
read GATT service data
- 参数:
p_att_chan – [in] ATT L2CAP channel information struct
p_attr – [in] buffer for GATT service data
buf – [out] buffer data for read result
len – [in] data length of p_buf try to get
offset – [in] offset for p_attr
svs_end_handle – [in] service end index
- 返回值:
> – 0 data length
other – error index (0 - @ERR_INVALID_OFFSET)
- 返回:
read length or error index
-
int16_t btif_gatt_server_rd_characters(btif_att_chan_info_t *p_att_chan, const void *p_attr, uint8_t *buf, uint16_t len, uint16_t offset, uint16_t svs_end_handle)
btif_gatt_server_rd_characters brief description
read GATT characters data
- 参数:
p_att_chan – [in] ATT L2CAP channel information struct
p_attr – [in] buffer for GATT characters data
buf – [out] buffer data for read result
len – [in] data length of p_buf try to get
offset – [in] offset for p_attr
svs_end_handle – [in] service end index
- 返回值:
> – 0 data length
other – error index (0 - @ERR_INVALID_OFFSET)
- 返回:
read length or error index
-
btif_ret_t btif_gatt_server_register_service(btif_gatt_service_t *p_service)
btif_gatt_server_register_service brief description
register a GATT service
- 参数:
p_service – [in] GATT service data struct
- 返回值:
0 – success
-1 – fail
- 返回:
result
-
btif_ret_t btif_gatt_server_unregister_service(btif_gatt_service_t *p_service)
btif_gatt_server_unregister_service brief description
unregister a GATT service
- 参数:
p_service – [in] GATT service data struct
- 返回值:
0 – success
-1 – fail
- 返回:
result
-
btif_ret_t btif_gatt_server_send_notify(uint16_t hci_handle, btif_gatt_nty_t *p_para)
btif_gatt_server_send_notify brief description
GATT server send notify
- 参数:
hci_handle – [in] connection handle
p_para – [in] GATT notify strcut
- 返回值:
0 – success
-1 – fail
- 返回:
result
-
btif_ret_t btif_gatt_server_send_indicate(uint16_t hci_handle, btif_gatt_ind_t *p_para)
btif_gatt_server_send_indicate brief description
GATT server send indicate
- 参数:
hci_handle – [in] connection handle
p_para – [in] GATT indicate strcut
- 返回值:
0 – success
-1 – fail
- 返回:
result
-
int16_t btif_gatt_server_read_attr(uint8_t *p_dst_buf, uint16_t dst_len, uint8_t *p_src_buf, uint16_t src_len, uint16_t rd_offset)
btif_gatt_server_read_attr brief description
read GATT server specific attribute data
- 参数:
p_dst_buf – [out] buffer for destination data
dst_len – [in] destination data length
p_src_buf – [in] buffer for source data
src_len – [in] source data length
rd_offset – [in] read offset for source data
- 返回值:
> – 0 data length
other – error index (0 - @ERR_INVALID_OFFSET)
- 返回:
read length or error index
Structures
-
struct btif_att_chan_info_t
ATT channel information struct.
Public Members
-
uint16_t handle
connection handle
-
btif_le_bd_addr_t remote_addr
remote BT address
-
uint16_t tx_mtu
TX MTU size
-
uint16_t rx_mtu
RX MTU size
-
uint16_t handle
-
struct btif_attr_const_t
GATT attribute configured data struct.
Public Members
-
btif_uuid_t *p_uuid
UUID value
-
btif_att_read_fp p_read
callback function for ATT read command
-
btif_att_write_fp p_write
callback function for ATT write command
-
uint8_t permission
permission setting for attribute
-
btif_uuid_t *p_uuid
-
struct btif_attr_t
GATT attribute data struct.
Public Members
-
const btif_attr_const_t *p_const_attr
attribute configured data
-
void *p_user_data
data buffer for attribute user defined
-
uint16_t attr_handle
attribute handle index
-
const btif_attr_const_t *p_const_attr
-
struct btif_gatt_ind_t
GATT indicate data struct.
Public Members
-
const btif_attr_t *p_attr
GATT attribute information
-
btif_att_indicate_cb_fp func
indicate done callback function
-
const void *p_data
data buffer will be sent
-
uint16_t len
data length of p_data
-
void *p_user_data
data buffer for user data
-
const btif_attr_t *p_attr
-
struct btif_gatt_nty_t
GATT notify data struct.
Public Members
-
const btif_attr_t *p_attr
GATT attribute information
-
const void *p_data
data buffer will be sent
-
uint16_t len
data length of p_data
-
btif_att_tx_cb_fp tx_cb
notify done callback function
-
const btif_attr_t *p_attr
-
struct btif_gatt_service_t
GATT service information struct.
Public Members
-
dl_list_t dlst_node
node for application handler will be linked to orthers
-
uint16_t svs_end_handle
service handle end value
-
btif_attr_t *p_attr
service attribute struct
-
uint8_t attr_count
attribute count
-
dl_list_t dlst_node
-
struct btif_gatt_charac_t
GATT character information struct.
Public Members
-
btif_uuid_t *p_uuid
character’s UUID
-
uint16_t value_handle
handel index
-
uint8_t properties
character properties
-
btif_uuid_t *p_uuid
Macros
-
BTIF_GATT_CCC_NTF
-
BTIF_GATT_CCC_IND
-
BTIF_GATT_ERR(att_err)
-
BTIF_UUID_GATT_PRIMARY
-
BTIF_UUID_GATT_SECONDARY
-
BTIF_UUID_GATT_INCLUDE
-
BTIF_UUID_GATT_CHRC
-
BTIF_UUID_GATT_CCC
-
BTIF_UUID_GATT_CPF
-
BTIF_GATT_CHARAC_INIT(_uuid, _props)
-
BTIF_CONST_ATTR(_uuid, _perm, _read, _write)
-
BTIF_GATT_ATTRIBUTE(_uuid, _perm, _read, _write, _p_user_data, _att_handle)
-
BTIF_GATT_PRIMARY_SERVICE(_service)
-
BTIF_GATT_SECONDARY_SERVICE(_service)
-
BTIF_GATT_CHARACTERISTIC(_uuid, _props, _perm, _read, _write, _user_data)
-
BTIF_GATT_DESCRIPTOR(_uuid, _perm, _read, _write, _user_data)
-
BTIF_GATT_INCLUDE_SERVICE(_service_incl)
-
BTIF_GATT_CCC(_perm, _read, _write, _user_data)
-
BTIF_GATT_CPF(_perm, _read, _write, _user_data)
Type Definitions
-
typedef void (*btif_att_indicate_cb_fp)(void *p_att_chan, void *p_para, uint8_t err)
-
typedef void (*btif_att_tx_cb_fp)(btif_att_chan_info_t *p_att_chan, void *p_user_data)
-
typedef int16_t (*btif_att_read_fp)(btif_att_chan_info_t *p_att_chan, const void *p_gatt_svc, uint8_t *p_buf, uint16_t len, uint16_t offset, uint16_t svs_end_handle)
-
typedef int16_t (*btif_att_write_fp)(btif_att_chan_info_t *p_att_chan, const void *p_gatt_svc, const uint8_t *p_buf, uint16_t len, uint16_t offset, uint8_t w_flags, uint16_t svs_end_handle)