GATT Server#

Functions#

int32_t

request to the controller to know the maximum no.of supporting advertising sets

int32_t

request to the controller to know the maximum supporting advertising data length

int32_t
rsi_ble_set_ae_set_random_address(uint8_t handle, uint8_t *rand_addr)

sets the ae set random address

int32_t
rsi_ble_set_ae_params(void *ble_ae_params, int8_t *sel_tx_pwr)

request the local device to set the extended advertising parameters

int32_t
rsi_ble_set_ae_data(void *ble_ae_data)

request the local device to set the AE advertiser data used in advertising PDUs

int32_t

request the local device to enable or disable an advertising set using the advertising sets identified by the Advertising_Handle[i] parameter.

int32_t
rsi_ble_app_adv_set_clear_or_remove(uint8_t type, uint8_t handle)

request the local device to clear or remove the advertising sets based on the type specified

int32_t
rsi_ble_app_set_periodic_ae_params(void *periodic_adv_params)

request the local device to set periodic advertising params

int32_t
rsi_ble_app_set_periodic_ae_enable(uint8_t enable, uint8_t handle)

request the Controller to enable or disable the periodic advertising

int32_t
rsi_ble_ae_set_scan_params(void *ae_scan_params)

sets the extended scan parameters to be used on the advertising physical channels.

int32_t
rsi_ble_ae_set_scan_enable(void *ae_scan_enable)

request the local device to enable or disable scanning for both legacy and extended advertising PDUs

int32_t
rsi_ble_ae_set_periodic_sync(uint8_t type, void *periodic_sync_data)
int32_t

used to add,remove or clear the device to the periodic advertiser list

int32_t

used to read the periodic advertiser list size

int32_t
rsi_ble_extended_connect_with_params(void *ble_extended_conn_params)

This command is used to create an ACL connection, with the local device in the Central role, to a connectable advertiser.

int32_t
int32_t
rsi_ble_write_rf_path_compensation(uint16_t tx_path_value, uint16_t rx_path_value)

used to indicate the RF path gain or loss between the RF transceiver and the antenna contributed by intermediate components

int32_t

Vendor specific BLE command to set bitmap.

int32_t
rsi_ble_add_service(uuid_t service_uuid, rsi_ble_resp_add_serv_t *p_resp_serv)

Add a new service to the local GATT Server. This is a Blocking API.

int32_t
rsi_ble_add_attribute(rsi_ble_req_add_att_t *p_attribute)

Add a new attribute to a specific service. This is a Blocking API.

int32_t
rsi_ble_set_local_att_value(uint16_t handle, uint16_t data_len, uint8_t *p_data)

Change the local attribute value. This is a Blocking API.

int32_t
rsi_ble_set_wo_resp_notify_buf_info(uint8_t *dev_addr, uint8_t buf_mode, uint8_t buf_cnt)

Configure the buf mode for Notify and WO response commands for the remote device. This is a Blocking API.

int32_t
rsi_ble_notify_value(uint8_t *dev_addr, uint16_t handle, uint16_t data_len, uint8_t *p_data)

Notify the local value to 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.

