TactigonDoc  1.3 - 2018-28-12
Documentation of Tactigon libraries exposed in Arduino IDE
Public Member Functions | List of all members
T_BLE Class Reference

#include <tactigon_BLE.h>

Public Member Functions

 T_BLE ()
 
T_BLE_Characteristic addNewChar (UUID uuid, uint8_t numOfByte, uint8_t wEnable=0)
 
void InitRole (uint8_t role)
 
uint8_t getStatus (void)
 
uint8_t writeToPeripheral (uint8_t *pData, uint8_t size)
 
void setTarget (uint8_t *pMac, UUID uuid)
 
void setName (char *pName)
 
void setMAC (uint8_t *pMAC)
 
uint8_t setNcb (nCBType pFunc)
 
void startScan (scanCBType pFunc)
 
void stopScan (void)
 
void disconnect (void)
 

Detailed Description

T_BLE class. This is the main class for manage the Bloetooth Low Energy interface

Constructor & Destructor Documentation

◆ T_BLE()

T_BLE::T_BLE ( )

BLE manager Class constructor

Member Function Documentation

◆ addNewChar()

T_BLE_Characteristic T_BLE::addNewChar ( UUID  uuid,
uint8_t  numOfByte,
uint8_t  wEnable = 0 
)

add a new characteristic to the BLE manager

Parameters
uuiduuid of the characteristic to add
numOfBytesize of the characteristic (max 20 byte)
wEnableenable/disable write operation on characteristic (default disable)
Returns
the just create BLE characteristic

◆ disconnect()

void T_BLE::disconnect ( void  )

close current connection

◆ 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
rolethe 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
pMACpointer to 6byte array with MAC

◆ setName()

void T_BLE::setName ( char *  pName)

set the name of device on BLE interface

Parameters
pNamepointer 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
pFuncuser 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
pMACpointer of 6byte array with the MAC of the target
uuidthe 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
pFuncuser 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
pDatapointer of byte array to write
sizenumber of byte to write
Returns
to be implemented

The documentation for this class was generated from the following files: