mirror of
https://github.com/naruxde/revpimodio2.git
synced 2025-11-08 22:03:53 +01:00
Mit slots zusammenführen
This commit is contained in:
@@ -9,6 +9,8 @@ revpimodio2</h1>
|
|||||||
<p>
|
<p>
|
||||||
Stellt alle Klassen fuer den RevolutionPi zur Verfuegung.
|
Stellt alle Klassen fuer den RevolutionPi zur Verfuegung.
|
||||||
</p><p>
|
</p><p>
|
||||||
|
Webpage: https://revpimodio.org/
|
||||||
|
</p><p>
|
||||||
Stellt Klassen fuer die einfache Verwendung des Revolution Pis der
|
Stellt Klassen fuer die einfache Verwendung des Revolution Pis der
|
||||||
Kunbus GmbH (https://revolution.kunbus.de/) zur Verfuegung. Alle I/Os werden
|
Kunbus GmbH (https://revolution.kunbus.de/) zur Verfuegung. Alle I/Os werden
|
||||||
aus der piCtory Konfiguration eingelesen und mit deren Namen direkt zugreifbar
|
aus der piCtory Konfiguration eingelesen und mit deren Namen direkt zugreifbar
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ revpimodio2.__init__</h1>
|
|||||||
<p>
|
<p>
|
||||||
Stellt alle Klassen fuer den RevolutionPi zur Verfuegung.
|
Stellt alle Klassen fuer den RevolutionPi zur Verfuegung.
|
||||||
</p><p>
|
</p><p>
|
||||||
|
Webpage: https://revpimodio.org/
|
||||||
|
</p><p>
|
||||||
Stellt Klassen fuer die einfache Verwendung des Revolution Pis der
|
Stellt Klassen fuer die einfache Verwendung des Revolution Pis der
|
||||||
Kunbus GmbH (https://revolution.kunbus.de/) zur Verfuegung. Alle I/Os werden
|
Kunbus GmbH (https://revolution.kunbus.de/) zur Verfuegung. Alle I/Os werden
|
||||||
aus der piCtory Konfiguration eingelesen und mit deren Namen direkt zugreifbar
|
aus der piCtory Konfiguration eingelesen und mit deren Namen direkt zugreifbar
|
||||||
@@ -20,7 +22,7 @@ fuehrt das Modul bei Datenaenderung aus.
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Global Attributes</h3>
|
Global Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>BOTH</td></tr><tr><td>FALLING</td></tr><tr><td>GREEN</td></tr><tr><td>INP</td></tr><tr><td>MEM</td></tr><tr><td>OFF</td></tr><tr><td>OUT</td></tr><tr><td>RED</td></tr><tr><td>RISING</td></tr><tr><td>__all__</td></tr><tr><td>__author__</td></tr><tr><td>__name__</td></tr><tr><td>__package__</td></tr><tr><td>__version__</td></tr>
|
<tr><td>BOTH</td></tr><tr><td>FALLING</td></tr><tr><td>GREEN</td></tr><tr><td>INP</td></tr><tr><td>MEM</td></tr><tr><td>OFF</td></tr><tr><td>OUT</td></tr><tr><td>RED</td></tr><tr><td>RISING</td></tr><tr><td>__all__</td></tr><tr><td>__author__</td></tr><tr><td>__copyright__</td></tr><tr><td>__license__</td></tr><tr><td>__name__</td></tr><tr><td>__version__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Classes</h3>
|
Classes</h3>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Bildet die App Sektion von piCtory ab.
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Global Attributes</h3>
|
Global Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__author__</td></tr><tr><td>__copyright__</td></tr><tr><td>__license__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Classes</h3>
|
Classes</h3>
|
||||||
@@ -39,7 +39,7 @@ object
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__slots__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
|
|||||||
@@ -12,12 +12,15 @@ Modul fuer die Verwaltung der Devices.
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Global Attributes</h3>
|
Global Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__author__</td></tr><tr><td>__copyright__</td></tr><tr><td>__license__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Classes</h3>
|
Classes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td><a style="color:#0000FF" href="#Connect">Connect</a></td>
|
||||||
|
<td>Klasse fuer den RevPi Connect.</td>
|
||||||
|
</tr><tr>
|
||||||
<td><a style="color:#0000FF" href="#Core">Core</a></td>
|
<td><a style="color:#0000FF" href="#Core">Core</a></td>
|
||||||
<td>Klasse fuer den RevPi Core.</td>
|
<td>Klasse fuer den RevPi Core.</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
@@ -40,6 +43,124 @@ Functions</h3>
|
|||||||
<tr><td>None</td></tr>
|
<tr><td>None</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<hr /><hr />
|
<hr /><hr />
|
||||||
|
<a NAME="Connect" ID="Connect"></a>
|
||||||
|
<h2 style="background-color:#FFFFFF;color:#0000FF">Connect</h2>
|
||||||
|
<p>
|
||||||
|
Klasse fuer den RevPi Connect.
|
||||||
|
</p><p>
|
||||||
|
Stellt Funktionen fuer die LEDs, Watchdog und den Status zur Verfuegung.
|
||||||
|
</p><p>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Derived from</h3>
|
||||||
|
Core
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Class Attributes</h3>
|
||||||
|
<table>
|
||||||
|
<tr><td>A3</td></tr><tr><td>__slots__</td></tr><tr><td>wdautotoggle</td></tr>
|
||||||
|
</table>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Class Methods</h3>
|
||||||
|
<table>
|
||||||
|
<tr><td>None</td></tr>
|
||||||
|
</table>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Methods</h3>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td><a style="color:#0000FF" href="#Connect.__wdtoggle">__wdtoggle</a></td>
|
||||||
|
<td>WD Ausgang alle 10 Sekunden automatisch toggeln.</td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><a style="color:#0000FF" href="#Connect._devconfigure">_devconfigure</a></td>
|
||||||
|
<td>Connect-Klasse vorbereiten.</td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><a style="color:#0000FF" href="#Connect._get_leda3">_get_leda3</a></td>
|
||||||
|
<td>Gibt den Zustand der LED A3 vom Connect zurueck.</td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><a style="color:#0000FF" href="#Connect._get_wdtoggle">_get_wdtoggle</a></td>
|
||||||
|
<td>Ruft den Wert fuer Autowatchdog ab.</td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><a style="color:#0000FF" href="#Connect._set_leda3">_set_leda3</a></td>
|
||||||
|
<td>Setzt den Zustand der LED A3 vom Connect.</td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><a style="color:#0000FF" href="#Connect._set_wdtoggle">_set_wdtoggle</a></td>
|
||||||
|
<td>Setzt den Wert fuer Autowatchdog.</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Static Methods</h3>
|
||||||
|
<table>
|
||||||
|
<tr><td>None</td></tr>
|
||||||
|
</table>
|
||||||
|
<a NAME="Connect.__wdtoggle" ID="Connect.__wdtoggle"></a>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Connect.__wdtoggle</h3>
|
||||||
|
<b>__wdtoggle</b>(<i></i>)
|
||||||
|
<p>
|
||||||
|
WD Ausgang alle 10 Sekunden automatisch toggeln.
|
||||||
|
</p><a NAME="Connect._devconfigure" ID="Connect._devconfigure"></a>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Connect._devconfigure</h3>
|
||||||
|
<b>_devconfigure</b>(<i></i>)
|
||||||
|
<p>
|
||||||
|
Connect-Klasse vorbereiten.
|
||||||
|
</p><a NAME="Connect._get_leda3" ID="Connect._get_leda3"></a>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Connect._get_leda3</h3>
|
||||||
|
<b>_get_leda3</b>(<i></i>)
|
||||||
|
<p>
|
||||||
|
Gibt den Zustand der LED A3 vom Connect zurueck.
|
||||||
|
</p><dl>
|
||||||
|
<dt>Returns:</dt>
|
||||||
|
<dd>
|
||||||
|
0=aus, 1=gruen, 2=rot
|
||||||
|
</dd>
|
||||||
|
</dl><a NAME="Connect._get_wdtoggle" ID="Connect._get_wdtoggle"></a>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Connect._get_wdtoggle</h3>
|
||||||
|
<b>_get_wdtoggle</b>(<i></i>)
|
||||||
|
<p>
|
||||||
|
Ruft den Wert fuer Autowatchdog ab.
|
||||||
|
</p><dl>
|
||||||
|
<dt>Returns:</dt>
|
||||||
|
<dd>
|
||||||
|
True, wenn Autowatchdog aktiv ist
|
||||||
|
</dd>
|
||||||
|
</dl><a NAME="Connect._set_leda3" ID="Connect._set_leda3"></a>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Connect._set_leda3</h3>
|
||||||
|
<b>_set_leda3</b>(<i>value</i>)
|
||||||
|
<p>
|
||||||
|
Setzt den Zustand der LED A3 vom Connect.
|
||||||
|
</p><dl>
|
||||||
|
<dt><i>value</i></dt>
|
||||||
|
<dd>
|
||||||
|
0=aus, 1=gruen, 2=rot
|
||||||
|
</dd>
|
||||||
|
</dl><a NAME="Connect._set_wdtoggle" ID="Connect._set_wdtoggle"></a>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Connect._set_wdtoggle</h3>
|
||||||
|
<b>_set_wdtoggle</b>(<i>value</i>)
|
||||||
|
<p>
|
||||||
|
Setzt den Wert fuer Autowatchdog.
|
||||||
|
</p><p>
|
||||||
|
Wird dieser Wert auf True gesetzt, wechselt im Hintergrund das noetige
|
||||||
|
Bit zum toggeln des Watchdogs alle 10 Sekunden zwichen True und False.
|
||||||
|
Dieses Bit wird bei autorefresh=True natuerlich automatisch in das
|
||||||
|
Prozessabbild geschrieben.
|
||||||
|
</p><p>
|
||||||
|
WICHTIG: Sollte autorefresh=False sein, muss zyklisch
|
||||||
|
.writeprocimg() aufgerufen werden, um den Wert in das
|
||||||
|
Prozessabbild zu schreiben!!!
|
||||||
|
</p><dl>
|
||||||
|
<dt><i>value</i></dt>
|
||||||
|
<dd>
|
||||||
|
True zum aktivieren, Fals zum beenden
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||||
|
<hr /><hr />
|
||||||
<a NAME="Core" ID="Core"></a>
|
<a NAME="Core" ID="Core"></a>
|
||||||
<h2 style="background-color:#FFFFFF;color:#0000FF">Core</h2>
|
<h2 style="background-color:#FFFFFF;color:#0000FF">Core</h2>
|
||||||
<p>
|
<p>
|
||||||
@@ -55,7 +176,7 @@ Device
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>A1</td></tr><tr><td>A2</td></tr><tr><td>status</td></tr>
|
<tr><td>A1</td></tr><tr><td>A2</td></tr><tr><td>__slots__</td></tr><tr><td>status</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -73,19 +194,22 @@ Methods</h3>
|
|||||||
<td>Core-Klasse vorbereiten.</td>
|
<td>Core-Klasse vorbereiten.</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a style="color:#0000FF" href="#Core._get_leda1">_get_leda1</a></td>
|
<td><a style="color:#0000FF" href="#Core._get_leda1">_get_leda1</a></td>
|
||||||
<td>Gibt den Zustand der LED A1 vom core zurueck.</td>
|
<td>Gibt den Zustand der LED A1 vom Core zurueck.</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a style="color:#0000FF" href="#Core._get_leda2">_get_leda2</a></td>
|
<td><a style="color:#0000FF" href="#Core._get_leda2">_get_leda2</a></td>
|
||||||
<td>Gibt den Zustand der LED A2 vom core zurueck.</td>
|
<td>Gibt den Zustand der LED A2 vom Core zurueck.</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a style="color:#0000FF" href="#Core._get_status">_get_status</a></td>
|
<td><a style="color:#0000FF" href="#Core._get_status">_get_status</a></td>
|
||||||
<td>Gibt den RevPi Core Status zurueck.</td>
|
<td>Gibt den RevPi Core Status zurueck.</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
|
<td><a style="color:#0000FF" href="#Core._set_calculatedled">_set_calculatedled</a></td>
|
||||||
|
<td>Berechnet und setzt neuen Bytewert fuer LED byte.</td>
|
||||||
|
</tr><tr>
|
||||||
<td><a style="color:#0000FF" href="#Core._set_leda1">_set_leda1</a></td>
|
<td><a style="color:#0000FF" href="#Core._set_leda1">_set_leda1</a></td>
|
||||||
<td>Setzt den Zustand der LED A1 vom core.</td>
|
<td>Setzt den Zustand der LED A1 vom Core.</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a style="color:#0000FF" href="#Core._set_leda2">_set_leda2</a></td>
|
<td><a style="color:#0000FF" href="#Core._set_leda2">_set_leda2</a></td>
|
||||||
<td>Setzt den Zustand der LED A2 vom core.</td>
|
<td>Setzt den Zustand der LED A2 vom Core.</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a style="color:#0000FF" href="#Core.errorlimit1">errorlimit1</a></td>
|
<td><a style="color:#0000FF" href="#Core.errorlimit1">errorlimit1</a></td>
|
||||||
<td>Setzt RS485 ErrorLimit1 auf neuen Wert.</td>
|
<td>Setzt RS485 ErrorLimit1 auf neuen Wert.</td>
|
||||||
@@ -132,13 +256,13 @@ Static Methods</h3>
|
|||||||
<a NAME="Core.__errorlimit" ID="Core.__errorlimit"></a>
|
<a NAME="Core.__errorlimit" ID="Core.__errorlimit"></a>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Core.__errorlimit</h3>
|
Core.__errorlimit</h3>
|
||||||
<b>__errorlimit</b>(<i>io_id, errorlimit</i>)
|
<b>__errorlimit</b>(<i>io, errorlimit</i>)
|
||||||
<p>
|
<p>
|
||||||
Verwaltet das Lesen und Schreiben der ErrorLimits.
|
Verwaltet das Lesen und Schreiben der ErrorLimits.
|
||||||
</p><dl>
|
</p><dl>
|
||||||
<dt><i>io_id</i></dt>
|
<dt><i>io</i></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Index des IOs fuer ErrorLimit
|
IOs Objekt fuer ErrorLimit
|
||||||
</dd>
|
</dd>
|
||||||
</dl><dl>
|
</dl><dl>
|
||||||
<dt>Returns:</dt>
|
<dt>Returns:</dt>
|
||||||
@@ -156,7 +280,7 @@ Core-Klasse vorbereiten.
|
|||||||
Core._get_leda1</h3>
|
Core._get_leda1</h3>
|
||||||
<b>_get_leda1</b>(<i></i>)
|
<b>_get_leda1</b>(<i></i>)
|
||||||
<p>
|
<p>
|
||||||
Gibt den Zustand der LED A1 vom core zurueck.
|
Gibt den Zustand der LED A1 vom Core zurueck.
|
||||||
</p><dl>
|
</p><dl>
|
||||||
<dt>Returns:</dt>
|
<dt>Returns:</dt>
|
||||||
<dd>
|
<dd>
|
||||||
@@ -167,7 +291,7 @@ Gibt den Zustand der LED A1 vom core zurueck.
|
|||||||
Core._get_leda2</h3>
|
Core._get_leda2</h3>
|
||||||
<b>_get_leda2</b>(<i></i>)
|
<b>_get_leda2</b>(<i></i>)
|
||||||
<p>
|
<p>
|
||||||
Gibt den Zustand der LED A2 vom core zurueck.
|
Gibt den Zustand der LED A2 vom Core zurueck.
|
||||||
</p><dl>
|
</p><dl>
|
||||||
<dt>Returns:</dt>
|
<dt>Returns:</dt>
|
||||||
<dd>
|
<dd>
|
||||||
@@ -184,12 +308,26 @@ Gibt den RevPi Core Status zurueck.
|
|||||||
<dd>
|
<dd>
|
||||||
Status als <class 'int'>
|
Status als <class 'int'>
|
||||||
</dd>
|
</dd>
|
||||||
|
</dl><a NAME="Core._set_calculatedled" ID="Core._set_calculatedled"></a>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Core._set_calculatedled</h3>
|
||||||
|
<b>_set_calculatedled</b>(<i>addresslist, shifted_value</i>)
|
||||||
|
<p>
|
||||||
|
Berechnet und setzt neuen Bytewert fuer LED byte.
|
||||||
|
</p><dl>
|
||||||
|
<dt><i>addresslist</i></dt>
|
||||||
|
<dd>
|
||||||
|
Liste der Vergleicher
|
||||||
|
</dd><dt><i>shifed_value</i></dt>
|
||||||
|
<dd>
|
||||||
|
Bits vergleichen
|
||||||
|
</dd>
|
||||||
</dl><a NAME="Core._set_leda1" ID="Core._set_leda1"></a>
|
</dl><a NAME="Core._set_leda1" ID="Core._set_leda1"></a>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Core._set_leda1</h3>
|
Core._set_leda1</h3>
|
||||||
<b>_set_leda1</b>(<i>value</i>)
|
<b>_set_leda1</b>(<i>value</i>)
|
||||||
<p>
|
<p>
|
||||||
Setzt den Zustand der LED A1 vom core.
|
Setzt den Zustand der LED A1 vom Core.
|
||||||
</p><dl>
|
</p><dl>
|
||||||
<dt><i>value</i></dt>
|
<dt><i>value</i></dt>
|
||||||
<dd>
|
<dd>
|
||||||
@@ -200,7 +338,7 @@ Setzt den Zustand der LED A1 vom core.
|
|||||||
Core._set_leda2</h3>
|
Core._set_leda2</h3>
|
||||||
<b>_set_leda2</b>(<i>value</i>)
|
<b>_set_leda2</b>(<i>value</i>)
|
||||||
<p>
|
<p>
|
||||||
Setzt den Zustand der LED A2 vom core.
|
Setzt den Zustand der LED A2 vom Core.
|
||||||
</p><dl>
|
</p><dl>
|
||||||
<dt><i>value</i></dt>
|
<dt><i>value</i></dt>
|
||||||
<dd>
|
<dd>
|
||||||
@@ -358,7 +496,7 @@ object
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>length</td></tr><tr><td>name</td></tr><tr><td>offset</td></tr><tr><td>position</td></tr><tr><td>producttype</td></tr>
|
<tr><td>__slots__</td></tr><tr><td>length</td></tr><tr><td>name</td></tr><tr><td>offset</td></tr><tr><td>position</td></tr><tr><td>producttype</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -415,7 +553,7 @@ Methods</h3>
|
|||||||
<td>Gibt eine Liste aller Inputs zurueck.</td>
|
<td>Gibt eine Liste aller Inputs zurueck.</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a style="color:#0000FF" href="#Device.get_memories">get_memories</a></td>
|
<td><a style="color:#0000FF" href="#Device.get_memories">get_memories</a></td>
|
||||||
<td>Gibt eine Liste aller mems zurueck.</td>
|
<td>Gibt eine Liste aller Memoryobjekte zurueck.</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a style="color:#0000FF" href="#Device.get_outputs">get_outputs</a></td>
|
<td><a style="color:#0000FF" href="#Device.get_outputs">get_outputs</a></td>
|
||||||
<td>Gibt eine Liste aller Outputs zurueck.</td>
|
<td>Gibt eine Liste aller Outputs zurueck.</td>
|
||||||
@@ -485,13 +623,16 @@ True, wenn IO auf Device vorhanden
|
|||||||
</dl><a NAME="Device.__getioiter" ID="Device.__getioiter"></a>
|
</dl><a NAME="Device.__getioiter" ID="Device.__getioiter"></a>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Device.__getioiter</h3>
|
Device.__getioiter</h3>
|
||||||
<b>__getioiter</b>(<i>ioslc</i>)
|
<b>__getioiter</b>(<i>ioslc, export</i>)
|
||||||
<p>
|
<p>
|
||||||
Gibt <class 'iter'> mit allen IOs zurueck.
|
Gibt <class 'iter'> mit allen IOs zurueck.
|
||||||
</p><dl>
|
</p><dl>
|
||||||
<dt><i>ioslc</i></dt>
|
<dt><i>ioslc</i></dt>
|
||||||
<dd>
|
<dd>
|
||||||
IO Abschnitt <class 'slice'>
|
IO Abschnitt <class 'slice'>
|
||||||
|
</dd><dt><i>export</i></dt>
|
||||||
|
<dd>
|
||||||
|
Filter fuer 'Export' Flag in piCtory
|
||||||
</dd>
|
</dd>
|
||||||
</dl><dl>
|
</dl><dl>
|
||||||
<dt>Returns:</dt>
|
<dt>Returns:</dt>
|
||||||
@@ -603,10 +744,20 @@ Default True fuegt Device zur Synchronisierung hinzu
|
|||||||
</dl><a NAME="Device.get_allios" ID="Device.get_allios"></a>
|
</dl><a NAME="Device.get_allios" ID="Device.get_allios"></a>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Device.get_allios</h3>
|
Device.get_allios</h3>
|
||||||
<b>get_allios</b>(<i></i>)
|
<b>get_allios</b>(<i>export=None</i>)
|
||||||
<p>
|
<p>
|
||||||
Gibt eine Liste aller Inputs und Outputs zurueck, keine MEMs.
|
Gibt eine Liste aller Inputs und Outputs zurueck, keine MEMs.
|
||||||
|
</p><p>
|
||||||
|
Bleibt Parameter 'export' auf None werden alle Inputs und Outputs
|
||||||
|
zurueckgegeben. Wird 'export' auf True/False gesetzt, werden nur Inputs
|
||||||
|
und Outputs zurueckgegeben, bei denen der Wert 'Export' in piCtory
|
||||||
|
uebereinstimmt.
|
||||||
</p><dl>
|
</p><dl>
|
||||||
|
<dt><i>export</i></dt>
|
||||||
|
<dd>
|
||||||
|
Nur In-/Outputs mit angegebenen 'Export' Wert in piCtory
|
||||||
|
</dd>
|
||||||
|
</dl><dl>
|
||||||
<dt>Returns:</dt>
|
<dt>Returns:</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<class 'list'> Input und Output, keine MEMs
|
<class 'list'> Input und Output, keine MEMs
|
||||||
@@ -614,10 +765,19 @@ Gibt eine Liste aller Inputs und Outputs zurueck, keine MEMs.
|
|||||||
</dl><a NAME="Device.get_inputs" ID="Device.get_inputs"></a>
|
</dl><a NAME="Device.get_inputs" ID="Device.get_inputs"></a>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Device.get_inputs</h3>
|
Device.get_inputs</h3>
|
||||||
<b>get_inputs</b>(<i></i>)
|
<b>get_inputs</b>(<i>export=None</i>)
|
||||||
<p>
|
<p>
|
||||||
Gibt eine Liste aller Inputs zurueck.
|
Gibt eine Liste aller Inputs zurueck.
|
||||||
|
</p><p>
|
||||||
|
Bleibt Parameter 'export' auf None werden alle Inputs zurueckgegeben.
|
||||||
|
Wird 'export' auf True/False gesetzt, werden nur Inputs zurueckgegeben,
|
||||||
|
bei denen der Wert 'Export' in piCtory uebereinstimmt.
|
||||||
</p><dl>
|
</p><dl>
|
||||||
|
<dt><i>export</i></dt>
|
||||||
|
<dd>
|
||||||
|
Nur Inputs mit angegebenen 'Export' Wert in piCtory
|
||||||
|
</dd>
|
||||||
|
</dl><dl>
|
||||||
<dt>Returns:</dt>
|
<dt>Returns:</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<class 'list'> Inputs
|
<class 'list'> Inputs
|
||||||
@@ -625,10 +785,19 @@ Gibt eine Liste aller Inputs zurueck.
|
|||||||
</dl><a NAME="Device.get_memories" ID="Device.get_memories"></a>
|
</dl><a NAME="Device.get_memories" ID="Device.get_memories"></a>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Device.get_memories</h3>
|
Device.get_memories</h3>
|
||||||
<b>get_memories</b>(<i></i>)
|
<b>get_memories</b>(<i>export=None</i>)
|
||||||
<p>
|
<p>
|
||||||
Gibt eine Liste aller mems zurueck.
|
Gibt eine Liste aller Memoryobjekte zurueck.
|
||||||
|
</p><p>
|
||||||
|
Bleibt Parameter 'export' auf None werden alle Mems zurueckgegeben.
|
||||||
|
Wird 'export' auf True/False gesetzt, werden nur Mems zurueckgegeben,
|
||||||
|
bei denen der Wert 'Export' in piCtory uebereinstimmt.
|
||||||
</p><dl>
|
</p><dl>
|
||||||
|
<dt><i>export</i></dt>
|
||||||
|
<dd>
|
||||||
|
Nur Mems mit angegebenen 'Export' Wert in piCtory
|
||||||
|
</dd>
|
||||||
|
</dl><dl>
|
||||||
<dt>Returns:</dt>
|
<dt>Returns:</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<class 'list'> Mems
|
<class 'list'> Mems
|
||||||
@@ -636,10 +805,19 @@ Gibt eine Liste aller mems zurueck.
|
|||||||
</dl><a NAME="Device.get_outputs" ID="Device.get_outputs"></a>
|
</dl><a NAME="Device.get_outputs" ID="Device.get_outputs"></a>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Device.get_outputs</h3>
|
Device.get_outputs</h3>
|
||||||
<b>get_outputs</b>(<i></i>)
|
<b>get_outputs</b>(<i>export=None</i>)
|
||||||
<p>
|
<p>
|
||||||
Gibt eine Liste aller Outputs zurueck.
|
Gibt eine Liste aller Outputs zurueck.
|
||||||
|
</p><p>
|
||||||
|
Bleibt Parameter 'export' auf None werden alle Outputs zurueckgegeben.
|
||||||
|
Wird 'export' auf True/False gesetzt, werden nur Outputs
|
||||||
|
zurueckgegeben, bei denen der Wert 'Export' in piCtory uebereinstimmt.
|
||||||
</p><dl>
|
</p><dl>
|
||||||
|
<dt><i>export</i></dt>
|
||||||
|
<dd>
|
||||||
|
Nur Outputs mit angegebenen 'Export' Wert in piCtory
|
||||||
|
</dd>
|
||||||
|
</dl><dl>
|
||||||
<dt>Returns:</dt>
|
<dt>Returns:</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<class 'list'> Outputs
|
<class 'list'> Outputs
|
||||||
@@ -886,7 +1064,7 @@ Device
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__slots__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -955,7 +1133,7 @@ Gateway
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__slots__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ RevPiModIO Helperklassen und Tools.
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Global Attributes</h3>
|
Global Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__author__</td></tr><tr><td>__copyright__</td></tr><tr><td>__license__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Classes</h3>
|
Classes</h3>
|
||||||
@@ -26,6 +26,9 @@ Classes</h3>
|
|||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a style="color:#0000FF" href="#ProcimgWriter">ProcimgWriter</a></td>
|
<td><a style="color:#0000FF" href="#ProcimgWriter">ProcimgWriter</a></td>
|
||||||
<td>Klasse fuer Synchroniseriungs-Thread.</td>
|
<td>Klasse fuer Synchroniseriungs-Thread.</td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><a style="color:#0000FF" href="#Var">Var</a></td>
|
||||||
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
@@ -65,7 +68,7 @@ None
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__slots__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -351,7 +354,7 @@ Thread
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__slots__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -426,7 +429,7 @@ Thread
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>ioerrors</td></tr><tr><td>maxioerrors</td></tr><tr><td>refresh</td></tr>
|
<tr><td>__slots__</td></tr><tr><td>ioerrors</td></tr><tr><td>maxioerrors</td></tr><tr><td>refresh</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -513,6 +516,11 @@ Aktiviert oder Deaktiviert die Eventueberwachung.
|
|||||||
<dd>
|
<dd>
|
||||||
True aktiviert / False deaktiviert
|
True aktiviert / False deaktiviert
|
||||||
</dd>
|
</dd>
|
||||||
|
</dl><dl>
|
||||||
|
<dt>Returns:</dt>
|
||||||
|
<dd>
|
||||||
|
True, wenn Anforderung erfolgreich war
|
||||||
|
</dd>
|
||||||
</dl><a NAME="ProcimgWriter._get_ioerrors" ID="ProcimgWriter._get_ioerrors"></a>
|
</dl><a NAME="ProcimgWriter._get_ioerrors" ID="ProcimgWriter._get_ioerrors"></a>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
ProcimgWriter._get_ioerrors</h3>
|
ProcimgWriter._get_ioerrors</h3>
|
||||||
@@ -587,6 +595,35 @@ ProcimgWriter.stop</h3>
|
|||||||
<p>
|
<p>
|
||||||
Beendet die automatische Prozessabbildsynchronisierung.
|
Beendet die automatische Prozessabbildsynchronisierung.
|
||||||
</p>
|
</p>
|
||||||
|
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||||
|
<hr /><hr />
|
||||||
|
<a NAME="Var" ID="Var"></a>
|
||||||
|
<h2 style="background-color:#FFFFFF;color:#0000FF">Var</h2>
|
||||||
|
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Derived from</h3>
|
||||||
|
None
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Class Attributes</h3>
|
||||||
|
<table>
|
||||||
|
<tr><td>None</td></tr>
|
||||||
|
</table>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Class Methods</h3>
|
||||||
|
<table>
|
||||||
|
<tr><td>None</td></tr>
|
||||||
|
</table>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Methods</h3>
|
||||||
|
<table>
|
||||||
|
<tr><td>None</td></tr>
|
||||||
|
</table>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Static Methods</h3>
|
||||||
|
<table>
|
||||||
|
<tr><td>None</td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||||
<hr />
|
<hr />
|
||||||
</body></html>
|
</body></html>
|
||||||
@@ -12,7 +12,7 @@ RevPiModIO Modul fuer die Verwaltung der IOs.
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Global Attributes</h3>
|
Global Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__author__</td></tr><tr><td>__copyright__</td></tr><tr><td>__license__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Classes</h3>
|
Classes</h3>
|
||||||
@@ -54,7 +54,7 @@ object
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>_parentdevice</td></tr>
|
<tr><td>__slots__</td></tr><tr><td>_parentdevice</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -124,7 +124,7 @@ object
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>address</td></tr><tr><td>byteorder</td></tr><tr><td>defaultvalue</td></tr><tr><td>length</td></tr><tr><td>name</td></tr><tr><td>type</td></tr><tr><td>value</td></tr>
|
<tr><td>__slots__</td></tr><tr><td>address</td></tr><tr><td>byteorder</td></tr><tr><td>defaultvalue</td></tr><tr><td>length</td></tr><tr><td>name</td></tr><tr><td>type</td></tr><tr><td>value</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -202,7 +202,7 @@ Parentdevice auf dem der IO liegt
|
|||||||
</dd><dt><i>valuelist</i></dt>
|
</dd><dt><i>valuelist</i></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Datenliste fuer Instantiierung
|
Datenliste fuer Instantiierung
|
||||||
["name","defval","bitlen","startaddr",exp,"idx","bmk","bitaddr"]
|
["name","defval","bitlen","startaddrdev",exp,"idx","bmk","bitaddr"]
|
||||||
</dd><dt><i>iotype</i></dt>
|
</dd><dt><i>iotype</i></dt>
|
||||||
<dd>
|
<dd>
|
||||||
<class 'int'> Wert
|
<class 'int'> Wert
|
||||||
@@ -520,7 +520,7 @@ object
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__slots__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -752,7 +752,7 @@ IOBase
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>byteorder</td></tr><tr><td>defaultvalue</td></tr><tr><td>signed</td></tr><tr><td>value</td></tr>
|
<tr><td>__slots__</td></tr><tr><td>byteorder</td></tr><tr><td>defaultvalue</td></tr><tr><td>signed</td></tr><tr><td>value</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -889,7 +889,7 @@ IOBase
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>defaultvalue</td></tr><tr><td>frm</td></tr><tr><td>signed</td></tr><tr><td>value</td></tr>
|
<tr><td>__slots__</td></tr><tr><td>defaultvalue</td></tr><tr><td>frm</td></tr><tr><td>signed</td></tr><tr><td>value</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ RevPiModIO Hauptklasse fuer piControl0 Zugriff.
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Global Attributes</h3>
|
Global Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__author__</td></tr><tr><td>__copyright__</td></tr><tr><td>__license__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Classes</h3>
|
Classes</h3>
|
||||||
@@ -54,7 +54,7 @@ object
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>configrsc</td></tr><tr><td>cycletime</td></tr><tr><td>ioerrors</td></tr><tr><td>length</td></tr><tr><td>maxioerrors</td></tr><tr><td>monitoring</td></tr><tr><td>procimg</td></tr><tr><td>simulator</td></tr>
|
<tr><td>__slots__</td></tr><tr><td>configrsc</td></tr><tr><td>cycletime</td></tr><tr><td>ioerrors</td></tr><tr><td>length</td></tr><tr><td>maxioerrors</td></tr><tr><td>monitoring</td></tr><tr><td>procimg</td></tr><tr><td>simulator</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -345,7 +345,7 @@ Beendet autorefresh und alle Threads.
|
|||||||
</p><a NAME="RevPiModIO.cycleloop" ID="RevPiModIO.cycleloop"></a>
|
</p><a NAME="RevPiModIO.cycleloop" ID="RevPiModIO.cycleloop"></a>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
RevPiModIO.cycleloop</h3>
|
RevPiModIO.cycleloop</h3>
|
||||||
<b>cycleloop</b>(<i>func, cycletime=None</i>)
|
<b>cycleloop</b>(<i>func, cycletime=50</i>)
|
||||||
<p>
|
<p>
|
||||||
Startet den Cycleloop.
|
Startet den Cycleloop.
|
||||||
</p><p>
|
</p><p>
|
||||||
@@ -358,23 +358,24 @@ Startet den Cycleloop.
|
|||||||
Prozessabbild geschrieben.
|
Prozessabbild geschrieben.
|
||||||
</p><p>
|
</p><p>
|
||||||
Verlassen wird der Cycleloop, wenn die aufgerufene Funktion einen
|
Verlassen wird der Cycleloop, wenn die aufgerufene Funktion einen
|
||||||
Rueckgabewert nicht gleich None liefert, oder durch Aufruf von
|
Rueckgabewert nicht gleich None liefert (z.B. return True), oder durch
|
||||||
revpimodio.exit().
|
Aufruf von .exit().
|
||||||
</p><p>
|
</p><p>
|
||||||
HINWEIS: Die Aktualisierungszeit und die Laufzeit der Funktion duerfen
|
HINWEIS: Die Aktualisierungszeit und die Laufzeit der Funktion duerfen
|
||||||
die eingestellte autorefresh Zeit, bzw. uebergebene cycletime nicht
|
die eingestellte autorefresh Zeit, bzw. uebergebene cycletime nicht
|
||||||
ueberschreiten!
|
ueberschreiten!
|
||||||
</p><p>
|
</p><p>
|
||||||
Ueber das Attribut cycletime kann die Aktualisierungsrate fuer das
|
Ueber den Parameter cycletime wird die gewuenschte Zukluszeit der
|
||||||
Prozessabbild gesetzt werden.
|
uebergebenen Funktion gesetzt. Der Standardwert betraegt
|
||||||
|
50 Millisekunden, in denen das Prozessabild eingelesen, die uebergebene
|
||||||
|
Funktion ausgefuert und das Prozessabbild geschrieben wird.
|
||||||
</p><dl>
|
</p><dl>
|
||||||
<dt><i>func</i></dt>
|
<dt><i>func</i></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Funktion, die ausgefuehrt werden soll
|
Funktion, die ausgefuehrt werden soll
|
||||||
</dd><dt><i>cycletime</i></dt>
|
</dd><dt><i>cycletime</i></dt>
|
||||||
<dd>
|
<dd>
|
||||||
Zykluszeit in Millisekunden, bei Nichtangabe wird
|
Zykluszeit in Millisekunden - Standardwert 50 ms
|
||||||
aktuelle .cycletime Zeit verwendet - Standardwert 50 ms
|
|
||||||
</dd>
|
</dd>
|
||||||
</dl><dl>
|
</dl><dl>
|
||||||
<dt>Returns:</dt>
|
<dt>Returns:</dt>
|
||||||
@@ -557,7 +558,7 @@ RevPiModIOSelected
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__slots__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -617,7 +618,7 @@ RevPiModIO
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__slots__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ RevPiModIO Hauptklasse fuer Netzwerkzugriff.
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Global Attributes</h3>
|
Global Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>_sysdeldirty</td></tr><tr><td>_sysexit</td></tr><tr><td>_sysflush</td></tr><tr><td>_syspictory</td></tr><tr><td>_syssync</td></tr>
|
<tr><td>__author__</td></tr><tr><td>__copyright__</td></tr><tr><td>__license__</td></tr><tr><td>_sysdeldirty</td></tr><tr><td>_sysexit</td></tr><tr><td>_sysflush</td></tr><tr><td>_syspictory</td></tr><tr><td>_syssync</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Classes</h3>
|
Classes</h3>
|
||||||
@@ -54,7 +54,7 @@ Thread
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>closed</td></tr><tr><td>name</td></tr><tr><td>timeout</td></tr>
|
<tr><td>__slots__</td></tr><tr><td>closed</td></tr><tr><td>name</td></tr><tr><td>timeout</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -128,7 +128,15 @@ NetFH (Constructor)</h3>
|
|||||||
<b>NetFH</b>(<i>address, timeout=500</i>)
|
<b>NetFH</b>(<i>address, timeout=500</i>)
|
||||||
<p>
|
<p>
|
||||||
Init NetFH-class.
|
Init NetFH-class.
|
||||||
</p><a NAME="NetFH.__del__" ID="NetFH.__del__"></a>
|
</p><dl>
|
||||||
|
<dt><i>address</i></dt>
|
||||||
|
<dd>
|
||||||
|
IP Adresse des RevPi
|
||||||
|
</dd><dt><i>timeout</i></dt>
|
||||||
|
<dd>
|
||||||
|
Timeout in Millisekunden der Verbindung
|
||||||
|
</dd>
|
||||||
|
</dl><a NAME="NetFH.__del__" ID="NetFH.__del__"></a>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
NetFH.__del__</h3>
|
NetFH.__del__</h3>
|
||||||
<b>__del__</b>(<i></i>)
|
<b>__del__</b>(<i></i>)
|
||||||
@@ -315,7 +323,7 @@ _RevPiModIO
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__slots__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -440,7 +448,7 @@ RevPiNetIOSelected
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__slots__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
@@ -503,7 +511,7 @@ RevPiNetIO
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__slots__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Bildet die Summary-Sektion von piCtory ab.
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Global Attributes</h3>
|
Global Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__author__</td></tr><tr><td>__copyright__</td></tr><tr><td>__license__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Classes</h3>
|
Classes</h3>
|
||||||
@@ -39,7 +39,7 @@ object
|
|||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Attributes</h3>
|
Class Attributes</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr><td>__slots__</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Class Methods</h3>
|
Class Methods</h3>
|
||||||
|
|||||||
@@ -9,12 +9,20 @@ revpimodio2.RED?7
|
|||||||
revpimodio2.RISING?7
|
revpimodio2.RISING?7
|
||||||
revpimodio2.app.App?1(app)
|
revpimodio2.app.App?1(app)
|
||||||
revpimodio2.consttostr?4(value)
|
revpimodio2.consttostr?4(value)
|
||||||
|
revpimodio2.device.Connect.A3?7
|
||||||
|
revpimodio2.device.Connect._devconfigure?5()
|
||||||
|
revpimodio2.device.Connect._get_leda3?5()
|
||||||
|
revpimodio2.device.Connect._get_wdtoggle?5()
|
||||||
|
revpimodio2.device.Connect._set_leda3?5(value)
|
||||||
|
revpimodio2.device.Connect._set_wdtoggle?5(value)
|
||||||
|
revpimodio2.device.Connect.wdautotoggle?7
|
||||||
revpimodio2.device.Core.A1?7
|
revpimodio2.device.Core.A1?7
|
||||||
revpimodio2.device.Core.A2?7
|
revpimodio2.device.Core.A2?7
|
||||||
revpimodio2.device.Core._devconfigure?5()
|
revpimodio2.device.Core._devconfigure?5()
|
||||||
revpimodio2.device.Core._get_leda1?5()
|
revpimodio2.device.Core._get_leda1?5()
|
||||||
revpimodio2.device.Core._get_leda2?5()
|
revpimodio2.device.Core._get_leda2?5()
|
||||||
revpimodio2.device.Core._get_status?5()
|
revpimodio2.device.Core._get_status?5()
|
||||||
|
revpimodio2.device.Core._set_calculatedled?5(addresslist, shifted_value)
|
||||||
revpimodio2.device.Core._set_leda1?5(value)
|
revpimodio2.device.Core._set_leda1?5(value)
|
||||||
revpimodio2.device.Core._set_leda2?5(value)
|
revpimodio2.device.Core._set_leda2?5(value)
|
||||||
revpimodio2.device.Core.errorlimit1?4(value)
|
revpimodio2.device.Core.errorlimit1?4(value)
|
||||||
@@ -35,10 +43,10 @@ revpimodio2.device.Device._devconfigure?5()
|
|||||||
revpimodio2.device.Device._get_offset?5()
|
revpimodio2.device.Device._get_offset?5()
|
||||||
revpimodio2.device.Device._get_producttype?5()
|
revpimodio2.device.Device._get_producttype?5()
|
||||||
revpimodio2.device.Device.autorefresh?4(activate=True)
|
revpimodio2.device.Device.autorefresh?4(activate=True)
|
||||||
revpimodio2.device.Device.get_allios?4()
|
revpimodio2.device.Device.get_allios?4(export=None)
|
||||||
revpimodio2.device.Device.get_inputs?4()
|
revpimodio2.device.Device.get_inputs?4(export=None)
|
||||||
revpimodio2.device.Device.get_memories?4()
|
revpimodio2.device.Device.get_memories?4(export=None)
|
||||||
revpimodio2.device.Device.get_outputs?4()
|
revpimodio2.device.Device.get_outputs?4(export=None)
|
||||||
revpimodio2.device.Device.length?7
|
revpimodio2.device.Device.length?7
|
||||||
revpimodio2.device.Device.name?7
|
revpimodio2.device.Device.name?7
|
||||||
revpimodio2.device.Device.offset?7
|
revpimodio2.device.Device.offset?7
|
||||||
@@ -144,7 +152,7 @@ revpimodio2.modio.RevPiModIO._set_maxioerrors?5(value)
|
|||||||
revpimodio2.modio.RevPiModIO.autorefresh_all?4()
|
revpimodio2.modio.RevPiModIO.autorefresh_all?4()
|
||||||
revpimodio2.modio.RevPiModIO.cleanup?4()
|
revpimodio2.modio.RevPiModIO.cleanup?4()
|
||||||
revpimodio2.modio.RevPiModIO.configrsc?7
|
revpimodio2.modio.RevPiModIO.configrsc?7
|
||||||
revpimodio2.modio.RevPiModIO.cycleloop?4(func, cycletime=None)
|
revpimodio2.modio.RevPiModIO.cycleloop?4(func, cycletime=50)
|
||||||
revpimodio2.modio.RevPiModIO.cycletime?7
|
revpimodio2.modio.RevPiModIO.cycletime?7
|
||||||
revpimodio2.modio.RevPiModIO.exit?4(full=True)
|
revpimodio2.modio.RevPiModIO.exit?4(full=True)
|
||||||
revpimodio2.modio.RevPiModIO.get_jconfigrsc?4()
|
revpimodio2.modio.RevPiModIO.get_jconfigrsc?4()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
Connect Core
|
||||||
Core Device
|
Core Device
|
||||||
EventCallback Thread
|
EventCallback Thread
|
||||||
Gateway Device
|
Gateway Device
|
||||||
|
|||||||
115
revpimodio2.e4p
115
revpimodio2.e4p
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE Project SYSTEM "Project-5.1.dtd">
|
<!DOCTYPE Project SYSTEM "Project-5.1.dtd">
|
||||||
<!-- eric project file for project revpimodio2 -->
|
<!-- eric project file for project revpimodio2 -->
|
||||||
<!-- Saved: 2018-06-27, 11:30:13 -->
|
<!-- Saved: 2018-08-13, 13:53:52 -->
|
||||||
<!-- Copyright (C) 2018 Sven Sager, akira@narux.de -->
|
<!-- Copyright (C) 2018 Sven Sager, akira@narux.de -->
|
||||||
<Project version="5.1">
|
<Project version="5.1">
|
||||||
<Language>en_US</Language>
|
<Language>en_US</Language>
|
||||||
@@ -9,44 +9,45 @@
|
|||||||
<ProgLanguage mixed="0">Python3</ProgLanguage>
|
<ProgLanguage mixed="0">Python3</ProgLanguage>
|
||||||
<ProjectType>Console</ProjectType>
|
<ProjectType>Console</ProjectType>
|
||||||
<Description>Das Modul stellt alle Devices und IOs aus der piCtory Konfiguration in Python3 zur Verfügung. Es ermöglicht den direkten Zugriff auf die Werte über deren vergebenen Namen. Lese- und Schreibaktionen mit dem Prozessabbild werden von dem Modul selbst verwaltet, ohne dass sich der Programmierer um Offsets und Adressen kümmern muss. Für die Gatewaymodule wie ModbusTCP oder Profinet sind eigene 'Inputs' und 'Outputs' über einen bestimmten Adressbereich definierbar. Auf diese IOs kann mit Python3 über den Namen direkt auf die Werte zugegriffen werden.</Description>
|
<Description>Das Modul stellt alle Devices und IOs aus der piCtory Konfiguration in Python3 zur Verfügung. Es ermöglicht den direkten Zugriff auf die Werte über deren vergebenen Namen. Lese- und Schreibaktionen mit dem Prozessabbild werden von dem Modul selbst verwaltet, ohne dass sich der Programmierer um Offsets und Adressen kümmern muss. Für die Gatewaymodule wie ModbusTCP oder Profinet sind eigene 'Inputs' und 'Outputs' über einen bestimmten Adressbereich definierbar. Auf diese IOs kann mit Python3 über den Namen direkt auf die Werte zugegriffen werden.</Description>
|
||||||
<Version>2.1.6</Version>
|
<Version>2.2.3</Version>
|
||||||
<Author>Sven Sager</Author>
|
<Author>Sven Sager</Author>
|
||||||
<Email>akira@narux.de</Email>
|
<Email>akira@narux.de</Email>
|
||||||
<Eol index="1"/>
|
<Eol index="1"/>
|
||||||
<Sources>
|
<Sources>
|
||||||
<Source>setup.py</Source>
|
|
||||||
<Source>revpimodio2/modio.py</Source>
|
|
||||||
<Source>revpimodio2/summary.py</Source>
|
|
||||||
<Source>revpimodio2/app.py</Source>
|
|
||||||
<Source>revpimodio2/io.py</Source>
|
|
||||||
<Source>revpimodio2/__init__.py</Source>
|
<Source>revpimodio2/__init__.py</Source>
|
||||||
|
<Source>revpimodio2/app.py</Source>
|
||||||
<Source>revpimodio2/device.py</Source>
|
<Source>revpimodio2/device.py</Source>
|
||||||
<Source>revpimodio2/helper.py</Source>
|
<Source>revpimodio2/helper.py</Source>
|
||||||
|
<Source>revpimodio2/io.py</Source>
|
||||||
|
<Source>revpimodio2/modio.py</Source>
|
||||||
<Source>revpimodio2/netio.py</Source>
|
<Source>revpimodio2/netio.py</Source>
|
||||||
<Source>test/test_dio_while2.py</Source>
|
<Source>revpimodio2/summary.py</Source>
|
||||||
<Source>test/test_dio_mainloop.py</Source>
|
<Source>setup.py</Source>
|
||||||
<Source>test/test_dio_cycleloop.py</Source>
|
<Source>test/test_dio_cycleloop.py</Source>
|
||||||
|
<Source>test/test_dio_mainloop.py</Source>
|
||||||
|
<Source>test/test_dio_while2.py</Source>
|
||||||
<Source>test/test_net_leistung.py</Source>
|
<Source>test/test_net_leistung.py</Source>
|
||||||
<Source>test/web_cycleloop.py</Source>
|
<Source>test/test_netio_brett.py</Source>
|
||||||
<Source>test/web_mainloop.py</Source>
|
<Source>test/test_unit.py</Source>
|
||||||
<Source>test/web_virtdevdriver.py</Source>
|
<Source>test/test_unit_fh.py</Source>
|
||||||
|
<Source>test/test_unitnet.py</Source>
|
||||||
<Source>test/web_benniesrun.py</Source>
|
<Source>test/web_benniesrun.py</Source>
|
||||||
<Source>test/web_benniesrunxxl.py</Source>
|
<Source>test/web_benniesrunxxl.py</Source>
|
||||||
<Source>test/test_unit.py</Source>
|
<Source>test/web_cycleloop.py</Source>
|
||||||
<Source>test/test_unitnet.py</Source>
|
<Source>test/web_mainloop.py</Source>
|
||||||
<Source>test/test_netio_brett.py</Source>
|
|
||||||
<Source>test/web_startseite.py</Source>
|
|
||||||
<Source>test/web_rpidaten.py</Source>
|
<Source>test/web_rpidaten.py</Source>
|
||||||
<Source>test/web_rpii2c.py</Source>
|
<Source>test/web_rpii2c.py</Source>
|
||||||
|
<Source>test/web_startseite.py</Source>
|
||||||
|
<Source>test/web_virtdevdriver.py</Source>
|
||||||
</Sources>
|
</Sources>
|
||||||
<Forms/>
|
<Forms/>
|
||||||
<Translations/>
|
<Translations/>
|
||||||
<Resources/>
|
<Resources/>
|
||||||
<Interfaces/>
|
<Interfaces/>
|
||||||
<Others>
|
<Others>
|
||||||
<Other>doc</Other>
|
|
||||||
<Other>.hgignore</Other>
|
<Other>.hgignore</Other>
|
||||||
<Other>MANIFEST.in</Other>
|
<Other>MANIFEST.in</Other>
|
||||||
|
<Other>doc</Other>
|
||||||
<Other>eric-revpimodio2.api</Other>
|
<Other>eric-revpimodio2.api</Other>
|
||||||
</Others>
|
</Others>
|
||||||
<MainScript>test/test_unit.py</MainScript>
|
<MainScript>test/test_unit.py</MainScript>
|
||||||
@@ -152,9 +153,6 @@
|
|||||||
</value>
|
</value>
|
||||||
</dict>
|
</dict>
|
||||||
</VcsOptions>
|
</VcsOptions>
|
||||||
<VcsOtherData>
|
|
||||||
<dict/>
|
|
||||||
</VcsOtherData>
|
|
||||||
</Vcs>
|
</Vcs>
|
||||||
<FiletypeAssociations>
|
<FiletypeAssociations>
|
||||||
<FiletypeAssociation pattern="*.idl" type="INTERFACES"/>
|
<FiletypeAssociation pattern="*.idl" type="INTERFACES"/>
|
||||||
@@ -248,14 +246,6 @@
|
|||||||
<value>
|
<value>
|
||||||
<bool>False</bool>
|
<bool>False</bool>
|
||||||
</value>
|
</value>
|
||||||
<key>
|
|
||||||
<string>sourceExtensions</string>
|
|
||||||
</key>
|
|
||||||
<value>
|
|
||||||
<list>
|
|
||||||
<string></string>
|
|
||||||
</list>
|
|
||||||
</value>
|
|
||||||
<key>
|
<key>
|
||||||
<string>useRecursion</string>
|
<string>useRecursion</string>
|
||||||
</key>
|
</key>
|
||||||
@@ -275,6 +265,41 @@
|
|||||||
</key>
|
</key>
|
||||||
<value>
|
<value>
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>
|
||||||
|
<string>BuiltinsChecker</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<dict>
|
||||||
|
<key>
|
||||||
|
<string>chr</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<list>
|
||||||
|
<string>unichr</string>
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
<key>
|
||||||
|
<string>str</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<list>
|
||||||
|
<string>unicode</string>
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</dict>
|
||||||
|
</value>
|
||||||
|
<key>
|
||||||
|
<string>CopyrightAuthor</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<string></string>
|
||||||
|
</value>
|
||||||
|
<key>
|
||||||
|
<string>CopyrightMinFileSize</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<int>0</int>
|
||||||
|
</value>
|
||||||
<key>
|
<key>
|
||||||
<string>DocstringType</string>
|
<string>DocstringType</string>
|
||||||
</key>
|
</key>
|
||||||
@@ -285,13 +310,13 @@
|
|||||||
<string>ExcludeFiles</string>
|
<string>ExcludeFiles</string>
|
||||||
</key>
|
</key>
|
||||||
<value>
|
<value>
|
||||||
<string></string>
|
<string>*/test/*</string>
|
||||||
</value>
|
</value>
|
||||||
<key>
|
<key>
|
||||||
<string>ExcludeMessages</string>
|
<string>ExcludeMessages</string>
|
||||||
</key>
|
</key>
|
||||||
<value>
|
<value>
|
||||||
<string>E123,E226,E24</string>
|
<string>E123,E226,E24,C101,E402,C111</string>
|
||||||
</value>
|
</value>
|
||||||
<key>
|
<key>
|
||||||
<string>FixCodes</string>
|
<string>FixCodes</string>
|
||||||
@@ -305,6 +330,12 @@
|
|||||||
<value>
|
<value>
|
||||||
<bool>False</bool>
|
<bool>False</bool>
|
||||||
</value>
|
</value>
|
||||||
|
<key>
|
||||||
|
<string>FutureChecker</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<string></string>
|
||||||
|
</value>
|
||||||
<key>
|
<key>
|
||||||
<string>HangClosing</string>
|
<string>HangClosing</string>
|
||||||
</key>
|
</key>
|
||||||
@@ -317,6 +348,24 @@
|
|||||||
<value>
|
<value>
|
||||||
<string></string>
|
<string></string>
|
||||||
</value>
|
</value>
|
||||||
|
<key>
|
||||||
|
<string>LineComplexity</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<int>15</int>
|
||||||
|
</value>
|
||||||
|
<key>
|
||||||
|
<string>LineComplexityScore</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<int>10</int>
|
||||||
|
</value>
|
||||||
|
<key>
|
||||||
|
<string>MaxCodeComplexity</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<int>10</int>
|
||||||
|
</value>
|
||||||
<key>
|
<key>
|
||||||
<string>MaxLineLength</string>
|
<string>MaxLineLength</string>
|
||||||
</key>
|
</key>
|
||||||
@@ -341,6 +390,12 @@
|
|||||||
<value>
|
<value>
|
||||||
<bool>False</bool>
|
<bool>False</bool>
|
||||||
</value>
|
</value>
|
||||||
|
<key>
|
||||||
|
<string>ValidEncodings</string>
|
||||||
|
</key>
|
||||||
|
<value>
|
||||||
|
<string>latin-1, utf-8</string>
|
||||||
|
</value>
|
||||||
</dict>
|
</dict>
|
||||||
</value>
|
</value>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
|
||||||
# python3-RevPiModIO
|
|
||||||
#
|
|
||||||
# Webpage: https://revpimodio.org/
|
|
||||||
# (c) Sven Sager, License: LGPLv3
|
|
||||||
#
|
|
||||||
"""Stellt alle Klassen fuer den RevolutionPi zur Verfuegung.
|
"""Stellt alle Klassen fuer den RevolutionPi zur Verfuegung.
|
||||||
|
|
||||||
|
Webpage: https://revpimodio.org/
|
||||||
|
|
||||||
Stellt Klassen fuer die einfache Verwendung des Revolution Pis der
|
Stellt Klassen fuer die einfache Verwendung des Revolution Pis der
|
||||||
Kunbus GmbH (https://revolution.kunbus.de/) zur Verfuegung. Alle I/Os werden
|
Kunbus GmbH (https://revolution.kunbus.de/) zur Verfuegung. Alle I/Os werden
|
||||||
aus der piCtory Konfiguration eingelesen und mit deren Namen direkt zugreifbar
|
aus der piCtory Konfiguration eingelesen und mit deren Namen direkt zugreifbar
|
||||||
@@ -23,9 +19,10 @@ __all__ = [
|
|||||||
"RevPiNetIO", "RevPiNetIOSelected", "RevPiNetIODriver"
|
"RevPiNetIO", "RevPiNetIOSelected", "RevPiNetIODriver"
|
||||||
]
|
]
|
||||||
__author__ = "Sven Sager <akira@revpimodio.org>"
|
__author__ = "Sven Sager <akira@revpimodio.org>"
|
||||||
|
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||||
|
__license__ = "LGPLv3"
|
||||||
__name__ = "revpimodio2"
|
__name__ = "revpimodio2"
|
||||||
__package__ = "revpimodio2"
|
__version__ = "2.2.3"
|
||||||
__version__ = "2.1.6"
|
|
||||||
|
|
||||||
# Global package values
|
# Global package values
|
||||||
OFF = 0
|
OFF = 0
|
||||||
@@ -71,6 +68,7 @@ def consttostr(value):
|
|||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
# Benötigte Klassen importieren
|
# Benötigte Klassen importieren
|
||||||
from .modio import RevPiModIO, RevPiModIOSelected, RevPiModIODriver
|
from .modio import RevPiModIO, RevPiModIOSelected, RevPiModIODriver
|
||||||
from .netio import RevPiNetIO, RevPiNetIOSelected, RevPiNetIODriver
|
from .netio import RevPiNetIO, RevPiNetIOSelected, RevPiNetIODriver
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
|
||||||
# python3-RevPiModIO
|
|
||||||
#
|
|
||||||
# Webpage: https://revpimodio.org/
|
|
||||||
# (c) Sven Sager, License: LGPLv3
|
|
||||||
#
|
|
||||||
"""Bildet die App Sektion von piCtory ab."""
|
"""Bildet die App Sektion von piCtory ab."""
|
||||||
|
__author__ = "Sven Sager"
|
||||||
|
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||||
|
__license__ = "LGPLv3"
|
||||||
|
|
||||||
|
|
||||||
class App(object):
|
class App(object):
|
||||||
|
|
||||||
"""Bildet die App Sektion der config.rsc ab."""
|
"""Bildet die App Sektion der config.rsc ab."""
|
||||||
|
|
||||||
|
__slots__ = "name", "version", "language", "layout"
|
||||||
|
|
||||||
def __init__(self, app):
|
def __init__(self, app):
|
||||||
"""Instantiiert die App-Klasse.
|
"""Instantiiert die App-Klasse.
|
||||||
@param app piCtory Appinformationen"""
|
@param app piCtory Appinformationen"""
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
|
||||||
# python3-RevPiModIO
|
|
||||||
#
|
|
||||||
# Webpage: https://revpimodio.org/
|
|
||||||
# (c) Sven Sager, License: LGPLv3
|
|
||||||
#
|
|
||||||
"""Modul fuer die Verwaltung der Devices."""
|
"""Modul fuer die Verwaltung der Devices."""
|
||||||
from threading import Lock
|
__author__ = "Sven Sager"
|
||||||
|
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||||
|
__license__ = "LGPLv3"
|
||||||
|
|
||||||
|
from threading import Thread, Event, Lock
|
||||||
from .helper import ProcimgWriter
|
from .helper import ProcimgWriter
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +53,7 @@ class DeviceList(object):
|
|||||||
def __delitem__(self, key):
|
def __delitem__(self, key):
|
||||||
"""Entfernt Device an angegebener Position.
|
"""Entfernt Device an angegebener Position.
|
||||||
@param key Deviceposition zum entfernen"""
|
@param key Deviceposition zum entfernen"""
|
||||||
if issubclass(type(key), Device):
|
if isinstance(key, Device):
|
||||||
key = key._position
|
key = key._position
|
||||||
self.__delattr__(key)
|
self.__delattr__(key)
|
||||||
|
|
||||||
@@ -65,7 +63,7 @@ class DeviceList(object):
|
|||||||
@return Gefundenes <class 'Device'>-Objekt"""
|
@return Gefundenes <class 'Device'>-Objekt"""
|
||||||
if type(key) == int:
|
if type(key) == int:
|
||||||
if key not in self.__dict_position:
|
if key not in self.__dict_position:
|
||||||
raise KeyError("no device on position {}".format(key))
|
raise KeyError("no device on position {0}".format(key))
|
||||||
return self.__dict_position[key]
|
return self.__dict_position[key]
|
||||||
else:
|
else:
|
||||||
return getattr(self, key)
|
return getattr(self, key)
|
||||||
@@ -91,7 +89,7 @@ class DeviceList(object):
|
|||||||
"""Setzt Attribute nur wenn Device.
|
"""Setzt Attribute nur wenn Device.
|
||||||
@param key Attributname
|
@param key Attributname
|
||||||
@param value Attributobjekt"""
|
@param value Attributobjekt"""
|
||||||
if issubclass(type(value), Device):
|
if isinstance(value, Device):
|
||||||
object.__setattr__(self, key, value)
|
object.__setattr__(self, key, value)
|
||||||
self.__dict_position[value._position] = value
|
self.__dict_position[value._position] = value
|
||||||
elif key == "_DeviceList__dict_position":
|
elif key == "_DeviceList__dict_position":
|
||||||
@@ -108,6 +106,13 @@ class Device(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = "_ba_devdata", "_ba_datacp", \
|
||||||
|
"_dict_events", "_filelock", "_length", "_modio", "_name", "_offset", \
|
||||||
|
"_position", "_producttype", "_selfupdate", "_slc_devoff", \
|
||||||
|
"_slc_inp", "_slc_inpoff", "_slc_mem", "_slc_memoff", \
|
||||||
|
"_slc_out", "_slc_outoff", "bmk", "catalognr", "comment", "extend", \
|
||||||
|
"guid", "id", "inpvariant", "outvariant", "type"
|
||||||
|
|
||||||
def __init__(self, parentmodio, dict_device, simulator=False):
|
def __init__(self, parentmodio, dict_device, simulator=False):
|
||||||
"""Instantiierung der Device-Klasse.
|
"""Instantiierung der Device-Klasse.
|
||||||
|
|
||||||
@@ -124,24 +129,24 @@ class Device(object):
|
|||||||
self._selfupdate = False
|
self._selfupdate = False
|
||||||
|
|
||||||
# Wertzuweisung aus dict_device
|
# Wertzuweisung aus dict_device
|
||||||
self._name = dict_device.pop("name")
|
self._name = dict_device.get("name")
|
||||||
self._offset = int(dict_device.pop("offset"))
|
self._offset = int(dict_device.get("offset"))
|
||||||
self._position = int(dict_device.pop("position"))
|
self._position = int(dict_device.get("position"))
|
||||||
self._producttype = int(dict_device.pop("productType"))
|
self._producttype = int(dict_device.get("productType"))
|
||||||
|
|
||||||
# IOM-Objekte erstellen und Adressen in SLCs speichern
|
# IOM-Objekte erstellen und Adressen in SLCs speichern
|
||||||
if simulator:
|
if simulator:
|
||||||
self._slc_inp = self._buildio(
|
self._slc_inp = self._buildio(
|
||||||
dict_device.pop("out"), INP)
|
dict_device.get("out"), INP)
|
||||||
self._slc_out = self._buildio(
|
self._slc_out = self._buildio(
|
||||||
dict_device.pop("inp"), OUT)
|
dict_device.get("inp"), OUT)
|
||||||
else:
|
else:
|
||||||
self._slc_inp = self._buildio(
|
self._slc_inp = self._buildio(
|
||||||
dict_device.pop("inp"), INP)
|
dict_device.get("inp"), INP)
|
||||||
self._slc_out = self._buildio(
|
self._slc_out = self._buildio(
|
||||||
dict_device.pop("out"), OUT)
|
dict_device.get("out"), OUT)
|
||||||
self._slc_mem = self._buildio(
|
self._slc_mem = self._buildio(
|
||||||
dict_device.pop("mem"), MEM
|
dict_device.get("mem"), MEM
|
||||||
)
|
)
|
||||||
|
|
||||||
# SLCs mit offset berechnen
|
# SLCs mit offset berechnen
|
||||||
@@ -164,7 +169,15 @@ class Device(object):
|
|||||||
self._ba_datacp = bytearray()
|
self._ba_datacp = bytearray()
|
||||||
|
|
||||||
# Alle restlichen attribute an Klasse anhängen
|
# Alle restlichen attribute an Klasse anhängen
|
||||||
self.__dict__.update(dict_device)
|
self.bmk = dict_device.get("bmk", "")
|
||||||
|
self.catalognr = dict_device.get("catalogNr", "")
|
||||||
|
self.comment = dict_device.get("comment", "")
|
||||||
|
self.extend = dict_device.get("extend", {})
|
||||||
|
self.guid = dict_device.get("GUID", "")
|
||||||
|
self.id = dict_device.get("id", "")
|
||||||
|
self.inpvariant = dict_device.get("inpVariant", 0)
|
||||||
|
self.outvariant = dict_device.get("outVariant", 0)
|
||||||
|
self.type = dict_device.get("type", "")
|
||||||
|
|
||||||
# Spezielle Konfiguration von abgeleiteten Klassen durchführen
|
# Spezielle Konfiguration von abgeleiteten Klassen durchführen
|
||||||
self._devconfigure()
|
self._devconfigure()
|
||||||
@@ -178,7 +191,7 @@ class Device(object):
|
|||||||
"""Prueft ob IO auf diesem Device liegt.
|
"""Prueft ob IO auf diesem Device liegt.
|
||||||
@param key IO-Name <class 'str'> / IO-Bytenummer <class 'int'>
|
@param key IO-Name <class 'str'> / IO-Bytenummer <class 'int'>
|
||||||
@return True, wenn IO auf Device vorhanden"""
|
@return True, wenn IO auf Device vorhanden"""
|
||||||
if issubclass(type(key), IOBase):
|
if isinstance(key, IOBase):
|
||||||
# Umwandlung für key
|
# Umwandlung für key
|
||||||
key = key._name
|
key = key._name
|
||||||
|
|
||||||
@@ -200,7 +213,7 @@ class Device(object):
|
|||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
"""Gibt Iterator aller IOs zurueck.
|
"""Gibt Iterator aller IOs zurueck.
|
||||||
@return <class 'iter'> aller IOs"""
|
@return <class 'iter'> aller IOs"""
|
||||||
return self.__getioiter(self._slc_devoff)
|
return self.__getioiter(self._slc_devoff, None)
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
"""Gibt Anzahl der Bytes zurueck, die dieses Device belegt.
|
"""Gibt Anzahl der Bytes zurueck, die dieses Device belegt.
|
||||||
@@ -212,13 +225,17 @@ class Device(object):
|
|||||||
@return Devicename"""
|
@return Devicename"""
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
def __getioiter(self, ioslc):
|
def __getioiter(self, ioslc, export):
|
||||||
"""Gibt <class 'iter'> mit allen IOs zurueck.
|
"""Gibt <class 'iter'> mit allen IOs zurueck.
|
||||||
|
|
||||||
@param ioslc IO Abschnitt <class 'slice'>
|
@param ioslc IO Abschnitt <class 'slice'>
|
||||||
@return IOs als Iterator"""
|
@param export Filter fuer 'Export' Flag in piCtory
|
||||||
|
@return IOs als Iterator
|
||||||
|
|
||||||
|
"""
|
||||||
for lst_io in self._modio.io[ioslc]:
|
for lst_io in self._modio.io[ioslc]:
|
||||||
for io in lst_io:
|
for io in lst_io:
|
||||||
if io is not None:
|
if io is not None and (export is None or io.export == export):
|
||||||
yield io
|
yield io
|
||||||
|
|
||||||
def _buildio(self, dict_io, iotype):
|
def _buildio(self, dict_io, iotype):
|
||||||
@@ -236,7 +253,7 @@ class Device(object):
|
|||||||
for key in sorted(dict_io, key=lambda x: int(x)):
|
for key in sorted(dict_io, key=lambda x: int(x)):
|
||||||
|
|
||||||
# Neuen IO anlegen
|
# Neuen IO anlegen
|
||||||
if bool(dict_io[key][7]) or self._producttype == 95:
|
if bool(dict_io[key][7]) or isinstance(self, Core):
|
||||||
# Bei Bitwerten oder Core RevPiIOBase verwenden
|
# Bei Bitwerten oder Core RevPiIOBase verwenden
|
||||||
io_new = IOBase(
|
io_new = IOBase(
|
||||||
self, dict_io[key], iotype, "little", False
|
self, dict_io[key], iotype, "little", False
|
||||||
@@ -246,6 +263,7 @@ class Device(object):
|
|||||||
self, dict_io[key],
|
self, dict_io[key],
|
||||||
iotype,
|
iotype,
|
||||||
"little",
|
"little",
|
||||||
|
# Bei AIO (103) signed auf True setzen
|
||||||
self._producttype == 103
|
self._producttype == 103
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -285,9 +303,8 @@ class Device(object):
|
|||||||
self._modio.readprocimg(self)
|
self._modio.readprocimg(self)
|
||||||
|
|
||||||
# Datenkopie anlegen
|
# Datenkopie anlegen
|
||||||
self._filelock.acquire()
|
with self._filelock:
|
||||||
self._ba_datacp = self._ba_devdata[:]
|
self._ba_datacp = self._ba_devdata[:]
|
||||||
self._filelock.release()
|
|
||||||
|
|
||||||
self._selfupdate = True
|
self._selfupdate = True
|
||||||
|
|
||||||
@@ -322,27 +339,60 @@ class Device(object):
|
|||||||
if not self._modio._monitoring:
|
if not self._modio._monitoring:
|
||||||
self._modio.writeprocimg(self)
|
self._modio.writeprocimg(self)
|
||||||
|
|
||||||
def get_allios(self):
|
def get_allios(self, export=None):
|
||||||
"""Gibt eine Liste aller Inputs und Outputs zurueck, keine MEMs.
|
"""Gibt eine Liste aller Inputs und Outputs zurueck, keine MEMs.
|
||||||
@return <class 'list'> Input und Output, keine MEMs"""
|
|
||||||
|
Bleibt Parameter 'export' auf None werden alle Inputs und Outputs
|
||||||
|
zurueckgegeben. Wird 'export' auf True/False gesetzt, werden nur Inputs
|
||||||
|
und Outputs zurueckgegeben, bei denen der Wert 'Export' in piCtory
|
||||||
|
uebereinstimmt.
|
||||||
|
|
||||||
|
@param export Nur In-/Outputs mit angegebenen 'Export' Wert in piCtory
|
||||||
|
@return <class 'list'> Input und Output, keine MEMs
|
||||||
|
|
||||||
|
"""
|
||||||
return list(self.__getioiter(
|
return list(self.__getioiter(
|
||||||
slice(self._slc_inpoff.start, self._slc_outoff.stop)
|
slice(self._slc_inpoff.start, self._slc_outoff.stop), export
|
||||||
))
|
))
|
||||||
|
|
||||||
def get_inputs(self):
|
def get_inputs(self, export=None):
|
||||||
"""Gibt eine Liste aller Inputs zurueck.
|
"""Gibt eine Liste aller Inputs zurueck.
|
||||||
@return <class 'list'> Inputs"""
|
|
||||||
return list(self.__getioiter(self._slc_inpoff))
|
|
||||||
|
|
||||||
def get_outputs(self):
|
Bleibt Parameter 'export' auf None werden alle Inputs zurueckgegeben.
|
||||||
|
Wird 'export' auf True/False gesetzt, werden nur Inputs zurueckgegeben,
|
||||||
|
bei denen der Wert 'Export' in piCtory uebereinstimmt.
|
||||||
|
|
||||||
|
@param export Nur Inputs mit angegebenen 'Export' Wert in piCtory
|
||||||
|
@return <class 'list'> Inputs
|
||||||
|
|
||||||
|
"""
|
||||||
|
return list(self.__getioiter(self._slc_inpoff, export))
|
||||||
|
|
||||||
|
def get_outputs(self, export=None):
|
||||||
"""Gibt eine Liste aller Outputs zurueck.
|
"""Gibt eine Liste aller Outputs zurueck.
|
||||||
@return <class 'list'> Outputs"""
|
|
||||||
return list(self.__getioiter(self._slc_outoff))
|
|
||||||
|
|
||||||
def get_memories(self):
|
Bleibt Parameter 'export' auf None werden alle Outputs zurueckgegeben.
|
||||||
"""Gibt eine Liste aller mems zurueck.
|
Wird 'export' auf True/False gesetzt, werden nur Outputs
|
||||||
@return <class 'list'> Mems"""
|
zurueckgegeben, bei denen der Wert 'Export' in piCtory uebereinstimmt.
|
||||||
return list(self.__getioiter(self._slc_memoff))
|
|
||||||
|
@param export Nur Outputs mit angegebenen 'Export' Wert in piCtory
|
||||||
|
@return <class 'list'> Outputs
|
||||||
|
|
||||||
|
"""
|
||||||
|
return list(self.__getioiter(self._slc_outoff, export))
|
||||||
|
|
||||||
|
def get_memories(self, export=None):
|
||||||
|
"""Gibt eine Liste aller Memoryobjekte zurueck.
|
||||||
|
|
||||||
|
Bleibt Parameter 'export' auf None werden alle Mems zurueckgegeben.
|
||||||
|
Wird 'export' auf True/False gesetzt, werden nur Mems zurueckgegeben,
|
||||||
|
bei denen der Wert 'Export' in piCtory uebereinstimmt.
|
||||||
|
|
||||||
|
@param export Nur Mems mit angegebenen 'Export' Wert in piCtory
|
||||||
|
@return <class 'list'> Mems
|
||||||
|
|
||||||
|
"""
|
||||||
|
return list(self.__getioiter(self._slc_memoff, export))
|
||||||
|
|
||||||
def readprocimg(self):
|
def readprocimg(self):
|
||||||
"""Alle Inputs fuer dieses Device vom Prozessabbild einlesen.
|
"""Alle Inputs fuer dieses Device vom Prozessabbild einlesen.
|
||||||
@@ -399,64 +449,73 @@ class Core(Device):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = "_iocycle", "_ioerrorcnt", "_iostatusbyte", "_iotemperature", \
|
||||||
|
"_ioerrorlimit1", "_ioerrorlimit2", "_iofrequency", "_ioled", \
|
||||||
|
"a1green", "a1red", "a2green", "a2red"
|
||||||
|
|
||||||
def _devconfigure(self):
|
def _devconfigure(self):
|
||||||
"""Core-Klasse vorbereiten."""
|
"""Core-Klasse vorbereiten."""
|
||||||
|
# Eigene IO-Liste aufbauen
|
||||||
|
lst_io = [x for x in self.__iter__()]
|
||||||
|
|
||||||
|
self._iostatusbyte = lst_io[0]
|
||||||
self._iocycle = None
|
self._iocycle = None
|
||||||
self._iotemperature = None
|
self._iotemperature = None
|
||||||
self._iofrequency = None
|
self._iofrequency = None
|
||||||
self._ioerrorcnt = None
|
self._ioerrorcnt = None
|
||||||
self._ioled = 1
|
self._ioled = lst_io[1]
|
||||||
self._ioerrorlimit1 = None
|
self._ioerrorlimit1 = None
|
||||||
self._ioerrorlimit2 = None
|
self._ioerrorlimit2 = None
|
||||||
|
|
||||||
# Eigene IO-Liste aufbauen
|
int_lenio = len(lst_io)
|
||||||
self.__lst_io = [x for x in self.__iter__()]
|
|
||||||
|
|
||||||
int_lenio = len(self.__lst_io)
|
|
||||||
if int_lenio == 6:
|
if int_lenio == 6:
|
||||||
# Core 1.1
|
# Core 1.1
|
||||||
self._iocycle = 1
|
self._iocycle = lst_io[1]
|
||||||
self._ioerrorcnt = 2
|
self._ioerrorcnt = lst_io[2]
|
||||||
self._ioled = 3
|
self._ioled = lst_io[3]
|
||||||
self._ioerrorlimit1 = 4
|
self._ioerrorlimit1 = lst_io[4]
|
||||||
self._ioerrorlimit2 = 5
|
self._ioerrorlimit2 = lst_io[5]
|
||||||
elif int_lenio == 8:
|
elif int_lenio == 8:
|
||||||
# core 1.2
|
# Core 1.2
|
||||||
self._iocycle = 1
|
self._iocycle = lst_io[1]
|
||||||
self._ioerrorcnt = 2
|
self._ioerrorcnt = lst_io[2]
|
||||||
self._iotemperature = 3
|
self._iotemperature = lst_io[3]
|
||||||
self._iofrequency = 4
|
self._iofrequency = lst_io[4]
|
||||||
self._ioled = 5
|
self._ioled = lst_io[5]
|
||||||
self._ioerrorlimit1 = 6
|
self._ioerrorlimit1 = lst_io[6]
|
||||||
self._ioerrorlimit2 = 7
|
self._ioerrorlimit2 = lst_io[7]
|
||||||
|
|
||||||
if not (self._modio._monitoring or self._modio._simulator):
|
# Echte IOs erzeugen
|
||||||
# Für RS485 errors defaults laden sollte procimg NULL sein
|
self.a1green = IOBase(self, [
|
||||||
if self._ioerrorlimit1 is not None:
|
"a1green", 0, 1, self._ioled._slc_address.start,
|
||||||
self.__lst_io[self._ioerrorlimit1].set_value(
|
False, None, "LED_A1_GREEN", "0"
|
||||||
self.__lst_io[self._ioerrorlimit1]._defaultvalue
|
], OUT, "little", False)
|
||||||
)
|
self.a1red = IOBase(self, [
|
||||||
if self._ioerrorlimit2 is not None:
|
"a1red", 0, 1, self._ioled._slc_address.start,
|
||||||
self.__lst_io[self._ioerrorlimit2].set_value(
|
False, None, "LED_A1_RED", "1"
|
||||||
self.__lst_io[self._ioerrorlimit2]._defaultvalue
|
], OUT, "little", False)
|
||||||
)
|
self.a2green = IOBase(self, [
|
||||||
# RS485 errors schreiben
|
"a2green", 0, 1, self._ioled._slc_address.start,
|
||||||
self._modio.writeprocimg(self)
|
False, None, "LED_A2_GREEN", "2"
|
||||||
|
], OUT, "little", False)
|
||||||
|
self.a2red = IOBase(self, [
|
||||||
|
"a2red", 0, 1, self._ioled._slc_address.start,
|
||||||
|
False, None, "LED_A2_RED", "3"
|
||||||
|
], OUT, "little", False)
|
||||||
|
|
||||||
def __errorlimit(self, io_id, errorlimit):
|
def __errorlimit(self, io, errorlimit):
|
||||||
"""Verwaltet das Lesen und Schreiben der ErrorLimits.
|
"""Verwaltet das Lesen und Schreiben der ErrorLimits.
|
||||||
@param io_id Index des IOs fuer ErrorLimit
|
@param io IOs Objekt fuer ErrorLimit
|
||||||
@return Aktuellen ErrorLimit oder None wenn nicht verfuegbar"""
|
@return Aktuellen ErrorLimit oder None wenn nicht verfuegbar"""
|
||||||
if errorlimit is None:
|
if errorlimit is None:
|
||||||
return None if io_id is None else int.from_bytes(
|
return None if io is None else int.from_bytes(
|
||||||
self.__lst_io[io_id].get_value(),
|
io.get_value(), byteorder="little"
|
||||||
byteorder=self.__lst_io[io_id]._byteorder
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if 0 <= errorlimit <= 65535:
|
if 0 <= errorlimit <= 65535:
|
||||||
self.__lst_io[io_id].set_value(errorlimit.to_bytes(
|
io.set_value(
|
||||||
2, byteorder=self.__lst_io[io_id]._byteorder
|
errorlimit.to_bytes(2, byteorder="little")
|
||||||
))
|
)
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"errorlimit value must be between 0 and 65535"
|
"errorlimit value must be between 0 and 65535"
|
||||||
@@ -466,50 +525,63 @@ class Core(Device):
|
|||||||
"""Gibt den RevPi Core Status zurueck.
|
"""Gibt den RevPi Core Status zurueck.
|
||||||
@return Status als <class 'int'>"""
|
@return Status als <class 'int'>"""
|
||||||
return int.from_bytes(
|
return int.from_bytes(
|
||||||
self.__lst_io[0].get_value(), byteorder=self.__lst_io[0]._byteorder
|
self._iostatusbyte.get_value(), byteorder="little"
|
||||||
)
|
)
|
||||||
|
|
||||||
def _get_leda1(self):
|
def _get_leda1(self):
|
||||||
"""Gibt den Zustand der LED A1 vom core zurueck.
|
"""Gibt den Zustand der LED A1 vom Core zurueck.
|
||||||
@return 0=aus, 1=gruen, 2=rot"""
|
@return 0=aus, 1=gruen, 2=rot"""
|
||||||
int_led = int.from_bytes(
|
int_led = int.from_bytes(
|
||||||
self.__lst_io[self._ioled].get_value(),
|
self._ioled.get_value(), byteorder="little"
|
||||||
byteorder=self.__lst_io[self._ioled]._byteorder
|
|
||||||
)
|
)
|
||||||
led = int_led & 1
|
led = int_led & 1
|
||||||
led += int_led & 2
|
led += int_led & 2
|
||||||
return led
|
return led
|
||||||
|
|
||||||
def _get_leda2(self):
|
def _get_leda2(self):
|
||||||
"""Gibt den Zustand der LED A2 vom core zurueck.
|
"""Gibt den Zustand der LED A2 vom Core zurueck.
|
||||||
@return 0=aus, 1=gruen, 2=rot"""
|
@return 0=aus, 1=gruen, 2=rot"""
|
||||||
int_led = int.from_bytes(
|
int_led = int.from_bytes(
|
||||||
self.__lst_io[self._ioled].get_value(),
|
self._ioled.get_value(), byteorder="little"
|
||||||
byteorder=self.__lst_io[self._ioled]._byteorder
|
|
||||||
) >> 2
|
) >> 2
|
||||||
led = int_led & 1
|
led = int_led & 1
|
||||||
led += int_led & 2
|
led += int_led & 2
|
||||||
return led
|
return led
|
||||||
|
|
||||||
|
def _set_calculatedled(self, addresslist, shifted_value):
|
||||||
|
"""Berechnet und setzt neuen Bytewert fuer LED byte.
|
||||||
|
@param addresslist Liste der Vergleicher
|
||||||
|
@param shifed_value Bits vergleichen"""
|
||||||
|
# Byte als int holen
|
||||||
|
int_led = int.from_bytes(
|
||||||
|
self._ioled.get_value(), byteorder="little"
|
||||||
|
)
|
||||||
|
|
||||||
|
for int_bit in addresslist:
|
||||||
|
value = bool(shifted_value & int_bit)
|
||||||
|
if bool(int_led & int_bit) != value:
|
||||||
|
# Berechnen, wenn verändert
|
||||||
|
if value:
|
||||||
|
int_led += int_bit
|
||||||
|
else:
|
||||||
|
int_led -= int_bit
|
||||||
|
|
||||||
|
# Zurückschreiben wenn verändert
|
||||||
|
self._ioled.set_value(int_led.to_bytes(length=1, byteorder="little"))
|
||||||
|
|
||||||
def _set_leda1(self, value):
|
def _set_leda1(self, value):
|
||||||
"""Setzt den Zustand der LED A1 vom core.
|
"""Setzt den Zustand der LED A1 vom Core.
|
||||||
@param value 0=aus, 1=gruen, 2=rot"""
|
@param value 0=aus, 1=gruen, 2=rot"""
|
||||||
if 0 <= value <= 3:
|
if 0 <= value <= 3:
|
||||||
int_led = (self._get_leda2() << 2) + value
|
self._set_calculatedled([1, 2], value)
|
||||||
self.__lst_io[self._ioled].set_value(int_led.to_bytes(
|
|
||||||
length=1, byteorder=self.__lst_io[self._ioled]._byteorder
|
|
||||||
))
|
|
||||||
else:
|
else:
|
||||||
raise ValueError("led status must be between 0 and 3")
|
raise ValueError("led status must be between 0 and 3")
|
||||||
|
|
||||||
def _set_leda2(self, value):
|
def _set_leda2(self, value):
|
||||||
"""Setzt den Zustand der LED A2 vom core.
|
"""Setzt den Zustand der LED A2 vom Core.
|
||||||
@param value 0=aus, 1=gruen, 2=rot"""
|
@param value 0=aus, 1=gruen, 2=rot"""
|
||||||
if 0 <= value <= 3:
|
if 0 <= value <= 3:
|
||||||
int_led = (value << 2) + self._get_leda1()
|
self._set_calculatedled([4, 8], value << 2)
|
||||||
self.__lst_io[self._ioled].set_value(int_led.to_bytes(
|
|
||||||
length=1, byteorder=self.__lst_io[self._ioled]._byteorder
|
|
||||||
))
|
|
||||||
else:
|
else:
|
||||||
raise ValueError("led status must be between 0 and 3")
|
raise ValueError("led status must be between 0 and 3")
|
||||||
|
|
||||||
@@ -522,8 +594,7 @@ class Core(Device):
|
|||||||
"""Statusbit fuer piControl-Treiber laeuft.
|
"""Statusbit fuer piControl-Treiber laeuft.
|
||||||
@return True, wenn Treiber laeuft"""
|
@return True, wenn Treiber laeuft"""
|
||||||
return bool(int.from_bytes(
|
return bool(int.from_bytes(
|
||||||
self.__lst_io[0].get_value(),
|
self._iostatusbyte.get_value(), byteorder="little"
|
||||||
byteorder=self.__lst_io[0]._byteorder
|
|
||||||
) & 1)
|
) & 1)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -531,8 +602,7 @@ class Core(Device):
|
|||||||
"""Statusbit fuer ein IO-Modul nicht mit PiCtory konfiguriert.
|
"""Statusbit fuer ein IO-Modul nicht mit PiCtory konfiguriert.
|
||||||
@return True, wenn IO Modul nicht konfiguriert"""
|
@return True, wenn IO Modul nicht konfiguriert"""
|
||||||
return bool(int.from_bytes(
|
return bool(int.from_bytes(
|
||||||
self.__lst_io[0].get_value(),
|
self._iostatusbyte.get_value(), byteorder="little"
|
||||||
byteorder=self.__lst_io[0]._byteorder
|
|
||||||
) & 2)
|
) & 2)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -540,8 +610,7 @@ class Core(Device):
|
|||||||
"""Statusbit fuer ein IO-Modul fehlt oder piGate konfiguriert.
|
"""Statusbit fuer ein IO-Modul fehlt oder piGate konfiguriert.
|
||||||
@return True, wenn IO-Modul fehlt oder piGate konfiguriert"""
|
@return True, wenn IO-Modul fehlt oder piGate konfiguriert"""
|
||||||
return bool(int.from_bytes(
|
return bool(int.from_bytes(
|
||||||
self.__lst_io[0].get_value(),
|
self._iostatusbyte.get_value(), byteorder="little"
|
||||||
byteorder=self.__lst_io[0]._byteorder
|
|
||||||
) & 4)
|
) & 4)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -549,8 +618,7 @@ class Core(Device):
|
|||||||
"""Statusbit Modul belegt mehr oder weniger Speicher als konfiguriert.
|
"""Statusbit Modul belegt mehr oder weniger Speicher als konfiguriert.
|
||||||
@return True, wenn falscher Speicher belegt ist"""
|
@return True, wenn falscher Speicher belegt ist"""
|
||||||
return bool(int.from_bytes(
|
return bool(int.from_bytes(
|
||||||
self.__lst_io[0].get_value(),
|
self._iostatusbyte.get_value(), byteorder="little"
|
||||||
byteorder=self.__lst_io[0]._byteorder
|
|
||||||
) & 8)
|
) & 8)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -558,8 +626,7 @@ class Core(Device):
|
|||||||
"""Statusbit links vom RevPi ist ein piGate Modul angeschlossen.
|
"""Statusbit links vom RevPi ist ein piGate Modul angeschlossen.
|
||||||
@return True, wenn piGate links existiert"""
|
@return True, wenn piGate links existiert"""
|
||||||
return bool(int.from_bytes(
|
return bool(int.from_bytes(
|
||||||
self.__lst_io[0].get_value(),
|
self._iostatusbyte.get_value(), byteorder="little"
|
||||||
byteorder=self.__lst_io[0]._byteorder
|
|
||||||
) & 16)
|
) & 16)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -567,8 +634,7 @@ class Core(Device):
|
|||||||
"""Statusbit rechts vom RevPi ist ein piGate Modul angeschlossen.
|
"""Statusbit rechts vom RevPi ist ein piGate Modul angeschlossen.
|
||||||
@return True, wenn piGate rechts existiert"""
|
@return True, wenn piGate rechts existiert"""
|
||||||
return bool(int.from_bytes(
|
return bool(int.from_bytes(
|
||||||
self.__lst_io[0].get_value(),
|
self._iostatusbyte.get_value(), byteorder="little"
|
||||||
byteorder=self.__lst_io[0]._byteorder
|
|
||||||
) & 32)
|
) & 32)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -576,8 +642,7 @@ class Core(Device):
|
|||||||
"""Gibt Zykluszeit der Prozessabbildsynchronisierung zurueck.
|
"""Gibt Zykluszeit der Prozessabbildsynchronisierung zurueck.
|
||||||
@return Zykluszeit in ms"""
|
@return Zykluszeit in ms"""
|
||||||
return None if self._iocycle is None else int.from_bytes(
|
return None if self._iocycle is None else int.from_bytes(
|
||||||
self.__lst_io[self._iocycle].get_value(),
|
self._iocycle.get_value(), byteorder="little"
|
||||||
byteorder=self.__lst_io[self._iocycle]._byteorder
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -585,8 +650,7 @@ class Core(Device):
|
|||||||
"""Gibt CPU-Temperatur zurueck.
|
"""Gibt CPU-Temperatur zurueck.
|
||||||
@return CPU-Temperatur in Celsius"""
|
@return CPU-Temperatur in Celsius"""
|
||||||
return None if self._iotemperature is None else int.from_bytes(
|
return None if self._iotemperature is None else int.from_bytes(
|
||||||
self.__lst_io[self._iotemperature].get_value(),
|
self._iotemperature.get_value(), byteorder="little"
|
||||||
byteorder=self.__lst_io[self._iotemperature]._byteorder
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -594,8 +658,7 @@ class Core(Device):
|
|||||||
"""Gibt CPU Taktfrequenz zurueck.
|
"""Gibt CPU Taktfrequenz zurueck.
|
||||||
@return CPU Taktfrequenz in MHz"""
|
@return CPU Taktfrequenz in MHz"""
|
||||||
return None if self._iofrequency is None else int.from_bytes(
|
return None if self._iofrequency is None else int.from_bytes(
|
||||||
self.__lst_io[self._iofrequency].get_value(),
|
self._iofrequency.get_value(), byteorder="little"
|
||||||
byteorder=self.__lst_io[self._iofrequency]._byteorder
|
|
||||||
) * 10
|
) * 10
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -603,8 +666,7 @@ class Core(Device):
|
|||||||
"""Gibt Fehleranzahl auf RS485 piBridge Bus zurueck.
|
"""Gibt Fehleranzahl auf RS485 piBridge Bus zurueck.
|
||||||
@return Fehleranzahl der piBridge"""
|
@return Fehleranzahl der piBridge"""
|
||||||
return None if self._ioerrorcnt is None else int.from_bytes(
|
return None if self._ioerrorcnt is None else int.from_bytes(
|
||||||
self.__lst_io[self._ioerrorcnt].get_value(),
|
self._ioerrorcnt.get_value(), byteorder="little"
|
||||||
byteorder=self.__lst_io[self._ioerrorcnt]._byteorder
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -632,6 +694,111 @@ class Core(Device):
|
|||||||
self.__errorlimit(self._ioerrorlimit2, value)
|
self.__errorlimit(self._ioerrorlimit2, value)
|
||||||
|
|
||||||
|
|
||||||
|
class Connect(Core):
|
||||||
|
|
||||||
|
"""Klasse fuer den RevPi Connect.
|
||||||
|
|
||||||
|
Stellt Funktionen fuer die LEDs, Watchdog und den Status zur Verfuegung.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
__slots__ = "__evt_wdtoggle", "__th_wdtoggle", "a3green", "a3red", "wd", \
|
||||||
|
"x2in", "x2out"
|
||||||
|
|
||||||
|
def __wdtoggle(self):
|
||||||
|
"""WD Ausgang alle 10 Sekunden automatisch toggeln."""
|
||||||
|
while not self.__evt_wdtoggle.wait(10):
|
||||||
|
self.wd.value = not self.wd.value
|
||||||
|
|
||||||
|
def _devconfigure(self):
|
||||||
|
"""Connect-Klasse vorbereiten."""
|
||||||
|
super()._devconfigure()
|
||||||
|
self.__evt_wdtoggle = Event()
|
||||||
|
self.__th_wdtoggle = None
|
||||||
|
|
||||||
|
# Echte IOs erzeugen
|
||||||
|
self.a3green = IOBase(self, [
|
||||||
|
"a3green", 0, 1, self._ioled._slc_address.start,
|
||||||
|
False, None, "LED_A3_GREEN", "4"
|
||||||
|
], OUT, "little", False)
|
||||||
|
self.a3red = IOBase(self, [
|
||||||
|
"a3red", 0, 1, self._ioled._slc_address.start,
|
||||||
|
False, None, "LED_A3_RED", "5"
|
||||||
|
], OUT, "little", False)
|
||||||
|
|
||||||
|
# IO Objekte für WD und X2 in/out erzeugen
|
||||||
|
self.wd = IOBase(self, [
|
||||||
|
"wd", 0, 1, self._ioled._slc_address.start,
|
||||||
|
False, None, "Connect_WatchDog", "7"
|
||||||
|
], OUT, "little", False)
|
||||||
|
self.x2in = IOBase(self, [
|
||||||
|
"x2in", 0, 1, self._iostatusbyte._slc_address.start,
|
||||||
|
False, None, "Connect_X2_IN", "6"
|
||||||
|
], INP, "little", False)
|
||||||
|
self.x2out = IOBase(self, [
|
||||||
|
"x2out", 0, 1, self._ioled._slc_address.start,
|
||||||
|
False, None, "Connect_X2_OUT", "6"
|
||||||
|
], OUT, "little", False)
|
||||||
|
|
||||||
|
def _get_leda3(self):
|
||||||
|
"""Gibt den Zustand der LED A3 vom Connect zurueck.
|
||||||
|
@return 0=aus, 1=gruen, 2=rot"""
|
||||||
|
int_led = int.from_bytes(
|
||||||
|
self._ioled.get_value(), byteorder="little"
|
||||||
|
) >> 4
|
||||||
|
led = int_led & 1
|
||||||
|
led += int_led & 2
|
||||||
|
return led
|
||||||
|
|
||||||
|
def _get_wdtoggle(self):
|
||||||
|
"""Ruft den Wert fuer Autowatchdog ab.
|
||||||
|
@return True, wenn Autowatchdog aktiv ist"""
|
||||||
|
return self.__th_wdtoggle is not None \
|
||||||
|
and self.__th_wdtoggle.is_alive()
|
||||||
|
|
||||||
|
def _set_leda3(self, value):
|
||||||
|
"""Setzt den Zustand der LED A3 vom Connect.
|
||||||
|
@param value 0=aus, 1=gruen, 2=rot"""
|
||||||
|
if 0 <= value <= 3:
|
||||||
|
self._set_calculatedled([16, 32], value << 4)
|
||||||
|
else:
|
||||||
|
raise ValueError("led status must be between 0 and 3")
|
||||||
|
|
||||||
|
def _set_wdtoggle(self, value):
|
||||||
|
"""Setzt den Wert fuer Autowatchdog.
|
||||||
|
|
||||||
|
Wird dieser Wert auf True gesetzt, wechselt im Hintergrund das noetige
|
||||||
|
Bit zum toggeln des Watchdogs alle 10 Sekunden zwichen True und False.
|
||||||
|
Dieses Bit wird bei autorefresh=True natuerlich automatisch in das
|
||||||
|
Prozessabbild geschrieben.
|
||||||
|
|
||||||
|
WICHTIG: Sollte autorefresh=False sein, muss zyklisch
|
||||||
|
.writeprocimg() aufgerufen werden, um den Wert in das
|
||||||
|
Prozessabbild zu schreiben!!!
|
||||||
|
|
||||||
|
@param value True zum aktivieren, Fals zum beenden"""
|
||||||
|
if self._modio._monitoring:
|
||||||
|
raise RuntimeError(
|
||||||
|
"can not toggle watchdog, while system is in monitoring mode"
|
||||||
|
)
|
||||||
|
if self._modio._simulator:
|
||||||
|
raise RuntimeError(
|
||||||
|
"can not toggle watchdog, while system is in simulator mode"
|
||||||
|
)
|
||||||
|
|
||||||
|
if not value:
|
||||||
|
self.__evt_wdtoggle.set()
|
||||||
|
|
||||||
|
elif not self._get_wdtoggle():
|
||||||
|
# Watchdogtoggler erstellen
|
||||||
|
self.__evt_wdtoggle.clear()
|
||||||
|
self.__th_wdtoggle = Thread(target=self.__wdtoggle, daemon=True)
|
||||||
|
self.__th_wdtoggle.start()
|
||||||
|
|
||||||
|
A3 = property(_get_leda3, _set_leda3)
|
||||||
|
wdautotoggle = property(_get_wdtoggle, _set_wdtoggle)
|
||||||
|
|
||||||
|
|
||||||
class Gateway(Device):
|
class Gateway(Device):
|
||||||
|
|
||||||
"""Klasse fuer die RevPi Gateway-Devices.
|
"""Klasse fuer die RevPi Gateway-Devices.
|
||||||
@@ -645,6 +812,8 @@ class Gateway(Device):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = "_dict_slc"
|
||||||
|
|
||||||
def __init__(self, parent, dict_device, simulator=False):
|
def __init__(self, parent, dict_device, simulator=False):
|
||||||
"""Erweitert Device-Klasse um get_rawbytes-Funktionen.
|
"""Erweitert Device-Klasse um get_rawbytes-Funktionen.
|
||||||
@see #Device.__init__ Device.__init__(...)"""
|
@see #Device.__init__ Device.__init__(...)"""
|
||||||
@@ -674,6 +843,8 @@ class Virtual(Gateway):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = ()
|
||||||
|
|
||||||
def writeinputdefaults(self):
|
def writeinputdefaults(self):
|
||||||
"""Schreibt fuer ein virtuelles Device piCtory Defaultinputwerte.
|
"""Schreibt fuer ein virtuelles Device piCtory Defaultinputwerte.
|
||||||
|
|
||||||
@@ -698,7 +869,7 @@ class Virtual(Gateway):
|
|||||||
for io in self.get_inputs():
|
for io in self.get_inputs():
|
||||||
self._ba_devdata[io._slc_address] = io._defaultvalue
|
self._ba_devdata[io._slc_address] = io._defaultvalue
|
||||||
|
|
||||||
# Outpus auf Bus schreiben
|
# Outputs auf Bus schreiben
|
||||||
try:
|
try:
|
||||||
self._modio._myfh.seek(self._slc_inpoff.start)
|
self._modio._myfh.seek(self._slc_inpoff.start)
|
||||||
self._modio._myfh.write(self._ba_devdata[self._slc_inp])
|
self._modio._myfh.write(self._ba_devdata[self._slc_inp])
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
|
||||||
# python3-RevPiModIO
|
|
||||||
#
|
|
||||||
# Webpage: https://revpimodio.org/
|
|
||||||
# (c) Sven Sager, License: LGPLv3
|
|
||||||
#
|
|
||||||
"""RevPiModIO Helperklassen und Tools."""
|
"""RevPiModIO Helperklassen und Tools."""
|
||||||
|
__author__ = "Sven Sager"
|
||||||
|
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||||
|
__license__ = "LGPLv3"
|
||||||
|
|
||||||
import queue
|
import queue
|
||||||
import warnings
|
import warnings
|
||||||
from math import ceil
|
from math import ceil
|
||||||
@@ -39,6 +37,8 @@ class EventCallback(Thread):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = "daemon", "exit", "func", "ioname", "iovalue"
|
||||||
|
|
||||||
def __init__(self, func, name, value):
|
def __init__(self, func, name, value):
|
||||||
"""Init EventCallback class.
|
"""Init EventCallback class.
|
||||||
|
|
||||||
@@ -87,6 +87,11 @@ class Cycletools():
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = "__cycle", "__cycletime", "__ucycle", \
|
||||||
|
"__dict_ton", "__dict_tof", "__dict_tp", "first", \
|
||||||
|
"flag1c", "flag5c", "flag10c", "flag15c", "flag20c", \
|
||||||
|
"flank5c", "flank10c", "flank15c", "flank20c", "var"
|
||||||
|
|
||||||
def __init__(self, cycletime):
|
def __init__(self, cycletime):
|
||||||
"""Init Cycletools class."""
|
"""Init Cycletools class."""
|
||||||
self.__cycle = 0
|
self.__cycle = 0
|
||||||
@@ -110,6 +115,11 @@ class Cycletools():
|
|||||||
self.flank15c = True
|
self.flank15c = True
|
||||||
self.flank20c = True
|
self.flank20c = True
|
||||||
|
|
||||||
|
# Benutzerdaten
|
||||||
|
class Var:
|
||||||
|
pass
|
||||||
|
self.var = Var()
|
||||||
|
|
||||||
def _docycle(self):
|
def _docycle(self):
|
||||||
"""Zyklusarbeiten."""
|
"""Zyklusarbeiten."""
|
||||||
# Einschaltverzoegerung
|
# Einschaltverzoegerung
|
||||||
@@ -279,6 +289,10 @@ class ProcimgWriter(Thread):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = "__dict_delay", "__eventth", "__eventqth", "__eventwork", \
|
||||||
|
"_adjwait", "_eventq", "_ioerror", "_maxioerrors", "_modio", \
|
||||||
|
"_refresh", "_work", "daemon", "lck_refresh", "newdata"
|
||||||
|
|
||||||
def __init__(self, parentmodio):
|
def __init__(self, parentmodio):
|
||||||
"""Init ProcimgWriter class.
|
"""Init ProcimgWriter class.
|
||||||
@param parentmodio Parent Object"""
|
@param parentmodio Parent Object"""
|
||||||
@@ -386,10 +400,16 @@ class ProcimgWriter(Thread):
|
|||||||
|
|
||||||
def _collect_events(self, value):
|
def _collect_events(self, value):
|
||||||
"""Aktiviert oder Deaktiviert die Eventueberwachung.
|
"""Aktiviert oder Deaktiviert die Eventueberwachung.
|
||||||
@param value True aktiviert / False deaktiviert"""
|
@param value True aktiviert / False deaktiviert
|
||||||
|
@return True, wenn Anforderung erfolgreich war"""
|
||||||
if type(value) != bool:
|
if type(value) != bool:
|
||||||
raise ValueError("value must be <class 'bool'>")
|
raise ValueError("value must be <class 'bool'>")
|
||||||
|
|
||||||
|
# Nur starten, wenn System läuft
|
||||||
|
if not self.is_alive():
|
||||||
|
self.__eventwork = False
|
||||||
|
return False
|
||||||
|
|
||||||
if self.__eventwork != value:
|
if self.__eventwork != value:
|
||||||
with self.lck_refresh:
|
with self.lck_refresh:
|
||||||
self.__eventwork = value
|
self.__eventwork = value
|
||||||
@@ -403,6 +423,8 @@ class ProcimgWriter(Thread):
|
|||||||
self.__eventth.daemon = True
|
self.__eventth.daemon = True
|
||||||
self.__eventth.start()
|
self.__eventth.start()
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def _get_ioerrors(self):
|
def _get_ioerrors(self):
|
||||||
"""Ruft aktuelle Anzahl der Fehler ab.
|
"""Ruft aktuelle Anzahl der Fehler ab.
|
||||||
@return Aktuelle Fehleranzahl"""
|
@return Aktuelle Fehleranzahl"""
|
||||||
@@ -413,12 +435,12 @@ class ProcimgWriter(Thread):
|
|||||||
self._ioerror += 1
|
self._ioerror += 1
|
||||||
if self._maxioerrors != 0 and self._ioerror >= self._maxioerrors:
|
if self._maxioerrors != 0 and self._ioerror >= self._maxioerrors:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"reach max io error count {} on process image".format(
|
"reach max io error count {0} on process image".format(
|
||||||
self._maxioerrors
|
self._maxioerrors
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"count {} io errors on process image".format(self._ioerror),
|
"count {0} io errors on process image".format(self._ioerror),
|
||||||
RuntimeWarning
|
RuntimeWarning
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -443,7 +465,7 @@ class ProcimgWriter(Thread):
|
|||||||
# Lockobjekt holen und Fehler werfen, wenn nicht schnell genug
|
# Lockobjekt holen und Fehler werfen, wenn nicht schnell genug
|
||||||
if not self.lck_refresh.acquire(timeout=self._adjwait):
|
if not self.lck_refresh.acquire(timeout=self._adjwait):
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"cycle time of {} ms exceeded on lock".format(
|
"cycle time of {0} ms exceeded on lock".format(
|
||||||
int(self._refresh * 1000)
|
int(self._refresh * 1000)
|
||||||
),
|
),
|
||||||
RuntimeWarning
|
RuntimeWarning
|
||||||
@@ -458,13 +480,13 @@ class ProcimgWriter(Thread):
|
|||||||
if self._modio._monitoring:
|
if self._modio._monitoring:
|
||||||
# Inputs und Outputs in Puffer
|
# Inputs und Outputs in Puffer
|
||||||
for dev in self._modio._lst_refresh:
|
for dev in self._modio._lst_refresh:
|
||||||
dev._filelock.acquire()
|
with dev._filelock:
|
||||||
dev._ba_devdata[:] = bytesbuff[dev._slc_devoff]
|
dev._ba_devdata[:] = bytesbuff[dev._slc_devoff]
|
||||||
if self.__eventwork \
|
if self.__eventwork \
|
||||||
and len(dev._dict_events) > 0 \
|
and len(dev._dict_events) > 0 \
|
||||||
and dev._ba_datacp != dev._ba_devdata:
|
and dev._ba_datacp != dev._ba_devdata:
|
||||||
self.__check_change(dev)
|
self.__check_change(dev)
|
||||||
dev._filelock.release()
|
|
||||||
else:
|
else:
|
||||||
# Inputs in Puffer, Outputs in Prozessabbild
|
# Inputs in Puffer, Outputs in Prozessabbild
|
||||||
for dev in self._modio._lst_refresh:
|
for dev in self._modio._lst_refresh:
|
||||||
@@ -495,9 +517,9 @@ class ProcimgWriter(Thread):
|
|||||||
finally:
|
finally:
|
||||||
# Verzögerte Events prüfen
|
# Verzögerte Events prüfen
|
||||||
if self.__eventwork:
|
if self.__eventwork:
|
||||||
for tup_fire in list(self.__dict_delay.keys()):
|
for tup_fire in tuple(self.__dict_delay.keys()):
|
||||||
if tup_fire[0].overwrite \
|
if tup_fire[0].overwrite and \
|
||||||
and getattr(self._modio.io, tup_fire[1]).value != \
|
getattr(self._modio.io, tup_fire[1]).value != \
|
||||||
tup_fire[2]:
|
tup_fire[2]:
|
||||||
del self.__dict_delay[tup_fire]
|
del self.__dict_delay[tup_fire]
|
||||||
else:
|
else:
|
||||||
@@ -518,7 +540,7 @@ class ProcimgWriter(Thread):
|
|||||||
self._adjwait -= 0.001
|
self._adjwait -= 0.001
|
||||||
if self._adjwait < 0:
|
if self._adjwait < 0:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"cycle time of {} ms exceeded".format(
|
"cycle time of {0} ms exceeded".format(
|
||||||
int(self._refresh * 1000)
|
int(self._refresh * 1000)
|
||||||
),
|
),
|
||||||
RuntimeWarning
|
RuntimeWarning
|
||||||
@@ -534,7 +556,6 @@ class ProcimgWriter(Thread):
|
|||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
"""Beendet die automatische Prozessabbildsynchronisierung."""
|
"""Beendet die automatische Prozessabbildsynchronisierung."""
|
||||||
self._collect_events(False)
|
|
||||||
self._work.set()
|
self._work.set()
|
||||||
|
|
||||||
def set_maxioerrors(self, value):
|
def set_maxioerrors(self, value):
|
||||||
@@ -548,13 +569,13 @@ class ProcimgWriter(Thread):
|
|||||||
def set_refresh(self, value):
|
def set_refresh(self, value):
|
||||||
"""Setzt die Zykluszeit in Millisekunden.
|
"""Setzt die Zykluszeit in Millisekunden.
|
||||||
@param value <class 'int'> Millisekunden"""
|
@param value <class 'int'> Millisekunden"""
|
||||||
if type(value) == int and 10 <= value <= 2000:
|
if type(value) == int and 5 <= value <= 2000:
|
||||||
waitdiff = self._refresh - self._adjwait
|
waitdiff = self._refresh - self._adjwait
|
||||||
self._refresh = value / 1000
|
self._refresh = value / 1000
|
||||||
self._adjwait = self._refresh - waitdiff
|
self._adjwait = 0 if waitdiff < 0 else self._refresh - waitdiff
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"refresh time must be 10 to 2000 milliseconds"
|
"refresh time must be 5 to 2000 milliseconds"
|
||||||
)
|
)
|
||||||
|
|
||||||
ioerrors = property(_get_ioerrors)
|
ioerrors = property(_get_ioerrors)
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
|
||||||
# python3-RevPiModIO
|
|
||||||
#
|
|
||||||
# Webpage: https://revpimodio.org/
|
|
||||||
# (c) Sven Sager, License: LGPLv3
|
|
||||||
#
|
|
||||||
"""RevPiModIO Modul fuer die Verwaltung der IOs."""
|
"""RevPiModIO Modul fuer die Verwaltung der IOs."""
|
||||||
|
__author__ = "Sven Sager"
|
||||||
|
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||||
|
__license__ = "LGPLv3"
|
||||||
|
|
||||||
import struct
|
import struct
|
||||||
from re import match as rematch
|
from re import match as rematch
|
||||||
from threading import Event
|
from threading import Event
|
||||||
@@ -16,6 +14,8 @@ class IOEvent(object):
|
|||||||
|
|
||||||
"""Basisklasse fuer IO-Events."""
|
"""Basisklasse fuer IO-Events."""
|
||||||
|
|
||||||
|
__slots__ = "as_thread", "delay", "edge", "func", "overwrite"
|
||||||
|
|
||||||
def __init__(self, func, edge, as_thread, delay, overwrite):
|
def __init__(self, func, edge, as_thread, delay, overwrite):
|
||||||
"""Init IOEvent class."""
|
"""Init IOEvent class."""
|
||||||
self.as_thread = as_thread
|
self.as_thread = as_thread
|
||||||
@@ -69,7 +69,7 @@ class IOList(object):
|
|||||||
if key in self.__dict_iorefname:
|
if key in self.__dict_iorefname:
|
||||||
return self.__dict_iorefname[key]
|
return self.__dict_iorefname[key]
|
||||||
else:
|
else:
|
||||||
raise AttributeError("can not find io '{}'".format(key))
|
raise AttributeError("can not find io '{0}'".format(key))
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
"""Ruft angegebenen IO ab.
|
"""Ruft angegebenen IO ab.
|
||||||
@@ -86,7 +86,7 @@ class IOList(object):
|
|||||||
"""
|
"""
|
||||||
if type(key) == int:
|
if type(key) == int:
|
||||||
if key not in self.__dict_iobyte:
|
if key not in self.__dict_iobyte:
|
||||||
raise KeyError("byte '{}' does not exist".format(key))
|
raise KeyError("byte '{0}' does not exist".format(key))
|
||||||
return self.__dict_iobyte[key]
|
return self.__dict_iobyte[key]
|
||||||
elif type(key) == slice:
|
elif type(key) == slice:
|
||||||
return [
|
return [
|
||||||
@@ -151,14 +151,14 @@ class IOList(object):
|
|||||||
if oldio._bitaddress >= 0:
|
if oldio._bitaddress >= 0:
|
||||||
if io._bitaddress == oldio._bitaddress:
|
if io._bitaddress == oldio._bitaddress:
|
||||||
raise MemoryError(
|
raise MemoryError(
|
||||||
"bit {} already assigned to '{}'".format(
|
"bit {0} already assigned to '{1}'".format(
|
||||||
io._bitaddress, oldio._name
|
io._bitaddress, oldio._name
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# Bereits überschriebene bytes sind ungültig
|
# Bereits überschriebene bytes sind ungültig
|
||||||
raise MemoryError(
|
raise MemoryError(
|
||||||
"new io '{}' overlaps memory of '{}'".format(
|
"new io '{0}' overlaps memory of '{1}'".format(
|
||||||
io._name, oldio._name
|
io._name, oldio._name
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -191,10 +191,10 @@ class IOList(object):
|
|||||||
def _private_register_new_io_object(self, new_io):
|
def _private_register_new_io_object(self, new_io):
|
||||||
"""Registriert neues IO Objekt unabhaenging von __setattr__.
|
"""Registriert neues IO Objekt unabhaenging von __setattr__.
|
||||||
@param new_io Neues IO Objekt"""
|
@param new_io Neues IO Objekt"""
|
||||||
if issubclass(type(new_io), IOBase):
|
if isinstance(new_io, IOBase):
|
||||||
if hasattr(self, new_io._name):
|
if hasattr(self, new_io._name):
|
||||||
raise AttributeError(
|
raise AttributeError(
|
||||||
"attribute {} already exists - can not set io".format(
|
"attribute {0} already exists - can not set io".format(
|
||||||
new_io._name
|
new_io._name
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -222,6 +222,8 @@ class DeadIO(object):
|
|||||||
|
|
||||||
"""Klasse, mit der ersetzte IOs verwaltet werden."""
|
"""Klasse, mit der ersetzte IOs verwaltet werden."""
|
||||||
|
|
||||||
|
__slots__ = "__deadio"
|
||||||
|
|
||||||
def __init__(self, deadio):
|
def __init__(self, deadio):
|
||||||
"""Instantiierung der DeadIO-Klasse.
|
"""Instantiierung der DeadIO-Klasse.
|
||||||
@param deadio IO, der ersetzt wurde"""
|
@param deadio IO, der ersetzt wurde"""
|
||||||
@@ -250,18 +252,22 @@ class IOBase(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = "_bitaddress", "_bitlength", "_byteorder", "_defaultvalue", \
|
||||||
|
"_iotype", "_length", "_name", "_parentdevice", \
|
||||||
|
"_signed", "_slc_address", "bmk", "export"
|
||||||
|
|
||||||
def __init__(self, parentdevice, valuelist, iotype, byteorder, signed):
|
def __init__(self, parentdevice, valuelist, iotype, byteorder, signed):
|
||||||
"""Instantiierung der IOBase-Klasse.
|
"""Instantiierung der IOBase-Klasse.
|
||||||
|
|
||||||
@param parentdevice Parentdevice auf dem der IO liegt
|
@param parentdevice Parentdevice auf dem der IO liegt
|
||||||
@param valuelist Datenliste fuer Instantiierung
|
@param valuelist Datenliste fuer Instantiierung
|
||||||
["name","defval","bitlen","startaddr",exp,"idx","bmk","bitaddr"]
|
["name","defval","bitlen","startaddrdev",exp,"idx","bmk","bitaddr"]
|
||||||
@param iotype <class 'int'> Wert
|
@param iotype <class 'int'> Wert
|
||||||
@param byteorder Byteorder 'little'/'big' fuer <class 'int'> Berechnung
|
@param byteorder Byteorder 'little'/'big' fuer <class 'int'> Berechnung
|
||||||
@param sigend Intberechnung mit Vorzeichen durchfuehren
|
@param sigend Intberechnung mit Vorzeichen durchfuehren
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# ["name","defval","bitlen","startaddr",exp,"idx","bmk","bitaddr"]
|
# ["name","defval","bitlen","startaddrdev",exp,"idx","bmk","bitaddr"]
|
||||||
# [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ]
|
# [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ]
|
||||||
self._parentdevice = parentdevice
|
self._parentdevice = parentdevice
|
||||||
|
|
||||||
@@ -277,6 +283,7 @@ class IOBase(object):
|
|||||||
self._name = valuelist[0]
|
self._name = valuelist[0]
|
||||||
self._signed = signed
|
self._signed = signed
|
||||||
self.bmk = valuelist[6]
|
self.bmk = valuelist[6]
|
||||||
|
self.export = bool(valuelist[4])
|
||||||
|
|
||||||
int_startaddress = int(valuelist[3])
|
int_startaddress = int(valuelist[3])
|
||||||
if self._bitaddress == -1:
|
if self._bitaddress == -1:
|
||||||
@@ -298,7 +305,7 @@ class IOBase(object):
|
|||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"given bytes for default value must have a length "
|
"given bytes for default value must have a length "
|
||||||
"of {} but {} was given"
|
"of {0} but {1} was given"
|
||||||
"".format(self._length, len(valuelist[1]))
|
"".format(self._length, len(valuelist[1]))
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@@ -312,12 +319,12 @@ class IOBase(object):
|
|||||||
if len(buff) <= self._length:
|
if len(buff) <= self._length:
|
||||||
self._defaultvalue = \
|
self._defaultvalue = \
|
||||||
buff + bytes(self._length - len(buff))
|
buff + bytes(self._length - len(buff))
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Höhere Bits als 7 auf nächste Bytes umbrechen
|
# Höhere Bits als 7 auf nächste Bytes umbrechen
|
||||||
int_startaddress += int((int(valuelist[7]) % 16) / 8)
|
int_startaddress += int(int(valuelist[7]) / 8)
|
||||||
self._slc_address = slice(
|
self._slc_address = slice(
|
||||||
int_startaddress, int_startaddress + 1
|
int_startaddress, int_startaddress + 1
|
||||||
)
|
)
|
||||||
@@ -328,7 +335,7 @@ class IOBase(object):
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
self._defaultvalue = bool(int(valuelist[1]))
|
self._defaultvalue = bool(int(valuelist[1]))
|
||||||
except:
|
except Exception:
|
||||||
self._defaultvalue = False
|
self._defaultvalue = False
|
||||||
|
|
||||||
def __bool__(self):
|
def __bool__(self):
|
||||||
@@ -367,7 +374,7 @@ class IOBase(object):
|
|||||||
# Prüfen ob Funktion callable ist
|
# Prüfen ob Funktion callable ist
|
||||||
if not callable(func):
|
if not callable(func):
|
||||||
raise AttributeError(
|
raise AttributeError(
|
||||||
"registered function '{}' is not callable".format(func)
|
"registered function '{0}' is not callable".format(func)
|
||||||
)
|
)
|
||||||
if type(delay) != int or delay < 0:
|
if type(delay) != int or delay < 0:
|
||||||
raise AttributeError(
|
raise AttributeError(
|
||||||
@@ -379,6 +386,7 @@ class IOBase(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if self not in self._parentdevice._dict_events:
|
if self not in self._parentdevice._dict_events:
|
||||||
|
with self._parentdevice._filelock:
|
||||||
self._parentdevice._dict_events[self] = \
|
self._parentdevice._dict_events[self] = \
|
||||||
[IOEvent(func, edge, as_thread, delay, overwrite)]
|
[IOEvent(func, edge, as_thread, delay, overwrite)]
|
||||||
else:
|
else:
|
||||||
@@ -391,26 +399,28 @@ class IOBase(object):
|
|||||||
if edge == BOTH or regfunc.edge == BOTH:
|
if edge == BOTH or regfunc.edge == BOTH:
|
||||||
if self._bitaddress < 0:
|
if self._bitaddress < 0:
|
||||||
raise AttributeError(
|
raise AttributeError(
|
||||||
"io '{}' with function '{}' already in list."
|
"io '{0}' with function '{1}' already in list."
|
||||||
"".format(self._name, func)
|
"".format(self._name, func)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise AttributeError(
|
raise AttributeError(
|
||||||
"io '{}' with function '{}' already in list with "
|
"io '{0}' with function '{1}' already in list "
|
||||||
"edge '{}' - edge '{}' not allowed anymore".format(
|
"with edge '{2}' - edge '{3}' not allowed anymore"
|
||||||
|
"".format(
|
||||||
self._name, func,
|
self._name, func,
|
||||||
consttostr(regfunc.edge), consttostr(edge)
|
consttostr(regfunc.edge), consttostr(edge)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif regfunc.edge == edge:
|
elif regfunc.edge == edge:
|
||||||
raise AttributeError(
|
raise AttributeError(
|
||||||
"io '{}' with function '{}' for given edge '{}' "
|
"io '{0}' with function '{1}' for given edge '{2}' "
|
||||||
"already in list".format(
|
"already in list".format(
|
||||||
self._name, func, consttostr(edge)
|
self._name, func, consttostr(edge)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Eventfunktion einfügen
|
# Eventfunktion einfügen
|
||||||
|
with self._parentdevice._filelock:
|
||||||
self._parentdevice._dict_events[self].append(
|
self._parentdevice._dict_events[self].append(
|
||||||
IOEvent(func, edge, as_thread, delay, overwrite)
|
IOEvent(func, edge, as_thread, delay, overwrite)
|
||||||
)
|
)
|
||||||
@@ -519,7 +529,7 @@ class IOBase(object):
|
|||||||
>Python3 struct</a>
|
>Python3 struct</a>
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not issubclass(type(self._parentdevice), Gateway):
|
if not isinstance(self._parentdevice, Gateway):
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"this function can be used for ios on gatway or virtual "
|
"this function can be used for ios on gatway or virtual "
|
||||||
"devices only"
|
"devices only"
|
||||||
@@ -584,31 +594,31 @@ class IOBase(object):
|
|||||||
value
|
value
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"'{}' requires a <class 'bytes'> object of length "
|
"'{0}' requires a <class 'bytes'> object of "
|
||||||
"{}, but {} was given".format(
|
"length {1}, but {2} was given".format(
|
||||||
self._name, self._length, len(value)
|
self._name, self._length, len(value)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"'{}' requires a <class 'bytes'> object, not {}"
|
"'{0}' requires a <class 'bytes'> object, not {1}"
|
||||||
"".format(self._name, type(value))
|
"".format(self._name, type(value))
|
||||||
)
|
)
|
||||||
|
|
||||||
elif self._iotype == INP:
|
elif self._iotype == INP:
|
||||||
if self._parentdevice._modio._simulator:
|
if self._parentdevice._modio._simulator:
|
||||||
raise AttributeError(
|
raise AttributeError(
|
||||||
"can not write to output '{}' in simulator mode"
|
"can not write to output '{0}' in simulator mode"
|
||||||
"".format(self._name)
|
"".format(self._name)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise AttributeError(
|
raise AttributeError(
|
||||||
"can not write to input '{}'".format(self._name)
|
"can not write to input '{0}'".format(self._name)
|
||||||
)
|
)
|
||||||
|
|
||||||
elif self._iotype == MEM:
|
elif self._iotype == MEM:
|
||||||
raise AttributeError(
|
raise AttributeError(
|
||||||
"can not write to memory '{}'".format(self._name)
|
"can not write to memory '{0}'".format(self._name)
|
||||||
)
|
)
|
||||||
|
|
||||||
def unreg_event(self, func=None, edge=None):
|
def unreg_event(self, func=None, edge=None):
|
||||||
@@ -620,6 +630,7 @@ class IOBase(object):
|
|||||||
"""
|
"""
|
||||||
if self in self._parentdevice._dict_events:
|
if self in self._parentdevice._dict_events:
|
||||||
if func is None:
|
if func is None:
|
||||||
|
with self._parentdevice._filelock:
|
||||||
del self._parentdevice._dict_events[self]
|
del self._parentdevice._dict_events[self]
|
||||||
else:
|
else:
|
||||||
newlist = []
|
newlist = []
|
||||||
@@ -630,6 +641,7 @@ class IOBase(object):
|
|||||||
newlist.append(regfunc)
|
newlist.append(regfunc)
|
||||||
|
|
||||||
# Wenn Funktionen übrig bleiben, diese übernehmen
|
# Wenn Funktionen übrig bleiben, diese übernehmen
|
||||||
|
with self._parentdevice._filelock:
|
||||||
if len(newlist) > 0:
|
if len(newlist) > 0:
|
||||||
self._parentdevice._dict_events[self] = newlist
|
self._parentdevice._dict_events[self] = newlist
|
||||||
else:
|
else:
|
||||||
@@ -679,7 +691,7 @@ class IOBase(object):
|
|||||||
# Prüfen ob Device in autorefresh ist
|
# Prüfen ob Device in autorefresh ist
|
||||||
if not self._parentdevice._selfupdate:
|
if not self._parentdevice._selfupdate:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"autorefresh is not activated for device '{}|{}' - there "
|
"autorefresh is not activated for device '{0}|{1}' - there "
|
||||||
"will never be new data".format(
|
"will never be new data".format(
|
||||||
self._parentdevice._position, self._parentdevice._name
|
self._parentdevice._position, self._parentdevice._name
|
||||||
)
|
)
|
||||||
@@ -768,6 +780,8 @@ class IntIO(IOBase):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = ()
|
||||||
|
|
||||||
def __int__(self):
|
def __int__(self):
|
||||||
"""Gibt IO-Wert zurueck mit Beachtung byteorder/signed.
|
"""Gibt IO-Wert zurueck mit Beachtung byteorder/signed.
|
||||||
@return IO-Wert als <class 'int'>"""
|
@return IO-Wert als <class 'int'>"""
|
||||||
@@ -825,7 +839,7 @@ class IntIO(IOBase):
|
|||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"'{}' need a <class 'int'> value, but {} was given"
|
"'{0}' need a <class 'int'> value, but {1} was given"
|
||||||
"".format(self._name, type(value))
|
"".format(self._name, type(value))
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -845,6 +859,9 @@ class StructIO(IOBase):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = "__frm", "_parentio_address", "_parentio_defaultvalue", \
|
||||||
|
"_parentio_length"
|
||||||
|
|
||||||
def __init__(self, parentio, name, frm, **kwargs):
|
def __init__(self, parentio, name, frm, **kwargs):
|
||||||
"""Erstellt einen IO mit struct-Formatierung.
|
"""Erstellt einen IO mit struct-Formatierung.
|
||||||
|
|
||||||
@@ -873,7 +890,7 @@ class StructIO(IOBase):
|
|||||||
max_bits = parentio._length * 8
|
max_bits = parentio._length * 8
|
||||||
if not (0 <= bitaddress < max_bits):
|
if not (0 <= bitaddress < max_bits):
|
||||||
raise AttributeError(
|
raise AttributeError(
|
||||||
"bitaddress must be a value between 0 and {}"
|
"bitaddress must be a value between 0 and {0}"
|
||||||
"".format(max_bits - 1)
|
"".format(max_bits - 1)
|
||||||
)
|
)
|
||||||
bitlength = 1
|
bitlength = 1
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
|
||||||
# python3-RevPiModIO
|
|
||||||
#
|
|
||||||
# Webpage: https://revpimodio.org/
|
|
||||||
# (c) Sven Sager, License: LGPLv3
|
|
||||||
#
|
|
||||||
"""RevPiModIO Hauptklasse fuer piControl0 Zugriff."""
|
"""RevPiModIO Hauptklasse fuer piControl0 Zugriff."""
|
||||||
|
__author__ = "Sven Sager"
|
||||||
|
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||||
|
__license__ = "LGPLv3"
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
from json import load as jload
|
from json import load as jload
|
||||||
|
from multiprocessing import cpu_count
|
||||||
from os import access, F_OK, R_OK
|
from os import access, F_OK, R_OK
|
||||||
from queue import Empty
|
from queue import Empty
|
||||||
from signal import signal, SIG_DFL, SIGINT, SIGTERM
|
from signal import signal, SIG_DFL, SIGINT, SIGTERM
|
||||||
from threading import Thread, Event
|
from threading import Thread, Event
|
||||||
|
from timeit import default_timer
|
||||||
|
|
||||||
from . import app as appmodule
|
from . import app as appmodule
|
||||||
from . import device as devicemodule
|
from . import device as devicemodule
|
||||||
@@ -33,6 +33,13 @@ class RevPiModIO(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = "__cleanupfunc", "_autorefresh", "_buffedwrite", \
|
||||||
|
"_configrsc", "_exit", "_imgwriter", "_ioerror", "_length", \
|
||||||
|
"_looprunning", "_lst_devselect", "_lst_refresh", "_maxioerrors", \
|
||||||
|
"_myfh", "_monitoring", "_procimg", "_simulator", "_syncoutputs", \
|
||||||
|
"_th_mainloop", "_waitexit", \
|
||||||
|
"core", "app", "device", "exitsignal", "io", "summary"
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, autorefresh=False, monitoring=False, syncoutputs=True,
|
self, autorefresh=False, monitoring=False, syncoutputs=True,
|
||||||
procimg=None, configrsc=None, simulator=False):
|
procimg=None, configrsc=None, simulator=False):
|
||||||
@@ -79,6 +86,9 @@ class RevPiModIO(object):
|
|||||||
self.io = None
|
self.io = None
|
||||||
self.summary = None
|
self.summary = None
|
||||||
|
|
||||||
|
# Event für Benutzeraktionen
|
||||||
|
self.exitsignal = Event()
|
||||||
|
|
||||||
# Nur Konfigurieren, wenn nicht vererbt
|
# Nur Konfigurieren, wenn nicht vererbt
|
||||||
if type(self) == RevPiModIO:
|
if type(self) == RevPiModIO:
|
||||||
self._configure(self.get_jconfigrsc())
|
self._configure(self.get_jconfigrsc())
|
||||||
@@ -100,6 +110,7 @@ class RevPiModIO(object):
|
|||||||
if self.__cleanupfunc is not None:
|
if self.__cleanupfunc is not None:
|
||||||
self.readprocimg()
|
self.readprocimg()
|
||||||
self.__cleanupfunc()
|
self.__cleanupfunc()
|
||||||
|
if not self._monitoring:
|
||||||
self.writeprocimg()
|
self.writeprocimg()
|
||||||
|
|
||||||
def _configure(self, jconfigrsc):
|
def _configure(self, jconfigrsc):
|
||||||
@@ -150,7 +161,14 @@ class RevPiModIO(object):
|
|||||||
device["position"] += 1
|
device["position"] += 1
|
||||||
|
|
||||||
if device["type"] == "BASE":
|
if device["type"] == "BASE":
|
||||||
# Core
|
pt = int(device["productType"])
|
||||||
|
if pt == 105:
|
||||||
|
# RevPi Connect
|
||||||
|
dev_new = devicemodule.Connect(
|
||||||
|
self, device, simulator=self._simulator
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# RevPi Core immer als Fallback verwenden
|
||||||
dev_new = devicemodule.Core(
|
dev_new = devicemodule.Core(
|
||||||
self, device, simulator=self._simulator
|
self, device, simulator=self._simulator
|
||||||
)
|
)
|
||||||
@@ -170,10 +188,13 @@ class RevPiModIO(object):
|
|||||||
dev_new = devicemodule.Gateway(
|
dev_new = devicemodule.Gateway(
|
||||||
self, device, simulator=self._simulator
|
self, device, simulator=self._simulator
|
||||||
)
|
)
|
||||||
|
elif device["type"] == "RIGHT":
|
||||||
|
# Connectdevice
|
||||||
|
dev_new = None
|
||||||
else:
|
else:
|
||||||
# Device-Type nicht gefunden
|
# Device-Type nicht gefunden
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"device type '{}' unknown".format(device["type"]),
|
"device type '{0}' unknown".format(device["type"]),
|
||||||
Warning
|
Warning
|
||||||
)
|
)
|
||||||
dev_new = None
|
dev_new = None
|
||||||
@@ -205,10 +226,28 @@ class RevPiModIO(object):
|
|||||||
# ImgWriter erstellen
|
# ImgWriter erstellen
|
||||||
self._imgwriter = helpermodule.ProcimgWriter(self)
|
self._imgwriter = helpermodule.ProcimgWriter(self)
|
||||||
|
|
||||||
|
# Refreshzeit CM1 25 Hz / CM3 50 Hz
|
||||||
|
if not isinstance(self, RevPiNetIO):
|
||||||
|
self._imgwriter.refresh = 20 if cpu_count() > 1 else 40
|
||||||
|
|
||||||
# Aktuellen Outputstatus von procimg einlesen
|
# Aktuellen Outputstatus von procimg einlesen
|
||||||
if self._syncoutputs:
|
if self._syncoutputs:
|
||||||
self.syncoutputs()
|
self.syncoutputs()
|
||||||
|
|
||||||
|
# Für RS485 errors am core defaults laden sollte procimg NULL sein
|
||||||
|
if not (self.core is None or self._monitoring or self._simulator):
|
||||||
|
if self.core._ioerrorlimit1 is not None:
|
||||||
|
self.core._ioerrorlimit1.set_value(
|
||||||
|
self.core._ioerrorlimit1._defaultvalue
|
||||||
|
)
|
||||||
|
if self.core._ioerrorlimit2 is not None:
|
||||||
|
self.core._ioerrorlimit2.set_value(
|
||||||
|
self.core._ioerrorlimit2._defaultvalue
|
||||||
|
)
|
||||||
|
|
||||||
|
# RS485 errors schreiben
|
||||||
|
self.writeprocimg(self.core)
|
||||||
|
|
||||||
# Optional ins autorefresh aufnehmen
|
# Optional ins autorefresh aufnehmen
|
||||||
if self._autorefresh:
|
if self._autorefresh:
|
||||||
self.autorefresh_all()
|
self.autorefresh_all()
|
||||||
@@ -270,12 +309,12 @@ class RevPiModIO(object):
|
|||||||
self._ioerror += 1
|
self._ioerror += 1
|
||||||
if self._maxioerrors != 0 and self._ioerror >= self._maxioerrors:
|
if self._maxioerrors != 0 and self._ioerror >= self._maxioerrors:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"reach max io error count {} on process image".format(
|
"reach max io error count {0} on process image".format(
|
||||||
self._maxioerrors
|
self._maxioerrors
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"got io error during {} and count {} errors now".format(
|
"got io error during {0} and count {1} errors now".format(
|
||||||
action, self._ioerror
|
action, self._ioerror
|
||||||
),
|
),
|
||||||
RuntimeWarning
|
RuntimeWarning
|
||||||
@@ -286,7 +325,7 @@ class RevPiModIO(object):
|
|||||||
@param milliseconds <class 'int'> in Millisekunden"""
|
@param milliseconds <class 'int'> in Millisekunden"""
|
||||||
if self._looprunning:
|
if self._looprunning:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"can not change cycletime when cycleloop or mainloop are "
|
"can not change cycletime when cycleloop or mainloop is "
|
||||||
"running"
|
"running"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@@ -316,7 +355,7 @@ class RevPiModIO(object):
|
|||||||
self.io = None
|
self.io = None
|
||||||
self.summary = None
|
self.summary = None
|
||||||
|
|
||||||
def cycleloop(self, func, cycletime=None):
|
def cycleloop(self, func, cycletime=50):
|
||||||
"""Startet den Cycleloop.
|
"""Startet den Cycleloop.
|
||||||
|
|
||||||
Der aktuelle Programmthread wird hier bis Aufruf von
|
Der aktuelle Programmthread wird hier bis Aufruf von
|
||||||
@@ -328,19 +367,20 @@ class RevPiModIO(object):
|
|||||||
Prozessabbild geschrieben.
|
Prozessabbild geschrieben.
|
||||||
|
|
||||||
Verlassen wird der Cycleloop, wenn die aufgerufene Funktion einen
|
Verlassen wird der Cycleloop, wenn die aufgerufene Funktion einen
|
||||||
Rueckgabewert nicht gleich None liefert, oder durch Aufruf von
|
Rueckgabewert nicht gleich None liefert (z.B. return True), oder durch
|
||||||
revpimodio.exit().
|
Aufruf von .exit().
|
||||||
|
|
||||||
HINWEIS: Die Aktualisierungszeit und die Laufzeit der Funktion duerfen
|
HINWEIS: Die Aktualisierungszeit und die Laufzeit der Funktion duerfen
|
||||||
die eingestellte autorefresh Zeit, bzw. uebergebene cycletime nicht
|
die eingestellte autorefresh Zeit, bzw. uebergebene cycletime nicht
|
||||||
ueberschreiten!
|
ueberschreiten!
|
||||||
|
|
||||||
Ueber das Attribut cycletime kann die Aktualisierungsrate fuer das
|
Ueber den Parameter cycletime wird die gewuenschte Zukluszeit der
|
||||||
Prozessabbild gesetzt werden.
|
uebergebenen Funktion gesetzt. Der Standardwert betraegt
|
||||||
|
50 Millisekunden, in denen das Prozessabild eingelesen, die uebergebene
|
||||||
|
Funktion ausgefuert und das Prozessabbild geschrieben wird.
|
||||||
|
|
||||||
@param func Funktion, die ausgefuehrt werden soll
|
@param func Funktion, die ausgefuehrt werden soll
|
||||||
@param cycletime Zykluszeit in Millisekunden, bei Nichtangabe wird
|
@param cycletime Zykluszeit in Millisekunden - Standardwert 50 ms
|
||||||
aktuelle .cycletime Zeit verwendet - Standardwert 50 ms
|
|
||||||
@return None
|
@return None
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -352,21 +392,28 @@ class RevPiModIO(object):
|
|||||||
|
|
||||||
# Prüfen ob Devices in autorefresh sind
|
# Prüfen ob Devices in autorefresh sind
|
||||||
if len(self._lst_refresh) == 0:
|
if len(self._lst_refresh) == 0:
|
||||||
raise RuntimeError("no device with autorefresh activated")
|
raise RuntimeError(
|
||||||
|
"no device with autorefresh activated - use autorefresh=True "
|
||||||
|
"or call .autorefresh_all() before entering cycleloop"
|
||||||
|
)
|
||||||
|
|
||||||
# Prüfen ob Funktion callable ist
|
# Prüfen ob Funktion callable ist
|
||||||
if not callable(func):
|
if not callable(func):
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"registered function '{}' ist not callable".format(func)
|
"registered function '{0}' ist not callable".format(func)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Zykluszeit übernehmen
|
# Zykluszeit übernehmen
|
||||||
if not (cycletime is None or cycletime == self._imgwriter.refresh):
|
old_cycletime = self._imgwriter.refresh
|
||||||
|
if not cycletime == self._imgwriter.refresh:
|
||||||
self._imgwriter.refresh = cycletime
|
self._imgwriter.refresh = cycletime
|
||||||
|
|
||||||
# Zeitänderung in _imgwriter neuladen
|
# Zeitänderung in _imgwriter neuladen
|
||||||
self._imgwriter.newdata.clear()
|
self._imgwriter.newdata.clear()
|
||||||
|
|
||||||
|
# Benutzerevent
|
||||||
|
self.exitsignal.clear()
|
||||||
|
|
||||||
# Cycleloop starten
|
# Cycleloop starten
|
||||||
self._exit.clear()
|
self._exit.clear()
|
||||||
self._looprunning = True
|
self._looprunning = True
|
||||||
@@ -403,6 +450,9 @@ class RevPiModIO(object):
|
|||||||
# Cycleloop beenden
|
# Cycleloop beenden
|
||||||
self._looprunning = False
|
self._looprunning = False
|
||||||
|
|
||||||
|
# Alte autorefresh Zeit setzen
|
||||||
|
self._imgwriter.refresh = old_cycletime
|
||||||
|
|
||||||
return ec
|
return ec
|
||||||
|
|
||||||
def exit(self, full=True):
|
def exit(self, full=True):
|
||||||
@@ -416,6 +466,10 @@ class RevPiModIO(object):
|
|||||||
wird dann gestoppt und das Programm kann sauber beendet werden.
|
wird dann gestoppt und das Programm kann sauber beendet werden.
|
||||||
|
|
||||||
@param full Entfernt auch alle Devices aus autorefresh"""
|
@param full Entfernt auch alle Devices aus autorefresh"""
|
||||||
|
|
||||||
|
# Benutzerevent
|
||||||
|
self.exitsignal.set()
|
||||||
|
|
||||||
self._exit.set()
|
self._exit.set()
|
||||||
self._waitexit.set()
|
self._waitexit.set()
|
||||||
|
|
||||||
@@ -425,7 +479,7 @@ class RevPiModIO(object):
|
|||||||
self._imgwriter.stop()
|
self._imgwriter.stop()
|
||||||
self._imgwriter.join(self._imgwriter._refresh)
|
self._imgwriter.join(self._imgwriter._refresh)
|
||||||
|
|
||||||
# Mainloop beenden und darauf waretn
|
# Mainloop beenden und darauf 1 Sekunde warten
|
||||||
if self._th_mainloop is not None and self._th_mainloop.is_alive():
|
if self._th_mainloop is not None and self._th_mainloop.is_alive():
|
||||||
self._th_mainloop.join(1)
|
self._th_mainloop.join(1)
|
||||||
|
|
||||||
@@ -443,7 +497,7 @@ class RevPiModIO(object):
|
|||||||
if self._configrsc is not None:
|
if self._configrsc is not None:
|
||||||
if not access(self._configrsc, F_OK | R_OK):
|
if not access(self._configrsc, F_OK | R_OK):
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"can not access pictory configuration at {}".format(
|
"can not access pictory configuration at {0}".format(
|
||||||
self._configrsc))
|
self._configrsc))
|
||||||
else:
|
else:
|
||||||
# piCtory Konfiguration an bekannten Stellen prüfen
|
# piCtory Konfiguration an bekannten Stellen prüfen
|
||||||
@@ -454,7 +508,7 @@ class RevPiModIO(object):
|
|||||||
break
|
break
|
||||||
if self._configrsc is None:
|
if self._configrsc is None:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"can not access known pictory configurations at {} - "
|
"can not access known pictory configurations at {0} - "
|
||||||
"use 'configrsc' parameter so specify location"
|
"use 'configrsc' parameter so specify location"
|
||||||
"".format(", ".join(lst_rsc))
|
"".format(", ".join(lst_rsc))
|
||||||
)
|
)
|
||||||
@@ -462,7 +516,7 @@ class RevPiModIO(object):
|
|||||||
with open(self._configrsc, "r") as fhconfigrsc:
|
with open(self._configrsc, "r") as fhconfigrsc:
|
||||||
try:
|
try:
|
||||||
jdata = jload(fhconfigrsc)
|
jdata = jload(fhconfigrsc)
|
||||||
except:
|
except Exception:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"can not read piCtory configuration - check your hardware "
|
"can not read piCtory configuration - check your hardware "
|
||||||
"configuration http://revpi_ip/"
|
"configuration http://revpi_ip/"
|
||||||
@@ -494,7 +548,8 @@ class RevPiModIO(object):
|
|||||||
# Prüfen ob Funktion callable ist
|
# Prüfen ob Funktion callable ist
|
||||||
if not (cleanupfunc is None or callable(cleanupfunc)):
|
if not (cleanupfunc is None or callable(cleanupfunc)):
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"registered function '{}' ist not callable".format(cleanupfunc)
|
"registered function '{0}' ist not callable"
|
||||||
|
"".format(cleanupfunc)
|
||||||
)
|
)
|
||||||
self.__cleanupfunc = cleanupfunc
|
self.__cleanupfunc = cleanupfunc
|
||||||
signal(SIGINT, self.__evt_exit)
|
signal(SIGINT, self.__evt_exit)
|
||||||
@@ -527,7 +582,10 @@ class RevPiModIO(object):
|
|||||||
|
|
||||||
# Prüfen ob Devices in autorefresh sind
|
# Prüfen ob Devices in autorefresh sind
|
||||||
if len(self._lst_refresh) == 0:
|
if len(self._lst_refresh) == 0:
|
||||||
raise RuntimeError("no device with autorefresh activated")
|
raise RuntimeError(
|
||||||
|
"no device with autorefresh activated - use autorefresh=True "
|
||||||
|
"or call .autorefresh_all() before entering mainloop"
|
||||||
|
)
|
||||||
|
|
||||||
# Thread erstellen, wenn nicht blockieren soll
|
# Thread erstellen, wenn nicht blockieren soll
|
||||||
if not blocking:
|
if not blocking:
|
||||||
@@ -537,25 +595,48 @@ class RevPiModIO(object):
|
|||||||
self._th_mainloop.start()
|
self._th_mainloop.start()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Benutzerevent
|
||||||
|
self.exitsignal.clear()
|
||||||
|
|
||||||
# Event säubern vor Eintritt in Mainloop
|
# Event säubern vor Eintritt in Mainloop
|
||||||
self._exit.clear()
|
self._exit.clear()
|
||||||
self._looprunning = True
|
self._looprunning = True
|
||||||
|
|
||||||
# Beim Eintritt in mainloop Bytecopy erstellen
|
# Beim Eintritt in mainloop Bytecopy erstellen
|
||||||
for dev in self._lst_refresh:
|
for dev in self._lst_refresh:
|
||||||
dev._filelock.acquire()
|
with dev._filelock:
|
||||||
dev._ba_datacp = dev._ba_devdata[:]
|
dev._ba_datacp = dev._ba_devdata[:]
|
||||||
dev._filelock.release()
|
|
||||||
|
|
||||||
# ImgWriter mit Eventüberwachung aktivieren
|
# ImgWriter mit Eventüberwachung aktivieren
|
||||||
self._imgwriter._collect_events(True)
|
self._imgwriter._collect_events(True)
|
||||||
e = None
|
e = None
|
||||||
|
runtime = 0
|
||||||
|
|
||||||
while not self._exit.is_set():
|
while not self._exit.is_set():
|
||||||
|
|
||||||
|
# Laufzeit der Eventqueue auf 0 setzen
|
||||||
|
if self._imgwriter._eventq.qsize() == 0:
|
||||||
|
runtime = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tup_fire = self._imgwriter._eventq.get(timeout=1)
|
tup_fire = self._imgwriter._eventq.get(timeout=1)
|
||||||
|
|
||||||
|
# Messung Laufzeit der Queue starten
|
||||||
|
if runtime == 0:
|
||||||
|
runtime = default_timer()
|
||||||
|
|
||||||
# Direct callen da Prüfung in io.IOBase.reg_event ist
|
# Direct callen da Prüfung in io.IOBase.reg_event ist
|
||||||
tup_fire[0].func(tup_fire[1], tup_fire[2])
|
tup_fire[0].func(tup_fire[1], tup_fire[2])
|
||||||
|
|
||||||
|
# Laufzeitprüfung
|
||||||
|
if runtime != -1 and \
|
||||||
|
default_timer() - runtime > self._imgwriter._refresh:
|
||||||
|
runtime = -1
|
||||||
|
warnings.warn(
|
||||||
|
"can not execute all event functions in one cycle - "
|
||||||
|
"rise .cycletime or optimize your event functions",
|
||||||
|
RuntimeWarning
|
||||||
|
)
|
||||||
except Empty:
|
except Empty:
|
||||||
if not self._exit.is_set() and not self._imgwriter.is_alive():
|
if not self._exit.is_set() and not self._imgwriter.is_alive():
|
||||||
self.exit(full=False)
|
self.exit(full=False)
|
||||||
@@ -585,12 +666,12 @@ class RevPiModIO(object):
|
|||||||
if device is None:
|
if device is None:
|
||||||
mylist = self.device
|
mylist = self.device
|
||||||
else:
|
else:
|
||||||
dev = device if issubclass(type(device), devicemodule.Device) \
|
dev = device if isinstance(device, devicemodule.Device) \
|
||||||
else self.device.__getitem__(device)
|
else self.device.__getitem__(device)
|
||||||
|
|
||||||
if dev._selfupdate:
|
if dev._selfupdate:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"can not read process image, while device '{}|{}'"
|
"can not read process image, while device '{0}|{1}'"
|
||||||
"is in autorefresh mode".format(dev._position, dev._name)
|
"is in autorefresh mode".format(dev._position, dev._name)
|
||||||
)
|
)
|
||||||
mylist = [dev]
|
mylist = [dev]
|
||||||
@@ -640,7 +721,7 @@ class RevPiModIO(object):
|
|||||||
if device is None:
|
if device is None:
|
||||||
mylist = self.device
|
mylist = self.device
|
||||||
else:
|
else:
|
||||||
dev = device if issubclass(type(device), devicemodule.Device) \
|
dev = device if isinstance(device, devicemodule.Device) \
|
||||||
else self.device.__getitem__(device)
|
else self.device.__getitem__(device)
|
||||||
mylist = [dev]
|
mylist = [dev]
|
||||||
|
|
||||||
@@ -660,12 +741,12 @@ class RevPiModIO(object):
|
|||||||
if device is None:
|
if device is None:
|
||||||
mylist = self.device
|
mylist = self.device
|
||||||
else:
|
else:
|
||||||
dev = device if issubclass(type(device), devicemodule.Device) \
|
dev = device if isinstance(device, devicemodule.Device) \
|
||||||
else self.device.__getitem__(device)
|
else self.device.__getitem__(device)
|
||||||
|
|
||||||
if dev._selfupdate:
|
if dev._selfupdate:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"can not sync process image, while device '{}|{}'"
|
"can not sync outputs, while device '{0}|{1}'"
|
||||||
"is in autorefresh mode".format(dev._position, dev._name)
|
"is in autorefresh mode".format(dev._position, dev._name)
|
||||||
)
|
)
|
||||||
mylist = [dev]
|
mylist = [dev]
|
||||||
@@ -703,12 +784,12 @@ class RevPiModIO(object):
|
|||||||
if device is None:
|
if device is None:
|
||||||
mylist = self.device
|
mylist = self.device
|
||||||
else:
|
else:
|
||||||
dev = device if issubclass(type(device), devicemodule.Device) \
|
dev = device if isinstance(device, devicemodule.Device) \
|
||||||
else self.device.__getitem__(device)
|
else self.device.__getitem__(device)
|
||||||
|
|
||||||
if dev._selfupdate:
|
if dev._selfupdate:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"can not write process image, while device '{}|{}'"
|
"can not write process image, while device '{0}|{1}'"
|
||||||
"is in autorefresh mode".format(dev._position, dev._name)
|
"is in autorefresh mode".format(dev._position, dev._name)
|
||||||
)
|
)
|
||||||
mylist = [dev]
|
mylist = [dev]
|
||||||
@@ -759,6 +840,8 @@ class RevPiModIOSelected(RevPiModIO):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = ()
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, deviceselection, autorefresh=False, monitoring=False,
|
self, deviceselection, autorefresh=False, monitoring=False,
|
||||||
syncoutputs=True, procimg=None, configrsc=None, simulator=False):
|
syncoutputs=True, procimg=None, configrsc=None, simulator=False):
|
||||||
@@ -823,6 +906,8 @@ class RevPiModIODriver(RevPiModIOSelected):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = ()
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, virtdev, autorefresh=False, monitoring=False,
|
self, virtdev, autorefresh=False, monitoring=False,
|
||||||
syncoutputs=True, procimg=None, configrsc=None):
|
syncoutputs=True, procimg=None, configrsc=None):
|
||||||
@@ -842,4 +927,4 @@ class RevPiModIODriver(RevPiModIOSelected):
|
|||||||
|
|
||||||
|
|
||||||
# Nachträglicher Import
|
# Nachträglicher Import
|
||||||
from .netio import RevPiNetIODriver
|
from .netio import RevPiNetIODriver, RevPiNetIO
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
|
||||||
# python3-RevPiModIO
|
|
||||||
#
|
|
||||||
# Webpage: https://revpimodio.org/
|
|
||||||
# (c) Sven Sager, License: LGPLv3
|
|
||||||
#
|
|
||||||
"""RevPiModIO Hauptklasse fuer Netzwerkzugriff."""
|
"""RevPiModIO Hauptklasse fuer Netzwerkzugriff."""
|
||||||
|
__author__ = "Sven Sager"
|
||||||
|
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||||
|
__license__ = "LGPLv3"
|
||||||
|
|
||||||
import socket
|
import socket
|
||||||
import warnings
|
import warnings
|
||||||
from json import loads as jloads
|
from json import loads as jloads
|
||||||
@@ -37,10 +35,16 @@ class NetFH(Thread):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = "__by_buff", "__int_buff", "__dictdirty", "__flusherr", \
|
||||||
|
"__position", "__sockact", "__sockerr", "__sockend", "__socklock", \
|
||||||
|
"__timeout", "__trigger", "__waitsync", \
|
||||||
|
"_address", "_slavesock", \
|
||||||
|
"daemon"
|
||||||
|
|
||||||
def __init__(self, address, timeout=500):
|
def __init__(self, address, timeout=500):
|
||||||
"""Init NetFH-class.
|
"""Init NetFH-class.
|
||||||
@param address IP Adresse des RevPis
|
@param address IP Adresse des RevPi
|
||||||
@param timeout Verbindungstimeout in Millisekunden"""
|
@param timeout Timeout in Millisekunden der Verbindung"""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.daemon = True
|
self.daemon = True
|
||||||
|
|
||||||
@@ -94,7 +98,7 @@ class NetFH(Thread):
|
|||||||
so = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
so = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
try:
|
try:
|
||||||
so.connect(self._address)
|
so.connect(self._address)
|
||||||
except:
|
except Exception:
|
||||||
so.close()
|
so.close()
|
||||||
else:
|
else:
|
||||||
# Alten Socket trennen
|
# Alten Socket trennen
|
||||||
@@ -156,7 +160,7 @@ class NetFH(Thread):
|
|||||||
self._slavesock.send(_sysexit)
|
self._slavesock.send(_sysexit)
|
||||||
else:
|
else:
|
||||||
self._slavesock.shutdown(socket.SHUT_RDWR)
|
self._slavesock.shutdown(socket.SHUT_RDWR)
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
self._slavesock.close()
|
self._slavesock.close()
|
||||||
|
|
||||||
@@ -193,7 +197,7 @@ class NetFH(Thread):
|
|||||||
def get_name(self):
|
def get_name(self):
|
||||||
"""Verbindugnsnamen zurueckgeben.
|
"""Verbindugnsnamen zurueckgeben.
|
||||||
@return <class 'str'> IP:PORT"""
|
@return <class 'str'> IP:PORT"""
|
||||||
return "{}:{}".format(*self._address)
|
return "{0}:{1}".format(*self._address)
|
||||||
|
|
||||||
def get_timeout(self):
|
def get_timeout(self):
|
||||||
"""Gibt aktuellen Timeout zurueck.
|
"""Gibt aktuellen Timeout zurueck.
|
||||||
@@ -391,6 +395,8 @@ class RevPiNetIO(_RevPiModIO):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = "_address"
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, address, autorefresh=False, monitoring=False,
|
self, address, autorefresh=False, monitoring=False,
|
||||||
syncoutputs=True, simulator=False):
|
syncoutputs=True, simulator=False):
|
||||||
@@ -445,7 +451,7 @@ class RevPiNetIO(_RevPiModIO):
|
|||||||
autorefresh,
|
autorefresh,
|
||||||
monitoring,
|
monitoring,
|
||||||
syncoutputs,
|
syncoutputs,
|
||||||
"{}:{}".format(*self._address),
|
"{0}:{1}".format(*self._address),
|
||||||
None,
|
None,
|
||||||
simulator
|
simulator
|
||||||
)
|
)
|
||||||
@@ -488,7 +494,7 @@ class RevPiNetIO(_RevPiModIO):
|
|||||||
if device is None:
|
if device is None:
|
||||||
self._myfh.clear_dirtybytes()
|
self._myfh.clear_dirtybytes()
|
||||||
else:
|
else:
|
||||||
dev = device if issubclass(type(device), Device) \
|
dev = device if isinstance(device, Device) \
|
||||||
else self.device.__getitem__(device)
|
else self.device.__getitem__(device)
|
||||||
mylist = [dev]
|
mylist = [dev]
|
||||||
|
|
||||||
@@ -508,7 +514,7 @@ class RevPiNetIO(_RevPiModIO):
|
|||||||
if device is None:
|
if device is None:
|
||||||
mylist = self.device
|
mylist = self.device
|
||||||
else:
|
else:
|
||||||
dev = device if issubclass(type(device), Device) \
|
dev = device if isinstance(device, Device) \
|
||||||
else self.device.__getitem__(device)
|
else self.device.__getitem__(device)
|
||||||
mylist = [dev]
|
mylist = [dev]
|
||||||
|
|
||||||
@@ -554,6 +560,8 @@ class RevPiNetIOSelected(RevPiNetIO):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = ()
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, address, deviceselection, autorefresh=False,
|
self, address, deviceselection, autorefresh=False,
|
||||||
monitoring=False, syncoutputs=True, simulator=False):
|
monitoring=False, syncoutputs=True, simulator=False):
|
||||||
@@ -619,6 +627,8 @@ class RevPiNetIODriver(RevPiNetIOSelected):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = ()
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, address, virtdev, autorefresh=False, monitoring=False,
|
self, address, virtdev, autorefresh=False, monitoring=False,
|
||||||
syncoutputs=True):
|
syncoutputs=True):
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
|
||||||
# python3-RevPiModIO
|
|
||||||
#
|
|
||||||
# Webpage: https://revpimodio.org/
|
|
||||||
# (c) Sven Sager, License: LGPLv3
|
|
||||||
#
|
|
||||||
"""Bildet die Summary-Sektion von piCtory ab."""
|
"""Bildet die Summary-Sektion von piCtory ab."""
|
||||||
|
__author__ = "Sven Sager"
|
||||||
|
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||||
|
__license__ = "LGPLv3"
|
||||||
|
|
||||||
|
|
||||||
class Summary(object):
|
class Summary(object):
|
||||||
|
|
||||||
"""Bildet die Summary-Sektion der config.rsc ab."""
|
"""Bildet die Summary-Sektion der config.rsc ab."""
|
||||||
|
|
||||||
|
__slots__ = "inptotal", "outtotal"
|
||||||
|
|
||||||
def __init__(self, summary):
|
def __init__(self, summary):
|
||||||
"""Instantiiert die RevPiSummary-Klasse.
|
"""Instantiiert die RevPiSummary-Klasse.
|
||||||
@param summary piCtory Summaryinformationen"""
|
@param summary piCtory Summaryinformationen"""
|
||||||
|
|||||||
9
setup.py
9
setup.py
@@ -1,9 +1,10 @@
|
|||||||
#! /usr/bin/env python3
|
#! /usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
|
||||||
# (c) Sven Sager, License: LGPLv3
|
|
||||||
#
|
|
||||||
"""Setupscript fuer python3-revpimodio."""
|
"""Setupscript fuer python3-revpimodio."""
|
||||||
|
__author__ = "Sven Sager"
|
||||||
|
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||||
|
__license__ = "LGPLv3"
|
||||||
|
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
@@ -16,7 +17,7 @@ setup(
|
|||||||
|
|
||||||
license="LGPLv3",
|
license="LGPLv3",
|
||||||
name="revpimodio2",
|
name="revpimodio2",
|
||||||
version="2.1.6",
|
version="2.2.3",
|
||||||
|
|
||||||
packages=["revpimodio2"],
|
packages=["revpimodio2"],
|
||||||
python_requires="~=3.2",
|
python_requires="~=3.2",
|
||||||
|
|||||||
Reference in New Issue
Block a user