eive-tmtc/config/globals_config.py

55 lines
1.7 KiB
Python
Raw Normal View History

2021-03-19 17:39:52 +01:00
"""
@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
2021-03-19 18:01:17 +01:00
from tmtccmd.core.definitions import CoreComInterfaces, CoreServiceList
2021-03-19 17:39:52 +01:00
from tmtccmd.defaults.globals_setup import set_default_globals_pre_args_parsing, \
2021-03-19 18:01:17 +01:00
set_default_globals_post_args_parsing, get_core_service_dict
2021-03-19 17:39:52 +01:00
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
2021-03-19 17:50:09 +01:00
def set_globals_pre_args_parsing(gui: bool = False):
2021-03-19 18:01:17 +01:00
set_default_globals_pre_args_parsing(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)
2021-03-19 17:39:52 +01:00
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()