From 55344b158b78fb48623449ce36637ce8c9eadf7c Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Mon, 8 Jul 2019 16:33:37 +0200 Subject: [PATCH] whatever --- src/RegisterDatapoint.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/RegisterDatapoint.py b/src/RegisterDatapoint.py index 221be46..e6a02f5 100644 --- a/src/RegisterDatapoint.py +++ b/src/RegisterDatapoint.py @@ -83,20 +83,24 @@ class HoldingRegisterDatapoint(AbstractModbusDatapoint): self.writeRequestValue = value - - -class InputRegisterDatapoint(AbstractModbusDatapoint): +class ReadOnlyDatapoint(AbstractModbusDatapoint): def __init__(self, label, unit, address, count, scanRate, updateOnly, publishTopic): super().__init__(label, unit, address, count, scanRate) self.updateOnly = updateOnly self.lastValue = None self.publishTopic = publishTopic self.lastContact = None - self.type = 'input register' def __str__(self): return "[{0!s}, UpdateOnly: {1}, Read: {2}".format(super().__str__(), self.updateOnly, self.publishTopic) + + +class InputRegisterDatapoint(ReadOnlyDatapoint): + def __init__(self, label, unit, address, count, scanRate, updateOnly, publishTopic): + super().__init__(label, unit, address, count, scanRate, updateOnly, publishTopic) + self.type = 'input register' + def process(self, client, pubQueue): successFull = True giveUp = False @@ -123,18 +127,11 @@ class InputRegisterDatapoint(AbstractModbusDatapoint): pass -class DiscreteInputDatapoint(AbstractModbusDatapoint): +class DiscreteInputDatapoint(ReadOnlyDatapoint): def __init__(self, label, unit, address, count, scanRate, updateOnly, publishTopic): - super().__init__(label, unit, address, count, scanRate) - self.updateOnly = updateOnly - self.lastValue = None - self.publishTopic = publishTopic - self.lastContact = None + super().__init__(label, unit, address, count, scanRate, updateOnly, publishTopic) self.type = 'discrete input' - def __str__(self): - return "[{0!s}, UpdateOnly: {1}, Read: {2}".format(super().__str__(), self.updateOnly, self.publishTopic) - def process(self, client, pubQueue): successFull = True giveUp = False