This section contains description about BT APIs to initialize and configure the module in BT mode

Click here to download the BT APIs

rsi_bt_get_local_name

Prototype int32_t rsi_bt_get_local_name(rsi_bt_resp_get_local_name_t

*bt_resp_get_local_name)

Input Arguments rsi_bt_resp_get_local_name_t *bt_resp_get_local_name: This parameter is the response buffer to hold the response of this API.
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to request the local device name
Example Usage rsi_bt_get_local_name(&recvbuf);

rsi_bt_set_local_name

Prototype int32_t rsi_bt_set_local_name(int8_t *local_name)
Input Arguments int8_t *local_name:Name to be set to the local device
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to sets the local device name
Example Usage rsi_bt_set_local_name(“bttest”);

rsi_bt_set_local_class_of_device

Prototype int32_t rsi_bt_set_local_class_of_device(uint32_t class_of_device)
Input Arguments uint32_t class_of_device: Class of device
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to set the local COD.
Example Usage rsi_bt_set_local_class_of_device (cod);

rsi_bt_get_local_class_of_device

Prototype int32_t rsi_bt_get_local_class_of_device(uint8_t *resp)
Input Arguments uint8_t *resp: This parameter is to hold the response of this API
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to request the local COD name.
Example Usage int32_t rsi_bt_get_local_class_of_device(&recvbuf);

 rsi_bt_start_discoverable

Prototype int32_t rsi_bt_start_discoverable(void)
Input Arguments void: None
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to request the local device to enter discovery mode
Example Usage rsi_bt_start_discoverable();

rsi_bt_start_limited_discoverable

Prototype int32_t rsi_bt_start_limited_discoverable(int32_t time_out_ms)
Input Arguments int32_t time_out_ms: Limited discovery mode time_out in ms
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to request the local device to enter limited discovery mode
Example Usage rsi_bt_start_discoverable(100);

rsi_bt_stop_discoverable

Prototype int32_t rsi_bt_stop_discoverable(void)
Input Arguments void: None
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to request the local device to exit discovery mode
Example Usage rsi_bt_stop_discoverable();

rsi_bt_get_discoverable_status

Prototype int32_t rsi_bt_get_discoverable_status(uint8_t *resp)
Input Arguments uint8_t *resp: This parameter is to  hold the response of this API
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to request the local device discovery mode status
Example Usage rsi_bt_get_discoverable_status(&recvbuf);

rsi_bt_set_connectable

Prototype int32_t rsi_bt_set_connectable(void)
Input Arguments void: None
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to request the local device to set connectablity mode
Example Usage rsi_bt_set_connectable();

rsi_bt_set_non_connectable

Prototype int32_t rsi_bt_set_non_connectable(void)
Input Arguments void: None
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to set the BT Module in non-connectable mode
Example Usage rsi_bt_set_non_connectable();

rsi_bt_get_connectable_status

Prototype int32_t rsi_bt_get_connectable_status(uint8_t *resp)

 

Input Arguments uint8_t *resp: This parameter is to hold the response of this API
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to get BT Module connectablity status
Example Usage rsi_bt_get_connectable_status(&recvbuf);

rsi_bt_enable_authentication

Prototype int32_t rsi_bt_enable_authentication(void)
Input Arguments void: None
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to enable authentication
Example Usage rsi_bt_enable_authentication();

rsi_bt_disable_authentication

Prototype int32_t rsi_bt_disable_authentication(void)
Input Arguments  void: None
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to disable authentication.
Example Usage rsi_bt_disable_authentication();

rsi_bt_get_authentication

Prototype int32_t rsi_bt_get_authentication(void)
Input Arguments void: None
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to initiate authentication
Example Usage rsi_bt_get_authentication();

rsi_bt_remote_name_request_async

Prototype int32_t rsi_bt_remote_name_request_async(int8_t *remote_dev_addr, rsi_bt_event_remote_device_name_t *bt_event_remote_device_name)
Input Arguments int8_t *remote_dev_addr: Remote device address

