Asynchronous Client#

Functions#

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

Indicate the local value to the remote device. This is a blocking API.

int32_t
rsi_ble_indicate_confirm(const uint8_t *dev_addr)

Send indicate confirmation to the remote device. This is a blocking API.

int32_t
rsi_ble_get_profiles_async(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. The discovery results are provided asynchronously through callback functions:

int32_t
rsi_ble_get_profile_async(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. The discovery results are provided asynchronously through callback functions:

int32_t
rsi_ble_get_char_services_async(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. The discovery results are provided asynchronously through callback functions:

int32_t
rsi_ble_get_inc_services_async(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. The discovery results are provided asynchronously through callback functions:

int32_t
rsi_ble_get_char_value_by_uuid_async(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). The discovery results are provided asynchronously through callback functions:

int32_t
rsi_ble_get_att_descriptors_async(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. The discovery results are provided asynchronously through callback functions:

int32_t
rsi_ble_get_att_value_async(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. The discovery results are provided asynchronously through callback functions:

int32_t
rsi_ble_get_multiple_att_values_async(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. The discovery results are provided asynchronously through callback functions:

int32_t
rsi_ble_get_long_att_value_async(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. The discovery results are provided asynchronously through callback functions:

int32_t
rsi_ble_set_att_value_async(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. The result is provided asynchronously through callback functions:

int32_t
rsi_ble_prepare_write_async(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. The discovery results are provided asynchronously through callback functions:

int32_t
rsi_ble_execute_write_async(uint8_t *dev_addr, uint8_t exe_flag)

This API initiates a command to execute the prepared attribute values. The discovery results are provided asynchronously through callback functions:

Function Documentation#

rsi_ble_indicate_value_sync#

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

Indicate the local value to the remote device. This is a blocking API.

Parameters
TypeDirectionArgument NameDescription
const uint8_t *[in]dev_addr

- remote device address

uint16_t[in]handle

- local attribute handle

uint16_t[in]data_len

- attribute value length

const uint8_t *[in]p_data

- attribute value

        This will not send any confirmation event to the application instead 

        send the status as success on receiving confirmation from remote side.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

    • 0x4D05 - BLE socket not available

    • 0x4E60 - Invalid Handle Range

Note


rsi_ble_indicate_confirm#

int32_t rsi_ble_indicate_confirm (const uint8_t * dev_addr)

Send indicate confirmation to the remote device. This is a blocking API.

Parameters
TypeDirectionArgument NameDescription
const uint8_t *[in]dev_addr

- remote device address

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

    • 0x4D05 - BLE socket not available

Note

  • Refer to the Status Codes section for the above error codes at wiseconnect-status-codes

  • API is required to be called from the application when the "RSI_BLE_INDICATE_CONFIRMATION_FROM_HOST" is enabled in the opermode configurations.


rsi_ble_get_profiles_async#

int32_t rsi_ble_get_profiles_async (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. The discovery results are provided asynchronously through callback functions:

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 asynchronously through the callback event.

  • rsi_ble_on_event_profiles_list_t - Invoked upon successful retrieval of the profile list.

  • rsi_ble_on_gatt_error_resp_t - Invoked when an error response is received. Note

    • Although the results are delivered asynchronously via callbacks, this API is blocking. It waits for the command response before returning control to the application.

    Note

    • The p_prof_list structure should be set to NULL for asynchronous APIs.

    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_async#

int32_t rsi_ble_get_profile_async (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. The discovery results are provided asynchronously through callback functions:

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 asynchronously through the callback event.

  • rsi_ble_on_event_profile_by_uuid_t - Invoked upon successful retrieval of the specified profile/service.

  • rsi_ble_on_gatt_error_resp_t - Invoked when an error response is received. Note

    • Although the results are delivered asynchronously via callbacks, this API is blocking. It waits for the command response before returning control to the application.

    • Pre-conditions:

  • rsi_ble_connect() API needs to be called before this API.

Note

  • p_profile structure should be set to NULL for Asynchronous APIs.

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_async#

int32_t rsi_ble_get_char_services_async (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. The discovery results are provided asynchronously through callback functions:

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 asynchronously through the callback event.

  • rsi_ble_on_event_read_by_inc_services_t - Invoked upon successful retrieval of the service characteristics.

  • rsi_ble_on_gatt_error_resp_t - Invoked when an error response is received. Note

    • Although the results are delivered asynchronously via callbacks, this API is blocking. It waits for the command response before returning control to the application.

    • Pre-conditions:

  • rsi_ble_connect() API needs to be called before this API.

Note

  • p_char_serv_list structure should be set to NULL for Asynchronous APIs.

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_async#

int32_t rsi_ble_get_inc_services_async (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. The discovery results are provided asynchronously through callback functions:

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 asynchronously through the callback event.

Note

  • Although the results are delivered asynchronously via callbacks, this API is blocking. It waits for the command response before returning control to the application.

Note

  • p_inc_serv_list structure should be set to NULL for Asynchronous APIs.

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_async#

int32_t rsi_ble_get_char_value_by_uuid_async (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). The discovery results are provided asynchronously through callback functions:

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

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 asynchronously through the callback event.

Note

  • Although the results are delivered asynchronously via callbacks, this API is blocking. It waits for the command response before returning control to the application.

Note

  • The p_char_val structure should be set to NULL for Asynchronous APIs.

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_att_descriptors_async#

int32_t rsi_ble_get_att_descriptors_async (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. The discovery results are provided asynchronously through callback functions:

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 asynchronously through the callback event.

Note

  • Although the results are delivered asynchronously via callbacks, this API is blocking. It waits for the command response before returning control to the application.

Note

  • The p_att_desc structure should be set to NULL for Asynchronous APIs.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

    • 0x4E60 - Invalid Handle

    • 0x4E62 - Invalid Parameters

    • 0x4D04 - BLE not connected

    • 0x4D05 - BLE Socket not available

Note


rsi_ble_get_att_value_async#

int32_t rsi_ble_get_att_value_async (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. The discovery results are provided asynchronously through callback functions:

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 asynchronously through the callback event.

Note

  • Although the results are delivered asynchronously via callbacks, this API is blocking. It waits for the command response before returning control to the application.

Note

  • The p_att_val structure should be set to NULL for Asynchronous APIs.

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_multiple_att_values_async#

int32_t rsi_ble_get_multiple_att_values_async (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. The discovery results are provided asynchronously through callback functions:

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 asynchronously through the callback event.

Note

  • Although the results are delivered asynchronously via callbacks, this API is blocking. It waits for the command response before returning control to the application.

Note

  • The p_att_vals structure should be set to NULL for asynchronous APIs.

Returns

  • The following values are returned:

    • 0 - Success

    • 0x4E60 - Invalid Handle range

    • 0x4E62 - Invalid Parameters

    • 0x4D04 - BLE not connected

    • 0x4D05 - BLE Socket not available

Note


rsi_ble_get_long_att_value_async#

int32_t rsi_ble_get_long_att_value_async (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. The discovery results are provided asynchronously through callback functions:

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 asynchronously through the callback event.

Note

  • Although the results are delivered asynchronously via callbacks, this API is blocking. It waits for the command response before returning control to the application.

Note

  • The p_att_vals structure should be set to NULL for asynchronous APIs.

Returns

  • Possible return values:

    • 0 Success

    • Non-Zero Failure

    • 0x4E60 Invalid Handle range

    • 0x4E62 Invalid Parameters

    • 0x4D04 BLE not connected

    • 0x4D05 BLE Socket not available

Note


rsi_ble_set_att_value_async#

int32_t rsi_ble_set_att_value_async (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. The result is provided asynchronously through callback functions:

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.

Note

  • Although the results are delivered asynchronously via callbacks, this API is blocking. It waits for the command response before returning control to the application.

Returns

  • Possible return values:

    • 0 Success

    • Non-Zero Failure

    • 0x4E60 Invalid Handle range

    • 0x4E62 Invalid Parameters

    • 0x4D04 BLE not connected

    • 0x4D05 BLE Socket not available

Note


rsi_ble_prepare_write_async#

int32_t rsi_ble_prepare_write_async (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. The discovery results are provided asynchronously through callback functions:

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

Note

  • Although the results are delivered asynchronously via callbacks, this API is blocking. It waits for the command response before returning control to the application.

Returns

  • The following values are returned:

    • 0 - Success

    • 0x4E60 - Invalid Handle range

    • 0x4E62 - Invalid Parameters

    • 0x4D04 - BLE not connected

    • 0x4D05 - BLE Socket not available

Note


rsi_ble_execute_write_async#

int32_t rsi_ble_execute_write_async (uint8_t * dev_addr, uint8_t exe_flag)

This API initiates a command to execute the prepared attribute values. The discovery results are provided asynchronously through callback functions:

Parameters
TypeDirectionArgument NameDescription
uint8_t *[in]dev_addr

- Remote device address

uint8_t[in]exe_flag

- Execute flag to write. The possible values are listed below:

  • 0 - BLE_ATT_EXECUTE_WRITE_CANCEL

  • 1 - BLE_ATT_EXECUTE_PENDING_WRITES_IMMEDIATELY

Note

  • Although the results are delivered asynchronously via callbacks, this API is blocking. It waits for the command response before returning control to the application.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

    • 0x4D05 - BLE Socket not available

Note