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, const uint8_t *p_data)
int32_t
rsi_ble_set_wo_resp_notify_buf_info(const uint8_t *dev_addr, uint8_t buf_mode, uint8_t buf_cnt)
int32_t
rsi_ble_notify_value(const uint8_t *dev_addr, uint16_t handle, uint16_t data_len, const uint8_t *p_data)
int32_t
rsi_ble_indicate_value(const uint8_t *dev_addr, uint16_t handle, uint16_t data_len, const uint8_t *p_data)
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, const uint8_t *p_data)
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, const uint8_t *data)

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


Definition at line 3147 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


Definition at line 3163 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, const uint8_t * p_data)
Parameters
N/Ahandle
N/Adata_len
N/Ap_data

Definition at line 3192 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 (const uint8_t * dev_addr, uint8_t buf_mode, uint8_t buf_cnt)
Parameters
N/Adev_addr
N/Abuf_mode
N/Abuf_cnt

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

rsi_ble_notify_value#

int32_t rsi_ble_notify_value (const uint8_t * dev_addr, uint16_t handle, uint16_t data_len, const uint8_t * p_data)
Parameters
N/Adev_addr
N/Ahandle
N/Adata_len
N/Ap_data

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

rsi_ble_indicate_value#

int32_t rsi_ble_indicate_value (const uint8_t * dev_addr, uint16_t handle, uint16_t data_len, const uint8_t * p_data)
Parameters
N/Adev_addr
N/Ahandle
N/Adata_len
N/Ap_data

Definition at line 3269 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.

  • Pre-conditions: rsi_ble_connect() API needs to be called before this API.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

    • 0x4046 - Invalid Arguments

    • 0x4D06 - Attribute record not found

Note

  • Refer to the Status Codes section for the above error codes at additional-status-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 3340 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, const uint8_t * p_data)
Parameters
N/Adev_addr
N/Aread_type
N/Ahandle
N/Aoffset
N/Alength
N/Ap_data

Definition at line 3367 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.

  • Pre-conditions: rsi_ble_connect() API needs to be called before this API.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

    • 0x4D0A - BLE profile not found (profile handler invalid)

Note


Definition at line 3387 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.

  • Pre-conditions: rsi_ble_connect() API needs to be called before this API.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

    • 0x4D06 - Attribute record not found

Note


Definition at line 3403 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.

  • Pre-conditions: rsi_ble_connect() API needs to be called before this API.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

    • 0x4D04 - BLE not Connected

    • 0x4E62 - Invalid Parameters

Note


Definition at line 3423 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.

  • Pre-conditions: rsi_ble_connect() API needs to be called before this API.

Returns

  • The following values are returned:

    • 0 - Success

    • Non-Zero Value - Failure

    • 0x4046 - Invalid Arguments

    • 0x4D04 - BLE not Connected

Note


Definition at line 3487 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, const uint8_t * data)
Parameters
N/Adev_addr
N/Ahandle
N/Aoffset
N/Alength
N/Adata

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