mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
starting rigctld from daemon
This commit is contained in:
parent
599995ef17
commit
a03dd14a33
2 changed files with 39 additions and 8 deletions
|
@ -108,10 +108,6 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||||
#print(received_json["type"])
|
#print(received_json["type"])
|
||||||
#print(received_json["command"])
|
#print(received_json["command"])
|
||||||
try:
|
try:
|
||||||
#print(static.TNCSTARTED)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if received_json["type"] == 'SET' and received_json["command"] == 'STARTTNC' and not static.TNCSTARTED:
|
if received_json["type"] == 'SET' and received_json["command"] == 'STARTTNC' and not static.TNCSTARTED:
|
||||||
rx_audio = received_json["parameter"][0]["rx_audio"]
|
rx_audio = received_json["parameter"][0]["rx_audio"]
|
||||||
|
@ -120,17 +116,51 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||||
deviceport = received_json["parameter"][0]["deviceport"]
|
deviceport = received_json["parameter"][0]["deviceport"]
|
||||||
serialspeed = received_json["parameter"][0]["serialspeed"]
|
serialspeed = received_json["parameter"][0]["serialspeed"]
|
||||||
ptt = received_json["parameter"][0]["ptt"]
|
ptt = received_json["parameter"][0]["ptt"]
|
||||||
print("STARTING TNC !!!!!")
|
print("---- STARTING TNC !")
|
||||||
print(received_json["parameter"][0])
|
print(received_json["parameter"][0])
|
||||||
#os.system("python3 main.py --rx 3 --tx 3 --deviceport /dev/ttyUSB0 --deviceid 2028")
|
#os.system("python3 main.py --rx 3 --tx 3 --deviceport /dev/ttyUSB0 --deviceid 2028")
|
||||||
|
|
||||||
|
|
||||||
|
# Start RIGCTLD
|
||||||
|
|
||||||
|
if ptt == "RTS":
|
||||||
|
dtr_state = "OFF"
|
||||||
|
else:
|
||||||
|
dtr_state = "NONE"
|
||||||
|
|
||||||
|
if sys.platform == "linux":
|
||||||
|
command = "exec ./hamlib/linux/rigctld -r " + str(deviceport) + \
|
||||||
|
" -s "+ str(serialspeed) + \
|
||||||
|
" -P "+ str(ptt) + \
|
||||||
|
" -m "+ str(deviceid) + \
|
||||||
|
" --set-conf=dtr_state=" + dtr_state
|
||||||
|
try:
|
||||||
|
p = subprocess.Popen(command, shell=True)
|
||||||
|
except:
|
||||||
|
print("hamlib not started")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
elif sys.platform == "darwin":
|
||||||
|
print("platform not yet supported")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
elif sys.platform == "win32":
|
||||||
|
print("platform not yet supported")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("platform not supported!")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
p = subprocess.Popen("exec python3 main.py --rx "+ str(rx_audio) +" --tx "+ str(tx_audio) +" --deviceport "+ str(deviceport) +" --deviceid "+ str(deviceid) + " --serialspeed "+ str(serialspeed) + " --ptt "+ str(ptt), shell=True)
|
p = subprocess.Popen("exec python3 main.py --rx "+ str(rx_audio) +" --tx "+ str(tx_audio) +" --deviceport "+ str(deviceport) +" --deviceid "+ str(deviceid) + " --serialspeed "+ str(serialspeed) + " --ptt "+ str(ptt), shell=True)
|
||||||
else:
|
else:
|
||||||
p = subprocess.Popen("exec ./tnc --rx "+ str(rx_audio) +" --tx "+ str(tx_audio) +" --deviceport "+ str(deviceport) +" --deviceid "+ str(deviceid) + " --serialspeed "+ str(serialspeed) + " --ptt "+ str(ptt), shell=True)
|
p = subprocess.Popen("exec ./tnc --rx "+ str(rx_audio) +" --tx "+ str(tx_audio) +" --deviceport "+ str(deviceport) +" --deviceid "+ str(deviceid) + " --serialspeed "+ str(serialspeed) + " --ptt "+ str(ptt), shell=True)
|
||||||
static.TNCPROCESS = p#.pid
|
static.TNCPROCESS = p#.pid
|
||||||
#print(parameter)
|
|
||||||
# print(static.TNCPROCESS)
|
|
||||||
static.TNCSTARTED = True
|
static.TNCSTARTED = True
|
||||||
|
|
||||||
if received_json["type"] == 'SET' and received_json["command"] == 'STOPTNC':
|
if received_json["type"] == 'SET' and received_json["command"] == 'STOPTNC':
|
||||||
|
|
|
@ -55,7 +55,7 @@ if __name__ == '__main__':
|
||||||
WATCHDOG_SERVER_THREAD = threading.Thread(target=helpers.watchdog, name="watchdog")
|
WATCHDOG_SERVER_THREAD = threading.Thread(target=helpers.watchdog, name="watchdog")
|
||||||
WATCHDOG_SERVER_THREAD.start()
|
WATCHDOG_SERVER_THREAD.start()
|
||||||
|
|
||||||
|
'''
|
||||||
# Start RIGCTLD
|
# Start RIGCTLD
|
||||||
|
|
||||||
if static.HAMLIB_PTT_TYPE == "RTS":
|
if static.HAMLIB_PTT_TYPE == "RTS":
|
||||||
|
@ -86,3 +86,4 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
print("platform not supported!")
|
print("platform not supported!")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
'''
|
||||||
|
|
Loading…
Reference in a new issue