Commit 53123f02 authored by Robin Mueller's avatar Robin Mueller
Browse files

refactoring complete

parent 9c7cfc34
......@@ -16,7 +16,7 @@ from tmtc_core.com_if.tmtcc_com_interface_base import CommunicationInterface, Pu
from tmtc_core.pus_tm.tmtcc_pus_tm_factory import PusTelemetryFactory
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTcInfoT
from tmtc_core.utility.tmtcc_tmtc_printer import TmTcPrinter
from tmtc_core.core.tmtc_core_definitions import ethernet_address_t
from tmtc_core.core.definitions import ethernet_address_t
LOGGER = get_logger()
......
......@@ -4,7 +4,7 @@ import socket
import struct
from typing import Tuple
from tmtc_core.core.tmtc_core_definitions import ethernet_address_t
from tmtc_core.core.definitions import ethernet_address_t
from tmtc_core.utility.tmtcc_logger import get_logger
LOGGER = get_logger()
......
......@@ -138,9 +138,9 @@ def default_add_globals_post_args_parsing(args: argparse.Namespace):
def default_set_up_ethernet_cfg():
from tmtc_core.core.tmtcc_globals_manager import update_global
from tmtc_core.core.globals_manager import update_global
update_global(CoreGlobalIds.USE_ETHERNET, True)
from tmtc_core.core.tmtcc_globals_manager import get_global
from tmtc_core.core.globals_manager import get_global
from config.tmtcc_definitions import EthernetConfig
from tmtc_core.com_if.tmtcc_ethernet_utilities import determine_ip_addresses
ethernet_cfg_dict = get_global(CoreGlobalIds.ETHERNET_CONFIG)
......
......@@ -8,7 +8,7 @@ import sys
from enum import Enum
from typing import Dict, Union, Tuple, Deque
from tmtc_core.core.tmtc_core_definitions import QueueCommands
from tmtc_core.core.definitions import QueueCommands, CoreGlobalIds
from tmtc_core.utility.tmtcc_logger import get_logger
LOGGER = get_logger()
......@@ -57,9 +57,8 @@ class PusTelecommand:
source_id: int = 0, version: int = 0, apid: int = -1):
# To get the correct globally configured APID
if apid == -1:
from tmtc_core.core.tmtcc_globals_manager import get_global
from config.tmtcc_globals import GlobalIds
apid = get_global(GlobalIds.APID)
from tmtc_core.core.globals_manager import get_global
apid = get_global(CoreGlobalIds.APID)
"""
Initiates a telecommand with the given parameters.
"""
......
import enum
from tmtc_core.core.tmtc_core_definitions import QueueCommands
from tmtc_core.core.definitions import QueueCommands
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand, TcQueueT
......
import enum
from tmtc_core.core.tmtc_core_definitions import QueueCommands
from tmtc_core.core.definitions import QueueCommands
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand, TcQueueT
......
......@@ -31,7 +31,7 @@ class Service3TM(Service3Base):
STRUCTURE_REPORT_FIXED_HEADER_SIZE = MINIMAL_PACKET_SIZE + 7
def __init__(self, byte_array: bytearray):
from tmtc_core.core.tmtcc_object_id_manager import get_key_from_raw_object_id
from tmtc_core.core.object_id_manager import get_key_from_raw_object_id
super().__init__(byte_array)
if len(self._tm_data) < 8:
warning = "Service3TM: handle_filling_definition_arrays: Invalid Service 3 packet," \
......
......@@ -4,7 +4,7 @@
import struct
from tmtc_core.pus_tm.tmtcc_pus_tm_base import PusTelemetry
from tmtc_core.core.tmtcc_object_id_manager import get_key_from_raw_object_id
from tmtc_core.core.object_id_manager import get_key_from_raw_object_id
from tmtc_core.utility.tmtcc_logger import get_logger
from config.tmtcc_object_ids import ObjectIds
......
......@@ -199,7 +199,7 @@ class CommandSenderReceiver:
if self._start_time != 0:
self._elapsed_time = time.time() - self._start_time
if self._elapsed_time >= self._tm_timeout * self._tc_send_timeout_factor:
from tmtc_core.core.tmtcc_globals_manager import get_global
from tmtc_core.core.globals_manager import get_global
if get_global(CoreGlobalIds.RESEND_TC):
LOGGER.info("CommandSenderReceiver: Timeout, sending TC again !")
self._com_interface.send_telecommand(self._last_tc, self._last_tc_info)
......
......@@ -7,14 +7,14 @@ import time
from typing import Union, Deque
from collections import deque
from tmtc_core.core.definitions import CoreGlobalIds
from tmtc_core.sendreceive.tmtcc_sequential_sender_receiver import SequentialCommandSenderReceiver
from tmtc_core.com_if.tmtcc_com_interface_base import CommunicationInterface
from tmtc_core.utility.tmtcc_tmtc_printer import TmTcPrinter
from tmtc_core.core.tmtcc_globals_manager import get_global
from tmtc_core.core.globals_manager import get_global
from tmtc_core.sendreceive.tmtcc_tm_listener import TmListener
from tmtc_core.utility.tmtcc_tmtc_printer import get_logger
from config.tmtcc_globals import GlobalIds
LOGGER = get_logger()
......@@ -61,10 +61,10 @@ class MultipleCommandSenderReceiver(SequentialCommandSenderReceiver):
time.sleep(self._tm_timeout / 1.4)
# Get a copy of the queue, otherwise we will lose the data.
tm_packet_queue_list = self._tm_listener.retrieve_tm_packet_queue().copy()
if get_global(GlobalIds.PRINT_TM):
if get_global(CoreGlobalIds.PRINT_TM):
self.print_tm_queue(self._tm_listener.retrieve_tm_packet_queue())
self._tm_listener.clear_tm_packet_queue()
if get_global(GlobalIds.PRINT_TO_FILE):
if get_global(CoreGlobalIds.PRINT_TO_FILE):
self._tmtc_printer.print_to_file()
return self.tc_info_queue, tm_packet_queue_list
except (KeyboardInterrupt, SystemExit):
......
......@@ -226,10 +226,10 @@ class TmListener:
time.sleep(0.05)
# the timeout value can be set by special TC queue entries if wiretapping_packet handling
# takes longer, but it is reset here to the global value
from config.tmtcc_globals import GlobalIds
from tmtc_core.core.tmtcc_globals_manager import get_global
if self.__tm_timeout is not get_global(GlobalIds.TM_TIMEOUT):
self.__tm_timeout = get_global(GlobalIds.TM_TIMEOUT)
from tmtc_core.core.globals_manager import get_global
from tmtc_core.core.definitions import CoreGlobalIds
if self.__tm_timeout is not get_global(CoreGlobalIds.TM_TIMEOUT):
self.__tm_timeout = get_global(CoreGlobalIds.TM_TIMEOUT)
return True
@staticmethod
......
......@@ -8,8 +8,8 @@
"""
import sys
from tmtc_core.core.tmtcc_hook_base import TmTcHookBase
from tmtc_core.core.tmtccore_definitions import CoreGlobalIds
from tmtc_core.core.hook_base import TmTcHookBase
from tmtc_core.core.definitions import CoreGlobalIds
from tmtc_core.utility.tmtcc_core_args_parser import parse_input_arguments
from tmtc_core.utility.tmtcc_logger import set_tmtc_logger, get_logger
......@@ -18,16 +18,16 @@ logger = get_logger()
try:
from config.tmtcc_version import SW_NAME, SW_VERSION, SW_SUBVERSION
except ImportError as error:
import tmtc_core.core.tmtcc_version as core
SW_NAME = core.SW_NAME
SW_VERSION = core.SW_VERSION
SW_SUBVERSION = core.SW_SUBVERSION
import tmtc_core.core.version as core_version
SW_NAME = core_version.SW_NAME
SW_VERSION = core_version.SW_VERSION
SW_SUBVERSION = core_version.SW_SUBVERSION
logger.warning("TMTC Runner: No user versioning file found!")
def assign_tmtc_commander_hooks(hook_base: TmTcHookBase):
from tmtc_core.core.tmtcc_globals_manager import update_global
from tmtc_core.core.tmtccore_definitions import CoreGlobalIds
from tmtc_core.core.globals_manager import update_global
from tmtc_core.core.definitions import CoreGlobalIds
if hook_base is None:
logger.error("Passed hook base object handle is invalid! Terminating..")
sys.exit(-1)
......@@ -83,8 +83,8 @@ def handle_cli_args_and_globals():
def start_tmtc_commander_cli():
from tmtc_core.core.tmtcc_backend import TmTcHandler
from tmtc_core.core.tmtcc_globals_manager import get_global
from tmtc_core.core.backend import TmTcHandler
from tmtc_core.core.globals_manager import get_global
service = get_global(CoreGlobalIds.SERVICE)
op_code = get_global(CoreGlobalIds.OP_CODE)
# The global variables are set by the argument parser.
......@@ -96,8 +96,8 @@ def start_tmtc_commander_cli():
def start_tmtc_commander_qt_gui():
from tmtc_core.core.tmtc_frontend import TmTcFrontend
from tmtc_core.core.tmtcc_globals_manager import get_global
from tmtc_core.core.frontend import TmTcFrontend
from tmtc_core.core.globals_manager import get_global
try:
from PyQt5.QtWidgets import QApplication
except ImportError:
......
......@@ -89,9 +89,9 @@ class TmTcPrinter:
from typing import cast
self.__handle_hk_definition_print(cast(Service3Base, packet))
from config.tmtcc_globals import GlobalIds
from tmtc_core.core.tmtcc_globals_manager import get_global
if get_global(GlobalIds.PRINT_RAW_TM):
from tmtc_core.core.globals_manager import get_global
from tmtc_core.core.definitions import CoreGlobalIds
if get_global(CoreGlobalIds.PRINT_RAW_TM):
self.__print_buffer = "TM Data:" + "\n" + self.return_data_string(packet.get_tm_data())
LOGGER.info(self.__print_buffer)
self.add_print_buffer_to_file_buffer()
......@@ -149,9 +149,9 @@ class TmTcPrinter:
:param tm_packet:
:return:
"""
from tmtc_core.core.tmtcc_globals_manager import get_global
from config.tmtcc_globals import GlobalIds
print_hk = get_global(GlobalIds.PRINT_HK)
from tmtc_core.core.globals_manager import get_global
from tmtc_core.core.definitions import CoreGlobalIds
print_hk = get_global(CoreGlobalIds.PRINT_HK)
if print_hk:
self.__print_buffer = f"HK Data from Object ID {tm_packet.object_id:#010x} and " \
f"set ID {tm_packet.set_id}:"
......@@ -163,9 +163,9 @@ class TmTcPrinter:
:param tm_packet:
:return:
"""
from tmtc_core.core.tmtcc_globals_manager import get_global
from config.tmtcc_globals import GlobalIds
print_hk = get_global(GlobalIds.PRINT_HK)
from tmtc_core.core.globals_manager import get_global
from tmtc_core.core.definitions import CoreGlobalIds
print_hk = get_global(CoreGlobalIds.PRINT_HK)
if print_hk:
self.__print_buffer = f"HK Definition from Object ID {tm_packet.object_id:#010x} " \
f"and set ID {tm_packet.set_id}:"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment