eive-tmtc/tmtcgui.py

70 lines
2.2 KiB
Python
Raw Normal View History

2020-12-17 17:50:00 +01:00
#!/usr/bin/python3
"""
@brief TMTC Commander entry point for command line mode.
2020-12-17 17:50:00 +01:00
@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
2021-04-24 23:17:36 +02:00
https://www.apache.org/licenses/LICENSE-2.0
2020-12-17 17:50:00 +01:00
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
2021-03-19 17:42:36 +01:00
from config.hook_implementations import EiveHookObject
from config.version import __version__
from config.definitions import PUS_APID
from pus_tm.factory_hook import ccsds_tm_handler
2022-01-18 14:03:56 +01:00
try:
2022-01-18 14:03:56 +01:00
from tmtccmd.runner import (
2022-04-05 15:19:46 +02:00
init_tmtccmd,
run_tmtccmd,
2022-01-18 14:03:56 +01:00
add_ccsds_handler,
)
from tmtccmd.ccsds.handler import CcsdsTmHandler
import spacepackets
except ImportError as error:
run_tmtc_commander = None
initialize_tmtc_commander = None
print(error)
print("Python tmtccmd submodule could not be imported")
2022-01-18 14:03:56 +01:00
print(
'Install with "cd tmtccmd && python3 -m pip install -e ." for interactive installation'
)
sys.exit(0)
2020-12-17 17:50:00 +01:00
def main():
2021-03-19 17:42:36 +01:00
hook_obj = EiveHookObject()
print(f"-- eive tmtc version {__version__}")
2022-01-18 14:03:56 +01:00
print(f"-- spacepackets version {spacepackets.__version__} --")
2022-04-05 15:19:46 +02:00
init_tmtccmd(hook_object=hook_obj)
ccsds_handler = CcsdsTmHandler()
2022-01-18 14:03:56 +01:00
ccsds_handler.add_tm_handler(
apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50
)
add_ccsds_handler(ccsds_handler)
2022-04-05 15:19:46 +02:00
run_tmtccmd(use_gui=True)
2020-12-17 17:50:00 +01:00
if __name__ == "__main__":
main()