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_mtu_exchanged

sl_bt_evt_gatt_service

sl_bt_evt_gatt_characteristic

sl_bt_evt_gatt_descriptor

sl_bt_evt_gatt_characteristic_value

sl_bt_evt_gatt_descriptor_value

sl_bt_evt_gatt_procedure_completed

Enumerations#

enum
sl_bt_gatt_read_by_type_request = 0x8
sl_bt_gatt_read_by_type_response = 0x9
sl_bt_gatt_read_request = 0xa
sl_bt_gatt_read_response = 0xb
sl_bt_gatt_read_blob_request = 0xc
sl_bt_gatt_read_blob_response = 0xd
sl_bt_gatt_read_multiple_request = 0xe
sl_bt_gatt_read_multiple_response = 0xf
sl_bt_gatt_write_request = 0x12
sl_bt_gatt_write_response = 0x13
sl_bt_gatt_write_command = 0x52
sl_bt_gatt_prepare_write_request = 0x16
sl_bt_gatt_prepare_write_response = 0x17
sl_bt_gatt_execute_write_request = 0x18
sl_bt_gatt_execute_write_response = 0x19
sl_bt_gatt_handle_value_notification = 0x1b
sl_bt_gatt_handle_value_indication = 0x1d
}

These values indicate which attribute request or response has caused the event.

enum
sl_bt_gatt_disable = 0x0
sl_bt_gatt_notification = 0x1
sl_bt_gatt_indication = 0x2
}

These values define whether the client is to receive notifications or indications from a remote GATT server.

enum
sl_bt_gatt_cancel = 0x0
sl_bt_gatt_commit = 0x1
}

These values define whether the GATT server is to cancel all queued writes or commit all queued writes to a remote database.

Functions#

sl_status_t
sl_bt_gatt_set_max_mtu(uint16_t max_mtu, uint16_t *max_mtu_out)
sl_status_t
sl_status_t
sl_bt_gatt_discover_primary_services_by_uuid(uint8_t connection, size_t uuid_len, const uint8_t *uuid)
sl_status_t
sl_bt_gatt_find_included_services(uint8_t connection, uint32_t service)
sl_status_t
sl_bt_gatt_discover_characteristics(uint8_t connection, uint32_t service)
sl_status_t
sl_bt_gatt_discover_characteristics_by_uuid(uint8_t connection, uint32_t service, size_t uuid_len, const uint8_t *uuid)
sl_status_t
sl_bt_gatt_discover_descriptors(uint8_t connection, uint16_t characteristic)
sl_status_t
sl_bt_gatt_discover_characteristic_descriptors(uint8_t connection, uint16_t start, uint16_t end)
sl_status_t
sl_bt_gatt_set_characteristic_notification(uint8_t connection, uint16_t characteristic, uint8_t flags)
sl_status_t
sl_status_t
sl_bt_gatt_read_characteristic_value(uint8_t connection, uint16_t characteristic)
sl_status_t
sl_bt_gatt_read_characteristic_value_from_offset(uint8_t connection, uint16_t characteristic, uint16_t offset, uint16_t maxlen)
sl_status_t
sl_bt_gatt_read_multiple_characteristic_values(uint8_t connection, size_t characteristic_list_len, const uint8_t *characteristic_list)
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)
sl_status_t
sl_bt_gatt_write_characteristic_value(uint8_t connection, uint16_t characteristic, size_t value_len, const uint8_t *value)
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)
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)
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)
sl_status_t
sl_bt_gatt_execute_characteristic_value_write(uint8_t connection, uint8_t flags)
sl_status_t
sl_bt_gatt_read_descriptor_value(uint8_t connection, uint16_t descriptor)
sl_status_t
sl_bt_gatt_write_descriptor_value(uint8_t connection, uint16_t descriptor, size_t value_len, const uint8_t *value)

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


Definition at line 7946 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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


Definition at line 7973 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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


Definition at line 7985 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[in]max_mtu

Maximum size of Message Transfer Units (MTU) allowed

  • Range: 23 to 250

Default: 247

[out]max_mtu_out

The maximum ATT_MTU selected by the system if this command succeeds

