several adjustments to beacon and progressbars

This commit is contained in:
DJ2LS 2023-09-30 20:30:19 +02:00
parent 0deb074df7
commit 87388268e3
6 changed files with 86 additions and 20 deletions

View file

@ -37,6 +37,13 @@ function getDateTime(timestampRaw){
return datetime
}
function addBeaconDataToStore(item){
//chat.beaconDataArray.push(item.snr)
//chat.beaconLabelArray.push(item.timestamp)
return
}
</script>
@ -50,18 +57,30 @@ return datetime
<div class="separator my-2">{{prevChatMessageDay = getDateTime(item.timestamp)}}</div>
</div>
<div v-if="item.type === 'beacon'">
<div v-if="item.type === 'beacon' && item.status === 'received'">
{{item}}
{{lastBeaconReceived = getDateTime(item.timestamp)}}
{{item.snr}}
{{addBeaconDataToStore(item)}}
</div>
<div v-if="item.type === 'ping'">
{{item.snr}}
{{chat.beaconDataArray}}
</div>
<div v-if="item.type === 'ping-ack'">
{{item.snr}}
{{chat.beaconDataArray}}
</div>
<div v-if="item.type === 'transmit'">
<sent-message :message="item" />
</div>
<div v-else-if="item.type === 'received'">
<received-message :message="item" />
</div>
<div v-if="item.type === 'broadcast_transmit'">
@ -71,10 +90,6 @@ return datetime
<received-broadcast-message :message="item" />
</div>
</template>
</div>

View file

