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
@@ -22,7 +22,7 @@ module Cosmos
|
|
22
22
|
|
23
23
|
plw = PacketLogWriter.new(:CMD,nil,true,nil,10000000,nil,false)
|
24
24
|
@cmd_packets = []
|
25
|
-
pkt = System.commands.packet("
|
25
|
+
pkt = System.commands.packet("SYSTEM","STARTLOGGING").clone
|
26
26
|
pkt.received_time = Time.new(2020,1,31,12,30,15)
|
27
27
|
pkt.write('label','PKT1')
|
28
28
|
plw.write(pkt)
|
@@ -42,20 +42,20 @@ module Cosmos
|
|
42
42
|
|
43
43
|
plw = PacketLogWriter.new(:TLM,nil,true,nil,10000000,nil,false)
|
44
44
|
@tlm_packets = []
|
45
|
-
pkt = System.telemetry.packet("
|
45
|
+
pkt = System.telemetry.packet("SYSTEM","LIMITS_CHANGE").clone
|
46
46
|
pkt.received_time = Time.new(2020,2,1,12,30,15)
|
47
|
-
pkt.write('
|
47
|
+
pkt.write('PACKET','PKT1')
|
48
48
|
plw.write(pkt)
|
49
49
|
@tlm_packet_length = pkt.length
|
50
50
|
@tlm_packets << pkt
|
51
51
|
pkt = pkt.clone
|
52
52
|
pkt.received_time += 1
|
53
|
-
pkt.write('
|
53
|
+
pkt.write('PACKET','PKT2')
|
54
54
|
plw.write(pkt)
|
55
55
|
@tlm_packets << pkt
|
56
56
|
pkt = pkt.clone
|
57
57
|
pkt.received_time += 1
|
58
|
-
pkt.write('
|
58
|
+
pkt.write('PACKET','PKT3')
|
59
59
|
plw.write(pkt)
|
60
60
|
@tlm_packets << pkt
|
61
61
|
plw.stop
|
@@ -87,7 +87,7 @@ module Cosmos
|
|
87
87
|
end
|
88
88
|
|
89
89
|
it "complains if the log does not have a COSMOS header" do
|
90
|
-
pkt = System.telemetry.packet("
|
90
|
+
pkt = System.telemetry.packet("SYSTEM","LIMITS_CHANGE").clone
|
91
91
|
filename = File.join(@log_path,'test.bin')
|
92
92
|
File.open(filename,'wb') do |file|
|
93
93
|
file.write "OASIS CMD TEST"
|
@@ -99,7 +99,7 @@ module Cosmos
|
|
99
99
|
end
|
100
100
|
|
101
101
|
it "complains if the log is not CMD or TLM" do
|
102
|
-
pkt = System.telemetry.packet("
|
102
|
+
pkt = System.telemetry.packet("SYSTEM","LIMITS_CHANGE").clone
|
103
103
|
filename = File.join(@log_path,'test.bin')
|
104
104
|
File.open(filename,'wb') do |file|
|
105
105
|
file.write "COSMOSBOTH TEST"
|
@@ -111,7 +111,7 @@ module Cosmos
|
|
111
111
|
end
|
112
112
|
|
113
113
|
it "opens COSMOS1 log files" do
|
114
|
-
pkt = System.telemetry.packet("
|
114
|
+
pkt = System.telemetry.packet("SYSTEM","LIMITS_CHANGE").clone
|
115
115
|
filename = File.join(@log_path,'test.bin')
|
116
116
|
File.open(filename,'wb') do |file|
|
117
117
|
file.write "COSMOSCMD TEST"
|
@@ -152,24 +152,24 @@ module Cosmos
|
|
152
152
|
@config_targets = File.join(Cosmos::USERPATH,'config','targets')
|
153
153
|
|
154
154
|
File.open(@config_file,'w') do |file|
|
155
|
-
file.puts "DECLARE_TARGET
|
156
|
-
file.puts "DECLARE_TARGET
|
155
|
+
file.puts "DECLARE_TARGET INST OVERRIDE"
|
156
|
+
file.puts "DECLARE_TARGET SYSTEM"
|
157
157
|
end
|
158
158
|
|
159
159
|
# Load the original configuration
|
160
160
|
original_config_name, err = System.load_configuration
|
161
161
|
expect(err).to eql nil
|
162
|
-
expect(System.telemetry.target_names).to eql %w(
|
163
|
-
original_pkts = System.telemetry.packets('
|
162
|
+
expect(System.telemetry.target_names).to eql %w(OVERRIDE SYSTEM)
|
163
|
+
original_pkts = System.telemetry.packets('SYSTEM').keys
|
164
164
|
|
165
165
|
# Create a new configuration by writing another telemetry file
|
166
|
-
File.open(File.join(@config_targets,'
|
167
|
-
file.puts "TELEMETRY
|
166
|
+
File.open(File.join(@config_targets,'SYSTEM','cmd_tlm','test1_tlm.txt'),'w') do |file|
|
167
|
+
file.puts "TELEMETRY SYSTEM TEST1 BIG_ENDIAN"
|
168
168
|
file.puts " APPEND_ITEM DATA 240 STRING"
|
169
169
|
end
|
170
170
|
System.instance.process_file(@config_file)
|
171
171
|
# Verify the new telemetry packet is there
|
172
|
-
expect(System.telemetry.packets('
|
172
|
+
expect(System.telemetry.packets('SYSTEM').keys).to include "TEST1"
|
173
173
|
second_config_name = System.configuration_name
|
174
174
|
|
175
175
|
# Create a log file for the second config
|
@@ -195,7 +195,7 @@ module Cosmos
|
|
195
195
|
FileUtils.mv File.join(Cosmos::USERPATH, 'system.txt'),
|
196
196
|
File.join(Cosmos::USERPATH,'config','system')
|
197
197
|
|
198
|
-
File.delete(File.join(@config_targets,'
|
198
|
+
File.delete(File.join(@config_targets,'SYSTEM','cmd_tlm','test1_tlm.txt'))
|
199
199
|
end
|
200
200
|
end
|
201
201
|
|
@@ -206,11 +206,13 @@ module Cosmos
|
|
206
206
|
expect(@plr.configuration_name).not_to be_nil
|
207
207
|
expect(@plr.hostname).to eql Socket.gethostname
|
208
208
|
header_length = 8 + 1 + 6 + 1 + 12 + 4
|
209
|
-
|
209
|
+
meta_header_length = 8 + 1 + 6 + 1 + 4 + 4
|
210
|
+
meta_length = System.telemetry.packet('SYSTEM', 'META').length
|
211
|
+
expect(packet_offsets).to eql [PacketLogReader::COSMOS2_HEADER_LENGTH, PacketLogReader::COSMOS2_HEADER_LENGTH + meta_header_length + meta_length, PacketLogReader::COSMOS2_HEADER_LENGTH + meta_header_length + meta_length + header_length + @cmd_packet_length, PacketLogReader::COSMOS2_HEADER_LENGTH + meta_header_length + meta_length + (header_length + @cmd_packet_length) * 2]
|
210
212
|
|
211
213
|
expect(@plr.open(Dir[File.join(@log_path,"*cmd.bin")][0])).to eql [true, nil]
|
212
|
-
pkt = @plr.read_at_offset(packet_offsets[
|
213
|
-
expect(pkt.target_name).to eql "
|
214
|
+
pkt = @plr.read_at_offset(packet_offsets[2])
|
215
|
+
expect(pkt.target_name).to eql "SYSTEM"
|
214
216
|
expect(pkt.packet_name).to eql "STARTLOGGING"
|
215
217
|
expect(pkt.received_time).to eql Time.new(2020,1,31,12,30,16)
|
216
218
|
@plr.close
|
@@ -221,13 +223,15 @@ module Cosmos
|
|
221
223
|
expect(@plr.log_type).to eql :TLM
|
222
224
|
expect(@plr.configuration_name).not_to be_nil
|
223
225
|
expect(@plr.hostname).to eql Socket.gethostname
|
224
|
-
header_length = 8 + 1 + 6 + 1 +
|
225
|
-
|
226
|
+
header_length = 8 + 1 + 6 + 1 + 13 + 4
|
227
|
+
meta_header_length = 8 + 1 + 6 + 1 + 4 + 4
|
228
|
+
meta_length = System.telemetry.packet('SYSTEM', 'META').length
|
229
|
+
expect(packet_offsets).to eql [PacketLogReader::COSMOS2_HEADER_LENGTH, PacketLogReader::COSMOS2_HEADER_LENGTH + meta_header_length + meta_length, PacketLogReader::COSMOS2_HEADER_LENGTH + meta_header_length + meta_length + header_length + @tlm_packet_length, PacketLogReader::COSMOS2_HEADER_LENGTH + meta_header_length + meta_length + (header_length + @tlm_packet_length) * 2]
|
226
230
|
|
227
231
|
expect(@plr.open(Dir[File.join(@log_path,"*tlm.bin")][0])).to eql [true, nil]
|
228
|
-
pkt = @plr.read_at_offset(packet_offsets[
|
229
|
-
expect(pkt.target_name).to eql "
|
230
|
-
expect(pkt.packet_name).to eql "
|
232
|
+
pkt = @plr.read_at_offset(packet_offsets[2])
|
233
|
+
expect(pkt.target_name).to eql "SYSTEM"
|
234
|
+
expect(pkt.packet_name).to eql "LIMITS_CHANGE"
|
231
235
|
expect(pkt.received_time).to eql Time.new(2020,2,1,12,30,16)
|
232
236
|
@plr.close
|
233
237
|
end
|
@@ -236,25 +240,33 @@ module Cosmos
|
|
236
240
|
describe "each" do
|
237
241
|
it "returns packets" do
|
238
242
|
index = 0
|
239
|
-
|
243
|
+
meta_header_length = 8 + 1 + 6 + 1 + 4 + 4
|
244
|
+
meta_length = System.telemetry.packet('SYSTEM', 'META').length
|
245
|
+
packet_length = System.commands.packet('SYSTEM', 'STARTLOGGING').length
|
246
|
+
packet_header_length = 8 + 1 + 'SYSTEM'.length + 1 + 'STARTLOGGING'.length + 4
|
247
|
+
bytes_read = 128 + packet_header_length + packet_length + meta_header_length + meta_length
|
240
248
|
@plr.each(Dir[File.join(@log_path,"*cmd.bin")][0]) do |packet|
|
249
|
+
next if packet.packet_name == 'META'
|
241
250
|
expect(packet.target_name).to eql @cmd_packets[index].target_name
|
242
251
|
expect(packet.packet_name).to eql @cmd_packets[index].packet_name
|
243
252
|
expect(packet.received_time).to eql @cmd_packets[index].received_time
|
244
253
|
expect(packet.read('LABEL')).to eql @cmd_packets[index].read('LABEL')
|
245
254
|
expect(@plr.bytes_read).to eql bytes_read
|
246
|
-
bytes_read +=
|
255
|
+
bytes_read += packet_header_length + packet_length
|
247
256
|
index += 1
|
248
257
|
end
|
249
258
|
index = 0
|
250
|
-
|
259
|
+
packet_length = System.telemetry.packet('SYSTEM', 'LIMITS_CHANGE').length
|
260
|
+
packet_header_length = 8 + 1 + 'SYSTEM'.length + 1 + 'LIMITS_CHANGE'.length + 4
|
261
|
+
bytes_read = 128 + packet_header_length + packet_length + meta_header_length + meta_length
|
251
262
|
@plr.each(Dir[File.join(@log_path,"*tlm.bin")][0]) do |packet|
|
263
|
+
next if packet.packet_name == 'META'
|
252
264
|
expect(packet.target_name).to eql @tlm_packets[index].target_name
|
253
265
|
expect(packet.packet_name).to eql @tlm_packets[index].packet_name
|
254
266
|
expect(packet.received_time).to eql @tlm_packets[index].received_time
|
255
|
-
expect(packet.read('
|
267
|
+
expect(packet.read('PACKET')).to eql @tlm_packets[index].read('PACKET')
|
256
268
|
expect(@plr.bytes_read).to eql bytes_read
|
257
|
-
bytes_read +=
|
269
|
+
bytes_read += packet_header_length + packet_length
|
258
270
|
index += 1
|
259
271
|
end
|
260
272
|
end
|
@@ -262,6 +274,7 @@ module Cosmos
|
|
262
274
|
it "optionally does not identify and define packets" do
|
263
275
|
index = 0
|
264
276
|
@plr.each(Dir[File.join(@log_path,"*cmd.bin")][0], false) do |packet|
|
277
|
+
next if packet.packet_name == 'META'
|
265
278
|
expect(packet.target_name).to eql @cmd_packets[index].target_name
|
266
279
|
expect(packet.packet_name).to eql @cmd_packets[index].packet_name
|
267
280
|
expect(packet.received_time).to eql @cmd_packets[index].received_time
|
@@ -270,10 +283,11 @@ module Cosmos
|
|
270
283
|
end
|
271
284
|
index = 0
|
272
285
|
@plr.each(Dir[File.join(@log_path,"*tlm.bin")][0], false) do |packet|
|
286
|
+
next if packet.packet_name == 'META'
|
273
287
|
expect(packet.target_name).to eql @tlm_packets[index].target_name
|
274
288
|
expect(packet.packet_name).to eql @tlm_packets[index].packet_name
|
275
289
|
expect(packet.received_time).to eql @tlm_packets[index].received_time
|
276
|
-
expect { packet.read('
|
290
|
+
expect { packet.read('PACKET') }.to raise_error(/does not exist/)
|
277
291
|
index += 1
|
278
292
|
end
|
279
293
|
end
|
@@ -284,12 +298,13 @@ module Cosmos
|
|
284
298
|
plw.write(System.commands.packet("INST","ABORT").clone)
|
285
299
|
plw.write(System.commands.packet("INST","ABORT").clone)
|
286
300
|
plw.write(System.commands.packet("INST","COLLECT").clone)
|
287
|
-
plw.write(System.commands.packet("
|
301
|
+
plw.write(System.commands.packet("SYSTEM","STOPLOGGING").clone)
|
288
302
|
plw.write(System.commands.packet("INST","ABORT").clone)
|
289
303
|
plw.stop
|
290
304
|
|
291
305
|
cnt = {}
|
292
306
|
@plr.each(Dir[File.join(@log_path,"*cntcmd.bin")][0]) do |packet|
|
307
|
+
next if packet.packet_name == 'META'
|
293
308
|
cnt["#{packet.target_name}_#{packet.packet_name}"] ||= 0
|
294
309
|
cnt["#{packet.target_name}_#{packet.packet_name}"] += 1
|
295
310
|
expect(packet.received_count).to eql cnt["#{packet.target_name}_#{packet.packet_name}"]
|
@@ -302,6 +317,7 @@ module Cosmos
|
|
302
317
|
expect(collect.received_count).to eql 0
|
303
318
|
|
304
319
|
@plr.each(Dir[File.join(@log_path,"*cntcmd.bin")][0]) do |packet|
|
320
|
+
next if packet.packet_name == 'META'
|
305
321
|
cnt["#{packet.target_name}_#{packet.packet_name}"] ||= 0
|
306
322
|
cnt["#{packet.target_name}_#{packet.packet_name}"] += 1
|
307
323
|
expect(packet.received_count).to eql cnt["#{packet.target_name}_#{packet.packet_name}"]
|
@@ -316,12 +332,12 @@ module Cosmos
|
|
316
332
|
plw.write(System.telemetry.packet("INST","ADCS").clone)
|
317
333
|
plw.write(System.telemetry.packet("INST","ADCS").clone)
|
318
334
|
plw.write(System.telemetry.packet("INST","HEALTH_STATUS").clone)
|
319
|
-
plw.write(System.telemetry.packet("COSMOS","LIMITS_CHANGE").clone)
|
320
335
|
plw.write(System.telemetry.packet("INST","ADCS").clone)
|
321
336
|
plw.stop
|
322
337
|
|
323
338
|
cnt = {}
|
324
339
|
@plr.each(Dir[File.join(@log_path,"*cnttlm.bin")][0]) do |packet|
|
340
|
+
next if packet.packet_name == 'META'
|
325
341
|
cnt["#{packet.target_name}_#{packet.packet_name}"] ||= 0
|
326
342
|
cnt["#{packet.target_name}_#{packet.packet_name}"] += 1
|
327
343
|
expect(packet.received_count).to eql cnt["#{packet.target_name}_#{packet.packet_name}"]
|
@@ -334,6 +350,7 @@ module Cosmos
|
|
334
350
|
expect(status.received_count).to eql 0
|
335
351
|
|
336
352
|
@plr.each(Dir[File.join(@log_path,"*cnttlm.bin")][0]) do |packet|
|
353
|
+
next if packet.packet_name == 'META'
|
337
354
|
cnt["#{packet.target_name}_#{packet.packet_name}"] ||= 0
|
338
355
|
cnt["#{packet.target_name}_#{packet.packet_name}"] += 1
|
339
356
|
expect(packet.received_count).to eql cnt["#{packet.target_name}_#{packet.packet_name}"]
|
@@ -346,6 +363,7 @@ module Cosmos
|
|
346
363
|
time = Time.new(2000,1,31,12,30,16)
|
347
364
|
index = 0
|
348
365
|
@plr.each(Dir[File.join(@log_path,"*cmd.bin")][0], true, time) do |packet|
|
366
|
+
next if packet.packet_name == 'META'
|
349
367
|
expect(packet.target_name).to eql @cmd_packets[index].target_name
|
350
368
|
expect(packet.packet_name).to eql @cmd_packets[index].packet_name
|
351
369
|
expect(packet.received_time).to eql @cmd_packets[index].received_time
|
@@ -382,7 +400,7 @@ module Cosmos
|
|
382
400
|
expect(packet.target_name).to eql @tlm_packets[index+1].target_name
|
383
401
|
expect(packet.packet_name).to eql @tlm_packets[index+1].packet_name
|
384
402
|
expect(packet.received_time).to eql @tlm_packets[index+1].received_time
|
385
|
-
expect(packet.read('
|
403
|
+
expect(packet.read('PACKET')).to eql @tlm_packets[index+1].read('PACKET')
|
386
404
|
index += 1
|
387
405
|
end
|
388
406
|
expect(index).to eql 2
|
@@ -401,6 +419,7 @@ module Cosmos
|
|
401
419
|
time = Time.new(2030,2,1,12,30,16)
|
402
420
|
index = 0
|
403
421
|
@plr.each(Dir[File.join(@log_path,"*cmd.bin")][0], true, nil, time) do |packet|
|
422
|
+
next if packet.packet_name == 'META'
|
404
423
|
expect(packet.target_name).to eql @cmd_packets[index].target_name
|
405
424
|
expect(packet.packet_name).to eql @cmd_packets[index].packet_name
|
406
425
|
expect(packet.received_time).to eql @cmd_packets[index].received_time
|
@@ -414,6 +433,7 @@ module Cosmos
|
|
414
433
|
time = Time.new(2020,1,31,12,30,16)
|
415
434
|
index = 0
|
416
435
|
@plr.each(Dir[File.join(@log_path,"*cmd.bin")][0], true, nil, time) do |packet|
|
436
|
+
next if packet.packet_name == 'META'
|
417
437
|
expect(packet.target_name).to eql @cmd_packets[index].target_name
|
418
438
|
expect(packet.packet_name).to eql @cmd_packets[index].packet_name
|
419
439
|
expect(packet.received_time).to eql @cmd_packets[index].received_time
|
@@ -425,10 +445,11 @@ module Cosmos
|
|
425
445
|
time = Time.new(2020,2,1,12,30,16)
|
426
446
|
index = 0
|
427
447
|
@plr.each(Dir[File.join(@log_path,"*tlm.bin")][0], true, nil, time) do |packet|
|
448
|
+
next if packet.packet_name == 'META'
|
428
449
|
expect(packet.target_name).to eql @tlm_packets[index].target_name
|
429
450
|
expect(packet.packet_name).to eql @tlm_packets[index].packet_name
|
430
451
|
expect(packet.received_time).to eql @tlm_packets[index].received_time
|
431
|
-
expect(packet.read('
|
452
|
+
expect(packet.read('PACKET')).to eql @tlm_packets[index].read('PACKET')
|
432
453
|
index += 1
|
433
454
|
end
|
434
455
|
expect(index).to eql 2
|
@@ -439,16 +460,15 @@ module Cosmos
|
|
439
460
|
it "returns the first command packet and retain the file position" do
|
440
461
|
expect(@plr.open(Dir[File.join(@log_path,"*cmd.bin")][0])).to eql [true, nil]
|
441
462
|
pkt1 = @plr.read
|
463
|
+
pkt1 = @plr.read
|
442
464
|
expect(pkt1.target_name).to eql @cmd_packets[0].target_name
|
443
465
|
expect(pkt1.packet_name).to eql @cmd_packets[0].packet_name
|
444
466
|
expect(pkt1.received_time).to eql @cmd_packets[0].received_time
|
445
467
|
expect(pkt1.read('LABEL')).to eql @cmd_packets[0].read('LABEL')
|
446
468
|
|
447
469
|
first = @plr.first
|
448
|
-
expect(first.target_name).to eql
|
449
|
-
expect(first.packet_name).to eql
|
450
|
-
expect(first.received_time).to eql @cmd_packets[0].received_time
|
451
|
-
expect(first.read('LABEL')).to eql @cmd_packets[0].read('LABEL')
|
470
|
+
expect(first.target_name).to eql 'SYSTEM'
|
471
|
+
expect(first.packet_name).to eql 'META'
|
452
472
|
|
453
473
|
pkt2 = @plr.read
|
454
474
|
expect(pkt2.target_name).to eql @cmd_packets[1].target_name
|
@@ -461,22 +481,21 @@ module Cosmos
|
|
461
481
|
it "returns the first telemetry packet and retain the file position" do
|
462
482
|
expect(@plr.open(Dir[File.join(@log_path,"*tlm.bin")][0])).to eql [true, nil]
|
463
483
|
pkt1 = @plr.read
|
484
|
+
pkt1 = @plr.read
|
464
485
|
expect(pkt1.target_name).to eql @tlm_packets[0].target_name
|
465
486
|
expect(pkt1.packet_name).to eql @tlm_packets[0].packet_name
|
466
487
|
expect(pkt1.received_time).to eql @tlm_packets[0].received_time
|
467
|
-
expect(pkt1.read('
|
488
|
+
expect(pkt1.read('PACKET')).to eql @tlm_packets[0].read('PACKET')
|
468
489
|
|
469
490
|
first = @plr.first
|
470
|
-
expect(first.target_name).to eql
|
471
|
-
expect(first.packet_name).to eql
|
472
|
-
expect(first.received_time).to eql @tlm_packets[0].received_time
|
473
|
-
expect(first.read('COSMOS')).to eql @tlm_packets[0].read('COSMOS')
|
491
|
+
expect(first.target_name).to eql 'SYSTEM'
|
492
|
+
expect(first.packet_name).to eql 'META'
|
474
493
|
|
475
494
|
pkt2 = @plr.read
|
476
495
|
expect(pkt2.target_name).to eql @tlm_packets[1].target_name
|
477
496
|
expect(pkt2.packet_name).to eql @tlm_packets[1].packet_name
|
478
497
|
expect(pkt2.received_time).to eql @tlm_packets[1].received_time
|
479
|
-
expect(pkt2.read('
|
498
|
+
expect(pkt2.read('PACKET')).to eql @tlm_packets[1].read('PACKET')
|
480
499
|
@plr.close
|
481
500
|
end
|
482
501
|
end
|
@@ -485,6 +504,7 @@ module Cosmos
|
|
485
504
|
it "returns the last command packet and retain the file position" do
|
486
505
|
expect(@plr.open(Dir[File.join(@log_path,"*cmd.bin")][0])).to eql [true, nil]
|
487
506
|
pkt1 = @plr.read
|
507
|
+
pkt1 = @plr.read
|
488
508
|
expect(pkt1.target_name).to eql @cmd_packets[0].target_name
|
489
509
|
expect(pkt1.packet_name).to eql @cmd_packets[0].packet_name
|
490
510
|
expect(pkt1.received_time).to eql @cmd_packets[0].received_time
|
@@ -507,22 +527,23 @@ module Cosmos
|
|
507
527
|
it "returns the last telemetry packet and retain the file position" do
|
508
528
|
expect(@plr.open(Dir[File.join(@log_path,"*tlm.bin")][0])).to eql [true, nil]
|
509
529
|
pkt1 = @plr.read
|
530
|
+
pkt1 = @plr.read
|
510
531
|
expect(pkt1.target_name).to eql @tlm_packets[0].target_name
|
511
532
|
expect(pkt1.packet_name).to eql @tlm_packets[0].packet_name
|
512
533
|
expect(pkt1.received_time).to eql @tlm_packets[0].received_time
|
513
|
-
expect(pkt1.read('
|
534
|
+
expect(pkt1.read('PACKET')).to eql @tlm_packets[0].read('PACKET')
|
514
535
|
|
515
536
|
last = @plr.last
|
516
537
|
expect(last.target_name).to eql @tlm_packets[2].target_name
|
517
538
|
expect(last.packet_name).to eql @tlm_packets[2].packet_name
|
518
539
|
expect(last.received_time).to eql @tlm_packets[2].received_time
|
519
|
-
expect(last.read('
|
540
|
+
expect(last.read('PACKET')).to eql @tlm_packets[2].read('PACKET')
|
520
541
|
|
521
542
|
pkt2 = @plr.read
|
522
543
|
expect(pkt2.target_name).to eql @tlm_packets[1].target_name
|
523
544
|
expect(pkt2.packet_name).to eql @tlm_packets[1].packet_name
|
524
545
|
expect(pkt2.received_time).to eql @tlm_packets[1].received_time
|
525
|
-
expect(pkt2.read('
|
546
|
+
expect(pkt2.read('PACKET')).to eql @tlm_packets[1].read('PACKET')
|
526
547
|
@plr.close
|
527
548
|
end
|
528
549
|
end
|
@@ -92,16 +92,18 @@ module Cosmos
|
|
92
92
|
end
|
93
93
|
|
94
94
|
it "cycles the log when it a size" do
|
95
|
-
|
95
|
+
meta_length = System.telemetry.packet('SYSTEM', 'META').length
|
96
|
+
meta_header_length = 8 + 1 + 6 + 1 + 4 + 4
|
97
|
+
plw = PacketLogWriter.new(:TLM,nil,true,nil,128 + meta_header_length + meta_length + 72,nil,false)
|
96
98
|
pkt = Packet.new('tgt','pkt')
|
97
99
|
pkt.buffer = "\x01\x02\x03\x04"
|
98
|
-
plw.write(pkt) # size
|
100
|
+
plw.write(pkt) # size goal - 48
|
99
101
|
sleep 0.5
|
100
|
-
plw.write(pkt) # size
|
102
|
+
plw.write(pkt) # size goal - 24
|
101
103
|
sleep 0.5
|
102
|
-
plw.write(pkt) # size
|
104
|
+
plw.write(pkt) # size goal
|
103
105
|
expect(Dir[File.join(@log_path,"*.bin")].length).to eql 1
|
104
|
-
# This write pushs us past
|
106
|
+
# This write pushs us past the specified size so we should start a new file
|
105
107
|
plw.write(pkt)
|
106
108
|
expect(Dir[File.join(@log_path,"*.bin")].length).to eql 2
|
107
109
|
plw.shutdown
|
@@ -281,31 +281,31 @@ module Cosmos
|
|
281
281
|
describe "format" do
|
282
282
|
it "creates a string representation of a command" do
|
283
283
|
pkt = @cmd.packet("TGT1","PKT1")
|
284
|
-
expect(@cmd.format(pkt)).to eql "cmd(
|
284
|
+
expect(@cmd.format(pkt)).to eql "cmd(\"TGT1 PKT1 with ITEM1 0, ITEM2 0, ITEM3 0, ITEM4 0\")"
|
285
285
|
|
286
286
|
pkt = @cmd.packet("TGT2","PKT4")
|
287
287
|
string = ''
|
288
288
|
pkt.write("ITEM2","HELLO WORLD")
|
289
|
-
expect(@cmd.format(pkt)).to eql "cmd(
|
289
|
+
expect(@cmd.format(pkt)).to eql "cmd(\"TGT2 PKT4 with ITEM1 0, ITEM2 'HELLO WORLD'\")"
|
290
290
|
|
291
291
|
pkt = @cmd.packet("TGT2","PKT4")
|
292
292
|
string = ''
|
293
293
|
pkt.write("ITEM2","HELLO WORLD")
|
294
294
|
pkt.raw = true
|
295
|
-
expect(@cmd.format(pkt)).to eql "cmd_raw(
|
295
|
+
expect(@cmd.format(pkt)).to eql "cmd_raw(\"TGT2 PKT4 with ITEM1 0, ITEM2 'HELLO WORLD'\")"
|
296
296
|
|
297
297
|
# If the string is too big it should truncate it
|
298
298
|
(1..2028).each {|i| string << 'A' }
|
299
299
|
pkt.write("ITEM2",string)
|
300
300
|
pkt.raw = false
|
301
301
|
result = @cmd.format(pkt)
|
302
|
-
expect(result).to match(/cmd\(
|
302
|
+
expect(result).to match(/cmd\(\"TGT2 PKT4 with ITEM1 0, ITEM2 'AAAAAAAAAAA/)
|
303
303
|
expect(result).to match(/AAAAAAAAAAA.../)
|
304
304
|
end
|
305
305
|
|
306
306
|
it "ignores parameters" do
|
307
307
|
pkt = @cmd.packet("TGT1","PKT1")
|
308
|
-
expect(@cmd.format(pkt,['ITEM3','ITEM4'])).to eql "cmd(
|
308
|
+
expect(@cmd.format(pkt,['ITEM3','ITEM4'])).to eql "cmd(\"TGT1 PKT1 with ITEM1 0, ITEM2 0\")"
|
309
309
|
end
|
310
310
|
end
|
311
311
|
|
data/spec/packets/packet_spec.rb
CHANGED
@@ -140,24 +140,12 @@ module Cosmos
|
|
140
140
|
|
141
141
|
it "complains about nil received_count" do
|
142
142
|
p = Packet.new("tgt","pkt")
|
143
|
-
|
144
|
-
# Ruby version >= 2.4.0
|
145
|
-
expect {p.received_count = nil }.to raise_error(ArgumentError, "received_count must be an Integer but is a NilClass")
|
146
|
-
else
|
147
|
-
# Ruby version < 2.4.0
|
148
|
-
expect {p.received_count = nil }.to raise_error(ArgumentError, "received_count must be a Fixnum but is a NilClass")
|
149
|
-
end
|
143
|
+
expect {p.received_count = nil }.to raise_error(ArgumentError, "received_count must be an Integer but is a NilClass")
|
150
144
|
end
|
151
145
|
|
152
146
|
it "complains about non Fixnum received_counts" do
|
153
147
|
p = Packet.new("tgt","pkt")
|
154
|
-
|
155
|
-
# Ruby version >= 2.4.0
|
156
|
-
expect {p.received_count = "5" }.to raise_error(ArgumentError, "received_count must be an Integer but is a String")
|
157
|
-
else
|
158
|
-
# Ruby version < 2.4.0
|
159
|
-
expect {p.received_count = "5" }.to raise_error(ArgumentError, "received_count must be a Fixnum but is a String")
|
160
|
-
end
|
148
|
+
expect {p.received_count = "5" }.to raise_error(ArgumentError, "received_count must be an Integer but is a String")
|
161
149
|
end
|
162
150
|
end
|
163
151
|
|