this seems to work well
All checks were successful
EIVE/-/pipeline/head This commit looks good

This commit is contained in:
2023-11-13 11:12:18 +01:00
parent b3c3363591
commit ce363e3785
5 changed files with 229 additions and 196 deletions

View File

@ -1,5 +1,4 @@
#!/usr/bin/env python3
import sqlite3
import logging
import sys
import time
@ -16,7 +15,6 @@ from spacepackets.ecss import PusVerificator
from spacepackets.version import get_version as get_sp_version
from tmtccmd import BackendBase
from tmtccmd.cfdp.handler import RemoteEntityCfgTable
from eive_tmtc.cfdp.handler import CfdpInCcsdsHandler
from tmtccmd.cfdp.mib import (
IndicationCfg,
LocalEntityCfg,
@ -41,11 +39,13 @@ from tmtccmd.logging.pus import (
TimedLogWhen,
)
from tmtccmd.pus import VerificationWrapper
from tmtccmd.tmtc import CcsdsTmHandler, GenericApidHandlerBase, SpecificApidHandlerBase
from tmtccmd.tmtc import CcsdsTmHandler
from tmtccmd.util import FileSeqCountProvider, PusFileSeqCountProvider
from eive_tmtc import APP_LOGGER
from eive_tmtc.pus_tm.pus_handler import PusHandler, UnknownApidHandler
from eive_tmtc.cfdp.fault_handler import EiveCfdpFaultHandler
from eive_tmtc.cfdp.handler import CfdpInCcsdsHandler
from eive_tmtc.cfdp.tm import CfdpInCcsdsWrapper
from eive_tmtc.cfdp.user import EiveCfdpUser, EiveCheckTimerProvider
from eive_tmtc.config.definitions import (
@ -53,12 +53,9 @@ from eive_tmtc.config.definitions import (
CFDP_LOCAL_ENTITY_ID,
CFDP_REMOTE_ENTITY_ID,
PUS_APID,
DB_PATH,
)
from eive_tmtc.config.hook import EiveHookObject
from eive_tmtc.pus_tc.tc_handler import TcHandler
from eive_tmtc.pus_tm.hk_handler import HkFilter
from eive_tmtc.pus_tm.pus_demux import pus_factory_hook
_LOGGER = APP_LOGGER
_LOG_LEVEL = logging.INFO
@ -68,43 +65,6 @@ ROTATING_TIMED_LOGGER_INTERVAL_WHEN = TimedLogWhen.PER_MINUTE
ROTATING_TIMED_LOGGER_INTERVAL = 30
class PusHandler(SpecificApidHandlerBase):
def __init__(
self,
wrapper: VerificationWrapper,
printer: FsfwTmTcPrinter,
raw_logger: RawTmtcTimedLogWrapper,
hk_level: int,
):
super().__init__(PUS_APID, None)
self.printer = printer
self.verif_wrapper = wrapper
self.raw_logger = raw_logger
self.hk_level = hk_level
self.these_objs_hk_only = []
self.hk_filter = HkFilter(object_ids=self.these_objs_hk_only, set_ids=[])
self.tm_db = sqlite3.connect(DB_PATH)
def handle_tm(self, packet: bytes, _user_args: any):
# with open("tc.bin", "wb") as of:
# of.write(packet)
pus_factory_hook(
packet,
self.verif_wrapper,
self.printer,
self.raw_logger,
self.hk_level,
self.hk_filter,
)
class UnknownApidHandler(GenericApidHandlerBase):
def handle_tm(self, apid: int, packet: bytes, _user_args: any):
_LOGGER.warning(
f"Packet with unknown APID {apid} detected: {packet.hex(sep=',')}"
)
class CustomCcsdsTmHandler(CcsdsTmHandler):
def user_hook(self, apid: int, packet: bytes):
_LOGGER.debug(f"Received packet {packet.hex(sep=',')} with APID {apid}")