mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
first working beacon to chart attempt
This commit is contained in:
parent
43cd15ecc6
commit
593c15f48f
6 changed files with 108 additions and 42 deletions
|
@ -32,9 +32,26 @@ function chatSelected(callsign){
|
||||||
var messageBody = document.getElementById("message-container");
|
var messageBody = document.getElementById("message-container");
|
||||||
messageBody.scrollTop = messageBody.scrollHeight - messageBody.clientHeight;
|
messageBody.scrollTop = messageBody.scrollHeight - messageBody.clientHeight;
|
||||||
|
|
||||||
|
console.log(chat.sorted_beacon_list[chat.selectedCallsign])
|
||||||
|
console.log(chat.selectedCallsign)
|
||||||
|
try{
|
||||||
|
chat.beaconLabelArray = Object.values(chat.sorted_beacon_list[chat.selectedCallsign].timestamp)
|
||||||
|
chat.beaconDataArray = Object.values(chat.sorted_beacon_list[chat.selectedCallsign].snr)
|
||||||
|
} catch(e){
|
||||||
|
console.log("beacon data not fetched: " + e)
|
||||||
|
chat.beaconLabelArray = []
|
||||||
|
chat.beaconDataArray = []
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(chat.beaconDataArray)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
||||||
|
|
|
@ -37,14 +37,6 @@ function getDateTime(timestampRaw){
|
||||||
return datetime
|
return datetime
|
||||||
}
|
}
|
||||||
|
|
||||||
function addBeaconDataToStore(item){
|
|
||||||
|
|
||||||
//chat.beaconDataArray.push(item.snr)
|
|
||||||
//chat.beaconLabelArray.push(item.timestamp)
|
|
||||||
return
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -59,8 +51,6 @@ return
|
||||||
|
|
||||||
<div v-if="item.type === 'beacon' && item.status === 'received'">
|
<div v-if="item.type === 'beacon' && item.status === 'received'">
|
||||||
{{item}}
|
{{item}}
|
||||||
{{item.snr}}
|
|
||||||
{{addBeaconDataToStore(item)}}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="item.type === 'ping'">
|
<div v-if="item.type === 'ping'">
|
||||||
|
|
|
@ -54,6 +54,7 @@ ChartJS.register(
|
||||||
display: false
|
display: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
scales: {
|
scales: {
|
||||||
x: {
|
x: {
|
||||||
position: "bottom",
|
position: "bottom",
|
||||||
|
@ -62,7 +63,7 @@ ChartJS.register(
|
||||||
max: 15,
|
max: 15,
|
||||||
ticks: {
|
ticks: {
|
||||||
display: false,
|
display: false,
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
y: {
|
y: {
|
||||||
display: false,
|
display: false,
|
||||||
|
@ -70,7 +71,7 @@ ChartJS.register(
|
||||||
max: 10,
|
max: 10,
|
||||||
ticks: {
|
ticks: {
|
||||||
display: false,
|
display: false,
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -81,7 +82,20 @@ ChartJS.register(
|
||||||
//console.log(dataArray1)
|
//console.log(dataArray1)
|
||||||
//[-3, 10, 8, 5, 3, 0, -5]
|
//[-3, 10, 8, 5, 3, 0, -5]
|
||||||
|
|
||||||
//console.log(dataArray)
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
chat.beaconLabelArray = Object.values(chat.sorted_beacon_list['DJ2LS-0'].timestamp)
|
||||||
|
chat.beaconDataArray = Object.values(chat.sorted_beacon_list['DJ2LS-0'].snr)
|
||||||
|
} catch(e){
|
||||||
|
|
||||||
|
console.log(e)
|
||||||
|
|
||||||
|
var beaconLabels = []
|
||||||
|
var beaconData = []
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const beaconHistogramData = computed(() => ({
|
const beaconHistogramData = computed(() => ({
|
||||||
labels: chat.beaconLabelArray,
|
labels: chat.beaconLabelArray,
|
||||||
|
@ -108,6 +122,8 @@ const beaconHistogramData = computed(() => ({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function newChat(obj){
|
function newChat(obj){
|
||||||
|
|
||||||
|
@ -153,6 +169,7 @@ function newChat(obj){
|
||||||
<div class="col-7 ms-2 p-0">
|
<div class="col-7 ms-2 p-0">
|
||||||
|
|
||||||
<!-- right side of chat nav bar-->
|
<!-- right side of chat nav bar-->
|
||||||
|
{{beaconData}}
|
||||||
<Bar :data="beaconHistogramData" :options="beaconHistogramOptions" width="300" style="height:100%" />
|
<Bar :data="beaconHistogramData" :options="beaconHistogramOptions" width="300" style="height:100%" />
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -246,25 +246,6 @@ function sortChatList(){
|
||||||
return reorderedData
|
return reorderedData
|
||||||
}
|
}
|
||||||
|
|
||||||
// function for creating a list, accessible by callsign
|
|
||||||
function sortBeaconList(){
|
|
||||||
|
|
||||||
// Create an empty object to store the reordered data dynamically
|
|
||||||
var reorderedData = {};
|
|
||||||
var jsonObjects = chat.unsorted_beacon_list
|
|
||||||
// Iterate through the list of JSON objects and reorder them dynamically
|
|
||||||
jsonObjects.forEach(obj => {
|
|
||||||
var dxcallsign = obj.dxcallsign;
|
|
||||||
if (dxcallsign) {
|
|
||||||
if (!reorderedData[dxcallsign]) {
|
|
||||||
reorderedData[dxcallsign] = [];
|
|
||||||
}
|
|
||||||
reorderedData[dxcallsign].push(obj);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//console.log(reorderedData["DJ2LS-0"])
|
|
||||||
return reorderedData
|
|
||||||
}
|
|
||||||
|
|
||||||
//repeat a message
|
//repeat a message
|
||||||
export function repeatMessageTransmission(id){
|
export function repeatMessageTransmission(id){
|
||||||
|
@ -316,8 +297,39 @@ export async function updateAllChat() {
|
||||||
.then(async function (result) {
|
.then(async function (result) {
|
||||||
for (var item of result.docs) {
|
for (var item of result.docs) {
|
||||||
if(item.type === 'beacon'){
|
if(item.type === 'beacon'){
|
||||||
chat.callsign_list.add(item.dxcallsign)
|
|
||||||
chat.unsorted_beacon_list.push(item)
|
console.log(item)
|
||||||
|
|
||||||
|
// TODO: sort beacon list .... maybe a part for a separate function
|
||||||
|
const jsonData = [item]
|
||||||
|
const dxcallsign = obj.dxcallsign
|
||||||
|
// Process each JSON item step by step
|
||||||
|
jsonData.forEach(jsonitem => {
|
||||||
|
const { snr, timestamp } = item;
|
||||||
|
|
||||||
|
// Check if dxcallsign already exists as a property in the result object
|
||||||
|
if (!chat.sorted_beacon_list[dxcallsign]) {
|
||||||
|
// If not, initialize it with an empty array for snr values
|
||||||
|
chat.sorted_beacon_list[dxcallsign] = {
|
||||||
|
dxcallsign,
|
||||||
|
snr: [],
|
||||||
|
timestamp: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Push the snr value to the corresponding dxcallsign's snr array
|
||||||
|
chat.sorted_beacon_list[dxcallsign].snr.push(snr);
|
||||||
|
chat.sorted_beacon_list[dxcallsign].timestamp.push(timestamp);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
chat.callsign_list.add(item.dxcallsign)
|
chat.callsign_list.add(item.dxcallsign)
|
||||||
chat.unsorted_chat_list.push(item)
|
chat.unsorted_chat_list.push(item)
|
||||||
|
@ -328,7 +340,6 @@ export async function updateAllChat() {
|
||||||
console.log(chat.unsorted_beacon_list)
|
console.log(chat.unsorted_beacon_list)
|
||||||
console.log(chat.sorted_beacon_list)
|
console.log(chat.sorted_beacon_list)
|
||||||
|
|
||||||
console.log(chat.sorted_chat_list["EI7IG-0"])
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -498,6 +509,34 @@ export function newBeaconReceived(obj){
|
||||||
|
|
||||||
|
|
||||||
addObjToDatabase(newChatObj)
|
addObjToDatabase(newChatObj)
|
||||||
|
|
||||||
|
|
||||||
|
console.log(obj)
|
||||||
|
|
||||||
|
const jsonData = [obj]
|
||||||
|
const dxcallsign = obj.dxcallsign
|
||||||
|
// Process each JSON item step by step
|
||||||
|
jsonData.forEach(item => {
|
||||||
|
const { snr, timestamp } = obj;
|
||||||
|
|
||||||
|
// Check if dxcallsign already exists as a property in the result object
|
||||||
|
if (!chat.sorted_beacon_list[dxcallsign]) {
|
||||||
|
// If not, initialize it with an empty array for snr values
|
||||||
|
chat.sorted_beacon_list[dxcallsign] = {
|
||||||
|
dxcallsign,
|
||||||
|
snr: [],
|
||||||
|
timestamp: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Push the snr value to the corresponding dxcallsign's snr array
|
||||||
|
chat.sorted_beacon_list[dxcallsign].snr.push(snr);
|
||||||
|
chat.sorted_beacon_list[dxcallsign].timestamp.push(timestamp);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// function for handling a received message
|
// function for handling a received message
|
||||||
|
|
|
@ -25,14 +25,17 @@ export const useChatStore = defineStore('chatStore', () => {
|
||||||
var sorted_chat_list = ref()
|
var sorted_chat_list = ref()
|
||||||
var unsorted_chat_list = ref([])
|
var unsorted_chat_list = ref([])
|
||||||
|
|
||||||
var sorted_beacon_list = ref()
|
var sorted_beacon_list = ref({})
|
||||||
var unsorted_beacon_list = ref([])
|
var unsorted_beacon_list = ref({})
|
||||||
|
|
||||||
var chartSpeedPER0 = ref()
|
var chartSpeedPER0 = ref()
|
||||||
var chartSpeedPER25 = ref()
|
var chartSpeedPER25 = ref()
|
||||||
var chartSpeedPER75 = ref()
|
var chartSpeedPER75 = ref()
|
||||||
|
|
||||||
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 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'])
|
// 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'])
|
||||||
|
var beaconDataArray = ref([])
|
||||||
|
var beaconLabelArray = ref([])
|
||||||
|
|
||||||
return {selectedCallsign, inputText, chat_filter, callsign_list, sorted_chat_list, unsorted_chat_list, inputFileName, inputFileSize, inputFileType, inputFile, chartSpeedPER0, chartSpeedPER25, chartSpeedPER75, beaconDataArray, beaconLabelArray , unsorted_beacon_list, sorted_beacon_list };
|
return {selectedCallsign, inputText, chat_filter, callsign_list, sorted_chat_list, unsorted_chat_list, inputFileName, inputFileSize, inputFileType, inputFile, chartSpeedPER0, chartSpeedPER25, chartSpeedPER75, beaconDataArray, beaconLabelArray , unsorted_beacon_list, sorted_beacon_list };
|
||||||
});
|
});
|
||||||
|
|
|
@ -2789,7 +2789,7 @@ class DATA:
|
||||||
not ARQ.arq_session
|
not ARQ.arq_session
|
||||||
and not self.arq_file_transfer
|
and not self.arq_file_transfer
|
||||||
and not Beacon.beacon_pause
|
and not Beacon.beacon_pause
|
||||||
and not ModemParam.channel_busy
|
#and not ModemParam.channel_busy
|
||||||
and TNC.tnc_state not in ["BUSY"]
|
and TNC.tnc_state not in ["BUSY"]
|
||||||
and not ARQ.arq_state
|
and not ARQ.arq_state
|
||||||
):
|
):
|
||||||
|
|
Loading…
Reference in a new issue