mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
changed deviceid to devicename
this improves readability
This commit is contained in:
parent
4410ada112
commit
c5d8f5a259
4 changed files with 12 additions and 44 deletions
|
@ -153,13 +153,13 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||||
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 = str(received_json["parameter"][0]["rx_audio"])
|
rx_audio = str(received_json["parameter"][0]["rx_audio"])
|
||||||
tx_audio = str(received_json["parameter"][0]["tx_audio"])
|
tx_audio = str(received_json["parameter"][0]["tx_audio"])
|
||||||
deviceid = str(received_json["parameter"][0]["deviceid"])
|
devicename = str(received_json["parameter"][0]["devicename"])
|
||||||
deviceport = str(received_json["parameter"][0]["deviceport"])
|
deviceport = str(received_json["parameter"][0]["deviceport"])
|
||||||
serialspeed = str(received_json["parameter"][0]["serialspeed"])
|
serialspeed = str(received_json["parameter"][0]["serialspeed"])
|
||||||
pttprotocol = str(received_json["parameter"][0]["pttprotocol"])
|
pttprotocol = str(received_json["parameter"][0]["pttprotocol"])
|
||||||
pttport = str(received_json["parameter"][0]["pttport"])
|
pttport = str(received_json["parameter"][0]["pttport"])
|
||||||
|
|
||||||
structlog.get_logger("structlog").warning("[DMN] Starting TNC", rig=deviceid, port=deviceport)
|
structlog.get_logger("structlog").warning("[DMN] Starting TNC", rig=devicename, port=deviceport)
|
||||||
#print(received_json["parameter"][0])
|
#print(received_json["parameter"][0])
|
||||||
|
|
||||||
# command = "--rx "+ rx_audio +" \
|
# command = "--rx "+ rx_audio +" \
|
||||||
|
@ -178,8 +178,8 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||||
options.append(tx_audio)
|
options.append(tx_audio)
|
||||||
options.append('--deviceport')
|
options.append('--deviceport')
|
||||||
options.append(deviceport)
|
options.append(deviceport)
|
||||||
options.append('--deviceid')
|
options.append('--devicename')
|
||||||
options.append(deviceid)
|
options.append(devicename)
|
||||||
options.append('--serialspeed')
|
options.append('--serialspeed')
|
||||||
options.append(serialspeed)
|
options.append(serialspeed)
|
||||||
options.append('--pttprotocol')
|
options.append('--pttprotocol')
|
||||||
|
@ -278,7 +278,7 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||||
|
|
||||||
print(received_json["parameter"])
|
print(received_json["parameter"])
|
||||||
|
|
||||||
deviceid = str(received_json["parameter"][0]["deviceid"])
|
devicename = str(received_json["parameter"][0]["devicename"])
|
||||||
deviceport = str(received_json["parameter"][0]["deviceport"])
|
deviceport = str(received_json["parameter"][0]["deviceport"])
|
||||||
serialspeed = str(received_json["parameter"][0]["serialspeed"])
|
serialspeed = str(received_json["parameter"][0]["serialspeed"])
|
||||||
pttprotocol = str(received_json["parameter"][0]["pttprotocol"])
|
pttprotocol = str(received_json["parameter"][0]["pttprotocol"])
|
||||||
|
@ -296,7 +296,7 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||||
|
|
||||||
# get devicenumber by looking for deviceobject in Hamlib module
|
# get devicenumber by looking for deviceobject in Hamlib module
|
||||||
try:
|
try:
|
||||||
devicenumber = getattr(Hamlib, deviceid)
|
devicenumber = getattr(Hamlib, devicename)
|
||||||
except:
|
except:
|
||||||
structlog.get_logger("structlog").error("[DMN] Hamlib: rig not supported...")
|
structlog.get_logger("structlog").error("[DMN] Hamlib: rig not supported...")
|
||||||
devicenumber = 0
|
devicenumber = 0
|
||||||
|
|
38
tnc/main.py
38
tnc/main.py
|
@ -28,8 +28,8 @@ if __name__ == '__main__':
|
||||||
PARSER.add_argument('--rx', dest="audio_input_device", default=0, help="listening sound card", type=int)
|
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)
|
PARSER.add_argument('--tx', dest="audio_output_device", default=0, help="transmitting sound card", type=int)
|
||||||
PARSER.add_argument('--port', dest="socket_port", default=3000, help="Socket port", type=int)
|
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('--deviceport', dest="hamlib_device_port", default="/dev/ttyUSB0", help="Hamlib device port", type=str)
|
||||||
PARSER.add_argument('--deviceid', dest="hamlib_device_id", default=2028, help="Socket port", type=str)
|
PARSER.add_argument('--devicename', dest="hamlib_device_name", default=2028, help="Hamlib device name", type=str)
|
||||||
PARSER.add_argument('--serialspeed', dest="hamlib_serialspeed", default=9600, help="Serialspeed", type=str)
|
PARSER.add_argument('--serialspeed', dest="hamlib_serialspeed", default=9600, help="Serialspeed", type=str)
|
||||||
PARSER.add_argument('--pttprotocol', dest="hamlib_ptt_type", default='RTS', help="PTT Type", type=str)
|
PARSER.add_argument('--pttprotocol', dest="hamlib_ptt_type", default='RTS', help="PTT Type", type=str)
|
||||||
PARSER.add_argument('--pttport', dest="hamlib_ptt_port", default="/dev/ttyUSB0", help="PTT Port", type=str)
|
PARSER.add_argument('--pttport', dest="hamlib_ptt_port", default="/dev/ttyUSB0", help="PTT Port", type=str)
|
||||||
|
@ -39,7 +39,7 @@ if __name__ == '__main__':
|
||||||
static.AUDIO_INPUT_DEVICE = ARGS.audio_input_device
|
static.AUDIO_INPUT_DEVICE = ARGS.audio_input_device
|
||||||
static.AUDIO_OUTPUT_DEVICE = ARGS.audio_output_device
|
static.AUDIO_OUTPUT_DEVICE = ARGS.audio_output_device
|
||||||
static.PORT = ARGS.socket_port
|
static.PORT = ARGS.socket_port
|
||||||
static.HAMLIB_DEVICE_ID = ARGS.hamlib_device_id
|
static.HAMLIB_DEVICE_NAME = ARGS.hamlib_device_name
|
||||||
static.HAMLIB_DEVICE_PORT = ARGS.hamlib_device_port
|
static.HAMLIB_DEVICE_PORT = ARGS.hamlib_device_port
|
||||||
static.HAMLIB_PTT_TYPE = ARGS.hamlib_ptt_type
|
static.HAMLIB_PTT_TYPE = ARGS.hamlib_ptt_type
|
||||||
HAMLIB_PTT_PORT = ARGS.hamlib_ptt_port
|
HAMLIB_PTT_PORT = ARGS.hamlib_ptt_port
|
||||||
|
@ -60,35 +60,3 @@ if __name__ == '__main__':
|
||||||
CMD_SERVER_THREAD = threading.Thread(target=sock.start_cmd_socket, name="cmd server")
|
CMD_SERVER_THREAD = threading.Thread(target=sock.start_cmd_socket, name="cmd server")
|
||||||
CMD_SERVER_THREAD.start()
|
CMD_SERVER_THREAD.start()
|
||||||
|
|
||||||
'''
|
|
||||||
# Start RIGCTLD
|
|
||||||
|
|
||||||
if static.HAMLIB_PTT_TYPE == "RTS":
|
|
||||||
dtr_state = "OFF"
|
|
||||||
else:
|
|
||||||
dtr_state = "NONE"
|
|
||||||
|
|
||||||
if sys.platform == "linux":
|
|
||||||
command = "exec ./hamlib/linux/rigctld -r " + str(static.HAMLIB_DEVICE_PORT) + \
|
|
||||||
" -s "+ str(static.HAMLIB_SERIAL_SPEED) + \
|
|
||||||
" -P "+ str(static.HAMLIB_PTT_TYPE) + \
|
|
||||||
" -m "+ str(static.HAMLIB_DEVICE_ID) + \
|
|
||||||
" --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()
|
|
||||||
'''
|
|
||||||
|
|
|
@ -221,7 +221,7 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||||
"COMMAND": "TNC_STATE",
|
"COMMAND": "TNC_STATE",
|
||||||
"TIMESTAMP": received_json["timestamp"],
|
"TIMESTAMP": received_json["timestamp"],
|
||||||
"PTT_STATE": str(static.PTT_STATE),
|
"PTT_STATE": str(static.PTT_STATE),
|
||||||
"CHANNEL_STATE": str(static.CHANNEL_STATE),
|
#"CHANNEL_STATE": str(static.CHANNEL_STATE),
|
||||||
"TNC_STATE": str(static.TNC_STATE),
|
"TNC_STATE": str(static.TNC_STATE),
|
||||||
"ARQ_STATE": str(static.ARQ_STATE),
|
"ARQ_STATE": str(static.ARQ_STATE),
|
||||||
"AUDIO_RMS": str(static.AUDIO_RMS),
|
"AUDIO_RMS": str(static.AUDIO_RMS),
|
||||||
|
|
|
@ -36,7 +36,7 @@ SOCKET_TIMEOUT = 3 # seconds
|
||||||
HAMLIB_PTT_TYPE = 'RTS'
|
HAMLIB_PTT_TYPE = 'RTS'
|
||||||
PTT_STATE = False
|
PTT_STATE = False
|
||||||
|
|
||||||
HAMLIB_DEVICE_ID = 'RIG_MODEL_DUMMY_NOVFO'
|
HAMLIB_DEVICE_NAME = 'RIG_MODEL_DUMMY_NOVFO'
|
||||||
HAMLIB_DEVICE_PORT = '/dev/ttyUSB0'
|
HAMLIB_DEVICE_PORT = '/dev/ttyUSB0'
|
||||||
HAMLIB_SERIAL_SPEED = '9600'
|
HAMLIB_SERIAL_SPEED = '9600'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue