mirror of
https://github.com/naruxde/revpipyload.git
synced 2025-11-08 15:13:52 +01:00
Neuen NetworkFileHandler implementiert
This commit is contained in:
@@ -49,12 +49,21 @@ Classes</h3>
|
|||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a style="color:#0000FF" href="#RevPiPyLoad">RevPiPyLoad</a></td>
|
<td><a style="color:#0000FF" href="#RevPiPyLoad">RevPiPyLoad</a></td>
|
||||||
<td>Hauptklasse, die alle Funktionen zur Verfuegung stellt.</td>
|
<td>Hauptklasse, die alle Funktionen zur Verfuegung stellt.</td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><a style="color:#0000FF" href="#RevPiSlave">RevPiSlave</a></td>
|
||||||
|
<td></td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><a style="color:#0000FF" href="#RevPiSlaveDev">RevPiSlaveDev</a></td>
|
||||||
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
Functions</h3>
|
Functions</h3>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>None</td></tr>
|
<tr>
|
||||||
|
<td><a style="color:#0000FF" href="#_zeroprocimg">_zeroprocimg</a></td>
|
||||||
|
<td>Setzt Prozessabbild auf NULL.</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<hr /><hr />
|
<hr /><hr />
|
||||||
<a NAME="LogReader" ID="LogReader"></a>
|
<a NAME="LogReader" ID="LogReader"></a>
|
||||||
@@ -312,9 +321,6 @@ Methods</h3>
|
|||||||
<td><a style="color:#0000FF" href="#RevPiPlc._spopen">_spopen</a></td>
|
<td><a style="color:#0000FF" href="#RevPiPlc._spopen">_spopen</a></td>
|
||||||
<td>Startet das PLC Programm.</td>
|
<td>Startet das PLC Programm.</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td><a style="color:#0000FF" href="#RevPiPlc._zeroprocimg">_zeroprocimg</a></td>
|
|
||||||
<td>Setzt Prozessabbild auf NULL.</td>
|
|
||||||
</tr><tr>
|
|
||||||
<td><a style="color:#0000FF" href="#RevPiPlc.newlogfile">newlogfile</a></td>
|
<td><a style="color:#0000FF" href="#RevPiPlc.newlogfile">newlogfile</a></td>
|
||||||
<td>Konfiguriert die FileHandler auf neue Logdatei.</td>
|
<td>Konfiguriert die FileHandler auf neue Logdatei.</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
@@ -369,13 +375,7 @@ Prozessliste
|
|||||||
<dd>
|
<dd>
|
||||||
subprocess
|
subprocess
|
||||||
</dd>
|
</dd>
|
||||||
</dl><a NAME="RevPiPlc._zeroprocimg" ID="RevPiPlc._zeroprocimg"></a>
|
</dl><a NAME="RevPiPlc.newlogfile" ID="RevPiPlc.newlogfile"></a>
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
|
||||||
RevPiPlc._zeroprocimg</h3>
|
|
||||||
<b>_zeroprocimg</b>(<i></i>)
|
|
||||||
<p>
|
|
||||||
Setzt Prozessabbild auf NULL.
|
|
||||||
</p><a NAME="RevPiPlc.newlogfile" ID="RevPiPlc.newlogfile"></a>
|
|
||||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
RevPiPlc.newlogfile</h3>
|
RevPiPlc.newlogfile</h3>
|
||||||
<b>newlogfile</b>(<i></i>)
|
<b>newlogfile</b>(<i></i>)
|
||||||
@@ -788,5 +788,126 @@ Statuscode:
|
|||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||||
|
<hr /><hr />
|
||||||
|
<a NAME="RevPiSlave" ID="RevPiSlave"></a>
|
||||||
|
<h2 style="background-color:#FFFFFF;color:#0000FF">RevPiSlave</h2>
|
||||||
|
|
||||||
|
<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="#RevPiSlave.__init__">RevPiSlave</a></td>
|
||||||
|
<td>Instantiiert RevPiSlave-Klasse.</td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><a style="color:#0000FF" href="#RevPiSlave.newlogfile">newlogfile</a></td>
|
||||||
|
<td>Konfiguriert die FileHandler auf neue Logdatei.</td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><a style="color:#0000FF" href="#RevPiSlave.run">run</a></td>
|
||||||
|
<td></td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><a style="color:#0000FF" href="#RevPiSlave.stop">stop</a></td>
|
||||||
|
<td>Beendet Slaveausfuehrung.</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
Static Methods</h3>
|
||||||
|
<table>
|
||||||
|
<tr><td>None</td></tr>
|
||||||
|
</table>
|
||||||
|
<a NAME="RevPiSlave.__init__" ID="RevPiSlave.__init__"></a>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
RevPiSlave (Constructor)</h3>
|
||||||
|
<b>RevPiSlave</b>(<i></i>)
|
||||||
|
<p>
|
||||||
|
Instantiiert RevPiSlave-Klasse.
|
||||||
|
</p><a NAME="RevPiSlave.newlogfile" ID="RevPiSlave.newlogfile"></a>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
RevPiSlave.newlogfile</h3>
|
||||||
|
<b>newlogfile</b>(<i></i>)
|
||||||
|
<p>
|
||||||
|
Konfiguriert die FileHandler auf neue Logdatei.
|
||||||
|
</p><a NAME="RevPiSlave.run" ID="RevPiSlave.run"></a>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
RevPiSlave.run</h3>
|
||||||
|
<b>run</b>(<i></i>)
|
||||||
|
<a NAME="RevPiSlave.stop" ID="RevPiSlave.stop"></a>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
RevPiSlave.stop</h3>
|
||||||
|
<b>stop</b>(<i></i>)
|
||||||
|
<p>
|
||||||
|
Beendet Slaveausfuehrung.
|
||||||
|
</p>
|
||||||
|
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||||
|
<hr /><hr />
|
||||||
|
<a NAME="RevPiSlaveDev" ID="RevPiSlaveDev"></a>
|
||||||
|
<h2 style="background-color:#FFFFFF;color:#0000FF">RevPiSlaveDev</h2>
|
||||||
|
|
||||||
|
<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="#RevPiSlaveDev.__init__">RevPiSlaveDev</a></td>
|
||||||
|
<td></td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><a style="color:#0000FF" href="#RevPiSlaveDev.run">run</a></td>
|
||||||
|
<td></td>
|
||||||
|
</tr><tr>
|
||||||
|
<td><a style="color:#0000FF" href="#RevPiSlaveDev.stop">stop</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="RevPiSlaveDev.__init__" ID="RevPiSlaveDev.__init__"></a>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
RevPiSlaveDev (Constructor)</h3>
|
||||||
|
<b>RevPiSlaveDev</b>(<i>devcon, deadtime</i>)
|
||||||
|
<a NAME="RevPiSlaveDev.run" ID="RevPiSlaveDev.run"></a>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
RevPiSlaveDev.run</h3>
|
||||||
|
<b>run</b>(<i></i>)
|
||||||
|
<a NAME="RevPiSlaveDev.stop" ID="RevPiSlaveDev.stop"></a>
|
||||||
|
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||||
|
RevPiSlaveDev.stop</h3>
|
||||||
|
<b>stop</b>(<i></i>)
|
||||||
|
|
||||||
|
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||||
|
<hr /><hr />
|
||||||
|
<a NAME="_zeroprocimg" ID="_zeroprocimg"></a>
|
||||||
|
<h2 style="background-color:#FFFFFF;color:#0000FF">_zeroprocimg</h2>
|
||||||
|
<b>_zeroprocimg</b>(<i></i>)
|
||||||
|
<p>
|
||||||
|
Setzt Prozessabbild auf NULL.
|
||||||
|
</p>
|
||||||
|
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||||
<hr />
|
<hr />
|
||||||
</body></html>
|
</body></html>
|
||||||
@@ -29,7 +29,6 @@ revpipyload.PipeLogwriter?1(logfilename)
|
|||||||
revpipyload.RevPiPlc._configureplw?5()
|
revpipyload.RevPiPlc._configureplw?5()
|
||||||
revpipyload.RevPiPlc._setuppopen?5()
|
revpipyload.RevPiPlc._setuppopen?5()
|
||||||
revpipyload.RevPiPlc._spopen?5(lst_proc)
|
revpipyload.RevPiPlc._spopen?5(lst_proc)
|
||||||
revpipyload.RevPiPlc._zeroprocimg?5()
|
|
||||||
revpipyload.RevPiPlc.newlogfile?4()
|
revpipyload.RevPiPlc.newlogfile?4()
|
||||||
revpipyload.RevPiPlc.run?4()
|
revpipyload.RevPiPlc.run?4()
|
||||||
revpipyload.RevPiPlc.stop?4()
|
revpipyload.RevPiPlc.stop?4()
|
||||||
@@ -60,6 +59,14 @@ revpipyload.RevPiPyLoad.xml_reload?4()
|
|||||||
revpipyload.RevPiPyLoad.xml_setconfig?4(dc, loadnow=False)
|
revpipyload.RevPiPyLoad.xml_setconfig?4(dc, loadnow=False)
|
||||||
revpipyload.RevPiPyLoad.xml_setpictoryrsc?4(filebytes, reset=False)
|
revpipyload.RevPiPyLoad.xml_setpictoryrsc?4(filebytes, reset=False)
|
||||||
revpipyload.RevPiPyLoad?1()
|
revpipyload.RevPiPyLoad?1()
|
||||||
|
revpipyload.RevPiSlave.newlogfile?4()
|
||||||
|
revpipyload.RevPiSlave.run?4()
|
||||||
|
revpipyload.RevPiSlave.stop?4()
|
||||||
|
revpipyload.RevPiSlave?1()
|
||||||
|
revpipyload.RevPiSlaveDev.run?4()
|
||||||
|
revpipyload.RevPiSlaveDev.stop?4()
|
||||||
|
revpipyload.RevPiSlaveDev?1(devcon, deadtime)
|
||||||
|
revpipyload._zeroprocimg?5()
|
||||||
revpipyload.configrsc?7
|
revpipyload.configrsc?7
|
||||||
revpipyload.picontrolreset?7
|
revpipyload.picontrolreset?7
|
||||||
revpipyload.procimg?7
|
revpipyload.procimg?7
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
PipeLogwriter Thread
|
PipeLogwriter Thread
|
||||||
RevPiPlc Thread
|
RevPiPlc Thread
|
||||||
|
RevPiSlave Thread
|
||||||
|
RevPiSlaveDev Thread
|
||||||
|
|||||||
@@ -499,6 +499,7 @@ class RevPiSlave(Thread):
|
|||||||
def stop(self):
|
def stop(self):
|
||||||
"""Beendet Slaveausfuehrung."""
|
"""Beendet Slaveausfuehrung."""
|
||||||
proginit.logger.debug("enter RevPiSlave.stop()")
|
proginit.logger.debug("enter RevPiSlave.stop()")
|
||||||
|
|
||||||
self._evt_exit.set()
|
self._evt_exit.set()
|
||||||
self.so.shutdown(socket.SHUT_RDWR)
|
self.so.shutdown(socket.SHUT_RDWR)
|
||||||
|
|
||||||
@@ -521,7 +522,7 @@ class RevPiSlaveDev(Thread):
|
|||||||
def run(self):
|
def run(self):
|
||||||
proginit.logger.debug("enter RevPiSlaveDev.run()")
|
proginit.logger.debug("enter RevPiSlaveDev.run()")
|
||||||
|
|
||||||
msgcli = [b'DATA', b'PICT', b'SEND', b'CONF']
|
msgcli = [b'DATA', b'PICT', b'SEND']
|
||||||
proginit.logger.info("connected from {}".format(self._addr))
|
proginit.logger.info("connected from {}".format(self._addr))
|
||||||
|
|
||||||
# Prozessabbild öffnen
|
# Prozessabbild öffnen
|
||||||
@@ -530,8 +531,8 @@ class RevPiSlaveDev(Thread):
|
|||||||
while not self._evt_exit.is_set():
|
while not self._evt_exit.is_set():
|
||||||
# Meldung erhalten
|
# Meldung erhalten
|
||||||
try:
|
try:
|
||||||
netcmd = self._devcon.recv(4)
|
netcmd = self._devcon.recv(16)
|
||||||
#proginit.logger.debug("command {}".format(netcmd))
|
# proginit.logger.debug("command {}".format(netcmd))
|
||||||
except:
|
except:
|
||||||
break
|
break
|
||||||
|
|
||||||
@@ -539,10 +540,11 @@ class RevPiSlaveDev(Thread):
|
|||||||
ot = default_timer()
|
ot = default_timer()
|
||||||
|
|
||||||
# Wenn Meldung ungültig ist aussteigen
|
# Wenn Meldung ungültig ist aussteigen
|
||||||
if netcmd not in msgcli:
|
cmd = netcmd[:4]
|
||||||
|
if cmd not in msgcli:
|
||||||
break
|
break
|
||||||
|
|
||||||
if netcmd == b'PICT':
|
if cmd == b'PICT':
|
||||||
# piCtory Konfiguration senden
|
# piCtory Konfiguration senden
|
||||||
proginit.logger.debug(
|
proginit.logger.debug(
|
||||||
"transfair pictory configuration: {}".format(configrsc)
|
"transfair pictory configuration: {}".format(configrsc)
|
||||||
@@ -560,49 +562,36 @@ class RevPiSlaveDev(Thread):
|
|||||||
self._devcon.send(b'PICOK')
|
self._devcon.send(b'PICOK')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if netcmd == b'CONF':
|
if cmd == b'DATA':
|
||||||
meldung = self._devcon.recv(16)
|
|
||||||
|
|
||||||
# Konfiguraiton zerlegen
|
|
||||||
try:
|
|
||||||
self._startvalr = int(meldung[0:4])
|
|
||||||
except:
|
|
||||||
self._devcon.send(b'CFGXX')
|
|
||||||
continue
|
|
||||||
try:
|
|
||||||
self._lenvalr = int(meldung[4:8])
|
|
||||||
except:
|
|
||||||
self._devcon.send(b'CFGXX')
|
|
||||||
continue
|
|
||||||
try:
|
|
||||||
self._startvalw = int(meldung[8:12])
|
|
||||||
except:
|
|
||||||
self._devcon.send(b'CFGXX')
|
|
||||||
continue
|
|
||||||
try:
|
|
||||||
self._lenvalw = int(meldung[12:16])
|
|
||||||
except:
|
|
||||||
self._devcon.send(b'CFGXX')
|
|
||||||
continue
|
|
||||||
self._devcon.send(b'CFGOK')
|
|
||||||
|
|
||||||
if netcmd == b'DATA':
|
|
||||||
# Processabbild übertragen
|
# Processabbild übertragen
|
||||||
fh_proc.seek(self._startvalr)
|
# CMD_|POS_|LEN_|RSVE = 16
|
||||||
|
|
||||||
|
position = int(netcmd[4:8])
|
||||||
|
length = int(netcmd[8:12])
|
||||||
|
|
||||||
|
fh_proc.seek(position)
|
||||||
try:
|
try:
|
||||||
self._devcon.sendall(fh_proc.read(self._lenvalr))
|
self._devcon.sendall(fh_proc.read(length))
|
||||||
except:
|
except:
|
||||||
break
|
break
|
||||||
|
|
||||||
if netcmd == b'SEND':
|
if cmd == b'SEND':
|
||||||
# Ausgänge empfangen
|
# Ausgänge empfangen
|
||||||
try:
|
# CMD_|POS_|LEN_|RSVE = 16
|
||||||
block = self._devcon.recv(self._lenvalw)
|
|
||||||
except:
|
position = int(netcmd[4:8])
|
||||||
break
|
length = int(netcmd[8:12])
|
||||||
fh_proc.seek(self._startvalw)
|
|
||||||
|
# try:
|
||||||
|
block = self._devcon.recv(length)
|
||||||
|
# except:
|
||||||
|
# break
|
||||||
|
fh_proc.seek(position)
|
||||||
fh_proc.write(block)
|
fh_proc.write(block)
|
||||||
|
|
||||||
|
# Record seperator
|
||||||
|
self._devcon.send(b'\x1e')
|
||||||
|
|
||||||
# Verarbeitungszeit prüfen
|
# Verarbeitungszeit prüfen
|
||||||
comtime = default_timer() - ot
|
comtime = default_timer() - ot
|
||||||
if comtime > self._deadtime:
|
if comtime > self._deadtime:
|
||||||
@@ -611,7 +600,7 @@ class RevPiSlaveDev(Thread):
|
|||||||
int(self._deadtime * 1000), int(comtime * 1000)
|
int(self._deadtime * 1000), int(comtime * 1000)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
#break
|
# break
|
||||||
|
|
||||||
fh_proc.close()
|
fh_proc.close()
|
||||||
self._devcon.close()
|
self._devcon.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user