Support for pulse meter

This commit is contained in:
Gunnar Skjold
2024-01-18 07:57:56 +01:00
parent e7ca408baa
commit 87ddf00afa
8 changed files with 244 additions and 52 deletions

View File

@@ -0,0 +1,41 @@
/**
* @copyright Utilitech AS 2024
* License: Fair Source
*
*/
#ifndef _PULSEMETERCOMMUNICATOR_H
#define _PULSEMETERCOMMUNICATOR_H
#include "MeterCommunicator.h"
#include "RemoteDebug.h"
#include "AmsConfiguration.h"
#include "Timezone.h"
#include "ImpulseAmsData.h"
class PulseMeterCommunicator : public MeterCommunicator {
public:
PulseMeterCommunicator(RemoteDebug* debugger);
void configure(MeterConfig&, Timezone*);
bool loop();
AmsData* getData(AmsData& meterState);
int getLastError();
bool isConfigChanged();
void getCurrentConfig(MeterConfig& meterConfig);
void onPulse(uint8_t pulses);
protected:
RemoteDebug* debugger = NULL;
MeterConfig meterConfig;
bool configChanged = false;
Timezone* tz;
bool updated = false;
bool initialized = false;
AmsData state;
uint64_t lastUpdate = 0;
void setupGpio();
};
#endif