Skip to content
Snippets Groups Projects
Forked from an inaccessible project.
tmtc_client_core.py 2.20 KiB
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
@brief  This client was developed by KSat for the SOURCE project to test the on-board software.
@details
This client features multiple sender/receiver modes and has been designed
to be extensible and easy to use. This clien is based on the PUS standard for the format
of telecommands and telemetry. It can also send TMTC via different interfaces like the
serial interface (USB port) or ethernet interface.

@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

   http://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.

@manual
Run this file with the -h flag to display options.
"""
import time

from tmtc_core.utility.obsw_logger import set_tmtc_logger, get_logger

from config.obsw_config import set_globals
from core.tmtc_backend import TmTcHandler
from utility.obsw_args_parser import parse_input_arguments

LOGGER = get_logger()

def run_tmtc_client(use_gui: bool):
    """
    Main method, reads input arguments, sets global variables and start TMTC handler.
    """
    set_tmtc_logger()
    LOGGER.info("Starting TMTC Client")

    if use_gui:
        run_with_gui()

    LOGGER.info("Parsing input arguments")
    args = parse_input_arguments()

    LOGGER.info("Setting global variables")
    set_globals(args)

    LOGGER.info("Starting TMTC Handler")

    tmtc_handler = TmTcHandler()
    tmtc_handler.perform_operation()

    # At some later point, the program will run permanently and be able to take commands.
    # For now we put a permanent loop here so the program
    # doesn't exit automatically (TM Listener is daemonic)
    while True:
        pass


def run_with_gui():
    while True:
        print("GUI net fertig")
        time.sleep(2)
    # tmtcGui = gui.obsw_tmtc_gui.TmTcGUI()
    # tmtcGui.run()
    # sys.exit()