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

additional args to suppress console print

parent 6a2acc4a
No related branches found
No related tags found
No related merge requests found
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
<option name="PARAMETERS" value="-m 5 -c 1 --hk" /> <option name="PARAMETERS" value="-m 5 -c 1 --hk --np" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" /> <option name="MODULE_MODE" value="false" />
......
...@@ -10,7 +10,7 @@ Description: Generic Communication Interface. Defines the syntax of the communic ...@@ -10,7 +10,7 @@ Description: Generic Communication Interface. Defines the syntax of the communic
from abc import abstractmethod from abc import abstractmethod
from typing import TypeVar, Tuple, Union from typing import TypeVar, Tuple, Union
from tm.obsw_pus_tm_base import PusTmQueueT, PusTmTupleQueueT, PusTmInfoQueueT, PusTmListT from tm.obsw_pus_tm_base import PusTmQueueT, PusTmTupleQueueT, PusTmInfoQueueT, PusTmListT
from utility.obsw_tmtc_printer import TmTcPrinterT from utility.obsw_tmtc_printer import TmTcPrinter
from tc.obsw_pus_tc_base import PusTcInfoT from tc.obsw_pus_tc_base import PusTcInfoT
ComIfT = TypeVar('ComIfT', bound='CommunicationInterface') ComIfT = TypeVar('ComIfT', bound='CommunicationInterface')
...@@ -24,7 +24,7 @@ class CommunicationInterface: ...@@ -24,7 +24,7 @@ class CommunicationInterface:
Generic form of a communication interface to separate communication logic from Generic form of a communication interface to separate communication logic from
the underlying interface. the underlying interface.
""" """
def __init__(self, tmtc_printer: TmTcPrinterT): def __init__(self, tmtc_printer: TmTcPrinter):
self.tmtc_printer = tmtc_printer self.tmtc_printer = tmtc_printer
@abstractmethod @abstractmethod
......
...@@ -71,7 +71,8 @@ class EthernetComIF(CommunicationInterface): ...@@ -71,7 +71,8 @@ class EthernetComIF(CommunicationInterface):
packets = self.receive_telemetry() packets = self.receive_telemetry()
for packet in packets: for packet in packets:
packet_info = packet.pack_tm_information() packet_info = packet.pack_tm_information()
self.tmtc_printer.print_telemetry(packet) if g.G_PRINT_TM:
self.tmtc_printer.print_telemetry(packet)
tmInfoQueue.append(packet_info) tmInfoQueue.append(packet_info)
return tmInfoQueue return tmInfoQueue
...@@ -87,7 +88,8 @@ class EthernetComIF(CommunicationInterface): ...@@ -87,7 +88,8 @@ class EthernetComIF(CommunicationInterface):
for packet in packet_list: for packet in packet_list:
packet_info = packet.pack_tm_information() packet_info = packet.pack_tm_information()
tm_tuple = (packet_info, packet) tm_tuple = (packet_info, packet)
self.tmtc_printer.print_telemetry(packet) if g.G_PRINT_TM:
self.tmtc_printer.print_telemetry(packet)
tmTupleQueue.append(tm_tuple) tmTupleQueue.append(tm_tuple)
return tmTupleQueue return tmTupleQueue
......
...@@ -11,6 +11,7 @@ import logging ...@@ -11,6 +11,7 @@ import logging
from typing import Tuple, List, Union, Optional from typing import Tuple, List, Union, Optional
import serial import serial
import config.obsw_config as g
from comIF.obsw_com_interface import CommunicationInterface, PusTmQueueT from comIF.obsw_com_interface import CommunicationInterface, PusTmQueueT
from utility.obsw_tmtc_printer import TmTcPrinterT from utility.obsw_tmtc_printer import TmTcPrinterT
from tm.obsw_pus_tm_factory import pus_telemetry_factory from tm.obsw_pus_tm_factory import pus_telemetry_factory
...@@ -57,13 +58,15 @@ class SerialComIF(CommunicationInterface): ...@@ -57,13 +58,15 @@ class SerialComIF(CommunicationInterface):
return packet_list return packet_list
return [] return []
# TODO: DO NOT PRINT HERE! this will block the listener thread!!!
def poll_interface(self, parameters: any = 0) -> Tuple[bool, PusTmListT]: def poll_interface(self, parameters: any = 0) -> Tuple[bool, PusTmListT]:
if self.data_available(): if self.data_available():
pus_data_list, number_of_packets = self.__poll_pus_packets() pus_data_list, number_of_packets = self.__poll_pus_packets()
packet_list = [] packet_list = []
for counter in range(0, number_of_packets): for counter in range(0, number_of_packets):
packet = pus_telemetry_factory(pus_data_list[counter]) packet = pus_telemetry_factory(pus_data_list[counter])
self.tmtc_printer.print_telemetry(packet) if g.G_PRINT_TM:
self.tmtc_printer.print_telemetry(packet)
packet_list.append(packet) packet_list.append(packet)
return True, packet_list return True, packet_list
return False, [] return False, []
......
...@@ -81,6 +81,7 @@ G_SEND_ADDRESS = (0, 0) ...@@ -81,6 +81,7 @@ G_SEND_ADDRESS = (0, 0)
G_PRINT_TO_FILE = True G_PRINT_TO_FILE = True
G_PRINT_HK_DATA = False G_PRINT_HK_DATA = False
G_PRINT_RAW_TM = False G_PRINT_RAW_TM = False
G_PRINT_TM = True
""" """
These objects are set for the Unit Test, no better solution found yet These objects are set for the Unit Test, no better solution found yet
...@@ -94,7 +95,7 @@ G_TMTC_PRINTER = None ...@@ -94,7 +95,7 @@ G_TMTC_PRINTER = None
def setGlobals(args): def setGlobals(args):
global G_REC_ADDRESS, G_SEND_ADDRESS, G_SCRIPT_MODE, G_MODE_ID, G_SERVICE, G_DISPLAY_MODE,\ global G_REC_ADDRESS, G_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_TC_SEND_TIMEOUT_FACTOR, \ 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_TO_FILE, G_PRINT_HK_DATA, G_PRINT_RAW_TM, G_PRINT_TM
if args.mode == 0: if args.mode == 0:
print("GUI mode not implemented yet !") print("GUI mode not implemented yet !")
if args.shortDisplayMode: if args.shortDisplayMode:
...@@ -143,7 +144,8 @@ def setGlobals(args): ...@@ -143,7 +144,8 @@ def setGlobals(args):
G_SEND_ADDRESS = sendAddressToSet G_SEND_ADDRESS = sendAddressToSet
G_MODE_ID = G_MODE_ID G_MODE_ID = G_MODE_ID
G_PRINT_HK_DATA = args.print_hk G_PRINT_HK_DATA = args.print_hk
G_PRINT_TO_FILE = args.print_file G_PRINT_TM = args.print_tm
G_PRINT_TO_FILE = args.print_log
G_PRINT_RAW_TM = args.rawDataPrint G_PRINT_RAW_TM = args.rawDataPrint
G_COM_PORT = args.com_port G_COM_PORT = args.com_port
G_TM_TIMEOUT = args.tm_timeout G_TM_TIMEOUT = args.tm_timeout
......
...@@ -25,7 +25,7 @@ class TestService2(TestService): ...@@ -25,7 +25,7 @@ class TestService2(TestService):
print("Testing Service 2") print("Testing Service 2")
# all commands must be sent sequentially, not as a burst # all commands must be sent sequentially, not as a burst
cls.wait_intervals = [1, 2, 3, 4] cls.wait_intervals = [1, 2, 3, 4]
cls.wait_time = [2.5, 2.5, 2.5, 3] cls.wait_time = [2.0, 2.0, 2.0, 2.0]
pack_service2_test_into(cls.test_queue) pack_service2_test_into(cls.test_queue)
def test_service2(self): def test_service2(self):
...@@ -104,7 +104,7 @@ class TestService8(TestService): ...@@ -104,7 +104,7 @@ class TestService8(TestService):
super().setUpClass() super().setUpClass()
print("Testing Service 8") print("Testing Service 8")
cls.wait_intervals = [1, 2, 3, 4] cls.wait_intervals = [1, 2, 3, 4]
cls.wait_time = [1.5, 1.5, 1.5, 1.5] cls.wait_time = [1.5, 1.0, 1.0, 1.0]
cls.data_reply_count = 0 cls.data_reply_count = 0
pack_service8_test_into(cls.test_queue) pack_service8_test_into(cls.test_queue)
......
...@@ -34,7 +34,10 @@ def parse_input_arguments(): ...@@ -34,7 +34,10 @@ def parse_input_arguments():
'-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: 12, 6(Serial)', default=6.0) ' Default: 12, 6(Serial)', default=6.0)
arg_parser.add_argument( arg_parser.add_argument(
'--np', dest='print_file', help='Supply --np to suppress print output to log files.', '--nl', dest='print_log', help='Supply --nl to suppress print output to log files.',
action='store_false')
arg_parser.add_argument(
'--np', dest='print_tm', help='Supply --np to suppress print output to console.',
action='store_false') action='store_false')
arg_parser.add_argument( arg_parser.add_argument(
'-o', '--tc_timeout_factor', type=float, help='TC Timeout Factor. Multiplied with ' '-o', '--tc_timeout_factor', type=float, help='TC Timeout Factor. Multiplied with '
......
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