mirror of
https://github.com/naruxde/revpimodio2.git
synced 2025-11-08 13:53:53 +01:00
Merge pull request #12 from nbuchwitz/feature/product-type
introduce ProductType enum
This commit is contained in:
@@ -96,7 +96,7 @@ def consttostr(value) -> str:
|
|||||||
|
|
||||||
|
|
||||||
# Benötigte Klassen importieren
|
# Benötigte Klassen importieren
|
||||||
from .pictory import AIO, COMPACT, DI, DO, DIO, FLAT
|
from .pictory import ProductType, AIO, COMPACT, DI, DO, DIO, FLAT
|
||||||
from .helper import Cycletools, EventCallback
|
from .helper import Cycletools, EventCallback
|
||||||
from .modio import RevPiModIO, RevPiModIODriver, RevPiModIOSelected, run_plc
|
from .modio import RevPiModIO, RevPiModIODriver, RevPiModIOSelected, run_plc
|
||||||
from .netio import RevPiNetIO, RevPiNetIODriver, RevPiNetIOSelected
|
from .netio import RevPiNetIO, RevPiNetIODriver, RevPiNetIOSelected
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ __author__ = "Sven Sager"
|
|||||||
__copyright__ = "Copyright (C) 2020 Sven Sager"
|
__copyright__ = "Copyright (C) 2020 Sven Sager"
|
||||||
__license__ = "LGPLv3"
|
__license__ = "LGPLv3"
|
||||||
|
|
||||||
|
from .pictory import ProductType
|
||||||
|
|
||||||
|
|
||||||
class DeviceList(object):
|
class DeviceList(object):
|
||||||
"""Basisklasse fuer direkten Zugriff auf Device Objekte."""
|
"""Basisklasse fuer direkten Zugriff auf Device Objekte."""
|
||||||
@@ -340,7 +342,7 @@ class Device(object):
|
|||||||
iotype,
|
iotype,
|
||||||
"little",
|
"little",
|
||||||
# Bei AIO (103) signed auf True setzen
|
# Bei AIO (103) signed auf True setzen
|
||||||
self._producttype == 103
|
self._producttype == ProductType.AIO
|
||||||
)
|
)
|
||||||
|
|
||||||
# IO registrieren
|
# IO registrieren
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ __author__ = "Sven Sager"
|
|||||||
__copyright__ = "Copyright (C) 2020 Sven Sager"
|
__copyright__ = "Copyright (C) 2020 Sven Sager"
|
||||||
__license__ = "LGPLv3"
|
__license__ = "LGPLv3"
|
||||||
|
|
||||||
|
from .pictory import ProductType
|
||||||
|
|
||||||
|
|
||||||
class RevPiModIO(object):
|
class RevPiModIO(object):
|
||||||
"""
|
"""
|
||||||
@@ -236,25 +238,25 @@ class RevPiModIO(object):
|
|||||||
if device["type"] == "BASE":
|
if device["type"] == "BASE":
|
||||||
# Basedevices
|
# Basedevices
|
||||||
pt = int(device["productType"])
|
pt = int(device["productType"])
|
||||||
if pt == 95:
|
if pt == ProductType.REVPI_CORE:
|
||||||
# RevPi Core
|
# RevPi Core
|
||||||
dev_new = devicemodule.Core(
|
dev_new = devicemodule.Core(
|
||||||
self, device, simulator=self._simulator
|
self, device, simulator=self._simulator
|
||||||
)
|
)
|
||||||
self.core = dev_new
|
self.core = dev_new
|
||||||
elif pt == 105:
|
elif pt == ProductType.REVPI_CONNECT:
|
||||||
# RevPi Connect
|
# RevPi Connect
|
||||||
dev_new = devicemodule.Connect(
|
dev_new = devicemodule.Connect(
|
||||||
self, device, simulator=self._simulator
|
self, device, simulator=self._simulator
|
||||||
)
|
)
|
||||||
self.core = dev_new
|
self.core = dev_new
|
||||||
elif pt == 104:
|
elif pt == ProductType.REVPI_COMPACT:
|
||||||
# RevPi Compact
|
# RevPi Compact
|
||||||
dev_new = devicemodule.Compact(
|
dev_new = devicemodule.Compact(
|
||||||
self, device, simulator=self._simulator
|
self, device, simulator=self._simulator
|
||||||
)
|
)
|
||||||
self.core = dev_new
|
self.core = dev_new
|
||||||
elif pt == 135:
|
elif pt == ProductType.REVPI_FLAT:
|
||||||
# RevPi Flat
|
# RevPi Flat
|
||||||
dev_new = devicemodule.Flat(
|
dev_new = devicemodule.Flat(
|
||||||
self, device, simulator=self._simulator
|
self, device, simulator=self._simulator
|
||||||
@@ -268,7 +270,7 @@ class RevPiModIO(object):
|
|||||||
elif device["type"] == "LEFT_RIGHT":
|
elif device["type"] == "LEFT_RIGHT":
|
||||||
# IOs
|
# IOs
|
||||||
pt = int(device["productType"])
|
pt = int(device["productType"])
|
||||||
if pt == 96 or pt == 97 or pt == 98:
|
if pt == ProductType.DIO or pt == ProductType.DI or pt == ProductType.DO:
|
||||||
# DIO / DI / DO
|
# DIO / DI / DO
|
||||||
dev_new = devicemodule.DioModule(
|
dev_new = devicemodule.DioModule(
|
||||||
self, device, simulator=self._simulator
|
self, device, simulator=self._simulator
|
||||||
|
|||||||
@@ -14,6 +14,37 @@ __license__ = "LGPLv3"
|
|||||||
# - RevPiConCan_20180425_1_0.rap
|
# - RevPiConCan_20180425_1_0.rap
|
||||||
# - RevPiGateCANopen_20161102_1_0.rap
|
# - RevPiGateCANopen_20161102_1_0.rap
|
||||||
|
|
||||||
|
class ProductType:
|
||||||
|
GATEWAY_CAN_OPEN = 71
|
||||||
|
GATEWAY_CCLINK = 72
|
||||||
|
GATEWAY_DEV_NET = 73
|
||||||
|
GATEWAY_ETHERCAT = 74
|
||||||
|
GATEWAY_ETHERNET_IP = 75
|
||||||
|
GATEWAY_POWERLINK = 76
|
||||||
|
GATEWAY_PROFIBUS = 77
|
||||||
|
GATEWAY_PROFINET_RT = 78
|
||||||
|
GATEWAY_PROFINET_IRT = 79
|
||||||
|
GATEWAY_CAN_OPEN_MASTER = 80
|
||||||
|
GATEWAY_SERCOS3 = 81
|
||||||
|
GATEWAY_SERIAL = 82
|
||||||
|
GATEWAY_PROFINET_SITARA = 83
|
||||||
|
GATEWAY_PROFINET_IRT_MASTER = 84
|
||||||
|
GATEWAY_ETHERCAT_MASTER = 85
|
||||||
|
GATEWAY_MODBUS_RTU = 92
|
||||||
|
GATEWAY_MODBUS_TCP = 83
|
||||||
|
GATEWAY_DMX = 199
|
||||||
|
|
||||||
|
DIO = 96
|
||||||
|
DI = 97
|
||||||
|
DO = 98
|
||||||
|
AIO = 103
|
||||||
|
MIO = 118
|
||||||
|
|
||||||
|
REVPI_CORE = 95
|
||||||
|
REVPI_COMPACT = 104
|
||||||
|
REVPI_CONNECT = 105
|
||||||
|
REVPI_FLAT = 135
|
||||||
|
|
||||||
|
|
||||||
class AIO:
|
class AIO:
|
||||||
"""Memory value mappings for RevPi AIO 1.0 (RevPiAIO_20170301_1_0.rap)."""
|
"""Memory value mappings for RevPi AIO 1.0 (RevPiAIO_20170301_1_0.rap)."""
|
||||||
|
|||||||
Reference in New Issue
Block a user