Erste Debug-Version

This commit is contained in:
2017-08-14 16:12:44 +02:00
parent fa920b61ed
commit d733038563
17 changed files with 3230 additions and 243 deletions

View File

@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html><head>
<title>revpimodio2</title>
<meta charset="UTF-8">
</head>
<body style="background-color:#FFFFFF;color:#000000">
<h1 style="background-color:#FFFFFF;color:#0000FF">
revpimodio2</h1>
<p>
Stellt alle Klassen fuer den RevolutionPi zur Verfuegung.
</p><p>
Stellt Klassen fuer die einfache Verwendung des Revolution Pis der
Kunbus GmbH (https://revolution.kunbus.de/) zur Verfuegung. Alle I/Os werden
aus der piCtory Konfiguration eingelesen und mit deren Namen direkt zugreifbar
gemacht. Fuer Gateways sind eigene IOs ueber mehrere Bytes konfigurierbar
Mit den definierten Namen greift man direkt auf die gewuenschten Daten zu.
Auf alle IOs kann der Benutzer Funktionen als Events registrieren. Diese
fuehrt das Modul bei Datenaenderung aus.
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Modules</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="revpimodio2.__init__.html">revpimodio2</a></td>
<td>Stellt alle Klassen fuer den RevolutionPi zur Verfuegung.</td>
</tr><tr>
<td><a style="color:#0000FF" href="revpimodio2.app.html">app</a></td>
<td>Bildet die App Sektion von piCtory ab.</td>
</tr><tr>
<td><a style="color:#0000FF" href="revpimodio2.device.html">device</a></td>
<td>Modul fuer die Verwaltung der Devices.</td>
</tr><tr>
<td><a style="color:#0000FF" href="revpimodio2.helper.html">helper</a></td>
<td>RevPiModIO Helperklassen und Tools.</td>
</tr><tr>
<td><a style="color:#0000FF" href="revpimodio2.io.html">io</a></td>
<td>RevPiModIO Modul fuer die Verwaltung der IOs.</td>
</tr><tr>
<td><a style="color:#0000FF" href="revpimodio2.modio.html">modio</a></td>
<td>RevPiModIO Hauptklasse.</td>
</tr><tr>
<td><a style="color:#0000FF" href="revpimodio2.summary.html">summary</a></td>
<td>Bildet die Summary-Sektion von piCtory ab.</td>
</tr>
</table>
</body></html>

20
doc/index.html Normal file
View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html><head>
<title>Table of contents</title>
<meta charset="UTF-8">
</head>
<body style="background-color:#FFFFFF;color:#000000">
<h1 style="background-color:#FFFFFF;color:#0000FF">
Table of contents</h1>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Packages</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="index-revpimodio2.html">revpimodio2</a></td>
<td>Stellt alle Klassen fuer den RevolutionPi zur Verfuegung.</td>
</tr>
</table>
</body></html>

View File

@@ -0,0 +1,70 @@
<!DOCTYPE html>
<html><head>
<title>revpimodio2.__init__</title>
<meta charset="UTF-8">
</head>
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
<h1 style="background-color:#FFFFFF;color:#0000FF">
revpimodio2.__init__</h1>
<p>
Stellt alle Klassen fuer den RevolutionPi zur Verfuegung.
</p><p>
Stellt Klassen fuer die einfache Verwendung des Revolution Pis der
Kunbus GmbH (https://revolution.kunbus.de/) zur Verfuegung. Alle I/Os werden
aus der piCtory Konfiguration eingelesen und mit deren Namen direkt zugreifbar
gemacht. Fuer Gateways sind eigene IOs ueber mehrere Bytes konfigurierbar
Mit den definierten Namen greift man direkt auf die gewuenschten Daten zu.
Auf alle IOs kann der Benutzer Funktionen als Events registrieren. Diese
fuehrt das Modul bei Datenaenderung aus.
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Global Attributes</h3>
<table>
<tr><td>BOTH</td></tr><tr><td>FALLING</td></tr><tr><td>GREEN</td></tr><tr><td>OFF</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>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Classes</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="#IOType">IOType</a></td>
<td>IO Typen.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Functions</h3>
<table>
<tr><td>None</td></tr>
</table>
<hr /><hr />
<a NAME="IOType" ID="IOType"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">IOType</h2>
<p>
IO Typen.
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
object
<h3 style="background-color:#FFFFFF;color:#FF0000">
Class Attributes</h3>
<table>
<tr><td>INP</td></tr><tr><td>MEM</td></tr><tr><td>OUT</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>
<hr />
</body></html>

76
doc/revpimodio2.app.html Normal file
View File

@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html><head>
<title>revpimodio2.app</title>
<meta charset="UTF-8">
</head>
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
<h1 style="background-color:#FFFFFF;color:#0000FF">
revpimodio2.app</h1>
<p>
Bildet die App Sektion von piCtory ab.
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Global Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Classes</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="#App">App</a></td>
<td>Bildet die App Sektion der config.rsc ab.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Functions</h3>
<table>
<tr><td>None</td></tr>
</table>
<hr /><hr />
<a NAME="App" ID="App"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">App</h2>
<p>
Bildet die App Sektion der config.rsc ab.
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
object
<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><a style="color:#0000FF" href="#App.__init__">App</a></td>
<td>Instantiiert die App-Klasse.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="App.__init__" ID="App.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
App (Constructor)</h3>
<b>App</b>(<i>app</i>)
<p>
Instantiiert die App-Klasse.
</p><dl>
<dt><i>app</i></dt>
<dd>
piCtory Appinformationen
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr />
</body></html>

822
doc/revpimodio2.device.html Normal file
View File

@@ -0,0 +1,822 @@
<!DOCTYPE html>
<html><head>
<title>revpimodio2.device</title>
<meta charset="UTF-8">
</head>
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
<h1 style="background-color:#FFFFFF;color:#0000FF">
revpimodio2.device</h1>
<p>
Modul fuer die Verwaltung der Devices.
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Global Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Classes</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="#Core">Core</a></td>
<td>Klasse fuer den RevPi Core.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Device">Device</a></td>
<td>Basisklasse fuer alle Device-Objekte der RevPiDevicelist()-Klasse.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#DeviceList">DeviceList</a></td>
<td>Basisklasse fuer direkten Zugriff auf Device Objekte.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Gateway">Gateway</a></td>
<td>Klasse fuer die RevPi Gateway-Devices.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Virtual">Virtual</a></td>
<td>Klasse fuer die RevPi Virtual-Devices.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Functions</h3>
<table>
<tr><td>None</td></tr>
</table>
<hr /><hr />
<a NAME="Core" ID="Core"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">Core</h2>
<p>
Klasse fuer den RevPi Core.
</p><p>
Stellt Funktionen fuer die LEDs und den Status zur Verfuegung.
</p><p>
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
Device
<h3 style="background-color:#FFFFFF;color:#FF0000">
Class Attributes</h3>
<table>
<tr><td>A1</td></tr><tr><td>A2</td></tr><tr><td>status</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="#Core._devconfigure">_devconfigure</a></td>
<td>Core-Klasse vorbereiten.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core._errorlimit">_errorlimit</a></td>
<td>Verwaltet das Lesen und Schreiben der ErrorLimits.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.errorlimit1">errorlimit1</a></td>
<td>Setzt RS485 ErrorLimit1 auf neuen Wert.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.errorlimit2">errorlimit2</a></td>
<td>Setzt RS485 ErrorLimit2 auf neuen Wert.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.frequency">frequency</a></td>
<td>Gibt CPU Taktfrequenz zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.get_leda1">get_leda1</a></td>
<td>Gibt den Zustand der LED A1 vom core zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.get_leda2">get_leda2</a></td>
<td>Gibt den Zustand der LED A2 vom core zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.get_status">get_status</a></td>
<td>Gibt den RevPi Core Status zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.iocycle">iocycle</a></td>
<td>Gibt Zykluszeit der Prozessabbildsynchronisierung zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.ioerrorcount">ioerrorcount</a></td>
<td>Gibt Fehleranzahl auf RS485 piBridge Bus zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.leftgate">leftgate</a></td>
<td>Statusbit links vom RevPi ist ein piGate Modul angeschlossen.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.missingdeviceorgate">missingdeviceorgate</a></td>
<td>Statusbit fuer ein IO-Modul fehlt oder piGate konfiguriert.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.overunderflow">overunderflow</a></td>
<td>Statusbit Modul belegt mehr oder weniger Speicher als konfiguriert.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.picontrolrunning">picontrolrunning</a></td>
<td>Statusbit fuer piControl-Treiber laeuft.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.rightgate">rightgate</a></td>
<td>Statusbit rechts vom RevPi ist ein piGate Modul angeschlossen.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.set_leda1">set_leda1</a></td>
<td>Setzt den Zustand der LED A1 vom core.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.set_leda2">set_leda2</a></td>
<td>Setzt den Zustand der LED A2 vom core.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.temperatur">temperatur</a></td>
<td>Gibt CPU-Temperatur zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Core.unconfdevice">unconfdevice</a></td>
<td>Statusbit fuer ein IO-Modul nicht mit PiCtory konfiguriert.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="Core._devconfigure" ID="Core._devconfigure"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core._devconfigure</h3>
<b>_devconfigure</b>(<i></i>)
<p>
Core-Klasse vorbereiten.
</p><a NAME="Core._errorlimit" ID="Core._errorlimit"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core._errorlimit</h3>
<b>_errorlimit</b>(<i>io_id, errorlimit</i>)
<p>
Verwaltet das Lesen und Schreiben der ErrorLimits.
</p><dl>
<dt><i>io_id</i></dt>
<dd>
Index des IOs fuer ErrorLimit
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
Aktuellen ErrorLimit oder None wenn nicht verfuegbar
</dd>
</dl><a NAME="Core.errorlimit1" ID="Core.errorlimit1"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.errorlimit1</h3>
<b>errorlimit1</b>(<i>value</i>)
<p>
Setzt RS485 ErrorLimit1 auf neuen Wert.
</p><dl>
<dt><i>value</i></dt>
<dd>
Neuer ErrorLimit1 Wert
</dd>
</dl><a NAME="Core.errorlimit2" ID="Core.errorlimit2"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.errorlimit2</h3>
<b>errorlimit2</b>(<i>value</i>)
<p>
Setzt RS485 ErrorLimit2 auf neuen Wert.
</p><dl>
<dt><i>value</i></dt>
<dd>
Neuer ErrorLimit2 Wert
</dd>
</dl><a NAME="Core.frequency" ID="Core.frequency"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.frequency</h3>
<b>frequency</b>(<i></i>)
<p>
Gibt CPU Taktfrequenz zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
CPU Taktfrequenz in MHz
</dd>
</dl><a NAME="Core.get_leda1" ID="Core.get_leda1"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.get_leda1</h3>
<b>get_leda1</b>(<i></i>)
<p>
Gibt den Zustand der LED A1 vom core zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
0=aus, 1=gruen, 2=rot
</dd>
</dl><a NAME="Core.get_leda2" ID="Core.get_leda2"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.get_leda2</h3>
<b>get_leda2</b>(<i></i>)
<p>
Gibt den Zustand der LED A2 vom core zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
0=aus, 1=gruen, 2=rot
</dd>
</dl><a NAME="Core.get_status" ID="Core.get_status"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.get_status</h3>
<b>get_status</b>(<i></i>)
<p>
Gibt den RevPi Core Status zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
Status als int()
</dd>
</dl><a NAME="Core.iocycle" ID="Core.iocycle"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.iocycle</h3>
<b>iocycle</b>(<i></i>)
<p>
Gibt Zykluszeit der Prozessabbildsynchronisierung zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
Zykluszeit in ms
</dd>
</dl><a NAME="Core.ioerrorcount" ID="Core.ioerrorcount"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.ioerrorcount</h3>
<b>ioerrorcount</b>(<i></i>)
<p>
Gibt Fehleranzahl auf RS485 piBridge Bus zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
Fehleranzahl der piBridge
</dd>
</dl><a NAME="Core.leftgate" ID="Core.leftgate"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.leftgate</h3>
<b>leftgate</b>(<i></i>)
<p>
Statusbit links vom RevPi ist ein piGate Modul angeschlossen.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn piGate links existiert
</dd>
</dl><a NAME="Core.missingdeviceorgate" ID="Core.missingdeviceorgate"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.missingdeviceorgate</h3>
<b>missingdeviceorgate</b>(<i></i>)
<p>
Statusbit fuer ein IO-Modul fehlt oder piGate konfiguriert.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn IO-Modul fehlt oder piGate konfiguriert
</dd>
</dl><a NAME="Core.overunderflow" ID="Core.overunderflow"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.overunderflow</h3>
<b>overunderflow</b>(<i></i>)
<p>
Statusbit Modul belegt mehr oder weniger Speicher als konfiguriert.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn falscher Speicher belegt ist
</dd>
</dl><a NAME="Core.picontrolrunning" ID="Core.picontrolrunning"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.picontrolrunning</h3>
<b>picontrolrunning</b>(<i></i>)
<p>
Statusbit fuer piControl-Treiber laeuft.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn Treiber laeuft
</dd>
</dl><a NAME="Core.rightgate" ID="Core.rightgate"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.rightgate</h3>
<b>rightgate</b>(<i></i>)
<p>
Statusbit rechts vom RevPi ist ein piGate Modul angeschlossen.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn piGate rechts existiert
</dd>
</dl><a NAME="Core.set_leda1" ID="Core.set_leda1"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.set_leda1</h3>
<b>set_leda1</b>(<i>value</i>)
<p>
Setzt den Zustand der LED A1 vom core.
</p><dl>
<dt><i>value</i></dt>
<dd>
0=aus, 1=gruen, 2=rot
</dd>
</dl><a NAME="Core.set_leda2" ID="Core.set_leda2"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.set_leda2</h3>
<b>set_leda2</b>(<i>value</i>)
<p>
Setzt den Zustand der LED A2 vom core.
</p><dl>
<dt><i>value</i></dt>
<dd>
0=aus, 1=gruen, 2=rot
</dd>
</dl><a NAME="Core.temperatur" ID="Core.temperatur"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.temperatur</h3>
<b>temperatur</b>(<i></i>)
<p>
Gibt CPU-Temperatur zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
CPU-Temperatur in Celsius
</dd>
</dl><a NAME="Core.unconfdevice" ID="Core.unconfdevice"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Core.unconfdevice</h3>
<b>unconfdevice</b>(<i></i>)
<p>
Statusbit fuer ein IO-Modul nicht mit PiCtory konfiguriert.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn IO Modul nicht konfiguriert
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="Device" ID="Device"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">Device</h2>
<p>
Basisklasse fuer alle Device-Objekte der RevPiDevicelist()-Klasse.
</p><p>
Die Basisfunktionalitaet generiert bei Instantiierung alle IOs und
erweitert den Prozessabbildpuffer um die benoetigten Bytes. Ueber diese
Klasse oder von dieser abgeleiteten Klassen, werden alle IOs angesprochen.
Sie verwaltet ihren Prozessabbildpuffer und sorgt fuer die Aktualisierung
der IO-Werte.
</p><p>
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
object
<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><a style="color:#0000FF" href="#Device.__init__">Device</a></td>
<td>Instantiierung der Device()-Klasse.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Device.__bytes__">__bytes__</a></td>
<td>Gibt alle Daten des Devices als bytes() zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Device.__contains__">__contains__</a></td>
<td>Prueft ob IO auf diesem Device liegt.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Device.__int__">__int__</a></td>
<td>Gibt die Positon im RevPi Bus zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Device.__iter__">__iter__</a></td>
<td>Gibt Iterator aller IOs zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Device.__len__">__len__</a></td>
<td>Gibt Anzahl der Bytes zurueck, die dieses Device belegt.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Device.__str__">__str__</a></td>
<td>Gibt den Namen des Devices zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Device._buildio">_buildio</a></td>
<td>Erstellt aus der piCtory-Liste die IOs fuer dieses Device.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Device._devconfigure">_devconfigure</a></td>
<td>Funktion zum ueberschreiben von abgeleiteten Klassen.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Device.auto_refresh">auto_refresh</a></td>
<td>Registriert ein Device fuer die automatische Synchronisierung.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Device.get_allios">get_allios</a></td>
<td>Gibt eine Liste aller Inputs und Outputs zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Device.get_inps">get_inps</a></td>
<td>Gibt eine Liste aller Inputs zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Device.get_mems">get_mems</a></td>
<td>Gibt eine Liste aller mems zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Device.get_outs">get_outs</a></td>
<td>Gibt eine Liste aller Outputs zurueck.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="Device.__init__" ID="Device.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Device (Constructor)</h3>
<b>Device</b>(<i>parentmodio, dict_device, **kwargs</i>)
<p>
Instantiierung der Device()-Klasse.
</p><dl>
<dt><i>parent</i></dt>
<dd>
RevpiModIO parent object
</dd><dt><i>dict_device</i></dt>
<dd>
dict() fuer dieses Device aus piCotry Konfiguration
</dd><dt><i>kwargs</i></dt>
<dd>
Weitere Parameter:
- autoupdate: Wenn True fuehrt dieses Device Arbeiten am
Prozessabbild bei Aufruf der RevPiDevicelist-Funktionen aus
- simulator: Laed das Modul als Simulator und vertauscht IOs
</dd>
</dl><a NAME="Device.__bytes__" ID="Device.__bytes__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Device.__bytes__</h3>
<b>__bytes__</b>(<i></i>)
<p>
Gibt alle Daten des Devices als bytes() zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
Devicedaten als bytes()
</dd>
</dl><a NAME="Device.__contains__" ID="Device.__contains__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Device.__contains__</h3>
<b>__contains__</b>(<i>key</i>)
<p>
Prueft ob IO auf diesem Device liegt.
</p><dl>
<dt><i>key</i></dt>
<dd>
IO-Name str() / IO-Bytenummer int()
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
True, wenn device vorhanden
</dd>
</dl><a NAME="Device.__int__" ID="Device.__int__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Device.__int__</h3>
<b>__int__</b>(<i></i>)
<p>
Gibt die Positon im RevPi Bus zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
Positionsnummer
</dd>
</dl><a NAME="Device.__iter__" ID="Device.__iter__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Device.__iter__</h3>
<b>__iter__</b>(<i></i>)
<p>
Gibt Iterator aller IOs zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
iter() aller IOs
</dd>
</dl><a NAME="Device.__len__" ID="Device.__len__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Device.__len__</h3>
<b>__len__</b>(<i></i>)
<p>
Gibt Anzahl der Bytes zurueck, die dieses Device belegt.
</p><dl>
<dt>Returns:</dt>
<dd>
int()
</dd>
</dl><a NAME="Device.__str__" ID="Device.__str__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Device.__str__</h3>
<b>__str__</b>(<i></i>)
<p>
Gibt den Namen des Devices zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
Devicename
</dd>
</dl><a NAME="Device._buildio" ID="Device._buildio"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Device._buildio</h3>
<b>_buildio</b>(<i>dict_io, iotype</i>)
<p>
Erstellt aus der piCtory-Liste die IOs fuer dieses Device.
</p><dl>
<dt><i>dict_io</i></dt>
<dd>
dict()-Objekt aus piCtory Konfiguration
</dd><dt><i>iotype</i></dt>
<dd>
IOType() Wert
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
slice()-Objekt mit Start und Stop Position dieser IOs
</dd>
</dl><a NAME="Device._devconfigure" ID="Device._devconfigure"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Device._devconfigure</h3>
<b>_devconfigure</b>(<i></i>)
<p>
Funktion zum ueberschreiben von abgeleiteten Klassen.
</p><a NAME="Device.auto_refresh" ID="Device.auto_refresh"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Device.auto_refresh</h3>
<b>auto_refresh</b>(<i>remove=False</i>)
<p>
Registriert ein Device fuer die automatische Synchronisierung.
</p><dl>
<dt><i>remove</i></dt>
<dd>
bool() True entfernt Device aus Synchronisierung
</dd>
</dl><a NAME="Device.get_allios" ID="Device.get_allios"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Device.get_allios</h3>
<b>get_allios</b>(<i></i>)
<p>
Gibt eine Liste aller Inputs und Outputs zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
list() Input und Output, keine MEMs
</dd>
</dl><a NAME="Device.get_inps" ID="Device.get_inps"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Device.get_inps</h3>
<b>get_inps</b>(<i></i>)
<p>
Gibt eine Liste aller Inputs zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
list() Inputs
</dd>
</dl><a NAME="Device.get_mems" ID="Device.get_mems"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Device.get_mems</h3>
<b>get_mems</b>(<i></i>)
<p>
Gibt eine Liste aller mems zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
list() Mems
</dd>
</dl><a NAME="Device.get_outs" ID="Device.get_outs"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Device.get_outs</h3>
<b>get_outs</b>(<i></i>)
<p>
Gibt eine Liste aller Outputs zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
list() Outputs
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="DeviceList" ID="DeviceList"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">DeviceList</h2>
<p>
Basisklasse fuer direkten Zugriff auf Device Objekte.
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
object
<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><a style="color:#0000FF" href="#DeviceList.__init__">DeviceList</a></td>
<td>Init DeviceList class.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#DeviceList.__contains__">__contains__</a></td>
<td>Prueft ob Device existiert.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#DeviceList.__getitem__">__getitem__</a></td>
<td>Gibt angegebenes Device zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#DeviceList.__iter__">__iter__</a></td>
<td>Gibt Iterator aller Devices zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#DeviceList.__len__">__len__</a></td>
<td>Gibt Anzahl der Devices zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#DeviceList.__setattr__">__setattr__</a></td>
<td>Setzt Attribute nur wenn Device.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="DeviceList.__init__" ID="DeviceList.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
DeviceList (Constructor)</h3>
<b>DeviceList</b>(<i></i>)
<p>
Init DeviceList class.
</p><a NAME="DeviceList.__contains__" ID="DeviceList.__contains__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
DeviceList.__contains__</h3>
<b>__contains__</b>(<i>key</i>)
<p>
Prueft ob Device existiert.
</p><dl>
<dt><i>key</i></dt>
<dd>
DeviceName str() / Positionsnummer int()
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
True, wenn Device vorhanden
</dd>
</dl><a NAME="DeviceList.__getitem__" ID="DeviceList.__getitem__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
DeviceList.__getitem__</h3>
<b>__getitem__</b>(<i>key</i>)
<p>
Gibt angegebenes Device zurueck.
</p><dl>
<dt><i>key</i></dt>
<dd>
DeviceName str() / Positionsnummer int()
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
Gefundenes Device()-Objekt
</dd>
</dl><a NAME="DeviceList.__iter__" ID="DeviceList.__iter__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
DeviceList.__iter__</h3>
<b>__iter__</b>(<i></i>)
<p>
Gibt Iterator aller Devices zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
iter() aller Devices
</dd>
</dl><a NAME="DeviceList.__len__" ID="DeviceList.__len__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
DeviceList.__len__</h3>
<b>__len__</b>(<i></i>)
<p>
Gibt Anzahl der Devices zurueck.
return Anzahl der Devices
</p><a NAME="DeviceList.__setattr__" ID="DeviceList.__setattr__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
DeviceList.__setattr__</h3>
<b>__setattr__</b>(<i>key, value</i>)
<p>
Setzt Attribute nur wenn Device.
</p><dl>
<dt><i>key</i></dt>
<dd>
Attributname
</dd><dt><i>value</i></dt>
<dd>
Attributobjekt
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="Gateway" ID="Gateway"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">Gateway</h2>
<p>
Klasse fuer die RevPi Gateway-Devices.
</p><p>
Stellt neben den Funktionen von RevPiDevice weitere Funktionen fuer die
Gateways bereit. Es koennen ueber die reg_*-Funktionen eigene IOs definiert
werden, die ein RevPiStructIO-Objekt abbilden.
Dieser IO-Typ kann Werte ueber mehrere Bytes verarbeiten und zurueckgeben.
</p><p>
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
Device
<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><a style="color:#0000FF" href="#Gateway.__init__">Gateway</a></td>
<td>Erweitert RevPiDevice um reg_*-Funktionen.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Gateway.get_rawbytes">get_rawbytes</a></td>
<td>Gibt die Bytes aus, die dieses Device verwendet.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="Gateway.__init__" ID="Gateway.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Gateway (Constructor)</h3>
<b>Gateway</b>(<i>parent, dict_device, **kwargs</i>)
<p>
Erweitert RevPiDevice um reg_*-Funktionen.
</p><dl>
<dt><b>See Also:</b></dt>
<dd>
<a style="color:#0000FF" href="#RevPiDevice.__init__">RevPiDevice.__init__(...)</a>
</dd>
</dl><a NAME="Gateway.get_rawbytes" ID="Gateway.get_rawbytes"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Gateway.get_rawbytes</h3>
<b>get_rawbytes</b>(<i></i>)
<p>
Gibt die Bytes aus, die dieses Device verwendet.
</p><dl>
<dt>Returns:</dt>
<dd>
bytes() des Devices
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="Virtual" ID="Virtual"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">Virtual</h2>
<p>
Klasse fuer die RevPi Virtual-Devices.
</p><p>
Stellt die selben Funktionen wie RevPiGateway zur Verfuegung. Es koennen
ueber die reg_*-Funktionen eigene IOs definiert werden, die ein
RevPiStructIO-Objekt abbilden.
Dieser IO-Typ kann Werte ueber mehrere Bytes verarbeiten und zurueckgeben.
</p><dl>
<dt><b>See Also:</b></dt>
<dd>
<a style="color:#0000FF" href="#RevPiGateway">RevPiGateway</a>
</dd>
</dl>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
Gateway
<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>
<hr />
</body></html>

410
doc/revpimodio2.helper.html Normal file
View File

@@ -0,0 +1,410 @@
<!DOCTYPE html>
<html><head>
<title>revpimodio2.helper</title>
<meta charset="UTF-8">
</head>
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
<h1 style="background-color:#FFFFFF;color:#0000FF">
revpimodio2.helper</h1>
<p>
RevPiModIO Helperklassen und Tools.
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Global Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Classes</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="#Cycletools">Cycletools</a></td>
<td>Werkzeugkasten fuer Cycleloop-Funktion.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#EventCallback">EventCallback</a></td>
<td>Thread fuer das interne Aufrufen von Event-Funktionen.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#ProcimgWriter">ProcimgWriter</a></td>
<td>Klasse fuer Synchroniseriungs-Thread.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Functions</h3>
<table>
<tr><td>None</td></tr>
</table>
<hr /><hr />
<a NAME="Cycletools" ID="Cycletools"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">Cycletools</h2>
<p>
Werkzeugkasten fuer Cycleloop-Funktion.
</p><p>
Diese Klasse enthaelt Werkzeuge fuer Zyklusfunktionen, wie Taktmerker
und Flankenmerker.
Zu beachten ist, dass die Flankenmerker beim ersten Zyklus alle den Wert
True haben! Ueber den Merker Cycletools.first kann ermittelt werden,
ob es sich um den ersten Zyklus handelt.
</p><p>
Taktmerker flag1c, flag5c, flag10c, usw. haben den als Zahl angegebenen
Wert an Zyklen jeweils False und True.
Beispiel: flag5c hat 5 Zyklen den Wert False und in den naechsten 5 Zyklen
den Wert True.
</p><p>
Flankenmerker flank5c, flank10c, usw. haben immer im, als Zahl angebenen
Zyklus fuer einen Zyklusdurchlauf den Wert True, sonst False.
Beispiel: flank5c hat immer alle 5 Zyklen den Wert True.
</p><p>
Diese Merker koennen z.B. verwendet werden um, an Outputs angeschlossene,
Lampen synchron blinken zu lassen.
</p><p>
</p>
<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><a style="color:#0000FF" href="#Cycletools.__init__">Cycletools</a></td>
<td>Init Cycletools class.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Cycletools._docycle">_docycle</a></td>
<td>Zyklusarbeiten.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Cycletools.get_tofc">get_tofc</a></td>
<td>Wert der Ausschaltverzoegerung.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Cycletools.get_tonc">get_tonc</a></td>
<td>Einschaltverzoegerung.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Cycletools.get_tpc">get_tpc</a></td>
<td>Impulstimer.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Cycletools.set_tofc">set_tofc</a></td>
<td>Startet bei Aufruf einen ausschaltverzoegerten Timer.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Cycletools.set_tonc">set_tonc</a></td>
<td>Startet einen einschaltverzoegerten Timer.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#Cycletools.set_tpc">set_tpc</a></td>
<td>Startet einen Impuls Timer.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="Cycletools.__init__" ID="Cycletools.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Cycletools (Constructor)</h3>
<b>Cycletools</b>(<i></i>)
<p>
Init Cycletools class.
</p><a NAME="Cycletools._docycle" ID="Cycletools._docycle"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Cycletools._docycle</h3>
<b>_docycle</b>(<i></i>)
<p>
Zyklusarbeiten.
</p><a NAME="Cycletools.get_tofc" ID="Cycletools.get_tofc"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Cycletools.get_tofc</h3>
<b>get_tofc</b>(<i>name</i>)
<p>
Wert der Ausschaltverzoegerung.
</p><dl>
<dt><i>name</i></dt>
<dd>
Eindeutiger Name des Timers
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
Wert der Ausschaltverzoegerung
</dd>
</dl><a NAME="Cycletools.get_tonc" ID="Cycletools.get_tonc"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Cycletools.get_tonc</h3>
<b>get_tonc</b>(<i>name</i>)
<p>
Einschaltverzoegerung.
</p><dl>
<dt><i>name</i></dt>
<dd>
Eindeutiger Name des Timers
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
Wert der Einschaltverzoegerung
</dd>
</dl><a NAME="Cycletools.get_tpc" ID="Cycletools.get_tpc"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Cycletools.get_tpc</h3>
<b>get_tpc</b>(<i>name</i>)
<p>
Impulstimer.
</p><dl>
<dt><i>name</i></dt>
<dd>
Eindeutiger Name des Timers
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
Wert der des Impulses
</dd>
</dl><a NAME="Cycletools.set_tofc" ID="Cycletools.set_tofc"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Cycletools.set_tofc</h3>
<b>set_tofc</b>(<i>name, cycles</i>)
<p>
Startet bei Aufruf einen ausschaltverzoegerten Timer.
</p><dl>
<dt><i>name</i></dt>
<dd>
Eindeutiger Name fuer Zugriff auf Timer
</dd><dt><i>cycles</i></dt>
<dd>
Zyklusanzahl, der Verzoegerung wenn nicht neu gestartet
</dd>
</dl><a NAME="Cycletools.set_tonc" ID="Cycletools.set_tonc"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Cycletools.set_tonc</h3>
<b>set_tonc</b>(<i>name, cycles</i>)
<p>
Startet einen einschaltverzoegerten Timer.
</p><dl>
<dt><i>name</i></dt>
<dd>
Eindeutiger Name fuer Zugriff auf Timer
</dd><dt><i>cycles</i></dt>
<dd>
Zyklusanzahl, der Verzoegerung wenn neu gestartet
</dd>
</dl><a NAME="Cycletools.set_tpc" ID="Cycletools.set_tpc"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Cycletools.set_tpc</h3>
<b>set_tpc</b>(<i>name, cycles</i>)
<p>
Startet einen Impuls Timer.
</p><dl>
<dt><i>name</i></dt>
<dd>
Eindeutiger Name fuer Zugriff auf Timer
</dd><dt><i>cycles</i></dt>
<dd>
Zyklusanzahl, die der Impuls anstehen soll
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="EventCallback" ID="EventCallback"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">EventCallback</h2>
<p>
Thread fuer das interne Aufrufen von Event-Funktionen.
</p><p>
Der Eventfunktion, welche dieser Thread aufruft, wird der Thread selber
als Parameter uebergeben. Darauf muss bei der definition der Funktion
geachtet werden z.B. "def event(th):". Bei umfangreichen Funktionen kann
dieser ausgewertet werden um z.B. doppeltes Starten zu verhindern.
Ueber EventCallback.ioname kann der Name des IO-Objekts abgerufen werden,
welches das Event ausgeloest hast. EventCallback.iovalue gibt den Wert des
IO-Objekts zum Ausloesezeitpunkt zurueck.
Der Thread stellt das EventCallback.exit Event als Abbruchbedingung fuer
die aufgerufene Funktion zur Verfuegung.
Durch Aufruf der Funktion EventCallback.stop() wird das exit-Event gesetzt
und kann bei Schleifen zum Abbrechen verwendet werden.
Mit dem .exit() Event auch eine Wartefunktion realisiert
werden: "th.exit.wait(0.5)" - Wartet 500ms oder bricht sofort ab, wenn
fuer den Thread .stop() aufgerufen wird.
</p><p>
while not th.exit.is_set():
# IO-Arbeiten
th.exit.wait(0.5)
</p><p>
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
Thread
<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><a style="color:#0000FF" href="#EventCallback.__init__">EventCallback</a></td>
<td>Init EventCallback class.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#EventCallback.run">run</a></td>
<td>Ruft die registrierte Funktion auf.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#EventCallback.stop">stop</a></td>
<td>Setzt das exit-Event mit dem die Funktion beendet werden kann.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="EventCallback.__init__" ID="EventCallback.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
EventCallback (Constructor)</h3>
<b>EventCallback</b>(<i>func, name, value</i>)
<p>
Init EventCallback class.
</p><dl>
<dt><i>func</i></dt>
<dd>
Funktion die beim Start aufgerufen werden soll
</dd><dt><i>name</i></dt>
<dd>
IO-Name
</dd><dt><i>value</i></dt>
<dd>
IO-Value zum Zeitpunkt des Events
</dd>
</dl><a NAME="EventCallback.run" ID="EventCallback.run"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
EventCallback.run</h3>
<b>run</b>(<i></i>)
<p>
Ruft die registrierte Funktion auf.
</p><a NAME="EventCallback.stop" ID="EventCallback.stop"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
EventCallback.stop</h3>
<b>stop</b>(<i></i>)
<p>
Setzt das exit-Event mit dem die Funktion beendet werden kann.
</p>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="ProcimgWriter" ID="ProcimgWriter"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">ProcimgWriter</h2>
<p>
Klasse fuer Synchroniseriungs-Thread.
</p><p>
Diese Klasse wird als Thread gestartet, wenn das Prozessabbild zyklisch
synchronisiert werden soll. Diese Funktion wird hauptsaechlich fuer das
Event-Handling verwendet.
</p><p>
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
Thread
<h3 style="background-color:#FFFFFF;color:#FF0000">
Class Attributes</h3>
<table>
<tr><td>refresh</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="#ProcimgWriter.__init__">ProcimgWriter</a></td>
<td>Init ProcimgWriter class.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#ProcimgWriter._gotioerror">_gotioerror</a></td>
<td>IOError Verwaltung fuer auto_refresh.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#ProcimgWriter.get_refresh">get_refresh</a></td>
<td>Gibt Zykluszeit zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#ProcimgWriter.run">run</a></td>
<td>Startet die automatische Prozessabbildsynchronisierung.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#ProcimgWriter.set_refresh">set_refresh</a></td>
<td>Setzt die Zykluszeit in Millisekunden.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#ProcimgWriter.stop">stop</a></td>
<td>Beendet die automatische Prozessabbildsynchronisierung.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="ProcimgWriter.__init__" ID="ProcimgWriter.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
ProcimgWriter (Constructor)</h3>
<b>ProcimgWriter</b>(<i>parentmodio</i>)
<p>
Init ProcimgWriter class.
</p><dl>
<dt><i>parentmodio</i></dt>
<dd>
Parent Object
</dd>
</dl><a NAME="ProcimgWriter._gotioerror" ID="ProcimgWriter._gotioerror"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
ProcimgWriter._gotioerror</h3>
<b>_gotioerror</b>(<i></i>)
<p>
IOError Verwaltung fuer auto_refresh.
</p><a NAME="ProcimgWriter.get_refresh" ID="ProcimgWriter.get_refresh"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
ProcimgWriter.get_refresh</h3>
<b>get_refresh</b>(<i></i>)
<p>
Gibt Zykluszeit zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
int() Zykluszeit in Millisekunden
</dd>
</dl><a NAME="ProcimgWriter.run" ID="ProcimgWriter.run"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
ProcimgWriter.run</h3>
<b>run</b>(<i></i>)
<p>
Startet die automatische Prozessabbildsynchronisierung.
</p><a NAME="ProcimgWriter.set_refresh" ID="ProcimgWriter.set_refresh"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
ProcimgWriter.set_refresh</h3>
<b>set_refresh</b>(<i>value</i>)
<p>
Setzt die Zykluszeit in Millisekunden.
</p><dl>
<dt><i>value</i></dt>
<dd>
int() Millisekunden
</dd>
</dl><a NAME="ProcimgWriter.stop" ID="ProcimgWriter.stop"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
ProcimgWriter.stop</h3>
<b>stop</b>(<i></i>)
<p>
Beendet die automatische Prozessabbildsynchronisierung.
</p>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr />
</body></html>

777
doc/revpimodio2.io.html Normal file
View File

@@ -0,0 +1,777 @@
<!DOCTYPE html>
<html><head>
<title>revpimodio2.io</title>
<meta charset="UTF-8">
</head>
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
<h1 style="background-color:#FFFFFF;color:#0000FF">
revpimodio2.io</h1>
<p>
RevPiModIO Modul fuer die Verwaltung der IOs.
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Global Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Classes</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="#IOBase">IOBase</a></td>
<td>Basisklasse fuer alle IO-Objekte.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOList">IOList</a></td>
<td>Basisklasse fuer direkten Zugriff auf IO Objekte.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IntIO">IntIO</a></td>
<td>Klasse fuer den Zugriff auf die Daten mit Konvertierung in int().</td>
</tr><tr>
<td><a style="color:#0000FF" href="#StructIO">StructIO</a></td>
<td>Klasse fuer den Zugriff auf Daten ueber ein definierten struct().</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Functions</h3>
<table>
<tr><td>None</td></tr>
</table>
<hr /><hr />
<a NAME="IOBase" ID="IOBase"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">IOBase</h2>
<p>
Basisklasse fuer alle IO-Objekte.
</p><p>
Die Basisfunktionalitaet ermoeglicht das Lesen und Schreiben der Werte
als bytes() oder bool(). Dies entscheidet sich bei der Instantiierung.
Wenn eine Bittadresse angegeben wird, werden bool()-Werte erwartet
und zurueckgegeben, ansonsten bytes().
</p><p>
Diese Klasse dient als Basis fuer andere IO-Klassen mit denen die Werte
auch als int() verwendet werden koennen.
</p><p>
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
object
<h3 style="background-color:#FFFFFF;color:#FF0000">
Class Attributes</h3>
<table>
<tr><td>address</td></tr><tr><td>length</td></tr><tr><td>name</td></tr><tr><td>value</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="#IOBase.__init__">IOBase</a></td>
<td>Instantiierung der IOBase()-Klasse.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOBase.__bool__">__bool__</a></td>
<td>bool()-wert der Klasse.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOBase.__bytes__">__bytes__</a></td>
<td>bytes()-wert der Klasse.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOBase.__str__">__str__</a></td>
<td>str()-wert der Klasse.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOBase._get_byteorder">_get_byteorder</a></td>
<td>Gibt konfigurierte Byteorder zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOBase.get_address">get_address</a></td>
<td>Gibt die absolute Byteadresse im Prozessabbild zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOBase.get_length">get_length</a></td>
<td>Gibt die Bytelaenge des IO zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOBase.get_name">get_name</a></td>
<td>Gibt den Namen des IOs zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOBase.get_value">get_value</a></td>
<td>Gibt den Wert des IOs als bytes() oder bool() zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOBase.reg_event">reg_event</a></td>
<td>Registriert ein Event bei der Eventueberwachung.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOBase.replace_io">replace_io</a></td>
<td>Ersetzt bestehenden IO mit Neuem.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOBase.set_value">set_value</a></td>
<td>Setzt den Wert des IOs mit bytes() oder bool().</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOBase.unreg_event">unreg_event</a></td>
<td>Entfernt ein Event aus der Eventueberwachung.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOBase.wait">wait</a></td>
<td>Wartet auf Wertaenderung eines IOs.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="IOBase.__init__" ID="IOBase.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOBase (Constructor)</h3>
<b>IOBase</b>(<i>parentdevice, valuelist, iotype, byteorder</i>)
<p>
Instantiierung der IOBase()-Klasse.
</p><dl>
<dt><i>parentdevice</i></dt>
<dd>
Parentdevice auf dem der IO liegt
</dd><dt><i>valuelist</i></dt>
<dd>
Datenliste fuer Instantiierung
</dd><dt><i>iotype</i></dt>
<dd>
IOType() Wert
</dd><dt><i>byteorder</i></dt>
<dd>
Byteorder 'little' / 'big' fuer int() Berechnung
</dd>
</dl><a NAME="IOBase.__bool__" ID="IOBase.__bool__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOBase.__bool__</h3>
<b>__bool__</b>(<i></i>)
<p>
bool()-wert der Klasse.
</p><dl>
<dt>Returns:</dt>
<dd>
IO-Wert als bool(). Nur False wenn False oder 0 sonst True
</dd>
</dl><a NAME="IOBase.__bytes__" ID="IOBase.__bytes__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOBase.__bytes__</h3>
<b>__bytes__</b>(<i></i>)
<p>
bytes()-wert der Klasse.
</p><dl>
<dt>Returns:</dt>
<dd>
IO-Wert als bytes()
</dd>
</dl><a NAME="IOBase.__str__" ID="IOBase.__str__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOBase.__str__</h3>
<b>__str__</b>(<i></i>)
<p>
str()-wert der Klasse.
</p><dl>
<dt>Returns:</dt>
<dd>
Namen des IOs
</dd>
</dl><a NAME="IOBase._get_byteorder" ID="IOBase._get_byteorder"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOBase._get_byteorder</h3>
<b>_get_byteorder</b>(<i></i>)
<p>
Gibt konfigurierte Byteorder zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
str() Byteorder
</dd>
</dl><a NAME="IOBase.get_address" ID="IOBase.get_address"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOBase.get_address</h3>
<b>get_address</b>(<i></i>)
<p>
Gibt die absolute Byteadresse im Prozessabbild zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
Absolute Byteadresse
</dd>
</dl><a NAME="IOBase.get_length" ID="IOBase.get_length"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOBase.get_length</h3>
<b>get_length</b>(<i></i>)
<p>
Gibt die Bytelaenge des IO zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
Bytelaenge des IO
</dd>
</dl><a NAME="IOBase.get_name" ID="IOBase.get_name"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOBase.get_name</h3>
<b>get_name</b>(<i></i>)
<p>
Gibt den Namen des IOs zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
IO Name
</dd>
</dl><a NAME="IOBase.get_value" ID="IOBase.get_value"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOBase.get_value</h3>
<b>get_value</b>(<i></i>)
<p>
Gibt den Wert des IOs als bytes() oder bool() zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
IO-Wert
</dd>
</dl><a NAME="IOBase.reg_event" ID="IOBase.reg_event"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOBase.reg_event</h3>
<b>reg_event</b>(<i>func, edge=BOTH, as_thread=False</i>)
<p>
Registriert ein Event bei der Eventueberwachung.
</p><dl>
<dt><i>func</i></dt>
<dd>
Funktion die bei Aenderung aufgerufen werden soll
</dd><dt><i>edge</i></dt>
<dd>
Ausfuehren bei RISING, FALLING or BOTH Wertaenderung
</dd><dt><i>as_thread</i></dt>
<dd>
Bei True, Funktion als EventCallback-Thread ausfuehren
</dd>
</dl><a NAME="IOBase.replace_io" ID="IOBase.replace_io"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOBase.replace_io</h3>
<b>replace_io</b>(<i>name, frm, **kwargs</i>)
<p>
Ersetzt bestehenden IO mit Neuem.
</p><dl>
<dt><i>name</i></dt>
<dd>
Name des neuen Inputs
</dd><dt><i>frm</i></dt>
<dd>
struct() formatierung (1 Zeichen)
</dd><dt><i>kwargs</i></dt>
<dd>
Weitere Parameter:
- bmk: Bezeichnung fuer Input
- bit: Registriert Input als bool() am angegebenen Bit im Byte
- byteorder: Byteorder fuer den Input, Standardwert=little
- defaultvalue: Standardwert fuer Input, Standard ist 0
- event: Funktion fuer Eventhandling registrieren
- as_thread: Fuehrt die event-Funktion als RevPiCallback-Thread aus
- edge: event-Ausfuehren bei RISING, FALLING or BOTH Wertaenderung
</dd>
</dl><dl>
<dt><b>See Also:</b></dt>
<dd>
<a style="color:#0000FF" target="_blank" href="https://docs.python.org/3/library/struct.html#format-characters" >Python3 struct()</a>
</dd>
</dl><a NAME="IOBase.set_value" ID="IOBase.set_value"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOBase.set_value</h3>
<b>set_value</b>(<i>value</i>)
<p>
Setzt den Wert des IOs mit bytes() oder bool().
</p><dl>
<dt><i>value</i></dt>
<dd>
IO-Wert als bytes() oder bool()
</dd>
</dl><a NAME="IOBase.unreg_event" ID="IOBase.unreg_event"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOBase.unreg_event</h3>
<b>unreg_event</b>(<i>func=None, edge=None</i>)
<p>
Entfernt ein Event aus der Eventueberwachung.
</p><dl>
<dt><i>func</i></dt>
<dd>
Nur Events mit angegebener Funktion
</dd><dt><i>edge</i></dt>
<dd>
Nur Events mit angegebener Funktion und angegebener Edge
</dd>
</dl><a NAME="IOBase.wait" ID="IOBase.wait"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOBase.wait</h3>
<b>wait</b>(<i>edge=BOTH, exitevent=None, okvalue=None, timeout=0</i>)
<p>
Wartet auf Wertaenderung eines IOs.
</p><p>
Die Wertaenderung wird immer uerberprueft, wenn fuer Devices
in Devicelist.auto_refresh() neue Daten gelesen wurden.
</p><p>
Bei Wertaenderung, wird das Warten mit 0 als Rueckgabewert beendet.
</p><p>
HINWEIS: Wenn ProcimgWriter() keine neuen Daten liefert, wird
bis in die Ewigkeit gewartet (nicht bei Angabe von "timeout").
</p><p>
Wenn edge mit RISING oder FALLING angegeben wird muss diese Flanke
ausgeloest werden. Sollte der Wert 1 sein beim Eintritt mit Flanke
RISING, wird das Warten erst bei Aenderung von 0 auf 1 beendet.
</p><p>
Als exitevent kann ein threading.Event()-Objekt uebergeben werden,
welches das Warten bei is_set() sofort mit 1 als Rueckgabewert
beendet.
</p><p>
Wenn der Wert okvalue an dem IO fuer das Warten anliegt, wird
das Warten sofort mit -1 als Rueckgabewert beendet.
</p><p>
Der Timeoutwert bricht beim Erreichen das Warten sofort mit
Wert 2 Rueckgabewert ab. (Das Timeout wird ueber die Zykluszeit
der auto_refresh Funktion berechnet, entspricht also nicht exact den
angegeben Millisekunden! Es wird immer nach oben gerundet!)
</p><dl>
<dt><i>edge</i></dt>
<dd>
Flanke RISING, FALLING, BOTH bei der mit True beendet wird
</dd><dt><i>exitevent</i></dt>
<dd>
thrading.Event() fuer vorzeitiges Beenden mit False
</dd><dt><i>okvalue</i></dt>
<dd>
IO-Wert, bei dem das Warten sofort mit True beendet wird
</dd><dt><i>timeout</i></dt>
<dd>
Zeit in ms nach der mit False abgebrochen wird
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
int() erfolgreich Werte <= 0
- Erfolgreich gewartet
Wert 0: IO hat den Wert gewechselt
Wert -1: okvalue stimmte mit IO ueberein
- Fehlerhaft gewartet
Wert 1: exitevent wurde gesetzt
Wert 2: timeout abgelaufen
Wert 100: Devicelist.exit() wurde aufgerufen
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="IOList" ID="IOList"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">IOList</h2>
<p>
Basisklasse fuer direkten Zugriff auf IO Objekte.
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
object
<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><a style="color:#0000FF" href="#IOList.__init__">IOList</a></td>
<td>Init IOList class.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOList.__contains__">__contains__</a></td>
<td>Prueft ob IO existiert.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOList.__delattr__">__delattr__</a></td>
<td>Entfernt angegebenen IO.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOList.__getattr__">__getattr__</a></td>
<td>Verwaltet geloeschte IOs.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOList.__getitem__">__getitem__</a></td>
<td>Ruft angegebenen IO ab.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOList.__iter__">__iter__</a></td>
<td>Gibt Iterator aller IOs zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOList.__replace_oldio_with_newio">__replace_oldio_with_newio</a></td>
<td>Ersetzt bestehende IOs durch den neu Registrierten.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOList.__setattr__">__setattr__</a></td>
<td>Setzt IO Wert.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOList.__setitem__">__setitem__</a></td>
<td>Setzt IO Wert.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOList._register_new_io_object">_register_new_io_object</a></td>
<td>Registriert neues IO Objekt unabhaenging von __setattr__.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IOList._testme">_testme</a></td>
<td></td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="IOList.__init__" ID="IOList.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOList (Constructor)</h3>
<b>IOList</b>(<i></i>)
<p>
Init IOList class.
</p><a NAME="IOList.__contains__" ID="IOList.__contains__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOList.__contains__</h3>
<b>__contains__</b>(<i>key</i>)
<p>
Prueft ob IO existiert.
</p><dl>
<dt><i>key</i></dt>
<dd>
IO-Name str() oder Byte int()
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
True, wenn IO vorhanden / Byte belegt
</dd>
</dl><a NAME="IOList.__delattr__" ID="IOList.__delattr__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOList.__delattr__</h3>
<b>__delattr__</b>(<i>key</i>)
<p>
Entfernt angegebenen IO.
</p><dl>
<dt><i>key</i></dt>
<dd>
IO zum entfernen
</dd>
</dl><a NAME="IOList.__getattr__" ID="IOList.__getattr__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOList.__getattr__</h3>
<b>__getattr__</b>(<i>key</i>)
<p>
Verwaltet geloeschte IOs.
</p><dl>
<dt><i>key</i></dt>
<dd>
Wert eines alten IOs
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
Alten IO, wenn in Ref-Listen
</dd>
</dl><a NAME="IOList.__getitem__" ID="IOList.__getitem__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOList.__getitem__</h3>
<b>__getitem__</b>(<i>key</i>)
<p>
Ruft angegebenen IO ab.
</p><dl>
<dt><i>key</i></dt>
<dd>
IO Name oder Byte
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
IO Object
</dd>
</dl><a NAME="IOList.__iter__" ID="IOList.__iter__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOList.__iter__</h3>
<b>__iter__</b>(<i></i>)
<p>
Gibt Iterator aller IOs zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
Iterator aller IOs
</dd>
</dl><a NAME="IOList.__replace_oldio_with_newio" ID="IOList.__replace_oldio_with_newio"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOList.__replace_oldio_with_newio</h3>
<b>__replace_oldio_with_newio</b>(<i>io</i>)
<p>
Ersetzt bestehende IOs durch den neu Registrierten.
</p><dl>
<dt><i>io</i></dt>
<dd>
Neuer IO der eingefuegt werden soll
</dd>
</dl><a NAME="IOList.__setattr__" ID="IOList.__setattr__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOList.__setattr__</h3>
<b>__setattr__</b>(<i>key, value</i>)
<p>
Setzt IO Wert.
</p><dl>
<dt><i>key</i></dt>
<dd>
IO Name oder Byte
</dd><dt><i>value</i></dt>
<dd>
Wert, auf den der IO gesetzt wird
</dd>
</dl><a NAME="IOList.__setitem__" ID="IOList.__setitem__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOList.__setitem__</h3>
<b>__setitem__</b>(<i>key, value</i>)
<p>
Setzt IO Wert.
</p><dl>
<dt><i>key</i></dt>
<dd>
IO Name oder Byte
</dd><dt><i>value</i></dt>
<dd>
Wert, auf den der IO gesetzt wird
</dd>
</dl><a NAME="IOList._register_new_io_object" ID="IOList._register_new_io_object"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOList._register_new_io_object</h3>
<b>_register_new_io_object</b>(<i>new_io</i>)
<p>
Registriert neues IO Objekt unabhaenging von __setattr__.
</p><dl>
<dt><i>new_io</i></dt>
<dd>
Neues IO Objekt
</dd>
</dl><a NAME="IOList._testme" ID="IOList._testme"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IOList._testme</h3>
<b>_testme</b>(<i></i>)
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="IntIO" ID="IntIO"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">IntIO</h2>
<p>
Klasse fuer den Zugriff auf die Daten mit Konvertierung in int().
</p><p>
Diese Klasse erweitert die Funktion von IOBase() um Funktionen,
ueber die mit int() Werten gearbeitet werden kann. Fuer die Umwandlung
koennen 'Byteorder' (Default 'little') und 'signed' (Default False) als
Parameter gesetzt werden.
</p><dl>
<dt><b>See Also:</b></dt>
<dd>
<a style="color:#0000FF" href="#IOBase">IOBase</a>
</dd>
</dl>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
IOBase
<h3 style="background-color:#FFFFFF;color:#FF0000">
Class Attributes</h3>
<table>
<tr><td>byteorder</td></tr><tr><td>signed</td></tr><tr><td>value</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="#IntIO.__int__">__int__</a></td>
<td>Gibt IO als int() Wert zurueck mit Beachtung byteorder/signed.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IntIO._get_signed">_get_signed</a></td>
<td>Ruft ab, ob der Wert Vorzeichenbehaftet behandelt werden soll.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IntIO._set_byteorder">_set_byteorder</a></td>
<td>Setzt Byteorder fuer int() Umwandlung.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IntIO._set_signed">_set_signed</a></td>
<td>Left fest, ob der Wert Vorzeichenbehaftet behandelt werden soll.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IntIO.get_int">get_int</a></td>
<td>Gibt IO als int() Wert zurueck mit Beachtung byteorder/signed.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#IntIO.set_int">set_int</a></td>
<td>Setzt IO mit Beachtung byteorder/signed.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="IntIO.__int__" ID="IntIO.__int__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IntIO.__int__</h3>
<b>__int__</b>(<i></i>)
<p>
Gibt IO als int() Wert zurueck mit Beachtung byteorder/signed.
</p><dl>
<dt>Returns:</dt>
<dd>
int() ohne Vorzeichen
</dd>
</dl><a NAME="IntIO._get_signed" ID="IntIO._get_signed"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IntIO._get_signed</h3>
<b>_get_signed</b>(<i></i>)
<p>
Ruft ab, ob der Wert Vorzeichenbehaftet behandelt werden soll.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn Vorzeichenbehaftet
</dd>
</dl><a NAME="IntIO._set_byteorder" ID="IntIO._set_byteorder"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IntIO._set_byteorder</h3>
<b>_set_byteorder</b>(<i>value</i>)
<p>
Setzt Byteorder fuer int() Umwandlung.
</p><dl>
<dt><i>value</i></dt>
<dd>
str() 'little' or 'big'
</dd>
</dl><a NAME="IntIO._set_signed" ID="IntIO._set_signed"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IntIO._set_signed</h3>
<b>_set_signed</b>(<i>value</i>)
<p>
Left fest, ob der Wert Vorzeichenbehaftet behandelt werden soll.
</p><dl>
<dt><i>value</i></dt>
<dd>
True, wenn mit Vorzeichen behandel
</dd>
</dl><a NAME="IntIO.get_int" ID="IntIO.get_int"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IntIO.get_int</h3>
<b>get_int</b>(<i></i>)
<p>
Gibt IO als int() Wert zurueck mit Beachtung byteorder/signed.
</p><dl>
<dt>Returns:</dt>
<dd>
int() Wert
</dd>
</dl><a NAME="IntIO.set_int" ID="IntIO.set_int"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
IntIO.set_int</h3>
<b>set_int</b>(<i>value</i>)
<p>
Setzt IO mit Beachtung byteorder/signed.
</p><dl>
<dt><i>value</i></dt>
<dd>
int()
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="StructIO" ID="StructIO"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">StructIO</h2>
<p>
Klasse fuer den Zugriff auf Daten ueber ein definierten struct().
</p><p>
Diese Klasse ueberschreibt get_value() und set_value() der IOBase()
Klasse. Sie stellt ueber struct die Werte in der gewuenschten Formatierung
bereit. Der struct-Formatwert wird bei der Instantiierung festgelegt.
</p><dl>
<dt><b>See Also:</b></dt>
<dd>
<a style="color:#0000FF" href="#IOBase">IOBase</a>
</dd>
</dl>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
IOBase
<h3 style="background-color:#FFFFFF;color:#FF0000">
Class Attributes</h3>
<table>
<tr><td>byteorder</td></tr><tr><td>value</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="#StructIO.__init__">StructIO</a></td>
<td>Erstellt einen IO mit struct-Formatierung.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#StructIO.get_structvalue">get_structvalue</a></td>
<td>Gibt den Wert mit struct Formatierung zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#StructIO.set_structvalue">set_structvalue</a></td>
<td>Setzt den Wert mit struct Formatierung.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="StructIO.__init__" ID="StructIO.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
StructIO (Constructor)</h3>
<b>StructIO</b>(<i>parentio, name, iotype, byteorder, frm, **kwargs</i>)
<p>
Erstellt einen IO mit struct-Formatierung.
</p><dl>
<dt><i>parentio</i></dt>
<dd>
ParentIO Objekt, welches ersetzt wird
</dd><dt><i>name</i></dt>
<dd>
Name des neuen IO
</dd><dt><i>iotype</i></dt>
<dd>
IOType() Wert
</dd><dt><i>byteorder</i></dt>
<dd>
Byteorder 'little' / 'big' fuer int() Berechnung
</dd><dt><i>frm</i></dt>
<dd>
struct() formatierung (1 Zeichen)
</dd><dt><i>kwargs</i></dt>
<dd>
Weitere Parameter:
- bmk: Bezeichnung fuer Output
- bit: Registriert Outputs als bool() am angegebenen Bit im Byte
- defaultvalue: Standardwert fuer Output, Standard ist 0
</dd>
</dl><a NAME="StructIO.get_structvalue" ID="StructIO.get_structvalue"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
StructIO.get_structvalue</h3>
<b>get_structvalue</b>(<i></i>)
<p>
Gibt den Wert mit struct Formatierung zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
Wert vom Typ der struct-Formatierung
</dd>
</dl><a NAME="StructIO.set_structvalue" ID="StructIO.set_structvalue"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
StructIO.set_structvalue</h3>
<b>set_structvalue</b>(<i>value</i>)
<p>
Setzt den Wert mit struct Formatierung.
</p><dl>
<dt><i>value</i></dt>
<dd>
Wert vom Typ der struct-Formatierung
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr />
</body></html>

656
doc/revpimodio2.modio.html Normal file
View File

@@ -0,0 +1,656 @@
<!DOCTYPE html>
<html><head>
<title>revpimodio2.modio</title>
<meta charset="UTF-8">
</head>
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
<h1 style="background-color:#FFFFFF;color:#0000FF">
revpimodio2.modio</h1>
<p>
RevPiModIO Hauptklasse.
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Global Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Classes</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="#RevPiModIO">RevPiModIO</a></td>
<td>Klasse fuer die Verwaltung aller piCtory Informationen.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIODriver">RevPiModIODriver</a></td>
<td>Klasse um eigene Treiber fuer die virtuellen Devices zu erstellen.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIOSelected">RevPiModIOSelected</a></td>
<td>Klasse fuer die Verwaltung einzelner Devices aus piCtory.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Functions</h3>
<table>
<tr><td>None</td></tr>
</table>
<hr /><hr />
<a NAME="RevPiModIO" ID="RevPiModIO"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">RevPiModIO</h2>
<p>
Klasse fuer die Verwaltung aller piCtory Informationen.
</p><p>
Diese Klasse uebernimmt die gesamte Konfiguration aus piCtory und bilded
die Devices und IOs ab. Sie uebernimmt die exklusive Verwaltung des
Prozessabbilds und stellt sicher, dass die Daten synchron sind.
Sollten nur einzelne Devices gesteuert werden, verwendet man
RevPiModIOSelected() und uebergibt bei Instantiierung eine Liste mit
Device Positionen oder Device Namen.
</p><p>
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
object
<h3 style="background-color:#FFFFFF;color:#FF0000">
Class Attributes</h3>
<table>
<tr><td>configrsc</td></tr><tr><td>cycletime</td></tr><tr><td>length</td></tr><tr><td>monitoring</td></tr><tr><td>procimg</td></tr><tr><td>simulator</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="#RevPiModIO.__init__">RevPiModIO</a></td>
<td>Instantiiert die Grundfunktionen.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO.__del__">__del__</a></td>
<td>Zerstoert alle Klassen um aufzuraeumen.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO.__evt_exit">__evt_exit</a></td>
<td>Eventhandler fuer Programmende.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO._configure">_configure</a></td>
<td>Verarbeitet die piCtory Konfigurationsdatei.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO._create_myfh">_create_myfh</a></td>
<td>Erstellt FileObject mit Pfad zum procimg.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO._get_configrsc">_get_configrsc</a></td>
<td>Getter function.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO._get_cycletime">_get_cycletime</a></td>
<td>Gibt Aktualisierungsrate in ms der Prozessabbildsynchronisierung aus.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO._get_length">_get_length</a></td>
<td>Getter function.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO._get_monitoring">_get_monitoring</a></td>
<td>Getter function.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO._get_procimg">_get_procimg</a></td>
<td>Getter function.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO._get_simulator">_get_simulator</a></td>
<td>Getter function.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO._set_cycletime">_set_cycletime</a></td>
<td>Setzt Aktualisierungsrate der Prozessabbild-Synchronisierung.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO.auto_refresh_maxioerrors">auto_refresh_maxioerrors</a></td>
<td>Maximale IO Fehler fuer auto_refresh.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO.auto_refresh_resetioerrors">auto_refresh_resetioerrors</a></td>
<td>Setzt aktuellen IOError-Zaehler auf 0 zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO.cleanup">cleanup</a></td>
<td>Beendet auto_refresh und alle Threads.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO.cycleloop">cycleloop</a></td>
<td>Startet den Cycleloop.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO.exit">exit</a></td>
<td>Beendet mainloop() und optional auto_refresh.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO.get_jconfigrsc">get_jconfigrsc</a></td>
<td>Laed die piCotry Konfiguration und erstellt ein dict().</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO.handlesignalend">handlesignalend</a></td>
<td>Signalhandler fuer Programmende verwalten.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO.mainloop">mainloop</a></td>
<td>Startet den Mainloop mit Eventueberwachung.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO.readprocimg">readprocimg</a></td>
<td>Einlesen aller Inputs aller/eines Devices vom Prozessabbild.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO.setdefaultvalues">setdefaultvalues</a></td>
<td>Alle Outputbuffer werden auf die piCtory default Werte gesetzt.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO.syncoutputs">syncoutputs</a></td>
<td>Lesen aller aktuell gesetzten Outputs im Prozessabbild.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO.writedefaultinputs">writedefaultinputs</a></td>
<td>Schreibt fuer ein virtuelles Device piCtory Defaultinputwerte.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiModIO.writeprocimg">writeprocimg</a></td>
<td>Schreiben aller Outputs aller Devices ins Prozessabbild.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="RevPiModIO.__init__" ID="RevPiModIO.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO (Constructor)</h3>
<b>RevPiModIO</b>(<i>**kwargs</i>)
<p>
Instantiiert die Grundfunktionen.
</p><dl>
<dt><i>kwargs</i></dt>
<dd>
Weitere Parameter:
- auto_refresh: Wenn True, alle Devices zu auto_refresh hinzufuegen
- configrsc: Pfad zur piCtory Konfigurationsdatei
- procimg: Pfad zum Prozessabbild
- monitoring: In- und Outputs werden gelesen, niemals geschrieben
- simulator: Laed das Modul als Simulator und vertauscht IOs
- syncoutputs: Aktuell gesetzte Outputs vom Prozessabbild einlesen
</dd>
</dl><a NAME="RevPiModIO.__del__" ID="RevPiModIO.__del__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO.__del__</h3>
<b>__del__</b>(<i></i>)
<p>
Zerstoert alle Klassen um aufzuraeumen.
</p><a NAME="RevPiModIO.__evt_exit" ID="RevPiModIO.__evt_exit"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO.__evt_exit</h3>
<b>__evt_exit</b>(<i>signum, sigframe</i>)
<p>
Eventhandler fuer Programmende.
</p><dl>
<dt><i>signum</i></dt>
<dd>
Signalnummer
</dd><dt><i>sigframe</i></dt>
<dd>
Signalframe
</dd>
</dl><a NAME="RevPiModIO._configure" ID="RevPiModIO._configure"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO._configure</h3>
<b>_configure</b>(<i></i>)
<p>
Verarbeitet die piCtory Konfigurationsdatei.
</p><a NAME="RevPiModIO._create_myfh" ID="RevPiModIO._create_myfh"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO._create_myfh</h3>
<b>_create_myfh</b>(<i></i>)
<p>
Erstellt FileObject mit Pfad zum procimg.
return FileObject
</p><a NAME="RevPiModIO._get_configrsc" ID="RevPiModIO._get_configrsc"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO._get_configrsc</h3>
<b>_get_configrsc</b>(<i></i>)
<p>
Getter function.
</p><dl>
<dt>Returns:</dt>
<dd>
Pfad der verwendeten piCtory Konfiguration
</dd>
</dl><a NAME="RevPiModIO._get_cycletime" ID="RevPiModIO._get_cycletime"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO._get_cycletime</h3>
<b>_get_cycletime</b>(<i></i>)
<p>
Gibt Aktualisierungsrate in ms der Prozessabbildsynchronisierung aus.
</p><dl>
<dt>Returns:</dt>
<dd>
Millisekunden
</dd>
</dl><a NAME="RevPiModIO._get_length" ID="RevPiModIO._get_length"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO._get_length</h3>
<b>_get_length</b>(<i></i>)
<p>
Getter function.
</p><dl>
<dt>Returns:</dt>
<dd>
Laenge in Bytes der Devices
</dd>
</dl><a NAME="RevPiModIO._get_monitoring" ID="RevPiModIO._get_monitoring"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO._get_monitoring</h3>
<b>_get_monitoring</b>(<i></i>)
<p>
Getter function.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn als Monitoring gestartet
</dd>
</dl><a NAME="RevPiModIO._get_procimg" ID="RevPiModIO._get_procimg"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO._get_procimg</h3>
<b>_get_procimg</b>(<i></i>)
<p>
Getter function.
</p><dl>
<dt>Returns:</dt>
<dd>
Pfad des verwendeten Prozessabbilds
</dd>
</dl><a NAME="RevPiModIO._get_simulator" ID="RevPiModIO._get_simulator"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO._get_simulator</h3>
<b>_get_simulator</b>(<i></i>)
<p>
Getter function.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn als Simulator gestartet
</dd>
</dl><a NAME="RevPiModIO._set_cycletime" ID="RevPiModIO._set_cycletime"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO._set_cycletime</h3>
<b>_set_cycletime</b>(<i>milliseconds</i>)
<p>
Setzt Aktualisierungsrate der Prozessabbild-Synchronisierung.
</p><dl>
<dt><i>milliseconds</i></dt>
<dd>
int() in Millisekunden
</dd>
</dl><a NAME="RevPiModIO.auto_refresh_maxioerrors" ID="RevPiModIO.auto_refresh_maxioerrors"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO.auto_refresh_maxioerrors</h3>
<b>auto_refresh_maxioerrors</b>(<i>value=None</i>)
<p>
Maximale IO Fehler fuer auto_refresh.
</p><dl>
<dt><i>value</i></dt>
<dd>
Setzt maximale Anzahl bis exception ausgeloest wird
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
Maximale Anzahl bis exception ausgeloest wird
</dd>
</dl><a NAME="RevPiModIO.auto_refresh_resetioerrors" ID="RevPiModIO.auto_refresh_resetioerrors"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO.auto_refresh_resetioerrors</h3>
<b>auto_refresh_resetioerrors</b>(<i></i>)
<p>
Setzt aktuellen IOError-Zaehler auf 0 zurueck.
</p><a NAME="RevPiModIO.cleanup" ID="RevPiModIO.cleanup"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO.cleanup</h3>
<b>cleanup</b>(<i></i>)
<p>
Beendet auto_refresh und alle Threads.
</p><a NAME="RevPiModIO.cycleloop" ID="RevPiModIO.cycleloop"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO.cycleloop</h3>
<b>cycleloop</b>(<i>func, cycletime=50</i>)
<p>
Startet den Cycleloop.
</p><p>
Der aktuelle Programmthread wird hier bis Aufruf von
RevPiDevicelist.exit() "gefangen". Er fuehrt nach jeder Aktualisierung
des Prozessabbilds die uebergebene Funktion "func" aus und arbeitet sie
ab. Waehrend der Ausfuehrung der Funktion wird das Prozessabbild nicht
weiter aktualisiert. Die Inputs behalten bis zum Ende den aktuellen
Wert. Gesetzte Outputs werden nach Ende des Funktionsdurchlaufs in das
Prozessabbild geschrieben.
</p><p>
Verlassen wird der Cycleloop, wenn die aufgerufene Funktion einen
Rueckgabewert nicht gleich None liefert, oder durch Aufruf von
revpimodio.exit().
</p><p>
HINWEIS: Die Aktualisierungszeit und die Laufzeit der Funktion duerfen
die eingestellte auto_refresh Zeit, bzw. uebergebene cycletime nicht
ueberschreiten!
</p><p>
Ueber den Parameter cycletime kann die Aktualisierungsrate fuer das
Prozessabbild gesetzt werden (selbe Funktion wie
set_refreshtime(milliseconds)).
</p><dl>
<dt><i>func</i></dt>
<dd>
Funktion, die ausgefuehrt werden soll
</dd><dt><i>cycletime</i></dt>
<dd>
auto_refresh Wert in Millisekunden
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
None
</dd>
</dl><a NAME="RevPiModIO.exit" ID="RevPiModIO.exit"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO.exit</h3>
<b>exit</b>(<i>full=True</i>)
<p>
Beendet mainloop() und optional auto_refresh.
</p><p>
Wenn sich das Programm im mainloop() befindet, wird durch Aufruf
von exit() die Kontrolle wieder an das Hauptprogramm zurueckgegeben.
</p><p>
Der Parameter full ist mit True vorbelegt und entfernt alle Devices aus
dem auto_refresh. Der Thread fuer die Prozessabbildsynchronisierung
wird dann gestoppt und das Programm kann sauber beendet werden.
</p><dl>
<dt><i>full</i></dt>
<dd>
Entfernt auch alle Devices aus auto_refresh
</dd>
</dl><a NAME="RevPiModIO.get_jconfigrsc" ID="RevPiModIO.get_jconfigrsc"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO.get_jconfigrsc</h3>
<b>get_jconfigrsc</b>(<i></i>)
<p>
Laed die piCotry Konfiguration und erstellt ein dict().
</p><dl>
<dt>Returns:</dt>
<dd>
dict() der piCtory Konfiguration
</dd>
</dl><a NAME="RevPiModIO.handlesignalend" ID="RevPiModIO.handlesignalend"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO.handlesignalend</h3>
<b>handlesignalend</b>(<i>cleanupfunc=None</i>)
<p>
Signalhandler fuer Programmende verwalten.
</p><p>
Wird diese Funktion aufgerufen, uebernimmt RevPiModIO die SignalHandler
fuer SIGINT und SIGTERM. Diese werden Empfangen, wenn das
Betriebssystem oder der Benutzer das Steuerungsprogramm sauber beenden
will.
</p><p>
Die optionale Funktion "cleanupfunc" wird als letztes nach dem letzten
Einlesen der Inputs ausgefuehrt. Dort gesetzte Outputs werden nach
Ablauf der Funktion ein letztes Mal geschrieben.
Gedacht ist dies fuer Aufraeumarbeiten, wie z.B. das abschalten der
LEDs am RevPi-Core.
</p><p>
Nach einmaligem Empfangen eines der Signale und dem Beenden der
RevPiModIO Thrads / Funktionen werden die SignalHandler wieder
freigegeben.
</p><dl>
<dt><i>cleanupfunc</i></dt>
<dd>
Funktion wird nach dem letzten Lesen der Inputs
ausgefuehrt, gefolgt vom letzten Schreiben der Outputs
</dd>
</dl><a NAME="RevPiModIO.mainloop" ID="RevPiModIO.mainloop"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO.mainloop</h3>
<b>mainloop</b>(<i>freeze=False, blocking=True</i>)
<p>
Startet den Mainloop mit Eventueberwachung.
</p><p>
Der aktuelle Programmthread wird hier bis Aufruf von
RevPiDevicelist.exit() "gefangen" (es sei denn blocking=False). Er
durchlaeuft die Eventueberwachung und prueft Aenderungen der, mit
einem Event registrierten, IOs. Wird eine Veraenderung erkannt,
fuert das Programm die dazugehoerigen Funktionen der Reihe nach aus.
</p><p>
Wenn der Parameter "freeze" mit True angegeben ist, wird die
Prozessabbildsynchronisierung angehalten bis alle Eventfunktionen
ausgefuehrt wurden. Inputs behalten fuer die gesamte Dauer ihren
aktuellen Wert und Outputs werden erst nach Durchlauf aller Funktionen
in das Prozessabbild geschrieben.
</p><p>
Wenn der Parameter "blocking" mit False angegeben wird, aktiviert
dies die Eventueberwachung und blockiert das Programm NICHT an der
Stelle des Aufrufs. Eignet sich gut fuer die GUI Programmierung, wenn
Events vom RevPi benoetigt werden, aber das Programm weiter ausgefuehrt
werden soll.
</p><dl>
<dt><i>freeze</i></dt>
<dd>
Wenn True, Prozessabbildsynchronisierung anhalten
</dd><dt><i>blocking</i></dt>
<dd>
Wenn False, blockiert das Programm NICHT
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
None
</dd>
</dl><a NAME="RevPiModIO.readprocimg" ID="RevPiModIO.readprocimg"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO.readprocimg</h3>
<b>readprocimg</b>(<i>force=False, device=None</i>)
<p>
Einlesen aller Inputs aller/eines Devices vom Prozessabbild.
</p><dl>
<dt><i>force</i></dt>
<dd>
auch Devices mit autoupdate=False
</dd><dt><i>device</i></dt>
<dd>
nur auf einzelnes Device anwenden
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
True, wenn Arbeiten an allen Devices erfolgreich waren
</dd>
</dl><a NAME="RevPiModIO.setdefaultvalues" ID="RevPiModIO.setdefaultvalues"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO.setdefaultvalues</h3>
<b>setdefaultvalues</b>(<i>force=False, device=None</i>)
<p>
Alle Outputbuffer werden auf die piCtory default Werte gesetzt.
</p><dl>
<dt><i>force</i></dt>
<dd>
auch Devices mit autoupdate=False
</dd><dt><i>device</i></dt>
<dd>
nur auf einzelnes Device anwenden
</dd>
</dl><a NAME="RevPiModIO.syncoutputs" ID="RevPiModIO.syncoutputs"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO.syncoutputs</h3>
<b>syncoutputs</b>(<i>force=False, device=None</i>)
<p>
Lesen aller aktuell gesetzten Outputs im Prozessabbild.
</p><dl>
<dt><i>force</i></dt>
<dd>
auch Devices mit autoupdate=False
</dd><dt><i>device</i></dt>
<dd>
nur auf einzelnes Device anwenden
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
True, wenn Arbeiten an allen Devices erfolgreich waren
</dd>
</dl><a NAME="RevPiModIO.writedefaultinputs" ID="RevPiModIO.writedefaultinputs"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO.writedefaultinputs</h3>
<b>writedefaultinputs</b>(<i>virtual_device</i>)
<p>
Schreibt fuer ein virtuelles Device piCtory Defaultinputwerte.
</p><p>
Sollten in piCtory Defaultwerte fuer Inputs eines virtuellen Devices
angegeben sein, werden diese nur beim Systemstart oder einem piControl
Reset gesetzt. Sollte danach das Prozessabbild mit NULL ueberschrieben,
gehen diese Werte verloren.
Diese Funktion kann nur auf virtuelle Devices angewendet werden!
</p><dl>
<dt><i>virtual_device</i></dt>
<dd>
Virtuelles Device fuer Wiederherstellung
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
True, wenn Arbeiten am virtuellen Device erfolgreich waren
</dd>
</dl><a NAME="RevPiModIO.writeprocimg" ID="RevPiModIO.writeprocimg"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIO.writeprocimg</h3>
<b>writeprocimg</b>(<i>force=False, device=None</i>)
<p>
Schreiben aller Outputs aller Devices ins Prozessabbild.
</p><dl>
<dt><i>force</i></dt>
<dd>
auch Devices mit autoupdate=False
</dd><dt><i>device</i></dt>
<dd>
nur auf einzelnes Device anwenden
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
True, wenn Arbeiten an allen Devices erfolgreich waren
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="RevPiModIODriver" ID="RevPiModIODriver"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">RevPiModIODriver</h2>
<p>
Klasse um eigene Treiber fuer die virtuellen Devices zu erstellen.
</p><p>
Mit dieser Klasse werden nur angegebene Virtuelle Devices mit RevPiModIO
verwaltet. Bei Instantiierung werden automatisch die Inputs und Outputs
verdreht, um das Schreiben der Inputs zu ermoeglichen. Die Daten koennen
dann ueber logiCAD an den Devices abgerufen werden.
</p><p>
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
RevPiModIOSelected
<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><a style="color:#0000FF" href="#RevPiModIODriver.__init__">RevPiModIODriver</a></td>
<td>Instantiiert die Grundfunktionen.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="RevPiModIODriver.__init__" ID="RevPiModIODriver.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIODriver (Constructor)</h3>
<b>RevPiModIODriver</b>(<i>vdev, **kwargs</i>)
<p>
Instantiiert die Grundfunktionen.
</p><dl>
<dt><i>vdev</i></dt>
<dd>
Virtuelles Device fuer die Verwendung / oder list()
</dd><dt><i>kwargs</i></dt>
<dd>
Weitere Parameter (nicht monitoring und simulator)
</dd>
</dl><dl>
<dt><b>See Also:</b></dt>
<dd>
<a style="color:#0000FF" href="#RevPiModIO.__init__">RevPiModIO.__init__(...)</a>
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="RevPiModIOSelected" ID="RevPiModIOSelected"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">RevPiModIOSelected</h2>
<p>
Klasse fuer die Verwaltung einzelner Devices aus piCtory.
</p><p>
Diese Klasse uebernimmt nur angegebene Devices der piCtory Konfiguration
und bilded sie inkl. IOs ab. Sie uebernimmt die exklusive Verwaltung des
Adressbereichs im Prozessabbild an dem sich die angegebenen Devices
befinden und stellt sicher, dass die Daten synchron sind.
</p><p>
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
RevPiModIO
<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><a style="color:#0000FF" href="#RevPiModIOSelected.__init__">RevPiModIOSelected</a></td>
<td>Instantiiert nur fuer angegebene Devices die Grundfunktionen.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="RevPiModIOSelected.__init__" ID="RevPiModIOSelected.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiModIOSelected (Constructor)</h3>
<b>RevPiModIOSelected</b>(<i>deviceselection, **kwargs</i>)
<p>
Instantiiert nur fuer angegebene Devices die Grundfunktionen.
</p><p>
Der Parameter deviceselection kann eine einzelne
Device Position / einzelner Device Name sein oder eine Liste mit
mehreren Positionen / Namen
</p><dl>
<dt><i>deviceselection</i></dt>
<dd>
Positionsnummer oder Devicename
</dd><dt><i>kwargs</i></dt>
<dd>
Weitere Parameter
</dd>
</dl><dl>
<dt><b>See Also:</b></dt>
<dd>
<a style="color:#0000FF" href="#RevPiModIO.__init__">RevPiModIO.__init__(...)</a>
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr />
</body></html>

View File

@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html><head>
<title>revpimodio2.summary</title>
<meta charset="UTF-8">
</head>
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
<h1 style="background-color:#FFFFFF;color:#0000FF">
revpimodio2.summary</h1>
<p>
Bildet die Summary-Sektion von piCtory ab.
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Global Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Classes</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="#Summary">Summary</a></td>
<td>Bildet die Summary-Sektion der config.rsc ab.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Functions</h3>
<table>
<tr><td>None</td></tr>
</table>
<hr /><hr />
<a NAME="Summary" ID="Summary"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">Summary</h2>
<p>
Bildet die Summary-Sektion der config.rsc ab.
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Derived from</h3>
object
<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><a style="color:#0000FF" href="#Summary.__init__">Summary</a></td>
<td>Instantiiert die RevPiSummary-Klasse.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="Summary.__init__" ID="Summary.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Summary (Constructor)</h3>
<b>Summary</b>(<i>summary</i>)
<p>
Instantiiert die RevPiSummary-Klasse.
</p><dl>
<dt><i>summary</i></dt>
<dd>
piCtory Summaryinformationen
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr />
</body></html>

124
eric-revpimodio.api Normal file
View File

@@ -0,0 +1,124 @@
revpimodio2.BOTH?7
revpimodio2.FALLING?7
revpimodio2.GREEN?7
revpimodio2.IOType.INP?7
revpimodio2.IOType.MEM?7
revpimodio2.IOType.OUT?7
revpimodio2.OFF?7
revpimodio2.RED?7
revpimodio2.RISING?7
revpimodio2.app.App?1(app)
revpimodio2.device.Core.A1?7
revpimodio2.device.Core.A2?7
revpimodio2.device.Core._devconfigure?5()
revpimodio2.device.Core._errorlimit?5(io_id, errorlimit)
revpimodio2.device.Core.errorlimit1?4(value)
revpimodio2.device.Core.errorlimit2?4(value)
revpimodio2.device.Core.frequency?4()
revpimodio2.device.Core.get_leda1?4()
revpimodio2.device.Core.get_leda2?4()
revpimodio2.device.Core.get_status?4()
revpimodio2.device.Core.iocycle?4()
revpimodio2.device.Core.ioerrorcount?4()
revpimodio2.device.Core.leftgate?4()
revpimodio2.device.Core.missingdeviceorgate?4()
revpimodio2.device.Core.overunderflow?4()
revpimodio2.device.Core.picontrolrunning?4()
revpimodio2.device.Core.rightgate?4()
revpimodio2.device.Core.set_leda1?4(value)
revpimodio2.device.Core.set_leda2?4(value)
revpimodio2.device.Core.status?7
revpimodio2.device.Core.temperatur?4()
revpimodio2.device.Core.unconfdevice?4()
revpimodio2.device.Device._buildio?5(dict_io, iotype)
revpimodio2.device.Device._devconfigure?5()
revpimodio2.device.Device.auto_refresh?4(remove=False)
revpimodio2.device.Device.get_allios?4()
revpimodio2.device.Device.get_inps?4()
revpimodio2.device.Device.get_mems?4()
revpimodio2.device.Device.get_outs?4()
revpimodio2.device.Device?1(parentmodio, dict_device, **kwargs)
revpimodio2.device.DeviceList?1()
revpimodio2.device.Gateway.get_rawbytes?4()
revpimodio2.device.Gateway?1(parent, dict_device, **kwargs)
revpimodio2.helper.Cycletools._docycle?5()
revpimodio2.helper.Cycletools.get_tofc?4(name)
revpimodio2.helper.Cycletools.get_tonc?4(name)
revpimodio2.helper.Cycletools.get_tpc?4(name)
revpimodio2.helper.Cycletools.set_tofc?4(name, cycles)
revpimodio2.helper.Cycletools.set_tonc?4(name, cycles)
revpimodio2.helper.Cycletools.set_tpc?4(name, cycles)
revpimodio2.helper.Cycletools?1()
revpimodio2.helper.EventCallback.run?4()
revpimodio2.helper.EventCallback.stop?4()
revpimodio2.helper.EventCallback?1(func, name, value)
revpimodio2.helper.ProcimgWriter._gotioerror?5()
revpimodio2.helper.ProcimgWriter.get_refresh?4()
revpimodio2.helper.ProcimgWriter.refresh?7
revpimodio2.helper.ProcimgWriter.run?4()
revpimodio2.helper.ProcimgWriter.set_refresh?4(value)
revpimodio2.helper.ProcimgWriter.stop?4()
revpimodio2.helper.ProcimgWriter?1(parentmodio)
revpimodio2.io.IOBase._get_byteorder?5()
revpimodio2.io.IOBase.address?7
revpimodio2.io.IOBase.get_address?4()
revpimodio2.io.IOBase.get_length?4()
revpimodio2.io.IOBase.get_name?4()
revpimodio2.io.IOBase.get_value?4()
revpimodio2.io.IOBase.length?7
revpimodio2.io.IOBase.name?7
revpimodio2.io.IOBase.reg_event?4(func, edge=BOTH, as_thread=False)
revpimodio2.io.IOBase.replace_io?4(name, frm, **kwargs)
revpimodio2.io.IOBase.set_value?4(value)
revpimodio2.io.IOBase.unreg_event?4(func=None, edge=None)
revpimodio2.io.IOBase.value?7
revpimodio2.io.IOBase.wait?4(edge=BOTH, exitevent=None, okvalue=None, timeout=0)
revpimodio2.io.IOBase?1(parentdevice, valuelist, iotype, byteorder)
revpimodio2.io.IOList._register_new_io_object?5(new_io)
revpimodio2.io.IOList._testme?5()
revpimodio2.io.IOList?1()
revpimodio2.io.IntIO._get_signed?5()
revpimodio2.io.IntIO._set_byteorder?5(value)
revpimodio2.io.IntIO._set_signed?5(value)
revpimodio2.io.IntIO.byteorder?7
revpimodio2.io.IntIO.get_int?4()
revpimodio2.io.IntIO.set_int?4(value)
revpimodio2.io.IntIO.signed?7
revpimodio2.io.IntIO.value?7
revpimodio2.io.StructIO.byteorder?7
revpimodio2.io.StructIO.get_structvalue?4()
revpimodio2.io.StructIO.set_structvalue?4(value)
revpimodio2.io.StructIO.value?7
revpimodio2.io.StructIO?1(parentio, name, iotype, byteorder, frm, **kwargs)
revpimodio2.modio.RevPiModIO._configure?5()
revpimodio2.modio.RevPiModIO._create_myfh?5()
revpimodio2.modio.RevPiModIO._get_configrsc?5()
revpimodio2.modio.RevPiModIO._get_cycletime?5()
revpimodio2.modio.RevPiModIO._get_length?5()
revpimodio2.modio.RevPiModIO._get_monitoring?5()
revpimodio2.modio.RevPiModIO._get_procimg?5()
revpimodio2.modio.RevPiModIO._get_simulator?5()
revpimodio2.modio.RevPiModIO._set_cycletime?5(milliseconds)
revpimodio2.modio.RevPiModIO.auto_refresh_maxioerrors?4(value=None)
revpimodio2.modio.RevPiModIO.auto_refresh_resetioerrors?4()
revpimodio2.modio.RevPiModIO.cleanup?4()
revpimodio2.modio.RevPiModIO.configrsc?7
revpimodio2.modio.RevPiModIO.cycleloop?4(func, cycletime=50)
revpimodio2.modio.RevPiModIO.cycletime?7
revpimodio2.modio.RevPiModIO.exit?4(full=True)
revpimodio2.modio.RevPiModIO.get_jconfigrsc?4()
revpimodio2.modio.RevPiModIO.handlesignalend?4(cleanupfunc=None)
revpimodio2.modio.RevPiModIO.length?7
revpimodio2.modio.RevPiModIO.mainloop?4(freeze=False, blocking=True)
revpimodio2.modio.RevPiModIO.monitoring?7
revpimodio2.modio.RevPiModIO.procimg?7
revpimodio2.modio.RevPiModIO.readprocimg?4(force=False, device=None)
revpimodio2.modio.RevPiModIO.setdefaultvalues?4(force=False, device=None)
revpimodio2.modio.RevPiModIO.simulator?7
revpimodio2.modio.RevPiModIO.syncoutputs?4(force=False, device=None)
revpimodio2.modio.RevPiModIO.writedefaultinputs?4(virtual_device)
revpimodio2.modio.RevPiModIO.writeprocimg?4(force=False, device=None)
revpimodio2.modio.RevPiModIO?1(**kwargs)
revpimodio2.modio.RevPiModIODriver?1(vdev, **kwargs)
revpimodio2.modio.RevPiModIOSelected?1(deviceselection, **kwargs)
revpimodio2.summary.Summary?1(summary)

9
eric-revpimodio.bas Normal file
View File

@@ -0,0 +1,9 @@
Core Device
EventCallback Thread
Gateway Device
IntIO IOBase
ProcimgWriter Thread
RevPiModIODriver RevPiModIOSelected
RevPiModIOSelected RevPiModIO
StructIO IOBase
Virtual Gateway

View File

@@ -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: 2017-08-13, 12:05:22 --> <!-- Saved: 2017-08-14, 16:08:00 -->
<!-- Copyright (C) 2017 Sven Sager, akira@narux.de --> <!-- Copyright (C) 2017 Sven Sager, akira@narux.de -->
<Project version="5.1"> <Project version="5.1">
<Language>en_US</Language> <Language>en_US</Language>
@@ -30,6 +30,7 @@
<Others> <Others>
<Other>doc</Other> <Other>doc</Other>
<Other>.hgignore</Other> <Other>.hgignore</Other>
<Other>eric-revpimodio.api</Other>
</Others> </Others>
<Vcs> <Vcs>
<VcsType>Mercurial</VcsType> <VcsType>Mercurial</VcsType>
@@ -217,12 +218,6 @@
<string>setup.py</string> <string>setup.py</string>
</list> </list>
</value> </value>
<key>
<string>noindex</string>
</key>
<value>
<bool>True</bool>
</value>
<key> <key>
<string>outputDirectory</string> <string>outputDirectory</string>
</key> </key>

View File

@@ -36,6 +36,7 @@ BOTH = 33
warnings.simplefilter(action="always") warnings.simplefilter(action="always")
class IOType(object): class IOType(object):
"""IO Typen.""" """IO Typen."""

View File

@@ -5,10 +5,8 @@
# (c) Sven Sager, License: LGPLv3 # (c) Sven Sager, License: LGPLv3
# #
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import struct """Modul fuer die Verwaltung der Devices."""
from threading import Lock from threading import Lock
from . import io as iomodule
from .__init__ import IOType from .__init__ import IOType
from .helper import ProcimgWriter from .helper import ProcimgWriter
@@ -42,7 +40,13 @@ class DeviceList(object):
def __iter__(self): def __iter__(self):
"""Gibt Iterator aller Devices zurueck. """Gibt Iterator aller Devices zurueck.
@return iter() aller Devices""" @return iter() aller Devices"""
return iter(self.__dict_position.values()) for dev in sorted(self.__dict_position):
yield self.__dict_position[dev]
def __len__(self):
"""Gibt Anzahl der Devices zurueck.
return Anzahl der Devices"""
return len(self.__dict_position)
def __setattr__(self, key, value): def __setattr__(self, key, value):
"""Setzt Attribute nur wenn Device. """Setzt Attribute nur wenn Device.
@@ -107,9 +111,6 @@ class Device(object):
self.slc_out = self._buildio(dict_device.pop("out"), IOType.OUT) self.slc_out = self._buildio(dict_device.pop("out"), IOType.OUT)
self.slc_mem = self._buildio(dict_device.pop("mem"), IOType.MEM) self.slc_mem = self._buildio(dict_device.pop("mem"), IOType.MEM)
# Alle IOs nach Adresse sortieren
self._lst_io.sort(key=lambda x: x.slc_address.start)
# SLCs mit offset berechnen # SLCs mit offset berechnen
self.slc_devoff = slice(self.offset, self.offset + self._length) self.slc_devoff = slice(self.offset, self.offset + self._length)
self.slc_inpoff = slice( self.slc_inpoff = slice(
@@ -138,29 +139,14 @@ class Device(object):
@param key IO-Name str() / IO-Bytenummer int() @param key IO-Name str() / IO-Bytenummer int()
@return True, wenn device vorhanden""" @return True, wenn device vorhanden"""
if type(key) == str: if type(key) == str:
return hasattr(self._modio.io, key) return hasattr(self._modio.io, key) \
if type(key) == int: and getattr(self._modio.io, key)._parentdevice == self
key += self.offset elif type(key) == int:
return key in self._modio.io \ return key in self._modio.io \
and len(self._modio.io[key]) > 0 and len(self._modio.io[key]) > 0 \
and self._modio.io[key][0]._parentdevice == self
else: else:
return key in self._lst_io return key._parentdevice == self
def __getitem__(self, key):
"""Gibt angegebenes IO-Objekt zurueck.
@param key Name order Byteadresse des IOs
@return IO-Objekt wenn Name, sonst list() mit IO-Objekt"""
if type(key) == int:
key += self.offset
if key in self._modio.io:
return self._modio.io[key]
else:
raise KeyError("byte '{}' does not exist".format(key))
else:
if hasattr(self._modio.io, key):
return getattr(self._modio.io, key)
else:
raise KeyError("'{}' does not exist".format(key))
def __int__(self): def __int__(self):
"""Gibt die Positon im RevPi Bus zurueck. """Gibt die Positon im RevPi Bus zurueck.
@@ -170,34 +156,20 @@ class Device(object):
def __iter__(self): def __iter__(self):
"""Gibt Iterator aller IOs zurueck. """Gibt Iterator aller IOs zurueck.
@return iter() aller IOs""" @return iter() aller IOs"""
return iter(self._lst_io) for i_byte in range(self.slc_devoff.start, self.slc_devoff.stop):
for io in self._modio.io[i_byte]:
yield io
def __len__(self):
"""Gibt Anzahl der Bytes zurueck, die dieses Device belegt.
@return int()"""
return self._length
def __str__(self): def __str__(self):
"""Gibt den Namen des Devices zurueck. """Gibt den Namen des Devices zurueck.
@return Devicename""" @return Devicename"""
return self.name return self.name
def __setitem__(self, key, value):
"""Setzt den Wert des angegebenen Inputs.
@param key Name oder Byte des Inputs
@param value Wert der gesetzt werden soll"""
if type(key) == int:
key += self.offset
if key in self._modio.io:
if len(self._modio.io[key]) == 1:
self._modio.io[key][0].value = value
elif len(self._modio.io[key]) == 0:
raise KeyError("byte '{}' contains no input".format(key))
else:
raise KeyError(
"byte '{}' contains more than one bit-input"
"".format(key)
)
else:
raise KeyError("byte '{}' does not exist".format(key))
else:
getattr(self._modio.io, key).value = value
def _buildio(self, dict_io, iotype): def _buildio(self, dict_io, iotype):
"""Erstellt aus der piCtory-Liste die IOs fuer dieses Device. """Erstellt aus der piCtory-Liste die IOs fuer dieses Device.
@@ -228,22 +200,12 @@ class Device(object):
) )
# IO registrieren # IO registrieren
if hasattr(self._modio.io, io_new.name): self._modio.io._register_new_io_object(io_new)
raise NameError(
"name '{}' already exists on device '{}'".format(
io_new._name, self.name
)
)
else:
# Namesregister aufbauen
setattr(self._modio.io, io_new._name, io_new)
# Speicherbereich zuweisen # Speicherbereich zuweisen
self._ba_devdata.extend(bytes(io_new._length)) self._ba_devdata.extend(bytes(io_new._length))
# IO eintragen self._length += io_new._length
self._lst_io.append(io_new)
self._length += io_new._length
# Kleinste und größte Speicheradresse ermitteln # Kleinste und größte Speicheradresse ermitteln
if io_new.slc_address.start < int_min: if io_new.slc_address.start < int_min:
@@ -303,45 +265,38 @@ class Device(object):
if not self._modio._monitoring: if not self._modio._monitoring:
self._modio.writeprocimg(True, self) self._modio.writeprocimg(True, self)
def get_allios(self):
"""Gibt eine Liste aller Inputs und Outputs zurueck.
@return list() Input und Output, keine MEMs"""
return [
io for io in self._modio.io
if io._parentdevice == self and io._iotype != IOType.MEM
]
def get_inps(self): def get_inps(self):
"""Gibt eine Liste aller Inputs zurueck. """Gibt eine Liste aller Inputs zurueck.
@return list() Inputs""" @return list() Inputs"""
return [ return [
io for io in self._lst_io if io._iotype == IOType.INP io for io in self._modio.io
if io._parentdevice == self and io._iotype == IOType.INP
] ]
def get_outs(self): def get_outs(self):
"""Gibt eine Liste aller Outputs zurueck. """Gibt eine Liste aller Outputs zurueck.
@return list() Outputs""" @return list() Outputs"""
return [ return [
io for io in self._lst_io if io._iotype == IOType.OUT io for io in self._modio.io
if io._parentdevice == self and io._iotype == IOType.OUT
] ]
def get_mems(self): def get_mems(self):
"""Gibt eine Liste aller mems zurueck. """Gibt eine Liste aller mems zurueck.
@return list() Mems""" @return list() Mems"""
return [ return [
io for io in self._lst_io if io._iotype == IOType.MEM io for io in self._modio.io
if io._parentdevice == self and io._iotype == IOType.MEM
] ]
def get_iobyabsaddress(self, address):
"""Gibt das IO-Objekt an angegebenen Byte im Prozessabbild zurueck.
@param address Byteadresse im Prozessabbild
@return list() mit IO-Objekt/en"""
return self[address - self.offset]
def get_iobyaddress(self, address):
"""Gibt das IO-Objekt an angegebenen Byte des Devices zurueck.
@param address Byteadresse im Deviceabbild
@return list() mit IO-Objekt/en"""
return self[address]
def get_iobyname(self, name):
"""Gibt das IO-Objekt mit angegebenen Namen zurueck.
@param name Name des IO-Objekts
@return IO-Objekt"""
return getattr(self._modio.io, name)
class Core(Device): class Core(Device):
@@ -361,6 +316,9 @@ class Core(Device):
self._ioerrorlimit1 = None self._ioerrorlimit1 = None
self._ioerrorlimit2 = None self._ioerrorlimit2 = None
# Eigene IO-Liste aufbauen
self._lst_io = [x for x in self.__iter__()]
int_lenio = len(self._lst_io) int_lenio = len(self._lst_io)
if int_lenio == 6: if int_lenio == 6:
# Core 1.1 # Core 1.1
@@ -584,38 +542,12 @@ class Gateway(Device):
@see #RevPiDevice.__init__ RevPiDevice.__init__(...)""" @see #RevPiDevice.__init__ RevPiDevice.__init__(...)"""
super().__init__(parent, dict_device, **kwargs) super().__init__(parent, dict_device, **kwargs)
# TODO: evtl. an modio.io anhängen
self._dict_iorefbyte = {}
self._dict_iorefname = {}
self._dict_slc = { self._dict_slc = {
IOType.INP: self.slc_inp, IOType.INP: self.slc_inp,
IOType.OUT: self.slc_out, IOType.OUT: self.slc_out,
IOType.MEM: self.slc_mem IOType.MEM: self.slc_mem
} }
def _getbytename(self, iobyte):
"""Ermittelt den Namen eines IOs auf der Byteadresse.
@param iobyte Bytenummer
@return IO-Namen"""
# Wenn IO schon ausgetauscht wurde
if iobyte in self._dict_iorefbyte:
return self._dict_iorefbyte[iobyte]
# Wenn IO jetzt ausgetauscht wird
if iobyte in self._modio.io:
intlen = len(self._modio.io[iobyte])
if intlen == 1:
return self._modio.io[iobyte][0].name
elif len == 0:
raise KeyError("byte '{}' contains no input".format(iobyte))
else:
raise KeyError(
"byte '{}' contains more than one bit-input".format(iobyte)
)
else:
raise KeyError("byte '{}' does not exist".format(iobyte))
def get_rawbytes(self): def get_rawbytes(self):
"""Gibt die Bytes aus, die dieses Device verwendet. """Gibt die Bytes aus, die dieses Device verwendet.
@return bytes() des Devices""" @return bytes() des Devices"""
@@ -635,3 +567,7 @@ class Virtual(Gateway):
""" """
pass pass
# Nachträglicher Import
from . import io as iomodule

View File

@@ -5,6 +5,7 @@
# (c) Sven Sager, License: LGPLv3 # (c) Sven Sager, License: LGPLv3
# #
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""RevPiModIO Helperklassen und Tools."""
import warnings import warnings
from threading import Event, Lock, Thread from threading import Event, Lock, Thread
from timeit import default_timer from timeit import default_timer

View File

@@ -5,10 +5,9 @@
# (c) Sven Sager, License: LGPLv3 # (c) Sven Sager, License: LGPLv3
# #
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""RevPiModIO Modul fuer die Verwaltung der IOs."""
import struct import struct
from threading import Event from threading import Event
from . import device as devicemodule
from .__init__ import RISING, FALLING, BOTH, IOType from .__init__ import RISING, FALLING, BOTH, IOType
@@ -17,13 +16,15 @@ class IOList(object):
"""Basisklasse fuer direkten Zugriff auf IO Objekte.""" """Basisklasse fuer direkten Zugriff auf IO Objekte."""
def __init__(self): def __init__(self):
"""Init IOList clacc.""" """Init IOList class."""
self.__dict_iobyte = {k: [] for k in range(4096)} self.__dict_iobyte = {k: [] for k in range(4096)}
self.__dict_iorefbyte = {}
self.__dict_iorefname = {}
def __contains__(self, key): def __contains__(self, key):
"""Prueft ob IO existiert. """Prueft ob IO existiert.
@param key IO-Name str() @param key IO-Name str() oder Byte int()
@return True, wenn IO vorhanden""" @return True, wenn IO vorhanden / Byte belegt"""
if type(key) == int: if type(key) == int:
return key in self.__dict_iobyte \ return key in self.__dict_iobyte \
and len(self.__dict_iobyte[key]) > 0 and len(self.__dict_iobyte[key]) > 0
@@ -34,12 +35,27 @@ class IOList(object):
"""Entfernt angegebenen IO. """Entfernt angegebenen IO.
@param key IO zum entfernen""" @param key IO zum entfernen"""
# TODO: Prüfen ob auch Bit sein kann # TODO: Prüfen ob auch Bit sein kann
# FIXME: IO von DeviceIO Liste entfernen
# FIXME: IO aus Eventhandling entfernen io_del = getattr(self, key)
dev = getattr(self, key)
self.__dict_iobyte[dev.address].remove(dev) # Alte Events vom Device löschen
io_del.unreg_event()
# IO aus Byteliste und Attributen entfernen
self.__dict_iobyte[io_del.address].remove(io_del)
object.__delattr__(self, key) object.__delattr__(self, key)
def __getattr__(self, key):
"""Verwaltet geloeschte IOs.
@param key Wert eines alten IOs
@return Alten IO, wenn in Ref-Listen"""
if key in self.__dict_iorefname:
return self.__dict_iorefname[key]
elif key in self.__dict_iorefbyte:
return self.__dict_iorefbyte[key]
else:
raise AttributeError("can not find io '{}'".format(key))
def __getitem__(self, key): def __getitem__(self, key):
"""Ruft angegebenen IO ab. """Ruft angegebenen IO ab.
@param key IO Name oder Byte @param key IO Name oder Byte
@@ -83,42 +99,23 @@ class IOList(object):
"""Setzt IO Wert. """Setzt IO Wert.
@param key IO Name oder Byte @param key IO Name oder Byte
@param value Wert, auf den der IO gesetzt wird""" @param value Wert, auf den der IO gesetzt wird"""
if issubclass(type(value), IOBase): if key in [
if hasattr(self, key): "_IOList__dict_iobyte",
raise AttributeError( "_IOList__dict_iorefname",
"attribute {} already exists - can not set io".format(key) "_IOList__dict_iorefbyte"
) ]:
object.__setattr__(self, key, value)
# Bytedict erstellen für Adresszugriff
if value._bitaddress < 0:
self.__dict_iobyte[value.address].append(value)
else:
if len(self.__dict_iobyte[value.address]) != 8:
# "schnell" 8 Einträge erstellen da es BIT IOs sind
self.__dict_iobyte[value.address] += [
None, None, None, None, None, None, None, None
]
self.__dict_iobyte[value.address][value._bitaddress] = value
elif key == "_IOList__dict_iobyte":
object.__setattr__(self, key, value) object.__setattr__(self, key, value)
else: else:
# Setzt Wert bei Zuweisung
getattr(self, key).value = value getattr(self, key).value = value
def _replace_io(self, io): def __replace_oldio_with_newio(self, io):
"""Ersetzt bestehende IOs durch den neu Registrierten. """Ersetzt bestehende IOs durch den neu Registrierten.
@param io Neuer IO der eingefuegt werden soll""" @param io Neuer IO der eingefuegt werden soll"""
dict_oldio = {} for i in range(io.slc_address.start, io.slc_address.stop):
for oldio in self._lst_io: for oldio in self.__dict_iobyte[i + io._parentdevice.offset]:
# Alle IOs Prüfen ob sie im neuen Speicherbereich sind
errstart = oldio.slc_address.start >= io.slc_address.start \
and oldio.slc_address.start < io.slc_address.stop
errstop = oldio.slc_address.stop > io.slc_address.start \
and oldio.slc_address.stop <= io.slc_address.stop
if errstart or errstop:
if type(oldio) == StructIO: if type(oldio) == StructIO:
# Hier gibt es schon einen neuen IO # Hier gibt es schon einen neuen IO
if oldio._bitaddress >= 0: if oldio._bitaddress >= 0:
@@ -137,39 +134,52 @@ class IOList(object):
) )
) )
else: elif oldio is not None:
# IOs im Speicherbereich des neuen IO merken # IOs im Speicherbereich des neuen IO merken
dict_oldio[oldio.name] = oldio if io._bitaddress >= 0:
# ios für ref bei bitaddress speichern
for oldio in dict_oldio.values(): self.__dict_iorefbyte[oldio.slc_address.start] = oldio
if io._bitaddress >= 0: self.__dict_iorefname[oldio.name] = oldio
# ios für ref bei bitaddress speichern
self._dict_iorefbyte[oldio.slc_address.start] = oldio.name
self._dict_iorefname[oldio.name] = oldio.slc_address.start
# ios aus listen entfernen
delattr(self._modio.io, oldio.name)
self._lst_io.remove(oldio)
# Namensregister erweitern
setattr(self._modio.io, io.name, io)
# io einfügen (auch wenn nicht richtige stelle wegen BitOffset)
self._lst_io.insert(io.slc_address.start, io)
# Liste neu sortieren
self._lst_io.sort(key=lambda x: x.slc_address.start)
# ios aus listen entfernen
delattr(self, oldio.name)
def _register_new_io_object(self, new_io):
"""Registriert neues IO Objekt unabhaenging von __setattr__.
@param new_io Neues IO Objekt"""
if issubclass(type(new_io), IOBase):
if hasattr(self, new_io.name):
raise AttributeError(
"attribute {} already exists - can not set io".format(
new_io.name
)
)
if type(new_io) is StructIO:
self.__replace_oldio_with_newio(new_io)
object.__setattr__(self, new_io.name, new_io)
# Bytedict erstellen für Adresszugriff
if new_io._bitaddress < 0:
self.__dict_iobyte[new_io.address].append(new_io)
else:
if len(self.__dict_iobyte[new_io.address]) != 8:
# "schnell" 8 Einträge erstellen da es BIT IOs sind
self.__dict_iobyte[new_io.address] += [
None, None, None, None, None, None, None, None
]
self.__dict_iobyte[new_io.address][new_io._bitaddress] = new_io
else:
raise AttributeError("io must be IOBase or sub class")
def _testme(self): def _testme(self):
# NOTE: Nur Debugging # NOTE: Nur Debugging
for x in self.__dict_iobyte: for x in self.__dict_iobyte:
if len(self.__dict_iobyte[x]) > 0: if len(self.__dict_iobyte[x]) > 0:
print(x, self.__dict_iobyte[x]) print(x, self.__dict_iobyte[x])
print(self.__dict_iorefname)
print(self.__dict_iorefbyte)
class IOBase(object): class IOBase(object):
@@ -346,8 +356,8 @@ class IOBase(object):
) )
break break
def reg_inp(self, name, frm, **kwargs): def replace_io(self, name, frm, **kwargs):
"""Registriert einen neuen Input an Adresse von Diesem. """Ersetzt bestehenden IO mit Neuem.
@param name Name des neuen Inputs @param name Name des neuen Inputs
@param frm struct() formatierung (1 Zeichen) @param frm struct() formatierung (1 Zeichen)
@@ -364,7 +374,7 @@ class IOBase(object):
>Python3 struct()</a> >Python3 struct()</a>
""" """
if not issubclass(self._parentdevice, devicemodule.Gateway): if not issubclass(type(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"
@@ -372,14 +382,14 @@ class IOBase(object):
# StructIO erzeugen und in IO-Liste einfügen # StructIO erzeugen und in IO-Liste einfügen
io_new = StructIO( io_new = StructIO(
self._parentdevice, self,
name, name,
IOType.INP, self._iotype,
kwargs.get("byteorder", "little"), kwargs.get("byteorder", "little"),
frm, frm,
**kwargs **kwargs
) )
setattr(self._parentdevice._modio.io, name, io_new) self._parentdevice._modio.io._register_new_io_object(io_new)
# Optional Event eintragen # Optional Event eintragen
reg_event = kwargs.get("event", None) reg_event = kwargs.get("event", None)
@@ -388,48 +398,6 @@ class IOBase(object):
edge = kwargs.get("edge", None) edge = kwargs.get("edge", None)
io_new.reg_event(reg_event, as_thread=as_thread, edge=edge) io_new.reg_event(reg_event, as_thread=as_thread, edge=edge)
def reg_out(self, name, frm, **kwargs):
"""Registriert einen neuen Output.
@param name Name des neuen Outputs
@param startout Outputname ab dem eingefuegt wird
@param frm struct() formatierung (1 Zeichen)
@param kwargs Weitere Parameter:
- bmk: Bezeichnung fuer Output
- bit: Registriert Outputs als bool() am angegebenen Bit im Byte
- byteorder: Byteorder fuer den Output, Standardwert=little
- defaultvalue: Standardwert fuer Output, Standard ist 0
- event: Funktion fuer Eventhandling registrieren
- as_thread: Fuehrt die event-Funktion als RevPiCallback-Thread aus
- edge: event-Ausfuehren bei RISING, FALLING or BOTH Wertaenderung
@see <a target="_blank"
href="https://docs.python.org/3/library/struct.html#format-characters"
>Python3 struct()</a>
"""
if not issubclass(self._parentdevice, devicemodule.Gateway):
raise RuntimeError(
"this function can be used on gatway or virtual devices only"
)
# StructIO erzeugen und in IO-Liste einfügen
io_new = StructIO(
self._parentdevice,
name,
IOType.OUT,
kwargs.get("byteorder", "little"),
frm,
**kwargs
)
setattr(self._parentdevice._modio.io, name, io_new)
# Optional Event eintragen
reg_event = kwargs.get("event", None)
if reg_event is not None:
as_thread = kwargs.get("as_thread", False)
edge = kwargs.get("edge", None)
io_new.reg_event(name, reg_event, as_thread=as_thread, edge=edge)
def set_value(self, value): def set_value(self, value):
"""Setzt den Wert des IOs mit bytes() oder bool(). """Setzt den Wert des IOs mit bytes() oder bool().
@param value IO-Wert als bytes() oder bool()""" @param value IO-Wert als bytes() oder bool()"""
@@ -715,9 +683,9 @@ class StructIO(IOBase):
name, name,
kwargs.get("defaultvalue", 0), kwargs.get("defaultvalue", 0),
bitlength, bitlength,
parentio.address, parentio.slc_address.start,
False, False,
str(parentio.address).rjust(4, "0"), str(parentio.slc_address.start).rjust(4, "0"),
kwargs.get("bmk", ""), kwargs.get("bmk", ""),
bitaddress bitaddress
] ]
@@ -761,3 +729,7 @@ class StructIO(IOBase):
byteorder = property(IOBase._get_byteorder) byteorder = property(IOBase._get_byteorder)
value = property(get_structvalue, set_structvalue) value = property(get_structvalue, set_structvalue)
# Nachträglicher Import
from .device import Gateway

