Synchronous Client#

Modules#

ATT_MAINTAIN_IN_HOST

Functions#

int32_t
rsi_ble_get_profiles(uint8_t *dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_profiles_list_t *p_prof_list)

This API initiates a command to discover the GATT profiles or services supported by a remote BLE device.

int32_t
rsi_ble_get_profile(uint8_t *dev_addr, uuid_t profile_uuid, profile_descriptors_t *p_profile)

This API initiates a command to discover the specific GATT profile/service of the connected remote BLE device.

int32_t
rsi_ble_get_char_services(uint8_t *dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_char_services_t *p_char_serv_list)

This API initiates a command to get the service characteristics of the connected remote BLE device.

int32_t
rsi_ble_get_inc_services(uint8_t *dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_inc_services_t *p_inc_serv_list)

This API initiates a command to get the supported include services of the connected remote device.

int32_t
rsi_ble_get_char_value_by_uuid(uint8_t *dev_addr, uint16_t start_handle, uint16_t end_handle, uuid_t char_uuid, rsi_ble_resp_att_value_t *p_char_val)

This API initiates a command to get the characteristic value by UUID (char_uuid).

int32_t
rsi_ble_get_att_descriptors(uint8_t *dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_att_descs_t *p_att_desc)

This API initiates a command to get the characteristic descriptors list from the remote device.

int32_t
rsi_ble_get_att_value(uint8_t *dev_addr, uint16_t handle, rsi_ble_resp_att_value_t *p_att_val)

This API initiates a command to get the attribute for a specific handle.

int32_t
rsi_ble_get_multiple_att_values(uint8_t *dev_addr, uint8_t num_of_handlers, const uint16_t *handles, rsi_ble_resp_att_value_t *p_att_vals)

This API initiates a command to get the multiple attribute values by using multiple handles.

int32_t
rsi_ble_get_long_att_value(uint8_t *dev_addr, uint16_t handle, uint16_t offset, rsi_ble_resp_att_value_t *p_att_vals)

Initiates a command to get the long attribute value using handle and offset.

int32_t
rsi_ble_set_att_value(uint8_t *dev_addr, uint16_t handle, uint8_t data_len, const uint8_t *p_data)

Initiates a command to set the attribute value of the remote device.

int32_t
rsi_ble_set_att_cmd(uint8_t *dev_addr, uint16_t handle, uint8_t data_len, const uint8_t *p_data)

This API initiates a command to set the attribute value without waiting for an ACK from the remote device. This is a non-blocking API.

int32_t
rsi_ble_set_att_cmd_async(uint8_t *dev_addr, uint16_t handle, uint8_t data_len, const uint8_t *p_data)

Set the attribute value without waiting for an ACK from the remote device. This is a blocking API. If the API returns an RSI_ERROR_BLE_DEV_BUF_FULL (-31) error, wait until the rsi_ble_on_le_more_data_req_t event is received from the module.

int32_t
rsi_ble_set_long_att_value(uint8_t *dev_addr, uint16_t handle, uint16_t offset, uint8_t data_len, const uint8_t *p_data)

This API initiates a command to set the long attribute value of the remote device.

int32_t
rsi_ble_prepare_write(uint8_t *dev_addr, uint16_t handle, uint16_t offset, uint8_t data_len, const uint8_t *p_data)

This API initiates a command to prepare the attribute value.

int32_t
rsi_ble_execute_write(uint8_t *dev_addr, uint8_t exe_flag)

This API initiates a command to execute the prepared attribute values.

int32_t
rsi_ble_mtu_exchange_resp(uint8_t *dev_addr, uint8_t mtu_size)

This function (Exchange MTU Response) is sent in reply to a received Exchange MTU Request.

Function Documentation#

rsi_ble_get_profiles#

int32_t rsi_ble_get_profiles (uint8_t * dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_profiles_list_t * p_prof_list)

This API initiates a command to discover the GATT profiles or services supported by a remote BLE device.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

