move state variable to the parent class
This commit is contained in:
@@ -35,10 +35,6 @@ class Control:
|
|||||||
|
|
||||||
|
|
||||||
class Talent(Message):
|
class Talent(Message):
|
||||||
STATE_INIT = 0
|
|
||||||
STATE_UP = 2
|
|
||||||
STATE_CLOSED = 3
|
|
||||||
|
|
||||||
def __init__(self, server_side: bool, id_str=b''):
|
def __init__(self, server_side: bool, id_str=b''):
|
||||||
super().__init__(server_side)
|
super().__init__(server_side)
|
||||||
self.await_conn_resp_cnt = 0
|
self.await_conn_resp_cnt = 0
|
||||||
@@ -48,7 +44,6 @@ class Talent(Message):
|
|||||||
self.db = InfosG3()
|
self.db = InfosG3()
|
||||||
self.mb = Modbus()
|
self.mb = Modbus()
|
||||||
self.forward_modbus_resp = False
|
self.forward_modbus_resp = False
|
||||||
self.state = self.STATE_INIT
|
|
||||||
self.switch = {
|
self.switch = {
|
||||||
0x00: self.msg_contact_info,
|
0x00: self.msg_contact_info,
|
||||||
0x13: self.msg_ota_update,
|
0x13: self.msg_ota_update,
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ class IterRegistry(type):
|
|||||||
|
|
||||||
class Message(metaclass=IterRegistry):
|
class Message(metaclass=IterRegistry):
|
||||||
_registry = []
|
_registry = []
|
||||||
|
STATE_INIT = 0
|
||||||
|
STATE_UP = 2
|
||||||
|
STATE_CLOSED = 3
|
||||||
|
|
||||||
def __init__(self, server_side: bool):
|
def __init__(self, server_side: bool):
|
||||||
self._registry.append(weakref.ref(self))
|
self._registry.append(weakref.ref(self))
|
||||||
@@ -65,6 +68,7 @@ class Message(metaclass=IterRegistry):
|
|||||||
self._send_buffer = bytearray(0)
|
self._send_buffer = bytearray(0)
|
||||||
self._forward_buffer = bytearray(0)
|
self._forward_buffer = bytearray(0)
|
||||||
self.new_data = {}
|
self.new_data = {}
|
||||||
|
self.state = self.STATE_INIT
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Empty methods, that have to be implemented in any child class which
|
Empty methods, that have to be implemented in any child class which
|
||||||
|
|||||||
Reference in New Issue
Block a user