mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-23 19:17:01 +00:00
38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
/**
|
|
* @copyright Utilitech AS 2023
|
|
* License: Fair Source
|
|
*
|
|
*/
|
|
|
|
#ifndef _JSONMQTTHANDLER_H
|
|
#define _JSONMQTTHANDLER_H
|
|
|
|
#include "AmsMqttHandler.h"
|
|
|
|
class JsonMqttHandler : public AmsMqttHandler {
|
|
public:
|
|
JsonMqttHandler(MqttConfig& mqttConfig, RemoteDebug* debugger, char* buf, HwTools* hw) : AmsMqttHandler(mqttConfig, debugger, buf) {
|
|
this->hw = hw;
|
|
};
|
|
bool publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, PriceService* ps);
|
|
bool publishTemperatures(AmsConfiguration*, HwTools*);
|
|
bool publishPrices(PriceService*);
|
|
bool publishSystem(HwTools* hw, PriceService* ps, EnergyAccounting* ea);
|
|
bool publishRaw(String data);
|
|
|
|
void onMessage(String &topic, String &payload);
|
|
|
|
uint8_t getFormat();
|
|
|
|
private:
|
|
HwTools* hw;
|
|
uint16_t appendJsonHeader(AmsData* data);
|
|
uint16_t appendJsonFooter(EnergyAccounting* ea, uint16_t pos);
|
|
bool publishList1(AmsData* data, EnergyAccounting* ea);
|
|
bool publishList2(AmsData* data, EnergyAccounting* ea);
|
|
bool publishList3(AmsData* data, EnergyAccounting* ea);
|
|
bool publishList4(AmsData* data, EnergyAccounting* ea);
|
|
String getMeterModel(AmsData* data);
|
|
};
|
|
#endif
|