remote device address

uint16_t[in]start_handle

start handle (index) of the remote device's service records

uint16_t[in]end_handle

end handle (index) of the remote device's service records

rsi_ble_resp_profiles_list_t *[out]p_prof_list

NULL for p_prof_list because the profiles/services information will be provided through the callback event. Refer to rsi_ble_resp_profiles_list_s structure for more details.

        The discovery results are provided through callback functions:
          - \ref rsi_ble_on_profiles_list_resp_t    - Invoked upon successful retrieval of the profile list.
          - \ref rsi_ble_on_gatt_error_resp_t       - Invoked when an error response is received.

Note

  • This is a non-blocking API, still you need to wait until the callback rsi_ble_on_profiles_list_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.

Note

  • p_prof_list structure should be set to NULL.

Returns

  • The following values are returned:

    • Zero Value - Success

    • Non-Zero Value - Failure

    • 0x4E62 - Invalid Parameters

    • 0x4D04 - BLE not connected

    • 0x4D05 - BLE Socket not available

Note


rsi_ble_get_profile#

int32_t rsi_ble_get_profile (uint8_t * dev_addr, uuid_t profile_uuid, profile_descriptors_t * p_profile)

This API initiates a command to discover the specific GATT profile/service of the connected remote BLE device.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

remote device address

uuid_t[in]profile_uuid

services/profiles which are searched using profile_uuid

profile_descriptors_t *[out]p_profile

NULL for p_profile because the specified profile/service information will be provided through the callback event. Refer to profile_descriptor_s structure for more details.

        The discovery results are provided through callback functions:
          - \ref rsi_ble_on_profile_resp_t    - Invoked upon successful retrieval of the specified profile/service.
          - \ref rsi_ble_on_gatt_error_resp_t - Invoked when an error response is received.

Note

  • This is a non-blocking API, still you need to wait until the callback rsi_ble_on_profile_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.

Note

  • p_profile structure should be set to NULL.

Returns

  • The following values are returned:

    • Zero - Success

    • Non-Zero Value - Failure

    • 0x4E62 - Invalid Parameters

    • 0x4D04 - BLE not connected

    • 0x4D05 - BLE Socket not available

Note


rsi_ble_get_char_services#

int32_t rsi_ble_get_char_services (uint8_t * dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_char_services_t * p_char_serv_list)

This API initiates a command to get the service characteristics of the connected remote BLE device.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

remote device address

uint16_t[in]start_handle

start handle (index) of the remote device's service records

uint16_t[in]end_handle

end handle (index) of the remote device's service records

rsi_ble_resp_char_services_t *[out]p_char_serv_list

NULL for p_char_serv_list because the service characteristics information will be provided through the callback event. Refer to rsi_ble_resp_char_serv_s structure for more details.

        The discovery results are provided through callback functions:
          - \ref rsi_ble_on_char_services_resp_t    - Invoked upon successful retrieval of the service characteristics.
          - \ref rsi_ble_on_gatt_error_resp_t       - Invoked when an error response is received.

Note

  • This is a non-blocking API. Still you need to wait until the callback rsi_ble_on_char_services_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.

Note

  • p_char_serv_list structure should be set to NULL.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

    • 0x4E60 - Invalid Handle range

    • 0x4E62 - Invalid Parameters

    • 0x4D04 - BLE not connected

    • 0x4D05 - BLE Socket not available

Note


rsi_ble_get_inc_services#

int32_t rsi_ble_get_inc_services (uint8_t * dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_inc_services_t * p_inc_serv_list)

This API initiates a command to get the supported include services of the connected remote device.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

remote device address

uint16_t[in]start_handle

start handle (index) of the remote device's service records

uint16_t[in]end_handle

end handle (index) of the remote device's service records

rsi_ble_resp_inc_services_t *[out]p_inc_serv_list

