|
| template<typename Source> |
| char * | frameLine (uint8_t step, char *dst) |
| | Writes the line of a step.
|
| |
| template<typename Source> |
| constexpr uint8_t | frameSteps () |
| | The number of steps of a frame: one per line, invalid temperatures included (they write nothing).
|
| |
| char * | line (char *dst, const char *tag, int16_t value, uint8_t index=0) |
| | Writes the line of a signed value.
|
| |
| constexpr uint8_t | lineSize (uint8_t tagLength, uint8_t valueLength) |
| | The size of a line: LF, tag, TAB, value, TAB, checksum and CR.
|
| |
| char * | 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 * | writeDigits (char *dst, uint16_t value) |
| | Writes the decimal digits of a 16-bit value.
|
| |
| template<typename Source> |
| bool | 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 * | 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.
|
| |
The telemetry frame of the IoT output.
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.
The lines, in this order:
- "P": the power at the grid connection, in W (import > 0);
- with several phases, "Pn" then "Vn" for each phase, the last phase first: the phase's power in W, and its RMS voltage in hundredths of V;
- with relay diversion, "R": the relays' average power, in W, then "R1" to "Rn": each relay's state (1 ON, 0 OFF), Rn first;
- "D1" to "Dn": each load's ON time over the datalog period, in %, Dn first;
- with temperature sensing, "T1" to "Tn": each valid temperature, in hundredths of °C;
- "N": the number of seconds without diverted energy;
- with dual tariff, "TA": the tariff (0 high/on-peak, 1 low/off-peak);
- "S": the number of sample sets over the datalog period;
- "S_MC": the lowest number of sample sets in a mains cycle.
The data source is a type with these members:
static constexpr bool RELAY_DIVERSION, DUAL_TARIFF;
static constexpr uint8_t PHASE_COUNT, RELAY_COUNT, LOAD_COUNT, TEMP_COUNT;
static int16_t power(), phasePower(uint8_t idx), relayAverage(), loadOnPercent(uint8_t idx), temperature(uint8_t idx);
static uint16_t phaseVoltage(uint8_t idx), absenceCount(), sampleSets();
static bool relayOn(uint8_t idx), temperatureValid(uint8_t idx), offPeak();
static uint8_t lowestSampleSetsPerCycle().
Every value of a frame must stay that of the same datalog period until its last step.
- Parameters
-
| step | The index of the step, from 0. |
| text | Where to write, room for MAX_STEP_LENGTH characters. |
| [out] | length | The number of characters written (0 for an invalid temperature). |
- Returns
- false at the last step.
Definition at line 304 of file teleinfo.h.
| char * TeleInfo::writeLine |
( |
char * | dst, |
|
|
const char * | tag, |
|
|
uint8_t | index, |
|
|
uint16_t | magnitude, |
|
|
bool | negative ) |
|
inline |
Writes a whole line: LF, tag and index, TAB, value, TAB, checksum and CR.
The checksum is summed over the line once written: about 15 bytes, once per datalog period, in the main loop.
- Parameters
-
| dst | Where to write, room for lineSize() bytes. |
| tag | The tag, at most 4 characters with the index. |
| index | Appended to the tag as a digit (1-9), none when 0. |
| magnitude | The magnitude of the value. |
| negative | Whether the value is negative. |
- Returns
- The end of the line.
Definition at line 100 of file teleinfo.h.