Flying Silicon Sensor
ptvBleInterface.h
Go to the documentation of this file.
1
23#ifndef _PTVBLEINTERFACE_H_
24#define _PTVBLEINTERFACE_H_
25
26#include "bleInterface.h"
27
32
33public:
34
36 typedef struct {
38 float diffPa = 0.0;
40 float absHpa = 0.0;
42 float tempC = 0.0;
44 float humPct = 0.0;
45
47 float batVolt = 0.0;
49 float batPct = 0.0;
51 int isCharging = 0;
52
53 } SensorData;
54
57
58 void sendMetaMsg(const String &mna, const String &mmo, const String &msn);
59 void sendShortMsg(const SensorData &data);
60 void sendLongMsg(const SensorData &data);
61 void sendChunked(String & msg);
62
63 int getReceived(String &cmd);
65 void clrReceived() { clrBuffer(); command = ""; }
66
67protected:
68
69 void poll(); // no longer needs to be public
70
72 void clrBuffer() { memset(rcvBuffer, 0x00, sizeof(rcvBuffer)); pos = 0; }
74 String command;
78 unsigned int pos;
79};
80
81
82#endif // _PTVBLEINTERFACE_H_
Provides data transmission over BLE (encapsulating BLE details)
void clrBuffer()
Clear internal receive buffer.
String command
Holds last received text line / command.
void sendMetaMsg(const String &mna, const String &mmo, const String &msn)
void sendShortMsg(const SensorData &data)
char rcvBuffer[FIFO_SZ]
Receive data buffer, same size as UART FIFO.
void sendChunked(String &msg)
void sendLongMsg(const SensorData &data)
int getReceived(String &cmd)
PtvBleInterface()
Default c-tor.
unsigned int pos
Write position for next byte.
void clrReceived()
Clear anything received so far.
#define FIFO_SZ
Adafruit UART Tx and Rx FIFO size in bytes.
Definition fsUart.h:30
Sensor data structure.