diff --git a/include/payload.h b/include/payload.h index b2d5683f..328c0b4e 100644 --- a/include/payload.h +++ b/include/payload.h @@ -61,6 +61,62 @@ public: void addTime(time_t value); void addPM10(float value); void addPM25(float value); +private: + void addChars( char* string, int len); + +#if (PAYLOAD_ENCODER == 1) // format plain + +private: + uint8_t *buffer; + uint8_t cursor; + +#elif (PAYLOAD_ENCODER == 2) // format packed + +private: + uint8_t *buffer; + uint8_t cursor; + void uintToBytes(uint64_t i, uint8_t byteSize); + void writeUptime(uint64_t unixtime); + void writeLatLng(double latitude, double longitude); + void writeUint64(uint64_t i); + void writeUint32(uint32_t i); + void writeUint16(uint16_t i); + void writeUint8(uint8_t i); + void writeFloat(float value); + void writeUFloat(float value); + void writePressure(float value); + void writeVersion(char *version); + void writeBitmap(bool a, bool b, bool c, bool d, bool e, bool f, bool g, + bool h); + +#elif ((PAYLOAD_ENCODER == 3) || (PAYLOAD_ENCODER == 4)) // format cayenne lpp + +private: + uint8_t *buffer; + uint8_t maxsize; + uint8_t cursor; + +#else +#error No valid payload converter defined! +#endif +}; + +extern PayloadConvert payload; + +#endif // _PAYLOAD_H_ + void addCount(uint16_t value, uint8_t sniffytpe); + void addConfig(configData_t value); + void addStatus(uint16_t voltage, uint64_t uptime, float cputemp, uint32_t mem, + uint8_t reset1, uint8_t reset2); + void addAlarm(int8_t rssi, uint8_t message); + void addVoltage(uint16_t value); + void addGPS(gpsStatus_t value); + void addBME(bmeStatus_t value); + void addButton(uint8_t value); + void addSensor(uint8_t[]); + void addTime(time_t value); + void addPM10(float value); + void addPM25(float value); void addChars( char* string, int len); #if (PAYLOAD_ENCODER == 1) // format plain