1-phase PV router
|
A class for managing and sending telemetry information in a structured frame format. More...
#include <teleinfo.h>
Public Member Functions | |
__attribute__ ((always_inline)) void endFrame() | |
Finalizes the frame by adding the end character and sending the buffer over Serial. | |
__attribute__ ((always_inline)) void startFrame() | |
Initializes a new frame by resetting the buffer and adding the start character. | |
void | send (const char *tag, int16_t value, uint8_t index=0) |
Sends a telemetry value as an integer. | |
Private Member Functions | |
__attribute__ ((always_inline)) void writeTag(const char *tag | |
Writes a tag to the buffer. | |
uint8_t | calculateChecksum (size_t startPos, size_t endPos) const |
Calculates the checksum for a portion of the buffer. | |
if (index !=0) | |
Private Attributes | |
while ptr | buffer [bufferPos++] = *ptr++ |
buffer [bufferPos++] = TAB | |
char | buffer [calcBufferSize()] {} |
size_t | bufferPos { 0 } |
uint8_t | index |
Static Private Attributes | |
static const char | CR { 0x0D } |
static const char | ETX { 0x03 } |
static const char | LF { 0x0A } |
static const char | STX { 0x02 } |
static const char | TAB { 0x09 } |
A class for managing and sending telemetry information in a structured frame format.
The TeleInfo
class is responsible for creating and sending telemetry frames that include various data points such as power, voltage, temperature, and relay states. The frames are formatted with tags, values, and checksums to ensure data integrity.
Definition at line 144 of file teleinfo.h.
|
inline |
Finalizes the frame by adding the end character and sending the buffer over Serial.
Definition at line 239 of file teleinfo.h.
|
inline |
Initializes a new frame by resetting the buffer and adding the start character.
Definition at line 208 of file teleinfo.h.
|
private |
|
inlinenodiscardprivate |
Calculates the checksum for a portion of the buffer.
startPos | The starting position in the buffer. |
endPos | The ending position in the buffer. |
Definition at line 162 of file teleinfo.h.
References buffer.
Referenced by send().
|
inlineprivate |
Definition at line 196 of file teleinfo.h.
|
inline |
Sends a telemetry value as an integer.
tag | The tag associated with the value. |
value | The integer value to send. |
Definition at line 219 of file teleinfo.h.
References buffer, bufferPos, calculateChecksum(), CR, index, LF, and TAB.
Referenced by sendTelemetryData().
|
private |
Definition at line 193 of file teleinfo.h.
Definition at line 201 of file teleinfo.h.
|
private |
Buffer to store the frame data. Adjust size as needed.
Definition at line 153 of file teleinfo.h.
Referenced by __attribute__(), __attribute__(), calculateChecksum(), if(), and send().
|
private |
Current position in the buffer.
Definition at line 154 of file teleinfo.h.
Referenced by __attribute__(), __attribute__(), if(), and send().
|
staticprivate |
|
staticprivate |
|
private |
Definition at line 190 of file teleinfo.h.
Referenced by __attribute__(), if(), and send().
|
staticprivate |
|
staticprivate |
|
staticprivate |