diff --git a/tmtc/.idea/runConfigurations/spacepackets_unittests.xml b/tmtc/.idea/runConfigurations/spacepackets_unittests.xml
new file mode 100644
index 0000000..c80d502
--- /dev/null
+++ b/tmtc/.idea/runConfigurations/spacepackets_unittests.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tmtc/.idea/runConfigurations/tmtccmd_unittests.xml b/tmtc/.idea/runConfigurations/tmtccmd_unittests.xml
new file mode 100644
index 0000000..b21278c
--- /dev/null
+++ b/tmtc/.idea/runConfigurations/tmtccmd_unittests.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tmtc/common_tmtc b/tmtc/common_tmtc
index c83e00a..1c09052 160000
--- a/tmtc/common_tmtc
+++ b/tmtc/common_tmtc
@@ -1 +1 @@
-Subproject commit c83e00a67bfb8493e8955cad26d266f9b4033795
+Subproject commit 1c0905292e0f2983c723ad19710d27c402fbcf3f
diff --git a/tmtc/deps/tmtccmd b/tmtc/deps/tmtccmd
index 89ac892..e45e5ca 160000
--- a/tmtc/deps/tmtccmd
+++ b/tmtc/deps/tmtccmd
@@ -1 +1 @@
-Subproject commit 89ac892ea9992df4cf6f662c649b18f49b6c809e
+Subproject commit e45e5caca3926c2e800a991f16a6bbdf4c3a77d0
diff --git a/tmtc/tmtcc.py b/tmtc/tmtcc.py
index 698d16a..5117dc6 100755
--- a/tmtc/tmtcc.py
+++ b/tmtc/tmtcc.py
@@ -2,13 +2,36 @@
"""TMTC commander for FSFW Example"""
import sys
import time
+from pathlib import Path
+from typing import Sequence
+from spacepackets.cfdp import ConditionCode, TransmissionModes
from spacepackets.ecss import PusVerificator
import tmtccmd
-from common_tmtc.common import setup_params, setup_tmtc_handlers, setup_backend
+from common_tmtc.common import (
+ setup_params,
+ setup_tmtc_handlers,
+ setup_backend,
+ EXAMPLE_APID,
+)
from config.hook import FsfwHookBase
+from spacepackets.util import UnsignedByteField
from tmtccmd import get_console_logger
+from tmtccmd.cfdp import (
+ LocalEntityCfg,
+ CfdpUserBase,
+ TransactionId,
+ RemoteEntityCfg,
+ RemoteEntityCfgTable,
+ HostFilestore,
+)
+from tmtccmd.cfdp.request import PutRequestCfg, PutRequest
+from tmtccmd.cfdp.user import (
+ FileSegmentRecvdParams,
+ MetadataRecvParams,
+ TransactionFinishedParams,
+)
from tmtccmd.core import BackendRequest
from tmtccmd.logging.pus import (
RegularTmtcLogWrapper,
@@ -16,11 +39,87 @@ from tmtccmd.logging.pus import (
TimedLogWhen,
)
from tmtccmd.pus import VerificationWrapper
+from tmtccmd.util import ProvidesSeqCount
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
+from tmtccmd.cfdp.handler import DestHandler, SourceHandler
LOGGER = get_console_logger()
+class CfdpHandler(CfdpUserBase):
+ def __init__(
+ self,
+ cfg: LocalEntityCfg,
+ seq_cnt_provider: ProvidesSeqCount,
+ remote_cfg: Sequence[RemoteEntityCfg],
+ ):
+ vfs = HostFilestore()
+ super().__init__(vfs)
+ self.dest_id = UnsignedByteField(EXAMPLE_APID, 2)
+ self.remote_cfg_table = RemoteEntityCfgTable()
+ self.remote_cfg_table.add_remote_entities(remote_cfg)
+ self.dest_handler = DestHandler(cfg, self, self.remote_cfg_table)
+ self.source_handler = SourceHandler(cfg, seq_cnt_provider, self)
+
+ def put_request_file(
+ self,
+ source_path: Path,
+ dest_path: Path,
+ trans_mode: TransmissionModes,
+ closure_requested: bool,
+ ):
+ put_request_cfg = PutRequestCfg(
+ destination_id=self.dest_id,
+ source_file=source_path,
+ dest_file=dest_path.as_posix(),
+ trans_mode=trans_mode,
+ closure_requested=closure_requested,
+ )
+ put_request = PutRequest(put_request_cfg)
+ self.source_handler.put_request(
+ put_request, self.remote_cfg_table.get_remote_entity(self.dest_id)
+ )
+
+ def transaction_indication(self, transaction_id: TransactionId):
+ pass
+
+ def eof_sent_indication(self, transaction_id: TransactionId):
+ pass
+
+ def transaction_finished_indication(self, params: TransactionFinishedParams):
+ pass
+
+ def metadata_recv_indication(self, params: MetadataRecvParams):
+ pass
+
+ def file_segment_recv_indication(self, params: FileSegmentRecvdParams):
+ pass
+
+ def report_indication(self, transaction_id: TransactionId, status_report: any):
+ pass
+
+ def suspended_indication(
+ self, transaction_id: TransactionId, cond_code: ConditionCode
+ ):
+ pass
+
+ def resumed_indication(self, transaction_id: TransactionId, progress: int):
+ pass
+
+ def fault_indication(
+ self, transaction_id: TransactionId, cond_code: ConditionCode, progress: int
+ ):
+ pass
+
+ def abandoned_indication(
+ self, transaction_id: TransactionId, cond_code: ConditionCode, progress: int
+ ):
+ pass
+
+ def eof_recv_indication(self, transaction_id: TransactionId):
+ pass
+
+
def main():
setup_wrapper = setup_params(FsfwHookBase())
tmtc_logger = RegularTmtcLogWrapper()