Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
DJ2LS 2023-12-01 10:01:38 +01:00
commit d126117bd3
4 changed files with 78 additions and 35 deletions

View file

@ -18,8 +18,8 @@ const state = useStateStore(pinia);
<button
class="btn btn-sm btn-secondary me-1"
v-bind:class="{
'btn-danger': state.ptt_state === 'True',
'btn-secondary': state.ptt_state === 'False',
'btn-danger': state.ptt_state == true,
'btn-secondary': state.ptt_state == false,
}"
id="ptt_state"
type="button"

View file

@ -23,7 +23,7 @@ export function connectionFailed(endpoint, event) {
}
export function stateDispatcher(data) {
data = JSON.parse(data);
console.log(data);
//console.log(data);
stateStore.modem_connection = "connected";
@ -144,11 +144,46 @@ export function eventDispatcher(data) {
return;
}
// get ptt state as a first test
stateStore.ptt_state = data.ptt;
console.info(data);
if (data["scatter"] !== undefined) {
//console.warn("Got scatter data!!!!");
stateStore.scatter = JSON.parse(data["scatter"]);
return;
}
// catch modem related events
if (data["freedata"] == "modem-event") {
switch (data["ptt"]) {
case true:
case false:
// get ptt state as a first test
//console.warn("PTT state true")
stateStore.ptt_state = data.ptt;
return;
}
switch (data["freedata"]) {
case "modem-message":
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 "modem-event":
switch (data["event"]) {
case "start":
displayToast("success", "bi-arrow-left-right", "Modem started", 5000);
@ -175,6 +210,10 @@ export function eventDispatcher(data) {
5000,
);
return;
default:
console.warn("Unknown event message received:");
console.warn(data);
break;
}
}

View file

@ -14,13 +14,13 @@ export const useStateStore = defineStore("stateStore", () => {
var dbfs_level = ref(0);
var radio_status = ref(false);
var ptt_state = ref("False");
var ptt_state = ref(false);
var speed_level = ref(0);
var fft = ref();
var channel_busy = ref(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_raw = ref(0);

View file

@ -6,6 +6,7 @@ class EventManager:
def __init__(self, queues):
self.queues = queues
self.log = structlog.get_logger('Event Manager')
self.lastpttstate = False
def broadcast(self, data):
self.log.debug(f"Broadcasting event: {data}")
@ -13,10 +14,13 @@ class EventManager:
q.put(data)
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):
self.broadcast({"scatter": str(data)})
self.broadcast({"scatter": json.dumps(data)})
def send_buffer_overflow(self, data):
self.broadcast({"buffer-overflow": str(data)})