3-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 154 of file teleinfo.h.
|
inline |
Finalizes the frame by adding the end character and sending the buffer over Serial.
Definition at line 249 of file teleinfo.h.
|
inline |
Initializes a new frame by resetting the buffer and adding the start character.
Definition at line 218 of file teleinfo.h.
|
private |
Writes a tag to the buffer.
tag | The tag to write. |
|
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 172 of file teleinfo.h.
|
inlineprivate |
Definition at line 206 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 229 of file teleinfo.h.
|
private |
Definition at line 203 of file teleinfo.h.
Definition at line 211 of file teleinfo.h.
|
private |
Buffer to store the frame data. Adjust size as needed.
Definition at line 163 of file teleinfo.h.
|
private |
Current position in the buffer.
Definition at line 164 of file teleinfo.h.
|
staticprivate |
Carriage Return character.
Definition at line 160 of file teleinfo.h.
|
staticprivate |
End of Frame character.
Definition at line 158 of file teleinfo.h.
|
private |
Definition at line 200 of file teleinfo.h.
|
staticprivate |
Line Feed character.
Definition at line 159 of file teleinfo.h.
|
staticprivate |
Start of Frame character.
Definition at line 157 of file teleinfo.h.
|
staticprivate |
Tab character.
Definition at line 161 of file teleinfo.h.