diff --git a/tmtc/.gitignore b/tmtc/.gitignore
index f1ab1a9..734d816 100644
--- a/tmtc/.gitignore
+++ b/tmtc/.gitignore
@@ -3,4 +3,5 @@
/venv
/config/tmtc_config.json
-/log/*.log
\ No newline at end of file
+/log/*.log
+/seqcnt.txt
diff --git a/tmtc/.idea/runConfigurations/TMTC_GUI.xml b/tmtc/.idea/runConfigurations/TMTC_GUI.xml
index b386fe4..716dc79 100644
--- a/tmtc/.idea/runConfigurations/TMTC_GUI.xml
+++ b/tmtc/.idea/runConfigurations/TMTC_GUI.xml
@@ -12,8 +12,8 @@
-
-
+
+
diff --git a/tmtc/.idea/runConfigurations/TMTC_Listener.xml b/tmtc/.idea/runConfigurations/TMTC_Listener.xml
new file mode 100644
index 0000000..fdefda3
--- /dev/null
+++ b/tmtc/.idea/runConfigurations/TMTC_Listener.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tmtc/common_tmtc b/tmtc/common_tmtc
index 4cc02d2..d87e297 160000
--- a/tmtc/common_tmtc
+++ b/tmtc/common_tmtc
@@ -1 +1 @@
-Subproject commit 4cc02d287d48569f4c8b6aed836098efb2b0ea41
+Subproject commit d87e2971b43aa464a4860900f7713c0a551cc4f5
diff --git a/tmtc/config/hook.py b/tmtc/config/hook.py
index 46ee7ef..6676e3f 100644
--- a/tmtc/config/hook.py
+++ b/tmtc/config/hook.py
@@ -1,11 +1,21 @@
+from typing import Optional
+
+from common_tmtc.config.definitions import TM_SP_IDS
from common_tmtc.config.hook_implementation import CommonFsfwHookBase
-from tmtccmd.tc.definitions import TcQueueT
+from common_tmtc.pus_tc.cmd_definitions import common_fsfw_service_op_code_dict
+from tmtccmd.com_if import ComInterface
+from tmtccmd.config import TmTcDefWrapper
class FsfwHookBase(CommonFsfwHookBase):
- def pack_service_queue(self, service: int, op_code: str, service_queue: TcQueueT):
- from common_tmtc.pus_tc.tc_packing import common_service_queue_user
+ def get_tmtc_definitions(self) -> TmTcDefWrapper:
+ return common_fsfw_service_op_code_dict()
- common_service_queue_user(
- service=service, op_code=op_code, tc_queue=service_queue
+ def assign_communication_interface(self, com_if_key: str) -> Optional[ComInterface]:
+ from tmtccmd.config.com_if import create_communication_interface_default
+
+ return create_communication_interface_default(
+ com_if_key=com_if_key,
+ json_cfg_path=self.json_cfg_path,
+ space_packet_ids=TM_SP_IDS,
)
diff --git a/tmtc/deps/tmtccmd b/tmtc/deps/tmtccmd
index dd56396..4d34585 160000
--- a/tmtc/deps/tmtccmd
+++ b/tmtc/deps/tmtccmd
@@ -1 +1 @@
-Subproject commit dd56396e12d5c06418a05902839cec62d9c7f06c
+Subproject commit 4d34585d45ede975f14e16c730390b6bd8343e8f
diff --git a/tmtc/requirements.txt b/tmtc/requirements.txt
index f444d16..7b30a11 100644
--- a/tmtc/requirements.txt
+++ b/tmtc/requirements.txt
@@ -1 +1 @@
-tmtccmd >= 2.2.1
+tmtccmd >= 3.0.0rc1
diff --git a/tmtc/tmtcc.py b/tmtc/tmtcc.py
index 74dbe56..afafa06 100644
--- a/tmtc/tmtcc.py
+++ b/tmtc/tmtcc.py
@@ -1,27 +1,61 @@
#!/usr/bin/env python3
"""TMTC commander for FSFW Example"""
+import sys
+import time
+
+from spacepackets.ecss import PusVerificator
+
import tmtccmd
-from common_tmtc.common import (
- tmtcc_post_args,
- tmtcc_pre_args
-)
+from common_tmtc.common import setup_params, setup_tmtc_handlers, setup_backend
from config.hook import FsfwHookBase
-from examples.tmtcc import EXAMPLE_APID
-from tmtccmd.config import SetupParams, ArgParserWrapper, SetupWrapper
+from tmtccmd import get_console_logger
+from tmtccmd.core import BackendRequest
+from tmtccmd.logging.pus import (
+ RegularTmtcLogWrapper,
+ RawTmtcTimedLogWrapper,
+ TimedLogWhen,
+)
+from tmtccmd.pus import VerificationWrapper
+from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
+
+
+LOGGER = get_console_logger()
def main():
- tmtcc_pre_args()
- hook_obj = FsfwHookBase(json_cfg_path="tmtc_conf.json")
- params = SetupParams()
- parser_wrapper = ArgParserWrapper(hook_obj)
- parser_wrapper.parse()
- tmtccmd.init_printout(parser_wrapper.use_gui)
- parser_wrapper.set_params(params)
- params.apid = EXAMPLE_APID
- setup_wrapper = SetupWrapper(hook_obj, params)
-
- tmtcc_post_args(hook_obj=hook_obj, use_gui=False, args=args)
+ setup_wrapper = setup_params(FsfwHookBase())
+ tmtc_logger = RegularTmtcLogWrapper()
+ printer = FsfwTmTcPrinter(tmtc_logger.logger)
+ raw_logger = RawTmtcTimedLogWrapper(when=TimedLogWhen.PER_HOUR, interval=2)
+ pus_verificator = PusVerificator()
+ verif_wrapper = VerificationWrapper(
+ console_logger=get_console_logger(),
+ file_logger=printer.file_logger,
+ pus_verificator=pus_verificator,
+ )
+ ccsds_handler, tc_handler = setup_tmtc_handlers(
+ verif_wrapper=verif_wrapper, raw_logger=raw_logger, printer=printer
+ )
+ tmtccmd.setup(setup_wrapper)
+ backend = setup_backend(
+ setup_wrapper=setup_wrapper, ccsds_handler=ccsds_handler, tc_handler=tc_handler
+ )
+ try:
+ while True:
+ state = backend.periodic_op(None)
+ if state.request == BackendRequest.TERMINATION_NO_ERROR:
+ sys.exit(0)
+ elif state.request == BackendRequest.DELAY_IDLE:
+ LOGGER.info("TMTC Client in IDLE mode")
+ time.sleep(3.0)
+ elif state.request == BackendRequest.DELAY_LISTENER:
+ time.sleep(0.8)
+ elif state.request == BackendRequest.DELAY_CUSTOM:
+ time.sleep(state.next_delay.total_seconds())
+ elif state.request == BackendRequest.CALL_NEXT:
+ pass
+ except KeyboardInterrupt:
+ sys.exit(0)
if __name__ == "__main__":