* GEN3: Invalid Contact Info Msg Fixes #191 * introduce ifc with FIFOs * add object factory * use AsyncIfc class with FIFO * declare more methods as classmethods * - refactoring - remove _forward_buffer - make async_write private * remove _forward_buffer * refactoring * avoid mqtt handling for invalid serial numbers * add two more callbacks * FIX update_header_cb handling * split AsyncStream in two classes * split ConnectionG3(P) in server and client class * update class diagramm * refactor server creation * remove duplicated imports * reduce code duplication * move StremPtr instances into Inverter class * resolution of connection classes - remove ConnectionG3Client - remove ConnectionG3Server - remove ConnectionG3PClient - remove ConnectionG3PServer * fix server connections * fix client loop closing * don't overwrite self.remote in constructor * update class diagramm * fixes - fixes null pointer accesses - initalize AsyncStreamClient with proper StreamPtr instance * add close callback * refactor close handling * remove connection classes * move more code into InverterBase class * remove test_inverter_base.py * add abstract inverter interface class * initial commit * fix sonar qube warnings * rename class Inverter into Proxy * fix typo * move class InverterIfc into a separate file * add more testcases * use ProtocolIfc class * add unit tests for AsyncStream class * icrease test coverage * reduce cognitive complexity * increase test coverage * increase tes coverage * simplify heartbeat handler * remove obsolete tx_get method * add more unittests * update changelog * remove __del__ method for proper gc runs * check releasing of ModbusConn instances * call garbage collector to release unreachable objs * decrease ref counter after the with block
41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
from abc import abstractmethod
|
|
import logging
|
|
from asyncio import StreamReader, StreamWriter
|
|
|
|
if __name__ == "app.src.inverter_ifc":
|
|
from app.src.iter_registry import AbstractIterMeta
|
|
else: # pragma: no cover
|
|
from iter_registry import AbstractIterMeta
|
|
|
|
logger_mqtt = logging.getLogger('mqtt')
|
|
|
|
|
|
class InverterIfc(metaclass=AbstractIterMeta):
|
|
_registry = []
|
|
|
|
@abstractmethod
|
|
def __init__(self, reader: StreamReader, writer: StreamWriter,
|
|
config_id: str, prot_class,
|
|
client_mode: bool):
|
|
pass # pragma: no cover
|
|
|
|
@abstractmethod
|
|
def __enter__(self):
|
|
pass # pragma: no cover
|
|
|
|
@abstractmethod
|
|
def __exit__(self, exc_type, exc, tb):
|
|
pass # pragma: no cover
|
|
|
|
@abstractmethod
|
|
def healthy(self) -> bool:
|
|
pass # pragma: no cover
|
|
|
|
@abstractmethod
|
|
async def disc(self, shutdown_started=False) -> None:
|
|
pass # pragma: no cover
|
|
|
|
@abstractmethod
|
|
async def create_remote(self) -> None:
|
|
pass # pragma: no cover
|