Set the maximum size of ATT Message Transfer Units (MTU). Functionality is the same as sl_bt_gatt_server_set_max_mtu and this setting applies to both GATT client and server. If the given value is too large according to the maximum BGAPI payload size, the system will select the maximum possible value as the maximum ATT_MTU. If the maximum ATT_MTU is larger than 23, the GATT client in the stack will automatically send an MTU exchange request after a Bluetooth connection has been established.

Returns

  • SL_STATUS_OK if successful. Error code otherwise.


Definition at line 8223 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_gatt_discover_primary_services#

sl_status_t sl_bt_gatt_discover_primary_services (uint8_t connection)
Parameters
[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


Definition at line 8243 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[in]connection

Connection handle

[in]uuid_len

Length of data in uuid

[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


Definition at line 8265 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[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


Definition at line 8289 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[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


Definition at line 8313 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[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 uuid

[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


Definition at line 8340 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[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


Definition at line 8365 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[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


Definition at line 8390 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[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:

  • sl_bt_gatt_disable (0x0): Disable notifications and indications

  • sl_bt_gatt_notification (0x1): Notification

  • sl_bt_gatt_indication (0x2): Indication

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.


Definition at line 8426 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_gatt_send_characteristic_confirmation#

sl_status_t sl_bt_gatt_send_characteristic_confirmation (uint8_t connection)
Parameters
[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.


Definition at line 8444 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[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


Definition at line 8474 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[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


Definition at line 8505 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[in]connection

Connection handle

[in]characteristic_list_len

Length of data in characteristic_list

[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


Definition at line 8544 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[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 uuid

[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


Definition at line 8576 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[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 value

[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


Definition at line 8602 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[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 value

[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.


Definition at line 8626 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[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 value

[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


Definition at line 8663 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[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 value

[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


Definition at line 8699 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[in]connection

Connection handle

[in]flags

Enum sl_bt_gatt_execute_write_flag_t. Execute write flag. Values:

  • sl_bt_gatt_cancel (0x0): Cancel all queued writes

  • sl_bt_gatt_commit (0x1): Commit all queued writes

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


Definition at line 8728 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[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


Definition at line 8753 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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)
Parameters
[in]connection

Connection handle

[in]descriptor

GATT characteristic descriptor handle

[in]value_len

Length of data in value

[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


Definition at line 8776 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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_id
Value:
0x00090020

Definition at line 7899 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_gatt_discover_primary_services_id#

#define sl_bt_cmd_gatt_discover_primary_services_id
Value:
0x01090020

Definition at line 7900 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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_id
Value:
0x02090020

Definition at line 7901 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_gatt_find_included_services_id#

#define sl_bt_cmd_gatt_find_included_services_id
Value:
0x10090020

Definition at line 7902 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_gatt_discover_characteristics_id#

#define sl_bt_cmd_gatt_discover_characteristics_id
Value:
0x03090020

Definition at line 7903 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_gatt_discover_characteristics_by_uuid_id#

#define sl_bt_cmd_gatt_discover_characteristics_by_uuid_id
Value:
0x04090020

Definition at line 7904 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_gatt_discover_descriptors_id#

#define sl_bt_cmd_gatt_discover_descriptors_id
Value:
0x06090020

Definition at line 7905 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_gatt_discover_characteristic_descriptors_id#

#define sl_bt_cmd_gatt_discover_characteristic_descriptors_id
Value:
0x14090020

Definition at line 7906 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_gatt_set_characteristic_notification_id#

#define sl_bt_cmd_gatt_set_characteristic_notification_id
Value:
0x05090020

Definition at line 7907 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_gatt_send_characteristic_confirmation_id#

#define sl_bt_cmd_gatt_send_characteristic_confirmation_id
Value:
0x0d090020

Definition at line 7908 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_gatt_read_characteristic_value_id#

#define sl_bt_cmd_gatt_read_characteristic_value_id
Value:
0x07090020

Definition at line 7909 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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_id
Value:
0x12090020

Definition at line 7910 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_gatt_read_multiple_characteristic_values_id#

#define sl_bt_cmd_gatt_read_multiple_characteristic_values_id
Value:
0x11090020

Definition at line 7911 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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_id
Value:
0x08090020

Definition at line 7912 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_gatt_write_characteristic_value_id#

#define sl_bt_cmd_gatt_write_characteristic_value_id
Value:
0x09090020

Definition at line 7913 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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_id
Value:
0x0a090020

Definition at line 7914 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_gatt_prepare_characteristic_value_write_id#

#define sl_bt_cmd_gatt_prepare_characteristic_value_write_id
Value:
0x0b090020

Definition at line 7915 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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_id
Value:
0x13090020

Definition at line 7916 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_gatt_execute_characteristic_value_write_id#

#define sl_bt_cmd_gatt_execute_characteristic_value_write_id
Value:
0x0c090020

Definition at line 7917 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_gatt_read_descriptor_value_id#

#define sl_bt_cmd_gatt_read_descriptor_value_id
Value:
0x0e090020

Definition at line 7918 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_cmd_gatt_write_descriptor_value_id#

#define sl_bt_cmd_gatt_write_descriptor_value_id
Value:
0x0f090020

Definition at line 7919 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_set_max_mtu_id#

#define sl_bt_rsp_gatt_set_max_mtu_id
Value:
0x00090020

Definition at line 7920 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_discover_primary_services_id#

#define sl_bt_rsp_gatt_discover_primary_services_id
Value:
0x01090020

Definition at line 7921 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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_id
Value:
0x02090020

Definition at line 7922 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_find_included_services_id#

#define sl_bt_rsp_gatt_find_included_services_id
Value:
0x10090020

Definition at line 7923 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_discover_characteristics_id#

#define sl_bt_rsp_gatt_discover_characteristics_id
Value:
0x03090020

Definition at line 7924 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_discover_characteristics_by_uuid_id#

#define sl_bt_rsp_gatt_discover_characteristics_by_uuid_id
Value:
0x04090020

Definition at line 7925 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_discover_descriptors_id#

#define sl_bt_rsp_gatt_discover_descriptors_id
Value:
0x06090020

Definition at line 7926 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_discover_characteristic_descriptors_id#

#define sl_bt_rsp_gatt_discover_characteristic_descriptors_id
Value:
0x14090020

Definition at line 7927 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_set_characteristic_notification_id#

#define sl_bt_rsp_gatt_set_characteristic_notification_id
Value:
0x05090020

Definition at line 7928 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_send_characteristic_confirmation_id#

#define sl_bt_rsp_gatt_send_characteristic_confirmation_id
Value:
0x0d090020

Definition at line 7929 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_read_characteristic_value_id#

#define sl_bt_rsp_gatt_read_characteristic_value_id
Value:
0x07090020

Definition at line 7930 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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_id
Value:
0x12090020

Definition at line 7931 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_read_multiple_characteristic_values_id#

#define sl_bt_rsp_gatt_read_multiple_characteristic_values_id
Value:
0x11090020

Definition at line 7932 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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_id
Value:
0x08090020

Definition at line 7933 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_write_characteristic_value_id#

#define sl_bt_rsp_gatt_write_characteristic_value_id
Value:
0x09090020

Definition at line 7934 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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_id
Value:
0x0a090020

Definition at line 7935 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_prepare_characteristic_value_write_id#

#define sl_bt_rsp_gatt_prepare_characteristic_value_write_id
Value:
0x0b090020

Definition at line 7936 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/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_id
Value:
0x13090020

Definition at line 7937 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_execute_characteristic_value_write_id#

#define sl_bt_rsp_gatt_execute_characteristic_value_write_id
Value:
0x0c090020

Definition at line 7938 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_read_descriptor_value_id#

#define sl_bt_rsp_gatt_read_descriptor_value_id
Value:
0x0e090020

Definition at line 7939 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h

sl_bt_rsp_gatt_write_descriptor_value_id#

#define sl_bt_rsp_gatt_write_descriptor_value_id
Value:
0x0f090020

Definition at line 7940 of file /mnt/raid/workspaces/ws.iUTchugV0/overlay/gsdk/protocol/bluetooth/build_release/bt_api/sw/bgapi/inc/sl_bt_api.h