Skip to content
Snippets Groups Projects
Commit 121c1a13 authored by Martin Teichmann's avatar Martin Teichmann
Browse files

support RS232 terminal

this also adds support for terminals which have both
PacketVars and ProcessVars
parent e902ab06
No related branches found
No related tags found
No related merge requests found
Pipeline #142966 failed
......@@ -92,7 +92,7 @@ class ProcessDesc:
def __get__(self, instance, owner):
if instance is None:
return self
index = self.index + instance.position_offset[SyncManager.IN]
index = self.index + instance.position_offset[None]
if isinstance(instance, Struct):
terminal = instance.terminal
device = instance.device
......@@ -276,7 +276,7 @@ class EBPFTerminal(Terminal):
product id of all supported terminal types.
"""
compatibility = None
position_offset = {SyncManager.OUT: 0, SyncManager.IN: 0}
position_offset = {SyncManager.OUT: 0, SyncManager.IN: 0, None: 0}
use_fmmu = True
out_pdos = None
in_pdos = None
......
......@@ -497,16 +497,19 @@ class Struct:
"""
device = None
def __new__(cls, *args):
return StructDesc(cls, *args)
def __new__(cls, *args, **kwargs):
return StructDesc(cls, *args, **kwargs)
class StructDesc:
def __init__(self, struct, sm3=0, sm2=None):
def __init__(self, struct, sm3=0, sm2=None, coe=None):
self.struct = struct
if sm2 is None:
sm2 = sm3
self.position_offset = {SyncManager.OUT: sm2, SyncManager.IN: sm3}
if coe is None:
coe = sm3
self.position_offset = {SyncManager.OUT: sm2, SyncManager.IN: sm3,
None: coe}
def __get__(self, instance, owner):
if instance is None:
......@@ -680,7 +683,7 @@ class Terminal:
await self.read_object_entry(v.index, v.subidx))
elif isinstance(v, StructDesc):
struct = getattr(self, k)
offset = struct.position_offset[SyncManager.IN]
offset = struct.position_offset[None]
for kk, vv in struct.__class__.__dict__.items():
if isinstance(vv, ServiceDesc):
setattr(struct, kk,
......
......@@ -45,7 +45,7 @@ class EL2212(EBPFTerminal):
compatibility = {(2, 0x8A43052)}
class Channel(Struct):
output = ProcessDesc(0x7000, 2)
value = ProcessDesc(0x7000, 2)
boost_current = ServiceDesc(0x8000, 1)
hold_current = ServiceDesc(0x8000, 2)
......@@ -169,8 +169,8 @@ class EL5042(EBPFTerminal):
channel2 = Channel(0x10)
class EL6022(EBPFTerminal):
compatibility = {(2, 0x17863052)}
class EL6002(EBPFTerminal):
compatibility = {(2, 393359442)}
class Channel(Struct):
transmit_accept = PacketDesc(SyncManager.IN, 0, 0)
......@@ -193,8 +193,20 @@ class EL6022(EBPFTerminal):
baudRate = ServiceDesc(0x8000, 0x11)
dataFrame = ServiceDesc(0x8000, 0x15)
channel1 = Channel(0)
channel2 = Channel(0x10)
channel1 = Channel(0, 0, 0)
channel2 = Channel(24, 24, 0x10)
class EL6022(EBPFTerminal):
compatibility = {(2, 0x17863052)}
class Channel(EL6002.Channel):
enableHalfDuplex = ServiceDesc(0x8000, 6)
enablePointToPoint = ServiceDesc(0x8000, 7)
channel1 = Channel(0, 0, 0)
channel2 = Channel(24, 24, 0x10)
class EL7041(EBPFTerminal):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment