2023-11-30 08:24:36 +00:00
|
|
|
import frame_handler_ping
|
|
|
|
import helpers
|
|
|
|
import data_frame_factory
|
2023-12-01 18:54:46 +00:00
|
|
|
import frame_handler
|
2024-02-18 20:08:14 +00:00
|
|
|
from message_system_db_messages import DatabaseManagerMessages
|
|
|
|
|
|
|
|
|
2024-03-24 19:17:11 +00:00
|
|
|
class CQFrameHandler(frame_handler.FrameHandler):
|
2023-11-30 08:24:36 +00:00
|
|
|
|
2024-03-24 19:17:11 +00:00
|
|
|
#def should_respond(self):
|
|
|
|
# self.logger.debug(f"Respond to CQ: {self.config['MODEM']['respond_to_cq']}")
|
|
|
|
# return bool(self.config['MODEM']['respond_to_cq'] and not self.states.getARQ())
|
2024-03-24 18:29:28 +00:00
|
|
|
|
2024-03-24 19:17:11 +00:00
|
|
|
def follow_protocol(self):
|
|
|
|
if self.states.getARQ():
|
|
|
|
return
|
|
|
|
|
|
|
|
self.logger.debug(
|
|
|
|
f"[Modem] Responding to request from [{self.details['frame']['origin']}]",
|
|
|
|
snr=self.details['snr'],
|
|
|
|
)
|
|
|
|
|
|
|
|
self.send_ack()
|
2023-11-30 08:24:36 +00:00
|
|
|
|
|
|
|
def send_ack(self):
|
|
|
|
factory = data_frame_factory.DataFrameFactory(self.config)
|
|
|
|
qrv_frame = factory.build_qrv(
|
|
|
|
self.details['snr']
|
|
|
|
)
|
|
|
|
self.transmit(qrv_frame)
|
2024-02-18 20:08:14 +00:00
|
|
|
|
|
|
|
if self.config["MESSAGES"]["enable_auto_repeat"]:
|
2024-02-18 20:31:08 +00:00
|
|
|
# set message to queued if CQ received
|
2024-02-18 20:08:14 +00:00
|
|
|
DatabaseManagerMessages(self.event_manager).set_message_to_queued_for_callsign(self.details['frame']["origin"])
|