RUI3 (RAK Unified Interface 3) - RAK4631
BLE UART

Functions

void start (uint8_t adv_time)
 
void stop (void)
 
bool available (void)
 
char read (void)
 
void write (uint8_t *data, uint16_t size=6)
 
void setPIN (uint8_t *key, uint16_t size)
 
void setPermission (RAK_CHARS_SECURITY_REQ permission)
 

Detailed Description

Function Documentation

◆ start()

void start ( uint8_t  adv_time)
Description
To start the BLE UART Service
Syntax
api.ble.uart.start(adv_time)
Parameters
adv_timeadvertising timeout in seconds. If x = 0, advertising never stops
Returns
void
Examples:
BLE_Configuration/src/app.cpp, and BLE_Uart/src/app.cpp.

◆ stop()

void stop ( void  )
Description
To stop the BLE UART Service
Syntax
api.ble.uart.stop()
Returns
void
Example
void setup()
{
  api.ble.uart.stop();
}

void loop()
{
}

◆ available()

bool available ( void  )
Description
To check if there is any incoming Byte from BLE UART Service
Syntax
api.ble.uart.available()
Returns
bool
Return values
TRUE: receive data from the ble device
FALSE: nothing to get
Examples:
BLE_Uart/src/app.cpp.

◆ read()

char read ( void  )
Description
Reads incoming Byte from BLE UART Service
Syntax
api.ble.uart.read()
Returns
The first byte of incoming Ble data available(Type: char)
Examples:
BLE_Uart/src/app.cpp.

◆ write()

void write ( uint8_t *  data,
uint16_t  size = 6 
)
Description
This API is used to write data and send it to the connected device via BLE
Syntax
api.ble.uart.write(data, size)
Parameters
dataan array to send as a series of bytes
sizethe date length that write to the ble device
Returns
void
Examples:
BLE_Uart/src/app.cpp.

◆ setPIN()

void setPIN ( uint8_t *  key,
uint16_t  size 
)
Description
Used to set of passkey with BLE pairing
Syntax
api.ble.uart.setPIN(key, size)
Parameters
keythe key to set the passkey(6 digits only)
sizethe length of key(can only be 6)
Returns
void
Examples:
BLE_Uart/src/app.cpp.

◆ setPermission()

void setPermission ( RAK_CHARS_SECURITY_REQ  permission)
Description
To access BLE Uart is to require man-in-the-middle protection
Syntax
api.ble.uart.setPermission(permission)
Parameters
permisssionThis will cause apps to perform pairing with static PIN we set
RAK_SET_ENC_WITH_MITM
RAK_SET_ENC_NO_MITM
Returns
void
Examples:
BLE_Uart/src/app.cpp.