From 37c69031da5a0e14d65ceaf97d0f2ee2e322ccc6 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Mon, 7 Nov 2022 15:14:20 +0100 Subject: [PATCH 1/6] moved randbytes to np.random.bytes for python3.7 compatibility --- tnc/data_handler.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tnc/data_handler.py b/tnc/data_handler.py index 6a187719..4474ca8d 100644 --- a/tnc/data_handler.py +++ b/tnc/data_handler.py @@ -13,7 +13,7 @@ import threading import time import uuid import zlib -from random import randrange, randbytes +from random import randrange# , randbytes import codec2 import helpers @@ -361,7 +361,7 @@ class DATA: def enqueue_frame_for_tx( self, - frame_to_tx: list[bytearray], + frame_to_tx,# : list[bytearray], # this causes a crash on python 3.7 c2_mode=FREEDV_MODE.datac0.value, copies=1, repeat_delay=0, @@ -1323,7 +1323,8 @@ class DATA: static.ARQ_SESSION_STATE = "connecting" # create a random session id - self.session_id = randbytes(1) + # self.session_id = randbytes(1) + self.session_id = np.random.bytes(1) print(self.session_id) connection_frame = bytearray(self.length_sig0_frame) @@ -1615,7 +1616,8 @@ class DATA: # init a new random session id if we are not in an arq session if not static.ARQ_SESSION: - self.session_id = randbytes(1) + # self.session_id = randbytes(1) + self.session_id = np.random.bytes(1) print(self.session_id) # Update data_channel timestamp From 3c0e0b150d50090c1b0704935badb094560d0317 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Tue, 8 Nov 2022 09:08:44 +0100 Subject: [PATCH 2/6] added hostapi name to audio device --- tnc/audio.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tnc/audio.py b/tnc/audio.py index 41190bb6..fc89a9d3 100644 --- a/tnc/audio.py +++ b/tnc/audio.py @@ -52,7 +52,10 @@ def device_crc(device) -> str: crc_hwid = crc_algorithm(bytes(f"{device}", encoding="utf-8")) crc_hwid = crc_hwid.to_bytes(2, byteorder="big") crc_hwid = crc_hwid.hex() - return f"{device['name']} [{crc_hwid}]" + + hostapi_name = sd.query_hostapis(device['hostapi'])['name'] + + return f"{device['name']} [{hostapi_name}] [{crc_hwid}]" def fetch_audio_devices(input_devices, output_devices): From 77bfe28e2da5bb1562fed8ae057b18795a48ff85 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Tue, 8 Nov 2022 09:22:17 +0100 Subject: [PATCH 3/6] added beacon state to explorer --- tnc/explorer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tnc/explorer.py b/tnc/explorer.py index da538079..56dd01d4 100644 --- a/tnc/explorer.py +++ b/tnc/explorer.py @@ -42,11 +42,12 @@ class explorer(): gridsquare = str(static.MYGRID, "utf-8") version = str(static.VERSION) bandwidth = str(static.LOW_BANDWIDTH_MODE) + beacon = str(static.BEACON_STATE) log.info("[EXPLORER] publish", frequency=frequency, band=band, callsign=callsign, gridsquare=gridsquare, version=version, bandwidth=bandwidth) headers = {"Content-Type": "application/json"} - station_data = {'callsign': callsign, 'gridsquare': gridsquare, 'frequency': frequency, 'band': band, 'version': version, 'bandwidth': bandwidth} + station_data = {'callsign': callsign, 'gridsquare': gridsquare, 'frequency': frequency, 'band': band, 'version': version, 'bandwidth': bandwidth, 'beacon': beacon} station_data = json.dumps(station_data) try: response = requests.post(self.explorer_url, json=station_data, headers=headers) From 71d75584ee31e3f122b33a88029617d7367d22b9 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Tue, 8 Nov 2022 09:36:06 +0100 Subject: [PATCH 4/6] possible fix for #275 --- gui/main.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gui/main.js b/gui/main.js index 544062be..47e8f687 100644 --- a/gui/main.js +++ b/gui/main.js @@ -832,6 +832,7 @@ ipcMain.on('request-stop-rigctld',(event,data)=>{ // CHECK RIGCTLD ipcMain.on('request-check-rigctld',(data)=>{ + try { let Data = { state: "unknown", @@ -843,12 +844,15 @@ ipcMain.on('request-check-rigctld',(data)=>{ } else { Data["state"] = "unknown/stopped"; } - win.webContents.send('action-check-rigctld', Data); + if (win !== null && win !== ''){ + win.webContents.send('action-check-rigctld', Data); + } }) } catch (e) { mainLog.error(e) } + }); From 4d9730240f727c619a2f5cb016cda7fe933cb9b6 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Tue, 8 Nov 2022 09:36:14 +0100 Subject: [PATCH 5/6] added explorer url to settings --- gui/src/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/index.html b/gui/src/index.html index 7ed3f978..7555f8fd 100644 --- a/gui/src/index.html +++ b/gui/src/index.html @@ -1196,7 +1196,7 @@
- +