GATT Client#
GATT Client.
The commands and events in this class are used to browse and manage attributes in a remote GATT server.
Modules#
sl_bt_evt_gatt_characteristic_value
sl_bt_evt_gatt_descriptor_value
sl_bt_evt_gatt_procedure_completed
Enumerations#
These values indicate which attribute request or response has caused the event.
These values define whether the client is to receive notifications or indications from a remote GATT server.
These values define whether the GATT server is to cancel all queued writes or commit all queued writes to a remote database.
Functions#
Macros#
Enumeration Documentation#
sl_bt_gatt_att_opcode_t#
sl_bt_gatt_att_opcode_t
These values indicate which attribute request or response has caused the event.
Enumerator | |
---|---|
sl_bt_gatt_read_by_type_request | (0x8) Read by type request |
sl_bt_gatt_read_by_type_response | (0x9) Read by type response |
sl_bt_gatt_read_request | (0xa) Read request |
sl_bt_gatt_read_response | (0xb) Read response |
sl_bt_gatt_read_blob_request | (0xc) Read blob request |
sl_bt_gatt_read_blob_response | (0xd) Read blob response |
sl_bt_gatt_read_multiple_request | (0xe) Read multiple request |
sl_bt_gatt_read_multiple_response | (0xf) Read multiple response |
sl_bt_gatt_write_request | (0x12) Write request |
sl_bt_gatt_write_response | (0x13) Write response |
sl_bt_gatt_write_command | (0x52) Write command |
sl_bt_gatt_prepare_write_request | (0x16) Prepare write request |
sl_bt_gatt_prepare_write_response | (0x17) Prepare write response |
sl_bt_gatt_execute_write_request | (0x18) Execute write request |
sl_bt_gatt_execute_write_response | (0x19) Execute write response |
sl_bt_gatt_handle_value_notification | (0x1b) Notification |
sl_bt_gatt_handle_value_indication | (0x1d) Indication |
7543
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_client_config_flag_t#
sl_bt_gatt_client_config_flag_t
These values define whether the client is to receive notifications or indications from a remote GATT server.
Enumerator | |
---|---|
sl_bt_gatt_disable | (0x0) Disable notifications and indications |
sl_bt_gatt_notification | (0x1) Notification |
sl_bt_gatt_indication | (0x2) Indication |
7570
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_execute_write_flag_t#
sl_bt_gatt_execute_write_flag_t
These values define whether the GATT server is to cancel all queued writes or commit all queued writes to a remote database.
Enumerator | |
---|---|
sl_bt_gatt_cancel | (0x0) Cancel all queued writes |
sl_bt_gatt_commit | (0x1) Commit all queued writes |
7582
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
Function Documentation#
sl_bt_gatt_set_max_mtu#
sl_status_t sl_bt_gatt_set_max_mtu (uint16_t max_mtu, uint16_t * max_mtu_out)
[in] | max_mtu | Maximum size of MTU in the host stack for GATT client and server
|
[out] | max_mtu_out | The maximum size of MTU selected by the host stack |
Set the maximum size of ATT Message Transfer Units (MTU) in the host stack. The functionality is the same as sl_bt_gatt_server_set_max_mtu and the setting applies to both GATT client and server.
The value will be used as the maximum receive MTU size of the GATT client in ATT_EXCHANGE_MTU_REQ and maximum receive MTU size of the GATT server in ATT_EXCHANGE_MTU_RSP. The ATT_MTU on a connection is 23 when the connection is opened. The GATT client will automatically send an ATT_EXCHANGE_MTU_REQ after a connection is opened if the setting value is larger than 23.
If the given value is too large according to the maximum BGAPI payload size, the host stack will select the maximum possible value.
Returns
SL_STATUS_OK if successful. Error code otherwise.
7825
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_discover_primary_services#
sl_status_t sl_bt_gatt_discover_primary_services (uint8_t connection)
[in] | connection | Connection handle |
Discover all primary services of a remote GATT database. This command generates a unique gatt_service event for every discovered primary service. Received sl_bt_evt_gatt_procedure_completed event indicates that this GATT procedure has successfully completed or failed with an error.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_service - Discovered service from remote GATT database
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
7845
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_discover_primary_services_by_uuid#
sl_status_t sl_bt_gatt_discover_primary_services_by_uuid (uint8_t connection, size_t uuid_len, const uint8_t * uuid)
[in] | connection | Connection handle |
[in] | uuid_len | Length of data in |
[in] | uuid | Service UUID in little endian format |
Discover primary services with the specified UUID in a remote GATT database. This command generates unique gatt_service event for every discovered primary service. Received sl_bt_evt_gatt_procedure_completed event indicates that this GATT procedure was successfully completed or failed with an error.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_service - Discovered service from remote GATT database.
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
7867
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_find_included_services#
sl_status_t sl_bt_gatt_find_included_services (uint8_t connection, uint32_t service)
[in] | connection | Connection handle |
[in] | service | GATT service handle. This value is normally received from the gatt_service event. |
Find the services that are included by a service in a remote GATT database. This command generates a unique gatt_service event for each included service. The received sl_bt_evt_gatt_procedure_completed event indicates that this GATT procedure was successfully completed or failed with an error.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_service - Discovered service from remote GATT database.
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
7891
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_discover_characteristics#
sl_status_t sl_bt_gatt_discover_characteristics (uint8_t connection, uint32_t service)
[in] | connection | Connection handle |
[in] | service | GATT service handle. This value is normally received from the gatt_service event. |
Discover all characteristics of a GATT service from a remote GATT database. This command generates a unique gatt_characteristic event for every discovered characteristic. Received sl_bt_evt_gatt_procedure_completed event indicates that this GATT procedure was successfully completed or failed with an error.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_characteristic - Discovered characteristic from remote GATT database.
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
7915
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_discover_characteristics_by_uuid#
sl_status_t sl_bt_gatt_discover_characteristics_by_uuid (uint8_t connection, uint32_t service, size_t uuid_len, const uint8_t * uuid)
[in] | connection | Connection handle |
[in] | service | GATT service handle. This value is normally received from the gatt_service event. |
[in] | uuid_len | Length of data in |
[in] | uuid | Characteristic UUID in little endian format |
Discover all characteristics of a GATT service in a remote GATT database having the specified UUID. This command generates a unique gatt_characteristic event for every discovered characteristic having the specified UUID. Received sl_bt_evt_gatt_procedure_completed event indicates that this GATT procedure was successfully completed or failed with an error.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_characteristic - Discovered characteristic from remote GATT database.
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
7942
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_discover_descriptors#
sl_status_t sl_bt_gatt_discover_descriptors (uint8_t connection, uint16_t characteristic)
[in] | connection | Connection handle |
[in] | characteristic | GATT characteristic handle. This value is normally received from the gatt_characteristic event. |
Discover all descriptors in a remote GATT database starting from handle. It generates a unique gatt_descriptor event for every discovered descriptor. Received sl_bt_evt_gatt_procedure_completed event indicates that this GATT procedure has successfully completed or failed with an error.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_descriptor - Discovered descriptor from remote GATT database.
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
7967
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_discover_characteristic_descriptors#
sl_status_t sl_bt_gatt_discover_characteristic_descriptors (uint8_t connection, uint16_t start, uint16_t end)
[in] | connection | Connection handle |
[in] | start | GATT characteristic handle. This value is normally received from the gatt_characteristic event. |
[in] | end | GATT characteristic handle. This value is normally received from the gatt_characteristic event. |
Discover all descriptors of a GATT characteristic in a remote GATT database. It generates a unique gatt_descriptor event for every discovered descriptor. Received sl_bt_evt_gatt_procedure_completed event indicates that this GATT procedure has successfully completed or failed with an error.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_descriptor - Discovered descriptor from remote GATT database.
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
7992
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_set_characteristic_notification#
sl_status_t sl_bt_gatt_set_characteristic_notification (uint8_t connection, uint16_t characteristic, uint8_t flags)
[in] | connection | Connection handle |
[in] | characteristic | GATT characteristic handle. This value is normally received from the gatt_characteristic event. |
[in] | flags | Enum sl_bt_gatt_client_config_flag_t. Characteristic client configuration flags. Values:
|
Enable or disable the notifications and indications sent from a remote GATT server. This procedure discovers a characteristic client configuration descriptor and writes the related configuration flags to a remote GATT database. A received sl_bt_evt_gatt_procedure_completed event indicates that this GATT procedure was successfully completed or that it failed with an error.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
sl_bt_evt_gatt_characteristic_value - If an indication or notification has been enabled for a characteristic, this event is triggered whenever an indication or notification is sent by the remote GATT server. The triggering conditions of the GATT server are defined by an upper level, for example by a profile. As a result, it is possible that no values are ever received, or that it may take time, depending on how the server is configured.
8028
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_send_characteristic_confirmation#
sl_status_t sl_bt_gatt_send_characteristic_confirmation (uint8_t connection)
[in] | connection | Connection handle |
Send a confirmation to a remote GATT server after receiving a characteristic indication. The sl_bt_evt_gatt_characteristic_value event carries the att_opcode
containing sl_bt_gatt_handle_value_indication (0x1d), which reveals that an indication has been received and must be confirmed with this command. The confirmation needs to be sent within 30 seconds, otherwise further GATT transactions are not allowed by the remote side.
Returns
SL_STATUS_OK if successful. Error code otherwise.
8046
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_read_characteristic_value#
sl_status_t sl_bt_gatt_read_characteristic_value (uint8_t connection, uint16_t characteristic)
[in] | connection | Connection handle |
[in] | characteristic | GATT characteristic handle. This value is normally received from the gatt_characteristic event. |
Read the value of a characteristic from a remote GATT database. A single sl_bt_evt_gatt_characteristic_value is generated if the characteristic value fits in one ATT PDU. Otherwise, more than one sl_bt_evt_gatt_characteristic_value event is generated because the firmware will automatically use the Read Long Characteristic Values procedure. A received sl_bt_evt_gatt_procedure_completed event indicates that all data was read successfully or that an error response was received.
Note that the GATT client does not verify if the requested attribute is a characteristic value. Therefore, before calling this command, ensure that the attribute handle is for a characteristic value, for example, by performing characteristic discovery.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_characteristic_value - Contains the data of a characteristic sent by the GATT Server.
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
8076
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_read_characteristic_value_from_offset#
sl_status_t sl_bt_gatt_read_characteristic_value_from_offset (uint8_t connection, uint16_t characteristic, uint16_t offset, uint16_t maxlen)
[in] | connection | Connection handle |
[in] | characteristic | GATT characteristic handle. This value is normally received from the gatt_characteristic event. |
[in] | offset | Offset of the characteristic value |
[in] | maxlen | Maximum bytes to read. If this parameter is 0, all characteristic values starting at a given offset will be read. |
Read a partial characteristic value with a specified offset and maximum length from a remote GATT database. It is equivalent to sl_bt_gatt_read_characteristic_value if both the offset and maximum length parameters are 0. A single sl_bt_evt_gatt_characteristic_value event is generated if the value to read fits in one ATT PDU. Otherwise, more than one sl_bt_evt_gatt_characteristic_value events are generated because the firmware will automatically use the Read Long Characteristic Values procedure. A received sl_bt_evt_gatt_procedure_completed event indicates that all data was read successfully or that an error response was received.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_characteristic_value - Contains data of a characteristic sent by the GATT Server.
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
8107
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_read_multiple_characteristic_values#
sl_status_t sl_bt_gatt_read_multiple_characteristic_values (uint8_t connection, size_t characteristic_list_len, const uint8_t * characteristic_list)
[in] | connection | Connection handle |
[in] | characteristic_list_len | Length of data in |
[in] | characteristic_list | List of uint16 characteristic handles each in little endian format. |
Read values of multiple characteristics from a remote GATT database at once. The GATT server returns values in one ATT PDU as the response. If the total set of values is greater than (ATT_MTU - 1) bytes in length, only the first (ATT_MTU - 1) bytes are included. A single sl_bt_evt_gatt_characteristic_value event is generated, in which the characteristic is set to 0 and data in the value parameter is a concatenation of characteristic values in the order they were requested. The received sl_bt_evt_gatt_procedure_completed event indicates either that this GATT procedure was successfully completed or failed with an error.
Use this command only for characteristics values that have a known fixed size, except the last one that could have variable length.
When the remote GATT server is from Silicon Labs Bluetooth stack, the server returns ATT Invalid PDU (0x04) if this command only reads one characteristic value. The server returns ATT Application Error 0x80 if this command reads the value of a user-type characteristic.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_characteristic_value - A concatenation of characteristic values in the order they were requested
sl_bt_evt_gatt_procedure_completed - Procedure was either successfully completed or failed with an error.
8146
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_read_variable_length_characteristic_values#
sl_status_t sl_bt_gatt_read_variable_length_characteristic_values (uint8_t connection, size_t characteristic_list_len, const uint8_t * characteristic_list)
[in] | connection | Connection handle |
[in] | characteristic_list_len | Length of data in |
[in] | characteristic_list | List of uint16 characteristic handles each in little endian format. |
Read multiple variable-length characteristic values from a remote GATT database at once. The remote GATT server returns values in the order they were requested in one ATT PDU as the response. When the GATT client receives the response, it generates an sl_bt_evt_gatt_characteristic_value event for each length-value tuple in the response that contains a characteristic value in full length. If data in the last tuple is truncated, it will be discarded by the host stack. A sl_bt_evt_gatt_procedure_completed event indicates either that this GATT procedure was successfully completed or failed with an error.
When the remote GATT server is from Silicon Labs Bluetooth stack, the server returns ATT Invalid PDU (0x04) if this command only reads one characteristic value.
This command has following limitations in current SDK,
It cannot read all the requested characteristic values if the total length of length-value tuples is greater than the response PDU can take. The GATT client will discard a value in the response if the value is truncated.
The characteristic handle is not correctly reported in an sl_bt_evt_gatt_characteristic_value event generated from this procedure.
When the remote GATT server is from Silicon Labs Bluetooth stack, the server returns ATT Application Error 0x80 if this command tries to read the value of a user-type characteristic.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_characteristic_value - Generated for each length-value tuple in the response that contains a characteristic value in full length. The characteristic handle is set to 0 in this event.
sl_bt_evt_gatt_procedure_completed - Procedure was either successfully completed or failed with an error.
8192
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_read_characteristic_value_by_uuid#
sl_status_t sl_bt_gatt_read_characteristic_value_by_uuid (uint8_t connection, uint32_t service, size_t uuid_len, const uint8_t * uuid)
[in] | connection | Connection handle |
[in] | service | GATT service handle. This value is normally received from the gatt_service event. |
[in] | uuid_len | Length of data in |
[in] | uuid | Characteristic UUID in little endian format |
Read characteristic values of a service from a remote GATT database by giving the UUID of the characteristic and the handle of the service containing this characteristic. If multiple characteristic values are received in one ATT PDU, one sl_bt_evt_gatt_characteristic_value event is generated for each value. If the first characteristic value does not fit in one ATT PDU, the firmware automatically uses the Read Long Characteristic Values procedure and generate more sl_bt_evt_gatt_characteristic_value events until the value has been completely read. A received sl_bt_evt_gatt_procedure_completed event indicates that all data was read successfully or that an error response was received.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_characteristic_value - Contains the data of a characteristic sent by the GATT Server.
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
8224
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_write_characteristic_value#
sl_status_t sl_bt_gatt_write_characteristic_value (uint8_t connection, uint16_t characteristic, size_t value_len, const uint8_t * value)
[in] | connection | Connection handle |
[in] | characteristic | GATT characteristic handle. This value is normally received from the gatt_characteristic event. |
[in] | value_len | Length of data in |
[in] | value | Characteristic value |
Write the value of a characteristic in a remote GATT database. If the value length is greater than (ATT_MTU - 3) and does not fit in one ATT PDU, "write long" GATT procedure is used automatically. Received sl_bt_evt_gatt_procedure_completed event indicates that all data was written successfully or that an error response was received.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
8250
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_write_characteristic_value_without_response#
sl_status_t sl_bt_gatt_write_characteristic_value_without_response (uint8_t connection, uint16_t characteristic, size_t value_len, const uint8_t * value, uint16_t * sent_len)
[in] | connection | Connection handle |
[in] | characteristic | GATT characteristic handle. This value is normally received from the gatt_characteristic event. |
[in] | value_len | Length of data in |
[in] | value | Characteristic value |
[out] | sent_len | The length of data sent to the remote GATT server |
Write the value of a characteristic in a remote GATT server. It does not generate an event. All failures on the server are ignored silently. For example, if an error is generated in the remote GATT server and the given value is not written into the database, no error message will be reported to the local GATT client. Note that this command can't be used to write long values. At most ATT_MTU - 3 number of bytes can be sent once.
Returns
SL_STATUS_OK if successful. Error code otherwise.
8274
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_prepare_characteristic_value_write#
sl_status_t sl_bt_gatt_prepare_characteristic_value_write (uint8_t connection, uint16_t characteristic, uint16_t offset, size_t value_len, const uint8_t * value, uint16_t * sent_len)
[in] | connection | Connection handle |
[in] | characteristic | GATT characteristic handle. This value is normally received from the gatt_characteristic event. |
[in] | offset | Offset of the characteristic value |
[in] | value_len | Length of data in |
[in] | value | Value to write into the specified characteristic of the remote GATT database |
[out] | sent_len | The length of data sent to the remote GATT server |
Add a characteristic value to the write queue of a remote GATT server. It can be used when long attributes need to be written or a set of values needs to be written atomically. At most ATT_MTU - 5 number of bytes can be sent at one time. Writes are executed or canceled with the sl_bt_gatt_execute_characteristic_value_write command. Whether the writes succeed or not is indicated in the response of the sl_bt_gatt_execute_characteristic_value_write command.
In all use cases where the amount of data to transfer fits into the BGAPI payload, use the command sl_bt_gatt_write_characteristic_value to write long values because it transparently performs the prepare_write and execute_write commands.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
8311
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_prepare_characteristic_value_reliable_write#
sl_status_t sl_bt_gatt_prepare_characteristic_value_reliable_write (uint8_t connection, uint16_t characteristic, uint16_t offset, size_t value_len, const uint8_t * value, uint16_t * sent_len)
[in] | connection | Connection handle |
[in] | characteristic | GATT characteristic handle. This value is normally received from the gatt_characteristic event. |
[in] | offset | Offset of the characteristic value |
[in] | value_len | Length of data in |
[in] | value | Value to write into the specified characteristic of the remote GATT database |
[out] | sent_len | The length of data sent to the remote GATT server |
Add a characteristic value to the write queue of a remote GATT server and verify whether the value was correctly received by the server. Received sl_bt_evt_gatt_procedure_completed event indicates that this GATT procedure was successfully completed or failed with an error. Specifically, error code 0x0194 (data_corrupted) will be returned if the value received from the GATT server's response fails to pass the reliable write verification. At most, ATT_MTU - 5 number of bytes can be sent at one time. Writes are executed or canceled with the sl_bt_gatt_execute_characteristic_value_write command. Whether the writes succeed or not is indicated in the response of the sl_bt_gatt_execute_characteristic_value_write command.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
8347
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_execute_characteristic_value_write#
sl_status_t sl_bt_gatt_execute_characteristic_value_write (uint8_t connection, uint8_t flags)
[in] | connection | Connection handle |
[in] | flags | Enum sl_bt_gatt_execute_write_flag_t. Execute write flag. Values:
|
Commit or cancel previously queued writes to a long characteristic of a remote GATT server. Writes are sent to the queue with sl_bt_gatt_prepare_characteristic_value_write command. Content, offset, and length of queued values are validated by this procedure. A received sl_bt_evt_gatt_procedure_completed event indicates that all data was written successfully or that an error response was received.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
8376
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_read_descriptor_value#
sl_status_t sl_bt_gatt_read_descriptor_value (uint8_t connection, uint16_t descriptor)
[in] | connection | Connection handle |
[in] | descriptor | GATT characteristic descriptor handle |
Read the descriptor value of a characteristic in a remote GATT database. A single sl_bt_evt_gatt_descriptor_value event is generated if the descriptor value fits in one ATT PDU. Otherwise, more than one sl_bt_evt_gatt_descriptor_value events are generated because the firmware automatically uses the Read Long Characteristic Values procedure. A received sl_bt_evt_gatt_procedure_completed event indicates that all data was read successfully or that an error response was received.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_descriptor_value - Descriptor value received from the remote GATT server.
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
8401
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_write_descriptor_value#
sl_status_t sl_bt_gatt_write_descriptor_value (uint8_t connection, uint16_t descriptor, size_t value_len, const uint8_t * value)
[in] | connection | Connection handle |
[in] | descriptor | GATT characteristic descriptor handle |
[in] | value_len | Length of data in |
[in] | value | Descriptor value |
Write the value of a characteristic descriptor in a remote GATT database. If the value length is greater than ATT_MTU - 3 and does not fit in one ATT PDU, "write long" GATT procedure is used automatically. Received sl_bt_evt_gatt_procedure_completed event indicates either that all data was written successfully or that an error response was received.
Returns
SL_STATUS_OK if successful. Error code otherwise.
Events
sl_bt_evt_gatt_procedure_completed - Procedure was successfully completed or failed with an error.
8424
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_gatt_get_mtu#
sl_status_t sl_bt_gatt_get_mtu (uint8_t connection, uint16_t * mtu)
[in] | connection | Connection handle |
[out] | mtu | The maximum ATT_MTU used by the connection |
Get the size of ATT Message Transfer Units (MTU) for a connection.
Returns
SL_STATUS_OK if successful. Error code otherwise.
8439
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
Macro Definition Documentation#
sl_bt_cmd_gatt_set_max_mtu_id#
#define sl_bt_cmd_gatt_set_max_mtu_idValue:
0x00090020
7492
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_discover_primary_services_id#
#define sl_bt_cmd_gatt_discover_primary_services_idValue:
0x01090020
7493
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_discover_primary_services_by_uuid_id#
#define sl_bt_cmd_gatt_discover_primary_services_by_uuid_idValue:
0x02090020
7494
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_find_included_services_id#
#define sl_bt_cmd_gatt_find_included_services_idValue:
0x10090020
7495
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_discover_characteristics_id#
#define sl_bt_cmd_gatt_discover_characteristics_idValue:
0x03090020
7496
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_discover_characteristics_by_uuid_id#
#define sl_bt_cmd_gatt_discover_characteristics_by_uuid_idValue:
0x04090020
7497
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_discover_descriptors_id#
#define sl_bt_cmd_gatt_discover_descriptors_idValue:
0x06090020
7498
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_discover_characteristic_descriptors_id#
#define sl_bt_cmd_gatt_discover_characteristic_descriptors_idValue:
0x14090020
7499
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_set_characteristic_notification_id#
#define sl_bt_cmd_gatt_set_characteristic_notification_idValue:
0x05090020
7500
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_send_characteristic_confirmation_id#
#define sl_bt_cmd_gatt_send_characteristic_confirmation_idValue:
0x0d090020
7501
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_read_characteristic_value_id#
#define sl_bt_cmd_gatt_read_characteristic_value_idValue:
0x07090020
7502
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_read_characteristic_value_from_offset_id#
#define sl_bt_cmd_gatt_read_characteristic_value_from_offset_idValue:
0x12090020
7503
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_read_multiple_characteristic_values_id#
#define sl_bt_cmd_gatt_read_multiple_characteristic_values_idValue:
0x11090020
7504
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_read_variable_length_characteristic_values_id#
#define sl_bt_cmd_gatt_read_variable_length_characteristic_values_idValue:
0x16090020
7505
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_read_characteristic_value_by_uuid_id#
#define sl_bt_cmd_gatt_read_characteristic_value_by_uuid_idValue:
0x08090020
7506
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_write_characteristic_value_id#
#define sl_bt_cmd_gatt_write_characteristic_value_idValue:
0x09090020
7507
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_write_characteristic_value_without_response_id#
#define sl_bt_cmd_gatt_write_characteristic_value_without_response_idValue:
0x0a090020
7508
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_prepare_characteristic_value_write_id#
#define sl_bt_cmd_gatt_prepare_characteristic_value_write_idValue:
0x0b090020
7509
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_prepare_characteristic_value_reliable_write_id#
#define sl_bt_cmd_gatt_prepare_characteristic_value_reliable_write_idValue:
0x13090020
7510
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_execute_characteristic_value_write_id#
#define sl_bt_cmd_gatt_execute_characteristic_value_write_idValue:
0x0c090020
7511
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_read_descriptor_value_id#
#define sl_bt_cmd_gatt_read_descriptor_value_idValue:
0x0e090020
7512
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_write_descriptor_value_id#
#define sl_bt_cmd_gatt_write_descriptor_value_idValue:
0x0f090020
7513
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_cmd_gatt_get_mtu_id#
#define sl_bt_cmd_gatt_get_mtu_idValue:
0x15090020
7514
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_set_max_mtu_id#
#define sl_bt_rsp_gatt_set_max_mtu_idValue:
0x00090020
7515
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_discover_primary_services_id#
#define sl_bt_rsp_gatt_discover_primary_services_idValue:
0x01090020
7516
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_discover_primary_services_by_uuid_id#
#define sl_bt_rsp_gatt_discover_primary_services_by_uuid_idValue:
0x02090020
7517
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_find_included_services_id#
#define sl_bt_rsp_gatt_find_included_services_idValue:
0x10090020
7518
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_discover_characteristics_id#
#define sl_bt_rsp_gatt_discover_characteristics_idValue:
0x03090020
7519
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_discover_characteristics_by_uuid_id#
#define sl_bt_rsp_gatt_discover_characteristics_by_uuid_idValue:
0x04090020
7520
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_discover_descriptors_id#
#define sl_bt_rsp_gatt_discover_descriptors_idValue:
0x06090020
7521
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_discover_characteristic_descriptors_id#
#define sl_bt_rsp_gatt_discover_characteristic_descriptors_idValue:
0x14090020
7522
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_set_characteristic_notification_id#
#define sl_bt_rsp_gatt_set_characteristic_notification_idValue:
0x05090020
7523
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_send_characteristic_confirmation_id#
#define sl_bt_rsp_gatt_send_characteristic_confirmation_idValue:
0x0d090020
7524
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_read_characteristic_value_id#
#define sl_bt_rsp_gatt_read_characteristic_value_idValue:
0x07090020
7525
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_read_characteristic_value_from_offset_id#
#define sl_bt_rsp_gatt_read_characteristic_value_from_offset_idValue:
0x12090020
7526
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_read_multiple_characteristic_values_id#
#define sl_bt_rsp_gatt_read_multiple_characteristic_values_idValue:
0x11090020
7527
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_read_variable_length_characteristic_values_id#
#define sl_bt_rsp_gatt_read_variable_length_characteristic_values_idValue:
0x16090020
7528
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_read_characteristic_value_by_uuid_id#
#define sl_bt_rsp_gatt_read_characteristic_value_by_uuid_idValue:
0x08090020
7529
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_write_characteristic_value_id#
#define sl_bt_rsp_gatt_write_characteristic_value_idValue:
0x09090020
7530
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_write_characteristic_value_without_response_id#
#define sl_bt_rsp_gatt_write_characteristic_value_without_response_idValue:
0x0a090020
7531
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_prepare_characteristic_value_write_id#
#define sl_bt_rsp_gatt_prepare_characteristic_value_write_idValue:
0x0b090020
7532
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_prepare_characteristic_value_reliable_write_id#
#define sl_bt_rsp_gatt_prepare_characteristic_value_reliable_write_idValue:
0x13090020
7533
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_execute_characteristic_value_write_id#
#define sl_bt_rsp_gatt_execute_characteristic_value_write_idValue:
0x0c090020
7534
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_read_descriptor_value_id#
#define sl_bt_rsp_gatt_read_descriptor_value_idValue:
0x0e090020
7535
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_write_descriptor_value_id#
#define sl_bt_rsp_gatt_write_descriptor_value_idValue:
0x0f090020
7536
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h
sl_bt_rsp_gatt_get_mtu_id#
#define sl_bt_rsp_gatt_get_mtu_idValue:
0x15090020
7537
of file /mnt/raid/workspaces/ws.cynwT2I6w/overlay/gsdk/protocol/bluetooth/build/native/ble_host/ble_bgapi/inc/sl_bt_api.h