NULL for p_inc_serv_list because the supported include services information will be provided through the callback event. Refer to rsi_ble_resp_inc_serv structure for more details.

        The discovery results are provided through callback functions:
          - \ref rsi_ble_on_inc_services_resp_t    - Invoked upon successful retrieval of the supported include services.
          - \ref rsi_ble_on_gatt_error_resp_t      - Invoked when an error response is received.

Note

  • This is a non-blocking API. Still you need to wait until the callback rsi_ble_on_inc_services_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.

Note

  • p_inc_serv_list structure should be set to NULL.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

    • 0x4E60 - Invalid Handle range

    • 0x4E62 - Invalid Parameters

    • 0x4D04 - BLE not connected

    • 0x4D05 - BLE Socket not available

Note


rsi_ble_get_char_value_by_uuid#

int32_t rsi_ble_get_char_value_by_uuid (uint8_t * dev_addr, uint16_t start_handle, uint16_t end_handle, uuid_t char_uuid, rsi_ble_resp_att_value_t * p_char_val)

This API initiates a command to get the characteristic value by UUID (char_uuid).

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

remote device address

uint16_t[in]start_handle

start handle (index) of the remote device's service records

uint16_t[in]end_handle

end handle (index) of the remote device's service records

uuid_t[in]char_uuid

UUID of the characteristic which can be of sizes 128-bit, 32-bit, or 16-bit.

rsi_ble_resp_att_value_t *[out]p_char_val

NULL for p_char_val because the characteristic value from a specified characteristic service information will be provided through the callback event. Refer to rsi_ble_resp_att_value_s structure for more details.

        The discovery results are provided through callback functions:
          - \ref rsi_ble_on_read_resp_t       - Invoked upon successful retrieval of a characteristic value from a specified characteristic service.
          - \ref rsi_ble_on_gatt_error_resp_t - Invoked when an error response is received.

Note

  • This is a non-blocking API. Still you need to wait until the callback rsi_ble_on_read_resp_t is received to initiate further attribute related transactions such as read operation on the remote device address.

Note

  • p_char_val structure should be set to NULL.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

Note


rsi_ble_get_att_descriptors#

int32_t rsi_ble_get_att_descriptors (uint8_t * dev_addr, uint16_t start_handle, uint16_t end_handle, rsi_ble_resp_att_descs_t * p_att_desc)

This API initiates a command to get the characteristic descriptors list from the remote device.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

remote device address

uint16_t[in]start_handle

start handle (index) of the remote device's service records

uint16_t[in]end_handle

end handle (index) of the remote device's service records

rsi_ble_resp_att_descs_t *[out]p_att_desc

NULL for p_att_desc because the characteristic descriptors list information will be provided through the callback event. Refer to rsi_ble_resp_att_descs_s structure for more details.

        The discovery results are provided through callback functions:
          - \ref rsi_ble_on_att_desc_resp_t   - Invoked upon successful retrieval of the characteristic descriptors list.
          - \ref rsi_ble_on_gatt_error_resp_t - Invoked when an error response is received.

Note

  • This is a non-blocking API. Still you need to wait until the callback rsi_ble_on_att_desc_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.

Note

  • p_att_desc structure should be set to NULL.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

Note


rsi_ble_get_att_value#

int32_t rsi_ble_get_att_value (uint8_t * dev_addr, uint16_t handle, rsi_ble_resp_att_value_t * p_att_val)

This API initiates a command to get the attribute for a specific handle.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

remote device address

uint16_t[in]handle

handle value of the attribute

rsi_ble_resp_att_value_t *[out]p_att_val

NULL for p_att_val because the attribute for the specified handle information will be provided through the callback event. Refer to rsi_ble_resp_att_value_s structure for more details.

        The discovery results are provided through callback functions:
          - \ref rsi_ble_on_read_resp_t       - Invoked upon successful retrieval of the attribute for the specified handle.
          - \ref rsi_ble_on_gatt_error_resp_t - Invoked when an error response is received.

