![]() |
BLE5.2 1.0
开发文档说明
|
GATT client APIs source code Copyright (c) 2022 - 2025, XinChip All rights reserved. 更多...
函数 | |
| uint16_t | xc_ble_gatt_user_cli_register (uint16_t pref_mtu, uint8_t prio_level, const gatt_cli_cb_t *p_cb, uint8_t *p_user_lid) |
| Command used to register a GATT user. This must be done prior to any GATT procedure execution. | |
| uint16_t | xc_ble_gatt_user_unregister (uint8_t user_lid) |
| Command used to unregister a GATT user (client or server). | |
| uint16_t | xc_ble_gatt_cli_discover_svc (uint8_t conidx, uint8_t user_lid, uint16_t dummy, uint8_t disc_type, bool full, uint16_t start_hdl, uint16_t end_hdl, uint8_t uuid_type, const uint8_t *p_uuid) |
| Command used by a GATT client user to discover primary or secondary services, exposed by peer device in its attribute database. | |
| uint16_t | xc_ble_gatt_cli_discover_inc_svc (uint8_t conidx, uint8_t user_lid, uint16_t dummy, uint16_t start_hdl, uint16_t end_hdl) |
| Command used by a GATT client user to discover included services, exposed by peer device in its attribute database. | |
| uint16_t | xc_ble_gatt_cli_discover_char (uint8_t conidx, uint8_t user_lid, uint16_t dummy, uint8_t disc_type, uint16_t start_hdl, uint16_t end_hdl, uint8_t uuid_type, const uint8_t *p_uuid) |
| Command used by a GATT client user to discover all or according to a specific UUID characteristics exposed by peer device in its attribute database. | |
| uint16_t | xc_ble_gatt_cli_discover_desc (uint8_t conidx, uint8_t user_lid, uint16_t dummy, uint16_t start_hdl, uint16_t end_hdl) |
| Command used by a GATT client user to discover characteristic descriptor exposed by peer device in its attribute database. | |
| uint16_t | xc_ble_gatt_cli_discover_cancel (uint8_t conidx, uint8_t user_lid, uint16_t dummy) |
| Command used by a GATT client user to cancel an on-going discovery procedure. The dummy parameter in the request must be equals to dummy parameter used for service discovery command. | |
| uint16_t | xc_ble_gatt_cli_read (uint8_t conidx, uint8_t user_lid, uint16_t dummy, uint16_t hdl, uint16_t offset, uint16_t length) |
| Command used by a GATT client user to read value of an attribute (identified by its handle) present in peer database. | |
| uint16_t | xc_ble_gatt_cli_read_by_uuid (uint8_t conidx, uint8_t user_lid, uint16_t dummy, uint16_t start_hdl, uint16_t end_hdl, uint8_t uuid_type, const uint8_t *p_uuid) |
| Command used by a GATT client user to read value of an attribute with a given UUID in peer database. | |
| uint16_t | xc_ble_gatt_cli_write (uint8_t conidx, uint8_t user_lid, uint16_t dummy, uint8_t write_type, uint16_t hdl, uint16_t length, const uint8_t *p_data) |
| Command used by a GATT client user to request to write value of an attribute in peer database. | |
| uint16_t | xc_ble_gatt_cli_event_register (uint8_t conidx, uint8_t user_lid, uint16_t start_hdl, uint16_t end_hdl) |
| Command used by a GATT client user to register for reception of events (notification / indication) for a given handle range. | |
| uint16_t | xc_ble_gatt_cli_event_unregister (uint8_t conidx, uint8_t user_lid, uint16_t start_hdl, uint16_t end_hdl) |
| Command used by a GATT client user to stop reception of events (notification / indication) onto a specific handle range. | |
| uint16_t | xc_ble_gatt_cli_mtu_exch (uint8_t conidx, uint8_t user_lid) |
| Request a MTU exchange on legacy attribute bearer. There is no callback executed when the procedure is over. | |
| uint16_t | xc_ble_gatt_cli_indicate_cfm (uint8_t conidx, uint8_t user_lid, uint16_t token) |
| Upper layer provide status of attribute event handled by GATT client user. confirmation of indicate by GATT client. | |
GATT client APIs source code Copyright (c) 2022 - 2025, XinChip All rights reserved.
在文件 xc_gatt_client_api.c 中定义.
| uint16_t xc_ble_gatt_cli_discover_cancel | ( | uint8_t | conidx, |
| uint8_t | user_lid, | ||
| uint16_t | dummy | ||
| ) |
Command used by a GATT client user to cancel an on-going discovery procedure. The dummy parameter in the request must be equals to dummy parameter used for service discovery command.
The discovery is aborted as soon as on-going discovery attribute transaction is over.
Wait for
| [in] | conidx | Connection index |
| [in] | user_lid | GATT User Local identifier |
| [in] | dummy | Dummy parameter whose meaning is upper layer dependent and which is returned in command complete. |
在文件 xc_gatt_client_api.c 第 58 行定义.
| uint16_t xc_ble_gatt_cli_discover_char | ( | uint8_t | conidx, |
| uint8_t | user_lid, | ||
| uint16_t | dummy, | ||
| uint8_t | disc_type, | ||
| uint16_t | start_hdl, | ||
| uint16_t | end_hdl, | ||
| uint8_t | uuid_type, | ||
| const uint8_t * | p_uuid | ||
| ) |
Command used by a GATT client user to discover all or according to a specific UUID characteristics exposed by peer device in its attribute database.
The discovery is done between start handle and end handle range. For a complete discovery start handle must be set to 0x0001 and end handle to 0xFFFF.
Wait for
| [in] | conidx | Connection index |
| [in] | user_lid | GATT User Local identifier |
| [in] | dummy | Dummy parameter whose meaning is upper layer dependent and which is returned in command complete. |
| [in] | disc_type | GATT characteristic discovery type ( |
| [in] | start_hdl | Search start handle |
| [in] | end_hdl | Search end handle |
| [in] | uuid_type | UUID Type ( |
| [in] | p_uuid | Pointer to searched Attribute Value UUID (meaningful only for discovery by UUID) |
在文件 xc_gatt_client_api.c 第 42 行定义.
| uint16_t xc_ble_gatt_cli_discover_desc | ( | uint8_t | conidx, |
| uint8_t | user_lid, | ||
| uint16_t | dummy, | ||
| uint16_t | start_hdl, | ||
| uint16_t | end_hdl | ||
| ) |
Command used by a GATT client user to discover characteristic descriptor exposed by peer device in its attribute database.
The discovery is done between start handle and end handle range. For a complete discovery start handle must be set to 0x0001 and end handle to 0xFFFF.
Wait for
| [in] | conidx | Connection index |
| [in] | user_lid | GATT User Local identifier |
| [in] | dummy | Dummy parameter whose meaning is upper layer dependent and which is returned in command complete. |
| [in] | start_hdl | Search start handle |
| [in] | end_hdl | Search end handle |
在文件 xc_gatt_client_api.c 第 51 行定义.
| uint16_t xc_ble_gatt_cli_discover_inc_svc | ( | uint8_t | conidx, |
| uint8_t | user_lid, | ||
| uint16_t | dummy, | ||
| uint16_t | start_hdl, | ||
| uint16_t | end_hdl | ||
| ) |
Command used by a GATT client user to discover included services, exposed by peer device in its attribute database.
The discovery is done between start handle and end handle range. For a complete discovery start handle must be set to 0x0001 and end handle to 0xFFFF.
Wait for
| [in] | conidx | Connection index |
| [in] | user_lid | GATT User Local identifier |
| [in] | dummy | Dummy parameter whose meaning is upper layer dependent and which is returned in command complete. |
| [in] | start_hdl | Search start handle |
| [in] | end_hdl | Search end handle |
在文件 xc_gatt_client_api.c 第 34 行定义.
| uint16_t xc_ble_gatt_cli_discover_svc | ( | uint8_t | conidx, |
| uint8_t | user_lid, | ||
| uint16_t | dummy, | ||
| uint8_t | disc_type, | ||
| bool | full, | ||
| uint16_t | start_hdl, | ||
| uint16_t | end_hdl, | ||
| uint8_t | uuid_type, | ||
| const uint8_t * | p_uuid | ||
| ) |
Command used by a GATT client user to discover primary or secondary services, exposed by peer device in its attribute database.
All services can be discovered or filtering services having a specific UUID. The discovery is done between start handle and end handle range. For a complete discovery start handle must be set to 0x0001 and end handle to 0xFFFF.
Wait for
| [in] | conidx | Connection index |
| [in] | user_lid | GATT User Local identifier |
| [in] | dummy | Dummy parameter whose meaning is upper layer dependent and which is returned in command complete. |
| [in] | disc_type | GATT Service discovery type ( |
| [in] | full | Perform discovery of all information present in the service (True: enable, False: disable) |
| [in] | start_hdl | Search start handle |
| [in] | end_hdl | Search end handle |
| [in] | uuid_type | UUID Type ( |
| [in] | p_uuid | Pointer to searched Service UUID (meaningful only for discovery by UUID) |
在文件 xc_gatt_client_api.c 第 25 行定义.
| uint16_t xc_ble_gatt_cli_event_register | ( | uint8_t | conidx, |
| uint8_t | user_lid, | ||
| uint16_t | start_hdl, | ||
| uint16_t | end_hdl | ||
| ) |
Command used by a GATT client user to register for reception of events (notification / indication) for a given handle range.
| [in] | conidx | Connection index |
| [in] | user_lid | GATT User Local identifier |
| [in] | start_hdl | Attribute start handle |
| [in] | end_hdl | Attribute end handle |
在文件 xc_gatt_client_api.c 第 99 行定义.
| uint16_t xc_ble_gatt_cli_event_unregister | ( | uint8_t | conidx, |
| uint8_t | user_lid, | ||
| uint16_t | start_hdl, | ||
| uint16_t | end_hdl | ||
| ) |
Command used by a GATT client user to stop reception of events (notification / indication) onto a specific handle range.
| [in] | conidx | Connection index |
| [in] | user_lid | GATT User Local identifier |
| [in] | start_hdl | Attribute start handle |
| [in] | end_hdl | Attribute end handle |
在文件 xc_gatt_client_api.c 第 105 行定义.
| uint16_t xc_ble_gatt_cli_indicate_cfm | ( | uint8_t | conidx, |
| uint8_t | user_lid, | ||
| uint16_t | token | ||
| ) |
Upper layer provide status of attribute event handled by GATT client user. confirmation of indicate by GATT client.
| [in] | conidx | Connection index |
| [in] | user_lid | GATT User Local identifier |
| [in] | token | Procedure token provided in corresponding callback |
在文件 xc_gatt_client_api.c 第 116 行定义.
| uint16_t xc_ble_gatt_cli_mtu_exch | ( | uint8_t | conidx, |
| uint8_t | user_lid | ||
| ) |
Request a MTU exchange on legacy attribute bearer. There is no callback executed when the procedure is over.
| [in] | conidx | Connection index |
| [in] | user_lid | GATT User Local identifier |
在文件 xc_gatt_client_api.c 第 111 行定义.
| uint16_t xc_ble_gatt_cli_read | ( | uint8_t | conidx, |
| uint8_t | user_lid, | ||
| uint16_t | dummy, | ||
| uint16_t | hdl, | ||
| uint16_t | offset, | ||
| uint16_t | length | ||
| ) |
Command used by a GATT client user to read value of an attribute (identified by its handle) present in peer database.
Wait for
| [in] | conidx | Connection index |
| [in] | user_lid | GATT User Local identifier |
| [in] | dummy | Dummy parameter whose meaning is upper layer dependent and which is returned in command complete. |
| [in] | hdl | Attribute handle |
| [in] | offset | Value offset |
| [in] | length | Value length to read (0 = read all) |
在文件 xc_gatt_client_api.c 第 64 行定义.
| uint16_t xc_ble_gatt_cli_read_by_uuid | ( | uint8_t | conidx, |
| uint8_t | user_lid, | ||
| uint16_t | dummy, | ||
| uint16_t | start_hdl, | ||
| uint16_t | end_hdl, | ||
| uint8_t | uuid_type, | ||
| const uint8_t * | p_uuid | ||
| ) |
Command used by a GATT client user to read value of an attribute with a given UUID in peer database.
Wait for
| [in] | conidx | Connection index |
| [in] | user_lid | GATT User Local identifier |
| [in] | dummy | Dummy parameter whose meaning is upper layer dependent and which is returned in command complete. |
| [in] | start_hdl | Search start handle |
| [in] | end_hdl | Search end handle |
| [in] | uuid_type | UUID Type ( |
| [in] | p_uuid | Pointer to searched attribute UUID (LSB First) |
在文件 xc_gatt_client_api.c 第 70 行定义.
| uint16_t xc_ble_gatt_cli_write | ( | uint8_t | conidx, |
| uint8_t | user_lid, | ||
| uint16_t | dummy, | ||
| uint8_t | write_type, | ||
| uint16_t | hdl, | ||
| uint16_t | length, | ||
| const uint8_t * | p_data | ||
| ) |
Command used by a GATT client user to request to write value of an attribute in peer database.
Since user is not aware of MTU size of the bearer used for attribute transmission it cannot be considered reliable.
For a GATT_WRITE_NO_RESP if attribute bearer max transmission size isn't sufficient, a GATT_WRITE (with response) procedure will be used.
For a GATT_WRITE_SIGNED, if attribute bearer max transmission size isn't sufficient, the procedure is aborted with L2CAP_ERR_INVALID_MTU error code.
Wait for
| [in] | conidx | Connection index |
| [in] | user_lid | GATT User Local identifier |
| [in] | dummy | Dummy parameter whose meaning is upper layer dependent and which is returned in command complete. |
| [in] | write_type | GATT write type ( |
| [in] | hdl | Attribute handle |
| [in] | length | Value length |
| [in] | p_data | Pointer to data value |
在文件 xc_gatt_client_api.c 第 79 行定义.
| uint16_t xc_ble_gatt_user_cli_register | ( | uint16_t | pref_mtu, |
| uint8_t | prio_level, | ||
| const gatt_cli_cb_t * | p_cb, | ||
| uint8_t * | p_user_lid | ||
| ) |
Command used to register a GATT user. This must be done prior to any GATT procedure execution.
A GATT client user can initiate any client procedure, and shall be able to handle all client initiated message events
Same module can register multiple GATT users.
| [in] | pref_mtu | Preferred MTU for attribute exchange. |
| [in] | prio_level | User attribute priority level |
| [in] | p_cb | Pointer to set of callback functions to be used for communication with the GATT server user |
| [out] | p_user_lid | Pointer where GATT user local identifier will be set |
在文件 xc_gatt_client_api.c 第 13 行定义.
| uint16_t xc_ble_gatt_user_unregister | ( | uint8_t | user_lid | ) |
Command used to unregister a GATT user (client or server).
| [in] | user_lid | GATT User Local identifier |
在文件 xc_gatt_client_api.c 第 20 行定义.