rsi_bt_event_remote_device_name_t *bt_event_remote_device_name: This parameter is a response buffer to hold the name of remote device. This is a structure parameter of rsi_bt_event_remote_device_name_s

Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used know the remote device name
Example Usage rsi_bt_remote_name_request_async(“AA:BB:CC:DD:EE:FF”, &recvbuf);

 rsi_bt_remote_name_request_cancel

Prototype int32_t rsi_bt_remote_name_request_cancel(int8_t *remote_dev_addr)
Input Arguments int8_t *remote_dev_addr: Remote device address
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used cancel the remote device name request
Example Usage rsi_bt_remote_name_request_cancel(“AA:BB:CC:DD:EE:FF”);

 

rsi_bt_inquiry

Prototype int32_t rsi_bt_inquiry(uint8_t inquiry_type, uint32_t inquiry_duration,uint8_t max_devices)
Input Arguments uint8_t inquiry_type: Inquiry type

uint32_t inquiry_duration : Duration of inquiry

uint8_t max_devices : Maximum number of devices allowed to inquiry

Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to start inquiry
Example Usage rsi_bt_inquiry(0,1000,4);

rsi_bt_cancel_inquiry

Prototype int32_t rsi_bt_cancel_inquiry(void)
Input Arguments void: None
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to cancel inquiry
Example Usage rsi_bt_cancel_inquiry();

rsi_bt_connect

Prototype int32_t rsi_bt_connect(int8_t *remote_dev_addr)

 

Input Arguments  int8_t *remote_dev_addr: Remote device address
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to initiate the connection request
Example Usage rsi_bt_connect(“AA:BB:CC:DD:EE:FF”);

 

rsi_bt_cancel_connect

Prototype int32_t rsi_bt_cancel_connect(int8_t*remote_dev_address)
Input Arguments int8_t*remote_dev_address: Remote device address
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to cancel the connection request
Example Usage rsi_bt_cancel_connect(“AA:BB:CC:DD:EE:FF”);

 

rsi_bt_disconnect

Prototype int32_t rsi_bt_disconnect(int8_t *remote_dev_address)
Input Arguments int8_t*remote_dev_address: Remote device address
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to disconnect the physical connection
Example Usage rsi_bt_disconnect(“AA:BB:CC:DD:EE:FF”);

rsi_bt_set_ssp_mode

Prototype int32_t rsi_bt_set_ssp_mode(uint8_t pair_mode,uint8_t IOcapability)
Input Arguments uint8_t pair_mode : Enable/disable the SSP mode

uint8_t IOcapability : Input/output capability of local device

Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to enable/disable SSP in the local device
Example Usage rsi_bt_set_ssp_mode(0,0x02);

 

rsi_bt_accept_ssp_confirm

Prototype int32_t rsi_bt_accept_ssp_confirm(int8_t *remote_dev_address)
Input Arguments int8_t *remote_dev_address : Remote device address
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to give the confirmation for the passkey sent by local BT device at the time of pairing
Example Usage rsi_bt_accept_ssp_confirm(“AA:BB:CC:DD:EE:FF”);

rsi_bt_reject_ssp_confirm

Prototype int32_t rsi_bt_reject_ssp_confirm(int8_t *remote_dev_address)
Input Arguments int8_t *remote_dev_address : Remote device address
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to reject the confirmation for the passkey sent by local BT device at the time of pairing
Example Usage rsi_bt_reject_ssp_confirm(“AA:BB:CC:DD:EE:FF”);

 

rsi_bt_passkey

Prototype int32_t rsi_bt_passkey(int8_t *remote_dev_addr, uint32_t passkey ,uint8_t reply_type)
Input Arguments int8_t *remote_dev_address : Remote device address

uint32_t passkey : Passkey input

uint8_t reply_type : Positive or negative reply

Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to send passkey or reject the incoming pass key request
Example Usage

rsi_bt_passkey(“AA:BB:CC:DD:EE:FF”, 1234, 1);

 

rsi_bt_pincode_request_reply

Prototype int32_t rsi_bt_pincode_request_reply(int8_t *remote_dev_addr,uint8_t *pin_code,uint8_t reply_type)
Input Arguments int8_t *remote_dev_address : Remote device address

