FreeDATA/gui_vue/src/store/stateStore.js

127 lines
3.7 KiB
JavaScript
Raw Normal View History

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("-")
2023-09-11 14:53:24 +00:00
var new_frequency = ref(0)
var mode = ref("-")
2023-09-11 14:53:24 +00:00
var rf_level = ref("10")
var bandwidth = ref("-")
2023-09-20 18:38:21 +00:00
var dbfs_level_percent = ref(0)
var dbfs_level_raw = ref(0)
2023-09-09 16:29:32 +00:00
var ptt_state = ref("False")
var speed_level = ref(0)
var fft = ref()
2023-09-11 15:08:56 +00:00
var channel_busy = ref("")
2023-09-09 16:29:32 +00:00
var channel_busy_slot = ref()
var scatter = ref()
var s_meter_strength_percent = ref(0)
var s_meter_strength_raw = ref(0)
var tnc_connection = ref("disconnected")
var tncStartCount = ref(0)
2023-09-10 06:23:40 +00:00
var tnc_running_state = ref("--------")
2023-09-06 21:04:24 +00:00
2023-09-09 16:29:32 +00:00
var arq_total_bytes = ref(0)
2023-09-20 18:38:21 +00:00
var arq_transmission_percent = ref(0)
2023-09-09 17:01:10 +00:00
var heard_stations = ref("")
2023-09-09 18:15:02 +00:00
var dxcallsign = ref("")
2023-09-09 17:01:10 +00:00
2023-09-09 18:15:02 +00:00
var arq_session_state = ref("")
var arq_state = ref("")
var beacon_state = ref("False")
2023-09-09 17:01:10 +00:00
2023-09-11 14:09:17 +00:00
var audio_recording = ref("")
var hamlib_status = ref("")
var audio_level = ref("")
2023-09-11 14:53:24 +00:00
var alc = ref("")
2023-09-09 17:01:10 +00:00
2023-09-11 15:08:56 +00:00
var is_codec2_traffic = ref("")
2023-10-02 18:16:07 +00:00
var arq_speed_list_timestamp = ref([])
var arq_speed_list_bpm = ref([])
var arq_speed_list_snr = ref([])
var arq_seconds_until_finish = ref()
var arq_seconds_until_timeout = ref()
var arq_seconds_until_timeout_percent = ref()
2023-09-09 16:29:32 +00:00
2023-09-06 21:04:24 +00:00
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();
}
};
2023-10-02 18:16:07 +00:00
return { dxcallsign, busy_state, arq_state, new_frequency, frequency, mode, bandwidth, dbfs_level_raw, dbfs_level_percent, speed_level, fft, channel_busy, channel_busy_slot, scatter, ptt_state, s_meter_strength_percent, s_meter_strength_raw, arq_total_bytes, audio_recording, hamlib_status, audio_level, alc, updateTncState, arq_transmission_percent, arq_speed_list_bpm, arq_speed_list_timestamp, arq_speed_list_snr, arq_seconds_until_finish, arq_seconds_until_timeout, arq_seconds_until_timeout_percent };
});