Skip to content
Snippets Groups Projects
Commit f497a45f authored by Robin.Mueller's avatar Robin.Mueller
Browse files

new CLI argument for listener mode

parent 540ed898
No related branches found
No related tags found
No related merge requests found
...@@ -65,6 +65,7 @@ G_SCRIPT_MODE = 1 ...@@ -65,6 +65,7 @@ G_SCRIPT_MODE = 1
G_MODE_ID: ModeList = ModeList.ListenerMode G_MODE_ID: ModeList = ModeList.ListenerMode
G_SERVICE = 17 G_SERVICE = 17
G_OP_CODE = 0 G_OP_CODE = 0
G_LISTENER_AFTER_OP = False
G_DISPLAY_MODE = "long" G_DISPLAY_MODE = "long"
# General TMTC Settings # General TMTC Settings
...@@ -118,7 +119,7 @@ def set_globals(args): ...@@ -118,7 +119,7 @@ def set_globals(args):
global G_ETHERNET_RECV_ADDRESS, G_ETHERNET_SEND_ADDRESS, G_SCRIPT_MODE, G_MODE_ID, G_SERVICE, \ global G_ETHERNET_RECV_ADDRESS, G_ETHERNET_SEND_ADDRESS, G_SCRIPT_MODE, G_MODE_ID, G_SERVICE, \
G_DISPLAY_MODE, G_COM_IF, G_COM_PORT, G_SERIAL_TIMEOUT, G_TM_TIMEOUT, \ G_DISPLAY_MODE, G_COM_IF, G_COM_PORT, G_SERIAL_TIMEOUT, G_TM_TIMEOUT, \
G_TC_SEND_TIMEOUT_FACTOR, G_PRINT_TO_FILE, G_PRINT_HK_DATA, G_PRINT_RAW_TM, G_PRINT_TM, \ G_TC_SEND_TIMEOUT_FACTOR, G_PRINT_TO_FILE, G_PRINT_HK_DATA, G_PRINT_RAW_TM, G_PRINT_TM, \
G_OP_CODE, G_RESEND_TC G_OP_CODE, G_RESEND_TC, G_LISTENER_AFTER_OP
if args.shortDisplayMode: if args.shortDisplayMode:
G_DISPLAY_MODE = "short" G_DISPLAY_MODE = "short"
...@@ -171,6 +172,7 @@ def set_globals(args): ...@@ -171,6 +172,7 @@ def set_globals(args):
G_COM_PORT = args.com_port G_COM_PORT = args.com_port
G_TM_TIMEOUT = args.tm_timeout G_TM_TIMEOUT = args.tm_timeout
G_RESEND_TC = args.resend_tc G_RESEND_TC = args.resend_tc
G_LISTENER_AFTER_OP = args.listener
from config.obsw_user_code import global_setup_hook from config.obsw_user_code import global_setup_hook
global_setup_hook() global_setup_hook()
......
...@@ -93,11 +93,10 @@ class TmTcHandler: ...@@ -93,11 +93,10 @@ class TmTcHandler:
try: try:
self.__core_operation(self.one_shot_operation) self.__core_operation(self.one_shot_operation)
except KeyboardInterrupt: except KeyboardInterrupt:
LOGGER.info("Closing TMTC client.") LOGGER.info("Keyboard Interrupt.")
sys.exit() sys.exit()
except IOError as e: except IOError as e:
LOGGER.exception(e) LOGGER.error("IO Error occured!")
LOGGER.info("Closing TMTC client.")
sys.exit() sys.exit()
def __handle_action(self): def __handle_action(self):
......
...@@ -56,18 +56,17 @@ def run_tmtc_client(use_gui: bool): ...@@ -56,18 +56,17 @@ def run_tmtc_client(use_gui: bool):
# Currently does not work, problems with QEMU / Asyncio # Currently does not work, problems with QEMU / Asyncio
if not use_gui: if not use_gui:
tmtc_handler_task = TmTcHandler.prepare_tmtc_handler_start(g.G_MODE_ID) tmtc_handler = TmTcHandler(g.G_MODE_ID)
tmtc_handler.set_one_shot_or_loop_handling(g.G_LISTENER_AFTER_OP)
tmtc_handler.initialize()
tmtc_handler.perform_operation()
else: else:
tmtc_handler_task = TmTcHandler.prepare_tmtc_handler_start() tmtc_handler_task = TmTcHandler.prepare_tmtc_handler_start()
if use_gui:
tmtc_frontend = TmTcFrontend() tmtc_frontend = TmTcFrontend()
tmtc_frontend_task = tmtc_frontend.prepare_start(tmtc_frontend) tmtc_frontend_task = tmtc_frontend.prepare_start(tmtc_frontend)
tmtc_frontend_task.start() tmtc_frontend_task.start()
tmtc_handler_task.start() tmtc_handler_task.start()
tmtc_handler_task.join()
tmtc_handler_task.join()
if use_gui:
tmtc_frontend_task.join() tmtc_frontend_task.join()
......
Subproject commit bef5d1f8e52aff053a953e91bc287e7772ff3148 Subproject commit 3a728442dc9b5a9200272205bd6972762b3ca06f
...@@ -31,6 +31,10 @@ def parse_input_arguments(): ...@@ -31,6 +31,10 @@ def parse_input_arguments():
arg_parser.add_argument( arg_parser.add_argument(
'--boardIP', help='Board IP. Default: Localhost 127.0.0.1', default="127.0.0.1") '--boardIP', help='Board IP. Default: Localhost 127.0.0.1', default="127.0.0.1")
arg_parser.add_argument('-s', '--service', help='Service to test. Default: 17', default=17) arg_parser.add_argument('-s', '--service', help='Service to test. Default: 17', default=17)
arg_parser.add_argument(
'-l','--listener', help='Determine whether the listener mode will be active after '
'performing the operation',
action='store_false')
arg_parser.add_argument( arg_parser.add_argument(
'-t', '--tm_timeout', type=float, help='TM Timeout when listening to verification sequence.' '-t', '--tm_timeout', type=float, help='TM Timeout when listening to verification sequence.'
' Default: 5 seconds', default=5.0) ' Default: 5 seconds', default=5.0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment