cosmos 4.3.0-java → 4.4.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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 +1 -0
- data/.travis.yml +5 -5
- data/Manifest.txt +81 -44
- data/Rakefile +9 -0
- data/appveyor.yml +2 -1
- 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/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/tools/limits_monitor.ahk +1 -1
- data/autohotkey/tools/packet_viewer.ahk +1 -1
- data/autohotkey/tools/script_runner.ahk +16 -4
- data/bin/cosmos +1 -1
- data/bin/xtce_converter +1 -1
- data/cosmos.gemspec +5 -7
- data/data/config/_interfaces.yaml +4 -0
- data/data/config/cmd_sequence.yaml +14 -0
- data/data/config/housekeeping_params.yaml +14 -0
- data/data/config/interface_modifiers.yaml +11 -0
- data/data/config/item_modifiers.yaml +2 -1
- data/data/config/launcher.yaml +12 -2
- data/data/config/param_item_modifiers.yaml +2 -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 +47 -10
- data/data/config/table_manager.yaml +7 -0
- data/data/config/target.yaml +12 -0
- data/data/config/telemetry_modifiers.yaml +3 -1
- data/data/config/test_runner.yaml +10 -9
- data/data/config/widgets.yaml +174 -11
- data/data/crc.txt +128 -125
- 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/config/data/crc.txt +40 -20
- data/demo/config/system/system.txt +1 -1
- data/demo/config/system/system_alt_ports.txt +1 -1
- data/demo/config/targets/EXAMPLE/cmd_tlm_server.txt +1 -0
- data/demo/config/targets/INST/cmd_tlm/inst_cmds.txt +2 -1
- data/demo/config/targets/INST/cmd_tlm/inst_tlm.txt +7 -7
- 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/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/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 +1 -1
- data/demo/procedures/interactive.rb +22 -0
- data/ext/cosmos/ext/packet/packet.c +0 -77
- data/install/Gemfile +1 -1
- data/install/Launcher.bat +1 -9
- data/install/config/data/crc.txt +17 -1
- data/install/config/system/system.txt +1 -1
- 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/lib/cosmos/config/config_parser.rb +4 -5
- data/lib/cosmos/dart/lib/dart_common.rb +1 -1
- data/lib/cosmos/gui/dialogs/details_dialog.rb +16 -1
- data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +1 -0
- 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 +3 -1
- data/lib/cosmos/gui/qt_tool.rb +46 -23
- data/lib/cosmos/gui/text/ruby_editor.rb +44 -41
- data/lib/cosmos/gui/utilities/screenshot.rb +1 -1
- data/lib/cosmos/gui/utilities/script_module_gui.rb +92 -92
- data/lib/cosmos/interfaces.rb +1 -0
- data/lib/cosmos/interfaces/interface.rb +5 -1
- data/lib/cosmos/interfaces/protocols/fixed_protocol.rb +40 -18
- data/lib/cosmos/interfaces/protocols/template_protocol.rb +6 -1
- data/lib/cosmos/interfaces/simulated_target_interface.rb +14 -5
- data/lib/cosmos/io/json_drb.rb +11 -7
- data/lib/cosmos/packets/commands.rb +28 -11
- data/lib/cosmos/packets/packet.rb +69 -32
- data/lib/cosmos/packets/packet_config.rb +34 -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 +4 -3
- data/lib/cosmos/packets/structure.rb +4 -2
- data/lib/cosmos/packets/telemetry.rb +19 -3
- data/lib/cosmos/script/api_shared.rb +12 -9
- data/lib/cosmos/script/scripting.rb +16 -14
- data/lib/cosmos/system/system.rb +39 -20
- data/lib/cosmos/system/target.rb +39 -9
- data/lib/cosmos/tools/cmd_extractor/cmd_extractor.rb +94 -35
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +3 -0
- data/lib/cosmos/tools/cmd_sequence/sequence_item.rb +1 -1
- data/lib/cosmos/tools/cmd_tlm_server/background_tasks.rb +2 -0
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +30 -4
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +1 -0
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +9 -12
- data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +5 -2
- data/lib/cosmos/tools/cmd_tlm_server/routers.rb +2 -0
- data/lib/cosmos/tools/config_editor/config_editor.rb +80 -24
- data/lib/cosmos/tools/config_editor/config_editor_frame.rb +2 -0
- data/lib/cosmos/tools/data_viewer/data_viewer.rb +15 -9
- data/lib/cosmos/tools/data_viewer/dump_component.rb +2 -9
- data/lib/cosmos/tools/data_viewer/text_component.rb +77 -0
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +64 -38
- data/lib/cosmos/tools/launcher/launcher.rb +1 -0
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +31 -17
- data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +8 -6
- data/lib/cosmos/tools/script_runner/script_runner.rb +87 -29
- data/lib/cosmos/tools/script_runner/script_runner_config.rb +14 -0
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +41 -7
- data/lib/cosmos/tools/table_manager/table_config.rb +5 -3
- data/lib/cosmos/tools/table_manager/table_manager.rb +6 -3
- data/lib/cosmos/tools/test_runner/test_runner.rb +14 -9
- data/lib/cosmos/tools/test_runner/test_runner_chooser.rb +21 -9
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +3 -3
- 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 +11 -8
- data/lib/cosmos/tools/tlm_grapher/tlm_grapher.rb +9 -15
- data/lib/cosmos/tools/tlm_viewer/screen.rb +3 -1
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +19 -13
- data/lib/cosmos/tools/tlm_viewer/widgets.rb +2 -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 +1 -1
- 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 +2 -7
- 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 +54 -46
- data/lib/cosmos/top_level.rb +23 -12
- data/lib/cosmos/version.rb +4 -4
- 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 +112 -0
- data/spec/interfaces/protocols/fixed_protocol_spec.rb +20 -9
- data/spec/interfaces/protocols/template_protocol_spec.rb +78 -25
- data/spec/packets/commands_spec.rb +22 -0
- data/spec/packets/packet_config_spec.rb +24 -0
- data/spec/packets/packet_item_spec.rb +2 -2
- data/spec/packets/packet_spec.rb +39 -6
- data/spec/packets/parsers/state_parser_spec.rb +33 -11
- data/spec/packets/structure_spec.rb +41 -0
- data/spec/packets/telemetry_spec.rb +23 -0
- data/spec/streams/tcpip_socket_stream_spec.rb +32 -27
- data/spec/system/system_spec.rb +77 -2
- data/spec/system/target_spec.rb +62 -1
- data/spec/tools/cmd_tlm_server/api_spec.rb +1 -1
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +15 -7
- data/spec/top_level/top_level_spec.rb +29 -5
- data/tasks/gemfile_stats.rake +28 -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 +92 -55
data/lib/cosmos/interfaces.rb
CHANGED
@@ -283,7 +283,11 @@ module Cosmos
|
|
283
283
|
|
284
284
|
# Wrap all writes in a mutex and handle errors
|
285
285
|
def _write
|
286
|
-
@write_mutex.
|
286
|
+
if @write_mutex.owned?
|
287
|
+
yield
|
288
|
+
else
|
289
|
+
@write_mutex.synchronize { yield }
|
290
|
+
end
|
287
291
|
rescue Exception => err
|
288
292
|
Logger.instance.error("Error writing to interface : #{@name}")
|
289
293
|
disconnect()
|
@@ -68,37 +68,59 @@ module Cosmos
|
|
68
68
|
|
69
69
|
@interface.target_names.each do |target_name|
|
70
70
|
target_packets = nil
|
71
|
+
unique_id_mode = false
|
71
72
|
begin
|
72
73
|
if @telemetry
|
73
74
|
target_packets = System.telemetry.packets(target_name)
|
75
|
+
target = System.targets[target_name]
|
76
|
+
unique_id_mode = target.tlm_unique_id_mode if target
|
74
77
|
else
|
75
78
|
target_packets = System.commands.packets(target_name)
|
79
|
+
target = System.targets[target_name]
|
80
|
+
unique_id_mode = target.cmd_unique_id_mode if target
|
76
81
|
end
|
77
82
|
rescue RuntimeError
|
78
|
-
# No telemetry for this target
|
83
|
+
# No commands/telemetry for this target
|
79
84
|
next
|
80
85
|
end
|
81
86
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
return :STOP if @data.length < identified_packet.defined_length
|
87
|
+
if unique_id_mode
|
88
|
+
target_packets.each do |packet_name, packet|
|
89
|
+
if packet.identify?(@data[@discard_leading_bytes .. -1])
|
90
|
+
identified_packet = packet
|
91
|
+
break
|
88
92
|
end
|
89
|
-
# Set some variables so we can update the packet in
|
90
|
-
# read_packet
|
91
|
-
@received_time = Time.now.sys
|
92
|
-
@target_name = identified_packet.target_name
|
93
|
-
@packet_name = identified_packet.packet_name
|
94
|
-
|
95
|
-
# Get the data from this packet
|
96
|
-
packet_data = @data[0..(identified_packet.defined_length - 1)]
|
97
|
-
@data.replace(@data[identified_packet.defined_length..-1])
|
98
|
-
break
|
99
93
|
end
|
94
|
+
else
|
95
|
+
# Do a hash lookup to quickly identify the packet
|
96
|
+
if target_packets.length > 0
|
97
|
+
packet = target_packets.first[1]
|
98
|
+
key = packet.read_id_values(@data[@discard_leading_bytes .. -1])
|
99
|
+
if @telemetry
|
100
|
+
hash = System.telemetry.config.tlm_id_value_hash[target_name]
|
101
|
+
else
|
102
|
+
hash = System.commands.config.cmd_id_value_hash[target_name]
|
103
|
+
end
|
104
|
+
identified_packet = hash[key]
|
105
|
+
identified_packet = hash['CATCHALL'.freeze] unless identified_packet
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
if identified_packet
|
110
|
+
if identified_packet.defined_length + @discard_leading_bytes > @data.length
|
111
|
+
# Check if need more data to finish packet
|
112
|
+
return :STOP
|
113
|
+
end
|
114
|
+
# Set some variables so we can update the packet in
|
115
|
+
# read_packet
|
116
|
+
@received_time = Time.now.sys
|
117
|
+
@target_name = identified_packet.target_name
|
118
|
+
@packet_name = identified_packet.packet_name
|
119
|
+
|
120
|
+
# Get the data from this packet
|
121
|
+
packet_data = @data.slice!(0, identified_packet.defined_length + @discard_leading_bytes)
|
122
|
+
break
|
100
123
|
end
|
101
|
-
break if identified_packet
|
102
124
|
end
|
103
125
|
|
104
126
|
unless identified_packet
|
@@ -62,6 +62,7 @@ module Cosmos
|
|
62
62
|
allow_empty_data)
|
63
63
|
@response_template = nil
|
64
64
|
@response_packet = nil
|
65
|
+
@response_target_name = nil
|
65
66
|
@response_packets = []
|
66
67
|
@write_block_queue = Queue.new
|
67
68
|
@ignore_lines = ignore_lines.to_i
|
@@ -124,7 +125,7 @@ module Cosmos
|
|
124
125
|
end
|
125
126
|
|
126
127
|
# Grab the response packet specified in the command
|
127
|
-
result_packet = System.telemetry.packet(@
|
128
|
+
result_packet = System.telemetry.packet(@response_target_name, @response_packet).clone
|
128
129
|
result_packet.received_time = nil
|
129
130
|
result_packet.id_items.each do |item|
|
130
131
|
result_packet.write_item(item, item.id_value, :RAW)
|
@@ -181,17 +182,20 @@ module Cosmos
|
|
181
182
|
begin
|
182
183
|
@response_template = packet.read("RSP_TEMPLATE").strip
|
183
184
|
@response_packet = packet.read("RSP_PACKET").strip
|
185
|
+
@response_target_name = packet.target_name
|
184
186
|
# If the template or packet are empty set them to nil. This allows for
|
185
187
|
# the user to remove the RSP_TEMPLATE and RSP_PACKET values and avoid
|
186
188
|
# any response timeouts
|
187
189
|
if @response_template.empty? || @response_packet.empty?
|
188
190
|
@response_template = nil
|
189
191
|
@response_packet = nil
|
192
|
+
@response_target_name = nil
|
190
193
|
end
|
191
194
|
rescue
|
192
195
|
# If there is no response template we set to nil
|
193
196
|
@response_template = nil
|
194
197
|
@response_packet = nil
|
198
|
+
@response_target_name = nil
|
195
199
|
end
|
196
200
|
|
197
201
|
# Grab the command template because that is all we eventually send
|
@@ -235,6 +239,7 @@ module Cosmos
|
|
235
239
|
|
236
240
|
@response_template = nil
|
237
241
|
@response_packet = nil
|
242
|
+
@response_target_name = nil
|
238
243
|
@response_packets.clear
|
239
244
|
end
|
240
245
|
return super(packet, data)
|
@@ -56,10 +56,14 @@ module Cosmos
|
|
56
56
|
if @connected
|
57
57
|
packet = first_pending_packet()
|
58
58
|
if packet
|
59
|
-
#
|
59
|
+
# Support read_packet (but not read data) in protocols
|
60
60
|
# Generic protocol use is not supported
|
61
|
-
|
62
|
-
|
61
|
+
@read_protocols.each do |protocol|
|
62
|
+
packet = protocol.read_packet(packet)
|
63
|
+
return nil if packet == :DISCONNECT # Disconnect handled by thread
|
64
|
+
break if packet == :STOP
|
65
|
+
end
|
66
|
+
return packet unless packet == :STOP
|
63
67
|
end
|
64
68
|
|
65
69
|
while true
|
@@ -80,9 +84,14 @@ module Cosmos
|
|
80
84
|
|
81
85
|
packet = first_pending_packet()
|
82
86
|
if packet
|
83
|
-
#
|
87
|
+
# Support read_packet (but not read data) in protocols
|
84
88
|
# Generic protocol use is not supported
|
85
|
-
|
89
|
+
@read_protocols.each do |protocol|
|
90
|
+
packet = protocol.read_packet(packet)
|
91
|
+
return nil if packet == :DISCONNECT # Disconnect handled by thread
|
92
|
+
break if packet == :STOP
|
93
|
+
end
|
94
|
+
next if packet == :STOP
|
86
95
|
return packet
|
87
96
|
end
|
88
97
|
end
|
data/lib/cosmos/io/json_drb.rb
CHANGED
@@ -44,14 +44,19 @@ module Puma
|
|
44
44
|
end
|
45
45
|
|
46
46
|
module Cosmos
|
47
|
-
|
48
47
|
# JsonDRb implements the JSON-RPC 2.0 Specification to provide an interface
|
49
48
|
# for both internal and external tools to access the COSMOS server. It
|
50
49
|
# provides methods to install an access control list to control access to the
|
51
50
|
# API. It also limits the available methods to a known list of allowable API
|
52
51
|
# methods.
|
53
52
|
class JsonDRb
|
53
|
+
# Minimum amount of time in seconds to receive the JSON request,
|
54
|
+
# process it, and send the response. Requests for less than this amount
|
55
|
+
# will be set to the minimum
|
54
56
|
MINIMUM_REQUEST_TIME = 0.0001
|
57
|
+
STOP_SERVICE_TIMEOUT = 10.0 # seconds to wait when stopping the service
|
58
|
+
PUMA_THREAD_TIMEOUT = 10.0 # seconds to wait for the puma threads to die
|
59
|
+
SERVER_START_TIMEOUT = 15.0 # seconds to wait for the server to start
|
55
60
|
|
56
61
|
@@debug = false
|
57
62
|
|
@@ -94,9 +99,9 @@ module Cosmos
|
|
94
99
|
|
95
100
|
# Stops the DRb service by closing the socket and the processing thread
|
96
101
|
def stop_service
|
97
|
-
# Kill the server thread
|
98
|
-
#
|
99
|
-
Cosmos.kill_thread(self, @thread,
|
102
|
+
# Kill the server thread
|
103
|
+
# parameters are owner, thread, graceful_timeout, timeout_interval, hard_timeout
|
104
|
+
Cosmos.kill_thread(self, @thread, STOP_SERVICE_TIMEOUT, 0.1, STOP_SERVICE_TIMEOUT)
|
100
105
|
@thread = nil
|
101
106
|
@server_mutex.synchronize do
|
102
107
|
@server = nil
|
@@ -155,7 +160,7 @@ module Cosmos
|
|
155
160
|
puma_threads = false
|
156
161
|
Thread.list.each {|thread| puma_threads = true if thread.inspect.match(/puma/)}
|
157
162
|
break if !puma_threads
|
158
|
-
break if (Time.now - start_time) >
|
163
|
+
break if (Time.now - start_time) > PUMA_THREAD_TIMEOUT
|
159
164
|
sleep 0.25
|
160
165
|
end
|
161
166
|
|
@@ -184,7 +189,7 @@ module Cosmos
|
|
184
189
|
|
185
190
|
# Wait for the server to be started in the thread before returning.
|
186
191
|
start_time = Time.now
|
187
|
-
while ((Time.now - start_time) <
|
192
|
+
while ((Time.now - start_time) < SERVER_START_TIMEOUT) and !server_started
|
188
193
|
sleep(0.1)
|
189
194
|
@server_mutex.synchronize do
|
190
195
|
server_started = true if @server and @server.running
|
@@ -308,4 +313,3 @@ module Cosmos
|
|
308
313
|
|
309
314
|
end
|
310
315
|
end
|
311
|
-
|
@@ -90,6 +90,8 @@ module Cosmos
|
|
90
90
|
target_names = target_names() unless target_names
|
91
91
|
|
92
92
|
target_names.each do |target_name|
|
93
|
+
target_name = target_name.to_s.upcase
|
94
|
+
|
93
95
|
target_packets = nil
|
94
96
|
begin
|
95
97
|
target_packets = packets(target_name)
|
@@ -98,20 +100,35 @@ module Cosmos
|
|
98
100
|
next
|
99
101
|
end
|
100
102
|
|
101
|
-
|
102
|
-
|
103
|
-
if
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
identified_packet.buffer = packet_data
|
110
|
-
break
|
103
|
+
target = System.targets[target_name]
|
104
|
+
if target and target.cmd_unique_id_mode
|
105
|
+
# Iterate through the packets and see if any represent the buffer
|
106
|
+
target_packets.each do |packet_name, packet|
|
107
|
+
if packet.identify?(packet_data)
|
108
|
+
identified_packet = packet
|
109
|
+
break
|
110
|
+
end
|
111
111
|
end
|
112
|
+
else
|
113
|
+
# Do a hash lookup to quickly identify the packet
|
114
|
+
if target_packets.length > 0
|
115
|
+
packet = target_packets.first[1]
|
116
|
+
key = packet.read_id_values(packet_data)
|
117
|
+
hash = @config.cmd_id_value_hash[target_name]
|
118
|
+
identified_packet = hash[key]
|
119
|
+
identified_packet = hash['CATCHALL'.freeze] unless identified_packet
|
120
|
+
end
|
112
121
|
end
|
113
122
|
|
114
|
-
|
123
|
+
if identified_packet
|
124
|
+
identified_packet = identified_packet.clone
|
125
|
+
identified_packet.received_time = nil
|
126
|
+
identified_packet.stored = false
|
127
|
+
identified_packet.extra = nil
|
128
|
+
identified_packet.received_count = 0
|
129
|
+
identified_packet.buffer = packet_data
|
130
|
+
break
|
131
|
+
end
|
115
132
|
end
|
116
133
|
|
117
134
|
return identified_packet
|
@@ -8,7 +8,7 @@
|
|
8
8
|
# as published by the Free Software Foundation; version 3 with
|
9
9
|
# attribution addendums as found in the LICENSE.txt
|
10
10
|
|
11
|
-
require 'digest
|
11
|
+
require 'digest'
|
12
12
|
require 'cosmos/packets/structure'
|
13
13
|
require 'cosmos/packets/packet_item'
|
14
14
|
require 'cosmos/ext/packet' if RUBY_ENGINE == 'ruby' and !ENV['COSMOS_NO_EXT']
|
@@ -186,36 +186,58 @@ module Cosmos
|
|
186
186
|
@read_conversion_cache.clear if @read_conversion_cache
|
187
187
|
@received_count
|
188
188
|
end
|
189
|
+
|
190
|
+
end # if RUBY_ENGINE != 'ruby' or ENV['COSMOS_NO_EXT']
|
191
|
+
|
192
|
+
# Tries to identify if a buffer represents the currently defined packet. It
|
193
|
+
# does this by iterating over all the packet items that were created with
|
194
|
+
# an ID value and checking whether that ID value is present at the correct
|
195
|
+
# location in the buffer.
|
196
|
+
#
|
197
|
+
# Incorrectly sized buffers will still positively identify if there is
|
198
|
+
# enough data to match the ID values. This is to allow incorrectly sized
|
199
|
+
# packets to still be processed as well as possible given the incorrectly
|
200
|
+
# sized data.
|
201
|
+
#
|
202
|
+
# @param buffer [String] Raw buffer of binary data
|
203
|
+
# @return [Boolean] Whether or not the buffer of data is this packet
|
204
|
+
def identify?(buffer)
|
205
|
+
return false unless buffer
|
206
|
+
return true unless @id_items
|
189
207
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
# Incorrectly sized buffers will still positively identify if there is
|
196
|
-
# enough data to match the ID values. This is to allow incorrectly sized
|
197
|
-
# packets to still be processed as well as possible given the incorrectly
|
198
|
-
# sized data.
|
199
|
-
#
|
200
|
-
# @param buffer [String] Raw buffer of binary data
|
201
|
-
# @return [Boolean] Whether or not the buffer of data is this packet
|
202
|
-
def identify?(buffer)
|
203
|
-
return false unless buffer
|
204
|
-
return true unless @id_items
|
205
|
-
|
206
|
-
@id_items.each do |item|
|
207
|
-
begin
|
208
|
-
value = read_item(item, :RAW, buffer)
|
209
|
-
rescue Exception
|
210
|
-
value = nil
|
211
|
-
end
|
212
|
-
return false if item.id_value != value
|
208
|
+
@id_items.each do |item|
|
209
|
+
begin
|
210
|
+
value = read_item(item, :RAW, buffer)
|
211
|
+
rescue Exception
|
212
|
+
value = nil
|
213
213
|
end
|
214
|
-
|
215
|
-
true
|
214
|
+
return false if item.id_value != value
|
216
215
|
end
|
217
|
-
end # if RUBY_ENGINE != 'ruby' or ENV['COSMOS_NO_EXT']
|
218
216
|
|
217
|
+
true
|
218
|
+
end
|
219
|
+
|
220
|
+
# Reads the values from a buffer at the position of each id_item defined
|
221
|
+
# in the packet.
|
222
|
+
#
|
223
|
+
# @param buffer [String] Raw buffer of binary data
|
224
|
+
# @return [Array] Array of read id values in order
|
225
|
+
def read_id_values(buffer)
|
226
|
+
return [] unless buffer
|
227
|
+
return [] unless @id_items
|
228
|
+
values = []
|
229
|
+
|
230
|
+
@id_items.each do |item|
|
231
|
+
begin
|
232
|
+
values << read_item(item, :RAW, buffer)
|
233
|
+
rescue Exception
|
234
|
+
values << nil
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
values
|
239
|
+
end
|
240
|
+
|
219
241
|
# Returns @received_time unless a packet item called PACKET_TIME exists that returns
|
220
242
|
# a Ruby Time object that represents a different timestamp for the packet
|
221
243
|
def packet_time
|
@@ -227,7 +249,7 @@ module Cosmos
|
|
227
249
|
end
|
228
250
|
end
|
229
251
|
|
230
|
-
# Calculates a unique
|
252
|
+
# Calculates a unique hashing sum that changes if the parts of the packet configuration change that could affect
|
231
253
|
# the "shape" of the packet. This value is cached and that packet should not be changed if this method is being used
|
232
254
|
def config_name
|
233
255
|
return @config_name if @config_name
|
@@ -235,7 +257,9 @@ module Cosmos
|
|
235
257
|
@sorted_items.each do |item|
|
236
258
|
string << " ITEM #{item.name} #{item.bit_offset} #{item.bit_size} #{item.data_type} #{item.array_size} #{item.endianness} #{item.overflow} #{item.states} #{item.read_conversion ? item.read_conversion.class : 'NO_CONVERSION'}"
|
237
259
|
end
|
238
|
-
|
260
|
+
|
261
|
+
# Use the hashing algorithm established by Cosmos::System
|
262
|
+
digest = Digest.const_get(System.hashing_algorithm).send('new')
|
239
263
|
digest << string
|
240
264
|
@config_name = digest.hexdigest
|
241
265
|
@config_name
|
@@ -676,9 +700,10 @@ module Cosmos
|
|
676
700
|
# @param value_type (see #read_item)
|
677
701
|
# @param indent (see Structure#formatted)
|
678
702
|
# @param buffer (see Structure#formatted)
|
703
|
+
# @param ignored (see Structure#ignored)
|
679
704
|
# @return (see Structure#formatted)
|
680
|
-
def formatted(value_type = :CONVERTED, indent = 0, buffer = @buffer)
|
681
|
-
return super(value_type, indent, buffer)
|
705
|
+
def formatted(value_type = :CONVERTED, indent = 0, buffer = @buffer, ignored = nil)
|
706
|
+
return super(value_type, indent, buffer, ignored)
|
682
707
|
end
|
683
708
|
|
684
709
|
# Restore all items in the packet to their default value
|
@@ -852,7 +877,19 @@ module Cosmos
|
|
852
877
|
def update_id_items(item)
|
853
878
|
if item.id_value
|
854
879
|
@id_items ||= []
|
855
|
-
|
880
|
+
# Add to Id Items
|
881
|
+
unless @id_items.empty?
|
882
|
+
last_item = @id_items[-1]
|
883
|
+
@id_items << item
|
884
|
+
# If the current item or last item have a negative offset then we have
|
885
|
+
# to re-sort. We also re-sort if the current item is less than the last
|
886
|
+
# item because we are inserting.
|
887
|
+
if last_item.bit_offset <= 0 or item.bit_offset <= 0 or item.bit_offset < last_item.bit_offset
|
888
|
+
@id_items = @id_items.sort
|
889
|
+
end
|
890
|
+
else
|
891
|
+
@id_items << item
|
892
|
+
end
|
856
893
|
end
|
857
894
|
item
|
858
895
|
end
|
@@ -60,6 +60,16 @@ module Cosmos
|
|
60
60
|
# packet is not.
|
61
61
|
attr_reader :latest_data
|
62
62
|
|
63
|
+
# @return [Hash<String>=>Hash<Array>=>Packet] Hash keyed by target name
|
64
|
+
# that returns a hash keyed by an array of id values. The id values resolve to the packet
|
65
|
+
# defined by that identification. Command version
|
66
|
+
attr_reader :cmd_id_value_hash
|
67
|
+
|
68
|
+
# @return [Hash<String>=>Hash<Array>=>Packet] Hash keyed by target name
|
69
|
+
# that returns a hash keyed by an array of id values. The id values resolve to the packet
|
70
|
+
# defined by that identification. Telemetry version
|
71
|
+
attr_reader :tlm_id_value_hash
|
72
|
+
|
63
73
|
COMMAND = "Command"
|
64
74
|
TELEMETRY = "Telemetry"
|
65
75
|
|
@@ -73,6 +83,8 @@ module Cosmos
|
|
73
83
|
# Returns an array of packets with that target and item.
|
74
84
|
@latest_data = {}
|
75
85
|
@warnings = []
|
86
|
+
@cmd_id_value_hash = {}
|
87
|
+
@tlm_id_value_hash = {}
|
76
88
|
|
77
89
|
# Create unknown packets
|
78
90
|
@commands['UNKNOWN'] = {}
|
@@ -91,7 +103,8 @@ module Cosmos
|
|
91
103
|
# knowledge of the commands, telemetry, and limits groups.
|
92
104
|
#
|
93
105
|
# @param filename [String] The name of the configuration file
|
94
|
-
# @param process_target_name [String] The target name
|
106
|
+
# @param process_target_name [String] The target name. Pass nil when parsing
|
107
|
+
# an xtce file to automatically determine the target name.
|
95
108
|
def process_file(filename, process_target_name)
|
96
109
|
# Handle .xtce files
|
97
110
|
if File.extname(filename).to_s.downcase == ".xtce"
|
@@ -274,8 +287,16 @@ module Cosmos
|
|
274
287
|
if @current_cmd_or_tlm == COMMAND
|
275
288
|
PacketParser.check_item_data_types(@current_packet)
|
276
289
|
@commands[@current_packet.target_name][@current_packet.packet_name] = @current_packet
|
290
|
+
hash = @cmd_id_value_hash[@current_packet.target_name]
|
291
|
+
hash = {} unless hash
|
292
|
+
@cmd_id_value_hash[@current_packet.target_name] = hash
|
293
|
+
update_id_value_hash(hash)
|
277
294
|
else
|
278
295
|
@telemetry[@current_packet.target_name][@current_packet.packet_name] = @current_packet
|
296
|
+
hash = @tlm_id_value_hash[@current_packet.target_name]
|
297
|
+
hash = {} unless hash
|
298
|
+
@tlm_id_value_hash[@current_packet.target_name] = hash
|
299
|
+
update_id_value_hash(hash)
|
279
300
|
end
|
280
301
|
@current_packet = nil
|
281
302
|
@current_item = nil
|
@@ -284,6 +305,18 @@ module Cosmos
|
|
284
305
|
|
285
306
|
protected
|
286
307
|
|
308
|
+
def update_id_value_hash(hash)
|
309
|
+
if @current_packet.id_items.length > 0
|
310
|
+
key = []
|
311
|
+
@current_packet.id_items.each do |item|
|
312
|
+
key << item.id_value
|
313
|
+
end
|
314
|
+
hash[key] = @current_packet
|
315
|
+
else
|
316
|
+
hash['CATCHALL'.freeze] = @current_packet
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
287
320
|
def reset_processing_variables
|
288
321
|
@current_cmd_or_tlm = nil
|
289
322
|
@current_packet = nil
|