@ -48,6 +48,7 @@ ChartJS.register(
tooltipEvents:[], //remove trigger from tooltips so they will'nt be show
pointDot : false, //remove the points markers
scaleShowGridLines: true, //set to false to remove the grids background
maintainAspectRatio:true,
plugins:{
legend: {
display: false
@ -56,7 +57,7 @@ ChartJS.register(
scales: {
x: {
position: "bottom",
display: true,
display: false,
min: -10,
max: 15,
ticks: {
@ -64,7 +65,7 @@ ChartJS.register(
},
},
y: {
display: true,
display: false,
min: -5,
max: 10,
ticks: {
@ -74,10 +75,18 @@ ChartJS.register(
},
};
//let dataArray = new Array(25).fill(0)
//dataArray = dataArray.add([-3, 10, 8, 5, 3, 0, -5])
//let dataArray1 = dataArray.shift(2)
//console.log(dataArray1)
//[-3, 10, 8, 5, 3, 0, -5]
//console.log(dataArray)
const beaconHistogramData = computed(() => ({
labels: ['18:10', '19:00', '23:00', '01:13', '04:25', '08:15', '09:12'],
labels: chat.beaconLabelArray,
datasets: [
{ data: [-3, 10, 8, 5, 3, 0, -5], tension: 0.1, borderColor: 'rgb(0, 255, 0)' }
{ data: chat.beaconDataArray, tension: 0.1, borderColor: 'rgb(0, 255, 0)' }
]
}
));
@ -144,9 +153,7 @@ function newChat(obj){
<div class="col-7 ms-2 p-0">
<!-- right side of chat nav bar-->
<Bar :data="beaconHistogramData" :options="beaconHistogramOptions" style="height:100%" />
<Bar :data="beaconHistogramData" :options="beaconHistogramOptions" width="300" style="height:100%" />

View file

@ -301,6 +301,10 @@ export async function updateAllChat() {
chat.sorted_chat_list = sortChatList()
console.log(chat.sorted_chat_list["EI7IG-0"])
/*
if (typeof result !== "undefined") {
for (const item of result.docs) {
@ -440,6 +444,36 @@ db.find({
}
// function for handling a received beacon
export function newBeaconReceived(obj){
/*
{
"freedata": "tnc-message",
"beacon": "received",
"uuid": "12741312-3dbb-4a53-b0cc-100f6c930ab8",
"timestamp": 1696076869,
"dxcallsign": "DJ2LS-0",
"dxgrid": "JN48CS",
"snr": "-2.8",
"mycallsign": "DJ2LS-0"
}
*/
let newChatObj = new Object();
newChatObj.command = "beacon"
newChatObj._id = obj['uuid']
newChatObj.uuid = obj['uuid']
newChatObj.timestamp = obj['timestamp']
newChatObj.dxcallsign = obj["dxcallsign"]
newChatObj.dxgrid = obj["dxgrid"]
newChatObj.type = 'beacon'
newChatObj.status = obj["beacon"]
newChatObj.snr = obj["snr"]
addObjToDatabase(newChatObj)
}
// function for handling a received message
export function newMessageReceived(message, protocol){
/*
@ -505,7 +539,7 @@ export function newMessageReceived(message, protocol){
}
// some tweaks for broadcasts
if (item.fec == "broadcast") {
if (protocol.fec == "broadcast") {
newChatObj.broadcast_sender = protocol["dxcallsign"]
newChatObj.type = 'broadcast_received'
}

View file

@ -2,7 +2,7 @@ var net = require("net");
const path = require("path");
const FD = require("./src/js/freedata.js");
//import FD from './freedata.js';
import { newMessageReceived } from './chatHandler.js';
import { newMessageReceived, newBeaconReceived } from './chatHandler.js';
import {displayToast} from './popupHandler.js'
// ----------------- init pinia stores -------------
@ -216,6 +216,11 @@ client.on("data", function (socketdata) {
stateStore.arq_session_state = data["arq_session"]
stateStore.arq_state = data["arq_state"]
stateStore.arq_transmission_percent = data["arq_transmission_percent"]
stateStore.arq_seconds_until_finish = data["arq_seconds_until_finish"]
stateStore.arq_seconds_until_timeout = data["arq_seconds_until_timeout"]
stateStore.arq_seconds_until_timeout_percent = (stateStore.arq_seconds_until_timeout / 180) * 100
stateStore.arq_speed_list = data["speed_list"]
@ -310,6 +315,9 @@ client.on("data", function (socketdata) {
case "received":
// BEACON RECEIVED
newBeaconReceived(data)
message = "received BEACON from " + data['dxcallsign'] + " | " + data['dxgrid']
displayToast("success", "bi-arrow-left-right", message, 5000);
break;
@ -414,8 +422,6 @@ client.on("data", function (socketdata) {
if (splitted_data[0] == "m") {
console.log(splitted_data)
newMessageReceived(splitted_data, data)
}
break;

View file

@ -29,6 +29,7 @@ export const useChatStore = defineStore('chatStore', () => {
var chartSpeedPER25 = ref()
var chartSpeedPER75 = ref()
return {selectedCallsign, inputText, chat_filter, callsign_list, sorted_chat_list, unsorted_chat_list, inputFileName, inputFileSize, inputFileType, inputFile, chartSpeedPER0, chartSpeedPER25, chartSpeedPER75 };
var beaconDataArray = ref([-3, 10, 8, 5, 3, 0, -5, 10, 8, 5, 3, 0, -5, 10, 8, 5, 3, 0, -5, 10, 8, 5, 3, 0, -5])
var beaconLabelArray = ref(['18:10', '19:00', '23:00', '01:13', '04:25', '08:15', '09:12', '18:10', '19:00', '23:00', '01:13', '04:25', '08:15', '09:12', '18:10', '19:00', '23:00', '01:13', '04:25', '08:15', '09:12', '01:13', '04:25', '08:15', '09:12'])
return {selectedCallsign, inputText, chat_filter, callsign_list, sorted_chat_list, unsorted_chat_list, inputFileName, inputFileSize, inputFileType, inputFile, chartSpeedPER0, chartSpeedPER25, chartSpeedPER75, beaconDataArray, beaconLabelArray };
});

View file

@ -46,6 +46,9 @@ export const useStateStore = defineStore('stateStore', () => {
var is_codec2_traffic = ref("")
var arq_speed_list = ref()
var arq_seconds_until_finish = ref()
var arq_seconds_until_timeout = ref()
var arq_seconds_until_timeout_percent = ref()
function updateTncState(state){
@ -114,5 +117,5 @@ export const useStateStore = defineStore('stateStore', () => {
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 };
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, arq_seconds_until_finish, arq_seconds_until_timeout, arq_seconds_until_timeout_percent };
});