provide function to start put request
This commit is contained in:
parent
3f0367fdb2
commit
87c7542015
17
tmtc/.idea/runConfigurations/spacepackets_unittests.xml
generated
Normal file
17
tmtc/.idea/runConfigurations/spacepackets_unittests.xml
generated
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="spacepackets unittests" type="tests" factoryName="Autodetect">
|
||||||
|
<module name="tmtc" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<option name="SDK_HOME" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/deps/spacepackets/tests" />
|
||||||
|
<option name="IS_MODULE_SDK" value="true" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||||
|
<option name="_new_additionalArguments" value="""" />
|
||||||
|
<option name="_new_target" value=""$PROJECT_DIR$/deps/spacepackets/tests"" />
|
||||||
|
<option name="_new_targetType" value=""PATH"" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
17
tmtc/.idea/runConfigurations/tmtccmd_unittests.xml
generated
Normal file
17
tmtc/.idea/runConfigurations/tmtccmd_unittests.xml
generated
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="tmtccmd unittests" type="tests" factoryName="Autodetect">
|
||||||
|
<module name="tmtc" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<option name="SDK_HOME" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/deps/tmtccmd/tests" />
|
||||||
|
<option name="IS_MODULE_SDK" value="true" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||||
|
<option name="_new_additionalArguments" value="""" />
|
||||||
|
<option name="_new_target" value=""$PROJECT_DIR$/deps/tmtccmd/tests"" />
|
||||||
|
<option name="_new_targetType" value=""PATH"" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
@ -1 +1 @@
|
|||||||
Subproject commit c83e00a67bfb8493e8955cad26d266f9b4033795
|
Subproject commit 1c0905292e0f2983c723ad19710d27c402fbcf3f
|
@ -1 +1 @@
|
|||||||
Subproject commit 89ac892ea9992df4cf6f662c649b18f49b6c809e
|
Subproject commit e45e5caca3926c2e800a991f16a6bbdf4c3a77d0
|
101
tmtc/tmtcc.py
101
tmtc/tmtcc.py
@ -2,13 +2,36 @@
|
|||||||
"""TMTC commander for FSFW Example"""
|
"""TMTC commander for FSFW Example"""
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Sequence
|
||||||
|
|
||||||
|
from spacepackets.cfdp import ConditionCode, TransmissionModes
|
||||||
from spacepackets.ecss import PusVerificator
|
from spacepackets.ecss import PusVerificator
|
||||||
|
|
||||||
import tmtccmd
|
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 config.hook import FsfwHookBase
|
||||||
|
from spacepackets.util import UnsignedByteField
|
||||||
from tmtccmd import get_console_logger
|
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.core import BackendRequest
|
||||||
from tmtccmd.logging.pus import (
|
from tmtccmd.logging.pus import (
|
||||||
RegularTmtcLogWrapper,
|
RegularTmtcLogWrapper,
|
||||||
@ -16,11 +39,87 @@ from tmtccmd.logging.pus import (
|
|||||||
TimedLogWhen,
|
TimedLogWhen,
|
||||||
)
|
)
|
||||||
from tmtccmd.pus import VerificationWrapper
|
from tmtccmd.pus import VerificationWrapper
|
||||||
|
from tmtccmd.util import ProvidesSeqCount
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
from tmtccmd.cfdp.handler import DestHandler, SourceHandler
|
||||||
|
|
||||||
LOGGER = get_console_logger()
|
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():
|
def main():
|
||||||
setup_wrapper = setup_params(FsfwHookBase())
|
setup_wrapper = setup_params(FsfwHookBase())
|
||||||
tmtc_logger = RegularTmtcLogWrapper()
|
tmtc_logger = RegularTmtcLogWrapper()
|
||||||
|
Loading…
Reference in New Issue
Block a user