mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Ping ack and gen HSL
This commit is contained in:
parent
e7586ac967
commit
ed1070be79
|
@ -43,7 +43,9 @@ export function stateDispatcher(data) {
|
||||||
stateStore.radio_status = data["radio_status"];
|
stateStore.radio_status = data["radio_status"];
|
||||||
stateStore.frequency = data["radio_frequency"];
|
stateStore.frequency = data["radio_frequency"];
|
||||||
stateStore.mode = data["radio_mode"];
|
stateStore.mode = data["radio_mode"];
|
||||||
|
//Reverse entries so most recent is first
|
||||||
stateStore.activities = Object.entries(data["activities"]).reverse();
|
stateStore.activities = Object.entries(data["activities"]).reverse();
|
||||||
|
build_HSL();
|
||||||
/*
|
/*
|
||||||
self.is_arq_state = False
|
self.is_arq_state = False
|
||||||
self.is_arq_session = False
|
self.is_arq_session = False
|
||||||
|
@ -136,6 +138,33 @@ export function stateDispatcher(data) {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function build_HSL() {
|
||||||
|
//Use data from activities to build HSL list
|
||||||
|
for (let i=0; i < stateStore.activities.length; i++) {
|
||||||
|
if (stateStore.activities[i][1].direction != "received" || stateStore.activities[i][1].origin == undefined){
|
||||||
|
//Ignore stations without origin and not received type
|
||||||
|
//console.warn("HSL: Ignoring " + stateStore.activities[i][0]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let found = false;
|
||||||
|
for (let ii=0; ii < stateStore.heard_stations.length;ii++) {
|
||||||
|
if (stateStore.heard_stations[ii].origin == stateStore.activities[i][1].origin) {
|
||||||
|
//Station already in HSL, check if newer than one in HSL
|
||||||
|
found=true;
|
||||||
|
if (stateStore.heard_stations[ii].timestamp < stateStore.activities[i][1].timestamp) {
|
||||||
|
//Update existing entry in HSL
|
||||||
|
stateStore.heard_stations[ii] = stateStore.activities[i][1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (found == false) {
|
||||||
|
//Station not in HSL, let us add it
|
||||||
|
stateStore.heard_stations.push(stateStore.activities[i][1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stateStore.heard_stations.sort((a,b) => b.timestamp - a.timestamp); // b - a for reverse sort
|
||||||
|
}
|
||||||
|
|
||||||
export function eventDispatcher(data) {
|
export function eventDispatcher(data) {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
|
|
||||||
|
@ -182,6 +211,10 @@ export function eventDispatcher(data) {
|
||||||
5000,
|
5000,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
case "PING_ACK":
|
||||||
|
//Qrv received
|
||||||
|
displayToast("success", "bi-arrow-left-right", "Received ping-ack from " + "callsignisbroken" + " | " + data["dxgrid"], 5000);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "modem-event":
|
case "modem-event":
|
||||||
|
|
Loading…
Reference in a new issue