uint8_t *pin_code : Pincode input

uint8_t reply_type : Positive or negative reply

Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to send pincode or reject the incoming pincode request
Example Usage rsi_bt_pincode_request_reply (“AA:BB:CC:DD:EE:FF”,”1234”,0);

 

rsi_bt_linkkey_request_reply

Prototype int32_t rsi_bt_linkkey_request_reply(int8_t *remote_dev_addr,uint8_t *linkkey, uint8_t reply_type)
Input Arguments int8_t *remote_dev_address : Remote device address

uint8_t *linkkey : Linkkey input

uint8_t reply_type : Positive or negative reply

Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to send either positive(along with the link key) or negative reply to the incoming linkkey request
Example Usage rsi_bt_linkkey_request_reply(“AA:BB:CC:DD:EE:FF”,”6789”,1);

rsi_bt_get_local_device_role

Prototype int32_t rsi_bt_get_local_device_role(int8_t  *remote_dev_addr,uint8_t *resp)
Input Arguments int8_t *remote_dev_address : Remote device address

uint8_t *resp: This parameter is used to hold the reponse of this API.

Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to request the role of local device
Example Usage rsi_bt_get_local_device_role(“AA:BB:CC:DD:EE:FF”,&recvbuf);

 

rsi_bt_get_services_async

Prototype int32_t rsi_bt_get_services_async(int8_t *remote_dev_addr, rsi_bt_resp_query_services_t *bt_resp_query_services)
Input Arguments int8_t *remote_dev_address : Remote device address

rsi_bt_resp_query_services_t *bt_resp_query_services:  This parameter describes the response structure to hold the response of this API. This is a structure variable of a rsi_bt_resp_query_services_s structure

Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to query the remote device service list
Example Usage rsi_bt_get_services_async(“AA:BB:CC:DD:EE:FF”,&recvbuf);

 

rsi_bt_search_service_async

Prototype int32_t rsi_bt_search_service_async(int8_t *remote_dev_addr,uint32_t service_uuid)
Input Arguments int8_t *remote_dev_address : Remote device address

uint32_t service_uuid : UUID of the service to search

Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to search service of the given uuid.
Example Usage rsi_bt_search_service_async(“AA:BB:CC:DD:EE:FF”, 1105);

 

rsi_bt_sniff_mode

Prototype int32_t rsi_bt_sniff_mode(uint8_t *remote_dev_addr, uint16_t sniff_max_intv, uint16_t sniff_min_intv, uint16_t sniff_attempt, uint16_t sniff_tout)
Input Arguments int8_t *remote_dev_address : Remote device address

uint16_t sniff_max_intv : Sniff maximum interval

uint16_t sniff_min_intv : Sniff minimum interval

uint16_t sniff_attempt  : Sniff attempt

uint16_t sniff_tout     : Sniff timeout

Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to request the local device to enter into sniff mode
Example Usage rsi_bt_sniff_mode(“AA:BB:CC:DD:EE:FF”,100,10,5,10);

 

rsi_bt_sniff_exit_mode

Prototype int32_t rsi_bt_sniff_exit_mode(uint8_t *remote_dev_addr)
Input Arguments int8_t *remote_dev_address : Remote device address
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to request the local device to exit from sniff/sniff subrating mode
Example Usage rsi_bt_sniff_exit_mode(“AA:BB:CC:DD:EE:FF”);

 

rsi_bt_sniff_subrating_mode

Prototype int32_t rsi_bt_sniff_subrating_mode(uint8_t *remote_dev_addr, uint16_t max_latency, uint16_t min_remote_tout,  uint16_t   min_local_tout)
Input Arguments int8_t *remote_dev_address : Remote device address

uint16_t max_latency    : Maximum latency

uint16_t min_remote_tout : Minimum remote timeout

uint16_t   min_local_tout : Minimum local timeout

Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to request the device enter into sniff subrating mode
Example Usage rsi_bt_sniff_subrating_mode(“AA:BB:CC:DD:EE:FF”,100,10,5);

 

 rsi_bt_get_rssi