View File

@@ -5,6 +5,7 @@
# (c) Sven Sager, License: LGPLv3 # (c) Sven Sager, License: LGPLv3
# #
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""RevPiModIO Hauptklasse."""
import warnings import warnings
from json import load as jload from json import load as jload
from os import access, F_OK, R_OK from os import access, F_OK, R_OK
@@ -56,7 +57,6 @@ class RevPiModIO(object):
# Private Variablen # Private Variablen
self.__cleanupfunc = None self.__cleanupfunc = None
self._buffedwrite = False self._buffedwrite = False
self._device = []
self._exit = Event() self._exit = Event()
self._imgwriter = None self._imgwriter = None
self._length = 0 self._length = 0
@@ -73,7 +73,6 @@ class RevPiModIO(object):
# piCtory Klassen # piCtory Klassen
self.app = None self.app = None
self.device = None self.device = None
self.devices = None
self.io = None self.io = None
self.summary = None self.summary = None
@@ -129,7 +128,6 @@ class RevPiModIO(object):
# Device und IO Klassen anlegen # Device und IO Klassen anlegen
self.device = devicemodule.DeviceList() self.device = devicemodule.DeviceList()
#self.io = iomodule.IOList()
self.io = IOList() self.io = IOList()
# Devices initialisieren # Devices initialisieren
@@ -181,8 +179,6 @@ class RevPiModIO(object):
dev_new = None dev_new = None
if dev_new is not None: if dev_new is not None:
self._device.append(dev_new)
# Offset prüfen, muss mit Länge übereinstimmen # Offset prüfen, muss mit Länge übereinstimmen
if self._length < dev_new.offset: if self._length < dev_new.offset:
self._length = dev_new.offset self._length = dev_new.offset
@@ -196,13 +192,13 @@ class RevPiModIO(object):
# DeviceList für direkten Zugriff aufbauen # DeviceList für direkten Zugriff aufbauen
setattr(self.device, dev_new.name, dev_new) setattr(self.device, dev_new.name, dev_new)
# dict_devname zerstören, wenn doppelte Namen vorhanden sind # Namenszugriff zerstören, wenn doppelte Namen vorhanden sind
for errdev in err_names: for errdev in err_names:
delattr(self.device, errdev) delattr(self.device, errdev)
warnings.warn( warnings.warn(
"equal device name in pictory configuration. can not " "equal device name in pictory configuration. can not "
"build device to acces by name. you can access all devices " "build device to acces by name. you can access all devices "
"by position number pos_XX only!", "by position number .device[nn] only!",
Warning Warning
) )
@@ -215,7 +211,7 @@ class RevPiModIO(object):
# Optional ins auto_refresh aufnehmen # Optional ins auto_refresh aufnehmen
if self._auto_refresh: if self._auto_refresh:
for dev in self._device: for dev in self.device:
dev.auto_refresh() dev.auto_refresh()
# Summary Klasse instantiieren # Summary Klasse instantiieren
@@ -277,12 +273,11 @@ class RevPiModIO(object):
def cleanup(self): def cleanup(self):
"""Beendet auto_refresh und alle Threads.""" """Beendet auto_refresh und alle Threads."""
# TODO: wirklich alles löschen
self.exit(full=True) self.exit(full=True)
self._myfh.close() self._myfh.close()
self.app = None self.app = None
self.core = None
self.device = None self.device = None
self.devices = None
self.io = None self.io = None
self.summary = None self.summary = None
@@ -589,9 +584,8 @@ class RevPiModIO(object):
""" """
if device is None: if device is None:
mylist = self._device mylist = self.device
else: else:
# TODO: Devicesuchen ändern
dev = device if issubclass(type(device), devicemodule.Device) \ dev = device if issubclass(type(device), devicemodule.Device) \
else self.device.__getitem__(device) else self.device.__getitem__(device)
@@ -644,7 +638,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 issubclass(type(device), devicemodule.Device) \
else self.__getitem__(device) else self.__getitem__(device)
@@ -664,7 +658,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 issubclass(type(device), devicemodule.Device) \
else self.__getitem__(device) else self.__getitem__(device)
@@ -761,7 +755,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 issubclass(type(device), devicemodule.Device) \
else self.__getitem__(device) else self.__getitem__(device)
@@ -850,7 +844,7 @@ class RevPiModIOSelected(RevPiModIO):
self._configure() self._configure()
if len(self._device) == 0: if len(self.device) == 0:
if type(self) == RevPiModIODriver: if type(self) == RevPiModIODriver:
raise RuntimeError( raise RuntimeError(
"could not find any given VIRTUAL devices in config" "could not find any given VIRTUAL devices in config"
@@ -859,7 +853,7 @@ class RevPiModIOSelected(RevPiModIO):
raise RuntimeError( raise RuntimeError(
"could not find any given devices in config" "could not find any given devices in config"
) )
elif len(self._device) != len(self._lst_devselect): elif len(self.device) != len(self._lst_devselect):
if type(self) == RevPiModIODriver: if type(self) == RevPiModIODriver:
raise RuntimeError( raise RuntimeError(
"could not find all given VIRTUAL devices in config" "could not find all given VIRTUAL devices in config"