From 3b9db2980cbad271ecafa3a898a4954ecd7ae3e8 Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Thu, 9 Nov 2023 18:00:12 +0100 Subject: [PATCH] attempt using ptt --- gui/src/js/eventHandler.js | 10 +++++++++- modem/server_commands.py | 6 ++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/gui/src/js/eventHandler.js b/gui/src/js/eventHandler.js index 0d2e237d..04bfef2c 100644 --- a/gui/src/js/eventHandler.js +++ b/gui/src/js/eventHandler.js @@ -20,7 +20,15 @@ import { useSettingsStore } from "../store/settingsStore.js"; const settings = useSettingsStore(pinia); export function eventDispatcher(data) { - console.log(data); + data = JSON.parse(data); + + // get ptt state as a first test + // Todo we might use a switch function for data dispatching + stateStore.ptt_state = data.ptt; + + + + // copied directly from sock.js We need to implement these variables step by step if (data["command"] == "modem_state") { //console.log(data) diff --git a/modem/server_commands.py b/modem/server_commands.py index e9a09dd3..d1d9550c 100644 --- a/modem/server_commands.py +++ b/modem/server_commands.py @@ -2,7 +2,7 @@ from queues import DATA_QUEUE_TRANSMIT import structlog log = structlog.get_logger("COMMANDS") -def cqcqcq(self): +def cqcqcq(): DATA_QUEUE_TRANSMIT.put(["CQ"]) def ping_ping(data): @@ -18,9 +18,7 @@ def ping_ping(data): ) def beacon(data): - beacon_state = False - if data['enabled'] in ['True']: - beacon_state = True + beacon_state = data['enabled'] in ['True'] #Beacon.beacon_state = beacon_state log.info( "[CMD] Changing beacon state", state=beacon_state