basic PUS11 support
This commit is contained in:
parent
4a90841282
commit
6e89b61bf8
27
common.py
27
common.py
@ -3,6 +3,7 @@ import sys
|
|||||||
|
|
||||||
from tmtccmd.com_if import ComInterface
|
from tmtccmd.com_if import ComInterface
|
||||||
from tmtccmd.logging import get_current_time_string
|
from tmtccmd.logging import get_current_time_string
|
||||||
|
from tmtccmd.pus.pus_11_tc_sched import Subservices as Pus11Subservices
|
||||||
from tmtccmd.util import FileSeqCountProvider, PusFileSeqCountProvider
|
from tmtccmd.util import FileSeqCountProvider, PusFileSeqCountProvider
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ except ImportError as error:
|
|||||||
print("Python tmtccmd module could not be imported. Make sure it is installed")
|
print("Python tmtccmd module could not be imported. Make sure it is installed")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
from spacepackets.ecss import PusVerificator
|
from spacepackets.ecss import PusVerificator, PusTelecommand
|
||||||
|
|
||||||
from common_tmtc.pus_tc.pus_11_tc_sched import pack_service_11_commands
|
from common_tmtc.pus_tc.pus_11_tc_sched import pack_service_11_commands
|
||||||
from common_tmtc.pus_tc.pus_17_test import pack_service_17_commands
|
from common_tmtc.pus_tc.pus_17_test import pack_service_17_commands
|
||||||
@ -37,7 +38,8 @@ from tmtccmd.tc import (
|
|||||||
FeedWrapper,
|
FeedWrapper,
|
||||||
TcProcedureType,
|
TcProcedureType,
|
||||||
QueueEntryHelper,
|
QueueEntryHelper,
|
||||||
TcQueueEntryType, SendCbParams,
|
TcQueueEntryType,
|
||||||
|
SendCbParams,
|
||||||
)
|
)
|
||||||
from tmtccmd.tc.pus_5_event import pack_generic_service_5_test_into
|
from tmtccmd.tc.pus_5_event import pack_generic_service_5_test_into
|
||||||
from tmtccmd.tm import SpecificApidHandlerBase, CcsdsTmHandler
|
from tmtccmd.tm import SpecificApidHandlerBase, CcsdsTmHandler
|
||||||
@ -122,10 +124,27 @@ class TcHandler(TcHandlerBase):
|
|||||||
if params.entry.is_tc:
|
if params.entry.is_tc:
|
||||||
if params.entry.entry_type == TcQueueEntryType.PUS_TC:
|
if params.entry.entry_type == TcQueueEntryType.PUS_TC:
|
||||||
pus_tc_wrapper = params.entry.to_pus_tc_entry()
|
pus_tc_wrapper = params.entry.to_pus_tc_entry()
|
||||||
|
# TODO: All of this stuff should be done during queue insertion time
|
||||||
|
# This requires the queue helper to be optionally able to perform TC
|
||||||
|
# post-processing via a callback or something similar. Then an API can be
|
||||||
|
# added which is also able to pack time tagged TCs and stamping both TCs
|
||||||
pus_tc_wrapper.pus_tc.seq_count = (
|
pus_tc_wrapper.pus_tc.seq_count = (
|
||||||
self.seq_count_provider.get_and_increment()
|
self.seq_count_provider.get_and_increment()
|
||||||
)
|
)
|
||||||
pus_tc_wrapper.pus_tc.apid = EXAMPLE_APID
|
pus_tc_wrapper.pus_tc.apid = EXAMPLE_APID
|
||||||
|
if (
|
||||||
|
pus_tc_wrapper.pus_tc.service == 11
|
||||||
|
and pus_tc_wrapper.pus_tc.subservice == Pus11Subservices.TC_INSERT
|
||||||
|
):
|
||||||
|
try:
|
||||||
|
pus_tc = PusTelecommand.unpack(
|
||||||
|
pus_tc_wrapper.pus_tc.app_data[4:]
|
||||||
|
)
|
||||||
|
self.pus_verificator.add_tc(pus_tc)
|
||||||
|
except ValueError as e:
|
||||||
|
LOGGER.warning(
|
||||||
|
f"Attempt of unpacking time tagged TC failed with exception {e}"
|
||||||
|
)
|
||||||
# Add TC after Sequence Count stamping
|
# Add TC after Sequence Count stamping
|
||||||
self.pus_verificator.add_tc(pus_tc_wrapper.pus_tc)
|
self.pus_verificator.add_tc(pus_tc_wrapper.pus_tc)
|
||||||
raw_tc = pus_tc_wrapper.pus_tc.pack()
|
raw_tc = pus_tc_wrapper.pus_tc.pack()
|
||||||
@ -147,9 +166,7 @@ class TcHandler(TcHandlerBase):
|
|||||||
|
|
||||||
def setup_params(hook_obj: TmTcCfgHookBase) -> SetupWrapper:
|
def setup_params(hook_obj: TmTcCfgHookBase) -> SetupWrapper:
|
||||||
print(f"-- eive TMTC Commander --")
|
print(f"-- eive TMTC Commander --")
|
||||||
print(
|
print(f"-- spacepackets v{spacepackets.__version__} --")
|
||||||
f"-- spacepackets v{spacepackets.__version__} --"
|
|
||||||
)
|
|
||||||
params = SetupParams()
|
params = SetupParams()
|
||||||
parser_wrapper = ArgParserWrapper(hook_obj)
|
parser_wrapper = ArgParserWrapper(hook_obj)
|
||||||
parser_wrapper.parse()
|
parser_wrapper.parse()
|
||||||
|
Loading…
Reference in New Issue
Block a user