Prototype int32_t rsi_bt_get_rssi(int8_t *dev_addr, uint8_t *resp)
Input Arguments int8_t *remote_dev_address : Remote device address

uint8_t *resp : This parameter is to hold the response of this API

Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to request the RSSI of the remote device
Example Usage rsi_bt_get_rssi(“AA:BB:CC:DD:EE:FF”, &recvbuf);

 

rsi_bt_get_local_device_address

Prototype int32_t rsi_bt_get_local_device_address(uint8_t *resp)
Input Arguments uint8_t *resp : This parameter is to hold the response of this API
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to request the local device address
Example Usage rsi_bt_get_local_device_address(&recvbuf);

 

 rsi_bt_spp_init

Prototype                           int32_t rsi_bt_spp_init(void)
Input Arguments void: None
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to set the SPP profile mode
Example Usage rsi_bt_spp_init();

rsi_bt_spp_connect

Prototype                           int32_t rsi_bt_spp_connect(uint8_t *remote_dev_addr)
Input Arguments uint8_t *remote_dev_addr : Remote device address
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to initiate SPP profile level connection
Example Usage rsi_bt_spp_connect(“AA:BB:CC:DD:EE:FF”);

rsi_bt_spp_disconnect

Prototype                           int32_t rsi_bt_spp_disconnect(uint8_t *remote_dev_addr)
Input Arguments uint8_t *remote_dev_addr : Remote device address
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to initiate SPP service level disconnection
Example Usage rsi_bt_spp_disconnect(“AA:BB:CC:DD:EE:FF”);

 

 rsi_bt_spp_transfer

Prototype                 int32_t rsi_bt_spp_transfer(uint8_t *remote_dev_addr, uint8_t *data,uint16_t length)
Input Arguments uint8_t *remote_dev_addr : Remote device address

uint8_t *data  : Data for transmission

uint16_t length : Data length for transfer

Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to transfer data through SPP profile
Example Usage rsi_bt_spp_transfer(“AA:BB:CC:DD:EE:FF”,&data,sizeof(data));

 

rsi_bt_init

Prototype                           int32_t rsi_bt_init(void)
Input Arguments Void : None
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to initialize the BT device
Example Usage rsi_bt_init();

rsi_bt_deinit

Prototype                           int32_t rsi_bt_deinit(void)
Input Arguments Void : None
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to deinitialize  the BT device
Example Usage rsi_bt_deinit();

rsi_bt_set_antenna

Prototype                           int32_t rsi_bt_set_antenna(uint8_t antenna_value)
Input Arguments uint8_t antenna_value: This parameter is used to select either internal or external antenna
Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to select either internal/external antenna on the chip
Example Usage uint8_t antenna_value(0);

 

rsi_bt_power_save_profile

Prototype                           int32_t rsi_bt_power_save_profile(uint8_t psp_mode, uint8_t psp_type)
Input Arguments uint8_t psp_mode: Follwing psp_mode is defined.

RSI_ACTIVE (0): In this mode module is active and power save is disabled.

RSI_SLEEP_MODE_1 (1): This is connected sleep mode. In this sleep mode, SoC will never turn off, therefore no handshake is required before sending data to the module.

BT/BLE doesnot support this mode.

RSI_SLEEP_MODE_2 (2): This is connected sleep mode. In this sleep mode, SoC will go to sleep based on GPIO or Message, therefore handshake is required before sending data to the module.

RSI_SLEEP_MODE_8 (8): This is disconnected sleep mode. In this sleep mode, module will turn off the SoC. Since SoC is turn off, therefore handshake is required before sending data to the module.

uint8_t psp_type: Follwing psp_type is defined.

RSI_MAX_PSP (0): This psp_type will be used for max power saving.

BT/BLE supports only RSI_MAX_PSP mode.

Remaining modes are not support.

Return Value int32_t: Status of connection.
  • 0: Successfully initiated connection.
  • Non Zero value: Failed execution of the command.
Description This API is used to select power save profile mode for BT/BLE
Example Usage rsi_bt_power_save_profile(0,0);

 

NOTE:

psp_type is only valid in psp_mode 2.

BT/BLE doesnot support in RSI_SLEEP_MODE_1.