some adaptions

This commit is contained in:
Robin Müller 2022-09-12 00:53:15 +02:00
parent 27c1002d25
commit 99ccd04b2a
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 11 additions and 9 deletions

View File

@ -71,7 +71,7 @@ from examples.tmtcc import (
from tmtccmd import TcHandlerBase, get_console_logger, TmTcCfgHookBase, BackendBase from tmtccmd import TcHandlerBase, get_console_logger, TmTcCfgHookBase, BackendBase
from tmtccmd.pus import VerificationWrapper from tmtccmd.pus import VerificationWrapper
from tmtccmd.tc import ( from tmtccmd.tc import (
ProcedureHelper, ProcedureWrapper,
FeedWrapper, FeedWrapper,
TcProcedureType, TcProcedureType,
TcQueueEntryType, TcQueueEntryType,
@ -84,7 +84,7 @@ from tmtccmd.config import (
CoreServiceList, CoreServiceList,
SetupWrapper, SetupWrapper,
SetupParams, SetupParams,
PreArgsParsingWrapper, PreArgsParsingWrapper, params_to_procedure_conversion,
) )
from common_tmtc.pus_tm.factory_hook import pus_factory_hook from common_tmtc.pus_tm.factory_hook import pus_factory_hook
@ -323,14 +323,14 @@ class TcHandler(TcHandlerBase):
) )
self.cfdp_in_ccsds_wrapper = cfdp_in_ccsds_wrapper self.cfdp_in_ccsds_wrapper = cfdp_in_ccsds_wrapper
def feed_cb(self, info: ProcedureHelper, wrapper: FeedWrapper): def feed_cb(self, info: ProcedureWrapper, wrapper: FeedWrapper):
self.queue_helper.queue_wrapper = wrapper.queue_wrapper self.queue_helper.queue_wrapper = wrapper.queue_wrapper
if info.proc_type == TcProcedureType.DEFAULT: if info.proc_type == TcProcedureType.DEFAULT:
self.handle_default_procedure(info) self.handle_default_procedure(info)
elif info.proc_type == TcProcedureType.CFDP: elif info.proc_type == TcProcedureType.CFDP:
self.handle_cfdp_procedure(info) self.handle_cfdp_procedure(info)
def handle_default_procedure(self, info: ProcedureHelper): def handle_default_procedure(self, info: ProcedureWrapper):
def_proc = info.to_def_procedure() def_proc = info.to_def_procedure()
service = def_proc.service service = def_proc.service
op_code = def_proc.op_code op_code = def_proc.op_code
@ -352,7 +352,7 @@ class TcHandler(TcHandlerBase):
return pack_service_200_commands_into(q=self.queue_helper, op_code=op_code) return pack_service_200_commands_into(q=self.queue_helper, op_code=op_code)
LOGGER.warning("Invalid Service !") LOGGER.warning("Invalid Service !")
def handle_cfdp_procedure(self, info: ProcedureHelper): def handle_cfdp_procedure(self, info: ProcedureWrapper):
cfdp_procedure = info.to_cfdp_procedure() cfdp_procedure = info.to_cfdp_procedure()
if cfdp_procedure.cfdp_request_type == CfdpRequestType.PUT: if cfdp_procedure.cfdp_request_type == CfdpRequestType.PUT:
if not self.cfdp_in_ccsds_wrapper.handler.put_request_pending(): if not self.cfdp_in_ccsds_wrapper.handler.put_request_pending():
@ -401,7 +401,7 @@ class TcHandler(TcHandlerBase):
self.file_logger.info(f"{get_current_time_string(True)}: {tc_info_string}") self.file_logger.info(f"{get_current_time_string(True)}: {tc_info_string}")
params.com_if.send(raw_tc) params.com_if.send(raw_tc)
def queue_finished_cb(self, info: ProcedureHelper): def queue_finished_cb(self, info: ProcedureWrapper):
if info is not None and info.proc_type == TcQueueEntryType.PUS_TC: if info is not None and info.proc_type == TcQueueEntryType.PUS_TC:
def_proc = info.to_def_procedure() def_proc = info.to_def_procedure()
LOGGER.info( LOGGER.info(
@ -491,12 +491,14 @@ def setup_backend(
tc_handler: TcHandler, tc_handler: TcHandler,
ccsds_handler: CcsdsTmHandler, ccsds_handler: CcsdsTmHandler,
) -> BackendBase: ) -> BackendBase:
# TODO: Convert procedure params to procedure init_proc = params_to_procedure_conversion(
setup_wrapper.proc_param_wrapper
)
tmtc_backend = tmtccmd.create_default_tmtc_backend( tmtc_backend = tmtccmd.create_default_tmtc_backend(
setup_wrapper=setup_wrapper, setup_wrapper=setup_wrapper,
tm_handler=ccsds_handler, tm_handler=ccsds_handler,
tc_handler=tc_handler, tc_handler=tc_handler,
init_procedure=None, init_procedure=init_proc.base,
) )
tmtccmd.start(tmtc_backend=tmtc_backend, hook_obj=setup_wrapper.hook_obj) tmtccmd.start(tmtc_backend=tmtc_backend, hook_obj=setup_wrapper.hook_obj)
return tmtc_backend return tmtc_backend

View File

@ -6,7 +6,7 @@ from tmtccmd.tc.queue import DefaultPusQueueHelper
def pack_service_17_commands(op_code: str, q: DefaultPusQueueHelper): def pack_service_17_commands(op_code: str, q: DefaultPusQueueHelper):
if op_code == "0": if op_code in ["0", "ping"]:
q.add_pus_tc(pack_service_17_ping_command()) q.add_pus_tc(pack_service_17_ping_command())
else: else:
pack_generic_service17_test(q=q) pack_generic_service17_test(q=q)