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

gui stuff extracted

parent 16378f81
No related branches found
No related tags found
No related merge requests found
...@@ -5,8 +5,10 @@ import logging ...@@ -5,8 +5,10 @@ import logging
class TmTcBackend(Process): class TmTcBackend(Process):
def __init__(self): def __init__(self):
from obsw_tmtc_client import TmTcHandler
super(TmTcBackend, self).__init__() super(TmTcBackend, self).__init__()
self.address = ('localhost', 6000) # family is deduced to be 'AF_INET' self.address = ('localhost', 6000) # family is deduced to be 'AF_INET'
self.tmtc_backend = TmTcHandler()
self.listener = Listener(self.address, authkey=None) self.listener = Listener(self.address, authkey=None)
self.conn = 0 self.conn = 0
......
...@@ -91,8 +91,20 @@ def main(): ...@@ -91,8 +91,20 @@ def main():
set_globals(args) set_globals(args)
LOGGER.info("Starting TMTC Handler") LOGGER.info("Starting TMTC Handler")
tmtc_handler = TmTcHandler()
tmtc_handler.perform_operation() if g.G_MODE_ID == g.ModeList.GUIMode:
# Experimental
backend = TmTcBackend()
backend.start()
gui = TmTcGUI()
gui.start()
backend.join()
gui.join()
LOGGER.info("Both processes have closed")
sys.exit()
else:
tmtc_handler = TmTcHandler()
tmtc_handler.perform_operation()
# At some later point, the program will run permanently and be able to take commands. # 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 # For now we put a permanent loop here so the program
...@@ -143,22 +155,15 @@ class TmTcHandler: ...@@ -143,22 +155,15 @@ class TmTcHandler:
Command handling. Command handling.
""" """
tmtc_printer = TmTcPrinter(g.G_DISPLAY_MODE, g.G_PRINT_TO_FILE, True) tmtc_printer = TmTcPrinter(g.G_DISPLAY_MODE, g.G_PRINT_TO_FILE, True)
if self.mode == g.ModeList.GUIMode: communication_interface = set_communication_interface(tmtc_printer)
backend = TmTcBackend() atexit.register(keyboard_interrupt_handler, com_interface=communication_interface)
backend.start()
gui = TmTcGUI() tm_listener = TmListener(
gui.start() com_interface=communication_interface, tm_timeout=g.G_TM_TIMEOUT,
backend.join() tc_timeout_factor=g.G_TC_SEND_TIMEOUT_FACTOR
gui.join() )
LOGGER.info("Both processes have closed") tm_listener.start()
sys.exit()
else:
communication_interface = set_communication_interface(tmtc_printer)
atexit.register(keyboard_interrupt_handler, com_interface=communication_interface)
tm_listener = TmListener(
com_interface=communication_interface, tm_timeout=g.G_TM_TIMEOUT,
tc_timeout_factor=g.G_TC_SEND_TIMEOUT_FACTOR)
tm_listener.start()
if self.mode == g.ModeList.ListenerMode: if self.mode == g.ModeList.ListenerMode:
if tm_listener.event_reply_received: if tm_listener.event_reply_received:
# TODO: Test this. # TODO: Test this.
......
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