3-phase PV router
Loading...
Searching...
No Matches
teleinfo.h File Reference

The telemetry frame of the IoT output, written a line at a time. More...

#include <stdint.h>
Include dependency graph for teleinfo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  TeleInfo
 The telemetry frame of the IoT output.
 

Functions

template<typename Source>
char * TeleInfo::frameLine (uint8_t step, char *dst)
 Writes the line of a step.
 
template<typename Source>
constexpr uint8_t TeleInfo::frameSteps ()
 The number of steps of a frame: one per line, invalid temperatures included (they write nothing).
 
char * TeleInfo::line (char *dst, const char *tag, int16_t value, uint8_t index=0)
 Writes the line of a signed value.
 
constexpr uint8_t TeleInfo::lineSize (uint8_t tagLength, uint8_t valueLength)
 The size of a line: LF, tag, TAB, value, TAB, checksum and CR.
 
char * TeleInfo::lineUnsigned (char *dst, const char *tag, uint16_t value, uint8_t index=0)
 Writes the line of an unsigned value (above 32767, line() would wrap).
 
char * TeleInfo::writeDigits (char *dst, uint16_t value)
 Writes the decimal digits of a 16-bit value.
 
template<typename Source>
bool TeleInfo::writeFrameStep (const uint8_t step, char *const text, uint8_t &length)
 Writes a step of the frame: one line, STX before the first one, ETX after the last.
 
char * TeleInfo::writeLine (char *dst, const char *tag, uint8_t index, uint16_t magnitude, bool negative)
 Writes a whole line: LF, tag and index, TAB, value, TAB, checksum and CR.
 

Variables

constexpr char TeleInfo::CR { 0x0D }
 
constexpr char TeleInfo::ETX { 0x03 }
 
constexpr char TeleInfo::LF { 0x0A }
 
constexpr uint8_t TeleInfo::MAX_STEP_LENGTH { 1 + lineSize(4, 6) }
 The most a step writes: STX or ETX, and the longest line, a 4-character tag ("S_MC") with a signed 16-bit value (-32768).
 
constexpr char TeleInfo::STX { 0x02 }
 
constexpr char TeleInfo::TAB { 0x09 }
 

Detailed Description

The telemetry frame of the IoT output, written a line at a time.

Author
your name (you@d.nosp@m.omai.nosp@m.n.com)
  • Frame Structure: a frame starts with a Start-of-Text (STX) character and ends with an End-of-Text (ETX) character. In between, one line per value: LF, tag (and index), TAB, value, TAB, checksum, CR.
  • Checksum: each line carries its own, (the sum of the bytes from the tag to the TAB before the checksum) & 0x3F, + 0x20.
  • Streamed: the frame is written one line per step of the serial output (see serial_output.h), as the text and JSON outputs: a line is built in a buffer of a few bytes on the stack, there is no frame buffer.
  • Arduino-free: the values come from a data source given as a template parameter (see writeFrameStep()), so the frame is tested natively (test/native/test_teleinfo).
  • Serial Configuration: Serial at 9600 baud, 7 data bits, even parity, 1 stop bit.
Version
0.2
Date
2026-11-24

Definition in file teleinfo.h.