int32_t
rsi_ble_indicate_value(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 and can unblock the application on the reception of the callback functions either rsi_ble_on_event_indicate_confirmation_t.

int32_t
rsi_ble_get_local_att_value(uint16_t handle, rsi_ble_resp_local_att_value_t *p_resp_local_att_val)

Get the local attribute value. This is a Blocking API.

int32_t
rsi_ble_gatt_read_response(uint8_t *dev_addr, uint8_t read_type, uint16_t handle, uint16_t offset, uint16_t length, uint8_t *p_data)

Send the response for the read request received from the remote device. This is a Blocking API.

int32_t
rsi_ble_remove_gatt_service(uint32_t service_handler)

Remove the GATT service record. This is a Blocking API.

int32_t
rsi_ble_remove_gatt_attibute(uint32_t service_handler, uint16_t att_hndl)

Remove the GATT attribute record. This is a Blocking API.

int32_t
rsi_ble_att_error_response(uint8_t *dev_addr, uint16_t handle, uint8_t opcode, uint8_t err)

Send attribute error response for any of the att request. This is a Blocking API.

int32_t
rsi_ble_gatt_write_response(uint8_t *dev_addr, uint8_t type)

Send the response to the write request received from the remote device. This is a Blocking API.

int32_t
rsi_ble_gatt_prepare_write_response(uint8_t *dev_addr, uint16_t handle, uint16_t offset, uint16_t length, uint8_t *data)

Send the response for the prepare write requests received from the remote device. This is a Blocking API.

Function Documentation#

rsi_ble_get_max_no_of_supp_adv_sets#

int32_t rsi_ble_get_max_no_of_supp_adv_sets (uint8_t *resp)

request to the controller to know the maximum no.of supporting advertising sets

Parameters
[in]resp
[out]resp

- Number of Advertising sets supported ,filled by the controller. Possible values of Number of Advertising sets supported : 0x01 to 0xF0

Returns

  • 0 = success !0 = failure

description#

This function requests the controller to know the maximum no.of supporting advertising sets Note

  • : The number of advertising sets that can be supported is not fixed and it can be configured through the Opermodes


Definition at line 1902 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_get_max_adv_data_len#

int32_t rsi_ble_get_max_adv_data_len (uint8_t *resp)

request to the controller to know the maximum supporting advertising data length

Parameters
[in]resp
[out]resp

- filled by the controller Possible values of Maximum Advertising Data Length : 0x001F to 0x0672

Returns

  • 0 = success !0 = failure

description#

This function requests the controller to know the maximum supporting advertising data length


Definition at line 1923 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_set_ae_set_random_address#

rsi_ble_set_ae_set_random_address (uint8_t handle, uint8_t *rand_addr)

sets the ae set random address

Parameters
[in]handle

- Advertising_Handle : Used to identify an advertising set

[in]rand_addr

- Random_Address : Random device address , may be either of static address or Private address

Returns

  • 0 = success !0 = failure

description#

This function is used by the host to set the random device address specified by the Random_Address_parameter


Definition at line 1943 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_set_ae_params#

int32_t rsi_ble_set_ae_params (void *ble_ae_params, int8_t *sel_tx_pwr)

request the local device to set the extended advertising parameters

Parameters
[in]ble_ae_params

- Extended Advertising Parameters command data to be sent is filled in this

[out]sel_tx_pwr

- Selected_TX_Power, selected output tx power, Its units are in dBm and Range : -127 to +20 @

Returns

  • 0 = success !0 = failure

description#

This function requests the local device to set Extended Advertising Parameters


Definition at line 1967 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_set_ae_data#

int32_t rsi_ble_set_ae_data (void *ble_ae_data)

request the local device to set the AE advertiser data used in advertising PDUs

Parameters
[in]ble_ae_data

- Extended Advertising data to be sent is filled in this

Returns

  • 0 = success !0 = failure

description#

This function requests the local device to set the AE advertiser data used in advertising PDUs Note

  • Refer to Bluetooth spec 5.3 for possible combinations ae_adv/scanresp data can be set for .


Definition at line 1988 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_start_ae_advertising#

int32_t rsi_ble_start_ae_advertising (void *adv_enable)

request the local device to enable or disable an advertising set using the advertising sets identified by the Advertising_Handle[i] parameter.

Parameters
[in]adv_enable

- data to be sent is filled in this

Returns

  • 0 = success !0 = failure

description#

This function requests the local device to enable or disable an advertising set using the advertising sets identified by the Advertising_Handle[i] parameter.


Definition at line 2008 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_app_adv_set_clear_or_remove#

int32_t rsi_ble_app_adv_set_clear_or_remove (uint8_t type, uint8_t handle)

request the local device to clear or remove the advertising sets based on the type specified

Parameters
[in]type

- Specifies whether to remove or clear the advertising sets. {1} - clear {2} - remove

[in]handle

- Advertising_Handle - Used to identify an Advertising set. Possible Values : 0x00 to 0xEF

Returns

  • 0 = success !0 = failure

description#

This function requests the local device to clear or remove an advertising set from the controller based on the type specified


Definition at line 2032 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_app_set_periodic_ae_params#

int32_t rsi_ble_app_set_periodic_ae_params (void *periodic_adv_params)

request the local device to set periodic advertising params

Parameters
[in]periodic_adv_params

- Parameters for Periodic Advertising to be filled here.

Returns

  • 0 = success !0 = failure

description#

This function is used by the host to set the parameters for periodic advertising


Definition at line 2054 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_app_set_periodic_ae_enable#

int32_t rsi_ble_app_set_periodic_ae_enable (uint8_t enable, uint8_t handle)

request the Controller to enable or disable the periodic advertising

Parameters
[in]enable

- Enable, BIT map for Enable

           0      -  Enable Periodic Advertising  \n               
           1      -  Include the ADI field in AUX_SYNC_IND PDUs \n

        handle - Advertising_Handle - Used to Identify an Advertsing Set \n
N/Ahandle

Returns

  • 0 = success !0 = failure

description#

This function requests the Controller to enable or disable the periodic advertising for the advertising set specified by the Advertising_Handle parameter


Definition at line 2082 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_ae_set_scan_params#

int32_t rsi_ble_ae_set_scan_params (void *ae_scan_params)

sets the extended scan parameters to be used on the advertising physical channels.

Parameters
[in]ae_scan_params

- Extended scan Parameters data would be filled here

Returns

  • 0 = success !0 = failure

description#

This function sets the extended scan parameters to be used on the advertising physical channels.


Definition at line 2104 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_ae_set_scan_enable#

int32_t rsi_ble_ae_set_scan_enable (void *ae_scan_enable)

request the local device to enable or disable scanning for both legacy and extended advertising PDUs

Parameters
[in]ae_scan_enable

- Extended Scan Enable command Parameters would be filled here

Returns

  • 0 = success !0 = failure

description#

This function requests the local device to enable or disable scanning for both legacy and extended advertising PDUs


Definition at line 2127 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_ae_set_periodic_sync#

int32_t rsi_ble_ae_set_periodic_sync (uint8_t type, void *periodic_sync_data)
Parameters
N/Atype
N/Aperiodic_sync_data

Definition at line 2154 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_ae_dev_to_periodic_list#

int32_t rsi_ble_ae_dev_to_periodic_list (void *dev_to_list)

used to add,remove or clear the device to the periodic advertiser list

Parameters
[in]dev_to_list

- holds the data of the Device to be added to periodic Advertising list

Returns

  • 0 = success !0 = failure

description#

This function used to add,remove or clear the device to the periodic advertiser list


Definition at line 2193 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_ae_read_periodic_adv_list_size#

int32_t rsi_ble_ae_read_periodic_adv_list_size (uint8_t *resp)

used to read the periodic advertiser list size

Parameters
[in]resp
[out]resp

- stores the value of total number of Periodic Advertiser list entries/ advertinsing list size filled by the controller

Returns

  • 0 = success !0 = failure

description#

This function used to read the periodic advertiser list size


Definition at line 2217 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_extended_connect_with_params#

int32_t rsi_ble_extended_connect_with_params (void *ble_extended_conn_params)

This command is used to create an ACL connection, with the local device in the Central role, to a connectable advertiser.

Parameters
[in]ble_extended_conn_params

holds the data of the Parameters required to connect with the peer device.

Returns

  • 0 = success !0 = failure

description#

This function used to used to create an ACL connection, with the local device in the Central role, to a connectable advertiser.


Definition at line 2237 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_read_transmit_power#

int32_t rsi_ble_read_transmit_power (void *resp)
Parameters
N/Aresp

Definition at line 2264 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_read_rf_path_compensation#

int32_t rsi_ble_read_rf_path_compensation (void *resp)
Parameters
N/Aresp

Definition at line 2283 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_write_rf_path_compensation#

int32_t rsi_ble_write_rf_path_compensation (uint16_t tx_path_value, uint16_t rx_path_value)

used to indicate the RF path gain or loss between the RF transceiver and the antenna contributed by intermediate components

Parameters
[in]tx_path_value

- RF_TX_Path_Compensation_Value, rx_path_value - RF_RX_Path_Compensation_Value A positive value means a net RF path gain and a negative value means a net RF path loss RF_TX_Path_compensation_Value : units in 0.1dB , Range : -128.0 dB (0xFB00) to 128.0 dB (0x0500) RF_RX_Path_compensation_Value : units in 0.1dB , Range : -128.0 dB (0xFB00) to 128.0 dB (0x0500)

N/Arx_path_value

Returns

  • 0 = success !0 = failure

description#

This function used to indicate the RF path gain or loss between the RF transceiver and the antenna contributed by intermediate components.


Definition at line 2302 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_vendor_feature_bitmap#

int32_t rsi_ble_vendor_feature_bitmap (uint32_t bitmap)

Vendor specific BLE command to set bitmap.

Parameters
[in]bitmap

BIT(0) - enable/disable BLE scan responses other - reserved for future use

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 2322 of file bluetooth/rsi_ble_gap_apis.c

rsi_ble_add_service#

int32_t rsi_ble_add_service (uuid_t service_uuid, rsi_ble_resp_add_serv_t *p_resp_serv)

Add a new service to the local GATT Server. This is a Blocking API.

Parameters
[in]service_uuid

- new service UUID value, please refer uuid_s structure for more info.

[out]p_resp_serv

- new service handler filled in this structure, please refer rsi_ble_resp_add_serv_s structure for more info.

Returns

  • 0 - Success Non-Zero Value - Failure 0x4046 - Invalid Arguments 0x4D08 - Profile record full

Note

  • Refer Error Codes section for above error codes Error Codes .


Definition at line 1161 of file bluetooth/rsi_ble_gatt_apis.c

rsi_ble_add_attribute#

int32_t rsi_ble_add_attribute (rsi_ble_req_add_att_t *p_attribute)

Add a new attribute to a specific service. This is a Blocking API.

Parameters
[in]p_attribute

- add a new attribute to the service, please refer rsi_ble_req_add_att_s structure for more info.

Returns

  • 0 - Success Non-Zero Value - Failure 0x4046 - Invalid Arguments 0x4D09 - Attribute record full

Note

  • Refer Error Codes section for above error codes Error Codes .


Definition at line 1187 of file bluetooth/rsi_ble_gatt_apis.c

rsi_ble_set_local_att_value#

int32_t rsi_ble_set_local_att_value (uint16_t handle, uint16_t data_len, uint8_t *p_data)

Change the local attribute value. This is a Blocking API.

Parameters
[in]handle

- attribute value handle

[in]data_len

- attribute value length

[in]p_data

- attribute value

Returns

  • 0 - Success Non-Zero Value - Failure 0x4046 - Invalid Arguments 0x4D06 - Attribute record not found 0x4E60 - Invalid Handle Range

Note

  • Refer Error Codes section for above error codes Error Codes .

  • This API can only be used if the service is maintained inside the firmware. The services which are maintained by firmware must follow the below rules. Rule 1: The attribute_data_size is less than 20 bytes during the service_creation Rule 2: while creating the service, don't use the RSI_BLE_ATT_MAINTAIN_IN_HOST bit in the RSI_BLE_ATT_CONFIG_BITMAP macro. Rule 3: The data_len must be less than or equal to the dat_length mentioned while creating the service/attribute Rule 4: If the services are maintained in the Application/Host, then need to use rsi_ble_notify_value() API to send the notifications to the remote devices.


Definition at line 1221 of file bluetooth/rsi_ble_gatt_apis.c

rsi_ble_set_wo_resp_notify_buf_info#

int32_t rsi_ble_set_wo_resp_notify_buf_info (uint8_t *dev_addr, uint8_t buf_mode, uint8_t buf_cnt)

Configure the buf mode for Notify and WO response commands for the remote device. This is a Blocking API.

Parameters
[in]dev_addr

- remote device address

[in]buf_mode

- buffer mode configuration 0 - BLE_SMALL_BUFF_MODE 1 - BLE_BIG_BUFF_MODE

[in]buf_cnt

- no of buffers to be configured only value 1 and 2 are supporetd in BLE_SMALL_BUFF_MODE in BLE_BIG_BUFF_MODE, buffers allocated based on the below notations. intial available_buf_cnt = RSI_BLE_NUM_CONN_EVENTS, a) When connection 1 is formed, the possible range of buffers is (available_buf_cnt - remaining possible no.connections) b) After allocating X buffers using rsi_ble_set_wo_resp_notify_buf_info to the 1st connection remaiining available_buf_cnt = (available_buf_cnt - X )

