mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-21 02:17:56 +00:00
Prep for KMP
This commit is contained in:
parent
e3511f0ee2
commit
13d0521984
@ -78,7 +78,7 @@ ADC_MODE(ADC_VCC);
|
||||
|
||||
#include "MeterCommunicator.h"
|
||||
#include "PassiveMeterCommunicator.h"
|
||||
//#include "KamstrupPullCommunicator.h"
|
||||
#include "KmpCommunicator.h"
|
||||
#include "PulseMeterCommunicator.h"
|
||||
|
||||
#include "Uptime.h"
|
||||
@ -171,7 +171,7 @@ RealtimePlot rtp;
|
||||
|
||||
MeterCommunicator* mc = NULL;
|
||||
PassiveMeterCommunicator* passiveMc = NULL;
|
||||
//KamstrupPullCommunicator* kamstrupMc = NULL;
|
||||
KmpCommunicator* kmpMc = NULL;
|
||||
PulseMeterCommunicator* pulseMc = NULL;
|
||||
|
||||
bool networkConnected = false;
|
||||
@ -260,11 +260,9 @@ void rxerr(int err) {
|
||||
if(passiveMc != NULL) {
|
||||
passiveMc->rxerr(err);
|
||||
}
|
||||
/*
|
||||
if(kamstrupMc != NULL) {
|
||||
kamstrupMc->rxerr(err);
|
||||
if(kmpMc != NULL) {
|
||||
kmpMc->rxerr(err);
|
||||
}
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -723,12 +721,10 @@ void loop() {
|
||||
delete pulseMc;
|
||||
pulseMc = NULL;
|
||||
}
|
||||
/*
|
||||
if(kamstrupMc != NULL) {
|
||||
delete(kamstrupMc);
|
||||
kamstrupMc = NULL;
|
||||
if(kmpMc != NULL) {
|
||||
delete(kmpMc);
|
||||
kmpMc = NULL;
|
||||
}
|
||||
*/
|
||||
if(passiveMc == NULL) {
|
||||
passiveMc = new PassiveMeterCommunicator(&Debug);
|
||||
}
|
||||
@ -736,7 +732,6 @@ void loop() {
|
||||
hwSerial = passiveMc->getHwSerial();
|
||||
mc = passiveMc;
|
||||
break;
|
||||
/*
|
||||
case METER_PARSER_KAMSTRUP:
|
||||
if(pulseMc != NULL) {
|
||||
delete pulseMc;
|
||||
@ -746,20 +741,18 @@ void loop() {
|
||||
delete(passiveMc);
|
||||
passiveMc = NULL;
|
||||
}
|
||||
if(kamstrupMc == NULL) {
|
||||
kamstrupMc = new KamstrupPullCommunicator(&Debug);
|
||||
if(kmpMc == NULL) {
|
||||
kmpMc = new KmpCommunicator(&Debug);
|
||||
}
|
||||
kamstrupMc->configure(meterConfig, tz);
|
||||
hwSerial = kamstrupMc->getHwSerial();
|
||||
mc = kamstrupMc;
|
||||
break;*/
|
||||
kmpMc->configure(meterConfig, tz);
|
||||
hwSerial = kmpMc->getHwSerial();
|
||||
mc = kmpMc;
|
||||
break;
|
||||
case METER_PARSER_PULSE:
|
||||
/*
|
||||
if(kamstrupMc != NULL) {
|
||||
delete(kamstrupMc);
|
||||
kamstrupMc = NULL;
|
||||
if(kmpMc != NULL) {
|
||||
delete(kmpMc);
|
||||
kmpMc = NULL;
|
||||
}
|
||||
*/
|
||||
if(passiveMc != NULL) {
|
||||
delete(passiveMc);
|
||||
passiveMc = NULL;
|
||||
|
||||
12
src/KmpCommunicator.cpp
Normal file
12
src/KmpCommunicator.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "KmpCommunicator.h"
|
||||
|
||||
KmpCommunicator::KmpCommunicator(RemoteDebug* debugger) {}
|
||||
void KmpCommunicator::configure(MeterConfig& config, Timezone* tz) {}
|
||||
bool KmpCommunicator::loop() { return false; }
|
||||
AmsData* KmpCommunicator::getData(AmsData& meterState) { return NULL; }
|
||||
int KmpCommunicator::getLastError() { return 0; }
|
||||
bool KmpCommunicator::isConfigChanged() { return false; }
|
||||
void KmpCommunicator::getCurrentConfig(MeterConfig& meterConfig) {}
|
||||
|
||||
HardwareSerial* KmpCommunicator::getHwSerial() { return NULL; }
|
||||
void KmpCommunicator::rxerr(int err) {}
|
||||
27
src/KmpCommunicator.h
Normal file
27
src/KmpCommunicator.h
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @copyright Utilitech AS 2024
|
||||
* License: Fair Source
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MeterCommunicator.h"
|
||||
#include "RemoteDebug.h"
|
||||
#include "AmsConfiguration.h"
|
||||
#include "Timezone.h"
|
||||
#include "ImpulseAmsData.h"
|
||||
|
||||
class KmpCommunicator : public MeterCommunicator {
|
||||
public:
|
||||
KmpCommunicator(RemoteDebug* debugger);
|
||||
void configure(MeterConfig& config, Timezone* tz);
|
||||
bool loop();
|
||||
AmsData* getData(AmsData& meterState);
|
||||
int getLastError();
|
||||
bool isConfigChanged();
|
||||
void getCurrentConfig(MeterConfig& meterConfig);
|
||||
|
||||
HardwareSerial* getHwSerial();
|
||||
void rxerr(int err);
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user