[CodeFactor] Apply fixes to commit 85b81bb

This commit is contained in:
codefactor-io 2024-01-04 14:47:19 +00:00
parent 85b81bb0dd
commit 9dacf64601
No known key found for this signature in database
GPG key ID: B66B2D63282C190F

View file

@ -27,10 +27,7 @@ export function stateDispatcher(data) {
stateStore.modem_connection = "connected"; stateStore.modem_connection = "connected";
if ( if (data["type"] == "state-change" || data["type"] == "state") {
data["type"] == "state-change" ||
data["type"] == "state"
) {
stateStore.channel_busy = data["channel_busy"]; stateStore.channel_busy = data["channel_busy"];
stateStore.is_codec2_traffic = data["is_codec2_traffic"]; stateStore.is_codec2_traffic = data["is_codec2_traffic"];
stateStore.is_modem_running = data["is_modem_running"]; stateStore.is_modem_running = data["is_modem_running"];
@ -139,7 +136,6 @@ export function stateDispatcher(data) {
} }
} }
export function eventDispatcher(data) { export function eventDispatcher(data) {
data = JSON.parse(data); data = JSON.parse(data);
@ -155,7 +151,6 @@ export function eventDispatcher(data) {
return; return;
} }
switch (data["ptt"]) { switch (data["ptt"]) {
case true: case true:
case false: case false:
@ -167,11 +162,10 @@ export function eventDispatcher(data) {
switch (data["type"]) { switch (data["type"]) {
case "hello-client": case "hello-client":
console.log("hello client received") console.log("hello client received");
return return;
} }
switch (data["freedata"]) { switch (data["freedata"]) {
case "modem-message": case "modem-message":
switch (data["received"]) { switch (data["received"]) {
@ -250,69 +244,67 @@ export function eventDispatcher(data) {
} }
} }
if (data['arq-transfer-outbound']) { if (data["arq-transfer-outbound"]) {
switch (data["arq-transfer-outbound"].state) { switch (data["arq-transfer-outbound"].state) {
case "OPEN_SENT":
console.log("state OPEN_ACK_SENT needs to be implemented");
return;
case "OPEN_SENT": case "INFO_SENT":
console.log("state OPEN_ACK_SENT needs to be implemented") console.log("state INFO_ACK_SENT needs to be implemented");
return return;
case "INFO_SENT": case "BURST_SENT":
console.log("state INFO_ACK_SENT needs to be implemented") console.log("state BURST_REPLY_SENT needs to be implemented");
return return;
case "BURST_SENT": case "ABORTING":
console.log("state BURST_REPLY_SENT needs to be implemented") console.log("state ABORTING needs to be implemented");
return return;
case "ABORTING": case "ABORTED":
console.log("state ABORTING needs to be implemented") console.log("state ABORTED needs to be implemented");
return return;
case "ABORTED": case "FAILED":
console.log("state ABORTED needs to be implemented") let message = "Transmission failed";
return displayToast("danger", "bi-x-octagon", message, 5000);
return;
case "FAILED":
let message = "Transmission failed";
displayToast("danger", "bi-x-octagon", message, 5000);
return
}
} }
}
if (data['arq-transfer-inbound']) { if (data["arq-transfer-inbound"]) {
switch (data["arq-transfer-inbound"].state) { switch (data["arq-transfer-inbound"].state) {
case "NEW":
console.log("state NEW needs to be implemented");
return;
case "NEW": case "OPEN_ACK_SENT":
console.log("state NEW needs to be implemented") console.log("state OPEN_ACK_SENT needs to be implemented");
return return;
case "OPEN_ACK_SENT": case "INFO_ACK_SENT":
console.log("state OPEN_ACK_SENT needs to be implemented") console.log("state INFO_ACK_SENT needs to be implemented");
return return;
case "INFO_ACK_SENT": case "BURST_REPLY_SENT":
console.log("state INFO_ACK_SENT needs to be implemented") console.log("state BURST_REPLY_SENT needs to be implemented");
return return;
case "BURST_REPLY_SENT": case "ENDED":
console.log("state BURST_REPLY_SENT needs to be implemented") console.log("state ENDED needs to be implemented");
return return;
case "ENDED": case "ABORTED":
console.log("state ENDED needs to be implemented") console.log("state ABORTED needs to be implemented");
return return;
case "ABORTED": case "FAILED":
console.log("state ABORTED needs to be implemented") let message = "Transmission failed";
return displayToast("danger", "bi-x-octagon", message, 5000);
return;
case "FAILED":
let message = "Transmission failed";
displayToast("danger", "bi-x-octagon", message, 5000);
return
}
} }
}
/* /*
@ -531,7 +523,6 @@ export function eventDispatcher(data) {
*/ */
} }
function build_HSL() { function build_HSL() {
//Use data from activities to build HSL list //Use data from activities to build HSL list
for (let i = 0; i < stateStore.activities.length; i++) { for (let i = 0; i < stateStore.activities.length; i++) {
@ -566,4 +557,4 @@ function build_HSL() {
} }
} }
stateStore.heard_stations.sort((a, b) => b.timestamp - a.timestamp); // b - a for reverse sort stateStore.heard_stations.sort((a, b) => b.timestamp - a.timestamp); // b - a for reverse sort
} }