Flying Silicon Sensor
bleInterface.h
Go to the documentation of this file.
1
23#ifndef _BLEINTERFACE_H
24#define _BLEINTERFACE_H
25
26// Custom UART class with Adafruit BLE library
27#include "fsUart.h"
28
29// BLE attribute length
30// - in 4.0 and 4.1, the maximum ATT Payload in a 'Uncoded Packet' is 20 bytes
31// - in 4.2 and 5.0, the new Data Length Extension (DLE) allows the ATT Payload
32// to hold up to 244 bytes
33// The ArduinoBLE library hard-sets this *packet* length to 20 bytes,
34// equal to the BLE attribute length
35#define BLE_ATT_LEN 20
36
41
42public:
43 void init(const char *deviceName);
44 void startAdv(void);
45 void sendData(const char *buf, int len);
46 void poll(void);
47 void shutdown(void);
48 int isConnected(void);
49
51
53 const static int MtuSize = BLE_ATT_LEN + 3;
54
55protected:
58
59 // Device information service not really needed
60 // BLEDis bledis;
61
62 static void cbDisconnect(uint16_t conn_handle, uint8_t reason);
63 static void cbConnect(uint16_t conn_handle);
64};
65
66
67#endif // _BLEINTERFACE_H
#define BLE_ATT_LEN
void init(const char *deviceName)
int isConnected(void)
static void cbDisconnect(uint16_t conn_handle, uint8_t reason)
static const int MtuSize
BLE MTU size.
void sendData(const char *buf, int len)
FsUart bleuart
Customized UART service.
void poll(void)
static void cbConnect(uint16_t conn_handle)
void startAdv(void)
void shutdown(void)
Helper to enable usage of BLE Uart with different UUID sets.