From 7031077dabe30fd4d91983b87a9fd2d435c43b3c Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Wed, 29 Mar 2023 12:39:34 +0200 Subject: [PATCH] attempt getting frequency --- tnc/tci.py | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/tnc/tci.py b/tnc/tci.py index c8d513ba..f3938a54 100644 --- a/tnc/tci.py +++ b/tnc/tci.py @@ -46,6 +46,13 @@ class TCI: self.crc = None self.channel = None + self.frequency = None + self.bandwidth = None + self.mode = None + self.alc = None + self.meter = None + self.level = None + def connect(self): self.log.info( "[TCI] Starting TCI thread!", ip=self.hostname, port=self.port @@ -123,6 +130,24 @@ class TCI: audio_data = message[64:] self.audio_received_queue.put(audio_data) + # find frequency + if message.startswith("TX_FREQUENCY:"): + splitted_message = message.split("TX_FREQUENCY:") + self.frequency = splitted_message[1][:-1] + + # find bandwidth + #if message.startswith("rx_filter_band:0,"): + # splitted_message = message.split("rx_filter_band:0,") + # bandwidths = splitted_message[1] + # splitted_bandwidths = bandwidths.split(",") + # lower_bandwidth = int(splitted_bandwidths[0]) + # upper_bandwidth = int(splitted_bandwidths[1][:-1]) + # self.bandwidth = upper_bandwidth - lower_bandwidth + + + + + def on_error(self, error): self.log.error( "[TCI] Error FreeDATA to TCI rig!", ip=self.hostname, port=self.port, e=error @@ -212,27 +237,28 @@ class TCI: def get_frequency(self): """ """ - return None + self.ws.send('TX_FREQUENCY;') + return self.frequency def get_mode(self): """ """ - return None + return self.mode def get_level(self): """ """ - return None + return self.level def get_alc(self): """ """ - return None + return self.alc def get_meter(self): """ """ - return None + return self.meter def get_bandwidth(self): """ """ - return None + return self.bandwidth def get_strength(self): """ """