GATT Client#
Functions#
Get the supported profiles / services of the connected remote device. rsi_ble_on_profiles_list_resp_t callback function will be called after the profiles list response is received. This is a non-blocking API, Still user need to wait untill 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.
Get the specific profile / service of the connected remote device. rsi_ble_on_profile_resp_t callback function is called after the service characteristics response is received. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_profile_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
Get the service characteristic services of the connected / remote device. rsi_ble_on_char_services_resp_t callback function is called after the charateristic service response is received. This is a non-blocking API, Still user need to wait untill 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.
Get the supported include services of the connected / remote device. rsi_ble_on_inc_services_resp_t callback function is called after the include service response is received. This is a non-blocking API, Still user need to wait untill 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.
Get the characteristic value by UUID (char_uuid). rsi_ble_on_read_resp_t callback function is called after the attribute value is received. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_read_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
Get the characteristic descriptors list from the remote device. rsi_ble_on_att_desc_resp_t callback function is called after the attribute descriptors response is received. This is a non-blocking API, Still user need to wait untill 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.
Get the attribute by handle. rsi_ble_on_read_resp_t callback function is called upon receiving the attribute value. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_read_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
Get the multiple attribute values by using multiple handles. rsi_ble_on_read_resp_t callback function is called after the attribute value is received. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_read_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
Get the long attribute value by using handle and offset. rsi_ble_on_read_resp_t callback function is called after the attribute value is received. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_read_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
Set the attribute value of the remote device. rsi_ble_on_write_resp_t callback function is called if the attribute set action is completed. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_write_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
Set the attribute value without waiting for an ACK from the remote device. This is a Blocking API. If the API returns RSI_ERROR_BLE_DEV_BUF_FULL (-31) error then wait untill the rsi_ble_on_le_more_data_req_t event gets received from the module.
Set the long attribute value of the remote device. rsi_ble_on_write_resp_t callback function is called after the attribute set action is completed. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_write_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
Prepare the attribute value. rsi_ble_on_write_resp_t callback function is called after the prepare attribute write action is completed. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_write_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
Execute the prepared attribute values. rsi_ble_on_write_resp_t callback function is called after the execute attribute write action is completed. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_write_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
Initiates the MTU exchange request with the remote device. This is a Blocking API and will recive a callback event rsi_ble_on_mtu_event_t as the response for this API.
This function (Exchange MTU Response) is sent in reply to a received Exchange MTU Request.
Function Documentation#
rsi_ble_get_profiles#
nt32_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)
Get the supported profiles / services of the connected remote device. rsi_ble_on_profiles_list_resp_t callback function will be called after the profiles list response is received. This is a non-blocking API, Still user need to wait untill 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.
[in] | dev_addr | - remote device address |
[in] | start_handle | - start handle (index) of the remote device's service records |
[in] | end_handle | - end handle (index) of the remote device's service records |
[out] | p_prof_list | - profiles/services information will be filled in this structure after retrieving from the remote device, please refer rsi_ble_resp_profiles_list_s structure for more info. |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes .
589
of file bluetooth/rsi_ble_gatt_apis.c
rsi_ble_get_profile#
int32_t rsi_ble_get_profile (uint8_t * dev_addr, uuid_t profile_uuid, profile_descriptors_t * p_profile)
Get the specific profile / service of the connected remote device. rsi_ble_on_profile_resp_t callback function is called after the service characteristics response is received. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_profile_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
[in] | dev_addr | - remote device address |
[in] | profile_uuid | - services/profiles which are searched using profile_uuid |
[out] | p_profile | - profile / service information filled in this structure after retrieving from the remote device, please refer profile_descriptor_s structure for more info. |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes .
629
of file bluetooth/rsi_ble_gatt_apis.c
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)
Get the service characteristic services of the connected / remote device. rsi_ble_on_char_services_resp_t callback function is called after the charateristic service response is received. This is a non-blocking API, Still user need to wait untill 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.
[in] | dev_addr | - remote device address |
[in] | start_handle | - start handle (index) of the remote device's service records |
[in] | end_handle | - end handle (index) of the remote device's service records |
[out] | p_char_serv_list | - service characteristics details are filled in this structure, please refer rsi_ble_resp_char_serv_s structure for more info. |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes .
666
of file bluetooth/rsi_ble_gatt_apis.c
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)
Get the supported include services of the connected / remote device. rsi_ble_on_inc_services_resp_t callback function is called after the include service response is received. This is a non-blocking API, Still user need to wait untill 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.
[in] | dev_addr | - remote device address |
[in] | start_handle | - start handle (index) of the remote device's service records |
[in] | end_handle | - end handle (index) of the remote device's service records |
[out] | p_inc_serv_list | - include service characteristics details are filled in this structure, please refer rsi_ble_resp_inc_serv structure for more info. |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes .
708
of file bluetooth/rsi_ble_gatt_apis.c
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)
Get the characteristic value by UUID (char_uuid). rsi_ble_on_read_resp_t callback function is called after the attribute value is received. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_read_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
[in] | dev_addr | - remote device address |
[in] | start_handle | - start handle (index) of the remote device's service records |
[in] | end_handle | - end handle (index) of the remote device's service records |
[in] | char_uuid | - UUID of the characteristic |
[out] | p_char_val | - characteristic value is filled in this structure, please refer rsi_ble_resp_att_value_s structure for more info. |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success Non-Zero Value - Failure If the return value is less than 0
Note
Refer Error Codes section for above error codes Error Codes .
752
of file bluetooth/rsi_ble_gatt_apis.c
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)
Get the characteristic descriptors list from the remote device. rsi_ble_on_att_desc_resp_t callback function is called after the attribute descriptors response is received. This is a non-blocking API, Still user need to wait untill 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.
[in] | dev_addr | - remote device address |
[in] | start_handle | - start handle (index) of the remote device's service records |
[in] | end_handle | - end handle (index) of the remote device's service records |
[out] | p_att_desc | - pointer to characteristic descriptor structure, Please refer rsi_ble_resp_att_descs_s strcuture for more info. |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes .
797
of file bluetooth/rsi_ble_gatt_apis.c
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)
Get the attribute by handle. rsi_ble_on_read_resp_t callback function is called upon receiving the attribute value. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_read_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
[in] | dev_addr | - remote device address |
[in] | handle | - handle value of the attribute |
[out] | p_att_val | - attribute value is filled in this structure, Please refer rsi_ble_resp_att_value_s structure for more info. |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes .
835
of file bluetooth/rsi_ble_gatt_apis.c
rsi_ble_get_multiple_att_values#
int32_t rsi_ble_get_multiple_att_values (uint8_t * dev_addr, uint8_t num_of_handlers, uint16_t * handles, rsi_ble_resp_att_value_t * p_att_vals)
Get the multiple attribute values by using multiple handles. rsi_ble_on_read_resp_t callback function is called after the attribute value is received. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_read_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
[in] | dev_addr | - remote device address |
[in] | num_of_handlers | - number of handles in the list |
[in] | handles | - list of attribute handles |
[out] | p_att_vals | - attribute values filled in this structure, please refer rsi_ble_resp_att_value_s structure for more info. |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes .
872
of file bluetooth/rsi_ble_gatt_apis.c
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)
Get the long attribute value by using handle and offset. rsi_ble_on_read_resp_t callback function is called after the attribute value is received. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_read_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
[in] | dev_addr | - remote device address |
[in] | handle | - attribute handle |
[in] | offset | - offset within the attribute value |
[out] | p_att_vals | - attribute value filled in this structure, please refer rsi_ble_resp_att_value_s structure for more info. |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes .
915
of file bluetooth/rsi_ble_gatt_apis.c
rsi_ble_set_att_value#
int32_t rsi_ble_set_att_value (uint8_t * dev_addr, uint16_t handle, uint8_t data_len, uint8_t * p_data)
Set the attribute value of the remote device. rsi_ble_on_write_resp_t callback function is called if the attribute set action is completed. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_write_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
[in] | dev_addr | - remote device address |
[in] | handle | - attribute value handle |
[in] | data_len | - attribute value length |
[in] | p_data | - attribute value |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes .
953
of file bluetooth/rsi_ble_gatt_apis.c
rsi_ble_set_att_cmd#
int32_t rsi_ble_set_att_cmd (uint8_t * dev_addr, uint16_t handle, uint8_t data_len, 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 RSI_ERROR_BLE_DEV_BUF_FULL (-31) error then wait untill the rsi_ble_on_le_more_data_req_t event gets received from the module.
[in] | dev_addr | - remote device address |
[in] | handle | - attribute value handle |
[in] | data_len | - attribute value length |
[in] | p_data | - attribute value |
rsi_ble_connect() API needs to be called before this API.
Returns
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
Refer Error Codes section for above error codes Error Codes .
992
of file bluetooth/rsi_ble_gatt_apis.c
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, uint8_t * p_data)
Set the long attribute value of the remote device. rsi_ble_on_write_resp_t callback function is called after the attribute set action is completed. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_write_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
[in] | dev_addr | - remote device address |
[in] | handle | - attribute handle |
[in] | offset | - attribute value offset |
[in] | data_len | - attribute value length |
[in] | p_data | - attribute value |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes .
1033
of file bluetooth/rsi_ble_gatt_apis.c
rsi_ble_prepare_write#
int32_t rsi_ble_prepare_write (uint8_t * dev_addr, uint16_t handle, uint16_t offset, uint8_t data_len, uint8_t * p_data)
Prepare the attribute value. rsi_ble_on_write_resp_t callback function is called after the prepare attribute write action is completed. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_write_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
[in] | dev_addr | - remote device address |
[in] | handle | - attribute handle |
[in] | offset | - attribute value offset |
[in] | data_len | - attribute value length |
[in] | p_data | - attribute value |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes .
1082
of file bluetooth/rsi_ble_gatt_apis.c
rsi_ble_execute_write#
int32_t rsi_ble_execute_write (uint8_t * dev_addr, uint8_t exe_flag)
Execute the prepared attribute values. rsi_ble_on_write_resp_t callback function is called after the execute attribute write action is completed. This is a non-blocking API, Still user need to wait untill the callback rsi_ble_on_write_resp_t is received from the device, to initiate further attribute related transactions on this remote device address.
[in] | dev_addr | - remote device address |
[in] | exe_flag | - execute flag to write, possible values mentioned below 0 - BLE_ATT_EXECUTE_WRITE_CANCEL 1 - BLE_ATT_EXECUTE_PENDING_WRITES_IMMEDIATELY |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes .
1124
of file bluetooth/rsi_ble_gatt_apis.c
rsi_ble_mtu_exchange_event#
int32_t rsi_ble_mtu_exchange_event (uint8_t * dev_addr, uint8_t mtu_size)
Initiates the MTU exchange request with the remote device. This is a Blocking API and will recive a callback event rsi_ble_on_mtu_event_t as the response for this API.
[in] | dev_addr | - remote device address |
[in] | mtu_size | - requested MTU value |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success Non-Zero Value - Failure 0x4D04 - BLE not Connected 0x4E62 - Invalid Parameters
Note
Refer Error Codes section for above error codes Error Codes
1617
of file bluetooth/rsi_ble_gatt_apis.c
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.
[in] | dev_addr | - Remote Device Address |
[in] | mtu_size | - requested MTU value |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success 0x4D0C - When RSI_BLE_MTU_EXCHANGE_FROM_HOST BIT is not SET. 0x4D05 - BLE Socket Not Available. Non-Zero Value - Failure Refer Error Codes section for above error codes Error Codes
1645
of file bluetooth/rsi_ble_gatt_apis.c