diff --git a/.idea/runConfigurations/tmtcclient_Help.xml b/.idea/runConfigurations/tmtcclient_Help.xml index 683cda5aa7276a7e5321b3ba9c6028681505b480..6aece9026d223bfd963b60d15dc2fe90cc60130e 100644 --- a/.idea/runConfigurations/tmtcclient_Help.xml +++ b/.idea/runConfigurations/tmtcclient_Help.xml @@ -12,7 +12,7 @@ <option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> - <option name="SCRIPT_NAME" value="C:/Users/Robin/NoSyncDokumente/sourceobsw/tmtc/obsw_tmtc_client.py" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" /> <option name="PARAMETERS" value="-h" /> <option name="SHOW_COMMAND_LINE" value="false" /> <option name="EMULATE_TERMINAL" value="false" /> diff --git a/.idea/runConfigurations/tmtcclient_Service_17_UDP.xml b/.idea/runConfigurations/tmtcclient_Service_17_UDP.xml index 22544e608f0a2880084fd6eb8202eaaf8c8c8c0a..4d49dabef89f1516ce0526f7fffd64a44ce61947 100644 --- a/.idea/runConfigurations/tmtcclient_Service_17_UDP.xml +++ b/.idea/runConfigurations/tmtcclient_Service_17_UDP.xml @@ -12,7 +12,7 @@ <option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> - <option name="SCRIPT_NAME" value="C:/Users/Robin/NoSyncDokumente/sourceobsw/tmtc/obsw_tmtc_client.py" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" /> <option name="PARAMETERS" value="-m 3 -s 17 -p -t 5" /> <option name="SHOW_COMMAND_LINE" value="false" /> <option name="EMULATE_TERMINAL" value="true" /> diff --git a/.idea/runConfigurations/OBSW_UdpClient_Single_Command.xml b/.idea/runConfigurations/tmtcclient_Single_Command.xml similarity index 81% rename from .idea/runConfigurations/OBSW_UdpClient_Single_Command.xml rename to .idea/runConfigurations/tmtcclient_Single_Command.xml index eefb361c0bb927928f87948bcf859170678923a7..46d240300da9f6c7eec267237729c2fd9c72737d 100644 --- a/.idea/runConfigurations/OBSW_UdpClient_Single_Command.xml +++ b/.idea/runConfigurations/tmtcclient_Single_Command.xml @@ -1,5 +1,5 @@ <component name="ProjectRunConfigurationManager"> - <configuration default="false" name="OBSW_UdpClient Single Command" type="PythonConfigurationType" factoryName="Python" folderName="UDP Communication"> + <configuration default="false" name="tmtcclient Single Command" type="PythonConfigurationType" factoryName="Python" folderName="UDP Communication"> <module name="tmtc" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> @@ -13,7 +13,7 @@ <option name="ADD_SOURCE_ROOTS" value="true" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" /> - <option name="PARAMETERS" value="-m 2 --boardIP=169.254.86.53" /> + <option name="PARAMETERS" value="-m 2 -c 3 --boardIP=127.0.0.1" /> <option name="SHOW_COMMAND_LINE" value="false" /> <option name="EMULATE_TERMINAL" value="false" /> <option name="MODULE_MODE" value="false" /> diff --git a/comIF/obsw_ethernet_com_if.py b/comIF/obsw_ethernet_com_if.py index 8a56d9a802d6579746034a16829d4a9c8d8410b6..13cb067a853a8674896dc6db5c3c5e197072f266 100644 --- a/comIF/obsw_ethernet_com_if.py +++ b/comIF/obsw_ethernet_com_if.py @@ -25,6 +25,10 @@ class EthernetComIF(CommunicationInterface): """ Communication interface for UDP communication. """ + + def send_data(self, data: bytearray): + self.sock_send.sendto(data, self.send_address) + def __init__(self, tmtc_printer: TmTcPrinter, tm_timeout: float, tc_timeout_factor: float, receive_address: g.ethernetAddressT, send_address: g.ethernetAddressT): super().__init__(tmtc_printer) @@ -40,7 +44,7 @@ class EthernetComIF(CommunicationInterface): pass def send_telecommand(self, tc_packet: bytearray, tc_packet_info: PusTcInfoT = None) -> None: - self.tmtc_printer.print_telecommand(tc_packet, tc_packet_info) + # self.tmtc_printer.print_telecommand(tc_packet, tc_packet_info) self.sock_send.sendto(tc_packet, self.send_address) def data_available(self, timeout: float = 0) -> bool: diff --git a/obsw_user_code.py b/obsw_user_code.py index 48bc76a6eaa4156634a2f18aeeec1433b96ca610..1b204fa789709859647dd0951b585bb1c8060094 100644 --- a/obsw_user_code.py +++ b/obsw_user_code.py @@ -11,12 +11,13 @@ def command_preparation_hook() -> Tuple[bytearray, Union[None, PusTcInfo]]: Can be used to pack user-defined commands. """ command = PusTelecommand(service=17, subservice=1, ssc=20) - command2 = PusTelecommand(service=17, subservice=1, ssc=21) - tc_list = list() - tc_list.append(command) - tc_list.append(command2) - frame, frame_size, num_packets = pack_tc_frame(tc_list, 256) - return frame, None + # command2 = PusTelecommand(service=17, subservice=1, ssc=21) + # tc_list = list() + # tc_list.append(command) + # tc_list.append(command2) + # frame, frame_size, num_packets = pack_tc_frame(tc_list, 256) + + return command.pack_command_tuple() def global_setup_hook(): @@ -24,4 +25,8 @@ def global_setup_hook(): Can be used to alter the global variables in a custom defined way. For example, device specific com port can be set here. """ - pass + import config.obsw_config + # Static IP of board + port_send = 7301 + send_address_to_set = ("127.0.0.1", port_send) + config.obsw_config.G_SEND_ADDRESS = send_address_to_set diff --git a/utility/obsw_args_parser.py b/utility/obsw_args_parser.py index 39c7ea22101b8a148eb8445ff5c64e085e8769f6..f269f4a6a8d42992dd52629e7101fcfacac319fd 100644 --- a/utility/obsw_args_parser.py +++ b/utility/obsw_args_parser.py @@ -22,15 +22,15 @@ def parse_input_arguments(): '0: GUI Mode, 1:Listener Mode, 2: Single Command Mode, 3: Service Test Mode, ' '4: Software Test Mode, 5: Unit Test Mode ', default=0) arg_parser.add_argument( - '-c', '--com_if', type=int, help='Communication Interface. 0 for Ethernet, 1 for Serial, ' - '2 for virtual interface', default=2) + '-c', '--com_if', type=int, help='Communication Interface. 0: Dummy Interface, 1: Serial, ' + '2: QEMU, 3: UDP', default=2) arg_parser.add_argument('--clientIP', help='Client(Computer) IP. Default:\'\'', default='') arg_parser.add_argument( - '--boardIP', help='Board IP. Default: 169.254.1.38', default='169.254.1.38') + '--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( '-t', '--tm_timeout', type=float, help='TM Timeout when listening to verification sequence.' - ' Default: 12, 6(Serial)', default=6.0) + ' Default: 5 seconds', default=5.0) arg_parser.add_argument( '--nl', dest='print_log', help='Supply --nl to suppress print output to log files.', action='store_false')