RUI3 (RAK Unified Interface 3) - RAK4631
RAKBleCharacteristic

Public Member Functions

 RAKBleCharacteristic (uint16_t characteristicUUID)
 
void setProperties (RAK_CHARS_PROPERTIES prop)
 
void setPermission (RAK_CHARS_SECURITY_REQ read_write_perm)
 
void setFixedLen (uint16_t fixed_len)
 
void begin ()
 
void notify (uint8_t *notify_data)
 
void write (uint8_t *send_data)
 
bool notifyEnabled (void)
 
void setCccdWriteCallback (void(*userFunc)(uint16_t, uint8_t *))
 
void setWriteCallback (void(*userFunc)(uint16_t, uint8_t *))
 

Detailed Description

Description
Examples:
BLE_Custom_Service/src/app.cpp.

Constructor & Destructor Documentation

◆ RAKBleCharacteristic()

RAKBleCharacteristic ( uint16_t  characteristicUUID)
Description
Create a new BLE Characteristic associated with this service.
Syntax
RAKBleCharacteristic bslc = RAKBleCharacteristic(characteristicUUID)
Parameters
characteristicUUIDThe base is the same as the base uuid used when construct an instance BLEService, only provided the 3rd and 4th byte means characteristic (16bit UUID)

Member Function Documentation

◆ setProperties()

void setProperties ( RAK_CHARS_PROPERTIES  prop)
Description
Set the characteristic properties
Note
Users should create your own instance to use this api
RAKBleCharacteristic bslc = RAKBleCharacteristic(characteristicUUID)
Syntax
bslc.setProperties(prop)
Parameters
propcurrently supports (RAK_CHR_PROPS_NOTIFY/RAK_CHR_PROPS_READ)
Returns
void
Examples:
BLE_Custom_Service/src/app.cpp.

◆ setPermission()

void setPermission ( RAK_CHARS_SECURITY_REQ  read_write_perm)
Description
sets the security for the characteristic
Note
Users should create your own instance to use this api
RAKBleCharacteristic bslc = RAKBleCharacteristic(characteristicUUID)
Syntax
bslc.setPermission(read_write_perm)
Parameters
read_write_permRAK_SET_OPEN
Returns
void
Examples:
BLE_Custom_Service/src/app.cpp.

◆ setFixedLen()

void setFixedLen ( uint16_t  fixed_len)
Description
indicates how many bytes this characteristic has
Note
Users should create your own instance to use this api
RAKBleCharacteristic bslc = RAKBleCharacteristic(characteristicUUID)
Syntax
bslc.setFixedLen(fixed_len)
Parameters
fixed_lenthe length of the incoming data for notify or write
Returns
void
Examples:
BLE_Custom_Service/src/app.cpp.

◆ begin()

void begin ( )
Description
After adding the characteristic, must call .begin() to complete the configuration action
Note
Users should create your own instance to use this api
RAKBleCharacteristic bslc = RAKBleCharacteristic(characteristicUUID)
Syntax
bslc.begin()
Returns
void
Examples:
BLE_Custom_Service/src/app.cpp.

◆ notify()

void notify ( uint8_t *  notify_data)
Description
Provide information to send notifications to the connector
Note
Users should create your own instance to use this api
RAKBleCharacteristic bslc = RAKBleCharacteristic(characteristicUUID)
Syntax
bslc.notify(notify_data)
Parameters
notify_dataan array to send as a series of bytes
Returns
void
Examples:
BLE_Custom_Service/src/app.cpp.

◆ write()

void write ( uint8_t *  send_data)
Description
Data is written by the application to provide the peer connector for read data
Note
Users should create your own instance to use this api
RAKBleCharacteristic bslc = RAKBleCharacteristic(characteristicUUID)
Syntax
bslc.write(send_data)
Parameters
send_dataan array to send as a series of bytes
Returns
void
Examples:
BLE_Custom_Service/src/app.cpp.

◆ notifyEnabled()

bool notifyEnabled ( void  )
Description
Confirm whether the current connection has enabled notification
Note
Users should create your own instance to use this api
RAKBleCharacteristic bslc = RAKBleCharacteristic(characteristicUUID)
Syntax
bslc.notifyEnabled()
Returns
bool
Return values
TRUE: The mobile apps notification is enabled
FALSE: The mobile apps notification is not enabled
Examples:
BLE_Custom_Service/src/app.cpp.

◆ setCccdWriteCallback()

void setCccdWriteCallback ( void(*)(uint16_t, uint8_t *)  userFunc)
Description
This API is used to register a callback function, so that application can be notified on BLE notify data to peer connector
Note
Users should create your own instance to use this api
RAKBleCharacteristic bslc = RAKBleCharacteristic(characteristicUUID)
Syntax
bslc.setCccWriteCallback(userFunc)
Parameters
userFunccallback function
Returns
void
Examples:
BLE_Custom_Service/src/app.cpp.

◆ setWriteCallback()

void setWriteCallback ( void(*)(uint16_t, uint8_t *)  userFunc)
Description
This API is used to register a callback function so that the application can trigger a notification event when the peer connector reads data .(data written by the application and ready to be read)
Note
Users should create your own instance to use this api
RAKBleCharacteristic bslc = RAKBleCharacteristic(characteristicUUID)
Syntax
bslc.setWriteCallback(userFunc)
Parameters
userFunccallback function
Returns
void
Examples:
BLE_Custom_Service/src/app.cpp.