continue cfdp setup
This commit is contained in:
parent
0d9b6b7086
commit
d1f3898be8
54
common.py
54
common.py
@ -32,6 +32,7 @@ from tmtccmd.cfdp.user import (
|
|||||||
MetadataRecvParams,
|
MetadataRecvParams,
|
||||||
TransactionFinishedParams,
|
TransactionFinishedParams,
|
||||||
)
|
)
|
||||||
|
from tmtccmd.config.args import ProcedureParamsWrapper
|
||||||
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.pus.pus_11_tc_sched import Subservices as Pus11Subservices
|
||||||
from tmtccmd.tc.queue import DefaultPusQueueHelper
|
from tmtccmd.tc.queue import DefaultPusQueueHelper
|
||||||
@ -67,7 +68,13 @@ from examples.tmtcc import (
|
|||||||
CFDP_LOCAL_ENTITY_ID,
|
CFDP_LOCAL_ENTITY_ID,
|
||||||
CFDP_REMOTE_ENTITY_ID,
|
CFDP_REMOTE_ENTITY_ID,
|
||||||
)
|
)
|
||||||
from tmtccmd import TcHandlerBase, get_console_logger, TmTcCfgHookBase, BackendBase
|
from tmtccmd import (
|
||||||
|
TcHandlerBase,
|
||||||
|
get_console_logger,
|
||||||
|
TmTcCfgHookBase,
|
||||||
|
BackendBase,
|
||||||
|
DefProcedureParams,
|
||||||
|
)
|
||||||
from tmtccmd.pus import VerificationWrapper
|
from tmtccmd.pus import VerificationWrapper
|
||||||
from tmtccmd.tc import (
|
from tmtccmd.tc import (
|
||||||
ProcedureHelper,
|
ProcedureHelper,
|
||||||
@ -79,13 +86,32 @@ from tmtccmd.tc import (
|
|||||||
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
|
||||||
from tmtccmd.logging.pus import RawTmtcTimedLogWrapper
|
from tmtccmd.logging.pus import RawTmtcTimedLogWrapper
|
||||||
from tmtccmd.config import CoreServiceList, SetupWrapper, SetupParams, ArgParserWrapper
|
from tmtccmd.config import (
|
||||||
|
CoreServiceList,
|
||||||
|
SetupWrapper,
|
||||||
|
SetupParams,
|
||||||
|
PreArgsParsingWrapper,
|
||||||
|
)
|
||||||
from common_tmtc.pus_tm.factory_hook import pus_factory_hook
|
from common_tmtc.pus_tm.factory_hook import pus_factory_hook
|
||||||
|
|
||||||
|
|
||||||
LOGGER = get_console_logger()
|
LOGGER = get_console_logger()
|
||||||
|
|
||||||
|
|
||||||
|
class ExampleCfdpFaultHandler(DefaultFaultHandlerBase):
|
||||||
|
def notice_of_suspension_cb(self, cond: ConditionCode):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def notice_of_cancellation_cb(self, cond: ConditionCode):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def abandoned_cb(self, cond: ConditionCode):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def ignore_cb(self, cond: ConditionCode):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ExampleCfdpUser(CfdpUserBase):
|
class ExampleCfdpUser(CfdpUserBase):
|
||||||
def transaction_indication(self, transaction_id: TransactionId):
|
def transaction_indication(self, transaction_id: TransactionId):
|
||||||
pass
|
pass
|
||||||
@ -389,17 +415,23 @@ class TcHandler(TcHandlerBase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def setup_params(hook_obj: TmTcCfgHookBase) -> SetupWrapper:
|
def setup_params(
|
||||||
|
hook_obj: TmTcCfgHookBase, proc_param_wrapper: ProcedureParamsWrapper
|
||||||
|
) -> SetupWrapper:
|
||||||
print(f"-- eive TMTC Commander --")
|
print(f"-- eive TMTC Commander --")
|
||||||
print(f"-- spacepackets v{spacepackets.__version__} --")
|
print(f"-- spacepackets v{spacepackets.__version__} --")
|
||||||
params = SetupParams()
|
params = SetupParams()
|
||||||
parser_wrapper = ArgParserWrapper(hook_obj)
|
parser_wrapper = PreArgsParsingWrapper()
|
||||||
parser_wrapper.create_default_parent_parser()
|
parser_wrapper.create_default_parent_parser()
|
||||||
parser_wrapper.create_default_parser()
|
parser_wrapper.create_default_parser()
|
||||||
parser_wrapper.add_def_proc_and_cfdp_as_subparsers()
|
parser_wrapper.add_def_proc_and_cfdp_as_subparsers()
|
||||||
parser_wrapper.parse()
|
post_arg_parsing_wrapper = parser_wrapper.parse(hook_obj)
|
||||||
tmtccmd.init_printout(parser_wrapper.use_gui)
|
tmtccmd.init_printout(post_arg_parsing_wrapper.use_gui)
|
||||||
parser_wrapper.set_params(params)
|
use_prompts = not post_arg_parsing_wrapper.use_gui
|
||||||
|
if use_prompts:
|
||||||
|
post_arg_parsing_wrapper.set_params_with_prompts(params, proc_param_wrapper)
|
||||||
|
else:
|
||||||
|
post_arg_parsing_wrapper.set_params_without_prompts(params, proc_param_wrapper)
|
||||||
params.apid = EXAMPLE_PUS_APID
|
params.apid = EXAMPLE_PUS_APID
|
||||||
setup_wrapper = SetupWrapper(hook_obj=hook_obj, setup_params=params)
|
setup_wrapper = SetupWrapper(hook_obj=hook_obj, setup_params=params)
|
||||||
return setup_wrapper
|
return setup_wrapper
|
||||||
@ -411,7 +443,7 @@ def setup_tmtc_handlers(
|
|||||||
raw_logger: RawTmtcTimedLogWrapper,
|
raw_logger: RawTmtcTimedLogWrapper,
|
||||||
) -> (CcsdsTmHandler, TcHandler):
|
) -> (CcsdsTmHandler, TcHandler):
|
||||||
|
|
||||||
fh_base = DefaultFaultHandlerBase()
|
fh_base = ExampleCfdpFaultHandler()
|
||||||
cfdp_cfg = LocalEntityCfg(
|
cfdp_cfg = LocalEntityCfg(
|
||||||
local_entity_id=CFDP_LOCAL_ENTITY_ID,
|
local_entity_id=CFDP_LOCAL_ENTITY_ID,
|
||||||
indication_cfg=IndicationCfg(),
|
indication_cfg=IndicationCfg(),
|
||||||
@ -427,10 +459,10 @@ def setup_tmtc_handlers(
|
|||||||
default_transmission_mode=TransmissionModes.UNACKNOWLEDGED,
|
default_transmission_mode=TransmissionModes.UNACKNOWLEDGED,
|
||||||
)
|
)
|
||||||
cfdp_seq_count_provider = FileSeqCountProvider(
|
cfdp_seq_count_provider = FileSeqCountProvider(
|
||||||
max_bit_width=16, file_name=Path("cfdp_transaction_cnt.txt")
|
max_bit_width=16, file_name=Path("seqcnt_cfdp_transaction.txt")
|
||||||
)
|
)
|
||||||
cfdp_ccsds_seq_count_provider = PusFileSeqCountProvider(
|
cfdp_ccsds_seq_count_provider = PusFileSeqCountProvider(
|
||||||
file_name=Path("cfdp_ccsds_seqcnt.txt")
|
file_name=Path("seqcnt_cfdp_ccsds_.txt")
|
||||||
)
|
)
|
||||||
cfdp_user = ExampleCfdpUser()
|
cfdp_user = ExampleCfdpUser()
|
||||||
cfdp_in_ccsds_handler = CfdpCcsdsWrapper(
|
cfdp_in_ccsds_handler = CfdpCcsdsWrapper(
|
||||||
@ -452,7 +484,7 @@ def setup_tmtc_handlers(
|
|||||||
raw_logger=raw_logger,
|
raw_logger=raw_logger,
|
||||||
pus_verificator=verif_wrapper.pus_verificator,
|
pus_verificator=verif_wrapper.pus_verificator,
|
||||||
seq_count_provider=PusFileSeqCountProvider(
|
seq_count_provider=PusFileSeqCountProvider(
|
||||||
file_name=Path("pus_ccsds_seqcnt.txt")
|
file_name=Path("seqcnt_pus_ccsds.txt")
|
||||||
),
|
),
|
||||||
cfdp_in_ccsds_wrapper=cfdp_in_ccsds_handler,
|
cfdp_in_ccsds_wrapper=cfdp_in_ccsds_handler,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user