continued update to new API

This commit is contained in:
2022-07-04 17:59:09 +02:00
parent 27edcbd71d
commit 2b285417a0
19 changed files with 727 additions and 1012 deletions

View File

@ -7,14 +7,22 @@ from tmtccmd.config.definitions import CoreModeList
from spacepackets.ecss import PusVerificator
from tmtccmd import get_console_logger, TcHandlerBase
from tmtccmd.com_if import ComInterface
from tmtccmd.config.globals import update_global, CoreGlobalIds
from deps.tmtccmd.tmtccmd.logging.pus import RawTmtcTimedLogWrapper
from deps.tmtccmd.tmtccmd.pus import VerificationWrapper
from deps.tmtccmd.tmtccmd.tm import SpecificApidHandlerBase, GenericApidHandlerBase
from deps.tmtccmd.tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
from tmtccmd.logging import get_current_time_string
from tmtccmd.pus import FileSeqCountProvider
from tmtccmd.tc import ProcedureHelper, FeedWrapper, TcProcedureType
from tmtccmd.tc import (
ProcedureHelper,
FeedWrapper,
TcProcedureType,
QueueEntryHelper,
TcQueueEntryType,
)
try:
import spacepackets
@ -48,8 +56,7 @@ from config import __version__
from config.definitions import PUS_APID
from config.hook_implementations import EiveHookObject
from pus_tm.factory_hook import pus_factory_hook
from pus_tc.procedure_packer import pre_tc_send_cb
from pus_tc.procedure_packer import pre_tc_send_cb, handle_default_procedure
LOGGER = get_console_logger()
@ -93,6 +100,29 @@ class TcHandler(TcHandlerBase):
if info.proc_type == TcProcedureType.DEFAULT:
handle_default_procedure(info.to_def_procedure(), wrapper)
def send_cb(self, entry_helper: QueueEntryHelper, com_if: ComInterface):
if entry_helper.is_tc:
if entry_helper.entry_type == TcQueueEntryType.PUS_TC:
pus_tc_wrapper = entry_helper.to_pus_tc_entry()
pus_tc_wrapper.pus_tc.seq_count = (
self.seq_count_provider.next_seq_count()
)
pus_tc_wrapper.pus_tc.apid = PUS_APID
# Add TC after Sequence Count stamping
self.pus_verificator.add_tc(pus_tc_wrapper.pus_tc)
raw_tc = pus_tc_wrapper.pus_tc.pack()
self.raw_logger.log_tc(pus_tc_wrapper.pus_tc)
tc_info_string = f"Sent {pus_tc_wrapper.pus_tc}"
LOGGER.info(tc_info_string)
self.file_logger.info(
f"{get_current_time_string(True)}: {tc_info_string}"
)
com_if.send(raw_tc)
elif entry_helper.entry_type == TcQueueEntryType.LOG:
log_entry = entry_helper.to_log_entry()
LOGGER.info(log_entry.log_str)
self.file_logger.info(log_entry.log_str)
def tmtcc_pre_args() -> EiveHookObject:
print(f"-- eive tmtc v{__version__} --")