34#define CHUNK_SZ BLE_ATT_LEN
37#define CHUNK_DELAY_MS 0
74 else if (ch !=
'\r' && ch !=
'\0') {
106 for (
unsigned int i = 1; i < msg.length(); i++)
107 cksum ^= (
byte) msg[i];
109 sprintf(nmea,
"%02x", cksum);
117 unsigned int msglen = msg.length();
118 unsigned int chunks = msglen /
CHUNK_SZ;
119 unsigned int remain = msglen - (chunks *
CHUNK_SZ);
124 for (
unsigned int i = 0; i < chunks; i++) {
125 part = msg.substring(p, p +
CHUNK_SZ);
128 sendData(part.c_str(), part.length());
134 part = msg.substring(p, p + remain);
136 sendData(part.c_str(), part.length());
149 String msg =
"$PTVSOAR";
150 msg +=
",MNA," + mna;
151 msg +=
",MMO," + mmo;
152 msg +=
",MSN," + msn;
181 sprintf(buf,
"%06.2f", data.
diffPa);
185 sprintf(buf,
"%08.3f", data.
absHpa);
189 sprintf(buf,
"%+05.1f", data.
tempC);
193 sprintf(buf,
"%03.0f", data.
humPct);
197 sprintf(buf,
"%03.0f", data.
batPct);
206 sprintf(buf,
"%4.2f", data.
batVolt);
212 for (
unsigned int i = 1; i < msg.length(); i++)
213 cksum ^= (
byte) msg.charAt(i);
215 sprintf(nmea,
"%02x", cksum);
260 sprintf(buf,
",%4.2f", data.
batVolt);
Provides data transmission over BLE (encapsulating BLE details)
void sendData(const char *buf, int len)
FsUart bleuart
Customized UART service.
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)
unsigned int pos
Write position for next byte.
#define LOGL(s)
Debug log inactive.
#define CHUNK_SZ
Size of data chunks (bytes) sent via BLE interface.
#define SEND_VOLT
Optionally append battery voltage to BLE messages.
#define CHUNK_DELAY_MS
Time ms to wait after sending one chunk.
Extension of BleInterface providing the PTV / PTVSOAR protocol formats.
int isCharging
Charging state.
float batPct
Battery charge %.
float batVolt
Battery Voltage.
float diffPa
SDP31 differential pressure Pa.
float humPct
SHT humidity %.
float tempC
SHT temperature °C.
float absHpa
DPS310 barometric pressure hPa.