cosmos 3.9.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -45,7 +45,7 @@ module Cosmos
|
|
|
45
45
|
@tlm_log_system = nil
|
|
46
46
|
@subscription_thread = nil
|
|
47
47
|
@subscription_id = nil
|
|
48
|
-
@packet_log_reader = System.default_packet_log_reader.new
|
|
48
|
+
@packet_log_reader = System.default_packet_log_reader.new(*System.default_packet_log_reader_params)
|
|
49
49
|
@time_start = nil
|
|
50
50
|
@time_end = nil
|
|
51
51
|
@log_filenames = []
|
|
@@ -57,8 +57,12 @@ module Cosmos
|
|
|
57
57
|
@components = []
|
|
58
58
|
@packets = []
|
|
59
59
|
@packet_to_components_mapping = {}
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
|
|
61
|
+
begin
|
|
62
|
+
process_config(options.config_file)
|
|
63
|
+
rescue => error
|
|
64
|
+
ExceptionDialog.new(self, error, "Error parsing #{options.config_file}")
|
|
65
|
+
end
|
|
62
66
|
|
|
63
67
|
# Load System Definition and Event Data
|
|
64
68
|
Splash.execute(self) do |splash|
|
|
@@ -253,7 +257,7 @@ module Cosmos
|
|
|
253
257
|
else
|
|
254
258
|
Qt.execute_in_main_thread(true) { @realtime_button_bar.state = 'Running' }
|
|
255
259
|
end
|
|
256
|
-
Qt.execute_in_main_thread(true) { statusBar.showMessage("Connected to Command and Telemetry Server: #{Time.now.formatted}") }
|
|
260
|
+
Qt.execute_in_main_thread(true) { statusBar.showMessage("Connected to Command and Telemetry Server: #{Time.now.sys.formatted}") }
|
|
257
261
|
rescue DRb::DRbConnError
|
|
258
262
|
break if @cancel_thread
|
|
259
263
|
Qt.execute_in_main_thread(true) do
|
|
@@ -294,7 +298,7 @@ module Cosmos
|
|
|
294
298
|
rescue RuntimeError => error
|
|
295
299
|
raise error unless error.message =~ /queue/
|
|
296
300
|
break if @cancel_thread
|
|
297
|
-
Qt.execute_in_main_thread(true) { statusBar.showMessage(tr("Connection Dropped by Command and Telemetry Server: #{Time.now.formatted}")) }
|
|
301
|
+
Qt.execute_in_main_thread(true) { statusBar.showMessage(tr("Connection Dropped by Command and Telemetry Server: #{Time.now.sys.formatted}")) }
|
|
298
302
|
break # Let outer loop resubscribe
|
|
299
303
|
end
|
|
300
304
|
end
|
|
@@ -389,7 +393,10 @@ module Cosmos
|
|
|
389
393
|
|
|
390
394
|
def handle_open_log_file
|
|
391
395
|
# Prompt user for filename
|
|
392
|
-
packet_log_dialog = PacketLogDialog.new(
|
|
396
|
+
packet_log_dialog = PacketLogDialog.new(
|
|
397
|
+
self, 'Open Log File(s):', @log_file_directory, @packet_log_reader,
|
|
398
|
+
[], nil, false, true, true, Cosmos::TLM_FILE_PATTERN
|
|
399
|
+
)
|
|
393
400
|
begin
|
|
394
401
|
packet_log_dialog.time_start = @time_start
|
|
395
402
|
packet_log_dialog.time_end = @time_end
|
|
@@ -402,11 +409,8 @@ module Cosmos
|
|
|
402
409
|
@log_file_directory = File.dirname(@log_filenames[0])
|
|
403
410
|
@log_file_directory << '/' unless @log_file_directory[-1..-1] == '\\'
|
|
404
411
|
|
|
405
|
-
# Stop realtime collection
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
# Reset components
|
|
409
|
-
handle_reset()
|
|
412
|
+
handle_stop() # Stop realtime collection
|
|
413
|
+
handle_reset() # Reset since we're processing a new log file
|
|
410
414
|
|
|
411
415
|
@cancel_progress = false
|
|
412
416
|
ProgressDialog.execute(self, 'Processing Log File', 500, 200, @log_filenames.length > 1, true, true, true, true) do |dialog|
|
|
@@ -475,35 +479,26 @@ module Cosmos
|
|
|
475
479
|
end
|
|
476
480
|
|
|
477
481
|
def closeEvent(event)
|
|
478
|
-
# Stop GUI update timeout
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
# Stop Processing Packets
|
|
482
|
-
handle_stop()
|
|
482
|
+
@pause = true # Stop GUI update timeout
|
|
483
|
+
handle_stop() # Stop realtime processing
|
|
483
484
|
|
|
484
485
|
# Shutdown each component
|
|
485
486
|
@component_mutex.synchronize do
|
|
486
487
|
@components.each {|component| component.shutdown}
|
|
487
488
|
end
|
|
488
|
-
|
|
489
|
-
# Give things time to complete
|
|
490
|
-
sleep(0.1)
|
|
491
|
-
|
|
492
|
-
# Standard COSMOS Shutdown
|
|
489
|
+
sleep(0.1) # Give things time to complete
|
|
493
490
|
shutdown_cmd_tlm()
|
|
494
|
-
|
|
495
|
-
# Accept closure
|
|
496
491
|
super(event)
|
|
497
492
|
end
|
|
498
493
|
|
|
499
|
-
def process_config
|
|
494
|
+
def process_config(filename)
|
|
500
495
|
# ensure the file exists
|
|
501
|
-
unless test ?f,
|
|
502
|
-
raise "Configuration File Does not Exist: #{
|
|
496
|
+
unless test ?f, filename
|
|
497
|
+
raise "Configuration File Does not Exist: #{filename}"
|
|
503
498
|
end
|
|
504
499
|
|
|
505
500
|
parser = ConfigParser.new
|
|
506
|
-
parser.parse_file(
|
|
501
|
+
parser.parse_file(filename) do |keyword, params|
|
|
507
502
|
case keyword
|
|
508
503
|
|
|
509
504
|
when 'AUTO_START'
|
|
@@ -511,6 +506,28 @@ module Cosmos
|
|
|
511
506
|
parser.verify_num_parameters(0, 0, usage)
|
|
512
507
|
@auto_start = true
|
|
513
508
|
|
|
509
|
+
when 'AUTO_TARGET_COMPONENTS'
|
|
510
|
+
usage = "#{keyword}"
|
|
511
|
+
parser.verify_num_parameters(0, 0, usage)
|
|
512
|
+
System.targets.each do |target_name, target|
|
|
513
|
+
config = File.join(target.dir, 'tools', 'data_viewer', 'data_viewer.txt')
|
|
514
|
+
process_config(config) if File.exist?(config)
|
|
515
|
+
end
|
|
516
|
+
|
|
517
|
+
when 'TARGET_COMPONENT'
|
|
518
|
+
usage = "#{keyword} <Target Name> <Config File>"
|
|
519
|
+
parser.verify_num_parameters(1, 2, usage)
|
|
520
|
+
target_dir = File.join(Cosmos::USERPATH, 'config', 'targets', params[0].upcase)
|
|
521
|
+
if File.exist? target_dir
|
|
522
|
+
if params[1]
|
|
523
|
+
process_config(File.join(target_dir, 'tools', 'data_viewer', params[1]))
|
|
524
|
+
else
|
|
525
|
+
process_config(File.join(target_dir, 'tools', 'data_viewer', 'data_viewer.txt'))
|
|
526
|
+
end
|
|
527
|
+
else
|
|
528
|
+
raise parser.error("Unknown target #{params[0].upcase}", usage)
|
|
529
|
+
end
|
|
530
|
+
|
|
514
531
|
when 'COMPONENT'
|
|
515
532
|
usage = "#{keyword} <tab name> <component class filename> <component specific options...>"
|
|
516
533
|
parser.verify_num_parameters(2, nil, usage)
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
require 'cosmos'
|
|
12
12
|
|
|
13
13
|
module Cosmos
|
|
14
|
-
|
|
15
14
|
class DataViewerComponent < Qt::Widget
|
|
16
15
|
attr_reader :tab_name
|
|
17
16
|
attr_reader :packets
|
|
@@ -28,7 +27,6 @@ module Cosmos
|
|
|
28
27
|
@processed_queue = Queue.new
|
|
29
28
|
@log_file_directory = System.paths['LOGS']
|
|
30
29
|
@max_block_count = 1000
|
|
31
|
-
@timer = nil
|
|
32
30
|
end
|
|
33
31
|
|
|
34
32
|
# Adds a packet to the list of packets this components processes
|
|
@@ -68,11 +66,6 @@ module Cosmos
|
|
|
68
66
|
end
|
|
69
67
|
end
|
|
70
68
|
@top_layout.addWidget(@button)
|
|
71
|
-
|
|
72
|
-
@timer = Qt::Timer.new(self)
|
|
73
|
-
@timer.connect(SIGNAL('timeout()')) { scroll_to_bottom() }
|
|
74
|
-
@timer.setSingleShot(true)
|
|
75
|
-
|
|
76
69
|
setLayout(@top_layout)
|
|
77
70
|
end
|
|
78
71
|
|
|
@@ -80,11 +73,8 @@ module Cosmos
|
|
|
80
73
|
def update_gui
|
|
81
74
|
begin
|
|
82
75
|
loop do
|
|
83
|
-
# Get new processed text
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
# Add text to text widget
|
|
87
|
-
@text.appendPlainText(processed_text)
|
|
76
|
+
# Get new processed text and append to text
|
|
77
|
+
@text.appendPlainText(@processed_queue.pop(true))
|
|
88
78
|
end
|
|
89
79
|
rescue ThreadError
|
|
90
80
|
# Nothing to do
|
|
@@ -96,17 +86,14 @@ module Cosmos
|
|
|
96
86
|
@text.setPlainText("")
|
|
97
87
|
end
|
|
98
88
|
|
|
89
|
+
# QT method called when this widget is displayed
|
|
99
90
|
def showEvent(event)
|
|
100
|
-
# When the tab is shown we want to ensure the
|
|
101
|
-
#
|
|
91
|
+
# When the tab is shown we want to ensure the cursor is visible
|
|
92
|
+
# to allow the PlainTextArea to automatically hold the scroll
|
|
102
93
|
# at the bottom of the display while appending things.
|
|
103
94
|
# If this is not done, switching tabs will cause the scroll bar
|
|
104
95
|
# to "stick" and not stay at the bottom with the newest text.
|
|
105
|
-
@
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
def scroll_to_bottom
|
|
109
|
-
@text.verticalScrollBar.value = @text.verticalScrollBar.maximum
|
|
96
|
+
@text.ensureCursorVisible()
|
|
110
97
|
end
|
|
111
98
|
|
|
112
99
|
# Processes the given packet. No gui interaction should be done in this
|
|
@@ -127,8 +114,7 @@ module Cosmos
|
|
|
127
114
|
|
|
128
115
|
# Shutdown the Data Viewer Component. Called when program is closed.
|
|
129
116
|
def shutdown
|
|
130
|
-
# Do nothing by default
|
|
117
|
+
# Do nothing by default, this should be overridden by subclasses
|
|
131
118
|
end
|
|
132
119
|
end
|
|
133
|
-
|
|
134
|
-
end # module Cosmos
|
|
120
|
+
end
|
|
@@ -62,7 +62,11 @@ module Cosmos
|
|
|
62
62
|
config.items.each do |item_type, text, shell_command_or_settings, capture_io, icon_filename, variable_parameters|
|
|
63
63
|
case item_type
|
|
64
64
|
when :TOOL, :MULTITOOL
|
|
65
|
-
|
|
65
|
+
if @options.mini
|
|
66
|
+
layout = Qt::HBoxLayout.new
|
|
67
|
+
else
|
|
68
|
+
layout = Qt::VBoxLayout.new
|
|
69
|
+
end
|
|
66
70
|
if icon_filename
|
|
67
71
|
icon = Cosmos.get_icon(icon_filename)
|
|
68
72
|
else
|
|
@@ -70,7 +74,9 @@ module Cosmos
|
|
|
70
74
|
end
|
|
71
75
|
button = Qt::PushButton.new('')
|
|
72
76
|
button.setIcon(icon)
|
|
73
|
-
|
|
77
|
+
size = @options.mini ? 20 : 64
|
|
78
|
+
button.setIconSize(Qt::Size.new(size, size))
|
|
79
|
+
|
|
74
80
|
if item_type == :TOOL
|
|
75
81
|
connect(button,
|
|
76
82
|
SIGNAL('clicked()'),
|
|
@@ -83,13 +89,15 @@ module Cosmos
|
|
|
83
89
|
SLOT('button_clicked()'))
|
|
84
90
|
end
|
|
85
91
|
if Kernel.is_mac?
|
|
86
|
-
|
|
92
|
+
size = @options.mini ? 40 : 84
|
|
93
|
+
button.setFixedSize(size, size)
|
|
87
94
|
else
|
|
88
95
|
stylesheet = "padding:4px; text-align:center; " \
|
|
89
96
|
"font-family:#{config.tool_font_settings[0]}; " \
|
|
90
97
|
"font-size:#{config.tool_font_settings[1]}px"
|
|
91
98
|
button.setStyleSheet(stylesheet)
|
|
92
|
-
|
|
99
|
+
size = @options.mini ? 30 : 70
|
|
100
|
+
button.setFixedSize(size, size)
|
|
93
101
|
end
|
|
94
102
|
label = Qt::Label.new(text)
|
|
95
103
|
stylesheet = "text-align:center; " \
|
|
@@ -97,15 +105,19 @@ module Cosmos
|
|
|
97
105
|
"font-size:#{config.tool_font_settings[1]}px"
|
|
98
106
|
label.setStyleSheet(stylesheet)
|
|
99
107
|
label.setObjectName("ButtonLabel")
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
unless @options.mini
|
|
109
|
+
label.wordWrap = true
|
|
110
|
+
label.setFixedWidth(70)
|
|
111
|
+
label.setSizePolicy(Qt::SizePolicy::Fixed, Qt::SizePolicy::Fixed)
|
|
112
|
+
label.setMinimumSize(label.sizeHint)
|
|
113
|
+
label.setAlignment(Qt::AlignHCenter)
|
|
114
|
+
end
|
|
105
115
|
layout.addWidget(button)
|
|
106
116
|
layout.addWidget(label)
|
|
107
|
-
|
|
108
|
-
|
|
117
|
+
unless @options.mini
|
|
118
|
+
layout.setAlignment(button, Qt::AlignHCenter)
|
|
119
|
+
layout.setAlignment(label, Qt::AlignHCenter)
|
|
120
|
+
end
|
|
109
121
|
widgets << layout
|
|
110
122
|
|
|
111
123
|
when :DIVIDER
|
|
@@ -136,7 +148,7 @@ module Cosmos
|
|
|
136
148
|
v_layout = Qt::VBoxLayout.new
|
|
137
149
|
central_widget.layout = v_layout
|
|
138
150
|
widgets.each do |widget|
|
|
139
|
-
if Qt::
|
|
151
|
+
if widget.is_a?(Qt::BoxLayout)
|
|
140
152
|
unless h_layout
|
|
141
153
|
h_layout = Qt::HBoxLayout.new
|
|
142
154
|
v_layout.addLayout(h_layout)
|
|
@@ -170,6 +182,11 @@ module Cosmos
|
|
|
170
182
|
option_parser, options = create_default_options()
|
|
171
183
|
options.title = 'Launcher'
|
|
172
184
|
end
|
|
185
|
+
option_parser.separator "Launcher Specific Options:"
|
|
186
|
+
option_parser.on("-m", "--mini", "Create mini launcher") do |arg|
|
|
187
|
+
options.mini = true
|
|
188
|
+
end
|
|
189
|
+
|
|
173
190
|
super(option_parser, options)
|
|
174
191
|
end
|
|
175
192
|
end
|
|
@@ -58,7 +58,7 @@ module Cosmos
|
|
|
58
58
|
multitool = nil
|
|
59
59
|
|
|
60
60
|
# Loop over each line of the configuration file
|
|
61
|
-
parser = ConfigParser.new
|
|
61
|
+
parser = ConfigParser.new("http://cosmosrb.com/docs/tools/#launcher-configuration")
|
|
62
62
|
parser.parse_file(filename) do |keyword, params|
|
|
63
63
|
# Handle each keyword
|
|
64
64
|
case keyword
|
|
@@ -33,6 +33,17 @@ class Array
|
|
|
33
33
|
return index
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
def find_packet_items(item)
|
|
37
|
+
packet_items = []
|
|
38
|
+
self.each do |target_name, packet_name, item_name|
|
|
39
|
+
if ((target_name == item[0]) &&
|
|
40
|
+
(packet_name == item[1]))
|
|
41
|
+
packet_items << [target_name, packet_name, item_name]
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
return packet_items
|
|
45
|
+
end
|
|
46
|
+
|
|
36
47
|
private
|
|
37
48
|
def find_item(item)
|
|
38
49
|
found = false
|
|
@@ -56,6 +67,8 @@ module Cosmos
|
|
|
56
67
|
class LimitsItems
|
|
57
68
|
# @return [Array<String,String,String>] Target name, packet name, item name
|
|
58
69
|
attr_reader :ignored
|
|
70
|
+
# @return [Array<String,String>] Target name, packet name
|
|
71
|
+
attr_reader :ignored_stale
|
|
59
72
|
# @return [Boolean] Whether the limits items have been fetched from the server
|
|
60
73
|
attr_reader :initialized
|
|
61
74
|
# @return [Boolean] Whether to display an item with a colorblind option
|
|
@@ -70,13 +83,17 @@ module Cosmos
|
|
|
70
83
|
# @param new_item_callback [Proc] Method to create a new item in the GUI
|
|
71
84
|
# @param update_item_callback [Proc] Method to update an item in the GUI
|
|
72
85
|
# @param clear_items_callback [Proc] Method to clear all items in the GUI
|
|
73
|
-
|
|
86
|
+
# @param remove_item_callback [Proc] Method to remove an item from the GUI
|
|
87
|
+
def initialize(new_item_callback, update_item_callback, clear_items_callback, remove_item_callback)
|
|
74
88
|
@new_item_callback = new_item_callback
|
|
75
89
|
@update_item_callback = update_item_callback
|
|
76
90
|
@clear_items_callback = clear_items_callback
|
|
91
|
+
@remove_item_callback = remove_item_callback
|
|
77
92
|
@ignored = []
|
|
93
|
+
@ignored_stale = []
|
|
78
94
|
@items = {}
|
|
79
95
|
@out_of_limits = []
|
|
96
|
+
@stale = []
|
|
80
97
|
@queue_id = nil
|
|
81
98
|
@limits_set = :DEFAULT
|
|
82
99
|
@colorblind = false
|
|
@@ -96,31 +113,62 @@ module Cosmos
|
|
|
96
113
|
# @param item [Array<String,String,String>] Target name, packet name,
|
|
97
114
|
# item name to ignore
|
|
98
115
|
def ignore(item)
|
|
99
|
-
|
|
100
|
-
|
|
116
|
+
if item[2]
|
|
117
|
+
items_to_delete = [item]
|
|
118
|
+
else
|
|
119
|
+
items_to_delete = @out_of_limits.find_packet_items(item)
|
|
120
|
+
end
|
|
121
|
+
items_to_delete.each do |item_to_delete|
|
|
122
|
+
index = @out_of_limits.delete_item(item_to_delete)
|
|
123
|
+
widget = @items.delete("#{item_to_delete[0]} #{item_to_delete[1]} #{item_to_delete[2]}") if index
|
|
124
|
+
@remove_item_callback.call(widget) if widget
|
|
125
|
+
end
|
|
101
126
|
unless @ignored.includes_item?(item)
|
|
102
127
|
@ignored << item
|
|
103
128
|
end
|
|
104
129
|
end
|
|
105
130
|
|
|
131
|
+
# Ignore a stale packet. Don't display it in the GUI and don't have it
|
|
132
|
+
# count towards the overall limit state.
|
|
133
|
+
#
|
|
134
|
+
# @param item [Array<String,String>] Target name, packet name
|
|
135
|
+
def ignore_stale(item)
|
|
136
|
+
index = @stale.delete_item(item)
|
|
137
|
+
widget = @items.delete("#{item[0]} #{item[1]}") if index
|
|
138
|
+
@remove_item_callback.call(widget) if widget
|
|
139
|
+
unless @ignored_stale.includes_item?(item)
|
|
140
|
+
@ignored_stale << item
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
106
144
|
# Remove an item from the ignored list to have it be displayed and
|
|
107
145
|
# count towards the overall limits state.
|
|
108
146
|
#
|
|
109
|
-
# @param item [Array<String,String,String> Target name, packet name,
|
|
147
|
+
# @param item [Array<String,String,String>] Target name, packet name,
|
|
110
148
|
# item name to remove from ignored list
|
|
111
149
|
def remove_ignored(item)
|
|
112
150
|
index = @ignored.delete_item(item)
|
|
151
|
+
if index
|
|
152
|
+
# If we deleted an item get all the current out of limit items
|
|
153
|
+
get_out_of_limits().each do |target, packet, item, state|
|
|
154
|
+
limits_change(target, packet, item, state)
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
rescue DRb::DRbConnError
|
|
158
|
+
# Do nothing
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Remove an item from the ignored_stale list to have it be displayed and
|
|
162
|
+
# count towards the overall limits state.
|
|
163
|
+
#
|
|
164
|
+
# @param item [Array<String,String>] Target name, packet name to remove
|
|
165
|
+
# from ignored list
|
|
166
|
+
def remove_ignored_stale(item)
|
|
167
|
+
index = @ignored_stale.delete_item(item)
|
|
113
168
|
if index
|
|
114
169
|
# If we deleted a packet we need to recalculate the stale packets
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
stale_packet(target, packet)
|
|
118
|
-
end
|
|
119
|
-
# We deleted an item so get all the current out of limit items
|
|
120
|
-
else
|
|
121
|
-
get_out_of_limits().each do |target, packet, item, state|
|
|
122
|
-
limits_change(target, packet, item, state)
|
|
123
|
-
end
|
|
170
|
+
get_stale(true).each do |target, packet|
|
|
171
|
+
stale_packet(target, packet)
|
|
124
172
|
end
|
|
125
173
|
end
|
|
126
174
|
rescue DRb::DRbConnError
|
|
@@ -129,13 +177,15 @@ module Cosmos
|
|
|
129
177
|
|
|
130
178
|
# @return [Boolean] Whether there are any items being ignored
|
|
131
179
|
def ignored_items?
|
|
132
|
-
!@ignored.empty?
|
|
180
|
+
!@ignored.empty? or !@ignored_stale.empty?
|
|
133
181
|
end
|
|
134
182
|
|
|
135
183
|
# @return [Symbol] The overall limits state. Returns :STALE if there
|
|
136
184
|
# is no connection to the server.
|
|
137
185
|
def overall_state
|
|
138
|
-
get_overall_limits_state(@ignored)
|
|
186
|
+
state = get_overall_limits_state(@ignored)
|
|
187
|
+
state = get_overall_limits_state(@ignored + @ignored_stale) if state == :STALE
|
|
188
|
+
return state
|
|
139
189
|
rescue DRb::DRbConnError
|
|
140
190
|
:STALE
|
|
141
191
|
end
|
|
@@ -189,18 +239,20 @@ module Cosmos
|
|
|
189
239
|
when :STALE_PACKET
|
|
190
240
|
# A packet has gone stale: target, packet
|
|
191
241
|
result = stale_packet(data[0], data[1])
|
|
242
|
+
|
|
243
|
+
when :STALE_PACKET_RCVD
|
|
244
|
+
# A packet that was previously stale has been received: target, packet
|
|
245
|
+
result = refresh_stale_packet(data[0], data[1])
|
|
192
246
|
end
|
|
193
247
|
result
|
|
194
248
|
end
|
|
195
249
|
|
|
196
250
|
# Update the values for all the out of limits items being tracked.
|
|
197
251
|
def update_values
|
|
198
|
-
# Reject any out of limits packets as they don't have values
|
|
199
|
-
items = @out_of_limits.reject {|item| item[2].nil? }
|
|
200
252
|
|
|
201
|
-
values, limits_states, limits_settings, limits_set = get_tlm_values(
|
|
253
|
+
values, limits_states, limits_settings, limits_set = get_tlm_values(@out_of_limits, :WITH_UNITS)
|
|
202
254
|
index = 0
|
|
203
|
-
|
|
255
|
+
@out_of_limits.each do |target_name, packet_name, item_name|
|
|
204
256
|
begin
|
|
205
257
|
# Update the limits settings each time we update values
|
|
206
258
|
# to stay in sync with the Server. Responding to :LIMITS_SETTINGS
|
|
@@ -231,8 +283,9 @@ module Cosmos
|
|
|
231
283
|
return "Configuration file #{filename} not found!" unless File.exist?(filename)
|
|
232
284
|
|
|
233
285
|
@ignored = []
|
|
286
|
+
@ignored_stale = []
|
|
234
287
|
begin
|
|
235
|
-
parser = ConfigParser.new
|
|
288
|
+
parser = ConfigParser.new("http://cosmosrb.com/docs/tools/#limits-monitor-configuration")
|
|
236
289
|
parser.parse_file(filename) do |keyword, params|
|
|
237
290
|
case keyword
|
|
238
291
|
# TODO: Eventually we can deprecate 'IGNORE' in favor
|
|
@@ -241,6 +294,8 @@ module Cosmos
|
|
|
241
294
|
@ignored << ([params[0], params[1], params[2]])
|
|
242
295
|
when 'IGNORE_PACKET'
|
|
243
296
|
@ignored << ([params[0], params[1], nil])
|
|
297
|
+
when 'IGNORE_STALE'
|
|
298
|
+
@ignored_stale << ([params[0], params[1], nil])
|
|
244
299
|
when 'COLOR_BLIND'
|
|
245
300
|
@colorblind = true
|
|
246
301
|
when 'IGNORE_OPERATIONAL_LIMITS'
|
|
@@ -277,6 +332,9 @@ module Cosmos
|
|
|
277
332
|
file.puts("IGNORE_PACKET #{target} #{pkt_name}")
|
|
278
333
|
end
|
|
279
334
|
end
|
|
335
|
+
@ignored_stale.each do |target, pkt_name|
|
|
336
|
+
file.puts("IGNORE_STALE #{target} #{pkt_name}")
|
|
337
|
+
end
|
|
280
338
|
end
|
|
281
339
|
result = "#{filename} saved"
|
|
282
340
|
rescue => e
|
|
@@ -295,6 +353,7 @@ module Cosmos
|
|
|
295
353
|
def reset
|
|
296
354
|
@items = {}
|
|
297
355
|
@out_of_limits = []
|
|
356
|
+
@stale = []
|
|
298
357
|
@limits_set = get_limits_set()
|
|
299
358
|
unsubscribe_limits_events(@queue_id) if @queue_id
|
|
300
359
|
@queue_id = subscribe_limits_events(100000)
|
|
@@ -343,10 +402,22 @@ module Cosmos
|
|
|
343
402
|
|
|
344
403
|
# Record the stale packet and generate a log message
|
|
345
404
|
def stale_packet(target_name, packet_name)
|
|
346
|
-
|
|
405
|
+
item = [target_name, packet_name, nil]
|
|
406
|
+
unless (@stale.includes_item?(item) || @ignored_stale.includes_item?(item) || UNKNOWN_ARRAY.includes_item?(item))
|
|
407
|
+
@stale << item
|
|
408
|
+
@items["#{item[0]} #{item[1]}"] = @new_item_callback.call(*item)
|
|
409
|
+
end
|
|
347
410
|
return ["INFO: Packet #{target_name} #{packet_name} is STALE\n", :BLACK]
|
|
348
411
|
end
|
|
349
412
|
|
|
413
|
+
def refresh_stale_packet(target_name, packet_name)
|
|
414
|
+
item = [target_name, packet_name, nil]
|
|
415
|
+
index = @stale.delete_item(item)
|
|
416
|
+
widget = @items.delete("#{target_name} #{packet_name}") if index
|
|
417
|
+
@remove_item_callback.call(widget) if widget
|
|
418
|
+
return ["INFO: Packet #{target_name} #{packet_name} is no longer STALE\n", :BLACK]
|
|
419
|
+
end
|
|
420
|
+
|
|
350
421
|
# Record an out of limits item and call the new item callback.
|
|
351
422
|
# Existing out of limits and ignored items are not recorded.
|
|
352
423
|
def out_of_limit(item)
|
|
@@ -369,6 +440,8 @@ module Cosmos
|
|
|
369
440
|
class LimitsWidget < Qt::Widget
|
|
370
441
|
# @return [Widget] The widget which displays the value
|
|
371
442
|
attr_accessor :value
|
|
443
|
+
# @return [Symbol] The type that the widget represents :ITEM or :STALE
|
|
444
|
+
attr_accessor :type
|
|
372
445
|
|
|
373
446
|
# @param parent [Qt::Widget] Parent widget (the LimitsMonitor tool)
|
|
374
447
|
# @param target_name [String] Target name
|
|
@@ -382,25 +455,37 @@ module Cosmos
|
|
|
382
455
|
setLayout(@layout)
|
|
383
456
|
|
|
384
457
|
item = [target_name, packet_name, item_name]
|
|
458
|
+
packet = [target_name, packet_name, nil]
|
|
459
|
+
|
|
385
460
|
if item_name
|
|
461
|
+
@type = :ITEM
|
|
462
|
+
@packet = LabelWidget.new(@layout, "#{target_name} #{packet_name} ")
|
|
386
463
|
@value = LabelvaluelimitsbarWidget.new(@layout, target_name, packet_name, item_name)
|
|
387
|
-
|
|
464
|
+
@value.set_setting('COLORBLIND', [parent.limits_items.colorblind])
|
|
388
465
|
@value.process_settings
|
|
466
|
+
@ignore_button = Qt::PushButton.new('Ignore Item')
|
|
467
|
+
@ignore_button.connect(SIGNAL('clicked()')) { parent.ignore(self, item) }
|
|
468
|
+
@layout.addWidget(@ignore_button)
|
|
469
|
+
|
|
470
|
+
@ignore_packet_button = Qt::PushButton.new('Ignore Packet')
|
|
471
|
+
@ignore_packet_button.connect(SIGNAL('clicked()')) { parent.ignore(self, packet) }
|
|
472
|
+
@layout.addWidget(@ignore_packet_button)
|
|
389
473
|
else
|
|
390
|
-
@
|
|
474
|
+
@type = :STALE
|
|
475
|
+
@value = LabelWidget.new(@layout, "#{target_name} #{packet_name} is STALE")
|
|
476
|
+
@layout.addStretch(1)
|
|
477
|
+
@ignore_button = Qt::PushButton.new('Ignore Stale Packet')
|
|
478
|
+
@ignore_button.connect(SIGNAL('clicked()')) { parent.ignore(self, packet) }
|
|
479
|
+
@layout.addWidget(@ignore_button)
|
|
391
480
|
end
|
|
392
|
-
|
|
393
|
-
@ignore_button = Qt::PushButton.new('Ignore')
|
|
394
|
-
@ignore_button.connect(SIGNAL('clicked()')) { parent.ignore(self, item) }
|
|
395
|
-
@layout.addWidget(@ignore_button)
|
|
396
481
|
end
|
|
397
482
|
|
|
398
483
|
# Update the widget's value, limits_state, and limits_set
|
|
399
484
|
def set_values(value, limits_state, limits_set)
|
|
400
485
|
if LabelvaluelimitsbarWidget === @value
|
|
401
|
-
@value.value = value
|
|
402
486
|
@value.limits_state = limits_state
|
|
403
487
|
@value.limits_set = limits_set
|
|
488
|
+
@value.value = value
|
|
404
489
|
end
|
|
405
490
|
end
|
|
406
491
|
|
|
@@ -415,6 +500,8 @@ module Cosmos
|
|
|
415
500
|
# Dispose of the widget
|
|
416
501
|
def dispose
|
|
417
502
|
@ignore_button.dispose
|
|
503
|
+
@ignore_packet_button.dispose if @type == :ITEM
|
|
504
|
+
@packet.dispose if @type == :ITEM
|
|
418
505
|
@value.dispose
|
|
419
506
|
@layout.dispose
|
|
420
507
|
super()
|
|
@@ -440,7 +527,7 @@ module Cosmos
|
|
|
440
527
|
complete_initialize()
|
|
441
528
|
|
|
442
529
|
@limits_items = LimitsItems.new(
|
|
443
|
-
method(:new_gui_item), method(:update_gui_item), method(:clear_gui_items))
|
|
530
|
+
method(:new_gui_item), method(:update_gui_item), method(:clear_gui_items), method(:remove_gui_item))
|
|
444
531
|
result = @limits_items.open_config(options.config_file)
|
|
445
532
|
statusBar.showMessage(tr(result))
|
|
446
533
|
|
|
@@ -622,12 +709,21 @@ module Cosmos
|
|
|
622
709
|
# Opens a dialog to allow the user to remove ignored items
|
|
623
710
|
def edit_ignored_items
|
|
624
711
|
items = []
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
712
|
+
@limits_items.ignored.each do |item|
|
|
713
|
+
target_name, packet_name, item_name = item
|
|
714
|
+
if item_name
|
|
715
|
+
widget = Qt::ListWidgetItem.new("ITEM: #{target_name} #{packet_name} #{item_name}")
|
|
716
|
+
else
|
|
717
|
+
widget = Qt::ListWidgetItem.new("PACKET: #{target_name} #{packet_name}")
|
|
718
|
+
end
|
|
719
|
+
widget.setData(Qt::UserRole, Qt::Variant.new(item))
|
|
720
|
+
items << widget
|
|
721
|
+
end
|
|
722
|
+
@limits_items.ignored_stale.each do |item|
|
|
723
|
+
target_name, packet_name = item
|
|
724
|
+
widget = Qt::ListWidgetItem.new("STALE: #{target_name} #{packet_name}")
|
|
725
|
+
widget.setData(Qt::UserRole, Qt::Variant.new(item))
|
|
726
|
+
items << widget
|
|
631
727
|
end
|
|
632
728
|
|
|
633
729
|
Qt::Dialog.new(self) do |dialog|
|
|
@@ -642,7 +738,13 @@ module Cosmos
|
|
|
642
738
|
list.connect(shortcut, SIGNAL('activated()')) do
|
|
643
739
|
items = list.selectedItems()
|
|
644
740
|
(0...items.length).each do |index|
|
|
645
|
-
|
|
741
|
+
item = items[index].data(Qt::UserRole).value
|
|
742
|
+
item_text = items[index].text
|
|
743
|
+
if !item_text.start_with?("STALE:")
|
|
744
|
+
@limits_items.remove_ignored(item)
|
|
745
|
+
else
|
|
746
|
+
@limits_items.remove_ignored_stale(item)
|
|
747
|
+
end
|
|
646
748
|
end
|
|
647
749
|
list.remove_selected_items
|
|
648
750
|
list.setCurrentRow(0)
|
|
@@ -722,6 +824,14 @@ module Cosmos
|
|
|
722
824
|
end
|
|
723
825
|
end
|
|
724
826
|
|
|
827
|
+
def remove_gui_item(widget)
|
|
828
|
+
Qt.execute_in_main_thread(true) do
|
|
829
|
+
@scroll_layout.removeWidget(widget)
|
|
830
|
+
widget.dispose
|
|
831
|
+
@scroll_widget.adjustSize
|
|
832
|
+
end
|
|
833
|
+
end
|
|
834
|
+
|
|
725
835
|
# Reset the GUI by clearing all items
|
|
726
836
|
def clear_gui_items
|
|
727
837
|
Qt.execute_in_main_thread(true) { @scroll_layout.removeAll }
|
|
@@ -732,11 +842,12 @@ module Cosmos
|
|
|
732
842
|
# @param item [Array<String,String,String] Array containing the target name,
|
|
733
843
|
# packet name, and item name of the item to ignore.
|
|
734
844
|
def ignore(widget, item)
|
|
735
|
-
|
|
845
|
+
if widget.type == :ITEM
|
|
846
|
+
@limits_items.ignore(item)
|
|
847
|
+
else
|
|
848
|
+
@limits_items.ignore_stale(item)
|
|
849
|
+
end
|
|
736
850
|
Qt.execute_in_main_thread(true) do
|
|
737
|
-
@scroll_layout.removeWidget(widget)
|
|
738
|
-
widget.dispose
|
|
739
|
-
@scroll_widget.adjustSize
|
|
740
851
|
statusBar.showMessage('Warning: Some Telemetry Items are Ignored')
|
|
741
852
|
end
|
|
742
853
|
end
|
|
@@ -764,7 +875,7 @@ module Cosmos
|
|
|
764
875
|
end
|
|
765
876
|
@tf.setForeground(brush)
|
|
766
877
|
@log_output.setCurrentCharFormat(@tf)
|
|
767
|
-
@log_output.appendPlainText(message.chomp)
|
|
878
|
+
@log_output.appendPlainText(Time.now.sys.formatted + ' ' + message.chomp)
|
|
768
879
|
end
|
|
769
880
|
end
|
|
770
881
|
|
|
@@ -839,7 +950,7 @@ module Cosmos
|
|
|
839
950
|
Cosmos.catch_fatal_exception do
|
|
840
951
|
unless option_parser and options
|
|
841
952
|
option_parser, options = create_default_options()
|
|
842
|
-
options.width =
|
|
953
|
+
options.width = 700
|
|
843
954
|
options.height = 500
|
|
844
955
|
options.remember_geometry = false
|
|
845
956
|
options.title = "Limits Monitor"
|