git cli test

This commit is contained in:
DJ2LS 2021-09-16 17:17:55 +02:00
parent 3dd820ea50
commit 15102346c7
2 changed files with 30 additions and 13 deletions

View file

@ -163,12 +163,24 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
command = "--rx "+ str(rx_audio) +" \
--tx "+ str(tx_audio) +" \
--deviceport "+ str(deviceport) +" \
--deviceid "+ str(deviceid) + " \
--serialspeed "+ str(serialspeed) + " \
--pttprotocol "+ str(pttprotocol) + " \
--pttport "+ str(pttport)
# try running tnc from binary, else run from source
if DEBUG: # this helps running the tnc in a developer environment
p = subprocess.Popen("exec python3 main.py --rx "+ str(rx_audio) +" --tx "+ str(tx_audio) +" --deviceport "+ str(deviceport) +" --deviceid "+ str(deviceid) + " --serialspeed "+ str(serialspeed) + " --pttprotocol "+ str(pttprotocol) + " --pttport "+ str(pttport), shell=True) try:
else: subprocess.check_call("exec ./tnc " + command)
p = subprocess.Popen("exec ./tnc --rx "+ str(rx_audio) +" --tx "+ str(tx_audio) +" --deviceport "+ str(deviceport) +" --deviceid "+ str(deviceid) + " --serialspeed "+ str(serialspeed) + " --pttprotocol "+ str(pttprotocol) + " --pttport "+ str(pttport), shell=True) p = subprocess.Popen("exec ./tnc " + command, shell=True)
print("running TNC from binary...")
except:
p = subprocess.Popen("exec python3 main.py " + command, shell=True)
print("running TNC from source...")
static.TNCPROCESS = p#.pid static.TNCPROCESS = p#.pid
static.TNCSTARTED = True static.TNCSTARTED = True
@ -234,12 +246,12 @@ if __name__ == '__main__':
# --------------------------------------------GET PARAMETER INPUTS # --------------------------------------------GET PARAMETER INPUTS
PARSER = argparse.ArgumentParser(description='Simons TEST TNC') PARSER = argparse.ArgumentParser(description='Simons TEST TNC')
PARSER.add_argument('--port', dest="socket_port", default=3001, help="Socket port", type=int) PARSER.add_argument('--port', dest="socket_port", default=3001, help="Socket port", type=int)
PARSER.add_argument('--debug', dest="debug", action='store_true')
ARGS = PARSER.parse_args() ARGS = PARSER.parse_args()
PORT = ARGS.socket_port PORT = ARGS.socket_port
DEBUG = ARGS.debug
# --------------------------------------------START CMD SERVER # --------------------------------------------START CMD SERVER
DAEMON_THREAD = threading.Thread(target=start_daemon, name="daemon") DAEMON_THREAD = threading.Thread(target=start_daemon, name="daemon")

View file

@ -24,8 +24,15 @@ import data_handler
import sys import sys
#sys.path.append("hamlib/linux") #sys.path.append("hamlib/linux")
#import Hamlib try:
from hamlib.linux import Hamlib import Hamlib
print("running Hamlib from Sys Path")
except ImportError:
from hamlib.linux import Hamlib
print("running Hamlib from precompiled bundle")
else:
# place for rigctld
pass
import numpy as np import numpy as np
#import rigctld #import rigctld
@ -49,12 +56,9 @@ class MODEMSTATS(ctypes.Structure):
("pre", ctypes.c_int), ("pre", ctypes.c_int),
("post", ctypes.c_int), ("post", ctypes.c_int),
("uw_fails", ctypes.c_int), ("uw_fails", ctypes.c_int),
] ]
class RF(): class RF():
def __init__(self): def __init__(self):
@ -138,8 +142,9 @@ class RF():
if static.HAMLIB_PTT_TYPE == 'RIG_PTT_RIG': if static.HAMLIB_PTT_TYPE == 'RIG_PTT_RIG':
self.hamlib_ptt_type = Hamlib.RIG_PTT_RIG self.hamlib_ptt_type = Hamlib.RIG_PTT_RIG
elif static.HAMLIB_PTT_TYPE == 'RIG_PTT_SERIAL_DTR': elif static.HAMLIB_PTT_TYPE == 'DTR':
self.hamlib_ptt_type = Hamlib.RIG_PTT_SERIAL_DTR self.hamlib_ptt_type = Hamlib.RIG_PTT_SERIAL_DTR
self.my_rig.set_conf("ptt_type", "RTS")
elif static.HAMLIB_PTT_TYPE == 'RTS': elif static.HAMLIB_PTT_TYPE == 'RTS':
self.hamlib_ptt_type = Hamlib.RIG_PTT_SERIAL_RTS self.hamlib_ptt_type = Hamlib.RIG_PTT_SERIAL_RTS