eive-tmtc/config/globals_config.py

55 lines
1.7 KiB
Python

"""
@brief This file transfers definitions of global variables to the user.
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
it to your needs.
"""
import enum
import argparse
# All globals can be added here and will be part of a globals dictionary.
from config.definitions import CustomServiceList
from config.custom_mode_op import CustomModeList
from tmtccmd.core.definitions import CoreComInterfaces, CoreServiceList
from tmtccmd.defaults.globals_setup import set_default_globals_pre_args_parsing, \
set_default_globals_post_args_parsing, get_core_service_dict
from tmtccmd.core.globals_manager import update_global
from tmtccmd.core.definitions import CoreGlobalIds
from tmtccmd.utility.tmtcc_logger import get_logger
LOGGER = get_logger()
class CustomGlobalIds(enum.Enum):
from enum import auto
pass
def set_globals_pre_args_parsing(gui: bool = False):
set_default_globals_pre_args_parsing(gui=gui, apid=0x65, com_if_id=CoreComInterfaces.TCPIP_UDP)
servicelist = get_core_service_dict()
update_global(CoreGlobalIds.CURRENT_SERVICE, CoreServiceList.SERVICE_17)
update_global(CoreGlobalIds.SERVICE_DICT, servicelist)
def add_globals_post_args_parsing(args: argparse.Namespace):
set_default_globals_post_args_parsing(
args=args, custom_service_list=CustomServiceList, custom_mode_list=CustomModeList,
custom_com_if_list=None
)
def set_up_serial_cfg(com_if: CoreComInterfaces):
from tmtccmd.defaults.com_setup import default_serial_cfg_setup
default_serial_cfg_setup(com_if=com_if)
def set_up_ethernet_cfg():
from tmtccmd.defaults.com_setup import default_tcpip_udp_cfg_setup
default_tcpip_udp_cfg_setup()