Returns

  • 0 - Success Non-Zero Value - Failure 0x4046 - Invalid Arguments 0x4D05 - BLE socket not available 0x4D06 - Attribute record not found 0x4E60 - Invalid Handle Range 0x4E63 - BLE Buffer Count Exceeded 0x4E64 - BLE Buffer already in use

Note

  • Refer Error Codes section for above error codes Error Codes .


Definition at line 1261 of file bluetooth/rsi_ble_gatt_apis.c

rsi_ble_notify_value#

int32_t rsi_ble_notify_value (uint8_t *dev_addr, uint16_t handle, uint16_t data_len, uint8_t *p_data)

Notify the local value to 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.

Parameters
[in]dev_addr

- remote device address

[in]handle

- local attribute handle

[in]data_len

- attribute value length

[in]p_data

- attribute value

Returns

  • 0 - Success Non-Zero Value - Failure 0x4046 - Invalid Arguments 0x4A0D - Invalid attribute value length 0x4D05 - BLE socket not available 0x4D06 - Attribute record not found 0x4E60 - Invalid Handle Range 0x4E65 - Invalid Attribute Length When Small Buffer Mode is Configured

Note


Definition at line 1302 of file bluetooth/rsi_ble_gatt_apis.c

rsi_ble_indicate_value#