Note

  • This is a non-blocking API. Still you need to wait until the callback rsi_ble_on_read_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.

Note

  • p_att_val structure should be set to NULL.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

Note


rsi_ble_get_multiple_att_values#

int32_t rsi_ble_get_multiple_att_values (uint8_t * dev_addr, uint8_t num_of_handlers, const uint16_t * handles, rsi_ble_resp_att_value_t * p_att_vals)

This API initiates a command to get the multiple attribute values by using multiple handles.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

remote device address

uint8_t[in]num_of_handlers

number of handles in the list

const uint16_t *[in]handles

list of attribute handles

rsi_ble_resp_att_value_t *[out]p_att_vals

NULL for p_att_vals because the multiple attribute values for the specified multiple handles information will be provided through the callback event. Refer to rsi_ble_resp_att_value_s structure for more details.

        The discovery results are provided through callback functions:
          - \ref rsi_ble_on_read_resp_t       - Invoked upon successful retrieval of the multiple attribute values for the specified multiple handles.
          - \ref rsi_ble_on_gatt_error_resp_t - Invoked when an error response is received.

Note

  • This is a non-blocking API, Still you need to wait until the callback rsi_ble_on_read_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.

Note

  • p_att_vals structure should be set to NULL.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

Note


rsi_ble_get_long_att_value#

int32_t rsi_ble_get_long_att_value (uint8_t * dev_addr, uint16_t handle, uint16_t offset, rsi_ble_resp_att_value_t * p_att_vals)

Initiates a command to get the long attribute value using handle and offset.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

Remote device address.

uint16_t[in]handle

Attribute handle.

uint16_t[in]offset

Offset within the attribute value.

rsi_ble_resp_att_value_t *[out]p_att_vals

NULL for p_att_vals because the long attribute value information will be provided through the callback event. Refer to rsi_ble_resp_att_value_s structure for more details.

        The discovery results are provided through callback functions:
          - \ref rsi_ble_on_read_resp_t         – Invoked upon successful retrieval of the long attribute value.
          - \ref rsi_ble_on_gatt_error_resp_t   – Invoked when an error response is received.

Note

  • This is a non-blocking API. Still you need to wait until the callback rsi_ble_on_read_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.

Note

  • p_att_vals structure should be set to NULL.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

Note


rsi_ble_set_att_value#

int32_t rsi_ble_set_att_value (uint8_t * dev_addr, uint16_t handle, uint8_t data_len, const uint8_t * p_data)

Initiates a command to set the attribute value of the remote device.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

Remote device address.

uint16_t[in]handle

Attribute value handle.

uint8_t[in]data_len

Attribute value length.

const uint8_t *[in]p_data

Attribute value.

        The result is provided through callback functions:
          - \ref rsi_ble_on_write_resp_t      – Invoked upon the attribute write action is completed.
          - \ref rsi_ble_on_gatt_error_resp_t – Invoked when an error response is received.

Note

  • This is a non-blocking API. However, you need to wait until the rsi_ble_on_write_resp_t callback is received from the device to initiate further attribute-related transactions on this remote device address.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

Note


rsi_ble_set_att_cmd#

int32_t rsi_ble_set_att_cmd (uint8_t * dev_addr, uint16_t handle, uint8_t data_len, const uint8_t * p_data)

This API initiates a command to set the attribute value without waiting for an ACK from the remote device. This is a non-blocking API.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

remote device address

uint16_t[in]handle

attribute value handle

uint8_t[in]data_len

attribute value length

const uint8_t *[in]p_data

attribute value

        If the API returns RSI_ERROR_BLE_DEV_BUF_FULL (-31) error then wait until the \ref rsi_ble_on_le_more_data_req_t event gets received from the module.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

    • 0x4E60 - Invalid Handle range

    • 0x4E62 - Invalid Parameters

    • 0x4D04 - BLE not connected

    • 0x4D05 - BLE Socket not available

    • 0x4E65 - Invalid Attribute Length When Small Buffer Mode is Configured

