Server#

Functions#

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.

int32_t
rsi_ble_add_attribute(rsi_ble_req_add_att_t *p_attribute)

Add a new attribute to a specific service.

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

Change the local attribute value.

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.

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.

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.

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.

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.

int32_t
rsi_ble_remove_gatt_service(uint32_t service_handler)

Remove the GATT service record.

int32_t
rsi_ble_remove_gatt_attibute(uint32_t service_handler, uint16_t att_hndl)

Remove the GATT attribute record.

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.

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.

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.

Function Documentation#

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.

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.

This is a Blocking API.

  • Pre-conditions:

    • Device should be initialized before calling this API.

Returns

  • The following values are returned:

    • 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 3548 of file components/device/silabs/si91x/wireless/ble/inc/rsi_ble_apis.h

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.

Parameters
[in]p_attribute

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

This is a Blocking API.

  • Pre-conditions:

    • Device should be initialized before calling this API.

Returns

  • The following values are returned:

    • 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 3570 of file components/device/silabs/si91x/wireless/ble/inc/rsi_ble_apis.h

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.

Parameters
[in]handle

- attribute value handle

[in]data_len

- attribute value length

[in]p_data

- attribute value

This is a Blocking API.

Returns

  • The following values are returned:

    • 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 3614 of file components/device/silabs/si91x/wireless/ble/inc/rsi_ble_apis.h

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.

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 supported 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 number of connections)
        b) After allocating X buffers using \ref rsi_ble_set_wo_resp_notify_buf_info to the 1st connection remaining available_buf_cnt = (available_buf_cnt - X ) 
    

This is a Blocking API. Returns

  • The following values are returned:

    • 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 3657 of file components/device/silabs/si91x/wireless/ble/inc/rsi_ble_apis.h

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.

Parameters
[in]dev_addr

- remote device address

[in]handle

- local attribute handle

[in]data_len

- attribute value length

[in]p_data

- attribute value

This is a Blocking API. If the API returns RSI_ERROR_BLE_DEV_BUF_FULL (-31) error then wait until the 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

    • 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

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

  • If the services are maintained in the Application/Host,


Definition at line 3697 of file components/device/silabs/si91x/wireless/ble/inc/rsi_ble_apis.h

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.

Parameters
[in]dev_addr

- remote device address

[in]handle

- local attribute handle

[in]data_len

- attribute value length

[in]p_data

- attribute value

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.

Returns

  • The following values are returned:

    • 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 3724 of file components/device/silabs/si91x/wireless/ble/inc/rsi_ble_apis.h

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.

Parameters
[in]handle

- local attribute handle

[out]p_resp_local_att_val

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

This is a Blocking API.

Returns

  • The following values are returned:

    • 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 3813 of file components/device/silabs/si91x/wireless/ble/inc/rsi_ble_apis.h

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.

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

This is a Blocking API.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

    • 0x4D04 - BLE not connected

Note

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


Definition at line 3846 of file components/device/silabs/si91x/wireless/ble/inc/rsi_ble_apis.h

rsi_ble_remove_gatt_service#

int32_t rsi_ble_remove_gatt_service (uint32_t service_handler)

Remove the GATT service record.

Parameters
[in]service_handler

- GATT service record handle

This is a Blocking API.

Returns

  • The following values are returned:

    • 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 3870 of file components/device/silabs/si91x/wireless/ble/inc/rsi_ble_apis.h

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.

Parameters
[in]service_handler

- GATT service record handle

[in]att_hndl

- attribute handle

This is a Blocking API.

Returns

  • The following values are returned:

    • 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 3890 of file components/device/silabs/si91x/wireless/ble/inc/rsi_ble_apis.h

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.

Parameters
[in]dev_addr

- remote device address

[in]handle

- attribute handle

[in]opcode

- error response opcode

[in]err

- specific error related Gatt

This is a Blocking API.

Returns

  • The following values are returned:

    • 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 3914 of file components/device/silabs/si91x/wireless/ble/inc/rsi_ble_apis.h

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.

Parameters
[in]dev_addr

- remote device address

[in]type

- response type

  • 0 - write response,

  • 1 - execute write response.

This is a Blocking API.

Returns

  • The following values are returned:

    • 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 3991 of file components/device/silabs/si91x/wireless/ble/inc/rsi_ble_apis.h

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.

Parameters
[in]dev_addr

- remote device address

[in]handle

- attribute value handle

[in]offset

- attribute value offset

[in]length

- attribute value length

[in]data

- attribute value

This is a Blocking API.

Returns

  • The following values are returned:

    • 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 4019 of file components/device/silabs/si91x/wireless/ble/inc/rsi_ble_apis.h