added config related parts

This commit is contained in:
DJ2LS 2024-02-18 21:08:14 +01:00
parent 25dedfde6c
commit 7a09f94767
5 changed files with 34 additions and 4 deletions

View file

@ -5,9 +5,24 @@ import { setActivePinia } from "pinia";
import pinia from "../store/index"; import pinia from "../store/index";
setActivePinia(pinia); setActivePinia(pinia);
import { settingsStore as settings } from "../store/settingsStore.js"; import { settingsStore as settings, onChange } from "../store/settingsStore.js";
</script> </script>
<template> <template>
<h5>...soon...</h5> <div class="input-group input-group-sm mb-1">
<label class="input-group-text w-50">Enable message auto repeat</label>
<label class="input-group-text w-50">
<div class="form-check form-switch form-check-inline ms-2">
<input
class="form-check-input"
type="checkbox"
@change="onChange"
v-model="settings.remote.MESSAGES.enable_auto_repeat"
/>
<label class="form-check-label" for="enableMessagesAutoRepeatSwitch"
>Re-send message on beacon</label
>
</div>
</label>
</div>
</template> </template>

View file

@ -98,6 +98,9 @@ const defaultConfig = {
tci_ip: "127.0.0.1", tci_ip: "127.0.0.1",
tci_port: 0, tci_port: 0,
}, },
MESSAGES: {
enable_auto_repeat: false,
},
}, },
}; };

View file

@ -67,6 +67,9 @@ class CONFIG:
'tx_delay': int, 'tx_delay': int,
'beacon_interval': int, 'beacon_interval': int,
}, },
'MESSAGES': {
'enable_auto_repeat': bool,
}
} }
default_values = { default_values = {
@ -175,6 +178,7 @@ class CONFIG:
# Sets and writes config data from a dict containing data settings # Sets and writes config data from a dict containing data settings
def write(self, data): def write(self, data):
print(data)
# Validate config data before writing # Validate config data before writing
self.validate_data(data) self.validate_data(data)

View file

@ -17,5 +17,6 @@ class BeaconFrameHandler(frame_handler.FrameHandler):
self.details['frame']["gridsquare"] self.details['frame']["gridsquare"]
) )
if self.config["MESSAGES"]["enable_auto_repeat"]:
# set message to queued if beacon received # set message to queued if beacon received
DatabaseManagerMessages(self.event_manager).set_message_to_queued_for_callsign(self.details['frame']["origin"]) DatabaseManagerMessages(self.event_manager).set_message_to_queued_for_callsign(self.details['frame']["origin"])

View file

@ -2,6 +2,9 @@ import frame_handler_ping
import helpers import helpers
import data_frame_factory import data_frame_factory
import frame_handler import frame_handler
from message_system_db_messages import DatabaseManagerMessages
class CQFrameHandler(frame_handler_ping.PingFrameHandler): class CQFrameHandler(frame_handler_ping.PingFrameHandler):
def should_respond(self): def should_respond(self):
@ -14,3 +17,7 @@ class CQFrameHandler(frame_handler_ping.PingFrameHandler):
self.details['snr'] self.details['snr']
) )
self.transmit(qrv_frame) self.transmit(qrv_frame)
if self.config["MESSAGES"]["enable_auto_repeat"]:
# set message to queued if beacon received
DatabaseManagerMessages(self.event_manager).set_message_to_queued_for_callsign(self.details['frame']["origin"])