Note


rsi_ble_set_att_cmd_async#

int32_t rsi_ble_set_att_cmd_async (uint8_t * dev_addr, uint16_t handle, uint8_t data_len, const uint8_t * p_data)

Set the attribute value without waiting for an ACK from the remote device. This is a blocking API. If the API returns an RSI_ERROR_BLE_DEV_BUF_FULL (-31) error, wait until the rsi_ble_on_le_more_data_req_t event is received from the module.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

- remote device address

uint16_t[in]handle

- attribute value handle

uint8_t[in]data_len

- attribute value length

const uint8_t *[in]p_data

- attribute value

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

    • 0x4E60 - Invalid Handle range

    • 0x4E62 - Invalid Parameters

    • 0x4D04 - BLE not connected

    • 0x4D05 - BLE Socket not available

    • 0x4E65 - Invalid Attribute Length When Small Buffer Mode is Configured

Note


rsi_ble_set_long_att_value#

int32_t rsi_ble_set_long_att_value (uint8_t * dev_addr, uint16_t handle, uint16_t offset, uint8_t data_len, const uint8_t * p_data)

This API initiates a command to set the long attribute value of the remote device.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

remote device address

uint16_t[in]handle

attribute handle

uint16_t[in]offset

attribute value offset

uint8_t[in]data_len

attribute value length

const uint8_t *[in]p_data

attribute value

        The discovery results are provided through callback functions:
          - \ref rsi_ble_on_write_resp_t      - Invoked upon the attribute write action is completed
          - \ref rsi_ble_on_gatt_error_resp_t - Invoked when an error response is received.

Note

  • This is a non-blocking API. Still you need to wait until the callback rsi_ble_on_write_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

Note


rsi_ble_prepare_write#

int32_t rsi_ble_prepare_write (uint8_t * dev_addr, uint16_t handle, uint16_t offset, uint8_t data_len, const uint8_t * p_data)

This API initiates a command to prepare the attribute value.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

Remote device address

uint16_t[in]handle

Attribute handle

uint16_t[in]offset

Attribute value offset

uint8_t[in]data_len

Attribute value length

const uint8_t *[in]p_data

Attribute value

        The discovery results are provided through callback functions:
          - \ref rsi_ble_on_write_resp_t      - Invoked upon successful prepare write operation.
          - \ref rsi_ble_on_gatt_error_resp_t - Invoked when an error response is received.

Note

  • This is a non-blocking API. Still you need to wait until the callback rsi_ble_on_write_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

Note


rsi_ble_execute_write#

int32_t rsi_ble_execute_write (uint8_t * dev_addr, uint8_t exe_flag)

This API initiates a command to execute the prepared attribute values.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

Remote device address

uint8_t[in]exe_flag

Execute flag to write, possible values mentioned below:

  • 0 - BLE_ATT_EXECUTE_WRITE_CANCEL

  • 1 - BLE_ATT_EXECUTE_PENDING_WRITES_IMMEDIATELY

        The discovery results are provided through callback functions:
          - \ref rsi_ble_on_write_resp_t     - Invoked upon successful execute write operation.
          - \ref rsi_ble_on_gatt_error_resp_t - Invoked when an error response is received.

Note

  • This is a non-blocking API. Still you need to wait until the callback rsi_ble_on_write_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

Note


rsi_ble_mtu_exchange_resp#

int32_t rsi_ble_mtu_exchange_resp (uint8_t * dev_addr, uint8_t mtu_size)

This function (Exchange MTU Response) is sent in reply to a received Exchange MTU Request.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

- Remote Device Address

uint8_t[in]mtu_size

- requested MTU value

Returns

  • The following values are returned:

    • 0 - Success

    • 0x4D0C - When RSI_BLE_MTU_EXCHANGE_FROM_HOST BIT is not SET.

    • 0x4D05 - BLE Socket Not Available.

    • Non-Zero Value - Failure

Note