#include <tactigon_BLE.h>
T_BLE class. This is the main class for manage the Bloetooth Low Energy interface
◆ T_BLE()
BLE manager Class constructor
◆ addNewChar()
add a new characteristic to the BLE manager
- Parameters
-
uuid | uuid of the characteristic to add |
numOfByte | size of the characteristic (max 20 byte) |
wEnable | enable/disable write operation on characteristic (default disable) |
- Returns
- the just create BLE characteristic
◆ disconnect()
void T_BLE::disconnect |
( |
void |
| ) |
|
◆ getStatus()
uint8_t T_BLE::getStatus |
( |
void |
| ) |
|
in CENTRAL role get the status of target search/connection process
in PERIPHERAL role return the pairing status
- Returns
- CENTRAL: 0: no serach; 1: searching for target; 2:target found, searching for target characteristic; 3:ready for characteristic operations
PERIPHERAL: 0: not paired; 1: paired
◆ InitRole()
void T_BLE::InitRole |
( |
uint8_t |
role | ) |
|
set the role of device on the Bluetooth interface
- Parameters
-
role | the role (TACTIGON_BLE_PERIPHERAL or TACTIGON_BLE_CENTRAL) of device |
◆ setMAC()
void T_BLE::setMAC |
( |
uint8_t * |
pMAC | ) |
|
set the MAC address of device on BLE interface
- Parameters
-
pMAC | pointer to 6byte array with MAC |
◆ setName()
void T_BLE::setName |
( |
char * |
pName | ) |
|
set the name of device on BLE interface
- Parameters
-
pName | pointer to the name (max 5 char) |
◆ setNcb()
uint8_t T_BLE::setNcb |
( |
nCBType |
pFunc | ) |
|
in CENTRAL role set a CallBack on Notification events on connected device/characteristic
- Parameters
-
pFunc | user provided callback. It must be of type: void callBackName(uint8_t *pointer_to_data, uint8_t byte_data_size, uint8_t rssi) |
- Returns
- status: 0:ok, !=0: not ok
◆ setTarget()
void T_BLE::setTarget |
( |
uint8_t * |
pMAC, |
|
|
UUID |
uuid |
|
) |
| |
in CENTRAL role set the target to search and connect
- Parameters
-
pMAC | pointer of 6byte array with the MAC of the target |
uuid | the UUID of the characteristic of the target |
◆ startScan()
void T_BLE::startScan |
( |
scanCBType |
pFunc | ) |
|
in CENTRAL role start scan and set a CallBack on device discovered event
- Parameters
-
pFunc | user provided callback. It must be of type: void callBackName(uint8_t *pointer_to_Device_Info_String, const uint8_t *advertisingPacket)
pointer_to_Device_Info_String points to a string with following format: "MAC,device_name,rssi"
advertisingPacket points to advertising raw data. Refer to BLE documentation for format |
◆ stopScan()
void T_BLE::stopScan |
( |
void |
| ) |
|
in CENTRAL role stop scan
◆ writeToPeripheral()
uint8_t T_BLE::writeToPeripheral |
( |
uint8_t * |
pData, |
|
|
uint8_t |
size |
|
) |
| |
in CENTRAL role write to connected target device/characteristic
- Parameters
-
pData | pointer of byte array to write |
size | number of byte to write |
- Returns
- to be implemented
The documentation for this class was generated from the following files: