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
3349d09654
commit
3c8e77a237
1 changed files with 39 additions and 31 deletions
|
@ -119,39 +119,47 @@ export function stateDispatcher(data) {
|
||||||
export function eventDispatcher(data) {
|
export function eventDispatcher(data) {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
|
|
||||||
// break early if we received a dummy callsign
|
// break early if we received a dummy callsign
|
||||||
// thats a kind of hotfix, as long as the modem isnt handling this better
|
// 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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get ptt state as a first test
|
||||||
|
stateStore.ptt_state = data.ptt;
|
||||||
|
|
||||||
|
// catch modem related events
|
||||||
|
if (data["freedata"] == "modem-event") {
|
||||||
|
switch (data["event"]) {
|
||||||
|
case "start":
|
||||||
|
displayToast("success", "bi-arrow-left-right", "Modem started", 5000);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case "stop":
|
||||||
|
displayToast("success", "bi-arrow-left-right", "Modem stopped", 5000);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case "restart":
|
||||||
|
displayToast(
|
||||||
|
"secondary",
|
||||||
|
"bi-bootstrap-reboot",
|
||||||
|
"Modem restarted",
|
||||||
|
5000,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case "failed":
|
||||||
|
displayToast(
|
||||||
|
"danger",
|
||||||
|
"bi-bootstrap-reboot",
|
||||||
|
"Modem startup failed | bad config?",
|
||||||
|
5000,
|
||||||
|
);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// get ptt state as a first test
|
|
||||||
stateStore.ptt_state = data.ptt;
|
|
||||||
|
|
||||||
// catch modem related events
|
|
||||||
if (data["freedata"] == "modem-event") {
|
|
||||||
|
|
||||||
switch (data["event"]) {
|
|
||||||
case "start":
|
|
||||||
displayToast("success", "bi-arrow-left-right", "Modem started", 5000);
|
|
||||||
return;
|
|
||||||
|
|
||||||
case "stop":
|
|
||||||
displayToast("success", "bi-arrow-left-right", "Modem stopped", 5000);
|
|
||||||
return;
|
|
||||||
|
|
||||||
case "restart":
|
|
||||||
displayToast("secondary", "bi-bootstrap-reboot", "Modem restarted", 5000);
|
|
||||||
return;
|
|
||||||
|
|
||||||
case "failed":
|
|
||||||
displayToast("danger", "bi-bootstrap-reboot", "Modem startup failed | bad config?", 5000);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
var message = "";
|
var message = "";
|
||||||
if (data["freedata"] == "modem-message") {
|
if (data["freedata"] == "modem-message") {
|
||||||
|
|
Loading…
Reference in a new issue