fixed daemon for tci

This commit is contained in:
DJ2LS 2023-05-24 15:29:12 +02:00
parent a20d928cf1
commit dcb3835139
3 changed files with 20 additions and 9 deletions

View file

@ -131,7 +131,6 @@ class DAEMON:
# increase length of list for storing additional
# parameters starting at entry 64
data = data[:64] + [None] * (64 - len(data))
print(data)
# data[1] mycall
# data[2] mygrid
# data[3] rx_audio
@ -168,8 +167,6 @@ class DAEMON:
def test_hamlib_ptt(self, data):
radiocontrol = data[1]
rigctld_ip = data[2]
rigctld_port = data[3]
# check how we want to control the radio
if radiocontrol == "direct":
@ -180,8 +177,18 @@ class DAEMON:
sys.exit(1)
elif radiocontrol == "rigctld":
import rigctld as rig
rigctld_ip = data[2]
rigctld_port = data[3]
elif radiocontrol == "tci":
import tci as rig
rigctld_ip = data[22]
rigctld_port = data[23]
else:
import rigdummy as rig
rigctld_ip = '127.0.0.1'
rigctld_port = '0'
hamlib = rig.radio()
hamlib.open_rig(
@ -193,7 +200,7 @@ class DAEMON:
hamlib.set_ptt(True)
#Allow a little time for network based rig to register PTT is active
time.sleep(.250);
time.sleep(.250)
if hamlib.get_ptt():
self.log.info("[DMN] Hamlib PTT", status="SUCCESS")
response = {"command": "test_hamlib", "result": "SUCCESS"}
@ -237,8 +244,8 @@ class DAEMON:
options.append(data[7])
if data[5] == "tci":
options.append("--tci_ip")
options.extend((data[22], "--tci_port"))
options.append("--tci-ip")
options.extend((data[22], "--tci-port"))
options.append(data[23])
@ -302,6 +309,7 @@ class DAEMON:
command.append("freedata-tnc.exe")
command += options
proc = subprocess.Popen(command)
atexit.register(proc.kill)
@ -318,7 +326,6 @@ class DAEMON:
command.append("main.py")
command += options
print(command)
proc = subprocess.Popen(command)
atexit.register(proc.kill)

View file

@ -233,7 +233,7 @@ if __name__ == "__main__":
PARSER.add_argument(
"--tci-port",
dest="tci_port",
default=9000,
default=50001,
type=int,
help="Set tci destination port",
)

View file

@ -929,6 +929,8 @@ class ThreadedTCPRequestHandler(socketserver.StreamRequestHandler):
enable_auto_tune = str(helpers.return_key_from_object("False", startparam, "enable_auto_tune"))
enable_stats = str(helpers.return_key_from_object("False", startparam, "enable_stats"))
tx_delay = str(helpers.return_key_from_object("0", startparam, "tx_delay"))
tci_ip = str(helpers.return_key_from_object("127.0.0.1", startparam, "tci_ip"))
tci_port = str(helpers.return_key_from_object("50001", startparam, "tci_port"))
try:
# convert ssid list to python list
ssid_list = str(helpers.return_key_from_object("0, 1, 2, 3, 4, 5, 6, 7, 8, 9", startparam, "ssid_list"))
@ -969,7 +971,9 @@ class ThreadedTCPRequestHandler(socketserver.StreamRequestHandler):
ssid_list,
enable_auto_tune,
enable_stats,
tx_delay
tx_delay,
tci_ip,
tci_port
]
)
command_response("start_tnc", True)