GATT Client Asynchronous#
/*==============================================
Functions#
Get the supported profiles / services of the connected remote device asynchronously. rsi_ble_on_event_profiles_list_t callback function will be called after the profiles list event is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_profiles_list_t or rsi_ble_on_gatt_error_resp_t.
Get the specific profile / service of the connected remote device. rsi_ble_one_event_profile_by_uuid_t callback function is called after the service characteristics response is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_one_event_profile_by_uuid_t or rsi_ble_on_gatt_error_resp_t.
Get the service characteristics of the connected / remote device. rsi_ble_on_event_read_by_char_services_t callback function is called after the included service characteristics response is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_read_by_char_services_t or rsi_ble_on_gatt_error_resp_t.
Get the supported include services of the connected / remote device. rsi_ble_on_event_read_by_inc_services_t callback function is called after the service characteristics response is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_read_by_inc_services_t or rsi_ble_on_gatt_error_resp_t.
Get the characteristic value by UUID (char_uuid). rsi_ble_on_event_read_att_value_t callback function is called after the attribute value is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_read_att_value_t or rsi_ble_on_gatt_error_resp_t.
Get the characteristic descriptors list from the remote device. rsi_ble_on_gatt_desc_val_event_t callback function is called after the attribute descriptors response is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_gatt_desc_val_event_t or rsi_ble_on_gatt_error_resp_t.
Get the attribute with a handle. rsi_ble_on_event_read_resp_t callback function is called upon receiving the attribute value. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_read_resp_t or rsi_ble_on_gatt_error_resp_t.
Get the multiple attribute values by using multiple handles. rsi_ble_on_event_read_resp_t callback function is called after the attribute value is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_read_resp_t or rsi_ble_on_gatt_error_resp_t.
Get the long attribute value by using handle and offset. rsi_ble_on_event_read_resp_t callback function is called after the attribute value is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_read_resp_t or rsi_ble_on_gatt_error_resp_t.
Set the attribute value of the remote device. rsi_ble_on_event_write_resp_t callback function is called after the attribute set action is completed. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_write_resp_t or rsi_ble_on_gatt_error_resp_t.
Prepare the attribute value. rsi_ble_on_event_prepare_write_resp_t callback function is called after the prepare attribute write action is completed. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_prepare_write_resp_t or rsi_ble_on_gatt_error_resp_t.
Execute the prepared attribute values. rsi_ble_on_event_write_resp_t callback function is called after the execute attribute write action is completed. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_write_resp_t or rsi_ble_on_gatt_error_resp_t.
Indicate the local value to the remote device. This is a blocking API. This will not send any confirmation event to the application instead send the status as success on receiving confirmation from remote side.
Send indicate confirmation to the remote device. This is a blocking API.
Function Documentation#
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)
Get the supported profiles / services of the connected remote device asynchronously. rsi_ble_on_event_profiles_list_t callback function will be called after the profiles list event is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_profiles_list_t or rsi_ble_on_gatt_error_resp_t.
[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.
Note
p_prof_list structure should be passed as NULL because nothing will be filled in this structure
Returns
0 - Success Non-Zero Value - Failure 0x4E62 - Invalid Parameters 0x4D04 - BLE not connected 0x4D05 - BLE Socket not available
Note
Refer Error Codes section for above error codes Error Codes .
60
of file bluetooth/rsi_ble_gatt_apis.c
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)
Get the specific profile / service of the connected remote device. rsi_ble_one_event_profile_by_uuid_t callback function is called after the service characteristics response is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_one_event_profile_by_uuid_t or rsi_ble_on_gatt_error_resp_t.
[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.
Note
p_profile structure should be passed as NULL because nothing will be filled in this structure
Returns
0 - Success Non-Zero Value - Failure 0x4E62 - Invalid Parameters 0x4D04 - BLE not connected 0x4D05 - BLE Socket not available
Note
Refer Error Codes section for above error codes Error Codes .
102
of file bluetooth/rsi_ble_gatt_apis.c
rsi_ble_get_char_services_async#
rint32_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)
Get the service characteristics of the connected / remote device. rsi_ble_on_event_read_by_char_services_t callback function is called after the included service characteristics response is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_read_by_char_services_t or rsi_ble_on_gatt_error_resp_t.
[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.
Note
p_char_services_list structure should be passed as NULL because nothing will be filled in this structure
Returns
0 - Success Non-Zero Value - Failure 0x4E60 - Invalid Handle range 0x4E62 - Invalid Parameters 0x4D04 - BLE not connected 0x4D05 - BLE Socket not available
Note
Refer Error Codes section for above error codes Error Codes .
143
of file bluetooth/rsi_ble_gatt_apis.c
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)
Get the supported include services of the connected / remote device. rsi_ble_on_event_read_by_inc_services_t callback function is called after the service characteristics response is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_read_by_inc_services_t or rsi_ble_on_gatt_error_resp_t.
[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.
Note
p_inc_serv_list structure should be passed as NULL because nothing will be filled in this structure
Returns
0 - Success Non-Zero Value - Failure 0x4E60 - Invalid Handle range 0x4E62 - Invalid Parameters 0x4D04 - BLE not connected 0x4D05 - BLE Socket not available
Note
Refer Error Codes section for above error codes Error Codes .
189
of file bluetooth/rsi_ble_gatt_apis.c
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)
Get the characteristic value by UUID (char_uuid). rsi_ble_on_event_read_att_value_t callback function is called after the attribute value is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_read_att_value_t or rsi_ble_on_gatt_error_resp_t.
[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.
Note
p_char_value structure should be passed as NULL because nothing will be filled in this structure
Returns
0 - Success Non-Zero Value - Failure 0x4E60 - Invalid Handle range 0x4E62 - Invalid Parameters 0x4D04 - BLE not connected 0x4D05 - BLE Socket not available
Note
Refer Error Codes section for above error codes Error Codes .
238
of file bluetooth/rsi_ble_gatt_apis.c
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)
Get the characteristic descriptors list from the remote device. rsi_ble_on_gatt_desc_val_event_t callback function is called after the attribute descriptors response is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_gatt_desc_val_event_t or rsi_ble_on_gatt_error_resp_t.
[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.
Note
p_att_desc structure should be passed as NULL because nothing will be filled in this structure
Returns
0 - Success Non-Zero Value - Failure 0x4E60 - Invalid Handle range 0x4E62 - Invalid Parameters 0x4D04 - BLE not connected 0x4D05 - BLE Socket not available
Note
Refer Error Codes section for above error codes Error Codes .
286
of file bluetooth/rsi_ble_gatt_apis.c
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)
Get the attribute with a handle. rsi_ble_on_event_read_resp_t callback function is called upon receiving the attribute value. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_read_resp_t or rsi_ble_on_gatt_error_resp_t.
[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.
Note
p_att_val structure should be passed as NULL because nothing will be filled in this structure
Returns
0 - Success Non-Zero Value - Failure 0x4E60 - Invalid Handle range 0x4E62 - Invalid Parameters 0x4D04 - BLE not connected 0x4D05 - BLE Socket not available
Note
Refer Error Codes section for above error codes Error Codes .
328
of file bluetooth/rsi_ble_gatt_apis.c
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, uint16_t * handles, rsi_ble_resp_att_value_t * p_att_vals)
Get the multiple attribute values by using multiple handles. rsi_ble_on_event_read_resp_t callback function is called after the attribute value is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_read_resp_t or rsi_ble_on_gatt_error_resp_t.
[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.
Note
p_att_vals structure should be passed as NULL because nothing will be filled in this structure
Returns
0 - Success 0x4E60 - Invalid Handle range 0x4E62 - Invalid Parameters 0x4D04 - BLE not connected 0x4D05 - BLE Socket not available
Note
Refer Error Codes section for above error codes Error Codes .
368
of file bluetooth/rsi_ble_gatt_apis.c
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)
Get the long attribute value by using handle and offset. rsi_ble_on_event_read_resp_t callback function is called after the attribute value is received. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_read_resp_t or rsi_ble_on_gatt_error_resp_t.
[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.
Note
p_att_vals structure should be passed as NULL because nothing will be filled in this structure
Returns
0 - Success Non-Zero Value - Failure 0x4E60 - Invalid Handle range 0x4E62 - Invalid Parameters 0x4D04 - BLE not connected 0x4D05 - BLE Socket not available
Note
Refer Error Codes section for above error codes Error Codes .
415
of file bluetooth/rsi_ble_gatt_apis.c
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, uint8_t * p_data)
Set the attribute value of the remote device. rsi_ble_on_event_write_resp_t callback function is called after the attribute set action is completed. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_write_resp_t or rsi_ble_on_gatt_error_resp_t.
[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
Note
Refer Error Codes section for above error codes Error Codes .
456
of file bluetooth/rsi_ble_gatt_apis.c
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, uint8_t * p_data)
Prepare the attribute value. rsi_ble_on_event_prepare_write_resp_t callback function is called after the prepare attribute write action is completed. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_prepare_write_resp_t or rsi_ble_on_gatt_error_resp_t.
[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 0x4E60 - Invalid Handle range 0x4E62 - Invalid Parameters 0x4D04 - BLE not connected 0x4D05 - BLE Socket not available
Note
Refer Error Codes section for above error codes Error Codes .
498
of file bluetooth/rsi_ble_gatt_apis.c
rsi_ble_execute_write_async#
int32_t rsi_ble_execute_write_async (uint8_t * dev_addr, uint8_t exe_flag)
Execute the prepared attribute values. rsi_ble_on_event_write_resp_t callback function is called after the execute attribute write action is completed. This is a blocking API and can unblock the application on the reception of the callback functions either rsi_ble_on_event_write_resp_t or rsi_ble_on_gatt_error_resp_t.
[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 0x4D05 - BLE Socket not available
Note
Refer Error Codes section for above error codes Error Codes .
546
of file bluetooth/rsi_ble_gatt_apis.c
rsi_ble_indicate_value_sync#
int32_t rsi_ble_indicate_value_sync (uint8_t * dev_addr, uint16_t handle, uint16_t data_len, uint8_t * p_data)
Indicate the local value to the remote device. This is a blocking API. This will not send any confirmation event to the application instead send the status as success on receiving confirmation from remote side.
[in] | dev_addr | - remote device address |
[in] | handle | - local attribute 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 0x4D05 - BLE socket not available 0x4E60 - Invalid Handle Range
Note
Refer Error Codes section for above error codes Error Codes
1381
of file bluetooth/rsi_ble_gatt_apis.c
rsi_ble_indicate_confirm#
int32_t rsi_ble_indicate_confirm (uint8_t * dev_addr)
Send indicate confirmation to the remote device. This is a blocking API.
[in] | dev_addr | - remote device address |
rsi_ble_connect() API needs to be called before this API.
Returns
0 - Success Non-Zero Value - Failure 0x4D05 - BLE socket not available
Note
Refer Error Codes section for above error codes Error Codes
1416
of file bluetooth/rsi_ble_gatt_apis.c