diff --git a/.gitignore b/.gitignore index ac7a6ac..d345880 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,13 @@ __pycache__ *.db venv +/tmtc/bin +/tmtc/lib +/tmtc/config/*.json +/tmtc/log +/tmtc/lib64 +/tmtc/pyvenv.cfg +/tmtc/share # Eclipse .cproject @@ -16,14 +23,6 @@ venv # Build folders -Debug -Debug* -Release -Release* -RelWithDeb -RelWithDeb* -MinSizeRel -MinSizeRel* /build* _dep @@ -38,3 +37,4 @@ Makefile* # Visual Studio .vs out + diff --git a/.gitmodules b/.gitmodules index 8304ab3..5075b57 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "example_common"] path = example_common url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-example-common.git +[submodule "tmtc/common_tmtc"] + path = tmtc/common_tmtc + url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw-example-tmtc-common.git diff --git a/fsfw b/fsfw index fb7b059..22693ee 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit fb7b059137ca873b405b95f8d3072f4ae85ce2ff +Subproject commit 22693eee50aa85fccc9a1bd45aca4bca6b5dd62b diff --git a/tmtc/common_tmtc b/tmtc/common_tmtc new file mode 160000 index 0000000..a31a9d3 --- /dev/null +++ b/tmtc/common_tmtc @@ -0,0 +1 @@ +Subproject commit a31a9d39257d545a1a35752f35d7d1bfcf1b2c49 diff --git a/tmtc/config/__init__.py b/tmtc/config/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tmtc/tmtc_client_cli.py b/tmtc/tmtc_client_cli.py new file mode 100755 index 0000000..d22134a --- /dev/null +++ b/tmtc/tmtc_client_cli.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +""" +@brief TMTC Commander entry point for command line mode. +@details +This client was developed by KSat for the SOURCE project to test the on-board software but +has evolved into a more generic tool for satellite developers to perform TMTC (Telemetry and Telecommand) +handling and testing via different communication interfaces. Currently, only the PUS standard is +implemented as a packet standard. + +Run this file with the -h flag to display options. + +@license +Copyright 2020 KSat e.V. Stuttgart + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +@author R. Mueller +""" +import sys + +from common_tmtc.config.hook_implementation import FsfwHookBase +from common_tmtc.config.definitions import PUS_APID +from common_tmtc.pus_tm.factory_hook import ccsds_tm_handler +try: + from tmtccmd.runner import run_tmtc_commander, initialize_tmtc_commander, add_ccsds_handler + from tmtccmd.ccsds.handler import CcsdsTmHandler +except ImportError as error: + run_tmtc_commander = None + initialize_tmtc_commander = None + print(error) + print("Python tmtccmd submodule could not be imported") + print("Install with \"cd tmtccmd && python3 -m pip install -e .\" for interactive installation") + sys.exit(0) + + +def main(): + hook_obj = FsfwHookBase() + initialize_tmtc_commander(hook_object=hook_obj) + ccsds_handler = CcsdsTmHandler() + ccsds_handler.add_tm_handler(apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50) + add_ccsds_handler(ccsds_handler) + run_tmtc_commander(use_gui=False, app_name="TMTC Commander FSFW") + + +if __name__ == "__main__": + main() diff --git a/tmtc/tmtc_client_gui.py b/tmtc/tmtc_client_gui.py new file mode 100644 index 0000000..cde216e --- /dev/null +++ b/tmtc/tmtc_client_gui.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +""" +@brief TMTC Commander entry point for command line mode. +@details +This client was developed by KSat for the SOURCE project to test the on-board software but +has evolved into a more generic tool for satellite developers to perform TMTC (Telemetry and Telecommand) +handling and testing via different communication interfaces. Currently, only the PUS standard is +implemented as a packet standard. + +Run this file with the -h flag to display options. + +@license +Copyright 2020 KSat e.V. Stuttgart + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +@author R. Mueller +""" +import sys + +from common_tmtc.config.hook_implementation import FsfwHookBase +from common_tmtc.config.definitions import PUS_APID +from common_tmtc.pus_tm.factory_hook import ccsds_tm_handler +try: + from tmtccmd.runner import run_tmtc_commander, initialize_tmtc_commander, add_ccsds_handler + from tmtccmd.ccsds.handler import CcsdsTmHandler +except ImportError as error: + run_tmtc_commander = None + initialize_tmtc_commander = None + print(error) + print("Python tmtccmd submodule could not be imported") + print("Install with \"cd tmtccmd && python3 -m pip install -e .\" for interactive installation") + sys.exit(0) + + +def main(): + hook_obj = FsfwHookBase() + initialize_tmtc_commander(hook_object=hook_obj) + ccsds_handler = CcsdsTmHandler() + ccsds_handler.add_tm_handler(apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50) + add_ccsds_handler(ccsds_handler) + run_tmtc_commander(use_gui=True, app_name="TMTC Commander FSFW") + + +if __name__ == "__main__": + main() diff --git a/tmtc/tmtccmd b/tmtc/tmtccmd index 475ac3f..c4ab098 160000 --- a/tmtc/tmtccmd +++ b/tmtc/tmtccmd @@ -1 +1 @@ -Subproject commit 475ac3f8293fd92533e4d50c061d93b1c2b7f5e1 +Subproject commit c4ab0988f83a2754d5c18e1f3e939659c1156e30