mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-30 09:13:51 +01:00
2019-01-05 Fred Gleason <fredg@paravelsystems.com>
* Added keep-alive packet support to the 'pypad_xmpad.py' PyPAD script.
This commit is contained in:
@@ -18280,3 +18280,6 @@
|
|||||||
2019-01-05 Fred Gleason <fredg@paravelsystems.com>
|
2019-01-05 Fred Gleason <fredg@paravelsystems.com>
|
||||||
* Modified the 'PyPAD.setConfigFile()' method to return a
|
* Modified the 'PyPAD.setConfigFile()' method to return a
|
||||||
configparser object.
|
configparser object.
|
||||||
|
2019-01-05 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Added keep-alive packet support to the 'pypad_xmpad.py' PyPAD
|
||||||
|
script.
|
||||||
|
|||||||
@@ -48,9 +48,6 @@ DisplaySize2=10
|
|||||||
; Record Flag. Set to 'Yes' to allow recording, or 'No' to disable.
|
; Record Flag. Set to 'Yes' to allow recording, or 'No' to disable.
|
||||||
Recording=Yes
|
Recording=Yes
|
||||||
|
|
||||||
; Heartbeat Interval. Should normally be set to '30'.
|
|
||||||
HeartbeatInterval=30
|
|
||||||
|
|
||||||
; Log Selection
|
; Log Selection
|
||||||
;
|
;
|
||||||
; Set the status for each log to 'Yes', 'No' or 'Onair' to indicate whether
|
; Set the status for each log to 'Yes', 'No' or 'Onair' to indicate whether
|
||||||
|
|||||||
@@ -122,21 +122,38 @@ def MakeB4(update,section):
|
|||||||
return b4
|
return b4
|
||||||
|
|
||||||
|
|
||||||
|
def OpenSerialDevice(config,section):
|
||||||
|
devname=config.get(section,'Device')
|
||||||
|
speed=int(config.get(section,'Speed'))
|
||||||
|
parity=serial.PARITY_NONE
|
||||||
|
if int(config.get(section,'Parity'))==1:
|
||||||
|
parity=serial.PARITY_EVEN
|
||||||
|
if int(config.get(section,'Parity'))==2:
|
||||||
|
parity=serial.PARITY_ODD
|
||||||
|
bytesize=int(config.get(section,'WordSize'))
|
||||||
|
return serial.Serial(devname,speed,parity=parity,bytesize=bytesize)
|
||||||
|
|
||||||
|
|
||||||
|
def ProcessTimer(config):
|
||||||
|
n=1
|
||||||
|
try:
|
||||||
|
while(True):
|
||||||
|
section='Serial'+str(n)
|
||||||
|
dev=OpenSerialDevice(config,section)
|
||||||
|
dev.write('H0\n'.encode('utf-8'))
|
||||||
|
dev.close()
|
||||||
|
n=n+1
|
||||||
|
|
||||||
|
except configparser.NoSectionError:
|
||||||
|
return
|
||||||
|
|
||||||
def ProcessPad(update):
|
def ProcessPad(update):
|
||||||
n=1
|
n=1
|
||||||
try:
|
try:
|
||||||
while(True):
|
while(True):
|
||||||
section='Serial'+str(n)
|
section='Serial'+str(n)
|
||||||
if update.shouldBeProcessed(section) and update.hasPadType(PyPAD.TYPE_NOW):
|
if update.shouldBeProcessed(section) and update.hasPadType(PyPAD.TYPE_NOW):
|
||||||
devname=update.config().get(section,'Device')
|
dev=OpenSerialDevice(update.config(),section)
|
||||||
speed=int(update.config().get(section,'Speed'))
|
|
||||||
parity=serial.PARITY_NONE
|
|
||||||
if int(update.config().get(section,'Parity'))==1:
|
|
||||||
parity=serial.PARITY_EVEN
|
|
||||||
if int(update.config().get(section,'Parity'))==2:
|
|
||||||
parity=serial.PARITY_ODD
|
|
||||||
bytesize=int(update.config().get(section,'WordSize'))
|
|
||||||
dev=serial.Serial(devname,speed,parity=parity,bytesize=bytesize)
|
|
||||||
b4=MakeB4(update,section)
|
b4=MakeB4(update,section)
|
||||||
a4=MakeA4(update,section)
|
a4=MakeA4(update,section)
|
||||||
a5=MakeA5(update,section)
|
a5=MakeA5(update,section)
|
||||||
@@ -163,4 +180,5 @@ except IndexError:
|
|||||||
eprint('pypad_xmpad.py: you must specify a configuration file')
|
eprint('pypad_xmpad.py: you must specify a configuration file')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
rcvr.setCallback(ProcessPad)
|
rcvr.setCallback(ProcessPad)
|
||||||
|
rcvr.setTimerCallback(30,ProcessTimer)
|
||||||
rcvr.start(sys.argv[1],int(sys.argv[2]))
|
rcvr.start(sys.argv[1],int(sys.argv[2]))
|
||||||
|
|||||||
Reference in New Issue
Block a user