mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
d126117bd3
4 changed files with 78 additions and 35 deletions
|
@ -18,8 +18,8 @@ const state = useStateStore(pinia);
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-secondary me-1"
|
class="btn btn-sm btn-secondary me-1"
|
||||||
v-bind:class="{
|
v-bind:class="{
|
||||||
'btn-danger': state.ptt_state === 'True',
|
'btn-danger': state.ptt_state == true,
|
||||||
'btn-secondary': state.ptt_state === 'False',
|
'btn-secondary': state.ptt_state == false,
|
||||||
}"
|
}"
|
||||||
id="ptt_state"
|
id="ptt_state"
|
||||||
type="button"
|
type="button"
|
||||||
|
|
|
@ -23,7 +23,7 @@ export function connectionFailed(endpoint, event) {
|
||||||
}
|
}
|
||||||
export function stateDispatcher(data) {
|
export function stateDispatcher(data) {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
console.log(data);
|
//console.log(data);
|
||||||
|
|
||||||
stateStore.modem_connection = "connected";
|
stateStore.modem_connection = "connected";
|
||||||
|
|
||||||
|
@ -144,38 +144,77 @@ export function eventDispatcher(data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get ptt state as a first test
|
console.info(data);
|
||||||
stateStore.ptt_state = data.ptt;
|
if (data["scatter"] !== undefined) {
|
||||||
|
//console.warn("Got scatter data!!!!");
|
||||||
|
stateStore.scatter = JSON.parse(data["scatter"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// catch modem related events
|
switch (data["ptt"]) {
|
||||||
if (data["freedata"] == "modem-event") {
|
case true:
|
||||||
switch (data["event"]) {
|
case false:
|
||||||
case "start":
|
// get ptt state as a first test
|
||||||
displayToast("success", "bi-arrow-left-right", "Modem started", 5000);
|
//console.warn("PTT state true")
|
||||||
return;
|
stateStore.ptt_state = data.ptt;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
case "stop":
|
switch (data["freedata"]) {
|
||||||
displayToast("success", "bi-arrow-left-right", "Modem stopped", 5000);
|
case "modem-message":
|
||||||
return;
|
switch (data["received"]) {
|
||||||
|
case "BEACON":
|
||||||
|
//Beacon received
|
||||||
|
displayToast(
|
||||||
|
"info",
|
||||||
|
"bi-broadcast",
|
||||||
|
"Beacon from " + data["dxcallsign"],
|
||||||
|
5000,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
case "QRV":
|
||||||
|
//Qrv received
|
||||||
|
displayToast(
|
||||||
|
"success",
|
||||||
|
"bi-person-raised-hand",
|
||||||
|
"QRV from " + data["dxcallsign"],
|
||||||
|
5000,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
case "restart":
|
case "modem-event":
|
||||||
displayToast(
|
switch (data["event"]) {
|
||||||
"secondary",
|
case "start":
|
||||||
"bi-bootstrap-reboot",
|
displayToast("success", "bi-arrow-left-right", "Modem started", 5000);
|
||||||
"Modem restarted",
|
return;
|
||||||
5000,
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
|
|
||||||
case "failed":
|
case "stop":
|
||||||
displayToast(
|
displayToast("success", "bi-arrow-left-right", "Modem stopped", 5000);
|
||||||
"danger",
|
return;
|
||||||
"bi-bootstrap-reboot",
|
|
||||||
"Modem startup failed | bad config?",
|
case "restart":
|
||||||
5000,
|
displayToast(
|
||||||
);
|
"secondary",
|
||||||
return;
|
"bi-bootstrap-reboot",
|
||||||
}
|
"Modem restarted",
|
||||||
|
5000,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case "failed":
|
||||||
|
displayToast(
|
||||||
|
"danger",
|
||||||
|
"bi-bootstrap-reboot",
|
||||||
|
"Modem startup failed | bad config?",
|
||||||
|
5000,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
console.warn("Unknown event message received:");
|
||||||
|
console.warn(data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -14,13 +14,13 @@ export const useStateStore = defineStore("stateStore", () => {
|
||||||
var dbfs_level = ref(0);
|
var dbfs_level = ref(0);
|
||||||
var radio_status = ref(false);
|
var radio_status = ref(false);
|
||||||
|
|
||||||
var ptt_state = ref("False");
|
var ptt_state = ref(false);
|
||||||
|
|
||||||
var speed_level = ref(0);
|
var speed_level = ref(0);
|
||||||
var fft = ref();
|
var fft = ref();
|
||||||
var channel_busy = ref(false);
|
var channel_busy = ref(false);
|
||||||
var channel_busy_slot = ref([false, false, false, false, false]);
|
var channel_busy_slot = ref([false, false, false, false, false]);
|
||||||
var scatter = ref();
|
var scatter = ref([]);
|
||||||
var s_meter_strength_percent = ref(0);
|
var s_meter_strength_percent = ref(0);
|
||||||
var s_meter_strength_raw = ref(0);
|
var s_meter_strength_raw = ref(0);
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ class EventManager:
|
||||||
def __init__(self, queues):
|
def __init__(self, queues):
|
||||||
self.queues = queues
|
self.queues = queues
|
||||||
self.log = structlog.get_logger('Event Manager')
|
self.log = structlog.get_logger('Event Manager')
|
||||||
|
self.lastpttstate = False
|
||||||
|
|
||||||
def broadcast(self, data):
|
def broadcast(self, data):
|
||||||
self.log.debug(f"Broadcasting event: {data}")
|
self.log.debug(f"Broadcasting event: {data}")
|
||||||
|
@ -13,10 +14,13 @@ class EventManager:
|
||||||
q.put(data)
|
q.put(data)
|
||||||
|
|
||||||
def send_ptt_change(self, on:bool = False):
|
def send_ptt_change(self, on:bool = False):
|
||||||
self.broadcast({"ptt": str(on)})
|
if (on == self.lastpttstate):
|
||||||
|
return
|
||||||
|
self.lastpttstate= on
|
||||||
|
self.broadcast({"ptt": bool(on)})
|
||||||
|
|
||||||
def send_scatter_change(self, data):
|
def send_scatter_change(self, data):
|
||||||
self.broadcast({"scatter": str(data)})
|
self.broadcast({"scatter": json.dumps(data)})
|
||||||
|
|
||||||
def send_buffer_overflow(self, data):
|
def send_buffer_overflow(self, data):
|
||||||
self.broadcast({"buffer-overflow": str(data)})
|
self.broadcast({"buffer-overflow": str(data)})
|
||||||
|
|
Loading…
Reference in a new issue