RUI API Documentation
rui_ble_xxx()
typedef struct
{
uint8_t *p_data;
uint16_t len;
}BLE_DATA;
typedef struct
{
uint16_t write_handle;
uint16_t read_notify_handle;
uint16_t notify_cccd_handle;
}BLE_HANDLE;
typedef struct
{
BLE_CLIENT_EVT_TYPE evt_type;
uint16_t conn_handle;
union
{
BLE_DATA data;
BLE_HANDLE peer_db;
}params;
}BLE_CLIENT_EVT;
typedef void (* BLE_CLIENT_EVT_HANDLER) (BLE_CLIENT * p_ble_rcs_c, BLE_CLIENT_EVT * p_evt);
**@brief Rak Custom Service Client structure. */
struct BLE_CLIENT
{
uint16_t connect_handle;
HANDLE_LIST peer_list;
BLE_CLIENT_EVT_HANDLER evt_handler;
uint8_t uuid_type;
};
void rui_ble_scan_adv(int8_t rssi_value, uint8_t *p_adv_data, uint16_t adv_data_len, uint8_t *p_device_mac)
@brief | This API is used to scan all around BLE devices andvalid when the BLE works on master mode. |
---|---|
@return | NULL |
@param | int8_t rssi_value: peripheral rssi value uint8_t *p_adv_data: the advertise data uint16_t adv_data_len: the length of advertise data uint8_t *p_device_mac: the peripheral's MAC address |
@module | RAK8212-M RAK5010 RAK4600 |
typedef void (*ble_evt_connect)(void);
typedef void (*ble_evt_disconnect)(void);
uint32_t rui_ble_evt_register_callback(ble_evt_connect callback1, ble_evt_disconnect callback2);
@brief | This API is used to register ble event callback functions. |
---|---|
@return | RUI_RETURN_STATUS |
@param | ble_evt_connect: the callback function for ble connected event. ble_evt_disconnect: the callback function for ble disconnected event. |
@module | RAK5010 RAK8212(M) RAK4600 RAK4400 |
RUI_RETURN_STATUS rui_ble_set_work_mode(BLE_WORK_MODE mode, bool long_range_enable);
@brief | This API is used to set the work mode of BLE |
---|---|
@return | RUI_RETURN_STATUS |
@param | BLE_WORK_MODE mode: BLE_MODE_PERIPHERAL, BLE_MODE_CENTRAL, BLE_MODE_OBSERVER long_range_enable: true or false |
@module | RAK5010 RAK8212(M) RAK4600 RAK4400 |
void rui_ble_rx_data_notify(uint8_t *pdata, uint16_t len)
@brief | This API is used to receive the notify data coming from other devices through BLE |
---|---|
@return | NULL |
@param | uint8_t *pdata: the receive data uint16_t len: the length of receive data. |
@module | RAK8212-M RAK5010 RAK4600 |
RUI_RETURN_STATUS rui_ble_tx_data_write(uint8_t *pdata, uint16_t len)
@brief | This API is used to write data to another BLE device through BLE. |
---|---|
@return | RUI_RETURN_STATUS |
@param | uint8_t pdata: The data which will be sent. uint16_t len: The length of data. |
@module | RAK8212-M RAK5010 RAK4600 |
void rui_ble_advertising_start(void);
@brief | This API is used to start advertising in ble peripheral mode. BLE broadcast will stop automatically after 60 seconds. |
---|---|
@return | NULL |
@param | NULL |
@module | RAK5010 RAK8212 RAK8212M RAK4600 RAK4400 |