From 16b445afc2cefbb5e52d8c74e214614c2b3d2603 Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Tue, 5 Sep 2023 20:20:24 +0200 Subject: [PATCH] first working state toggle for tnc connection --- gui_vue/src/main.ts | 1 + gui_vue/src/store/stateStore.js | 83 +++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 gui_vue/src/store/stateStore.js diff --git a/gui_vue/src/main.ts b/gui_vue/src/main.ts index e7d6a48b..4199af03 100644 --- a/gui_vue/src/main.ts +++ b/gui_vue/src/main.ts @@ -30,3 +30,4 @@ app.use(pinia) import './js/daemon.js' +import './js/sock.js' diff --git a/gui_vue/src/store/stateStore.js b/gui_vue/src/store/stateStore.js new file mode 100644 index 00000000..f7f64bfb --- /dev/null +++ b/gui_vue/src/store/stateStore.js @@ -0,0 +1,83 @@ +import { defineStore } from 'pinia' +import { ref, computed } from 'vue'; +import * as bootstrap from 'bootstrap' + +export const useStateStore = defineStore('stateStore', () => { + var busy_state = ref("-") + var arq_state = ref("-") + var frequency = ref("-") + var mode = ref("-") + var bandwidth = ref("-") + var dbfs_level = ref(0) + + var tnc_connection = ref("disconnected") + var tncStartCount = ref(0) + + function updateTncState(state){ + + tnc_connection.value = state; + + + if (tnc_connection.value == "open") { + + // collapse settings screen + var collapseFirstRow = new bootstrap.Collapse( + document.getElementById("collapseFirstRow"), + { toggle: false }, + ); + collapseFirstRow.hide(); + var collapseSecondRow = new bootstrap.Collapse( + document.getElementById("collapseSecondRow"), + { toggle: false }, + ); + collapseSecondRow.hide(); + var collapseThirdRow = new bootstrap.Collapse( + document.getElementById("collapseThirdRow"), + { toggle: false }, + ); + collapseThirdRow.show(); + var collapseFourthRow = new bootstrap.Collapse( + document.getElementById("collapseFourthRow"), + { toggle: false }, + ); + collapseFourthRow.show(); + + //Set tuning for fancy graphics mode (high/low CPU) + //set_CPU_mode(); + + //GUI will auto connect to TNC if already running, if that is the case increment start count if 0 + if (tncStartCount.value == 0) tncStartCount++; + } else { + + // collapse settings screen + var collapseFirstRow = new bootstrap.Collapse( + document.getElementById("collapseFirstRow"), + { toggle: false }, + ); + collapseFirstRow.show(); + var collapseSecondRow = new bootstrap.Collapse( + document.getElementById("collapseSecondRow"), + { toggle: false }, + ); + collapseSecondRow.show(); + var collapseThirdRow = new bootstrap.Collapse( + document.getElementById("collapseThirdRow"), + { toggle: false }, + ); + collapseThirdRow.hide(); + var collapseFourthRow = new bootstrap.Collapse( + document.getElementById("collapseFourthRow"), + { toggle: false }, + ); + collapseFourthRow.hide(); + } +}; + + + + + + + + return { busy_state, arq_state, frequency, mode, bandwidth, dbfs_level, updateTncState }; +});