mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
moved frame activity to frame handler
This commit is contained in:
parent
7a88875309
commit
f01cc38e64
2 changed files with 27 additions and 24 deletions
|
@ -4,7 +4,6 @@ FRAME DISPATCHER - We are dispatching the received frames to the needed function
|
|||
|
||||
"""
|
||||
import threading
|
||||
import helpers
|
||||
import structlog
|
||||
from modem_frametypes import FRAME_TYPE as FR_TYPE
|
||||
import event_manager
|
||||
|
@ -80,7 +79,6 @@ class DISPATCHER():
|
|||
self.arq_iss = ISS(config, event_queue, states)
|
||||
self.arq_session = SESSION(config, event_queue, states)
|
||||
|
||||
|
||||
self.event_manager = event_manager.EventManager([event_queue])
|
||||
|
||||
def _initialize_dispatchers(self):
|
||||
|
@ -174,28 +172,6 @@ class DISPATCHER():
|
|||
MODEM_TRANSMIT_QUEUE,
|
||||
self.arq_sessions)
|
||||
|
||||
|
||||
|
||||
activity = {
|
||||
"direction": "received",
|
||||
"snr": snr,
|
||||
"offset": offset,
|
||||
"activity_type": self.FRAME_HANDLER[frametype]['name']
|
||||
}
|
||||
if "origin" in deconstructed_frame:
|
||||
activity["origin"] = deconstructed_frame["origin"]
|
||||
|
||||
if "destination" in deconstructed_frame:
|
||||
activity["destination"] = deconstructed_frame["destination"]
|
||||
|
||||
if "gridsquare" in deconstructed_frame:
|
||||
activity["gridsquare"] = deconstructed_frame["gridsquare"]
|
||||
|
||||
if "session_id" in deconstructed_frame:
|
||||
activity["session_id"] = deconstructed_frame["session_id"]
|
||||
|
||||
self.states.add_activity(activity)
|
||||
|
||||
handler.handle(deconstructed_frame, snr, offset, freedv, bytes_per_frame)
|
||||
|
||||
def old_process_data(self, bytes_out, freedv, bytes_per_frame: int, snr) -> None:
|
||||
|
|
|
@ -28,6 +28,32 @@ class FrameHandler():
|
|||
'bytes_per_frame': 0
|
||||
}
|
||||
|
||||
|
||||
|
||||
def add_to_activity_list(self):
|
||||
frame = self.details['frame']
|
||||
|
||||
activity = {
|
||||
"direction": "received",
|
||||
"snr": self.details['snr'],
|
||||
"offset": self.details['offset'],
|
||||
"activity_type": frame["frame_type"]
|
||||
}
|
||||
if "origin" in frame:
|
||||
activity["origin"] = frame["origin"]
|
||||
|
||||
if "destination" in frame:
|
||||
activity["destination"] = frame["destination"]
|
||||
|
||||
if "gridsquare" in frame:
|
||||
activity["gridsquare"] = frame["gridsquare"]
|
||||
|
||||
if "session_id" in frame:
|
||||
activity["session_id"] = frame["session_id"]
|
||||
|
||||
self.states.add_activity(activity)
|
||||
|
||||
|
||||
def add_to_heard_stations(self):
|
||||
frame = self.details['frame']
|
||||
|
||||
|
@ -97,5 +123,6 @@ class FrameHandler():
|
|||
|
||||
self.log()
|
||||
self.add_to_heard_stations()
|
||||
self.add_to_activity_list()
|
||||
self.emit_event()
|
||||
self.follow_protocol()
|
||||
|
|
Loading…
Reference in a new issue