FreeDATA/main.py

52 lines
1.7 KiB
Python
Raw Normal View History

2020-12-26 10:02:14 +00:00
#!/usr/bin/python3
2020-12-23 16:48:22 +00:00
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 22 16:58:45 2020
@author: DJ2LS
"""
2021-03-11 17:03:48 +00:00
2020-12-23 17:25:50 +00:00
import argparse
import threading
import static
2021-05-09 10:01:42 +00:00
2021-02-16 18:39:08 +00:00
if __name__ == '__main__':
2021-03-12 13:14:36 +00:00
# --------------------------------------------GET PARAMETER INPUTS
2021-03-11 17:03:48 +00:00
PARSER = argparse.ArgumentParser(description='Simons TEST TNC')
PARSER.add_argument('--rx', dest="audio_input_device", default=0, help="listening sound card", type=int)
PARSER.add_argument('--tx', dest="audio_output_device", default=0, help="transmitting sound card", type=int)
2021-03-12 13:14:36 +00:00
PARSER.add_argument('--port', dest="socket_port", default=3000, help="Socket port", type=int)
PARSER.add_argument('--deviceport', dest="hamlib_device_port", default="/dev/ttyUSB0", help="Socket port", type=str)
PARSER.add_argument('--deviceid', dest="hamlib_device_id", default=3011, help="Socket port", type=int)
2021-03-11 17:03:48 +00:00
ARGS = PARSER.parse_args()
2021-05-09 10:01:42 +00:00
2021-03-11 17:03:48 +00:00
static.AUDIO_INPUT_DEVICE = ARGS.audio_input_device
static.AUDIO_OUTPUT_DEVICE = ARGS.audio_output_device
static.PORT = ARGS.socket_port
static.HAMLIB_DEVICE_ID = ARGS.hamlib_device_id
static.HAMLIB_DEVICE_PORT = ARGS.hamlib_device_port
# we need to wait until we got all parameters from argparse first before we can load the other modules
import sock
import helpers
2021-05-09 10:01:42 +00:00
# config logging
helpers.setup_logging()
2021-03-12 13:14:36 +00:00
# --------------------------------------------START CMD SERVER
2021-02-16 21:41:06 +00:00
2021-03-11 17:03:48 +00:00
CMD_SERVER_THREAD = threading.Thread(target=sock.start_cmd_socket, name="cmd server")
CMD_SERVER_THREAD.start()
2021-04-17 15:42:25 +00:00
WATCHDOG_SERVER_THREAD = threading.Thread(target=helpers.watchdog, name="watchdog")
WATCHDOG_SERVER_THREAD.start()