int32_t rsi_ble_indicate_value (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 and can unblock the application on the reception of the callback functions either rsi_ble_on_event_indicate_confirmation_t.

Parameters
[in]dev_addr

- remote device address

[in]handle

- local attribute handle

[in]data_len

- attribute value length

[in]p_data

- attribute value

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


Definition at line 1340 of file bluetooth/rsi_ble_gatt_apis.c

rsi_ble_get_local_att_value#

int32_t rsi_ble_get_local_att_value (uint16_t handle, rsi_ble_resp_local_att_value_t *p_resp_local_att_val)

Get the local attribute value. This is a Blocking API.

Parameters
[in]handle

- local attribute handle

[out]p_resp_local_att_val

- local attribute value filled in this structure, plase refer rsi_ble_resp_local_att_value_s structure for more info.

Returns

  • 0 - Success Non-Zero Value - Failure 0x4046 - Invalid Arguments 0x4D06 - Attribute record not found

Note

  • Refer Error Codes section for above error codes Error Codes

  • This API can only be used if the service is maintained inside the firmware. The services which are maintained by firmware must follow the below rules. Rule 1: The attribute_data_size is less than 20 bytes during the service_creation Rule 2: While creating the service, don't use the RSI_BLE_ATT_MAINTAIN_IN_HOST bit in the RSI_BLE_ATT_CONFIG_BITMAP macro.


Definition at line 1454 of file bluetooth/rsi_ble_gatt_apis.c

rsi_ble_gatt_read_response#

int32_t rsi_ble_gatt_read_response (uint8_t *dev_addr, uint8_t read_type, uint16_t handle, uint16_t offset, uint16_t length, uint8_t *p_data)

Send the response for the read request received from the remote device. This is a Blocking API.

Parameters
[in]dev_addr

- remote device Address

[in]read_type

- read value type 0 - Read response 1 - Read blob response

[in]handle

- attribute value handle

[in]offset

- attribute value offset

[in]length

- attribute value length

[in]p_data

- attribute value

Returns

  • 0 - Success Non-Zero Value - Failure 0x4D04 - BLE not connected

Note

  • Refer Error Codes section for above error codes Error Codes


Definition at line 1488 of file bluetooth/rsi_ble_gatt_apis.c

rsi_ble_remove_gatt_service#

int32_t rsi_ble_remove_gatt_service (uint32_t service_handler)

Remove the GATT service record. This is a Blocking API.

Parameters
[in]service_handler

- GATT service record handle

Returns

  • 0 - Success Non-Zero Value - Failure 0x4D0A - BLE profile not found (profile handler invalid)

Note

  • Refer Error Codes section for above error codes Error Codes


Definition at line 1525 of file bluetooth/rsi_ble_gatt_apis.c

rsi_ble_remove_gatt_attibute#

int32_t rsi_ble_remove_gatt_attibute (uint32_t service_handler, uint16_t att_hndl)

Remove the GATT attribute record. This is a Blocking API.

Parameters
[in]service_handler

- GATT service record handle

[in]att_hndl

- attribute handle

Returns

  • 0 - Success Non-Zero Value - Failure 0x4D06 - Attribute record not found

Note

  • Refer Error Codes section for above error codes Error Codes


Definition at line 1548 of file bluetooth/rsi_ble_gatt_apis.c

rsi_ble_att_error_response#

int32_t rsi_ble_att_error_response (uint8_t *dev_addr, uint16_t handle, uint8_t opcode, uint8_t err)

Send attribute error response for any of the att request. This is a Blocking API.

Parameters
[in]dev_addr

- remote device address

[in]handle

- attribute handle

[in]opcode

- error response opcode

[in]err

- specific error related Gatt

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


Definition at line 1580 of file bluetooth/rsi_ble_gatt_apis.c

rsi_ble_gatt_write_response#

int32_t rsi_ble_gatt_write_response (uint8_t *dev_addr, uint8_t type)

Send the response to the write request received from the remote device. This is a Blocking API.

Parameters
[in]dev_addr

- remote device address

[in]type

- response type 0 - write response, 1 - execute write response.

Returns

  • 0 - Success Non-Zero Value - Failure 0x4046 - Invalid Arguments 0x4D04 - BLE not Connected

Note

  • Refer Error Codes section for above error codes Error Codes


Definition at line 1679 of file bluetooth/rsi_ble_gatt_apis.c

rsi_ble_gatt_prepare_write_response#

int32_t rsi_ble_gatt_prepare_write_response (uint8_t *dev_addr, uint16_t handle, uint16_t offset, uint16_t length, uint8_t *data)

Send the response for the prepare write requests received from the remote device. This is a Blocking API.

Parameters
[in]dev_addr

- remote device address

[in]handle

- attribute value handle

[in]offset

- attribute value offset

[in]length

- attribute value length

[in]data

- attribite value

Returns

  • 0 - Success Non-Zero Value - Failure 0x4046 - Invalid Arguments 0x4D04 - BLE not Connected

Note

  • Refer Error Codes section for above error codes Error Codes


Definition at line 1715 of file bluetooth/rsi_ble_gatt_apis.c