mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
[CodeFactor] Apply fixes
This commit is contained in:
parent
165fb9588b
commit
7ee6707047
4 changed files with 282 additions and 308 deletions
|
@ -19,10 +19,9 @@ const stateStore = useStateStore(pinia);
|
|||
import { useSettingsStore } from "../store/settingsStore.js";
|
||||
const settings = useSettingsStore(pinia);
|
||||
|
||||
|
||||
export function eventDispatcher(data){
|
||||
console.log(data)
|
||||
if (data["command"] == "modem_state") {
|
||||
export function eventDispatcher(data) {
|
||||
console.log(data);
|
||||
if (data["command"] == "modem_state") {
|
||||
//console.log(data)
|
||||
|
||||
stateStore.rx_buffer_length = data["rx_buffer_length"];
|
||||
|
@ -104,8 +103,7 @@ if (data["command"] == "modem_state") {
|
|||
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 = data["arq_seconds_until_timeout"];
|
||||
stateStore.arq_seconds_until_timeout_percent =
|
||||
(stateStore.arq_seconds_until_timeout / 180) * 100;
|
||||
|
||||
|
@ -139,18 +137,13 @@ if (data["command"] == "modem_state") {
|
|||
//speed_table: [{"bpm" : 5200, "snr": -3, "timestamp":1673555399},{"bpm" : 2315, "snr": 12, "timestamp":1673555500}],
|
||||
};
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
var message = "";
|
||||
if (data["freedata"] == "modem-message") {
|
||||
// break early if we received a dummy callsign
|
||||
// thats a kind of hotfix, as long as the modem isnt handling this better
|
||||
if (
|
||||
data["dxcallsign"] == "AA0AA-0" ||
|
||||
data["dxcallsign"] == "ZZ9YY-0"
|
||||
) {
|
||||
if (data["dxcallsign"] == "AA0AA-0" || data["dxcallsign"] == "ZZ9YY-0") {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -176,12 +169,7 @@ if (data["command"] == "modem_state") {
|
|||
switch (data["cq"]) {
|
||||
case "transmitting":
|
||||
// CQ TRANSMITTING
|
||||
displayToast(
|
||||
"success",
|
||||
"bi-arrow-left-right",
|
||||
"Transmitting CQ",
|
||||
5000,
|
||||
);
|
||||
displayToast("success", "bi-arrow-left-right", "Transmitting CQ", 5000);
|
||||
break;
|
||||
|
||||
case "received":
|
||||
|
@ -224,8 +212,7 @@ if (data["command"] == "modem_state") {
|
|||
// BEACON RECEIVED
|
||||
newBeaconReceived(data);
|
||||
|
||||
message =
|
||||
"Beacon from " + data["dxcallsign"] + " | " + data["dxgrid"];
|
||||
message = "Beacon from " + data["dxcallsign"] + " | " + data["dxgrid"];
|
||||
displayToast("info", "bi-broadcast", message, 5000);
|
||||
break;
|
||||
}
|
||||
|
@ -240,10 +227,7 @@ if (data["command"] == "modem_state") {
|
|||
case "received":
|
||||
// PING RECEIVED
|
||||
message =
|
||||
"Ping request from " +
|
||||
data["dxcallsign"] +
|
||||
" | " +
|
||||
data["dxgrid"];
|
||||
"Ping request from " + data["dxcallsign"] + " | " + data["dxgrid"];
|
||||
displayToast("success", "bi-arrow-right-short", message, 5000);
|
||||
break;
|
||||
|
||||
|
@ -372,7 +356,4 @@ if (data["command"] == "modem_state") {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
eventDispatcher
|
||||
} from "../js/eventHandler.js";
|
||||
|
||||
import { eventDispatcher } from "../js/eventHandler.js";
|
||||
|
||||
let socket;
|
||||
let retries = 0;
|
||||
|
@ -19,7 +16,7 @@ function connect() {
|
|||
// handle data
|
||||
socket.addEventListener("message", function (event) {
|
||||
console.log("Message from server:", event.data);
|
||||
eventDispatcher(event.data)
|
||||
eventDispatcher(event.data);
|
||||
});
|
||||
|
||||
// handle errors
|
||||
|
|
|
@ -9,8 +9,6 @@ import {
|
|||
getModemConfigAsJSON,
|
||||
} from "../js/settingsHandler.ts";
|
||||
|
||||
|
||||
|
||||
export async function getFromServer(host, port, endpoint) {
|
||||
// our central function for fetching the modems REST API by a specific endpoint
|
||||
// TODO make this function using the host and port, specified in settings
|
||||
|
|
|
@ -733,8 +733,6 @@ export function getRxBuffer() {
|
|||
writeTncCommand(command);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// OPEN ARQ SESSION
|
||||
export function connectARQ(dxcallsign) {
|
||||
var command =
|
||||
|
|
Loading…
Reference in a new issue