85 lines
2.8 KiB
Python
Executable File
85 lines
2.8 KiB
Python
Executable File
#!/usr/bin/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
|
|
|
|
try:
|
|
from tmtccmd.runner import (
|
|
initialize_tmtc_commander,
|
|
run_tmtc_commander,
|
|
add_ccsds_handler,
|
|
)
|
|
from tmtccmd.ccsds.handler import CcsdsTmHandler
|
|
from tmtccmd.utility.logger import TMTC_LOGGER_NAME
|
|
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 .[gui]" for interactive installation'
|
|
)
|
|
sys.exit(1)
|
|
|
|
try:
|
|
import spacepackets
|
|
from spacepackets.log import set_custom_console_logger_name
|
|
except ImportError as error:
|
|
print(error)
|
|
print("Python spacepackets module could not be imported")
|
|
print(
|
|
'Install with "cd spacepackets && python3 -m pip intall -e ." for interative installation'
|
|
)
|
|
sys.exit(1)
|
|
|
|
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
|
|
|
|
|
|
def main():
|
|
from pus_tm.event_handler import handle_event_packet
|
|
hook_obj = EiveHookObject()
|
|
print(f"-- eive tmtc version {__version__} --")
|
|
print(f"-- spacepackets version {spacepackets.__version__} --")
|
|
set_custom_console_logger_name(logger_name=TMTC_LOGGER_NAME)
|
|
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
|
|
)
|
|
handle_event_packet(object_id=bytes([0x00, 0x00, 0x00, 0x00]), event_id=0, param_1=0, param_2=0)
|
|
add_ccsds_handler(ccsds_handler)
|
|
run_tmtc_commander(False)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|