cosmos 3.9.2 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +23 -0
- data/.travis.yml +1 -0
- data/.yardopts +3 -0
- data/Gemfile +1 -1
- data/Manifest.txt +137 -52
- data/Rakefile +50 -44
- data/autohotkey/config/system/system.txt +0 -5
- data/autohotkey/config/targets/INST/cmd_tlm/inst_cmds.txt +6 -1
- data/autohotkey/config/targets/INST/screens/extra.txt +19 -0
- data/autohotkey/config/targets/INST/sequences/run_sequence.txt +1 -0
- data/autohotkey/config/targets/META/screens/data.txt +12 -0
- data/autohotkey/config/targets/SYSTEM/cmd_tlm/meta_cmd_tlm.txt +16 -0
- data/autohotkey/config/targets/{COSMOS/cmd_tlm/cosmos_server_cmds.txt → SYSTEM/cmd_tlm/system_cmds.txt} +8 -8
- data/autohotkey/config/targets/SYSTEM/cmd_tlm/system_tlm.txt +7 -0
- data/autohotkey/config/targets/SYSTEM/screens/limits_change.txt +14 -0
- data/autohotkey/config/targets/SYSTEM/screens/meta.txt +14 -0
- data/autohotkey/config/targets/SYSTEM/target.txt +12 -0
- data/autohotkey/config/tools/cmd_tlm_server/cmd_tlm_server.txt +2 -2
- data/autohotkey/config/tools/test_runner/test_runner2.txt +1 -1
- data/autohotkey/tools/CmdSequence +14 -0
- data/autohotkey/tools/CmdSequenceAHK +23 -0
- data/autohotkey/tools/CmdSequenceAHK2 +16 -0
- data/autohotkey/tools/cmd_extractor.ahk +2 -2
- data/autohotkey/tools/cmd_sender.ahk +4 -6
- data/autohotkey/tools/cmd_sequence.ahk +215 -0
- data/autohotkey/tools/cmd_sequence2.ahk +23 -0
- data/autohotkey/tools/data_viewer.ahk +2 -3
- data/autohotkey/tools/limits_monitor.ahk +9 -11
- data/autohotkey/tools/open_gl_builder.ahk +1 -2
- data/autohotkey/tools/packet_viewer.ahk +51 -35
- data/autohotkey/tools/replay.ahk +1 -2
- data/autohotkey/tools/script_runner.ahk +1 -2
- data/autohotkey/tools/script_runner2.ahk +1 -2
- data/autohotkey/tools/test_runner2.ahk +1 -5
- data/autohotkey/tools/test_runner3.ahk +1 -3
- data/autohotkey/tools/tlm_grapher.ahk +1 -3
- data/autohotkey/tools/tlm_grapher3.ahk +1 -2
- data/autohotkey/tools/tlm_viewer.ahk +8 -3
- data/autohotkey/tools/tlm_viewer2.ahk +2 -3
- data/autohotkey/tools/tlm_viewer5.ahk +1 -2
- data/cosmos.gemspec +26 -20
- data/data/cmd_sequence.png +0 -0
- data/data/config/_array_params.yaml +23 -0
- data/data/config/_id_items.yaml +24 -0
- data/data/config/_id_params.yaml +58 -0
- data/data/config/_interfaces.yaml +206 -0
- data/data/config/_items.yaml +20 -0
- data/data/config/_params.yaml +58 -0
- data/data/config/cmd_tlm_server.yaml +110 -0
- data/data/config/command.yaml +38 -0
- data/data/config/command_modifiers.yaml +127 -0
- data/data/config/command_telemetry.yaml +3 -0
- data/data/config/data_viewer.yaml +43 -0
- data/data/config/handbook_creator.yaml +23 -0
- data/data/config/housekeeping_params.yaml +71 -0
- data/data/config/interface_modifiers.yaml +44 -0
- data/data/config/item_modifiers.yaml +172 -0
- data/data/config/launcher.yaml +117 -0
- data/data/config/limits_monitor.yaml +53 -0
- data/data/config/linegraph_params.yaml +30 -0
- data/data/config/linegraph_plot.yaml +106 -0
- data/data/config/page_modifiers.yaml +128 -0
- data/data/config/param_item_modifiers.yaml +41 -0
- data/data/config/parameter_modifiers.yaml +144 -0
- data/data/config/protocols.yaml +257 -0
- data/data/config/screen.yaml +151 -0
- data/data/config/script_runner.yaml +15 -0
- data/data/config/system.yaml +153 -0
- data/data/config/table_manager.yaml +76 -0
- data/data/config/table_parameter_modifiers.yaml +9 -0
- data/data/config/target.yaml +71 -0
- data/data/config/telemetry.yaml +73 -0
- data/data/config/telemetry_modifiers.yaml +129 -0
- data/data/config/test_runner.yaml +118 -0
- data/data/config/tlm_extractor.yaml +109 -0
- data/data/config/tlm_grapher.yaml +78 -0
- data/data/config/tlm_viewer.yaml +107 -0
- data/data/config/unknown.yaml +3 -0
- data/data/config/widgets.yaml +1339 -0
- data/data/config/xy_params.yaml +50 -0
- data/data/config/xy_plot.yaml +12 -0
- data/data/config_editor.png +0 -0
- data/data/crc.txt +172 -161
- data/data/delete.png +0 -0
- data/demo/config/data/crc.txt +56 -36
- data/demo/config/data/meta_init.txt +1 -4
- data/demo/config/system/system.txt +15 -3
- data/demo/config/system/system2.txt +13 -3
- data/demo/config/targets/EXAMPLE/lib/example_interface.rb +2 -6
- data/demo/config/targets/EXAMPLE/target.txt +3 -1
- data/demo/config/targets/INST/cmd_tlm/inst_cmds.txt +1 -0
- data/demo/config/targets/INST/lib/inst_dump_component.rb +34 -0
- data/demo/config/targets/INST/screens/adcs.txt +39 -15
- data/demo/config/targets/INST/screens/commanding.txt +26 -19
- data/demo/config/targets/INST/screens/spacing_box.txt +44 -0
- data/demo/config/targets/INST/screens/spacing_grid.txt +78 -0
- data/demo/config/targets/INST/screens/tabs.txt +0 -2
- data/demo/config/targets/INST/sequences/sequence.tsv +3 -0
- data/demo/config/targets/INST/tables/EventAction.csv +9 -0
- data/demo/config/targets/INST/tables/EventAction.dat +0 -0
- data/demo/config/targets/INST/tables/McConfigTable.csv +20 -0
- data/demo/config/targets/INST/tables/McConfigTable.dat +0 -0
- data/demo/config/targets/INST/target.txt +4 -0
- data/demo/config/targets/INST/tools/data_viewer/data_viewer.txt +2 -0
- data/demo/config/targets/INST/tools/data_viewer/data_viewer2.txt +2 -0
- data/demo/config/targets/INST/tools/table_manager/EventAction_def.txt +6 -0
- data/demo/config/targets/INST/tools/table_manager/McConfigTable_def.txt +38 -0
- data/demo/config/targets/SYSTEM/cmd_tlm/limits_groups.txt +7 -3
- data/demo/config/targets/SYSTEM/cmd_tlm/meta_cmd_tlm.txt +16 -0
- data/demo/config/targets/{COSMOS/cmd_tlm/cosmos_server_cmds.txt → SYSTEM/cmd_tlm/system_cmds.txt} +8 -8
- data/demo/config/targets/SYSTEM/cmd_tlm/system_tlm.txt +7 -0
- data/demo/config/targets/{COSMOS → SYSTEM}/cmd_tlm_server.txt +2 -2
- data/demo/config/targets/SYSTEM/lib/limits_groups.rb +39 -0
- data/demo/config/targets/SYSTEM/screens/status.txt +1 -1
- data/demo/config/targets/SYSTEM/target.txt +12 -0
- data/demo/config/targets/TEMPLATED/cmd_tlm_server.txt +1 -1
- data/demo/config/targets/TEMPLATED/lib/templated_interface.rb +8 -5
- data/demo/config/targets/TEMPLATED/target.txt +2 -0
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server.txt +15 -6
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server2.txt +13 -5
- data/demo/config/tools/data_viewer/data_viewer.txt +9 -0
- data/demo/config/tools/launcher/launcher.txt +9 -6
- data/demo/config/tools/launcher/launcher2.txt +16 -13
- data/demo/config/tools/launcher/launcher_mini.txt +45 -0
- data/demo/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +12 -11
- data/demo/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +12 -11
- data/demo/config/tools/test_runner/test_runner.txt +1 -1
- data/demo/config/tools/tlm_viewer/tlm_viewer.txt +5 -5
- data/demo/lib/example_background_task.rb +9 -5
- data/demo/lib/example_target.rb +5 -15
- data/demo/lib/scpi_target.rb +4 -10
- data/demo/procedures/cosmos_api_test.rb +17 -0
- data/demo/tools/CmdSequence +16 -0
- data/demo/tools/CmdSequence.bat +9 -0
- data/demo/tools/ConfigEditor +16 -0
- data/demo/tools/ConfigEditor.bat +9 -0
- data/demo/tools/mac/CmdSequence.app/Contents/Info.plist +38 -0
- data/demo/tools/mac/CmdSequence.app/Contents/MacOS/CmdSequence.rb +16 -0
- data/demo/tools/mac/CmdSequence.app/Contents/MacOS/main.sh +10 -0
- data/demo/tools/mac/CmdSequence.app/Contents/MacOS/tool_launch.rb +38 -0
- data/demo/tools/mac/CmdSequence.app/Contents/Resources/appIcon.icns +0 -0
- data/ext/cosmos/ext/packet/packet.c +5 -5
- data/install/config/data/crc.txt +12 -8
- data/install/config/system/system.txt +13 -3
- data/install/config/targets/SYSTEM/cmd_tlm/meta_cmd_tlm.txt +14 -0
- data/install/config/targets/SYSTEM/target.txt +12 -0
- data/install/tools/CmdSequence +16 -0
- data/install/tools/CmdSequence.bat +9 -0
- data/install/tools/ConfigEditor +16 -0
- data/install/tools/ConfigEditor.bat +9 -0
- data/install/tools/mac/CmdSequence.app/Contents/Info.plist +38 -0
- data/install/tools/mac/CmdSequence.app/Contents/MacOS/CmdSequence.rb +16 -0
- data/install/tools/mac/CmdSequence.app/Contents/MacOS/main.sh +10 -0
- data/install/tools/mac/CmdSequence.app/Contents/MacOS/tool_launch.rb +38 -0
- data/install/tools/mac/CmdSequence.app/Contents/Resources/appIcon.icns +0 -0
- data/lib/cosmos.rb +1 -1
- data/lib/cosmos/config/config_parser.rb +147 -59
- data/lib/cosmos/config/meta_config_parser.rb +57 -0
- data/lib/cosmos/conversions/polynomial_conversion.rb +20 -4
- data/lib/cosmos/conversions/unix_time_conversion.rb +4 -4
- data/lib/cosmos/core_ext/array.rb +45 -5
- data/lib/cosmos/core_ext/cosmos_io.rb +31 -15
- data/lib/cosmos/core_ext/file.rb +2 -2
- data/lib/cosmos/core_ext/kernel.rb +1 -6
- data/lib/cosmos/core_ext/objectspace.rb +0 -2
- data/lib/cosmos/core_ext/string.rb +27 -4
- data/lib/cosmos/core_ext/time.rb +39 -10
- data/lib/cosmos/gui/choosers/combobox_chooser.rb +37 -26
- data/lib/cosmos/gui/choosers/file_chooser.rb +23 -6
- data/lib/cosmos/gui/choosers/float_chooser.rb +13 -11
- data/lib/cosmos/gui/choosers/integer_chooser.rb +13 -11
- data/lib/cosmos/gui/choosers/string_chooser.rb +18 -36
- data/lib/cosmos/gui/choosers/telemetry_chooser.rb +64 -64
- data/lib/cosmos/gui/choosers/value_chooser.rb +15 -15
- data/lib/cosmos/gui/dialogs/about_dialog.rb +18 -13
- data/lib/cosmos/gui/dialogs/calendar_dialog.rb +11 -3
- data/lib/cosmos/gui/dialogs/cmd_tlm_raw_dialog.rb +1 -1
- data/lib/cosmos/gui/dialogs/details_dialog.rb +1 -1
- data/lib/cosmos/gui/dialogs/exception_dialog.rb +7 -7
- data/lib/cosmos/gui/dialogs/find_replace_dialog.rb +20 -15
- data/lib/cosmos/gui/dialogs/interface_raw_dialog.rb +143 -0
- data/lib/cosmos/gui/dialogs/legal_dialog.rb +6 -5
- data/lib/cosmos/gui/dialogs/packet_log_dialog.rb +5 -2
- data/lib/cosmos/gui/dialogs/progress_dialog.rb +1 -1
- data/lib/cosmos/gui/dialogs/pry_dialog.rb +4 -4
- data/lib/cosmos/gui/dialogs/scroll_text_dialog.rb +3 -0
- data/lib/cosmos/gui/dialogs/set_tlm_dialog.rb +7 -6
- data/lib/cosmos/gui/dialogs/splash.rb +1 -1
- data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +1 -1
- data/lib/cosmos/gui/dialogs/tlm_graph_dialog.rb +114 -0
- data/lib/cosmos/gui/line_graph/line_graph.rb +9 -10
- data/lib/cosmos/gui/line_graph/line_graph_dialog.rb +7 -5
- data/lib/cosmos/gui/line_graph/line_graph_drawing.rb +3 -7
- data/lib/cosmos/gui/line_graph/line_graph_popups.rb +3 -8
- data/lib/cosmos/gui/line_graph/line_graph_scaling.rb +2 -7
- data/lib/cosmos/gui/line_graph/overview_graph.rb +6 -1
- data/lib/cosmos/gui/opengl/earth_model.rb +6 -3
- data/lib/cosmos/gui/opengl/gl_bounds.rb +11 -23
- data/lib/cosmos/gui/opengl/gl_light.rb +3 -4
- data/lib/cosmos/gui/opengl/gl_material.rb +3 -4
- data/lib/cosmos/gui/opengl/gl_scene.rb +10 -4
- data/lib/cosmos/gui/opengl/gl_shape.rb +6 -2
- data/lib/cosmos/gui/opengl/gl_viewer.rb +5 -5
- data/lib/cosmos/gui/opengl/gl_viewport.rb +11 -12
- data/lib/cosmos/gui/opengl/moon_model.rb +6 -3
- data/lib/cosmos/gui/opengl/stl_reader.rb +8 -9
- data/lib/cosmos/gui/opengl/stl_shape.rb +4 -5
- data/lib/cosmos/gui/opengl/texture_mapped_sphere.rb +7 -7
- data/lib/cosmos/gui/qt.rb +1 -1
- data/lib/cosmos/gui/qt_tool.rb +21 -10
- data/lib/cosmos/gui/text/completion.rb +23 -2
- data/lib/cosmos/gui/text/completion_text_edit.rb +38 -23
- data/lib/cosmos/gui/utilities/analyze_log.rb +1 -1
- data/lib/cosmos/gui/utilities/screenshot.rb +2 -2
- data/lib/cosmos/gui/widgets/full_text_search_line_edit.rb +11 -1
- data/lib/cosmos/gui/widgets/packet_log_frame.rb +19 -6
- data/lib/cosmos/interfaces.rb +10 -0
- data/lib/cosmos/interfaces/cmd_tlm_server_interface.rb +28 -47
- data/lib/cosmos/interfaces/interface.rb +240 -22
- data/lib/cosmos/interfaces/linc_interface.rb +3 -5
- data/lib/cosmos/interfaces/protocols/burst_protocol.rb +173 -0
- data/lib/cosmos/interfaces/protocols/crc_protocol.rb +141 -0
- data/lib/cosmos/{streams/fixed_stream_protocol.rb → interfaces/protocols/fixed_protocol.rb} +40 -37
- data/lib/cosmos/{streams/length_stream_protocol.rb → interfaces/protocols/length_protocol.rb} +55 -48
- data/lib/cosmos/interfaces/protocols/override_protocol.rb +52 -0
- data/lib/cosmos/interfaces/protocols/preidentified_protocol.rb +141 -0
- data/lib/cosmos/interfaces/protocols/protocol.rb +60 -0
- data/lib/cosmos/interfaces/protocols/template_protocol.rb +209 -0
- data/lib/cosmos/interfaces/protocols/terminated_protocol.rb +81 -0
- data/lib/cosmos/interfaces/serial_interface.rb +28 -23
- data/lib/cosmos/interfaces/simulated_target_interface.rb +27 -16
- data/lib/cosmos/interfaces/stream_interface.rb +36 -108
- data/lib/cosmos/interfaces/tcpip_client_interface.rb +21 -21
- data/lib/cosmos/interfaces/tcpip_server_interface.rb +555 -94
- data/lib/cosmos/interfaces/udp_interface.rb +51 -83
- data/lib/cosmos/io/buffered_file.rb +92 -2
- data/lib/cosmos/io/json_drb.rb +2 -2
- data/lib/cosmos/io/posix_serial_driver.rb +3 -1
- data/lib/cosmos/io/raw_logger.rb +3 -3
- data/lib/cosmos/io/serial_driver.rb +14 -5
- data/lib/cosmos/io/win32_serial_driver.rb +16 -4
- data/lib/cosmos/packet_logs.rb +0 -1
- data/lib/cosmos/packet_logs/packet_log_reader.rb +11 -1
- data/lib/cosmos/packet_logs/packet_log_writer.rb +31 -13
- data/lib/cosmos/packets/binary_accessor.rb +599 -32
- data/lib/cosmos/packets/commands.rb +48 -24
- data/lib/cosmos/packets/packet.rb +140 -54
- data/lib/cosmos/packets/packet_config.rb +0 -2
- data/lib/cosmos/packets/parsers/packet_item_parser.rb +10 -2
- data/lib/cosmos/packets/structure.rb +81 -33
- data/lib/cosmos/packets/structure_item.rb +45 -5
- data/lib/cosmos/packets/telemetry.rb +149 -55
- data/lib/cosmos/script/api_shared.rb +1000 -0
- data/lib/cosmos/script/commands.rb +2 -2
- data/lib/cosmos/script/extract.rb +19 -4
- data/lib/cosmos/script/limits.rb +2 -0
- data/lib/cosmos/script/script.rb +1 -1
- data/lib/cosmos/script/scripting.rb +4 -784
- data/lib/cosmos/script/telemetry.rb +44 -23
- data/lib/cosmos/script/tools.rb +15 -69
- data/lib/cosmos/streams/serial_stream.rb +12 -19
- data/lib/cosmos/streams/stream.rb +2 -11
- data/lib/cosmos/streams/tcpip_socket_stream.rb +3 -13
- data/lib/cosmos/system/system.rb +187 -31
- data/lib/cosmos/system/target.rb +11 -2
- data/lib/cosmos/tools/cmd_extractor/cmd_extractor.rb +12 -11
- data/lib/cosmos/tools/cmd_sender/{cmd_sender_item_delegate.rb → cmd_param_table_item_delegate.rb} +11 -10
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +209 -164
- data/lib/cosmos/tools/cmd_sequence/cmd_sequence.rb +652 -0
- data/lib/cosmos/tools/cmd_sequence/sequence_item.rb +510 -0
- data/lib/cosmos/tools/cmd_sequence/sequence_list.rb +194 -0
- data/lib/cosmos/tools/cmd_tlm_server/api.rb +179 -5
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +31 -14
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +23 -16
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +92 -20
- data/lib/cosmos/tools/cmd_tlm_server/commanding.rb +1 -1
- data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +17 -4
- data/lib/cosmos/tools/cmd_tlm_server/gui/targets_tab.rb +0 -5
- data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +1 -2
- data/lib/cosmos/tools/cmd_tlm_server/interfaces.rb +4 -4
- data/lib/cosmos/tools/cmd_tlm_server/limits_groups_background_task.rb +121 -0
- data/lib/cosmos/tools/cmd_tlm_server/routers.rb +8 -4
- data/lib/cosmos/tools/config_editor/config_editor.rb +720 -0
- data/lib/cosmos/tools/config_editor/config_editor_frame.rb +675 -0
- data/lib/cosmos/tools/data_viewer/data_viewer.rb +44 -27
- data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +8 -22
- data/lib/cosmos/tools/launcher/launcher.rb +29 -12
- data/lib/cosmos/tools/launcher/launcher_config.rb +1 -1
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +153 -42
- data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +44 -6
- data/lib/cosmos/tools/replay/replay.rb +36 -20
- data/lib/cosmos/tools/replay/replay_server.rb +1 -1
- data/lib/cosmos/tools/script_runner/script_runner_config.rb +1 -1
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +31 -21
- data/lib/cosmos/tools/table_manager/table_config.rb +9 -3
- data/lib/cosmos/tools/table_manager/table_manager.rb +27 -7
- data/lib/cosmos/tools/test_runner/results_writer.rb +6 -6
- data/lib/cosmos/tools/test_runner/test_runner.rb +4 -6
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +4 -5
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb +1 -1
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +1 -1
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/housekeeping_data_object_adder.rb +23 -6
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +44 -3
- data/lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb +20 -7
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb +1 -1
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_config.rb +11 -4
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_plot_editor.rb +2 -2
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_realtime_thread.rb +1 -1
- data/lib/cosmos/tools/tlm_grapher/tlm_grapher.rb +16 -0
- data/lib/cosmos/tools/tlm_viewer/screen.rb +36 -32
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +59 -50
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer_config.rb +2 -2
- data/lib/cosmos/tools/tlm_viewer/widgets.rb +1 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasvalue_widget.rb +1 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvalue_widget.rb +22 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/matrixbycolumns_widget.rb +9 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/spacer_widget.rb +55 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/vertical_widget.rb +3 -2
- data/lib/cosmos/tools/tlm_viewer/widgets/verticalbox_widget.rb +3 -2
- data/lib/cosmos/tools/tlm_viewer/widgets/widget.rb +12 -12
- data/lib/cosmos/top_level.rb +34 -24
- data/lib/cosmos/utilities/crc.rb +108 -6
- data/lib/cosmos/utilities/csv.rb +68 -14
- data/lib/cosmos/utilities/logger.rb +2 -2
- data/lib/cosmos/utilities/low_fragmentation_array.rb +9 -1
- data/lib/cosmos/version.rb +6 -6
- data/lib/cosmos/win32/win32_main.rb +50 -46
- data/run_gui_tests.bat +3 -1
- data/spec/conversions/unix_time_formatted_conversion_spec.rb +2 -2
- data/spec/conversions/unix_time_seconds_conversion_spec.rb +2 -2
- data/spec/core_ext/file_spec.rb +1 -1
- data/spec/core_ext/objectspace_spec.rb +12 -9
- data/spec/core_ext/string_spec.rb +6 -0
- data/spec/core_ext/time_spec.rb +10 -0
- data/spec/gui/line_graph/line_clip_spec.rb +226 -224
- data/spec/gui/qt_spec.rb +81 -79
- data/spec/install/config/system/system.txt +0 -6
- data/spec/install/config/targets/INST/cmd_tlm/inst_cmd_linc.txt +5 -5
- data/spec/install/config/targets/INST/cmd_tlm/inst_tlm_linc.txt +8 -8
- data/spec/install/config/targets/SYSTEM/cmd_tlm/meta_cmd_tlm.txt +16 -0
- data/{install/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt → spec/install/config/targets/SYSTEM/cmd_tlm/system_cmds.txt} +8 -8
- data/spec/install/config/targets/SYSTEM/cmd_tlm/system_tlm.txt +7 -0
- data/spec/install/config/targets/{COSMOS → SYSTEM}/cmd_tlm_server.txt +2 -2
- data/spec/install/config/targets/SYSTEM/screens/status.txt +12 -0
- data/spec/install/config/targets/SYSTEM/target.txt +12 -0
- data/spec/interfaces/cmd_tlm_server_interface_spec.rb +9 -13
- data/spec/interfaces/interface_spec.rb +402 -18
- data/spec/interfaces/linc_interface_spec.rb +37 -39
- data/spec/interfaces/protocols/burst_protocol_spec.rb +300 -0
- data/spec/interfaces/protocols/crc_protocol_spec.rb +709 -0
- data/spec/interfaces/protocols/fixed_protocol_spec.rb +119 -0
- data/spec/interfaces/protocols/length_protocol_spec.rb +499 -0
- data/spec/interfaces/protocols/override_protocol_spec.rb +158 -0
- data/spec/interfaces/protocols/preidentified_protocol_spec.rb +149 -0
- data/spec/interfaces/protocols/template_protocol_spec.rb +218 -0
- data/spec/interfaces/protocols/terminated_protocol_spec.rb +174 -0
- data/spec/interfaces/serial_interface_spec.rb +35 -34
- data/spec/interfaces/simulated_target_interface_spec.rb +13 -13
- data/spec/interfaces/tcpip_client_interface_spec.rb +21 -16
- data/spec/interfaces/tcpip_server_interface_spec.rb +66 -69
- data/spec/interfaces/udp_interface_spec.rb +120 -55
- data/spec/io/serial_driver_spec.rb +41 -39
- data/spec/io/udp_sockets_spec.rb +13 -8
- data/spec/io/win32_serial_driver_spec.rb +62 -59
- data/spec/packet_logs/packet_log_reader_spec.rb +68 -47
- data/spec/packet_logs/packet_log_writer_spec.rb +7 -5
- data/spec/packets/commands_spec.rb +5 -5
- data/spec/packets/packet_spec.rb +2 -14
- data/spec/script/extract_spec.rb +21 -7
- data/spec/script/scripting_spec.rb +261 -6
- data/spec/script/telemetry_spec.rb +17 -9
- data/spec/spec_helper.rb +26 -10
- data/spec/streams/serial_stream_spec.rb +87 -82
- data/spec/streams/tcpip_client_stream_spec.rb +12 -4
- data/spec/streams/tcpip_socket_stream_spec.rb +5 -0
- data/spec/system/system_spec.rb +66 -50
- data/spec/system/target_spec.rb +33 -11
- data/spec/tools/cmd_tlm_server/api_spec.rb +5 -5
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +75 -15
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +125 -5
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +244 -232
- data/spec/tools/cmd_tlm_server/commanding_spec.rb +18 -18
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +124 -29
- data/spec/tools/cmd_tlm_server/interfaces_spec.rb +2 -2
- data/spec/tools/cmd_tlm_server/limits_groups_background_task_spec.rb +145 -0
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +50 -10
- data/spec/tools/table_manager/tablemanager_core_spec.rb +0 -1
- data/spec/top_level/top_level_spec.rb +39 -11
- data/spec/utilities/csv_spec.rb +62 -20
- data/tasks/gemfile_stats.rake +6 -3
- data/test/performance/config/system/system_packets.txt +0 -1
- data/test/performance/config/system/system_threads.txt +0 -1
- metadata +177 -92
- data/autohotkey/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +0 -15
- data/autohotkey/config/targets/COSMOS/cmd_tlm_server.txt +0 -6
- data/autohotkey/config/targets/COSMOS/target.txt +0 -5
- data/autohotkey/userpath.txt +0 -1
- data/demo/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +0 -15
- data/demo/config/targets/COSMOS/screens/limits_change.txt +0 -20
- data/demo/config/targets/COSMOS/screens/version.txt +0 -19
- data/demo/config/targets/COSMOS/target.txt +0 -11
- data/demo/config/targets/META/cmd_tlm/meta_cmd.txt +0 -10
- data/demo/config/targets/META/cmd_tlm/meta_tlm.txt +0 -13
- data/demo/userpath.txt +0 -1
- data/install/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +0 -15
- data/install/config/targets/COSMOS/cmd_tlm_server.txt +0 -6
- data/install/config/targets/COSMOS/screens/limits_change.txt +0 -20
- data/install/config/targets/COSMOS/screens/version.txt +0 -19
- data/install/config/targets/COSMOS/target.txt +0 -9
- data/install/config/targets/SYSTEM/README.txt +0 -1
- data/install/userpath.txt +0 -1
- data/lib/cosmos/io/tcpip_server.rb +0 -571
- data/lib/cosmos/packet_logs/meta_packet_log_writer.rb +0 -107
- data/lib/cosmos/streams/burst_stream_protocol.rb +0 -25
- data/lib/cosmos/streams/preidentified_stream_protocol.rb +0 -118
- data/lib/cosmos/streams/stream_protocol.rb +0 -373
- data/lib/cosmos/streams/template_stream_protocol.rb +0 -140
- data/lib/cosmos/streams/terminated_stream_protocol.rb +0 -85
- data/spec/install/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +0 -41
- data/spec/install/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +0 -15
- data/spec/install/config/targets/COSMOS/screens/limits_change.txt +0 -20
- data/spec/install/config/targets/COSMOS/screens/version.txt +0 -19
- data/spec/install/config/targets/COSMOS/target.txt +0 -5
- data/spec/install/config/targets/META/cmd_tlm/meta_cmd.txt +0 -4
- data/spec/install/config/targets/META/cmd_tlm/meta_tlm.txt +0 -4
- data/spec/install/userpath.txt +0 -1
- data/spec/interfaces/stream_interface_spec.rb +0 -157
- data/spec/io/tcpip_server_spec.rb +0 -338
- data/spec/packet_logs/meta_packet_log_writer_spec.rb +0 -170
- data/spec/streams/burst_stream_protocol_spec.rb +0 -32
- data/spec/streams/fixed_stream_protocol_spec.rb +0 -113
- data/spec/streams/length_stream_protocol_spec.rb +0 -300
- data/spec/streams/preidentified_stream_protocol_spec.rb +0 -121
- data/spec/streams/stream_protocol_spec.rb +0 -346
- data/spec/streams/template_stream_protocol_spec.rb +0 -156
- data/spec/streams/terminated_stream_protocol_spec.rb +0 -127
- data/test/performance/userpath.txt +0 -1
data/lib/cosmos/system/target.rb
CHANGED
@@ -117,14 +117,23 @@ module Cosmos
|
|
117
117
|
# @param filename [String] The target configuration file to parse
|
118
118
|
def process_file(filename)
|
119
119
|
Logger.instance.info "Processing target definition in file '#{filename}'"
|
120
|
-
parser = ConfigParser.new
|
120
|
+
parser = ConfigParser.new("http://cosmosrb.com/docs/system/#target-configuration")
|
121
121
|
parser.parse_file(filename) do |keyword, parameters|
|
122
122
|
case keyword
|
123
123
|
when 'REQUIRE'
|
124
124
|
usage = "#{keyword} <FILENAME>"
|
125
125
|
parser.verify_num_parameters(1, 1, usage)
|
126
126
|
begin
|
127
|
-
|
127
|
+
# Require absolute path to file in target lib folder. Prevents name
|
128
|
+
# conflicts at the require step
|
129
|
+
Cosmos.require_file(File.join(@dir, 'lib', parameters[0]))
|
130
|
+
rescue LoadError
|
131
|
+
begin
|
132
|
+
# If we couldn't load at the target/lib level check everywhere
|
133
|
+
Cosmos.require_file(parameters[0])
|
134
|
+
rescue Exception => err
|
135
|
+
raise parser.error(err.message)
|
136
|
+
end
|
128
137
|
rescue Exception => err
|
129
138
|
raise parser.error(err.message)
|
130
139
|
end
|
@@ -18,20 +18,21 @@ Cosmos.catch_fatal_exception do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
module Cosmos
|
21
|
-
|
22
|
-
# Breaks a binary log of commands into readable text.
|
21
|
+
# Breaks a binary log of commands into readable text
|
23
22
|
class CmdExtractor < QtTool
|
24
|
-
|
23
|
+
# Create a new CmdExtractor by instantiating a new packet log reader,
|
24
|
+
# loading the custom icon, building the application and loading the system
|
25
|
+
# commands.
|
26
|
+
# @param (see QtTool#initialize)
|
25
27
|
def initialize(options)
|
26
28
|
# MUST BE FIRST - All code before super is executed twice in RubyQt Based classes
|
27
29
|
super(options)
|
28
30
|
|
29
|
-
# Define instance variables
|
30
31
|
@output_filename = nil
|
31
32
|
@input_filenames = []
|
32
33
|
@log_dir = System.paths['LOGS']
|
33
34
|
@export_dir = @log_dir.clone
|
34
|
-
@packet_log_reader = System.default_packet_log_reader.new
|
35
|
+
@packet_log_reader = System.default_packet_log_reader.new(*System.default_packet_log_reader_params)
|
35
36
|
@time_start = nil
|
36
37
|
@time_end = nil
|
37
38
|
|
@@ -50,6 +51,7 @@ module Cosmos
|
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
54
|
+
# Initialize the Mode menu actions
|
53
55
|
def initialize_actions
|
54
56
|
super()
|
55
57
|
|
@@ -66,29 +68,27 @@ module Cosmos
|
|
66
68
|
@include_raw.setCheckable(true)
|
67
69
|
end
|
68
70
|
|
71
|
+
# Create the File and Mode menus and initialize the Help menu
|
69
72
|
def initialize_menus
|
70
|
-
# File Menu
|
71
73
|
@file_menu = menuBar.addMenu(tr('&File'))
|
72
74
|
@file_menu.addAction(@analyze_log)
|
73
75
|
@file_menu.addSeparator()
|
74
76
|
@file_menu.addAction(@exit_action)
|
75
|
-
|
76
|
-
# Mode Menu
|
77
77
|
@mode_menu = menuBar.addMenu(tr('&Mode'))
|
78
78
|
@mode_menu.addAction(@include_raw)
|
79
|
-
|
80
|
-
# Help Menu
|
81
79
|
@about_string = "Command Extractor extracts commands from a binary command log file into a human readable text file."
|
82
80
|
initialize_help_menu()
|
83
81
|
end
|
84
82
|
|
83
|
+
# Create the CmdExtractor application which primarily consists of a
|
84
|
+
# {PacketLogFrame}
|
85
85
|
def initialize_central_widget
|
86
86
|
@central_widget = Qt::Widget.new
|
87
87
|
setCentralWidget(@central_widget)
|
88
88
|
@top_layout = Qt::VBoxLayout.new(@central_widget)
|
89
89
|
|
90
90
|
# Packet Log Frame
|
91
|
-
@packet_log_frame = PacketLogFrame.new(self, @log_dir, System.default_packet_log_reader.new, @input_filenames, @output_filename, true, true, true, Cosmos::CMD_FILE_PATTERN, Cosmos::TXT_FILE_PATTERN)
|
91
|
+
@packet_log_frame = PacketLogFrame.new(self, @log_dir, System.default_packet_log_reader.new(*System.default_packet_log_reader_params), @input_filenames, @output_filename, true, true, true, Cosmos::CMD_FILE_PATTERN, Cosmos::TXT_FILE_PATTERN)
|
92
92
|
@packet_log_frame.change_callback = method(:change_callback)
|
93
93
|
@top_layout.addWidget(@packet_log_frame)
|
94
94
|
|
@@ -110,6 +110,7 @@ module Cosmos
|
|
110
110
|
@top_layout.addLayout(@button_layout)
|
111
111
|
end
|
112
112
|
|
113
|
+
# (see QtTool.run)
|
113
114
|
def self.run(option_parser = nil, options = nil)
|
114
115
|
Cosmos.catch_fatal_exception do
|
115
116
|
unless option_parser and options
|
data/lib/cosmos/tools/cmd_sender/{cmd_sender_item_delegate.rb → cmd_param_table_item_delegate.rb}
RENAMED
@@ -9,26 +9,28 @@
|
|
9
9
|
# attribution addendums as found in the LICENSE.txt
|
10
10
|
|
11
11
|
module Cosmos
|
12
|
+
class CmdParamTableItemDelegate < Qt::StyledItemDelegate
|
13
|
+
MANUALLY = "MANUALLY ENTERED"
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
@
|
16
|
-
super(
|
15
|
+
def initialize(table, widgets)
|
16
|
+
@table = table
|
17
|
+
@widgets = widgets
|
18
|
+
super(table)
|
17
19
|
end
|
18
20
|
|
19
21
|
def createEditor(parent, option, index)
|
20
|
-
packet_item, _, _ =
|
22
|
+
packet_item, _, _ = @widgets[index.row]
|
21
23
|
if index.column == 1 and packet_item and packet_item.states
|
22
24
|
combo = Qt::ComboBox.new(parent)
|
23
25
|
sorted_states = packet_item.states.sort {|a, b| a[1] <=> b[1]}
|
24
26
|
items = sorted_states.map {|state_name, state_value| state_name}
|
25
|
-
items <<
|
27
|
+
items << MANUALLY
|
26
28
|
combo.addItems(items)
|
27
29
|
combo.setCurrentText(@table.item(index.row, index.column).text.to_s)
|
28
30
|
combo.setMaxVisibleItems(6)
|
29
31
|
connect(combo, SIGNAL('activated(int)')) do
|
30
32
|
emit commitData(combo)
|
31
|
-
|
33
|
+
@table.closeEditor(combo, 0)
|
32
34
|
end
|
33
35
|
return combo
|
34
36
|
else
|
@@ -37,7 +39,7 @@ module Cosmos
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def paint(painter, option, index)
|
40
|
-
packet_item, _, _ =
|
42
|
+
packet_item, _, _ = @widgets[index.row]
|
41
43
|
if index.column == 1 and packet_item and packet_item.states
|
42
44
|
# This code simply draws the current combo box text inside a button to
|
43
45
|
# give the user an idea that they have to click it to activate it
|
@@ -73,5 +75,4 @@ module Cosmos
|
|
73
75
|
end
|
74
76
|
end
|
75
77
|
end
|
76
|
-
|
77
|
-
end # module Cosmos
|
78
|
+
end
|
@@ -18,11 +18,10 @@ Cosmos.catch_fatal_exception do
|
|
18
18
|
require 'cosmos/gui/dialogs/splash'
|
19
19
|
require 'cosmos/gui/dialogs/cmd_details_dialog'
|
20
20
|
require 'cosmos/tools/cmd_sender/cmd_sender_text_edit'
|
21
|
-
require 'cosmos/tools/cmd_sender/
|
21
|
+
require 'cosmos/tools/cmd_sender/cmd_param_table_item_delegate'
|
22
22
|
end
|
23
23
|
|
24
24
|
module Cosmos
|
25
|
-
|
26
25
|
Cosmos.disable_warnings do
|
27
26
|
module Script
|
28
27
|
def prompt_for_script_abort
|
@@ -30,12 +29,12 @@ module Cosmos
|
|
30
29
|
window.statusBar.showMessage(tr("Hazardous command not sent"))
|
31
30
|
return true # Aborted - Don't retry
|
32
31
|
end
|
33
|
-
end
|
32
|
+
end
|
34
33
|
end
|
35
34
|
|
36
35
|
$eval_binding = binding()
|
37
36
|
|
38
|
-
# Command Sender sends commands to the COSMOS server.
|
37
|
+
# Command Sender sends commands to the COSMOS server. It gives the user
|
39
38
|
# a drop down to select the target and then command to send.
|
40
39
|
# It then displays all the command parameters. Once a
|
41
40
|
# command is sent it is added to the command history window which allows the
|
@@ -52,22 +51,34 @@ module Cosmos
|
|
52
51
|
|
53
52
|
MANUALLY = "MANUALLY ENTERED"
|
54
53
|
|
54
|
+
# @return [Integer] Number of commands sent
|
55
55
|
def self.send_count
|
56
56
|
@@send_count
|
57
57
|
end
|
58
58
|
|
59
|
+
# @param val [Integer] Number of commands sent
|
59
60
|
def self.send_count=(val)
|
60
61
|
@@send_count = val
|
61
62
|
end
|
62
63
|
|
64
|
+
# @return [Array<PacketItem, Qt::TableWidgetItem, Qt::TableWidgetItem>]
|
65
|
+
# Array of the packet item, the table widget item representing the value,
|
66
|
+
# and the table widget item representing states if the packet item has
|
67
|
+
# states.
|
63
68
|
def self.param_widgets
|
64
69
|
@@param_widgets
|
65
70
|
end
|
66
71
|
|
72
|
+
# @return [Qt::TableWidget] Table holding the command parameters. Each
|
73
|
+
# parameter is a separate row in the table.
|
67
74
|
def self.table
|
68
75
|
@@table
|
69
76
|
end
|
70
77
|
|
78
|
+
# Create the application by building the GUI and loading an initial target
|
79
|
+
# and command packet. This can be passed on the command line or the first
|
80
|
+
# target and packet will be loaded.
|
81
|
+
# @param (see QtTool#initialize)
|
71
82
|
def initialize(options)
|
72
83
|
# MUST BE FIRST - All code before super is executed twice in RubyQt Based classes
|
73
84
|
super(options)
|
@@ -104,9 +115,10 @@ module Cosmos
|
|
104
115
|
end
|
105
116
|
end
|
106
117
|
|
118
|
+
# Create the File and Mode menu actions
|
107
119
|
def initialize_actions
|
108
120
|
super()
|
109
|
-
|
121
|
+
# File menu actions
|
110
122
|
@send_raw_action = Qt::Action.new(Cosmos.get_icon('send_file.png'),
|
111
123
|
tr('&Send Raw'),
|
112
124
|
self)
|
@@ -114,6 +126,7 @@ module Cosmos
|
|
114
126
|
@send_raw_action.statusTip = tr('Send raw data from a file')
|
115
127
|
connect(@send_raw_action, SIGNAL('triggered()'), self, SLOT('file_send_raw()'))
|
116
128
|
|
129
|
+
# Mode menu actions
|
117
130
|
@ignore_range = Qt::Action.new(tr('&Ignore Range Checks'), self)
|
118
131
|
@ignore_range.statusTip = tr('Ignore range checks when processing command')
|
119
132
|
@ignore_range.setCheckable(true)
|
@@ -137,30 +150,51 @@ module Cosmos
|
|
137
150
|
@cmd_raw.setChecked(false)
|
138
151
|
end
|
139
152
|
|
153
|
+
# Create the File and Mode menus and initialize the help menu
|
140
154
|
def initialize_menus
|
141
|
-
# File Menu
|
142
155
|
file_menu = menuBar.addMenu(tr('&File'))
|
143
156
|
file_menu.addAction(@send_raw_action)
|
144
157
|
file_menu.addAction(@exit_action)
|
145
158
|
file_menu.insertSeparator(@exit_action)
|
146
159
|
|
147
|
-
# Mode Menu
|
148
160
|
mode_menu = menuBar.addMenu(tr('&Mode'))
|
149
161
|
mode_menu.addAction(@ignore_range)
|
150
162
|
mode_menu.addAction(@states_in_hex)
|
151
163
|
mode_menu.addAction(@show_ignored)
|
152
164
|
mode_menu.addAction(@cmd_raw)
|
153
165
|
|
154
|
-
# Help Menu
|
155
166
|
@about_string = "Command Sender allows the user to send any command defined in the system."
|
156
167
|
initialize_help_menu()
|
157
168
|
end
|
158
169
|
|
170
|
+
# Create the GUI which consists of a split window and add the top and
|
171
|
+
# bottom half widgets. The top half contains the command sender and the
|
172
|
+
# bottom half contains the history.
|
159
173
|
def initialize_central_widget
|
160
|
-
# Create the central widget
|
161
174
|
central_widget = Qt::Widget.new
|
162
175
|
setCentralWidget(central_widget)
|
163
176
|
|
177
|
+
splitter = Qt::Splitter.new(central_widget)
|
178
|
+
splitter.setOrientation(Qt::Vertical)
|
179
|
+
splitter.addWidget(create_sender_widget)
|
180
|
+
splitter.addWidget(create_history_widget)
|
181
|
+
splitter.setStretchFactor(0,10)
|
182
|
+
splitter.setStretchFactor(1,1)
|
183
|
+
|
184
|
+
layout = Qt::VBoxLayout.new
|
185
|
+
layout.setSpacing(1)
|
186
|
+
layout.setContentsMargins(1, 1, 1, 1)
|
187
|
+
layout.setSizeConstraint(Qt::Layout::SetMaximumSize)
|
188
|
+
layout.addWidget(splitter)
|
189
|
+
central_widget.layout = layout
|
190
|
+
|
191
|
+
# Mark this window as the window for popups
|
192
|
+
set_cmd_tlm_gui_window(self)
|
193
|
+
end
|
194
|
+
|
195
|
+
# Create the top half widget which contains target and packet combobox
|
196
|
+
# selections that update a table of command parameters.
|
197
|
+
def create_sender_widget
|
164
198
|
# Create the top half of the splitter window
|
165
199
|
sender = Qt::Widget.new
|
166
200
|
|
@@ -229,6 +263,17 @@ module Cosmos
|
|
229
263
|
# to get equal space.
|
230
264
|
top_layout.addStretch(1)
|
231
265
|
|
266
|
+
# Create the scroll area
|
267
|
+
scroll = Qt::ScrollArea.new
|
268
|
+
scroll.setMinimumSize(500, 150)
|
269
|
+
scroll.setWidgetResizable(true)
|
270
|
+
scroll.setWidget(sender)
|
271
|
+
scroll
|
272
|
+
end
|
273
|
+
|
274
|
+
# Create the history widget which consists of a {CmdSenderTextEdit} that
|
275
|
+
# displays the history of sent commands.
|
276
|
+
def create_history_widget
|
232
277
|
# Create the text edit where previously issued commands go and where
|
233
278
|
# commands can be manually typed in and re-executed
|
234
279
|
@input = CmdSenderTextEdit.new(statusBar)
|
@@ -242,189 +287,174 @@ module Cosmos
|
|
242
287
|
layout.addWidget(@input)
|
243
288
|
history = Qt::Widget.new
|
244
289
|
history.layout = layout
|
245
|
-
|
246
|
-
# Create the scroll area
|
247
|
-
scroll = Qt::ScrollArea.new
|
248
|
-
scroll.setMinimumSize(500, 150)
|
249
|
-
scroll.setWidgetResizable(true)
|
250
|
-
scroll.setWidget(sender)
|
251
|
-
|
252
|
-
splitter = Qt::Splitter.new(central_widget)
|
253
|
-
splitter.setOrientation(Qt::Vertical)
|
254
|
-
splitter.addWidget(scroll)
|
255
|
-
splitter.addWidget(history)
|
256
|
-
splitter.setStretchFactor(0,10)
|
257
|
-
splitter.setStretchFactor(1,1)
|
258
|
-
|
259
|
-
layout = Qt::VBoxLayout.new
|
260
|
-
layout.setSpacing(1)
|
261
|
-
layout.setContentsMargins(1, 1, 1, 1)
|
262
|
-
layout.setSizeConstraint(Qt::Layout::SetMaximumSize)
|
263
|
-
layout.addWidget(splitter)
|
264
|
-
central_widget.layout = layout
|
265
|
-
|
266
|
-
# Mark this window as the window for popups
|
267
|
-
set_cmd_tlm_gui_window(self)
|
290
|
+
history
|
268
291
|
end
|
269
292
|
|
293
|
+
# Changes the display of items with states to hex if checked is true.
|
294
|
+
# Otherwise state values are displayed as decimal.
|
295
|
+
# @param checked [Boolean] Whether to display state values in hex
|
270
296
|
def menu_states_in_hex(checked)
|
271
|
-
@@param_widgets.each do |
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
end
|
297
|
+
@@param_widgets.each do |_, _, state_value_item|
|
298
|
+
next unless state_value_item
|
299
|
+
text = state_value_item.text
|
300
|
+
quotes_removed = text.remove_quotes
|
301
|
+
if text == quotes_removed
|
302
|
+
if checked
|
303
|
+
if text.is_int?
|
304
|
+
@@table.blockSignals(true)
|
305
|
+
state_value_item.text = sprintf("0x%X", text.to_i)
|
306
|
+
@@table.blockSignals(false)
|
307
|
+
end
|
308
|
+
else
|
309
|
+
if text.is_hex?
|
310
|
+
@@table.blockSignals(true)
|
311
|
+
state_value_item.text = Integer(text).to_s
|
312
|
+
@@table.blockSignals(false)
|
288
313
|
end
|
289
314
|
end
|
290
315
|
end
|
291
316
|
end
|
292
317
|
end
|
293
318
|
|
319
|
+
# Opens a dialog which allows the user to select a file to read and send
|
320
|
+
# directly over the interface.
|
294
321
|
def file_send_raw
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
file_line.text = Qt::FileDialog::getOpenFileName(self, "Select File", @send_raw_dir, tr("Binary Files (*.bin);;All Files (*)"))
|
318
|
-
end
|
322
|
+
dialog = Qt::Dialog.new(self, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
|
323
|
+
dialog.setWindowTitle("Send Raw Data From File")
|
324
|
+
layout = Qt::GridLayout.new
|
325
|
+
interfaces = Qt::ComboBox.new
|
326
|
+
interfaces.addItems(get_interface_names())
|
327
|
+
interfaces.setMaxVisibleItems(30)
|
328
|
+
layout.addWidget(interfaces, 0, 1)
|
329
|
+
int_label = Qt::Label.new(tr("&Interface:"))
|
330
|
+
int_label.setBuddy(interfaces)
|
331
|
+
layout.addWidget(int_label, 0, 0)
|
332
|
+
|
333
|
+
file_line = Qt::LineEdit.new(@send_raw_dir)
|
334
|
+
file_line.setMinimumSize(250, 0)
|
335
|
+
file_label = Qt::Label.new(tr("&Filename:"))
|
336
|
+
file_label.setBuddy(file_line)
|
337
|
+
get_file = Qt::PushButton.new("Select")
|
338
|
+
file_layout = Qt::BoxLayout.new(Qt::Horizontal)
|
339
|
+
file_layout.addWidget(get_file)
|
340
|
+
file_layout.addWidget(file_line)
|
341
|
+
get_file.connect(SIGNAL('clicked()')) do
|
342
|
+
Cosmos.set_working_dir do
|
343
|
+
file_line.text = Qt::FileDialog::getOpenFileName(self, "Select File", @send_raw_dir, tr("Binary Files (*.bin);;All Files (*)"))
|
319
344
|
end
|
345
|
+
end
|
320
346
|
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
end
|
339
|
-
statusBar.showMessage(tr("File #{file_line.text} sent to interface #{interfaces.text}"))
|
347
|
+
layout.addWidget(file_label, 1, 0)
|
348
|
+
layout.addLayout(file_layout, 1, 1)
|
349
|
+
|
350
|
+
button_layout = Qt::BoxLayout.new(Qt::Horizontal)
|
351
|
+
ok = Qt::PushButton.new("Ok")
|
352
|
+
connect(ok, SIGNAL('clicked()'), dialog, SLOT('accept()'))
|
353
|
+
button_layout.addWidget(ok)
|
354
|
+
cancel = Qt::PushButton.new("Cancel")
|
355
|
+
connect(cancel, SIGNAL('clicked()'), dialog, SLOT('reject()'))
|
356
|
+
button_layout.addWidget(cancel)
|
357
|
+
layout.addLayout(button_layout, 2, 0, 1 ,2)
|
358
|
+
|
359
|
+
dialog.setLayout(layout)
|
360
|
+
if dialog.exec == Qt::Dialog::Accepted
|
361
|
+
@send_raw_dir = file_line.text
|
362
|
+
Cosmos.set_working_dir do
|
363
|
+
send_raw_file(interfaces.text, file_line.text)
|
340
364
|
end
|
341
|
-
dialog.dispose
|
342
|
-
rescue Exception => err
|
343
|
-
message = "Error sending raw file due to #{err}"
|
344
|
-
@message_log.write(Time.now.formatted + ' ' + message + "\n")
|
345
|
-
statusBar.showMessage(message)
|
346
|
-
rescue DRb::DRbConnError
|
347
|
-
message = "Error Connecting to Command and Telemetry Server"
|
348
|
-
@message_log.write(Time.now.formatted + ' ' + message + "\n")
|
349
|
-
statusBar.showMessage(message)
|
350
365
|
end
|
366
|
+
dialog.dispose
|
367
|
+
rescue Exception => err
|
368
|
+
message = "Error sending raw file due to #{err}"
|
369
|
+
@message_log.write(Time.now.formatted + ' ' + message + "\n")
|
370
|
+
statusBar.showMessage(message)
|
371
|
+
rescue DRb::DRbConnError
|
372
|
+
message = "Error Connecting to Command and Telemetry Server"
|
373
|
+
@message_log.write(Time.now.formatted + ' ' + message + "\n")
|
374
|
+
statusBar.showMessage(message)
|
351
375
|
end
|
352
376
|
|
377
|
+
# (see QtTool#closeEvent)
|
353
378
|
def closeEvent(event)
|
354
379
|
shutdown_cmd_tlm()
|
355
380
|
@message_log.stop
|
356
381
|
super(event)
|
357
382
|
end
|
358
383
|
|
359
|
-
|
384
|
+
# Updates the commands combobox and command parameters table
|
385
|
+
def target_changed(_)
|
360
386
|
update_commands()
|
361
387
|
update_cmd_params()
|
362
388
|
end
|
363
389
|
|
364
|
-
|
390
|
+
# Updates the command parameters table
|
391
|
+
def cmd_changed(_)
|
365
392
|
update_cmd_params()
|
366
393
|
end
|
367
394
|
|
395
|
+
# Sends the current command and parameters to the target
|
368
396
|
def send_button
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
if @
|
376
|
-
|
377
|
-
cmd_raw_no_range_check(target_name, packet_name, params)
|
378
|
-
else
|
379
|
-
cmd_raw(target_name, packet_name, params)
|
380
|
-
end
|
397
|
+
target_name = @target_select.text
|
398
|
+
packet_name = @cmd_select.text
|
399
|
+
if target_name and packet_name
|
400
|
+
output_string, params = view_as_script()
|
401
|
+
@message_log.write(Time.now.sys.formatted + ' ' + output_string + "\n")
|
402
|
+
if @cmd_raw.checked?
|
403
|
+
if @ignore_range.checked?
|
404
|
+
cmd_raw_no_range_check(target_name, packet_name, params)
|
381
405
|
else
|
382
|
-
|
383
|
-
cmd_no_range_check(target_name, packet_name, params)
|
384
|
-
else
|
385
|
-
cmd(target_name, packet_name, params)
|
386
|
-
end
|
406
|
+
cmd_raw(target_name, packet_name, params)
|
387
407
|
end
|
388
|
-
|
389
|
-
if
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
@input.moveCursor(Qt::TextCursor::End)
|
394
|
-
@input.ensureCursorVisible()
|
408
|
+
else
|
409
|
+
if @ignore_range.checked?
|
410
|
+
cmd_no_range_check(target_name, packet_name, params)
|
411
|
+
else
|
412
|
+
cmd(target_name, packet_name, params)
|
395
413
|
end
|
396
414
|
end
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
@message_log.write(Time.now.formatted + ' ' + message + "\n")
|
405
|
-
statusBar.showMessage(message)
|
406
|
-
Qt::MessageBox.critical(self, 'Error', message)
|
415
|
+
if statusBar.currentMessage != 'Hazardous command not sent'
|
416
|
+
@@send_count += 1
|
417
|
+
statusBar.showMessage("#{output_string} sent. (#{@@send_count})")
|
418
|
+
@input.append(output_string)
|
419
|
+
@input.moveCursor(Qt::TextCursor::End)
|
420
|
+
@input.ensureCursorVisible()
|
421
|
+
end
|
407
422
|
end
|
423
|
+
rescue DRb::DRbConnError
|
424
|
+
message = "Error Connecting to Command and Telemetry Server"
|
425
|
+
@message_log.write(Time.now.formatted + ' ' + message + "\n")
|
426
|
+
statusBar.showMessage(message)
|
427
|
+
Qt::MessageBox.critical(self, 'Error', message)
|
428
|
+
rescue Exception => err
|
429
|
+
message = "Error sending #{target_name} #{packet_name} due to #{err}"
|
430
|
+
@message_log.write(Time.now.formatted + ' ' + message + "\n")
|
431
|
+
statusBar.showMessage(message)
|
432
|
+
Qt::MessageBox.critical(self, 'Error', message)
|
408
433
|
end
|
409
434
|
|
435
|
+
# @return [String, Hash] Command as it would appear in a ScriptRunner script
|
410
436
|
def view_as_script
|
411
437
|
params = {}
|
412
438
|
|
413
439
|
@@param_widgets.each do |packet_item, value_item, state_value_item|
|
414
440
|
text = value_item.text
|
415
441
|
|
416
|
-
text = state_value_item.text if state_value_item
|
442
|
+
text = state_value_item.text if state_value_item && (text == MANUALLY or @cmd_raw.checked?)
|
417
443
|
quotes_removed = text.remove_quotes
|
418
444
|
if text == quotes_removed
|
419
|
-
|
445
|
+
if (packet_item.data_type == :STRING or packet_item.data_type == :BLOCK) and text.upcase.start_with?("0X")
|
446
|
+
params[packet_item.name] = text.hex_to_byte_string
|
447
|
+
else
|
448
|
+
params[packet_item.name] = text.convert_to_value
|
449
|
+
end
|
420
450
|
else
|
421
451
|
params[packet_item.name] = quotes_removed
|
422
452
|
end
|
423
|
-
raise "#{packet_item.name} is required." if quotes_removed == ''
|
453
|
+
raise "#{packet_item.name} is required." if quotes_removed == '' && packet_item.required
|
424
454
|
end
|
425
455
|
statusBar.clearMessage()
|
426
456
|
|
427
|
-
output_string = build_cmd_output_string(@target_select.text, @cmd_select.text, params, @cmd_raw.checked?)
|
457
|
+
output_string = System.commands.build_cmd_output_string(@target_select.text, @cmd_select.text, params, @cmd_raw.checked?)
|
428
458
|
if output_string =~ /[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F-\xFF]/
|
429
459
|
output_string = output_string.inspect.remove_quotes
|
430
460
|
end
|
@@ -442,6 +472,7 @@ module Cosmos
|
|
442
472
|
return output_string, params
|
443
473
|
end
|
444
474
|
|
475
|
+
# Updates the targets combobox
|
445
476
|
def update_targets
|
446
477
|
@target_select.clearItems()
|
447
478
|
target_names = System.commands.target_names
|
@@ -466,6 +497,7 @@ module Cosmos
|
|
466
497
|
end
|
467
498
|
end
|
468
499
|
|
500
|
+
# Updates the commands combobox based on the selected target
|
469
501
|
def update_commands
|
470
502
|
@cmd_select.clearItems()
|
471
503
|
target_name = @target_select.text
|
@@ -482,12 +514,13 @@ module Cosmos
|
|
482
514
|
end
|
483
515
|
end
|
484
516
|
|
517
|
+
# Updates the command parameters table based on the selected target and
|
518
|
+
# packet comboboxes
|
519
|
+
# @param ignored_toggle [Boolean] Whether to display the ignored
|
520
|
+
# parameters. Pass nil (the default) to keep the existing setting.
|
485
521
|
def update_cmd_params(ignored_toggle = nil)
|
486
522
|
old_params = {}
|
487
|
-
if ignored_toggle.nil?
|
488
|
-
ignored_toggle = false
|
489
|
-
else
|
490
|
-
ignored_toggle = true
|
523
|
+
if !ignored_toggle.nil?
|
491
524
|
# Save parameter values
|
492
525
|
@@param_widgets.each do |packet_item, value_item, state_value_item|
|
493
526
|
text = value_item.text
|
@@ -505,12 +538,12 @@ module Cosmos
|
|
505
538
|
target_name = @target_select.text
|
506
539
|
target = System.targets[target_name]
|
507
540
|
packet_name = @cmd_select.text
|
508
|
-
if target_name
|
541
|
+
if target_name && packet_name
|
509
542
|
packet = System.commands.packet(target_name, packet_name)
|
510
543
|
packet_items = packet.sorted_items
|
511
544
|
shown_packet_items = []
|
512
545
|
packet_items.each do |packet_item|
|
513
|
-
next if target
|
546
|
+
next if target && target.ignored_parameters.include?(packet_item.name) && !@show_ignored.checked?
|
514
547
|
shown_packet_items << packet_item
|
515
548
|
end
|
516
549
|
|
@@ -527,7 +560,7 @@ module Cosmos
|
|
527
560
|
|
528
561
|
row = 0
|
529
562
|
shown_packet_items.each do |packet_item|
|
530
|
-
next if target
|
563
|
+
next if target && target.ignored_parameters.include?(packet_item.name) && !@show_ignored.checked?
|
531
564
|
value_item = nil
|
532
565
|
state_value_item = nil
|
533
566
|
|
@@ -540,10 +573,10 @@ module Cosmos
|
|
540
573
|
@@table.setHorizontalHeaderLabels(['Name', ' Value or State ', ' ', 'Units', 'Description'])
|
541
574
|
@@table.horizontalHeader.setStretchLastSection(true)
|
542
575
|
@@table.verticalHeader.setVisible(false)
|
543
|
-
@@table.setItemDelegate(
|
576
|
+
@@table.setItemDelegate(CmdParamTableItemDelegate.new(@@table, @@param_widgets))
|
544
577
|
@@table.setContextMenuPolicy(Qt::CustomContextMenu)
|
545
578
|
@@table.verticalHeader.setResizeMode(Qt::HeaderView::ResizeToContents)
|
546
|
-
@@table.setEditTriggers(Qt::AbstractItemView::
|
579
|
+
@@table.setEditTriggers(Qt::AbstractItemView::DoubleClicked | Qt::AbstractItemView::SelectedClicked | Qt::AbstractItemView::AnyKeyPressed)
|
547
580
|
@@table.setSelectionMode(Qt::AbstractItemView::NoSelection)
|
548
581
|
connect(@@table, SIGNAL('customContextMenuRequested(const QPoint&)'), self, SLOT('context_menu(const QPoint&)'))
|
549
582
|
connect(@@table, SIGNAL('itemClicked(QTableWidgetItem*)'), self, SLOT('click_callback(QTableWidgetItem*)'))
|
@@ -577,7 +610,12 @@ module Cosmos
|
|
577
610
|
if @states_in_hex.checked? && packet_item.default.kind_of?(Integer)
|
578
611
|
state_value_item = Qt::TableWidgetItem.new(sprintf("0x%X", packet_item.default))
|
579
612
|
else
|
580
|
-
|
613
|
+
default_str = packet_item.default.to_s
|
614
|
+
if default_str.is_printable?
|
615
|
+
state_value_item = Qt::TableWidgetItem.new(default_str)
|
616
|
+
else
|
617
|
+
state_value_item = Qt::TableWidgetItem.new("0x" + default_str.simple_formatted)
|
618
|
+
end
|
581
619
|
end
|
582
620
|
end
|
583
621
|
state_value_item.setTextAlignment(Qt::AlignRight | Qt::AlignVCenter)
|
@@ -586,7 +624,7 @@ module Cosmos
|
|
586
624
|
|
587
625
|
# If the parameter is required set the combobox to MANUAL and
|
588
626
|
# clear the value field so they have to choose something
|
589
|
-
if packet_item.required
|
627
|
+
if packet_item.required && !old_params[packet_item.name]
|
590
628
|
value_item.setText(MANUALLY)
|
591
629
|
state_value_item.setText('')
|
592
630
|
end
|
@@ -596,19 +634,23 @@ module Cosmos
|
|
596
634
|
value_item = Qt::TableWidgetItem.new(old_params[packet_item.name])
|
597
635
|
else
|
598
636
|
if packet_item.required
|
599
|
-
|
637
|
+
value_text = ''
|
600
638
|
else
|
601
639
|
if packet_item.format_string
|
602
640
|
begin
|
603
|
-
|
641
|
+
value_text = sprintf(packet_item.format_string, packet_item.default)
|
604
642
|
rescue
|
605
643
|
# Oh well - Don't use the format string
|
606
|
-
|
644
|
+
value_text = packet_item.default.to_s
|
607
645
|
end
|
608
646
|
else
|
609
|
-
|
647
|
+
value_text = packet_item.default.to_s
|
648
|
+
end
|
649
|
+
if !value_text.is_printable?
|
650
|
+
value_text = "0x" + value_text.simple_formatted
|
610
651
|
end
|
611
652
|
end
|
653
|
+
value_item = Qt::TableWidgetItem.new(value_text)
|
612
654
|
end
|
613
655
|
value_item.setTextAlignment(Qt::AlignRight | Qt::AlignVCenter)
|
614
656
|
value_item.setFlags(Qt::NoItemFlags | Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable)
|
@@ -656,16 +698,19 @@ module Cosmos
|
|
656
698
|
@@table.resizeColumnsToContents()
|
657
699
|
@@table.resizeRowsToContents()
|
658
700
|
end
|
659
|
-
end # if target_name
|
701
|
+
end # if target_name && packet_name
|
660
702
|
end
|
661
703
|
|
704
|
+
# If the user right clicks over a table item, this method displays a context
|
705
|
+
# menu with various options.
|
706
|
+
# @param point [Qt::Point] Point to display the context menu
|
662
707
|
def context_menu(point)
|
663
708
|
target_name = @target_select.text
|
664
709
|
packet_name = @cmd_select.text
|
665
710
|
item = @@table.itemAt(point)
|
666
711
|
if item
|
667
712
|
item_name = @@table.item(item.row, 0).text[0..-2] # Remove :
|
668
|
-
if target_name.length > 0
|
713
|
+
if target_name.length > 0 && packet_name.length > 0 && item_name.length > 0
|
669
714
|
menu = Qt::Menu.new()
|
670
715
|
|
671
716
|
details_action = Qt::Action.new(tr("Details #{target_name} #{packet_name} #{item_name}"), self)
|
@@ -679,7 +724,7 @@ module Cosmos
|
|
679
724
|
file_chooser_action.statusTip = tr("Select a file and place its name into this parameter")
|
680
725
|
file_chooser_action.connect(SIGNAL('triggered()')) do
|
681
726
|
filename = Qt::FileDialog::getOpenFileName(self, "Insert Filename:", @file_dir, "All Files (*)")
|
682
|
-
if filename
|
727
|
+
if filename && !filename.empty?
|
683
728
|
@file_dir = File.dirname(filename)
|
684
729
|
_, value_item, state_value_item = @@param_widgets[item.row]
|
685
730
|
if state_value_item
|
@@ -697,11 +742,13 @@ module Cosmos
|
|
697
742
|
end
|
698
743
|
end
|
699
744
|
|
745
|
+
# @param item [Qt::TableWidgetItem] Item which was left clicked
|
700
746
|
def click_callback(item)
|
701
747
|
@@table.editItem(item) if (item.flags & Qt::ItemIsEditable) != 0
|
702
748
|
end
|
703
749
|
|
704
|
-
|
750
|
+
# (see QtTool.run)
|
751
|
+
def self.run(option_parser = nil, options = nil)
|
705
752
|
Cosmos.catch_fatal_exception do
|
706
753
|
unless option_parser && options
|
707
754
|
option_parser, options = create_default_options()
|
@@ -722,7 +769,5 @@ module Cosmos
|
|
722
769
|
super(option_parser, options)
|
723
770
|
end
|
724
771
|
end
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
end # module Cosmos
|
772
|
+
end
|
773
|
+
end
|