Files
revpipyload/doc/revpipyload.html
NaruX cf0f136c07 Modul picontrolserver angelegt und PLCSlave-Funktionen verschoben
Kleine Anpassungen durch Übernehme von default-Zweig
2017-09-13 10:00:46 +02:00

523 lines
16 KiB
HTML

<!DOCTYPE html>
<html><head>
<title>revpipyload</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">
revpipyload</h1>
<p>
Revolution Pi Python PLC Loader.
</p><p>
Stellt das RevPiPyLoad Programm bereit. Dieses Programm lauft als Daemon auf
dem Revolution Pi. Es stellt Funktionen bereit, die es ermoeglichen ein Python
Programm zu starten und fuehrt dessen Ausgaben in eine Logdatei. Die Logdaten
koennen am Pi selber oder ueber eine XML-RPC Schnittstelle ausgelesen werden.
</p><p>
Dieser Daemon prueft ob das Python Programm noch lauft und kann es im Fall
eines Absturzes neu starten.
</p><p>
Ueber diesen Daemon kann die gesamte piCtory Konfiguration exportiert oder
importiert, ein Dump vom Prozessabbild gezogen und das eigene Python
Programm hochgeladen werden.
</p><p>
Es kann von dem Python Programm auch eine Archivdatei herunterladen werden,
welche optional auch die piCtory Konfiguraiton beinhaltet. Damit kann man sehr
schnell auf einem Revolution Pi das Programm inkl. piCtory Konfiguration
austauschen.
</p><p>
Die Zugriffsmoeglichkeiten koennen ueber einen Konfigurationsparameter
begrenzt werden!
</p>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Global Attributes</h3>
<table>
<tr><td>pyloadversion</td></tr><tr><td>re_ipacl</td></tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Classes</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad">RevPiPyLoad</a></td>
<td>Hauptklasse, die alle Funktionen zur Verfuegung stellt.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Functions</h3>
<table>
<tr>
<td><a style="color:#0000FF" href="#_ipmatch">_ipmatch</a></td>
<td>Prueft IP gegen ACL List und gibt ACL aus.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#refullmatch">refullmatch</a></td>
<td>re.fullmatch wegen alter python version aus wheezy nachgebaut.</td>
</tr>
</table>
<hr /><hr />
<a NAME="RevPiPyLoad" ID="RevPiPyLoad"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">RevPiPyLoad</h2>
<p>
Hauptklasse, die alle Funktionen zur Verfuegung stellt.
</p><p>
Hier wird die gesamte Konfiguraiton eingelesen und der ggf. aktivierte
XML-RPC-Server gestartet.
</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>root</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="#RevPiPyLoad.__init__">RevPiPyLoad</a></td>
<td>Instantiiert RevPiPyLoad-Klasse.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad._loadconfig">_loadconfig</a></td>
<td>Load configuration file and setup modul.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad._plcthread">_plcthread</a></td>
<td>Konfiguriert den PLC-Thread fuer die Ausfuehrung.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad._sigexit">_sigexit</a></td>
<td>Signal handler to clean and exit program.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad._sigloadconfig">_sigloadconfig</a></td>
<td>Signal handler to load configuration.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad._signewlogfile">_signewlogfile</a></td>
<td>Signal handler to start new logfile.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.packapp">packapp</a></td>
<td>Erzeugt aus dem PLC-Programm ein TAR/Zip-File.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.start">start</a></td>
<td>Start revpipyload.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.stop">stop</a></td>
<td>Stop revpipyload.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_getconfig">xml_getconfig</a></td>
<td>Uebertraegt die RevPiPyLoad Konfiguration.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_getfilelist">xml_getfilelist</a></td>
<td>Uebertraegt die Dateiliste vom plcworkdir.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_getpictoryrsc">xml_getpictoryrsc</a></td>
<td>Gibt die config.rsc Datei von piCotry zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_getprocimg">xml_getprocimg</a></td>
<td>Gibt die Rohdaten aus piControl0 zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcdownload">xml_plcdownload</a></td>
<td>Uebertraegt ein Archiv vom plcworkdir.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcexitcode">xml_plcexitcode</a></td>
<td>Gibt den aktuellen exitcode vom PLC Programm zurueck.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcrunning">xml_plcrunning</a></td>
<td>Prueft ob das PLC Programm noch lauft.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcslavestart">xml_plcslavestart</a></td>
<td>Startet den PLC Slave Server.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcslavestop">xml_plcslavestop</a></td>
<td>Stoppt den PLC Slave Server.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcstart">xml_plcstart</a></td>
<td>Startet das PLC Programm.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcstop">xml_plcstop</a></td>
<td>Stoppt das PLC Programm.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcupload">xml_plcupload</a></td>
<td>Empfaengt Dateien fuer das PLC Programm einzeln.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_plcuploadclean">xml_plcuploadclean</a></td>
<td>Loescht das gesamte plcworkdir Verzeichnis.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_psstart">xml_psstart</a></td>
<td>Startet den Prozessabbildserver.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_psstop">xml_psstop</a></td>
<td>Stoppt den Prozessabbildserver.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_reload">xml_reload</a></td>
<td>Startet RevPiPyLoad neu und verwendet neue Konfiguraiton.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_setconfig">xml_setconfig</a></td>
<td>Empfaengt die RevPiPyLoad Konfiguration.</td>
</tr><tr>
<td><a style="color:#0000FF" href="#RevPiPyLoad.xml_setpictoryrsc">xml_setpictoryrsc</a></td>
<td>Schreibt die config.rsc Datei von piCotry.</td>
</tr>
</table>
<h3 style="background-color:#FFFFFF;color:#FF0000">
Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="RevPiPyLoad.__init__" ID="RevPiPyLoad.__init__"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad (Constructor)</h3>
<b>RevPiPyLoad</b>(<i></i>)
<p>
Instantiiert RevPiPyLoad-Klasse.
</p><a NAME="RevPiPyLoad._loadconfig" ID="RevPiPyLoad._loadconfig"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad._loadconfig</h3>
<b>_loadconfig</b>(<i></i>)
<p>
Load configuration file and setup modul.
</p><a NAME="RevPiPyLoad._plcthread" ID="RevPiPyLoad._plcthread"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad._plcthread</h3>
<b>_plcthread</b>(<i></i>)
<p>
Konfiguriert den PLC-Thread fuer die Ausfuehrung.
</p><dl>
<dt>Returns:</dt>
<dd>
PLC-Thread Object or None
</dd>
</dl><a NAME="RevPiPyLoad._sigexit" ID="RevPiPyLoad._sigexit"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad._sigexit</h3>
<b>_sigexit</b>(<i>signum, frame</i>)
<p>
Signal handler to clean and exit program.
</p><a NAME="RevPiPyLoad._sigloadconfig" ID="RevPiPyLoad._sigloadconfig"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad._sigloadconfig</h3>
<b>_sigloadconfig</b>(<i>signum, frame</i>)
<p>
Signal handler to load configuration.
</p><a NAME="RevPiPyLoad._signewlogfile" ID="RevPiPyLoad._signewlogfile"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad._signewlogfile</h3>
<b>_signewlogfile</b>(<i>signum, frame</i>)
<p>
Signal handler to start new logfile.
</p><a NAME="RevPiPyLoad.packapp" ID="RevPiPyLoad.packapp"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.packapp</h3>
<b>packapp</b>(<i>mode="tar", pictory=False</i>)
<p>
Erzeugt aus dem PLC-Programm ein TAR/Zip-File.
</p><dl>
<dt><i>mode</i></dt>
<dd>
Packart 'tar' oder 'zip'
</dd><dt><i>pictory</i></dt>
<dd>
piCtory Konfiguration mit einpacken
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
Dateinamen des Archivs
</dd>
</dl><a NAME="RevPiPyLoad.start" ID="RevPiPyLoad.start"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.start</h3>
<b>start</b>(<i></i>)
<p>
Start revpipyload.
</p><a NAME="RevPiPyLoad.stop" ID="RevPiPyLoad.stop"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.stop</h3>
<b>stop</b>(<i></i>)
<p>
Stop revpipyload.
</p><a NAME="RevPiPyLoad.xml_getconfig" ID="RevPiPyLoad.xml_getconfig"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_getconfig</h3>
<b>xml_getconfig</b>(<i></i>)
<p>
Uebertraegt die RevPiPyLoad Konfiguration.
</p><dl>
<dt>Returns:</dt>
<dd>
dict() der Konfiguration
</dd>
</dl><a NAME="RevPiPyLoad.xml_getfilelist" ID="RevPiPyLoad.xml_getfilelist"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_getfilelist</h3>
<b>xml_getfilelist</b>(<i></i>)
<p>
Uebertraegt die Dateiliste vom plcworkdir.
</p><dl>
<dt>Returns:</dt>
<dd>
list() mit Dateinamen
</dd>
</dl><a NAME="RevPiPyLoad.xml_getpictoryrsc" ID="RevPiPyLoad.xml_getpictoryrsc"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_getpictoryrsc</h3>
<b>xml_getpictoryrsc</b>(<i></i>)
<p>
Gibt die config.rsc Datei von piCotry zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
xmlrpc.client.Binary()
</dd>
</dl><a NAME="RevPiPyLoad.xml_getprocimg" ID="RevPiPyLoad.xml_getprocimg"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_getprocimg</h3>
<b>xml_getprocimg</b>(<i></i>)
<p>
Gibt die Rohdaten aus piControl0 zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
xmlrpc.client.Binary()
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcdownload" ID="RevPiPyLoad.xml_plcdownload"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcdownload</h3>
<b>xml_plcdownload</b>(<i>mode="tar", pictory=False</i>)
<p>
Uebertraegt ein Archiv vom plcworkdir.
</p><dl>
<dt><i>mode</i></dt>
<dd>
Archivart 'tar' 'zip'
</dd><dt><i>pictory</i></dt>
<dd>
piCtory Konfiguraiton mit einpacken
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
Binary() mit Archivdatei
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcexitcode" ID="RevPiPyLoad.xml_plcexitcode"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcexitcode</h3>
<b>xml_plcexitcode</b>(<i></i>)
<p>
Gibt den aktuellen exitcode vom PLC Programm zurueck.
</p><dl>
<dt>Returns:</dt>
<dd>
int() exitcode oder:
-1 laeuft noch
-2 Datei nicht gefunden
-3 Lief nie
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcrunning" ID="RevPiPyLoad.xml_plcrunning"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcrunning</h3>
<b>xml_plcrunning</b>(<i></i>)
<p>
Prueft ob das PLC Programm noch lauft.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn das PLC Programm noch lauft
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcslavestart" ID="RevPiPyLoad.xml_plcslavestart"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcslavestart</h3>
<b>xml_plcslavestart</b>(<i></i>)
<p>
Startet den PLC Slave Server.
</p><dl>
<dt>Returns:</dt>
<dd>
Statuscode:
0: erfolgreich gestartet
-1: Nicht aktiv in Konfiguration
-2: Laeuft bereits
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcslavestop" ID="RevPiPyLoad.xml_plcslavestop"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcslavestop</h3>
<b>xml_plcslavestop</b>(<i></i>)
<p>
Stoppt den PLC Slave Server.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn stop erfolgreich
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcstart" ID="RevPiPyLoad.xml_plcstart"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcstart</h3>
<b>xml_plcstart</b>(<i></i>)
<p>
Startet das PLC Programm.
</p><dl>
<dt>Returns:</dt>
<dd>
int() Status:
-0 Erfolgreich
-1 Programm lauft noch
-2 Datei nicht gefunden
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcstop" ID="RevPiPyLoad.xml_plcstop"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcstop</h3>
<b>xml_plcstop</b>(<i></i>)
<p>
Stoppt das PLC Programm.
</p><dl>
<dt>Returns:</dt>
<dd>
int() Exitcode vom PLC Programm
-0 Erfolgreich
-1 PLC Programm lief nicht
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcupload" ID="RevPiPyLoad.xml_plcupload"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcupload</h3>
<b>xml_plcupload</b>(<i>filedata, filename</i>)
<p>
Empfaengt Dateien fuer das PLC Programm einzeln.
</p><dl>
<dt><i>filedata</i></dt>
<dd>
GZIP Binary data der datei
</dd><dt><i>filename</i></dt>
<dd>
Name inkl. Unterverzeichnis der Datei
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
Ture, wenn Datei erfolgreich gespeichert wurde
</dd>
</dl><a NAME="RevPiPyLoad.xml_plcuploadclean" ID="RevPiPyLoad.xml_plcuploadclean"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_plcuploadclean</h3>
<b>xml_plcuploadclean</b>(<i></i>)
<p>
Loescht das gesamte plcworkdir Verzeichnis.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn erfolgreich
</dd>
</dl><a NAME="RevPiPyLoad.xml_psstart" ID="RevPiPyLoad.xml_psstart"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_psstart</h3>
<b>xml_psstart</b>(<i></i>)
<p>
Startet den Prozessabbildserver.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn start erfolgreich
</dd>
</dl><a NAME="RevPiPyLoad.xml_psstop" ID="RevPiPyLoad.xml_psstop"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_psstop</h3>
<b>xml_psstop</b>(<i></i>)
<p>
Stoppt den Prozessabbildserver.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn stop erfolgreich
</dd>
</dl><a NAME="RevPiPyLoad.xml_reload" ID="RevPiPyLoad.xml_reload"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_reload</h3>
<b>xml_reload</b>(<i></i>)
<p>
Startet RevPiPyLoad neu und verwendet neue Konfiguraiton.
</p><a NAME="RevPiPyLoad.xml_setconfig" ID="RevPiPyLoad.xml_setconfig"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_setconfig</h3>
<b>xml_setconfig</b>(<i>dc, loadnow=False</i>)
<p>
Empfaengt die RevPiPyLoad Konfiguration.
</p><dl>
<dt>Returns:</dt>
<dd>
True, wenn erfolgreich angewendet
</dd>
</dl><a NAME="RevPiPyLoad.xml_setpictoryrsc" ID="RevPiPyLoad.xml_setpictoryrsc"></a>
<h3 style="background-color:#FFFFFF;color:#FF0000">
RevPiPyLoad.xml_setpictoryrsc</h3>
<b>xml_setpictoryrsc</b>(<i>filebytes, reset=False</i>)
<p>
Schreibt die config.rsc Datei von piCotry.
</p><dl>
<dt><i>filebytes</i></dt>
<dd>
xmlrpc.client.Binary()-Objekt
</dd><dt><i>reset</i></dt>
<dd>
Reset piControl Device
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
Statuscode:
-0 Alles erfolgreich
-1 Kann JSON-Datei nicht laden
-2 piCtory Elemente in JSON-Datei nicht gefunden
-3 Konnte Konfiguraiton nicht schreiben
-4 Module in Konfiguration enthalten, die es nicht gibt
-5 Kein RAP Katalog zur Ueberpruefung gefunden
Positive Zahl ist exitcode von piControlReset
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="_ipmatch" ID="_ipmatch"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">_ipmatch</h2>
<b>_ipmatch</b>(<i>ipaddress, dict_acl</i>)
<p>
Prueft IP gegen ACL List und gibt ACL aus.
</p><dl>
<dt><i>ipaddress</i></dt>
<dd>
zum pruefen
</dd><dt><i>dict_acl</i></dt>
<dd>
ACL Dict gegen die IP zu pruefen ist
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
int() ACL Wert oder -1 wenn nicht gefunden
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr /><hr />
<a NAME="refullmatch" ID="refullmatch"></a>
<h2 style="background-color:#FFFFFF;color:#0000FF">refullmatch</h2>
<b>refullmatch</b>(<i>regex, string</i>)
<p>
re.fullmatch wegen alter python version aus wheezy nachgebaut.
</p><dl>
<dt><i>regex</i></dt>
<dd>
RegEx Statement
</dd><dt><i>string</i></dt>
<dd>
Zeichenfolge gegen die getestet wird
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
True, wenn komplett passt sonst False
</dd>
</dl>
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
<hr />
</body></html>