cosmos 4.2.4-java → 4.5.0-java
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/.dockerignore +2 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +30 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
- data/.github/ISSUE_TEMPLATE/help---usage---general-question.md +12 -0
- data/.gitignore +2 -0
- data/.travis.yml +6 -6
- data/Dockerfile +69 -0
- data/Gemfile +1 -1
- data/Manifest.txt +130 -46
- data/README.md +9 -0
- data/Rakefile +57 -0
- data/appveyor.yml +18 -7
- data/autohotkey/config/targets/INST/cmd_tlm/inst_cmds.txt +1 -1
- data/autohotkey/config/targets/INST/cmd_tlm/inst_tlm.txt +5 -5
- data/autohotkey/config/targets/INST/lib/sim_inst.rb +3 -1
- data/autohotkey/config/tools/cmd_sequence/cmd_sequence.txt +2 -0
- data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
- data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
- data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
- data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
- data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/autohotkey/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
- data/autohotkey/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
- data/autohotkey/config/tools/table_manager/ConfigTables_def.txt +2 -4
- data/autohotkey/config/tools/table_manager/SubTables/OneDimensionalSubTable_def.txt +31 -0
- data/autohotkey/config/tools/table_manager/SubTables/TwoDimensionalSubTable_def.txt +28 -0
- data/autohotkey/config/tools/test_runner/test_runner.txt +1 -1
- data/autohotkey/config/tools/test_runner/test_runner2.txt +1 -1
- data/autohotkey/config/tools/test_runner/test_runner3.txt +1 -1
- data/autohotkey/config/tools/test_runner/test_runner4.txt +1 -1
- data/autohotkey/lib/cmd_sequence_exporter.rb +52 -0
- data/autohotkey/procedures/collect.rb +2 -2
- data/autohotkey/procedures/collect_util.rb +1 -1
- data/autohotkey/procedures/script_test.rb +1 -1
- data/autohotkey/tools/CmdSenderAHK2 +18 -0
- data/autohotkey/tools/cmd_sender.ahk +34 -6
- data/autohotkey/tools/cmd_sender2.ahk +4 -0
- data/autohotkey/tools/cmd_sequence.ahk +36 -22
- data/autohotkey/tools/cmd_sequence2.ahk +1 -1
- data/autohotkey/tools/config_editor.ahk +5 -5
- data/autohotkey/tools/launcher.ahk +1 -0
- data/autohotkey/tools/limits_monitor.ahk +1 -1
- data/autohotkey/tools/packet_viewer.ahk +7 -6
- data/autohotkey/tools/script_runner.ahk +16 -4
- data/autohotkey/tools/test_runner.ahk +8 -8
- data/bin/cosmos +38 -1
- data/bin/cstol_converter +1 -1
- data/bin/dart_util +0 -0
- data/bin/rubysloc +73 -28
- data/bin/xtce_converter +1 -1
- data/cosmos.gemspec +7 -9
- data/data/config/_interfaces.yaml +4 -0
- data/data/config/cmd_sequence.yaml +14 -0
- data/data/config/command_modifiers.yaml +16 -1
- data/data/config/housekeeping_params.yaml +14 -0
- data/data/config/interface_modifiers.yaml +14 -2
- data/data/config/item_modifiers.yaml +11 -1
- data/data/config/launcher.yaml +12 -2
- data/data/config/param_item_modifiers.yaml +7 -2
- data/data/config/parameter_modifiers.yaml +20 -0
- data/data/config/screen.yaml +2 -0
- data/data/config/script_runner.yaml +9 -0
- data/data/config/system.yaml +152 -28
- data/data/config/table_manager.yaml +7 -0
- data/data/config/target.yaml +12 -0
- data/data/config/telemetry_modifiers.yaml +19 -2
- data/data/config/test_runner.yaml +10 -9
- data/data/config/widgets.yaml +174 -11
- data/data/crc.txt +428 -415
- data/demo/Gemfile +1 -1
- data/demo/Launcher.bat +1 -9
- data/demo/Launcher2.bat +1 -0
- data/demo/LauncherMini.bat +1 -0
- data/demo/Rakefile +2 -0
- data/demo/config/dart/Gemfile +2 -7
- data/demo/config/data/crc.txt +243 -219
- data/demo/config/system/system.txt +42 -3
- data/demo/config/system/system2.txt +34 -5
- data/demo/config/system/system_alt_ports.txt +80 -0
- data/demo/config/targets/EXAMPLE/cmd_tlm_server.txt +1 -0
- data/demo/config/targets/INST/cmd_tlm/inst_cmds.txt +5 -4
- data/demo/config/targets/INST/cmd_tlm/inst_tlm.txt +12 -7
- data/demo/config/targets/INST/cmd_tlm/inst_tlm_override.txt +12 -0
- data/demo/config/targets/INST/cmd_tlm_server.txt +2 -0
- data/demo/config/targets/INST/lib/sim_inst.rb +15 -3
- data/demo/config/targets/INST/screens/adcs.txt +2 -2
- data/demo/config/targets/INST/screens/block.txt +1 -1
- data/demo/config/targets/INST/screens/commanding.txt +1 -1
- data/demo/config/targets/INST/screens/ground.txt +27 -5
- data/demo/config/targets/INST/screens/ground_error.gif +0 -0
- data/demo/config/{data/groundoff.gif → targets/INST/screens/ground_off.gif} +0 -0
- data/demo/config/{data/groundon.gif → targets/INST/screens/ground_on.gif} +0 -0
- data/demo/config/targets/INST/screens/limits.txt +69 -31
- data/demo/config/targets/INST/screens/other.txt +13 -3
- data/demo/config/targets/INST/screens/params.txt +54 -0
- data/demo/config/targets/INST/screens/satellite.gif +0 -0
- data/demo/config/targets/INST/target.txt +1 -0
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server_chain.txt +18 -0
- data/demo/config/tools/data_viewer/data_viewer.txt +3 -0
- data/demo/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
- data/demo/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
- data/demo/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
- data/demo/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
- data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/demo/config/tools/handbook_creator/assets/img/ball_logo.bmp +0 -0
- data/demo/config/tools/handbook_creator/assets/img/ball_logo.gif +0 -0
- data/demo/config/tools/handbook_creator/assets/img/ball_logo.jpg +0 -0
- data/demo/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
- data/demo/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
- data/demo/config/tools/handbook_creator/assets/js/html5shiv.js +8 -0
- data/demo/config/tools/handbook_creator/assets/js/jquery-1.10.2.min.js +6 -0
- data/demo/config/tools/handbook_creator/assets/js/respond.min.js +6 -0
- data/demo/config/tools/handbook_creator/default_toc.xsl +59 -59
- data/demo/config/tools/script_runner/script_runner.txt +1 -2
- data/demo/config/tools/test_runner/test_runner.txt +3 -1
- data/demo/lib/example_background_task.rb +1 -0
- data/demo/procedures/cosmos_api_test.rb +26 -22
- data/demo/procedures/interactive.rb +22 -0
- data/demo/procedures/local_screen_example.rb +51 -0
- data/ext/cosmos/ext/cosmos_io/cosmos_io.c +32 -4
- data/ext/cosmos/ext/packet/packet.c +6 -77
- data/ext/mkrf_conf.rb +2 -2
- data/extensions/vscode/.gitignore +4 -0
- data/extensions/vscode/.vscode/launch.json +32 -0
- data/extensions/vscode/.vscode/settings.json +13 -0
- data/extensions/vscode/.vscode/tasks.json +79 -0
- data/extensions/vscode/License.txt +879 -0
- data/extensions/vscode/README.md +9 -0
- data/extensions/vscode/client/License.txt +879 -0
- data/extensions/vscode/client/README.md +39 -0
- data/extensions/vscode/client/cosmos.configuration.json +23 -0
- data/extensions/vscode/client/images/icon.png +0 -0
- data/extensions/vscode/client/package-lock.json +414 -0
- data/extensions/vscode/client/package.json +105 -0
- data/extensions/vscode/client/src/extension.ts +132 -0
- data/extensions/vscode/client/src/screen_preview.rb +25 -0
- data/extensions/vscode/client/syntaxes/cosmos.tmLanguage.json +219 -0
- data/extensions/vscode/client/tsconfig.json +17 -0
- data/extensions/vscode/package-lock.json +26 -0
- data/extensions/vscode/package.json +35 -0
- data/extensions/vscode/server/License.txt +879 -0
- data/extensions/vscode/server/package-lock.json +236 -0
- data/extensions/vscode/server/package.json +29 -0
- data/extensions/vscode/server/src/server.ts +59 -0
- data/extensions/vscode/server/tsconfig.json +16 -0
- data/install/Gemfile +1 -1
- data/install/Launcher.bat +1 -9
- data/install/config/dart/Gemfile +3 -8
- data/install/config/data/crc.txt +148 -132
- data/install/config/system/system.txt +36 -3
- data/install/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
- data/install/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
- data/install/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
- data/install/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
- data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/install/config/tools/handbook_creator/assets/img/ball_logo.bmp +0 -0
- data/install/config/tools/handbook_creator/assets/img/ball_logo.gif +0 -0
- data/install/config/tools/handbook_creator/assets/img/ball_logo.jpg +0 -0
- data/install/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
- data/install/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
- data/install/config/tools/handbook_creator/assets/js/html5shiv.js +8 -0
- data/install/config/tools/handbook_creator/assets/js/jquery-1.10.2.min.js +6 -0
- data/install/config/tools/handbook_creator/assets/js/respond.min.js +6 -0
- data/install/config/tools/handbook_creator/default_toc.xsl +59 -59
- data/lib/cosmos/config/config_parser.rb +4 -5
- data/lib/cosmos/conversions.rb +2 -0
- data/lib/cosmos/conversions/packet_time_formatted_conversion.rb +38 -0
- data/lib/cosmos/conversions/packet_time_seconds_conversion.rb +38 -0
- data/lib/cosmos/core_ext/cosmos_io.rb +2 -1
- data/lib/cosmos/core_ext/time.rb +3 -1
- data/lib/cosmos/dart/config/boot.rb +1 -1
- data/lib/cosmos/dart/config/database.yml +2 -0
- data/lib/cosmos/dart/examples/dart_decom_client.rb +1 -1
- data/lib/cosmos/dart/examples/dart_stream_client.rb +6 -2
- data/lib/cosmos/dart/lib/dart_common.rb +13 -6
- data/lib/cosmos/dart/lib/dart_constants.rb +15 -0
- data/lib/cosmos/dart/lib/dart_database_cleaner.rb +2 -2
- data/lib/cosmos/dart/lib/dart_decom_query.rb +5 -6
- data/lib/cosmos/dart/lib/dart_decommutator.rb +64 -54
- data/lib/cosmos/dart/lib/dart_importer.rb +3 -3
- data/lib/cosmos/dart/lib/dart_master_query.rb +71 -0
- data/lib/cosmos/dart/lib/dart_packet_log_writer.rb +2 -2
- data/lib/cosmos/dart/lib/dart_reducer_worker_thread.rb +165 -134
- data/lib/cosmos/dart/processes/dart.rb +4 -2
- data/lib/cosmos/dart/processes/dart_decom_server.rb +3 -3
- data/lib/cosmos/dart/processes/dart_ingester.rb +40 -1
- data/lib/cosmos/dart/processes/dart_master.rb +44 -0
- data/lib/cosmos/dart/processes/dart_util.rb +119 -4
- data/lib/cosmos/dart/spec/dart/dart_reducer_manager_spec.rb +3 -3
- data/lib/cosmos/gui/dialogs/cmd_tlm_raw_dialog.rb +9 -5
- data/lib/cosmos/gui/dialogs/details_dialog.rb +44 -29
- data/lib/cosmos/gui/dialogs/exception_list_dialog.rb +1 -1
- data/lib/cosmos/gui/dialogs/find_replace_dialog.rb +3 -3
- data/lib/cosmos/gui/dialogs/interface_raw_dialog.rb +2 -2
- data/lib/cosmos/gui/dialogs/set_tlm_dialog.rb +1 -1
- data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +11 -10
- data/lib/cosmos/gui/dialogs/tlm_graph_dialog.rb +4 -2
- data/lib/cosmos/gui/opengl/earth_model.rb +1 -1
- data/lib/cosmos/gui/qt.rb +13 -2
- data/lib/cosmos/gui/qt_tool.rb +71 -43
- data/lib/cosmos/gui/text/ruby_editor.rb +91 -49
- data/lib/cosmos/gui/utilities/classification_banner.rb +60 -0
- data/lib/cosmos/gui/utilities/screenshot.rb +1 -1
- data/lib/cosmos/gui/utilities/script_module_gui.rb +117 -91
- data/lib/cosmos/gui/widgets/dart_meta_frame.rb +22 -3
- data/lib/cosmos/interfaces.rb +2 -0
- data/lib/cosmos/interfaces/dart_status_interface.rb +1 -1
- data/lib/cosmos/interfaces/interface.rb +9 -1
- data/lib/cosmos/interfaces/linc_interface.rb +3 -3
- data/lib/cosmos/interfaces/protocols/burst_protocol.rb +1 -1
- data/lib/cosmos/interfaces/protocols/crc_protocol.rb +1 -1
- data/lib/cosmos/interfaces/protocols/fixed_protocol.rb +40 -18
- data/lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb +46 -0
- data/lib/cosmos/interfaces/protocols/length_protocol.rb +5 -0
- data/lib/cosmos/interfaces/protocols/preidentified_protocol.rb +68 -23
- data/lib/cosmos/interfaces/protocols/template_protocol.rb +9 -4
- data/lib/cosmos/interfaces/serial_interface.rb +7 -1
- data/lib/cosmos/interfaces/simulated_target_interface.rb +14 -5
- data/lib/cosmos/interfaces/stream_interface.rb +1 -1
- data/lib/cosmos/interfaces/tcpip_server_interface.rb +13 -13
- data/lib/cosmos/io/json_drb.rb +16 -12
- data/lib/cosmos/io/json_drb_object.rb +7 -2
- data/lib/cosmos/io/json_drb_rack.rb +25 -5
- data/lib/cosmos/io/json_rpc.rb +1 -1
- data/lib/cosmos/io/posix_serial_driver.rb +60 -22
- data/lib/cosmos/io/serial_driver.rb +11 -8
- data/lib/cosmos/io/win32_serial_driver.rb +31 -3
- data/lib/cosmos/packet_logs/packet_log_reader.rb +71 -28
- data/lib/cosmos/packet_logs/packet_log_writer.rb +13 -1
- data/lib/cosmos/packets/commands.rb +30 -9
- data/lib/cosmos/packets/packet.rb +105 -34
- data/lib/cosmos/packets/packet_config.rb +60 -10
- data/lib/cosmos/packets/parsers/format_string_parser.rb +0 -1
- data/lib/cosmos/packets/parsers/state_parser.rb +0 -1
- data/lib/cosmos/packets/parsers/xtce_converter.rb +2 -0
- data/lib/cosmos/packets/parsers/xtce_parser.rb +5 -4
- data/lib/cosmos/packets/structure.rb +32 -4
- data/lib/cosmos/packets/structure_item.rb +5 -1
- data/lib/cosmos/packets/telemetry.rb +30 -4
- data/lib/cosmos/script/api_shared.rb +22 -10
- data/lib/cosmos/script/extract.rb +1 -1
- data/lib/cosmos/script/limits.rb +4 -0
- data/lib/cosmos/script/script.rb +29 -20
- data/lib/cosmos/script/scripting.rb +16 -14
- data/lib/cosmos/script/telemetry.rb +3 -1
- data/lib/cosmos/script/tools.rb +18 -8
- data/lib/cosmos/streams/serial_stream.rb +11 -6
- data/lib/cosmos/system/system.rb +214 -76
- data/lib/cosmos/system/target.rb +39 -9
- data/lib/cosmos/tools/cmd_extractor/cmd_extractor.rb +116 -55
- data/lib/cosmos/tools/cmd_sender/cmd_param_table_item_delegate.rb +15 -0
- data/lib/cosmos/tools/cmd_sender/cmd_params.rb +382 -0
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +54 -340
- data/lib/cosmos/tools/cmd_sequence/cmd_sequence.rb +74 -52
- data/lib/cosmos/tools/cmd_sequence/sequence_item.rb +40 -333
- data/lib/cosmos/tools/cmd_sequence/sequence_list.rb +16 -11
- data/lib/cosmos/tools/cmd_tlm_server/api.rb +13 -0
- data/lib/cosmos/tools/cmd_tlm_server/background_tasks.rb +2 -0
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +44 -15
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +8 -1
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +18 -20
- data/lib/cosmos/tools/cmd_tlm_server/commanding.rb +13 -2
- data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +2 -2
- data/lib/cosmos/tools/cmd_tlm_server/gui/logging_tab.rb +13 -13
- data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +9 -6
- data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +8 -8
- data/lib/cosmos/tools/cmd_tlm_server/gui/targets_tab.rb +5 -5
- data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +35 -20
- data/lib/cosmos/tools/cmd_tlm_server/replay_backend.rb +15 -11
- data/lib/cosmos/tools/cmd_tlm_server/router_thread.rb +5 -0
- data/lib/cosmos/tools/cmd_tlm_server/routers.rb +2 -0
- data/lib/cosmos/tools/config_editor/config_editor.rb +181 -94
- data/lib/cosmos/tools/config_editor/config_editor_frame.rb +10 -9
- data/lib/cosmos/tools/config_editor/system_config_dialog.rb +158 -0
- data/lib/cosmos/tools/data_viewer/data_viewer.rb +57 -47
- data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +1 -0
- data/lib/cosmos/tools/data_viewer/dump_component.rb +3 -9
- data/lib/cosmos/tools/data_viewer/text_component.rb +77 -0
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +68 -42
- data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +1 -1
- data/lib/cosmos/tools/launcher/launcher.rb +2 -1
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +59 -41
- data/lib/cosmos/tools/opengl_builder/opengl_builder.rb +42 -42
- data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +64 -59
- data/lib/cosmos/tools/script_runner/script_runner.rb +198 -123
- data/lib/cosmos/tools/script_runner/script_runner_config.rb +14 -0
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +87 -35
- data/lib/cosmos/tools/table_manager/table_config.rb +5 -3
- data/lib/cosmos/tools/table_manager/table_manager.rb +48 -45
- data/lib/cosmos/tools/test_runner/test.rb +5 -2
- data/lib/cosmos/tools/test_runner/test_runner.rb +61 -38
- data/lib/cosmos/tools/test_runner/test_runner_chooser.rb +24 -12
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +48 -48
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb +5 -8
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +20 -16
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +3 -3
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +7 -7
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb +10 -10
- data/lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb +10 -3
- data/lib/cosmos/tools/tlm_grapher/data_objects/xy_data_object.rb +6 -6
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb +14 -14
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_dart_thread.rb +21 -17
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_realtime_thread.rb +5 -8
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tool.rb +94 -91
- data/lib/cosmos/tools/tlm_grapher/tlm_grapher.rb +27 -26
- data/lib/cosmos/tools/tlm_viewer/screen.rb +76 -14
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +51 -34
- data/lib/cosmos/tools/tlm_viewer/widgets.rb +3 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/aging_widget.rb +4 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/array_widget.rb +3 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/block_widget.rb +4 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/canvas_clickable.rb +16 -2
- data/lib/cosmos/tools/tlm_viewer/widgets/canvas_widget.rb +17 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasdot_widget.rb +1 -2
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasellipse_widget.rb +40 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb +12 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasimagevalue_widget.rb +79 -29
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabel_widget.rb +1 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabelvalue_widget.rb +2 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasline_widget.rb +2 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslinevalue_widget.rb +4 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasvalue_widget.rb +33 -25
- data/lib/cosmos/tools/tlm_viewer/widgets/checkbutton_widget.rb +5 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb +5 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/formatfontvalue_widget.rb +1 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/formatvalue_widget.rb +4 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/horizontal_widget.rb +5 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/horizontalbox_widget.rb +6 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/horizontalline_widget.rb +2 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/label_widget.rb +10 -8
- data/lib/cosmos/tools/tlm_viewer/widgets/labelformatvalue_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/labelled_widget.rb +58 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/labelprogressbar_widget.rb +3 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/labeltrendlimitsbar_widget.rb +2 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvalue_widget.rb +2 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluedesc_widget.rb +3 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitsbar_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitscolumn_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangebar_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangecolumn_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/layout_widget.rb +3 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/led_widget.rb +108 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/limits_widget.rb +60 -10
- data/lib/cosmos/tools/tlm_viewer/widgets/limitsbar_widget.rb +22 -8
- data/lib/cosmos/tools/tlm_viewer/widgets/limitscolor_widget.rb +19 -13
- data/lib/cosmos/tools/tlm_viewer/widgets/limitscolumn_widget.rb +22 -8
- data/lib/cosmos/tools/tlm_viewer/widgets/linegraph_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/matrixbycolumns_widget.rb +4 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/multi_widget.rb +1 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/progressbar_widget.rb +10 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/radiobutton_widget.rb +7 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/rangebar_widget.rb +4 -6
- data/lib/cosmos/tools/tlm_viewer/widgets/rangecolumn_widget.rb +3 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/screenshotbutton_widget.rb +4 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/scrollwindow_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/sectionheader_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/spacer_widget.rb +4 -6
- data/lib/cosmos/tools/tlm_viewer/widgets/tabbook_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/tabitem_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/textbox_widget.rb +13 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/textfield_widget.rb +3 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/timegraph_widget.rb +3 -8
- data/lib/cosmos/tools/tlm_viewer/widgets/title_widget.rb +6 -12
- data/lib/cosmos/tools/tlm_viewer/widgets/trendbar_widget.rb +5 -10
- data/lib/cosmos/tools/tlm_viewer/widgets/trendlimitsbar_widget.rb +5 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/value_widget.rb +4 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/valuelimitsbar_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/valuelimitscolumn_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/valuerangebar_widget.rb +3 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/valuerangecolumn_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/vertical_widget.rb +8 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/verticalbox_widget.rb +9 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/widget.rb +60 -47
- data/lib/cosmos/top_level.rb +37 -13
- data/lib/cosmos/utilities/ruby_lex_utils.rb +34 -30
- data/lib/cosmos/version.rb +5 -5
- data/lib/cosmos/win32/excel.rb +81 -24
- data/make_gems.sh +10 -0
- data/run_gui_tests.bat +1 -0
- data/spec/conversions/packet_time_formatted_conversion_spec.rb +58 -0
- data/spec/conversions/packet_time_seconds_conversion_spec.rb +60 -0
- data/spec/core_ext/socket_spec.rb +1 -1
- data/spec/core_ext/time_spec.rb +4 -0
- data/spec/gui/utilities/script_module_gui_spec.rb +44 -63
- data/spec/install/config/targets/INST/cmd_tlm/inst_cmds.txt +1 -1
- data/spec/install/config/targets/INST/cmd_tlm/inst_tlm.txt +5 -5
- data/spec/install/yaml_docs_spec.rb +132 -0
- data/spec/interfaces/linc_interface_spec.rb +1 -1
- data/spec/interfaces/protocols/fixed_protocol_spec.rb +20 -9
- data/spec/interfaces/protocols/ignore_packet_protocol_spec.rb +243 -0
- data/spec/interfaces/protocols/length_protocol_spec.rb +39 -0
- data/spec/interfaces/protocols/preidentified_protocol_spec.rb +227 -4
- data/spec/interfaces/protocols/template_protocol_spec.rb +78 -25
- data/spec/io/json_drb_rack_spec.rb +166 -0
- data/spec/io/json_drb_spec.rb +14 -0
- data/spec/io/json_rpc_spec.rb +4 -5
- data/spec/io/posix_serial_driver_spec.rb +81 -0
- data/spec/io/serial_driver_spec.rb +15 -13
- data/spec/io/win32_serial_driver_spec.rb +33 -3
- data/spec/packet_logs/packet_log_reader_spec.rb +106 -52
- data/spec/packets/commands_spec.rb +22 -0
- data/spec/packets/packet_config_spec.rb +29 -16
- data/spec/packets/packet_item_spec.rb +2 -2
- data/spec/packets/packet_spec.rb +39 -6
- data/spec/packets/parsers/format_string_parser_spec.rb +0 -11
- data/spec/packets/parsers/macro_parser_spec.rb +36 -36
- data/spec/packets/parsers/state_parser_spec.rb +69 -11
- data/spec/packets/structure_spec.rb +93 -2
- data/spec/packets/telemetry_spec.rb +63 -10
- data/spec/script/extract_spec.rb +4 -1
- data/spec/script/script_spec.rb +2 -3
- data/spec/script/scripting_spec.rb +2 -1
- data/spec/script/tools_spec.rb +0 -1
- data/spec/streams/tcpip_socket_stream_spec.rb +32 -27
- data/spec/system/system_spec.rb +187 -4
- data/spec/system/target_spec.rb +62 -1
- data/spec/tools/cmd_tlm_server/api_spec.rb +29 -21
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +15 -7
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +33 -0
- data/spec/tools/cmd_tlm_server/commanding_spec.rb +25 -1
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +15 -0
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +2 -3
- data/spec/top_level/top_level_spec.rb +29 -5
- data/spec/utilities/message_log_spec.rb +6 -3
- data/tasks/gemfile_stats.rake +38 -14
- data/test/performance/config/system/system.txt +0 -0
- data/test/performance/config/targets/PACKET/cmd_tlm/packet_tlm.txt +5 -5
- data/test/performance/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
- data/test/performance/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
- data/test/performance/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
- data/test/performance/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
- data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/test/performance/config/tools/handbook_creator/assets/img/ball_logo.bmp +0 -0
- data/test/performance/config/tools/handbook_creator/assets/img/ball_logo.gif +0 -0
- data/test/performance/config/tools/handbook_creator/assets/img/ball_logo.jpg +0 -0
- data/test/performance/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
- data/test/performance/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
- data/test/performance/config/tools/handbook_creator/assets/js/html5shiv.js +8 -0
- data/test/performance/config/tools/handbook_creator/assets/js/jquery-1.10.2.min.js +6 -0
- data/test/performance/config/tools/handbook_creator/assets/js/respond.min.js +6 -0
- data/test/performance/config/tools/test_runner/test_runner.txt +1 -1
- data/test/performance/procedures/cosmos_api_test.rb +1 -1
- data/test/performance/tools/identify_performance.rb +82 -0
- metadata +146 -62
- data/lib/cosmos/dart/Gemfile +0 -69
|
@@ -130,7 +130,7 @@ module Cosmos
|
|
|
130
130
|
return [target_name, packet_name, item_name, comparison_to_eval] if split_string.length == 3
|
|
131
131
|
raise "ERROR: Check improperly specified: #{text}" if split_string.length < 4
|
|
132
132
|
split_string = text.split(/ /) # Split on regex spaces to preserve spaces in comparison
|
|
133
|
-
index = split_string.
|
|
133
|
+
index = split_string.rindex(item_name)
|
|
134
134
|
comparison_to_eval = split_string[(index + 1)..(split_string.length - 1)].join(" ")
|
|
135
135
|
raise "ERROR: Use '==' instead of '=': #{text}" if split_string[3] == '='
|
|
136
136
|
return [target_name, packet_name, item_name, comparison_to_eval]
|
data/lib/cosmos/script/limits.rb
CHANGED
|
@@ -98,6 +98,10 @@ module Cosmos
|
|
|
98
98
|
if result[0] == :LIMITS_CHANGE
|
|
99
99
|
result[1][3] = result[1][3].to_s.intern if result[1][3]
|
|
100
100
|
result[1][4] = result[1][4].to_s.intern if result[1][4]
|
|
101
|
+
if result[1][5] and result[1][6]
|
|
102
|
+
result[1][5] = Time.at(result[1][5], result[1][6]).sys
|
|
103
|
+
result[1].delete_at(6)
|
|
104
|
+
end
|
|
101
105
|
elsif result[0] == :LIMITS_SETTINGS
|
|
102
106
|
result[1][3] = result[1][3].to_s.intern if result[1][3]
|
|
103
107
|
elsif result[0] == :STALE_PACKET
|
data/lib/cosmos/script/script.rb
CHANGED
|
@@ -21,16 +21,10 @@ require 'cosmos/script/tools'
|
|
|
21
21
|
|
|
22
22
|
$cmd_tlm_server = nil
|
|
23
23
|
$disconnected_targets = nil
|
|
24
|
+
$disconnect_all_targets = false
|
|
24
25
|
$cmd_tlm_replay_mode = false
|
|
25
26
|
|
|
26
27
|
module Cosmos
|
|
27
|
-
# Error raised by the API when a check fails
|
|
28
|
-
class CheckError < RuntimeError; end
|
|
29
|
-
# Error raised when a Script should be stopped
|
|
30
|
-
class StopScript < StandardError; end
|
|
31
|
-
# Error raised when a TestCase should be skipped by TestRunner
|
|
32
|
-
class SkipTestCase < StandardError; end
|
|
33
|
-
|
|
34
28
|
# Provides a proxy to both a disconnected CmdTlmServer instance and the real
|
|
35
29
|
# JsonDRbObject which communicates with the real CmdTlmServer. If targets
|
|
36
30
|
# are disconnected their method calls are forwarded to the disconnected
|
|
@@ -48,9 +42,9 @@ module Cosmos
|
|
|
48
42
|
end
|
|
49
43
|
# Start a Json connect to the real server
|
|
50
44
|
if $cmd_tlm_replay_mode
|
|
51
|
-
@cmd_tlm_server = JsonDRbObject.new(System.connect_hosts['REPLAY_API'], System.ports['REPLAY_API'])
|
|
45
|
+
@cmd_tlm_server = JsonDRbObject.new(System.connect_hosts['REPLAY_API'], System.ports['REPLAY_API'], 1.0, Cosmos::System.x_csrf_token)
|
|
52
46
|
else
|
|
53
|
-
@cmd_tlm_server = JsonDRbObject.new(System.connect_hosts['CTS_API'], System.ports['CTS_API'])
|
|
47
|
+
@cmd_tlm_server = JsonDRbObject.new(System.connect_hosts['CTS_API'], System.ports['CTS_API'], 1.0, Cosmos::System.x_csrf_token)
|
|
54
48
|
end
|
|
55
49
|
end
|
|
56
50
|
|
|
@@ -58,16 +52,6 @@ module Cosmos
|
|
|
58
52
|
# us to proxy the methods to either the disconnected CmdTlmServer object
|
|
59
53
|
# or to the real server through the JsonDRbObject.
|
|
60
54
|
def method_missing(method_name, *method_params)
|
|
61
|
-
if $disconnected_targets && method_params[0].is_a?(String)
|
|
62
|
-
if method_params.length == 1
|
|
63
|
-
target = method_params[0].split(" ")[0]
|
|
64
|
-
else
|
|
65
|
-
target = method_params[0]
|
|
66
|
-
end
|
|
67
|
-
if $disconnected_targets.include?(target)
|
|
68
|
-
return @disconnected.send(method_name, *method_params)
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
55
|
# Must call shutdown and disconnect on the JsonDrbObject itself
|
|
72
56
|
# to avoid it being sent to the CmdTlmServer
|
|
73
57
|
case method_name
|
|
@@ -77,6 +61,28 @@ module Cosmos
|
|
|
77
61
|
when :disconnect
|
|
78
62
|
@cmd_tlm_server.disconnect
|
|
79
63
|
else
|
|
64
|
+
if $disconnect_all_targets
|
|
65
|
+
return @disconnected.send(method_name, *method_params)
|
|
66
|
+
elsif $disconnected_targets
|
|
67
|
+
name_string = nil
|
|
68
|
+
if method_params[0].is_a?(String)
|
|
69
|
+
name_string = method_params[0]
|
|
70
|
+
elsif method_params[0].is_a?(Array)
|
|
71
|
+
if method_params[0][0].is_a?(Array)
|
|
72
|
+
if method_params[0][0][0].is_a?(String)
|
|
73
|
+
name_string = method_params[0][0][0]
|
|
74
|
+
end
|
|
75
|
+
elsif method_params[0][0].is_a?(String)
|
|
76
|
+
name_string = method_params[0][0]
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
if name_string
|
|
80
|
+
target = name_string.split(" ")[0]
|
|
81
|
+
if $disconnected_targets.include?(target)
|
|
82
|
+
return @disconnected.send(method_name, *method_params)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
80
86
|
@cmd_tlm_server.method_missing(method_name, *method_params)
|
|
81
87
|
end
|
|
82
88
|
end
|
|
@@ -95,6 +101,7 @@ module Cosmos
|
|
|
95
101
|
# Called when this module is mixed in using "include Cosmos::Script"
|
|
96
102
|
def self.included(base)
|
|
97
103
|
$disconnected_targets = nil
|
|
104
|
+
$disconnect_all_targets = false
|
|
98
105
|
$cmd_tlm_replay_mode = false
|
|
99
106
|
$cmd_tlm_server = nil
|
|
100
107
|
initialize_script_module()
|
|
@@ -109,8 +116,9 @@ module Cosmos
|
|
|
109
116
|
$cmd_tlm_server.shutdown if $cmd_tlm_server
|
|
110
117
|
end
|
|
111
118
|
|
|
112
|
-
def set_disconnected_targets(targets, config_file = CmdTlmServer::DEFAULT_CONFIG_FILE)
|
|
119
|
+
def set_disconnected_targets(targets, all = false, config_file = CmdTlmServer::DEFAULT_CONFIG_FILE)
|
|
113
120
|
$disconnected_targets = targets
|
|
121
|
+
$disconnect_all_targets = all
|
|
114
122
|
initialize_script_module(config_file)
|
|
115
123
|
end
|
|
116
124
|
|
|
@@ -120,6 +128,7 @@ module Cosmos
|
|
|
120
128
|
|
|
121
129
|
def clear_disconnected_targets
|
|
122
130
|
$disconnected_targets = nil
|
|
131
|
+
$disconnect_all_targets = false
|
|
123
132
|
end
|
|
124
133
|
|
|
125
134
|
def script_disconnect
|
|
@@ -56,20 +56,20 @@ module Cosmos
|
|
|
56
56
|
return value
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
def prompt(string)
|
|
60
|
-
prompt_to_continue(string)
|
|
59
|
+
def prompt(string, **options)
|
|
60
|
+
prompt_to_continue(string, options)
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
def message_box(string, *buttons)
|
|
64
|
-
prompt_message_box(string, buttons)
|
|
63
|
+
def message_box(string, *buttons, **options)
|
|
64
|
+
prompt_message_box(string, buttons, options)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
def vertical_message_box(string, *buttons)
|
|
68
|
-
prompt_vertical_message_box(string, buttons)
|
|
67
|
+
def vertical_message_box(string, *buttons, **options)
|
|
68
|
+
prompt_vertical_message_box(string, buttons, options)
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
def combo_box(string, *options)
|
|
72
|
-
prompt_combo_box(string, options)
|
|
71
|
+
def combo_box(string, *items, **options)
|
|
72
|
+
prompt_combo_box(string, items, options)
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
def _file_dialog(message, directory, filter, select_files = true)
|
|
@@ -123,22 +123,24 @@ module Cosmos
|
|
|
123
123
|
end
|
|
124
124
|
end
|
|
125
125
|
|
|
126
|
-
def prompt_to_continue(string)
|
|
126
|
+
def prompt_to_continue(string, text_color: nil, background_color: nil, font_size: nil, font_family: nil, details: nil)
|
|
127
127
|
print "#{string}: "
|
|
128
|
+
print "Details: #{details}\n" if details
|
|
128
129
|
gets.chomp
|
|
129
130
|
end
|
|
130
131
|
|
|
131
|
-
def prompt_message_box(string, buttons)
|
|
132
|
+
def prompt_message_box(string, buttons, text_color: nil, background_color: nil, font_size: nil, font_family: nil, details: nil)
|
|
132
133
|
print "#{string} (#{buttons.join(", ")}): "
|
|
134
|
+
print "Details: #{details}\n" if details
|
|
133
135
|
gets.chomp
|
|
134
136
|
end
|
|
135
137
|
|
|
136
|
-
def prompt_vertical_message_box(string, options)
|
|
137
|
-
prompt_message_box(string, options)
|
|
138
|
+
def prompt_vertical_message_box(string, buttons, options)
|
|
139
|
+
prompt_message_box(string, buttons, options)
|
|
138
140
|
end
|
|
139
141
|
|
|
140
|
-
def prompt_combo_box(string, options)
|
|
141
|
-
prompt_message_box(string, options)
|
|
142
|
+
def prompt_combo_box(string, items, options)
|
|
143
|
+
prompt_message_box(string, items, options)
|
|
142
144
|
end
|
|
143
145
|
end
|
|
144
146
|
end
|
|
@@ -203,12 +203,14 @@ module Cosmos
|
|
|
203
203
|
packet = nil
|
|
204
204
|
# The get_packet_data above returns a Ruby time after the packet_name.
|
|
205
205
|
# This is different from the API.s
|
|
206
|
-
buffer, target_name, packet_name, time, rx_count = get_packet_data(id, non_block)
|
|
206
|
+
buffer, target_name, packet_name, time, rx_count, stored, extra = get_packet_data(id, non_block)
|
|
207
207
|
if buffer
|
|
208
208
|
packet = System.telemetry.packet(target_name, packet_name).clone
|
|
209
209
|
packet.buffer = buffer
|
|
210
210
|
packet.received_time = time
|
|
211
211
|
packet.received_count = rx_count
|
|
212
|
+
packet.stored = stored
|
|
213
|
+
packet.extra = extra
|
|
212
214
|
end
|
|
213
215
|
packet
|
|
214
216
|
end
|
data/lib/cosmos/script/tools.rb
CHANGED
|
@@ -67,20 +67,20 @@ module Cosmos
|
|
|
67
67
|
# Methods for debugging
|
|
68
68
|
#######################################
|
|
69
69
|
|
|
70
|
-
def insert_return(*params)
|
|
71
|
-
_ensure_script_runner_frame do
|
|
72
|
-
ScriptRunnerFrame.instance.inline_return = true
|
|
73
|
-
ScriptRunnerFrame.instance.inline_return_params = params
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
70
|
def step_mode
|
|
78
71
|
if defined? ScriptRunnerFrame
|
|
72
|
+
# Ensure the Frame has toggled to debug so the user can see the Step button
|
|
73
|
+
_ensure_script_runner_frame do
|
|
74
|
+
Qt.execute_in_main_thread do
|
|
75
|
+
ScriptRunnerFrame.instance.toggle_debug(true)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
79
78
|
ScriptRunnerFrame.step_mode = true
|
|
80
79
|
end
|
|
81
80
|
end
|
|
82
81
|
|
|
83
82
|
def run_mode
|
|
83
|
+
# Run mode simply disables step mode. Debug frame may or may not be displayed.
|
|
84
84
|
if defined? ScriptRunnerFrame
|
|
85
85
|
ScriptRunnerFrame.step_mode = false
|
|
86
86
|
end
|
|
@@ -104,7 +104,17 @@ module Cosmos
|
|
|
104
104
|
# Get a specific screen definition
|
|
105
105
|
def get_screen_definition(screen_full_name, config_filename = nil, force_refresh = false)
|
|
106
106
|
$cmd_tlm_server.get_screen_definition(screen_full_name, config_filename, force_refresh)
|
|
107
|
-
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Show a local telemetry screen
|
|
110
|
+
def local_screen(title = 'Local Screen', screen_def = nil, x_pos = nil, y_pos = nil, &block)
|
|
111
|
+
# See script_module_gui.rb
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Close all local telemetry screens
|
|
115
|
+
def close_local_screens
|
|
116
|
+
# See script_module_gui.rb
|
|
117
|
+
end
|
|
108
118
|
|
|
109
119
|
end # module Script
|
|
110
120
|
|
|
@@ -35,8 +35,10 @@ module Cosmos
|
|
|
35
35
|
# complete. Pass nil to create no timeout. The {SerialDriver} will
|
|
36
36
|
# continously try to read data until it has received data or an error
|
|
37
37
|
# occurs.
|
|
38
|
-
# @param flow_control [Symbol] Currently supported :NONE
|
|
38
|
+
# @param flow_control [Symbol] Currently supported :NONE, :RTSCTS (default :NONE)
|
|
39
39
|
# @param data_bits [Integer] Number of data bits (default 8)
|
|
40
|
+
# @param struct [Array] Array of arrays of fields and values to set in the
|
|
41
|
+
# Windows DCB or POSIX structure
|
|
40
42
|
def initialize(write_port_name,
|
|
41
43
|
read_port_name,
|
|
42
44
|
baud_rate,
|
|
@@ -45,7 +47,8 @@ module Cosmos
|
|
|
45
47
|
write_timeout,
|
|
46
48
|
read_timeout,
|
|
47
49
|
flow_control = :NONE,
|
|
48
|
-
data_bits = 8
|
|
50
|
+
data_bits = 8,
|
|
51
|
+
struct = [])
|
|
49
52
|
super()
|
|
50
53
|
|
|
51
54
|
# The SerialDriver class will validate the parameters
|
|
@@ -69,7 +72,8 @@ module Cosmos
|
|
|
69
72
|
@write_timeout,
|
|
70
73
|
@read_timeout,
|
|
71
74
|
@flow_control,
|
|
72
|
-
@data_bits
|
|
75
|
+
@data_bits,
|
|
76
|
+
struct)
|
|
73
77
|
else
|
|
74
78
|
@write_serial_port = nil
|
|
75
79
|
end
|
|
@@ -84,7 +88,8 @@ module Cosmos
|
|
|
84
88
|
@write_timeout,
|
|
85
89
|
@read_timeout,
|
|
86
90
|
@flow_control,
|
|
87
|
-
@data_bits
|
|
91
|
+
@data_bits,
|
|
92
|
+
struct)
|
|
88
93
|
end
|
|
89
94
|
else
|
|
90
95
|
@read_serial_port = nil
|
|
@@ -151,5 +156,5 @@ module Cosmos
|
|
|
151
156
|
@connected = false
|
|
152
157
|
end
|
|
153
158
|
end
|
|
154
|
-
end
|
|
155
|
-
end
|
|
159
|
+
end
|
|
160
|
+
end
|
data/lib/cosmos/system/system.rb
CHANGED
|
@@ -20,6 +20,7 @@ require 'drb/acl'
|
|
|
20
20
|
require 'zip'
|
|
21
21
|
require 'zip/filesystem'
|
|
22
22
|
require 'bundler'
|
|
23
|
+
require 'thread'
|
|
23
24
|
|
|
24
25
|
module Cosmos
|
|
25
26
|
# System is the primary entry point into the COSMOS framework. It captures
|
|
@@ -29,7 +30,7 @@ module Cosmos
|
|
|
29
30
|
# #targets variable provides access to all the targets defined by the system.
|
|
30
31
|
# Its primary responsibily is to load the system configuration file and
|
|
31
32
|
# create all the Target instances. It also saves and restores configurations
|
|
32
|
-
# using a
|
|
33
|
+
# using a hashing checksum over the entire configuration to detect changes.
|
|
33
34
|
class System
|
|
34
35
|
# @return [Hash<String,Fixnum>] Hash of all the known ports and their values
|
|
35
36
|
instance_attr_reader :ports
|
|
@@ -67,20 +68,36 @@ module Cosmos
|
|
|
67
68
|
instance_attr_reader :limits_set
|
|
68
69
|
# @return [Boolean] Whether to use UTC or local times
|
|
69
70
|
instance_attr_reader :use_utc
|
|
70
|
-
# @return [Array<String>] List of files that are to be included in the
|
|
71
|
+
# @return [Array<String>] List of files that are to be included in the hashing
|
|
71
72
|
# calculation in addition to the cmd/tlm definition files that are
|
|
72
73
|
# automatically included
|
|
73
|
-
instance_attr_reader :
|
|
74
|
+
instance_attr_reader :additional_hashing_files
|
|
75
|
+
# @return [Hash<String,String>] Hash of the text/color to use for the classificaiton banner
|
|
76
|
+
instance_attr_reader :classificiation_banner
|
|
77
|
+
# @return [String] Which hashing algorithm is in use
|
|
78
|
+
instance_attr_reader :hashing_algorithm
|
|
79
|
+
# @return [Boolean] Allow router commanding - defaults to false
|
|
80
|
+
instance_attr_reader :allow_router_commanding
|
|
81
|
+
# @return [String] API access secret using X-Csrf-Token - defaults to SuperSecret
|
|
82
|
+
instance_attr_reader :x_csrf_token
|
|
83
|
+
# @return [Array<String>] Allowed origins in http origin header - defaults to no origin header only
|
|
84
|
+
instance_attr_reader :allowed_origins
|
|
85
|
+
# @return [Array<String>] Allowed hosts in http host header - defaults to '127.0.0.1:7777' only
|
|
86
|
+
instance_attr_reader :allowed_hosts
|
|
74
87
|
|
|
75
88
|
# Known COSMOS ports
|
|
76
|
-
KNOWN_PORTS = ['CTS_API', 'TLMVIEWER_API', 'CTS_PREIDENTIFIED', 'CTS_CMD_ROUTER', 'REPLAY_API', 'REPLAY_PREIDENTIFIED', 'REPLAY_CMD_ROUTER', 'DART_STREAM', 'DART_DECOM']
|
|
89
|
+
KNOWN_PORTS = ['CTS_API', 'TLMVIEWER_API', 'CTS_PREIDENTIFIED', 'CTS_CMD_ROUTER', 'REPLAY_API', 'REPLAY_PREIDENTIFIED', 'REPLAY_CMD_ROUTER', 'DART_STREAM', 'DART_DECOM', 'DART_MASTER']
|
|
90
|
+
API_PORTS = ['CTS_API', 'TLMVIEWER_API', 'REPLAY_API', 'DART_DECOM', 'DART_MASTER']
|
|
77
91
|
# Known COSMOS hosts
|
|
78
|
-
KNOWN_HOSTS = ['CTS_API', 'TLMVIEWER_API', 'CTS_PREIDENTIFIED', 'CTS_CMD_ROUTER', 'REPLAY_API', 'REPLAY_PREIDENTIFIED', 'REPLAY_CMD_ROUTER', 'DART_STREAM', 'DART_DECOM']
|
|
92
|
+
KNOWN_HOSTS = ['CTS_API', 'TLMVIEWER_API', 'CTS_PREIDENTIFIED', 'CTS_CMD_ROUTER', 'REPLAY_API', 'REPLAY_PREIDENTIFIED', 'REPLAY_CMD_ROUTER', 'DART_STREAM', 'DART_DECOM', 'DART_MASTER']
|
|
79
93
|
# Known COSMOS paths
|
|
80
94
|
KNOWN_PATHS = ['LOGS', 'TMP', 'SAVED_CONFIG', 'TABLES', 'HANDBOOKS', 'PROCEDURES', 'SEQUENCES', 'DART_DATA', 'DART_LOGS']
|
|
95
|
+
# Supported hashing algorithms
|
|
96
|
+
SUPPORTED_HASHING_ALGORITHMS = ['MD5', 'RMD160', 'SHA1', 'SHA256', 'SHA384', 'SHA512']
|
|
81
97
|
|
|
82
98
|
@@instance = nil
|
|
83
99
|
@@instance_mutex = Mutex.new
|
|
100
|
+
@@instance_filename = nil
|
|
84
101
|
|
|
85
102
|
# Create a new System object. Note, this should not be called directly but
|
|
86
103
|
# you should instead use System.instance and treat this class as a
|
|
@@ -90,6 +107,7 @@ module Cosmos
|
|
|
90
107
|
# read. Be default this is <Cosmos::USERPATH>/config/system/system.txt
|
|
91
108
|
def initialize(filename = nil)
|
|
92
109
|
raise "Cosmos::System created twice" unless @@instance.nil?
|
|
110
|
+
@@instance_filename = filename
|
|
93
111
|
reset_variables(filename)
|
|
94
112
|
@@instance = self
|
|
95
113
|
end
|
|
@@ -189,11 +207,12 @@ module Cosmos
|
|
|
189
207
|
@targets = {}
|
|
190
208
|
# Set config to nil so things will lazy load later
|
|
191
209
|
@config = nil
|
|
210
|
+
@meta_init_filename = nil
|
|
192
211
|
@use_utc = false
|
|
193
212
|
acl_list = []
|
|
194
213
|
all_allowed = false
|
|
195
214
|
first_procedures_path = true
|
|
196
|
-
@
|
|
215
|
+
@additional_hashing_files = []
|
|
197
216
|
|
|
198
217
|
Cosmos.set_working_dir do
|
|
199
218
|
parser = ConfigParser.new("http://cosmosrb.com/docs/system")
|
|
@@ -201,7 +220,7 @@ module Cosmos
|
|
|
201
220
|
# First pass - Everything except targets
|
|
202
221
|
parser.parse_file(filename) do |keyword, parameters|
|
|
203
222
|
case keyword
|
|
204
|
-
when 'AUTO_DECLARE_TARGETS', 'DECLARE_TARGET', 'DECLARE_GEM_TARGET'
|
|
223
|
+
when 'AUTO_DECLARE_TARGETS', 'DECLARE_TARGET', 'DECLARE_GEM_TARGET', 'DECLARE_GEM_MULTI_TARGET'
|
|
205
224
|
# Will be handled by second pass
|
|
206
225
|
|
|
207
226
|
when 'PORT'
|
|
@@ -209,6 +228,7 @@ module Cosmos
|
|
|
209
228
|
parser.verify_num_parameters(2, 2, usage)
|
|
210
229
|
port_name = parameters[0].to_s.upcase
|
|
211
230
|
@ports[port_name] = Integer(parameters[1])
|
|
231
|
+
@allowed_hosts << "127.0.0.1:#{parameters[1]}" if API_PORTS.include?(port_name)
|
|
212
232
|
Logger.warn("Unknown port name given: #{port_name}") unless KNOWN_PORTS.include?(port_name)
|
|
213
233
|
|
|
214
234
|
when 'LISTEN_HOST', 'CONNECT_HOST'
|
|
@@ -327,16 +347,60 @@ module Cosmos
|
|
|
327
347
|
parser.verify_num_parameters(0, 0, "#{keyword}")
|
|
328
348
|
@use_utc = true
|
|
329
349
|
|
|
330
|
-
when 'ADD_MD5_FILE'
|
|
350
|
+
when 'ADD_HASH_FILE', 'ADD_MD5_FILE' # MD5 is here for backwards compatibility
|
|
331
351
|
parser.verify_num_parameters(1, 1, "#{keyword} <Filename>")
|
|
332
352
|
if File.file?(parameters[0])
|
|
333
|
-
@
|
|
353
|
+
@additional_hashing_files << File.expand_path(parameters[0])
|
|
334
354
|
elsif File.file?(File.join(Cosmos::USERPATH, parameters[0]))
|
|
335
|
-
@
|
|
355
|
+
@additional_hashing_files << File.expand_path(File.join(Cosmos::USERPATH, parameters[0]))
|
|
336
356
|
else
|
|
337
357
|
raise "Missing expected file: #{parameters[0]}"
|
|
338
358
|
end
|
|
339
359
|
|
|
360
|
+
when 'HASHING_ALGORITHM'
|
|
361
|
+
parser.verify_num_parameters(1, 1, "#{keyword} <Hashing Algorithm>")
|
|
362
|
+
if SUPPORTED_HASHING_ALGORITHMS.include? parameters[0]
|
|
363
|
+
@hashing_algorithm = parameters[0]
|
|
364
|
+
else
|
|
365
|
+
Logger.error "Unrecognized hashing algorithm: #{parameters[0]}, using default algorithm MD5"
|
|
366
|
+
@hashing_algorithm = 'MD5'
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
when 'CLASSIFICATION'
|
|
370
|
+
parser.verify_num_parameters(2, 4, "#{keyword} <Display_Text> <Color Name|Red> <Green> <Blue>")
|
|
371
|
+
# Determine if the COSMOS color already exists, otherwise create a new one
|
|
372
|
+
if Cosmos.constants.include? parameters[1].upcase.to_sym
|
|
373
|
+
# We were given a named color that already exists in COSMOS
|
|
374
|
+
color = eval("Cosmos::#{parameters[1].upcase}")
|
|
375
|
+
else
|
|
376
|
+
if parameters.length < 4
|
|
377
|
+
# We were given a named color, but it didn't exist in COSMOS already
|
|
378
|
+
color = Cosmos::getColor(parameters[1].upcase)
|
|
379
|
+
else
|
|
380
|
+
# We were given RGB values
|
|
381
|
+
color = Cosmos::getColor(parameters[1], parameters[2], parameters[3])
|
|
382
|
+
end
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
@classificiation_banner = {'display_text' => parameters[0],
|
|
386
|
+
'color' => color}
|
|
387
|
+
|
|
388
|
+
when 'ALLOW_ROUTER_COMMANDING'
|
|
389
|
+
parser.verify_num_parameters(0, 0, "#{keyword}")
|
|
390
|
+
@allow_router_commanding = true
|
|
391
|
+
|
|
392
|
+
when 'X_CSRF_TOKEN'
|
|
393
|
+
parser.verify_num_parameters(1, 1, "#{keyword} <Token>")
|
|
394
|
+
@x_csrf_token = ConfigParser.handle_nil(parameters[0])
|
|
395
|
+
|
|
396
|
+
when 'ALLOW_ORIGIN'
|
|
397
|
+
parser.verify_num_parameters(1, 1, "#{keyword} <Origin>")
|
|
398
|
+
@allowed_origins << parameters[0]
|
|
399
|
+
|
|
400
|
+
when 'ALLOW_HOST'
|
|
401
|
+
parser.verify_num_parameters(1, 1, "#{keyword} <Host:Port>")
|
|
402
|
+
@allowed_hosts << parameters[0]
|
|
403
|
+
|
|
340
404
|
else
|
|
341
405
|
# blank lines will have a nil keyword and should not raise an exception
|
|
342
406
|
raise parser.error("Unknown keyword '#{keyword}'") if keyword
|
|
@@ -392,13 +456,8 @@ module Cosmos
|
|
|
392
456
|
end
|
|
393
457
|
end
|
|
394
458
|
end
|
|
395
|
-
|
|
396
459
|
auto_detect_gem_based_targets()
|
|
397
460
|
|
|
398
|
-
# Make sure SYSTEM target is always present and added last
|
|
399
|
-
target = Target.new('SYSTEM')
|
|
400
|
-
@targets[target.name] = target
|
|
401
|
-
|
|
402
461
|
when 'DECLARE_TARGET'
|
|
403
462
|
usage = "#{keyword} <TARGET NAME> <SUBSTITUTE TARGET NAME (Optional)> <TARGET FILENAME (Optional - defaults to target.txt)>"
|
|
404
463
|
parser.verify_num_parameters(1, 3, usage)
|
|
@@ -429,60 +488,96 @@ module Cosmos
|
|
|
429
488
|
target = Target.new(target_name, substitute_name, configuration_directory, ConfigParser.handle_nil(parameters[2]), gem_dir)
|
|
430
489
|
@targets[target.name] = target
|
|
431
490
|
|
|
491
|
+
when 'DECLARE_GEM_MULTI_TARGET'
|
|
492
|
+
usage = "#{keyword} <GEM NAME> <TARGET NAME> <SUBSTITUTE TARGET NAME (Optional)> <TARGET FILENAME (Optional - defaults to target.txt)>"
|
|
493
|
+
parser.verify_num_parameters(2, 4, usage)
|
|
494
|
+
|
|
495
|
+
target_name = parameters[1].to_s.upcase
|
|
496
|
+
substitute_name = nil
|
|
497
|
+
substitute_name = ConfigParser.handle_nil(parameters[2])
|
|
498
|
+
substitute_name.to_s.upcase if substitute_name
|
|
499
|
+
gem_dir = Gem::Specification.find_by_name(parameters[0]).gem_dir
|
|
500
|
+
gem_dir = File.join(gem_dir, target_name)
|
|
501
|
+
target = Target.new(target_name, substitute_name, configuration_directory, ConfigParser.handle_nil(parameters[3]), gem_dir)
|
|
502
|
+
@targets[target.name] = target
|
|
503
|
+
|
|
432
504
|
end # case keyword
|
|
433
505
|
end # parser.parse_file
|
|
506
|
+
|
|
507
|
+
# Make sure SYSTEM target is always present and added last
|
|
508
|
+
unless @targets.key?('SYSTEM')
|
|
509
|
+
target = Target.new('SYSTEM')
|
|
510
|
+
@targets[target.name] = target
|
|
511
|
+
end
|
|
434
512
|
end
|
|
435
513
|
|
|
436
514
|
# Load the specified configuration by iterating through the SAVED_CONFIG
|
|
437
|
-
# directory looking for a matching
|
|
515
|
+
# directory looking for a matching hashing sum. Updates the internal state so
|
|
438
516
|
# subsequent commands and telemetry methods return the new configuration.
|
|
439
517
|
#
|
|
440
|
-
# @param name [String]
|
|
518
|
+
# @param name [String] hash string which identifies the
|
|
441
519
|
# configuration. Pass nil to load the default configuration.
|
|
442
520
|
# @return [String, Exception/nil] The actual configuration loaded
|
|
443
521
|
def load_configuration(name = nil)
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
System.commands
|
|
447
|
-
end
|
|
522
|
+
# Ensure packets have been lazy loaded
|
|
523
|
+
load_packets() unless @config
|
|
448
524
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
525
|
+
@@instance_mutex.synchronize do
|
|
526
|
+
if @config_blacklist[name]
|
|
527
|
+
Logger.warn "Ignoring failed config #{name}"
|
|
528
|
+
update_config(@initial_config)
|
|
529
|
+
return @config.name, RuntimeError.new("Ignoring failed config #{name}")
|
|
530
|
+
end
|
|
531
|
+
|
|
532
|
+
if name && @config
|
|
533
|
+
# Make sure they're requesting something other than the current
|
|
534
|
+
# configuration.
|
|
535
|
+
if name != @config.name
|
|
536
|
+
# If they want the initial configuration we can just swap out the
|
|
537
|
+
# current configuration without doing any file processing
|
|
538
|
+
if name == @initial_config.name
|
|
539
|
+
Logger.info "Switching to initial configuration: #{name}"
|
|
540
|
+
update_config(@initial_config)
|
|
541
|
+
else
|
|
542
|
+
# Look for the requested configuration in the saved configurations
|
|
543
|
+
configuration = find_configuration(name)
|
|
544
|
+
if configuration
|
|
545
|
+
# We found the configuration requested. Reprocess the system.txt
|
|
546
|
+
# and reload the packets
|
|
547
|
+
begin
|
|
548
|
+
unless File.directory?(configuration)
|
|
549
|
+
# Zip file configuration so unzip and reset configuration path
|
|
550
|
+
configuration = unzip(configuration)
|
|
551
|
+
end
|
|
552
|
+
|
|
553
|
+
Logger.info "Switching to configuration: #{name}"
|
|
554
|
+
process_file(File.join(configuration, 'system.txt'), configuration)
|
|
555
|
+
load_packets(name, false)
|
|
556
|
+
rescue Exception => error
|
|
557
|
+
# Failed to load - Restore initial
|
|
558
|
+
@config_blacklist[name] = true # Prevent wasting time trying to load the bad configuration again
|
|
559
|
+
Logger.error "Problem loading configuration from #{configuration}: #{error.class}:#{error.message}\n#{error.backtrace.join("\n")}\n"
|
|
560
|
+
Logger.info "Switching to initial configuration: #{@initial_config.name}"
|
|
561
|
+
update_config(@initial_config)
|
|
562
|
+
return @config.name, error
|
|
467
563
|
end
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
564
|
+
else
|
|
565
|
+
# We couldn't find the configuration request. Reload the
|
|
566
|
+
# initial configuration
|
|
567
|
+
Logger.error "Unable to find configuration: #{name}"
|
|
568
|
+
Logger.info "Switching to initial configuration: #{@initial_config.name}"
|
|
472
569
|
update_config(@initial_config)
|
|
473
|
-
return @config.name,
|
|
570
|
+
return @config.name, RuntimeError.new("Unable to find configuration: #{name}")
|
|
474
571
|
end
|
|
475
|
-
else
|
|
476
|
-
# We couldn't find the configuration request. Reload the
|
|
477
|
-
# initial configuration
|
|
478
|
-
update_config(@initial_config)
|
|
479
572
|
end
|
|
480
573
|
end
|
|
574
|
+
else
|
|
575
|
+
Logger.info "Switching to initial configuration: #{@initial_config.name}"
|
|
576
|
+
update_config(@initial_config)
|
|
481
577
|
end
|
|
482
|
-
|
|
483
|
-
|
|
578
|
+
|
|
579
|
+
return @config.name, nil
|
|
484
580
|
end
|
|
485
|
-
return @config.name, nil
|
|
486
581
|
end
|
|
487
582
|
|
|
488
583
|
# (see #load_configuration)
|
|
@@ -495,7 +590,6 @@ module Cosmos
|
|
|
495
590
|
# @param filename [String] Path to system.txt config file to process. Defaults to config/system/system.txt
|
|
496
591
|
def reset_variables(filename = nil)
|
|
497
592
|
@targets = {}
|
|
498
|
-
@targets['UNKNOWN'] = Target.new('UNKNOWN')
|
|
499
593
|
@config = nil
|
|
500
594
|
@commands = nil
|
|
501
595
|
@telemetry = nil
|
|
@@ -510,8 +604,9 @@ module Cosmos
|
|
|
510
604
|
@staleness_seconds = 30
|
|
511
605
|
@limits_set = :DEFAULT
|
|
512
606
|
@use_utc = false
|
|
513
|
-
@
|
|
607
|
+
@additional_hashing_files = []
|
|
514
608
|
@meta_init_filename = nil
|
|
609
|
+
@hashing_algorithm = 'MD5'
|
|
515
610
|
|
|
516
611
|
@ports = {}
|
|
517
612
|
@ports['CTS_API'] = 7777
|
|
@@ -521,21 +616,22 @@ module Cosmos
|
|
|
521
616
|
@ports['REPLAY_API'] = 7877
|
|
522
617
|
@ports['REPLAY_PREIDENTIFIED'] = 7879
|
|
523
618
|
@ports['REPLAY_CMD_ROUTER'] = 7880
|
|
524
|
-
|
|
525
|
-
@ports['DART_STREAM'] =
|
|
619
|
+
|
|
620
|
+
@ports['DART_STREAM'] = 8777
|
|
621
|
+
@ports['DART_DECOM'] = 8779
|
|
622
|
+
@ports['DART_MASTER'] = 8780
|
|
526
623
|
|
|
527
624
|
@listen_hosts = {}
|
|
528
625
|
@listen_hosts['CTS_API'] = '127.0.0.1'
|
|
529
626
|
@listen_hosts['TLMVIEWER_API'] = '127.0.0.1'
|
|
530
|
-
|
|
531
|
-
@listen_hosts['
|
|
532
|
-
@listen_hosts['CTS_CMD_ROUTER'] = '0.0.0.0'
|
|
627
|
+
@listen_hosts['CTS_PREIDENTIFIED'] = '127.0.0.1'
|
|
628
|
+
@listen_hosts['CTS_CMD_ROUTER'] = '127.0.0.1'
|
|
533
629
|
@listen_hosts['REPLAY_API'] = '127.0.0.1'
|
|
534
|
-
|
|
535
|
-
@listen_hosts['
|
|
536
|
-
@listen_hosts['
|
|
537
|
-
@listen_hosts['
|
|
538
|
-
@listen_hosts['
|
|
630
|
+
@listen_hosts['REPLAY_PREIDENTIFIED'] = '127.0.0.1'
|
|
631
|
+
@listen_hosts['REPLAY_CMD_ROUTER'] = '127.0.0.1'
|
|
632
|
+
@listen_hosts['DART_STREAM'] = '127.0.0.1'
|
|
633
|
+
@listen_hosts['DART_DECOM'] = '127.0.0.1'
|
|
634
|
+
@listen_hosts['DART_MASTER'] = '127.0.0.1'
|
|
539
635
|
|
|
540
636
|
@connect_hosts = {}
|
|
541
637
|
@connect_hosts['CTS_API'] = '127.0.0.1'
|
|
@@ -547,6 +643,7 @@ module Cosmos
|
|
|
547
643
|
@connect_hosts['REPLAY_CMD_ROUTER'] = '127.0.0.1'
|
|
548
644
|
@connect_hosts['DART_STREAM'] = '127.0.0.1'
|
|
549
645
|
@connect_hosts['DART_DECOM'] = '127.0.0.1'
|
|
646
|
+
@connect_hosts['DART_MASTER'] = '127.0.0.1'
|
|
550
647
|
|
|
551
648
|
@paths = {}
|
|
552
649
|
@paths['LOGS'] = File.join(USERPATH, 'outputs', 'logs')
|
|
@@ -559,6 +656,11 @@ module Cosmos
|
|
|
559
656
|
@paths['DART_DATA'] = File.join(USERPATH, 'outputs', 'dart', 'data')
|
|
560
657
|
@paths['DART_LOGS'] = File.join(USERPATH, 'outputs', 'dart', 'logs')
|
|
561
658
|
|
|
659
|
+
@allow_router_commanding = false
|
|
660
|
+
@x_csrf_token = 'SuperSecret'
|
|
661
|
+
@allowed_origins = []
|
|
662
|
+
@allowed_hosts = ['127.0.0.1:7777', '127.0.0.1:7778', '127.0.0.1:7877', '127.0.0.1:8779', '127.0.0.1:8780']
|
|
663
|
+
|
|
562
664
|
unless filename
|
|
563
665
|
system_arg = false
|
|
564
666
|
ARGV.each do |arg|
|
|
@@ -575,10 +677,11 @@ module Cosmos
|
|
|
575
677
|
|
|
576
678
|
@initial_filename = filename
|
|
577
679
|
@initial_config = nil
|
|
680
|
+
@config_blacklist = {}
|
|
578
681
|
end
|
|
579
682
|
|
|
580
683
|
# Reset variables and load packets
|
|
581
|
-
def reset(filename =
|
|
684
|
+
def reset(filename = @@instance_filename)
|
|
582
685
|
reset_variables(filename)
|
|
583
686
|
load_packets()
|
|
584
687
|
end
|
|
@@ -653,11 +756,31 @@ module Cosmos
|
|
|
653
756
|
Bundler.load.specs.each do |spec|
|
|
654
757
|
spec_name_split = spec.name.split('-')
|
|
655
758
|
if spec_name_split.length > 1 && (spec_name_split[0] == 'cosmos')
|
|
656
|
-
#
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
759
|
+
# search for multiple targets packaged in a single gem
|
|
760
|
+
dirs = []
|
|
761
|
+
Dir.foreach(spec.gem_dir) { |dir_filename| dirs << dir_filename }
|
|
762
|
+
dirs.sort!
|
|
763
|
+
dirs.each do |dir_filename|
|
|
764
|
+
if dir_filename == "."
|
|
765
|
+
# check the base directory
|
|
766
|
+
curr_dir = spec.gem_dir
|
|
767
|
+
target_name = spec_name_split[1..-1].join('-').to_s.upcase
|
|
768
|
+
else
|
|
769
|
+
#check for targets in other directories 1 level deep
|
|
770
|
+
next if dir_filename[0] == '.' #skip dot directories and ".."
|
|
771
|
+
next if dir_filename != dir_filename.upcase #skip non uppercase directories
|
|
772
|
+
curr_dir = File.join(spec.gem_dir, dir_filename)
|
|
773
|
+
target_name = dir_filename
|
|
774
|
+
end
|
|
775
|
+
# check for the cmd_tlm directory - if it has it, then we have found a target
|
|
776
|
+
if File.directory?(File.join(curr_dir,'cmd_tlm'))
|
|
777
|
+
# If any of the targets original directory name matches the
|
|
778
|
+
# current directory then it must have been already processed by
|
|
779
|
+
# DECLARE_TARGET so we skip it.
|
|
780
|
+
next if @targets.select {|name, target| target.original_name == target_name }.length > 0
|
|
781
|
+
target = Target.new(target_name,nil, nil, nil, spec.gem_dir)
|
|
782
|
+
@targets[target.name] = target
|
|
783
|
+
end
|
|
661
784
|
end
|
|
662
785
|
end
|
|
663
786
|
end
|
|
@@ -686,9 +809,10 @@ module Cosmos
|
|
|
686
809
|
configuration = find_configuration(@config.name)
|
|
687
810
|
configuration = File.join(@paths['SAVED_CONFIG'], File.build_timestamped_filename([@config.name], '.zip')) unless configuration
|
|
688
811
|
unless File.exist?(configuration)
|
|
812
|
+
configuration_tmp = File.join(@paths['SAVED_CONFIG'], File.build_timestamped_filename(['tmp_' + @config.name], '.zip.tmp'))
|
|
689
813
|
begin
|
|
690
814
|
Zip.continue_on_exists_proc = true
|
|
691
|
-
Zip::File.open(
|
|
815
|
+
Zip::File.open(configuration_tmp, Zip::File::CREATE) do |zipfile|
|
|
692
816
|
zip_file_path = File.basename(configuration, ".zip")
|
|
693
817
|
zipfile.mkdir zip_file_path
|
|
694
818
|
|
|
@@ -720,6 +844,7 @@ module Cosmos
|
|
|
720
844
|
end
|
|
721
845
|
end
|
|
722
846
|
end
|
|
847
|
+
File.rename(configuration_tmp, configuration)
|
|
723
848
|
File.chmod(0444, configuration) # Mark readonly
|
|
724
849
|
rescue Exception => error
|
|
725
850
|
Logger.error "Problem saving configuration to #{configuration}: #{error.class}:#{error.message}\n#{error.backtrace.join("\n")}\n"
|
|
@@ -728,12 +853,13 @@ module Cosmos
|
|
|
728
853
|
end
|
|
729
854
|
end
|
|
730
855
|
|
|
731
|
-
def
|
|
732
|
-
# Determine
|
|
856
|
+
def load_packets_internal(configuration_name = nil)
|
|
857
|
+
# Determine hashing over all targets cmd_tlm files
|
|
733
858
|
cmd_tlm_files = []
|
|
734
859
|
additional_data = ''
|
|
735
860
|
@targets.each do |target_name, target|
|
|
736
861
|
cmd_tlm_files << target.filename if File.exist?(target.filename)
|
|
862
|
+
cmd_tlm_files.concat(target.requires)
|
|
737
863
|
cmd_tlm_files.concat(target.cmd_tlm_files)
|
|
738
864
|
if target.substitute
|
|
739
865
|
additional_data << target.original_name
|
|
@@ -743,11 +869,13 @@ module Cosmos
|
|
|
743
869
|
end
|
|
744
870
|
end
|
|
745
871
|
|
|
746
|
-
|
|
747
|
-
|
|
872
|
+
hashing_result = Cosmos.hash_files(cmd_tlm_files + @additional_hashing_files, additional_data, @hashing_algorithm)
|
|
873
|
+
hash_string = hashing_result.hexdigest
|
|
874
|
+
# Only use at most, 32 characters of the hex
|
|
875
|
+
hash_string = hash_string[-32..-1] if hash_string.length >= 32
|
|
748
876
|
|
|
749
877
|
# Build filename for marshal file
|
|
750
|
-
marshal_filename = File.join(@paths['TMP'], 'marshal_' <<
|
|
878
|
+
marshal_filename = File.join(@paths['TMP'], 'marshal_' << hash_string << '.bin')
|
|
751
879
|
|
|
752
880
|
# Attempt to load marshal file
|
|
753
881
|
config = Cosmos.marshal_load(marshal_filename)
|
|
@@ -780,7 +908,7 @@ module Cosmos
|
|
|
780
908
|
if configuration_name
|
|
781
909
|
@config.name = configuration_name
|
|
782
910
|
else
|
|
783
|
-
@config.name =
|
|
911
|
+
@config.name = hash_string
|
|
784
912
|
end
|
|
785
913
|
|
|
786
914
|
Cosmos.marshal_dump(marshal_filename, @config)
|
|
@@ -791,6 +919,16 @@ module Cosmos
|
|
|
791
919
|
save_configuration()
|
|
792
920
|
end
|
|
793
921
|
|
|
922
|
+
def load_packets(configuration_name = nil, take_mutex = true)
|
|
923
|
+
if take_mutex
|
|
924
|
+
@@instance_mutex.synchronize do
|
|
925
|
+
load_packets_internal(configuration_name)
|
|
926
|
+
end
|
|
927
|
+
else
|
|
928
|
+
load_packets_internal(configuration_name)
|
|
929
|
+
end
|
|
930
|
+
end
|
|
931
|
+
|
|
794
932
|
def setup_system_meta
|
|
795
933
|
# Ensure SYSTEM META is defined and defined correctly
|
|
796
934
|
begin
|