cosmos 3.5.1 → 3.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -1
- data/.gitattributes +3 -3
- data/.gitignore +48 -48
- data/.travis.yml +8 -8
- data/CONTRIBUTING.txt +50 -50
- data/Gemfile +10 -10
- data/Guardfile +27 -27
- data/LICENSE.txt +879 -879
- data/Manifest.txt +1414 -1414
- data/README.md +111 -111
- data/Rakefile +218 -214
- data/autohotkey/config/data/diamond.STL +57 -57
- data/autohotkey/config/system/system.txt +34 -34
- data/autohotkey/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -41
- data/autohotkey/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -15
- data/autohotkey/config/targets/COSMOS/cmd_tlm_server.txt +6 -6
- data/autohotkey/config/targets/COSMOS/target.txt +5 -5
- data/autohotkey/config/targets/INST/cmd_tlm/inst_cmds.txt +121 -121
- data/autohotkey/config/targets/INST/cmd_tlm/inst_tlm.txt +270 -270
- data/autohotkey/config/targets/INST/cmd_tlm_server.txt +5 -5
- data/autohotkey/config/targets/INST/lib/example_limits_response.rb +30 -30
- data/autohotkey/config/targets/INST/lib/sim_inst.rb +305 -305
- data/autohotkey/config/targets/INST/screens/adcs.txt +46 -46
- data/autohotkey/config/targets/INST/screens/array.txt +7 -7
- data/autohotkey/config/targets/INST/screens/block.txt +8 -8
- data/autohotkey/config/targets/INST/screens/commanding.txt +30 -30
- data/autohotkey/config/targets/INST/screens/graphs.txt +14 -14
- data/autohotkey/config/targets/INST/screens/ground.txt +25 -25
- data/autohotkey/config/targets/INST/screens/health_status.txt +33 -33
- data/autohotkey/config/targets/INST/screens/hs.txt +49 -49
- data/autohotkey/config/targets/INST/screens/image.txt +21 -21
- data/autohotkey/config/targets/INST/screens/latest.txt +23 -23
- data/autohotkey/config/targets/INST/screens/mech.txt +25 -25
- data/autohotkey/config/targets/INST/screens/other.txt +25 -25
- data/autohotkey/config/targets/INST/screens/params.txt +25 -25
- data/autohotkey/config/targets/INST/screens/tabs.txt +68 -68
- data/autohotkey/config/targets/INST/target.txt +26 -26
- data/autohotkey/config/targets/META/cmd_tlm/meta_cmd.txt +10 -10
- data/autohotkey/config/targets/META/cmd_tlm/meta_tlm.txt +9 -9
- data/autohotkey/config/targets/SYSTEM/cmd_tlm/limits_groups.txt +7 -7
- data/autohotkey/config/targets/SYSTEM/screens/error.txt +11 -11
- data/autohotkey/config/tools/cmd_tlm_server/cmd_tlm_server.txt +22 -22
- data/autohotkey/config/tools/data_viewer/data_viewer.txt +11 -11
- data/autohotkey/config/tools/handbook_creator/handbook_creator.txt +49 -49
- data/autohotkey/config/tools/handbook_creator/templates/command_packets.html.erb +86 -86
- data/autohotkey/config/tools/handbook_creator/templates/command_toc.html.erb +38 -38
- data/autohotkey/config/tools/handbook_creator/templates/footer.html.erb +9 -9
- data/autohotkey/config/tools/handbook_creator/templates/header.html.erb +25 -25
- data/autohotkey/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -13
- data/autohotkey/config/tools/handbook_creator/templates/nav.html.erb +27 -27
- data/autohotkey/config/tools/handbook_creator/templates/overview.html.erb +1 -1
- data/autohotkey/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -23
- data/autohotkey/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -33
- data/autohotkey/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -41
- data/autohotkey/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -80
- data/autohotkey/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -38
- data/autohotkey/config/tools/handbook_creator/templates/title.html.erb +1 -1
- data/autohotkey/config/tools/launcher/launcher.txt +38 -38
- data/autohotkey/config/tools/script_runner/script_runner.txt +3 -3
- data/autohotkey/config/tools/table_manager/ConfigTables_def.txt +8 -8
- data/autohotkey/config/tools/table_manager/OneDimensionalTable_def.txt +19 -19
- data/autohotkey/config/tools/table_manager/TwoDimensionalTable_def.txt +248 -248
- data/autohotkey/config/tools/test_runner/test_runner.txt +8 -8
- data/autohotkey/config/tools/test_runner/test_runner2.txt +11 -11
- data/autohotkey/config/tools/test_runner/test_runner3.txt +6 -6
- data/autohotkey/config/tools/test_runner/test_runner4.txt +1 -1
- data/autohotkey/config/tools/tlm_extractor/tlm_extractor.txt +13 -13
- data/autohotkey/config/tools/tlm_extractor/tlm_extractor2.txt +9 -9
- data/autohotkey/config/tools/tlm_grapher/bad.txt +50 -50
- data/autohotkey/config/tools/tlm_grapher/temp1-4.txt +51 -51
- data/autohotkey/config/tools/tlm_grapher/test2.txt +111 -111
- data/autohotkey/config/tools/tlm_viewer/tlm_viewer.txt +24 -24
- data/autohotkey/config/tools/tlm_viewer/tlm_viewer2.txt +4 -4
- data/autohotkey/config/tools/tlm_viewer/tlm_viewer3.txt +3 -3
- data/autohotkey/lib/example_background_task.rb +42 -42
- data/autohotkey/lib/user_version.rb +3 -3
- data/autohotkey/procedures/clear_util.rb +7 -7
- data/autohotkey/procedures/collect_util.rb +14 -14
- data/autohotkey/procedures/example_test.rb +67 -67
- data/autohotkey/procedures/example_test2.rb +74 -74
- data/autohotkey/procedures/script_test.rb +17 -17
- data/autohotkey/procedures/syntax_error.rb +18 -18
- data/autohotkey/tools/CmdExtractorAHK +16 -16
- data/autohotkey/tools/CmdSender +14 -14
- data/autohotkey/tools/CmdSenderAHK +18 -18
- data/autohotkey/tools/CmdTlmServer +14 -14
- data/autohotkey/tools/CmdTlmServerAHK +28 -28
- data/autohotkey/tools/CmdTlmServerAHK2 +17 -17
- data/autohotkey/tools/DataViewer +14 -14
- data/autohotkey/tools/DataViewerAHK +17 -17
- data/autohotkey/tools/HandbookCreatorAHK +20 -20
- data/autohotkey/tools/LauncherAHK +17 -17
- data/autohotkey/tools/LimitsMonitorAHK +20 -20
- data/autohotkey/tools/OpenGLBuilderAHK +24 -24
- data/autohotkey/tools/PacketViewer +14 -14
- data/autohotkey/tools/PacketViewerAHK +18 -18
- data/autohotkey/tools/PacketViewerAHK2 +17 -17
- data/autohotkey/tools/Replay +14 -14
- data/autohotkey/tools/ReplayAHK +17 -17
- data/autohotkey/tools/ScriptRunner +14 -14
- data/autohotkey/tools/ScriptRunnerAHK +20 -20
- data/autohotkey/tools/ScriptRunnerAHK2 +17 -17
- data/autohotkey/tools/TableManager +14 -14
- data/autohotkey/tools/TableManagerAHK +30 -30
- data/autohotkey/tools/TestRunner +15 -15
- data/autohotkey/tools/TestRunnerAHK +17 -17
- data/autohotkey/tools/TestRunnerAHK2 +17 -17
- data/autohotkey/tools/TestRunnerAHK3 +17 -17
- data/autohotkey/tools/TestRunnerAHK4 +17 -17
- data/autohotkey/tools/TestRunnerAHK5 +17 -17
- data/autohotkey/tools/TestRunnerAHK6 +17 -17
- data/autohotkey/tools/TlmExtractor +15 -15
- data/autohotkey/tools/TlmExtractorAHK +19 -19
- data/autohotkey/tools/TlmExtractorAHK2 +16 -16
- data/autohotkey/tools/TlmExtractorAHK3 +16 -16
- data/autohotkey/tools/TlmGrapher +14 -14
- data/autohotkey/tools/TlmGrapherAHK +19 -19
- data/autohotkey/tools/TlmGrapherAHK2 +23 -23
- data/autohotkey/tools/TlmGrapherAHK3 +17 -17
- data/autohotkey/tools/TlmGrapherAHK4 +17 -17
- data/autohotkey/tools/TlmViewer +14 -14
- data/autohotkey/tools/TlmViewerAHK +28 -28
- data/autohotkey/tools/TlmViewerAHK2 +22 -22
- data/autohotkey/tools/TlmViewerAHK3 +23 -23
- data/autohotkey/tools/TlmViewerAHK4 +22 -22
- data/autohotkey/tools/TlmViewerAHK5 +18 -18
- data/autohotkey/tools/autohotkey.rb +37 -37
- data/autohotkey/tools/cmd_extractor.ahk +33 -33
- data/autohotkey/tools/cmd_sender.ahk +182 -182
- data/autohotkey/tools/cmd_tlm_server.ahk +90 -90
- data/autohotkey/tools/cmd_tlm_server2.ahk +45 -45
- data/autohotkey/tools/data_viewer.ahk +141 -141
- data/autohotkey/tools/handbook_creator.ahk +32 -32
- data/autohotkey/tools/launcher.ahk +41 -41
- data/autohotkey/tools/limits_monitor.ahk +123 -123
- data/autohotkey/tools/open_gl_builder.ahk +134 -134
- data/autohotkey/tools/packet_viewer.ahk +196 -196
- data/autohotkey/tools/packet_viewer2.ahk +9 -9
- data/autohotkey/tools/replay.ahk +104 -104
- data/autohotkey/tools/script_runner.ahk +589 -589
- data/autohotkey/tools/script_runner2.ahk +38 -38
- data/autohotkey/tools/table_manager.ahk +220 -220
- data/autohotkey/tools/test_runner.ahk +262 -262
- data/autohotkey/tools/test_runner2.ahk +53 -53
- data/autohotkey/tools/test_runner3.ahk +13 -13
- data/autohotkey/tools/test_runner5.ahk +8 -8
- data/autohotkey/tools/test_runner6.ahk +5 -5
- data/autohotkey/tools/tlm_extractor.ahk +296 -296
- data/autohotkey/tools/tlm_grapher.ahk +660 -660
- data/autohotkey/tools/tlm_grapher2.ahk +115 -115
- data/autohotkey/tools/tlm_grapher3.ahk +24 -24
- data/autohotkey/tools/tlm_viewer.ahk +133 -133
- data/autohotkey/tools/tlm_viewer2.ahk +50 -50
- data/autohotkey/tools/tlm_viewer4.ahk +4 -4
- data/autohotkey/tools/tlm_viewer5.ahk +20 -20
- data/bin/cosmos +96 -96
- data/bin/cstol_converter +1166 -1166
- data/bin/rubysloc +85 -85
- data/cosmos.gemspec +99 -99
- data/data/about.txt +4 -4
- data/data/crc.txt +326 -326
- data/data/diamond.STL +57 -57
- data/data/legal.txt +9 -9
- data/demo/Gemfile +10 -10
- data/demo/Launcher +16 -16
- data/demo/Launcher.bat +0 -0
- data/demo/Rakefile +77 -77
- data/demo/config/data/crc.txt +224 -226
- data/demo/config/data/diamond.STL +57 -57
- data/demo/config/data/meta_init.txt +4 -4
- data/demo/config/system/system.txt +35 -35
- data/demo/config/system/system2.txt +33 -33
- data/demo/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -41
- data/demo/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -15
- data/demo/config/targets/COSMOS/cmd_tlm_server.txt +6 -6
- data/demo/config/targets/COSMOS/screens/limits_change.txt +20 -20
- data/demo/config/targets/COSMOS/screens/version.txt +19 -19
- data/demo/config/targets/COSMOS/target.txt +11 -11
- data/demo/config/targets/EXAMPLE/cmd_tlm/example_cmds.txt +2 -2
- data/demo/config/targets/EXAMPLE/cmd_tlm/example_tlm.txt +5 -5
- data/demo/config/targets/EXAMPLE/cmd_tlm_server.txt +6 -6
- data/demo/config/targets/EXAMPLE/lib/example_interface.rb +22 -22
- data/demo/config/targets/EXAMPLE/target.txt +6 -6
- data/demo/config/targets/INST/cmd_tlm/inst_cmds.txt +121 -121
- data/demo/config/targets/INST/cmd_tlm/inst_tlm.txt +247 -247
- data/demo/config/targets/INST/cmd_tlm_server.txt +5 -5
- data/demo/config/targets/INST/lib/example_limits_response.rb +30 -30
- data/demo/config/targets/INST/lib/sim_inst.rb +305 -305
- data/demo/config/targets/INST/screens/adcs.txt +46 -46
- data/demo/config/targets/INST/screens/array.txt +15 -15
- data/demo/config/targets/INST/screens/block.txt +8 -8
- data/demo/config/targets/INST/screens/commanding.txt +30 -30
- data/demo/config/targets/INST/screens/graphs.txt +14 -14
- data/demo/config/targets/INST/screens/ground.txt +25 -25
- data/demo/config/targets/INST/screens/hs.txt +44 -44
- data/demo/config/targets/INST/screens/latest.txt +23 -23
- data/demo/config/targets/INST/screens/other.txt +29 -29
- data/demo/config/targets/INST/screens/tabs.txt +70 -70
- data/demo/config/targets/INST/target.txt +33 -33
- data/demo/config/targets/META/cmd_tlm/meta_cmd.txt +10 -10
- data/demo/config/targets/META/cmd_tlm/meta_tlm.txt +13 -13
- data/demo/config/targets/SYSTEM/cmd_tlm/limits_groups.txt +7 -7
- data/demo/config/targets/SYSTEM/cmd_tlm/override.txt +29 -29
- data/demo/config/targets/SYSTEM/screens/status.txt +12 -12
- data/demo/config/targets/TEMPLATED/cmd_tlm/templated_cmds.txt +13 -13
- data/demo/config/targets/TEMPLATED/cmd_tlm/templated_tlm.txt +3 -3
- data/demo/config/targets/TEMPLATED/cmd_tlm_server.txt +6 -6
- data/demo/config/targets/TEMPLATED/lib/templated_interface.rb +56 -56
- data/demo/config/targets/TEMPLATED/target.txt +6 -6
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server.txt +39 -39
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server2.txt +34 -34
- data/demo/config/tools/data_viewer/data_viewer.txt +11 -11
- data/demo/config/tools/handbook_creator/handbook_creator.txt +66 -66
- data/demo/config/tools/handbook_creator/templates/command_packets.html.erb +88 -88
- data/demo/config/tools/handbook_creator/templates/command_toc.html.erb +38 -38
- data/demo/config/tools/handbook_creator/templates/footer.html.erb +9 -9
- data/demo/config/tools/handbook_creator/templates/header.html.erb +25 -25
- data/demo/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -13
- data/demo/config/tools/handbook_creator/templates/nav.html.erb +27 -27
- data/demo/config/tools/handbook_creator/templates/overview.html.erb +1 -1
- data/demo/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -23
- data/demo/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -33
- data/demo/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -41
- data/demo/config/tools/handbook_creator/templates/telemetry_packets.html.erb +82 -82
- data/demo/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -38
- data/demo/config/tools/handbook_creator/templates/title.html.erb +1 -1
- data/demo/config/tools/launcher/launcher.txt +45 -45
- data/demo/config/tools/launcher/launcher2.txt +45 -45
- data/demo/config/tools/script_runner/script_runner.txt +3 -3
- data/demo/config/tools/table_manager/ConfigTables_def.txt +8 -8
- data/demo/config/tools/table_manager/ExampleTableDefinition.txt +24 -24
- data/demo/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +25 -25
- data/demo/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +25 -25
- data/demo/config/tools/table_manager/PPSSelectionTable_def.txt +8 -8
- data/demo/config/tools/table_manager/TLMMonitoringTable_def.txt +248 -248
- data/demo/config/tools/test_runner/test_runner.txt +17 -17
- data/demo/config/tools/tlm_extractor/tlm_extractor.txt +13 -13
- data/demo/config/tools/tlm_extractor/tlm_extractor2.txt +2 -2
- data/demo/config/tools/tlm_extractor/tlm_extractor3.txt +2 -2
- data/demo/config/tools/tlm_extractor/tlm_extractor4.txt +2 -2
- data/demo/config/tools/tlm_viewer/tlm_viewer.txt +41 -41
- data/demo/lib/example_background_task.rb +57 -57
- data/demo/lib/example_target.rb +113 -113
- data/demo/lib/scpi_target.rb +74 -74
- data/demo/lib/user_version.rb +3 -3
- data/demo/procedures/checks.rb +11 -11
- data/demo/procedures/clear_util.rb +7 -7
- data/demo/procedures/collect.rb +18 -18
- data/demo/procedures/collect_util.rb +14 -14
- data/demo/procedures/cosmos_api_test.rb +293 -293
- data/demo/procedures/disconnect.rb +29 -29
- data/demo/procedures/example_test.rb +183 -183
- data/demo/procedures/plot_test.rb +8 -8
- data/demo/procedures/run_example_test.rb +3 -3
- data/demo/procedures/test.rb +51 -51
- data/demo/tools/CmdExtractor +16 -16
- data/demo/tools/CmdExtractor.bat +0 -0
- data/demo/tools/CmdSender +16 -16
- data/demo/tools/CmdSender.bat +0 -0
- data/demo/tools/CmdTlmServer +16 -16
- data/demo/tools/CmdTlmServer.bat +0 -0
- data/demo/tools/DataViewer +16 -16
- data/demo/tools/DataViewer.bat +0 -0
- data/demo/tools/ExampleTarget +16 -16
- data/demo/tools/ExampleTarget.bat +0 -0
- data/demo/tools/HandbookCreator +16 -16
- data/demo/tools/HandbookCreator.bat +0 -0
- data/demo/tools/Launcher +16 -16
- data/demo/tools/Launcher.bat +0 -0
- data/demo/tools/LimitsMonitor +16 -16
- data/demo/tools/LimitsMonitor.bat +0 -0
- data/demo/tools/OpenGLBuilder +16 -16
- data/demo/tools/OpenGLBuilder.bat +0 -0
- data/demo/tools/PacketViewer +16 -16
- data/demo/tools/PacketViewer.bat +0 -0
- data/demo/tools/Replay +16 -16
- data/demo/tools/Replay.bat +0 -0
- data/demo/tools/ScpiTarget +16 -16
- data/demo/tools/ScpiTarget.bat +0 -0
- data/demo/tools/ScriptRunner +16 -16
- data/demo/tools/ScriptRunner.bat +0 -0
- data/demo/tools/TableManager +16 -16
- data/demo/tools/TableManager.bat +0 -0
- data/demo/tools/TestRunner +16 -16
- data/demo/tools/TestRunner.bat +0 -0
- data/demo/tools/TlmExtractor +16 -16
- data/demo/tools/TlmExtractor.bat +0 -0
- data/demo/tools/TlmGrapher +16 -16
- data/demo/tools/TlmGrapher.bat +0 -0
- data/demo/tools/TlmViewer +16 -16
- data/demo/tools/TlmViewer.bat +0 -0
- data/demo/tools/ToolLaunch.bat +14 -5
- data/demo/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +16 -16
- data/demo/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/CmdExtractor.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/CmdSender.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +16 -16
- data/demo/tools/mac/CmdSender.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/CmdSender.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +16 -16
- data/demo/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/CmdTlmServer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/DataViewer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +16 -16
- data/demo/tools/mac/DataViewer.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/DataViewer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +16 -16
- data/demo/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/HandbookCreator.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/Launcher.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +16 -16
- data/demo/tools/mac/Launcher.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/Launcher.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +16 -16
- data/demo/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/LimitsMonitor.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +16 -16
- data/demo/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/OpenGLBuilder.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/PacketViewer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +16 -16
- data/demo/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/PacketViewer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/Replay.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/Replay.app/Contents/MacOS/Replay.rb +16 -16
- data/demo/tools/mac/Replay.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/Replay.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +16 -16
- data/demo/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/ScriptRunner.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/TableManager.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +16 -16
- data/demo/tools/mac/TableManager.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/TableManager.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/TestRunner.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +16 -16
- data/demo/tools/mac/TestRunner.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/TestRunner.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +16 -16
- data/demo/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/TlmExtractor.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +16 -16
- data/demo/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/TlmGrapher.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/mac/TlmViewer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +16 -16
- data/demo/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +10 -10
- data/demo/tools/mac/TlmViewer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/demo/tools/tool_launch.rb +38 -38
- data/ext/cosmos/ext/array/array.c +111 -111
- data/ext/cosmos/ext/array/extconf.rb +13 -13
- data/ext/cosmos/ext/buffered_file/buffered_file.c +167 -167
- data/ext/cosmos/ext/buffered_file/extconf.rb +13 -13
- data/ext/cosmos/ext/config_parser/config_parser.c +237 -237
- data/ext/cosmos/ext/config_parser/extconf.rb +13 -13
- data/ext/cosmos/ext/cosmos_io/cosmos_io.c +117 -117
- data/ext/cosmos/ext/cosmos_io/extconf.rb +13 -13
- data/ext/cosmos/ext/crc/crc.c +341 -341
- data/ext/cosmos/ext/crc/extconf.rb +12 -12
- data/ext/cosmos/ext/line_graph/extconf.rb +13 -13
- data/ext/cosmos/ext/line_graph/line_graph.c +501 -501
- data/ext/cosmos/ext/low_fragmentation_array/extconf.rb +12 -12
- data/ext/cosmos/ext/low_fragmentation_array/low_fragmentation_array.c +265 -265
- data/ext/cosmos/ext/packet/extconf.rb +13 -13
- data/ext/cosmos/ext/packet/packet.c +339 -339
- data/ext/cosmos/ext/platform/extconf.rb +13 -13
- data/ext/cosmos/ext/platform/platform.c +101 -101
- data/ext/cosmos/ext/polynomial_conversion/extconf.rb +13 -13
- data/ext/cosmos/ext/polynomial_conversion/polynomial_conversion.c +73 -73
- data/ext/cosmos/ext/string/extconf.rb +13 -13
- data/ext/cosmos/ext/string/string.c +49 -49
- data/ext/cosmos/ext/structure/structure.c +1428 -1428
- data/ext/cosmos/ext/tabbed_plots_config/extconf.rb +13 -13
- data/ext/cosmos/ext/tabbed_plots_config/tabbed_plots_config.c +51 -51
- data/ext/cosmos/ext/telemetry/extconf.rb +13 -13
- data/ext/cosmos/ext/telemetry/telemetry.c +307 -307
- data/ext/mkrf_conf.rb +40 -40
- data/install/Gemfile +10 -10
- data/install/Launcher +16 -16
- data/install/Launcher.bat +0 -0
- data/install/Rakefile +77 -77
- data/install/config/data/crc.txt +151 -151
- data/install/config/system/system.txt +29 -29
- data/install/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -41
- data/install/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -15
- data/install/config/targets/COSMOS/cmd_tlm_server.txt +6 -6
- data/install/config/targets/COSMOS/screens/limits_change.txt +20 -20
- data/install/config/targets/COSMOS/screens/version.txt +19 -19
- data/install/config/targets/COSMOS/target.txt +8 -8
- data/install/config/tools/cmd_tlm_server/cmd_tlm_server.txt +2 -2
- data/install/config/tools/data_viewer/data_viewer.txt +3 -3
- data/install/config/tools/handbook_creator/handbook_creator.txt +49 -49
- data/install/config/tools/handbook_creator/templates/command_packets.html.erb +86 -86
- data/install/config/tools/handbook_creator/templates/command_toc.html.erb +38 -38
- data/install/config/tools/handbook_creator/templates/footer.html.erb +9 -9
- data/install/config/tools/handbook_creator/templates/header.html.erb +25 -25
- data/install/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -13
- data/install/config/tools/handbook_creator/templates/nav.html.erb +27 -27
- data/install/config/tools/handbook_creator/templates/overview.html.erb +1 -1
- data/install/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -23
- data/install/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -33
- data/install/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -41
- data/install/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -80
- data/install/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -38
- data/install/config/tools/handbook_creator/templates/title.html.erb +1 -1
- data/install/config/tools/launcher/launcher.txt +40 -40
- data/install/config/tools/script_runner/script_runner.txt +3 -3
- data/install/config/tools/test_runner/test_runner.txt +8 -8
- data/install/config/tools/tlm_viewer/tlm_viewer.txt +5 -5
- data/install/lib/user_version.rb +3 -3
- data/install/tools/CmdExtractor +16 -16
- data/install/tools/CmdExtractor.bat +0 -0
- data/install/tools/CmdSender +16 -16
- data/install/tools/CmdSender.bat +0 -0
- data/install/tools/CmdTlmServer +16 -16
- data/install/tools/CmdTlmServer.bat +0 -0
- data/install/tools/DataViewer +16 -16
- data/install/tools/DataViewer.bat +0 -0
- data/install/tools/HandbookCreator +16 -16
- data/install/tools/HandbookCreator.bat +0 -0
- data/install/tools/Launcher +16 -16
- data/install/tools/Launcher.bat +0 -0
- data/install/tools/LimitsMonitor +16 -16
- data/install/tools/LimitsMonitor.bat +0 -0
- data/install/tools/OpenGLBuilder +16 -16
- data/install/tools/OpenGLBuilder.bat +0 -0
- data/install/tools/PacketViewer +16 -16
- data/install/tools/PacketViewer.bat +0 -0
- data/install/tools/Replay +16 -16
- data/install/tools/Replay.bat +0 -0
- data/install/tools/ScriptRunner +16 -16
- data/install/tools/ScriptRunner.bat +0 -0
- data/install/tools/TableManager +16 -16
- data/install/tools/TableManager.bat +0 -0
- data/install/tools/TestRunner +16 -16
- data/install/tools/TestRunner.bat +0 -0
- data/install/tools/TlmExtractor +16 -16
- data/install/tools/TlmExtractor.bat +0 -0
- data/install/tools/TlmGrapher +16 -16
- data/install/tools/TlmGrapher.bat +0 -0
- data/install/tools/TlmViewer +16 -16
- data/install/tools/TlmViewer.bat +0 -0
- data/install/tools/ToolLaunch.bat +14 -5
- data/install/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -38
- data/install/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +16 -16
- data/install/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/CmdExtractor.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/CmdSender.app/Contents/Info.plist +38 -38
- data/install/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +16 -16
- data/install/tools/mac/CmdSender.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/CmdSender.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +16 -16
- data/install/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/CmdTlmServer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/DataViewer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +16 -16
- data/install/tools/mac/DataViewer.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/DataViewer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -38
- data/install/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +16 -16
- data/install/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/HandbookCreator.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/Launcher.app/Contents/Info.plist +38 -38
- data/install/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +16 -16
- data/install/tools/mac/Launcher.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/Launcher.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -38
- data/install/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +16 -16
- data/install/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/LimitsMonitor.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -38
- data/install/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +16 -16
- data/install/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/OpenGLBuilder.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/PacketViewer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +16 -16
- data/install/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/PacketViewer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/Replay.app/Contents/Info.plist +38 -38
- data/install/tools/mac/Replay.app/Contents/MacOS/Replay.rb +16 -16
- data/install/tools/mac/Replay.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/Replay.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -38
- data/install/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +16 -16
- data/install/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/ScriptRunner.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/TableManager.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +16 -16
- data/install/tools/mac/TableManager.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/TableManager.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/TestRunner.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +16 -16
- data/install/tools/mac/TestRunner.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/TestRunner.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +16 -16
- data/install/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/TlmExtractor.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +16 -16
- data/install/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/TlmGrapher.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/mac/TlmViewer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +16 -16
- data/install/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +10 -10
- data/install/tools/mac/TlmViewer.app/Contents/MacOS/tool_launch.rb +38 -38
- data/install/tools/tool_launch.rb +38 -38
- data/lib/cosmos.rb +63 -63
- data/lib/cosmos/ccsds/ccsds_packet.rb +63 -63
- data/lib/cosmos/ccsds/ccsds_parser.rb +143 -143
- data/lib/cosmos/config/config_parser.rb +324 -324
- data/lib/cosmos/conversions.rb +13 -13
- data/lib/cosmos/conversions/conversion.rb +47 -47
- data/lib/cosmos/conversions/generic_conversion.rb +55 -55
- data/lib/cosmos/conversions/new_packet_log_conversion.rb +45 -45
- data/lib/cosmos/conversions/polynomial_conversion.rb +57 -57
- data/lib/cosmos/conversions/processor_conversion.rb +46 -46
- data/lib/cosmos/conversions/received_count_conversion.rb +33 -33
- data/lib/cosmos/conversions/received_time_formatted_conversion.rb +37 -37
- data/lib/cosmos/conversions/received_time_seconds_conversion.rb +37 -37
- data/lib/cosmos/conversions/segmented_polynomial_conversion.rb +128 -128
- data/lib/cosmos/conversions/unix_time_conversion.rb +50 -50
- data/lib/cosmos/conversions/unix_time_formatted_conversion.rb +44 -44
- data/lib/cosmos/conversions/unix_time_seconds_conversion.rb +44 -44
- data/lib/cosmos/core_ext.rb +18 -18
- data/lib/cosmos/core_ext/array.rb +354 -354
- data/lib/cosmos/core_ext/class.rb +51 -51
- data/lib/cosmos/core_ext/cosmos_io.rb +29 -29
- data/lib/cosmos/core_ext/exception.rb +52 -52
- data/lib/cosmos/core_ext/file.rb +75 -75
- data/lib/cosmos/core_ext/hash.rb +28 -28
- data/lib/cosmos/core_ext/io.rb +75 -75
- data/lib/cosmos/core_ext/kernel.rb +38 -38
- data/lib/cosmos/core_ext/math.rb +119 -119
- data/lib/cosmos/core_ext/matrix.rb +146 -146
- data/lib/cosmos/core_ext/objectspace.rb +29 -29
- data/lib/cosmos/core_ext/range.rb +22 -22
- data/lib/cosmos/core_ext/socket.rb +32 -32
- data/lib/cosmos/core_ext/string.rb +311 -311
- data/lib/cosmos/core_ext/stringio.rb +24 -24
- data/lib/cosmos/core_ext/time.rb +448 -448
- data/lib/cosmos/gui/choosers/combobox_chooser.rb +130 -130
- data/lib/cosmos/gui/choosers/file_chooser.rb +68 -68
- data/lib/cosmos/gui/choosers/float_chooser.rb +82 -82
- data/lib/cosmos/gui/choosers/integer_chooser.rb +80 -80
- data/lib/cosmos/gui/choosers/string_chooser.rb +53 -53
- data/lib/cosmos/gui/choosers/telemetry_chooser.rb +326 -326
- data/lib/cosmos/gui/dialogs/about_dialog.rb +137 -137
- data/lib/cosmos/gui/dialogs/calendar_dialog.rb +136 -136
- data/lib/cosmos/gui/dialogs/cmd_details_dialog.rb +52 -52
- data/lib/cosmos/gui/dialogs/cmd_tlm_raw_dialog.rb +149 -149
- data/lib/cosmos/gui/dialogs/details_dialog.rb +174 -174
- data/lib/cosmos/gui/dialogs/exception_dialog.rb +97 -97
- data/lib/cosmos/gui/dialogs/exception_list_dialog.rb +59 -59
- data/lib/cosmos/gui/dialogs/find_replace_dialog.rb +260 -260
- data/lib/cosmos/gui/dialogs/legal_dialog.rb +169 -169
- data/lib/cosmos/gui/dialogs/packet_log_dialog.rb +118 -118
- data/lib/cosmos/gui/dialogs/progress_dialog.rb +276 -276
- data/lib/cosmos/gui/dialogs/pry_dialog.rb +165 -165
- data/lib/cosmos/gui/dialogs/scroll_text_dialog.rb +37 -37
- data/lib/cosmos/gui/dialogs/select_dialog.rb +54 -54
- data/lib/cosmos/gui/dialogs/set_tlm_dialog.rb +131 -131
- data/lib/cosmos/gui/dialogs/splash.rb +135 -135
- data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +206 -206
- data/lib/cosmos/gui/dialogs/tlm_edit_dialog.rb +81 -81
- data/lib/cosmos/gui/line_graph/line_graph.rb +456 -456
- data/lib/cosmos/gui/line_graph/line_graph_dialog.rb +34 -34
- data/lib/cosmos/gui/line_graph/line_graph_drawing.rb +473 -473
- data/lib/cosmos/gui/line_graph/line_graph_popups.rb +116 -116
- data/lib/cosmos/gui/line_graph/line_graph_scaling.rb +451 -451
- data/lib/cosmos/gui/line_graph/line_graph_script.rb +26 -26
- data/lib/cosmos/gui/line_graph/lines.rb +290 -290
- data/lib/cosmos/gui/line_graph/overview_graph.rb +469 -469
- data/lib/cosmos/gui/opengl/earth_model.rb +22 -22
- data/lib/cosmos/gui/opengl/gl_bounds.rb +67 -67
- data/lib/cosmos/gui/opengl/gl_light.rb +39 -39
- data/lib/cosmos/gui/opengl/gl_material.rb +29 -29
- data/lib/cosmos/gui/opengl/gl_scene.rb +72 -72
- data/lib/cosmos/gui/opengl/gl_shape.rb +146 -146
- data/lib/cosmos/gui/opengl/gl_viewer.rb +724 -724
- data/lib/cosmos/gui/opengl/gl_viewport.rb +35 -35
- data/lib/cosmos/gui/opengl/moon_model.rb +22 -22
- data/lib/cosmos/gui/opengl/opengl.rb +8 -8
- data/lib/cosmos/gui/opengl/stl_reader.rb +211 -211
- data/lib/cosmos/gui/opengl/stl_shape.rb +124 -124
- data/lib/cosmos/gui/opengl/texture_mapped_sphere.rb +202 -202
- data/lib/cosmos/gui/qt.rb +860 -860
- data/lib/cosmos/gui/qt_tool.rb +380 -380
- data/lib/cosmos/gui/text/completion.rb +381 -381
- data/lib/cosmos/gui/text/completion_line_edit.rb +30 -30
- data/lib/cosmos/gui/text/completion_text_edit.rb +179 -179
- data/lib/cosmos/gui/text/ruby_editor.rb +415 -415
- data/lib/cosmos/gui/utilities/screenshot.rb +25 -25
- data/lib/cosmos/gui/utilities/script_module_gui.rb +330 -330
- data/lib/cosmos/gui/widgets/full_text_search_line_edit.rb +161 -161
- data/lib/cosmos/gui/widgets/packet_log_frame.rb +305 -305
- data/lib/cosmos/gui/widgets/realtime_button_bar.rb +98 -98
- data/lib/cosmos/interfaces.rb +11 -11
- data/lib/cosmos/interfaces/cmd_tlm_server_interface.rb +153 -153
- data/lib/cosmos/interfaces/interface.rb +225 -225
- data/lib/cosmos/interfaces/linc_interface.rb +360 -360
- data/lib/cosmos/interfaces/serial_interface.rb +76 -76
- data/lib/cosmos/interfaces/simulated_target_interface.rb +129 -129
- data/lib/cosmos/interfaces/stream_interface.rb +136 -136
- data/lib/cosmos/interfaces/tcpip_client_interface.rb +60 -60
- data/lib/cosmos/interfaces/tcpip_server_interface.rb +164 -164
- data/lib/cosmos/interfaces/udp_interface.rb +161 -161
- data/lib/cosmos/io/buffered_file.rb +11 -11
- data/lib/cosmos/io/cosmos_snmp.rb +50 -50
- data/lib/cosmos/io/io_multiplexer.rb +89 -89
- data/lib/cosmos/io/json_drb.rb +376 -376
- data/lib/cosmos/io/json_drb_object.rb +198 -198
- data/lib/cosmos/io/json_rpc.rb +365 -365
- data/lib/cosmos/io/posix_serial_driver.rb +145 -145
- data/lib/cosmos/io/raw_logger.rb +174 -174
- data/lib/cosmos/io/raw_logger_pair.rb +71 -71
- data/lib/cosmos/io/serial_driver.rb +85 -85
- data/lib/cosmos/io/stderr.rb +36 -36
- data/lib/cosmos/io/stdout.rb +36 -36
- data/lib/cosmos/io/tcpip_server.rb +571 -571
- data/lib/cosmos/io/udp_sockets.rb +152 -152
- data/lib/cosmos/io/win32_serial_driver.rb +145 -145
- data/lib/cosmos/packet_logs.rb +7 -7
- data/lib/cosmos/packet_logs/ccsds_log_reader.rb +104 -104
- data/lib/cosmos/packet_logs/meta_packet_log_writer.rb +107 -107
- data/lib/cosmos/packet_logs/packet_log_reader.rb +450 -450
- data/lib/cosmos/packet_logs/packet_log_writer.rb +323 -323
- data/lib/cosmos/packet_logs/packet_log_writer_pair.rb +30 -30
- data/lib/cosmos/packets/binary_accessor.rb +634 -634
- data/lib/cosmos/packets/commands.rb +293 -293
- data/lib/cosmos/packets/limits.rb +267 -267
- data/lib/cosmos/packets/limits_response.rb +38 -38
- data/lib/cosmos/packets/packet.rb +786 -786
- data/lib/cosmos/packets/packet_config.rb +482 -482
- data/lib/cosmos/packets/packet_item.rb +317 -317
- data/lib/cosmos/packets/packet_item_limits.rb +128 -128
- data/lib/cosmos/packets/parsers/format_string_parser.rb +58 -58
- data/lib/cosmos/packets/parsers/limits_parser.rb +146 -146
- data/lib/cosmos/packets/parsers/limits_response_parser.rb +52 -52
- data/lib/cosmos/packets/parsers/macro_parser.rb +116 -116
- data/lib/cosmos/packets/parsers/packet_item_parser.rb +215 -215
- data/lib/cosmos/packets/parsers/packet_parser.rb +123 -123
- data/lib/cosmos/packets/parsers/processor_parser.rb +63 -63
- data/lib/cosmos/packets/parsers/state_parser.rb +116 -116
- data/lib/cosmos/packets/structure.rb +458 -458
- data/lib/cosmos/packets/structure_item.rb +233 -233
- data/lib/cosmos/packets/telemetry.rb +350 -350
- data/lib/cosmos/processors.rb +6 -6
- data/lib/cosmos/processors/new_packet_log_processor.rb +34 -34
- data/lib/cosmos/processors/processor.rb +71 -71
- data/lib/cosmos/processors/statistics_processor.rb +65 -65
- data/lib/cosmos/processors/watermark_processor.rb +44 -44
- data/lib/cosmos/script.rb +9 -9
- data/lib/cosmos/script/cmd_tlm_server.rb +110 -110
- data/lib/cosmos/script/commands.rb +184 -184
- data/lib/cosmos/script/extract.rb +123 -123
- data/lib/cosmos/script/limits.rb +114 -114
- data/lib/cosmos/script/script.rb +76 -76
- data/lib/cosmos/script/scripting.rb +897 -897
- data/lib/cosmos/script/telemetry.rb +174 -174
- data/lib/cosmos/script/tools.rb +138 -138
- data/lib/cosmos/streams/burst_stream_protocol.rb +25 -25
- data/lib/cosmos/streams/fixed_stream_protocol.rb +111 -111
- data/lib/cosmos/streams/length_stream_protocol.rb +140 -140
- data/lib/cosmos/streams/preidentified_stream_protocol.rb +118 -118
- data/lib/cosmos/streams/serial_stream.rb +157 -157
- data/lib/cosmos/streams/stream.rb +63 -63
- data/lib/cosmos/streams/stream_protocol.rb +373 -373
- data/lib/cosmos/streams/tcpip_client_stream.rb +113 -113
- data/lib/cosmos/streams/tcpip_socket_stream.rb +143 -143
- data/lib/cosmos/streams/template_stream_protocol.rb +140 -140
- data/lib/cosmos/streams/terminated_stream_protocol.rb +81 -81
- data/lib/cosmos/system.rb +4 -4
- data/lib/cosmos/system/system.rb +618 -618
- data/lib/cosmos/system/target.rb +197 -197
- data/lib/cosmos/tools/cmd_extractor/cmd_extractor.rb +255 -255
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +717 -717
- data/lib/cosmos/tools/cmd_sender/cmd_sender_item_delegate.rb +77 -77
- data/lib/cosmos/tools/cmd_sender/cmd_sender_text_edit.rb +70 -70
- data/lib/cosmos/tools/cmd_tlm_server/api.rb +1034 -1034
- data/lib/cosmos/tools/cmd_tlm_server/background_task.rb +46 -46
- data/lib/cosmos/tools/cmd_tlm_server/background_tasks.rb +67 -67
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +515 -515
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +253 -253
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +408 -408
- data/lib/cosmos/tools/cmd_tlm_server/commanding.rb +112 -112
- data/lib/cosmos/tools/cmd_tlm_server/connections.rb +175 -175
- data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +200 -200
- data/lib/cosmos/tools/cmd_tlm_server/gui/logging_tab.rb +176 -176
- data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +150 -150
- data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +244 -244
- data/lib/cosmos/tools/cmd_tlm_server/gui/targets_tab.rb +90 -90
- data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +266 -266
- data/lib/cosmos/tools/cmd_tlm_server/interfaces.rb +127 -127
- data/lib/cosmos/tools/cmd_tlm_server/packet_logging.rb +132 -132
- data/lib/cosmos/tools/cmd_tlm_server/router_thread.rb +66 -66
- data/lib/cosmos/tools/cmd_tlm_server/routers.rb +97 -97
- data/lib/cosmos/tools/data_viewer/data_viewer.rb +621 -621
- data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +134 -134
- data/lib/cosmos/tools/data_viewer/dump_component.rb +40 -40
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +156 -156
- data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +382 -382
- data/lib/cosmos/tools/launcher/launcher.rb +188 -188
- data/lib/cosmos/tools/launcher/launcher_config.rb +256 -256
- data/lib/cosmos/tools/launcher/launcher_multitool.rb +40 -40
- data/lib/cosmos/tools/launcher/launcher_tool.rb +116 -116
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +837 -837
- data/lib/cosmos/tools/opengl_builder/opengl_builder.rb +416 -416
- data/lib/cosmos/tools/opengl_builder/scene_config.rb +118 -118
- data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +542 -542
- data/lib/cosmos/tools/replay/replay.rb +501 -501
- data/lib/cosmos/tools/replay/replay_server.rb +91 -91
- data/lib/cosmos/tools/script_runner/script_audit.rb +147 -147
- data/lib/cosmos/tools/script_runner/script_runner.rb +922 -922
- data/lib/cosmos/tools/script_runner/script_runner_config.rb +40 -40
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +1798 -1798
- data/lib/cosmos/tools/table_manager/table.rb +70 -70
- data/lib/cosmos/tools/table_manager/table_config.rb +764 -764
- data/lib/cosmos/tools/table_manager/table_item.rb +74 -74
- data/lib/cosmos/tools/table_manager/table_manager.rb +1065 -1065
- data/lib/cosmos/tools/table_manager/table_manager_core.rb +539 -539
- data/lib/cosmos/tools/test_runner/results_writer.rb +283 -283
- data/lib/cosmos/tools/test_runner/test.rb +539 -539
- data/lib/cosmos/tools/test_runner/test_runner.rb +1189 -1189
- data/lib/cosmos/tools/test_runner/test_runner_chooser.rb +341 -341
- data/lib/cosmos/tools/tlm_extractor/text_item_chooser.rb +60 -60
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +1016 -1016
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb +371 -371
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +60 -60
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/housekeeping_data_object_adder.rb +75 -75
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/singlexy_data_object_adder.rb +44 -44
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +95 -95
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/data_object_editor.rb +61 -61
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +181 -181
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/linegraph_data_object_editor.rb +141 -141
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/singlexy_data_object_editor.rb +30 -30
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb +174 -174
- data/lib/cosmos/tools/tlm_grapher/data_objects/data_object.rb +193 -193
- data/lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb +407 -407
- data/lib/cosmos/tools/tlm_grapher/data_objects/linegraph_data_object.rb +176 -176
- data/lib/cosmos/tools/tlm_grapher/data_objects/singlexy_data_object.rb +25 -25
- data/lib/cosmos/tools/tlm_grapher/data_objects/xy_data_object.rb +323 -323
- data/lib/cosmos/tools/tlm_grapher/plot_editors/linegraph_plot_editor.rb +181 -181
- data/lib/cosmos/tools/tlm_grapher/plot_editors/plot_editor.rb +28 -28
- data/lib/cosmos/tools/tlm_grapher/plot_editors/singlexy_plot_editor.rb +30 -30
- data/lib/cosmos/tools/tlm_grapher/plot_editors/xy_plot_editor.rb +59 -59
- data/lib/cosmos/tools/tlm_grapher/plot_gui_objects/linegraph_plot_gui_object.rb +172 -172
- data/lib/cosmos/tools/tlm_grapher/plot_gui_objects/singlexy_plot_gui_object.rb +27 -27
- data/lib/cosmos/tools/tlm_grapher/plot_gui_objects/xy_plot_gui_object.rb +74 -74
- data/lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb +201 -201
- data/lib/cosmos/tools/tlm_grapher/plots/plot.rb +69 -69
- data/lib/cosmos/tools/tlm_grapher/plots/singlexy_plot.rb +20 -20
- data/lib/cosmos/tools/tlm_grapher/plots/xy_plot.rb +61 -61
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb +1291 -1291
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_config.rb +430 -430
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_data_object_editor.rb +107 -107
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_logfile_thread.rb +114 -114
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_plot_editor.rb +101 -101
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_realtime_thread.rb +78 -78
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tab.rb +57 -57
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tool.rb +1004 -1004
- data/lib/cosmos/tools/tlm_grapher/tlm_grapher.rb +87 -87
- data/lib/cosmos/tools/tlm_viewer/screen.rb +486 -486
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +561 -561
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer_config.rb +290 -290
- data/lib/cosmos/tools/tlm_viewer/widgets.rb +53 -53
- data/lib/cosmos/tools/tlm_viewer/widgets/aging_widget.rb +110 -110
- data/lib/cosmos/tools/tlm_viewer/widgets/array_widget.rb +66 -66
- data/lib/cosmos/tools/tlm_viewer/widgets/block_widget.rb +57 -57
- data/lib/cosmos/tools/tlm_viewer/widgets/button_widget.rb +39 -39
- data/lib/cosmos/tools/tlm_viewer/widgets/canvas_widget.rb +62 -62
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb +41 -41
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasimagevalue_widget.rb +57 -57
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabel_widget.rb +37 -37
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabelvalue_widget.rb +56 -56
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasline_widget.rb +55 -55
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslinevalue_widget.rb +66 -66
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasvalue_widget.rb +124 -124
- data/lib/cosmos/tools/tlm_viewer/widgets/checkbutton_widget.rb +31 -31
- data/lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb +30 -30
- data/lib/cosmos/tools/tlm_viewer/widgets/formatfontvalue_widget.rb +36 -36
- data/lib/cosmos/tools/tlm_viewer/widgets/formatvalue_widget.rb +35 -35
- data/lib/cosmos/tools/tlm_viewer/widgets/horizontal_widget.rb +27 -27
- data/lib/cosmos/tools/tlm_viewer/widgets/horizontalbox_widget.rb +31 -31
- data/lib/cosmos/tools/tlm_viewer/widgets/horizontalline_widget.rb +26 -26
- data/lib/cosmos/tools/tlm_viewer/widgets/label_widget.rb +29 -29
- data/lib/cosmos/tools/tlm_viewer/widgets/labelformatvalue_widget.rb +39 -39
- data/lib/cosmos/tools/tlm_viewer/widgets/labelprogressbar_widget.rb +38 -38
- data/lib/cosmos/tools/tlm_viewer/widgets/labeltrendlimitsbar_widget.rb +38 -38
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvalue_widget.rb +39 -39
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluedesc_widget.rb +42 -42
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitsbar_widget.rb +37 -37
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangebar_widget.rb +37 -37
- data/lib/cosmos/tools/tlm_viewer/widgets/layout_widget.rb +34 -34
- data/lib/cosmos/tools/tlm_viewer/widgets/limitsbar_widget.rb +178 -178
- data/lib/cosmos/tools/tlm_viewer/widgets/linegraph_widget.rb +54 -54
- data/lib/cosmos/tools/tlm_viewer/widgets/matrixbycolumns_widget.rb +47 -47
- data/lib/cosmos/tools/tlm_viewer/widgets/multi_widget.rb +116 -116
- data/lib/cosmos/tools/tlm_viewer/widgets/progressbar_widget.rb +34 -34
- data/lib/cosmos/tools/tlm_viewer/widgets/radiobutton_widget.rb +30 -30
- data/lib/cosmos/tools/tlm_viewer/widgets/rangebar_widget.rb +57 -57
- data/lib/cosmos/tools/tlm_viewer/widgets/screenshotbutton_widget.rb +34 -34
- data/lib/cosmos/tools/tlm_viewer/widgets/scrollwindow_widget.rb +35 -35
- data/lib/cosmos/tools/tlm_viewer/widgets/sectionheader_widget.rb +33 -33
- data/lib/cosmos/tools/tlm_viewer/widgets/tabbook_widget.rb +26 -26
- data/lib/cosmos/tools/tlm_viewer/widgets/tabitem_widget.rb +28 -28
- data/lib/cosmos/tools/tlm_viewer/widgets/textbox_widget.rb +47 -47
- data/lib/cosmos/tools/tlm_viewer/widgets/textfield_widget.rb +26 -26
- data/lib/cosmos/tools/tlm_viewer/widgets/timegraph_widget.rb +88 -88
- data/lib/cosmos/tools/tlm_viewer/widgets/title_widget.rb +27 -27
- data/lib/cosmos/tools/tlm_viewer/widgets/trendbar_widget.rb +130 -130
- data/lib/cosmos/tools/tlm_viewer/widgets/trendlimitsbar_widget.rb +46 -46
- data/lib/cosmos/tools/tlm_viewer/widgets/value_widget.rb +43 -43
- data/lib/cosmos/tools/tlm_viewer/widgets/valuelimitsbar_widget.rb +37 -37
- data/lib/cosmos/tools/tlm_viewer/widgets/valuerangebar_widget.rb +37 -37
- data/lib/cosmos/tools/tlm_viewer/widgets/vertical_widget.rb +35 -35
- data/lib/cosmos/tools/tlm_viewer/widgets/verticalbox_widget.rb +37 -37
- data/lib/cosmos/tools/tlm_viewer/widgets/widget.rb +257 -257
- data/lib/cosmos/top_level.rb +759 -759
- data/lib/cosmos/utilities.rb +11 -11
- data/lib/cosmos/utilities/crc.rb +166 -166
- data/lib/cosmos/utilities/csv.rb +83 -83
- data/lib/cosmos/utilities/logger.rb +137 -137
- data/lib/cosmos/utilities/low_fragmentation_array.rb +11 -11
- data/lib/cosmos/utilities/message_log.rb +79 -79
- data/lib/cosmos/utilities/quaternion.rb +258 -258
- data/lib/cosmos/utilities/ruby_lex_utils.rb +313 -313
- data/lib/cosmos/utilities/simulated_target.rb +99 -99
- data/lib/cosmos/utilities/sleeper.rb +44 -44
- data/lib/cosmos/version.rb +12 -12
- data/lib/cosmos/win32/excel.rb +66 -66
- data/lib/cosmos/win32/win32.rb +387 -387
- data/lib/cosmos/win32/win32_main.rb +321 -321
- data/roodi.yml +24 -24
- data/run_gui_tests.bat +0 -0
- data/spec/ccsds/ccsds_packet_spec.rb +67 -67
- data/spec/ccsds/ccsds_parser_spec.rb +148 -148
- data/spec/config/config_parser_spec.rb +322 -322
- data/spec/conversions/conversion_spec.rb +31 -31
- data/spec/conversions/generic_conversion_spec.rb +45 -45
- data/spec/conversions/new_packet_log_conversion_spec.rb +39 -39
- data/spec/conversions/polynomial_conversion_spec.rb +40 -40
- data/spec/conversions/processor_conversion_spec.rb +45 -45
- data/spec/conversions/received_count_conversion_spec.rb +43 -43
- data/spec/conversions/received_time_formatted_conversion_spec.rb +49 -49
- data/spec/conversions/received_time_seconds_conversion_spec.rb +50 -50
- data/spec/conversions/segmented_polynomial_conversion_spec.rb +51 -51
- data/spec/conversions/unix_time_formatted_conversion_spec.rb +74 -74
- data/spec/conversions/unix_time_seconds_conversion_spec.rb +76 -76
- data/spec/core_ext/array_spec.rb +186 -186
- data/spec/core_ext/class_spec.rb +36 -36
- data/spec/core_ext/cosmos_io_spec.rb +77 -77
- data/spec/core_ext/exception_spec.rb +91 -91
- data/spec/core_ext/file_spec.rb +72 -72
- data/spec/core_ext/hash_spec.rb +24 -24
- data/spec/core_ext/io_spec.rb +46 -46
- data/spec/core_ext/kernel_spec.rb +54 -54
- data/spec/core_ext/math_spec.rb +116 -116
- data/spec/core_ext/matrix_spec.rb +66 -66
- data/spec/core_ext/objectspace_spec.rb +29 -29
- data/spec/core_ext/range_spec.rb +21 -21
- data/spec/core_ext/socket_spec.rb +32 -32
- data/spec/core_ext/string_spec.rb +223 -223
- data/spec/core_ext/stringio_spec.rb +21 -21
- data/spec/core_ext/time_spec.rb +202 -202
- data/spec/gui/line_graph/line_clip_spec.rb +322 -322
- data/spec/gui/qt_spec.rb +102 -102
- data/spec/install/config/system/system.txt +33 -33
- data/spec/install/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -41
- data/spec/install/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -15
- data/spec/install/config/targets/COSMOS/cmd_tlm_server.txt +6 -6
- data/spec/install/config/targets/COSMOS/screens/limits_change.txt +20 -20
- data/spec/install/config/targets/COSMOS/screens/version.txt +19 -19
- data/spec/install/config/targets/COSMOS/target.txt +5 -5
- data/spec/install/config/targets/INST/cmd_tlm/inst_cmd_linc.txt +30 -30
- data/spec/install/config/targets/INST/cmd_tlm/inst_cmds.txt +111 -111
- data/spec/install/config/targets/INST/cmd_tlm/inst_tlm.txt +236 -236
- data/spec/install/config/targets/INST/cmd_tlm/inst_tlm_linc.txt +25 -25
- data/spec/install/config/targets/INST/cmd_tlm_server.txt +5 -5
- data/spec/install/config/targets/INST/lib/sim_inst.rb +305 -305
- data/spec/install/config/targets/INST/target.txt +10 -10
- data/spec/install/config/targets/META/cmd_tlm/meta_cmd.txt +4 -4
- data/spec/install/config/targets/META/cmd_tlm/meta_tlm.txt +4 -4
- data/spec/install/config/targets/SYSTEM/cmd_tlm/limits_groups.txt +7 -7
- data/spec/interfaces/cmd_tlm_server_interface_spec.rb +150 -150
- data/spec/interfaces/interface_spec.rb +130 -130
- data/spec/interfaces/linc_interface_spec.rb +259 -259
- data/spec/interfaces/serial_interface_spec.rb +56 -56
- data/spec/interfaces/simulated_target_interface_spec.rb +128 -128
- data/spec/interfaces/stream_interface_spec.rb +157 -157
- data/spec/interfaces/tcpip_client_interface_spec.rb +55 -55
- data/spec/interfaces/tcpip_server_interface_spec.rb +160 -160
- data/spec/interfaces/udp_interface_spec.rb +175 -175
- data/spec/io/buffered_file_spec.rb +113 -113
- data/spec/io/io_multiplexer_spec.rb +94 -94
- data/spec/io/json_drb_object_spec.rb +119 -119
- data/spec/io/json_drb_spec.rb +311 -311
- data/spec/io/json_rpc_spec.rb +264 -264
- data/spec/io/raw_logger_pair_spec.rb +76 -76
- data/spec/io/raw_logger_spec.rb +133 -133
- data/spec/io/serial_driver_spec.rb +60 -60
- data/spec/io/stderr_spec.rb +32 -32
- data/spec/io/stdout_spec.rb +32 -32
- data/spec/io/tcpip_server_spec.rb +338 -338
- data/spec/io/udp_sockets_spec.rb +94 -94
- data/spec/io/win32_serial_driver_spec.rb +88 -88
- data/spec/packet_logs/meta_packet_log_writer_spec.rb +170 -170
- data/spec/packet_logs/packet_log_reader_spec.rb +468 -468
- data/spec/packet_logs/packet_log_writer_pair_spec.rb +30 -30
- data/spec/packet_logs/packet_log_writer_spec.rb +225 -225
- data/spec/packets/binary_accessor_spec.rb +2326 -2326
- data/spec/packets/commands_spec.rb +369 -369
- data/spec/packets/limits_response_spec.rb +25 -25
- data/spec/packets/limits_spec.rb +344 -344
- data/spec/packets/packet_config_spec.rb +805 -805
- data/spec/packets/packet_item_limits_spec.rb +161 -161
- data/spec/packets/packet_item_spec.rb +386 -386
- data/spec/packets/packet_spec.rb +1317 -1317
- data/spec/packets/parsers/format_string_parser_spec.rb +122 -122
- data/spec/packets/parsers/limits_parser_spec.rb +282 -282
- data/spec/packets/parsers/limits_response_parser_spec.rb +149 -149
- data/spec/packets/parsers/macro_parser_spec.rb +212 -212
- data/spec/packets/parsers/packet_item_parser_spec.rb +306 -306
- data/spec/packets/parsers/packet_parser_spec.rb +99 -99
- data/spec/packets/parsers/processor_parser_spec.rb +114 -114
- data/spec/packets/parsers/state_parser_spec.rb +156 -156
- data/spec/packets/structure_item_spec.rb +195 -195
- data/spec/packets/structure_spec.rb +565 -565
- data/spec/packets/telemetry_spec.rb +578 -578
- data/spec/processors/new_packet_log_processor_spec.rb +39 -39
- data/spec/processors/processor_spec.rb +55 -55
- data/spec/processors/statistics_processor_spec.rb +60 -60
- data/spec/processors/watermark_processor_spec.rb +51 -51
- data/spec/script/cmd_tlm_server_spec.rb +110 -110
- data/spec/script/commands_disconnect_spec.rb +270 -270
- data/spec/script/commands_spec.rb +302 -302
- data/spec/script/limits_spec.rb +153 -153
- data/spec/script/script_spec.rb +86 -86
- data/spec/script/scripting_spec.rb +440 -440
- data/spec/script/telemetry_spec.rb +165 -165
- data/spec/script/tools_spec.rb +117 -117
- data/spec/spec_helper.rb +190 -190
- data/spec/streams/burst_stream_protocol_spec.rb +32 -32
- data/spec/streams/fixed_stream_protocol_spec.rb +113 -113
- data/spec/streams/length_stream_protocol_spec.rb +300 -300
- data/spec/streams/preidentified_stream_protocol_spec.rb +121 -121
- data/spec/streams/serial_stream_spec.rb +117 -117
- data/spec/streams/stream_protocol_spec.rb +346 -346
- data/spec/streams/stream_spec.rb +30 -30
- data/spec/streams/tcpip_client_stream_spec.rb +57 -57
- data/spec/streams/tcpip_socket_stream_spec.rb +193 -193
- data/spec/streams/template_stream_protocol_spec.rb +156 -156
- data/spec/streams/terminated_stream_protocol_spec.rb +127 -127
- data/spec/system/system_spec.rb +665 -665
- data/spec/system/target_spec.rb +250 -250
- data/spec/tools/cmd_tlm_server/api_spec.rb +1117 -1117
- data/spec/tools/cmd_tlm_server/background_task_spec.rb +32 -32
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +81 -81
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +453 -453
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +415 -415
- data/spec/tools/cmd_tlm_server/commanding_spec.rb +151 -151
- data/spec/tools/cmd_tlm_server/connections_spec.rb +235 -235
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +306 -306
- data/spec/tools/cmd_tlm_server/interfaces_spec.rb +252 -252
- data/spec/tools/cmd_tlm_server/packet_logging_spec.rb +143 -143
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +151 -151
- data/spec/tools/cmd_tlm_server/routers_spec.rb +223 -223
- data/spec/tools/launcher/launcher_config_spec.rb +464 -464
- data/spec/top_level/top_level_spec.rb +334 -334
- data/spec/utilities/crc_spec.rb +45 -45
- data/spec/utilities/csv_spec.rb +97 -97
- data/spec/utilities/logger_spec.rb +102 -102
- data/spec/utilities/message_log_spec.rb +89 -89
- data/spec/utilities/quaternion_spec.rb +107 -107
- data/spec/utilities/ruby_lex_utils_spec.rb +86 -86
- data/tasks/manifest.rake +22 -22
- data/tasks/spec.rake +23 -23
- data/test/benchmarks/binary_accessor_benchmark.rb +14 -14
- data/test/benchmarks/gsub_benchmark.rb +152 -152
- data/test/benchmarks/is_a_benchmark.rb +34 -34
- data/test/performance/PACKETS.bat +0 -0
- data/test/performance/Rakefile +77 -77
- data/test/performance/THREADS.bat +0 -0
- data/test/performance/config/data/crc.txt +196 -196
- data/test/performance/config/data/diamond.STL +57 -57
- data/test/performance/config/data/meta_init.txt +4 -4
- data/test/performance/config/system/system_packets.txt +39 -39
- data/test/performance/config/system/system_threads.txt +59 -59
- data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +46 -46
- data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -15
- data/test/performance/config/targets/COSMOS/cmd_tlm_server.txt +6 -6
- data/test/performance/config/targets/COSMOS/screens/limits_change.txt +20 -20
- data/test/performance/config/targets/COSMOS/screens/version.txt +19 -19
- data/test/performance/config/targets/COSMOS/target.txt +11 -11
- data/test/performance/config/targets/PACKET/cmd_tlm/packet_cmds.txt +20 -20
- data/test/performance/config/targets/PACKET/cmd_tlm/packet_tlm.txt +98 -98
- data/test/performance/config/targets/PACKET/cmd_tlm_server.txt +6 -6
- data/test/performance/config/targets/PACKET/lib/packet_interface.rb +22 -22
- data/test/performance/config/targets/PACKET/lib/packet_limits_response.rb +24 -24
- data/test/performance/config/targets/PACKET/screens/status.txt +25 -25
- data/test/performance/config/targets/PACKET/target.txt +28 -28
- data/test/performance/config/targets/SYSTEM/screens/status.txt +12 -12
- data/test/performance/config/targets/THREAD/cmd_tlm/thread_cmds.txt +17 -17
- data/test/performance/config/targets/THREAD/cmd_tlm/thread_tlm.txt +18 -18
- data/test/performance/config/targets/THREAD/cmd_tlm_server.txt +6 -6
- data/test/performance/config/targets/THREAD/lib/thread_interface.rb +22 -22
- data/test/performance/config/targets/THREAD/screens/status.txt +25 -25
- data/test/performance/config/targets/THREAD/target.txt +6 -6
- data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_packets.txt +28 -28
- data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_threads.txt +68 -68
- data/test/performance/config/tools/data_viewer/data_viewer.txt +11 -11
- data/test/performance/config/tools/handbook_creator/handbook_creator.txt +66 -66
- data/test/performance/config/tools/handbook_creator/templates/command_packets.html.erb +86 -86
- data/test/performance/config/tools/handbook_creator/templates/command_toc.html.erb +38 -38
- data/test/performance/config/tools/handbook_creator/templates/footer.html.erb +9 -9
- data/test/performance/config/tools/handbook_creator/templates/header.html.erb +25 -25
- data/test/performance/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -13
- data/test/performance/config/tools/handbook_creator/templates/nav.html.erb +27 -27
- data/test/performance/config/tools/handbook_creator/templates/overview.html.erb +1 -1
- data/test/performance/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -23
- data/test/performance/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -33
- data/test/performance/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -41
- data/test/performance/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -80
- data/test/performance/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -38
- data/test/performance/config/tools/handbook_creator/templates/title.html.erb +1 -1
- data/test/performance/config/tools/launcher/launcher_packets.txt +34 -34
- data/test/performance/config/tools/launcher/launcher_threads.txt +83 -83
- data/test/performance/config/tools/script_runner/script_runner.txt +3 -3
- data/test/performance/config/tools/table_manager/ConfigTables_def.txt +8 -8
- data/test/performance/config/tools/table_manager/ExampleTableDefinition.txt +24 -24
- data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +25 -25
- data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +25 -25
- data/test/performance/config/tools/table_manager/PPSSelectionTable_def.txt +8 -8
- data/test/performance/config/tools/table_manager/TLMMonitoringTable_def.txt +248 -248
- data/test/performance/config/tools/test_runner/test_runner.txt +17 -17
- data/test/performance/config/tools/tlm_extractor/tlm_extractor.txt +13 -13
- data/test/performance/config/tools/tlm_extractor/tlm_extractor2.txt +2 -2
- data/test/performance/config/tools/tlm_extractor/tlm_extractor3.txt +2 -2
- data/test/performance/config/tools/tlm_extractor/tlm_extractor4.txt +2 -2
- data/test/performance/config/tools/tlm_grapher/tlm_grapher.txt +204 -204
- data/test/performance/config/tools/tlm_viewer/tlm_viewer.txt +13 -13
- data/test/performance/lib/packet_target.rb +126 -126
- data/test/performance/lib/thread_target.rb +120 -120
- data/test/performance/lib/user_version.rb +3 -3
- data/test/performance/procedures/checks.rb +11 -11
- data/test/performance/procedures/clear_util.rb +7 -7
- data/test/performance/procedures/collect.rb +18 -18
- data/test/performance/procedures/collect_util.rb +14 -14
- data/test/performance/procedures/cosmos_api_test.rb +293 -293
- data/test/performance/procedures/disconnect.rb +29 -29
- data/test/performance/procedures/example_test.rb +182 -182
- data/test/performance/procedures/plot_test.rb +8 -8
- data/test/performance/procedures/procedure.rb +2 -2
- data/test/performance/procedures/run_example_test.rb +3 -3
- data/test/performance/procedures/test.rb +51 -51
- data/test/performance/tools/CmdExtractor +14 -14
- data/test/performance/tools/CmdExtractor.bat +0 -0
- data/test/performance/tools/CmdSender +14 -14
- data/test/performance/tools/CmdSender.bat +0 -0
- data/test/performance/tools/CmdTlmServer +16 -16
- data/test/performance/tools/CmdTlmServer.bat +0 -0
- data/test/performance/tools/CmdTlmServerMemProf +20 -20
- data/test/performance/tools/CmdTlmServerMemProf.bat +0 -0
- data/test/performance/tools/DataViewer +14 -14
- data/test/performance/tools/DataViewer.bat +0 -0
- data/test/performance/tools/HandbookCreator +14 -14
- data/test/performance/tools/HandbookCreator.bat +0 -0
- data/test/performance/tools/Launcher +14 -14
- data/test/performance/tools/Launcher.bat +0 -0
- data/test/performance/tools/LimitsMonitor +14 -14
- data/test/performance/tools/LimitsMonitor.bat +0 -0
- data/test/performance/tools/OpenGLBuilder +14 -14
- data/test/performance/tools/OpenGLBuilder.bat +0 -0
- data/test/performance/tools/PacketTarget +14 -14
- data/test/performance/tools/PacketTarget.bat +0 -0
- data/test/performance/tools/PacketViewer +14 -14
- data/test/performance/tools/PacketViewer.bat +0 -0
- data/test/performance/tools/Replay +14 -14
- data/test/performance/tools/Replay.bat +0 -0
- data/test/performance/tools/ScpiTarget +14 -14
- data/test/performance/tools/ScpiTarget.bat +0 -0
- data/test/performance/tools/ScriptRunner +14 -14
- data/test/performance/tools/ScriptRunner.bat +0 -0
- data/test/performance/tools/TableManager +14 -14
- data/test/performance/tools/TableManager.bat +0 -0
- data/test/performance/tools/TestRunner +14 -14
- data/test/performance/tools/TestRunner.bat +0 -0
- data/test/performance/tools/ThreadTarget +14 -14
- data/test/performance/tools/ThreadTarget.bat +0 -0
- data/test/performance/tools/TlmExtractor +14 -14
- data/test/performance/tools/TlmExtractor.bat +0 -0
- data/test/performance/tools/TlmGrapher +14 -14
- data/test/performance/tools/TlmGrapher.bat +0 -0
- data/test/performance/tools/TlmGrapherMemProf +19 -19
- data/test/performance/tools/TlmGrapherMemProf.bat +0 -0
- data/test/performance/tools/TlmViewer +14 -14
- data/test/performance/tools/TlmViewer.bat +0 -0
- data/test/performance/tools/TlmViewerMemProf +19 -19
- data/test/performance/tools/TlmViewerMemProf.bat +0 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +15 -15
- data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/CmdSender.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +15 -15
- data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +15 -15
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/DataViewer.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +15 -15
- data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +15 -15
- data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/Launcher.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +15 -15
- data/test/performance/tools/mac/Launcher.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +15 -15
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +15 -15
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/PacketViewer.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +15 -15
- data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/Replay.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/Replay.app/Contents/MacOS/Replay.rb +15 -15
- data/test/performance/tools/mac/Replay.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +15 -15
- data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/TableManager.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +15 -15
- data/test/performance/tools/mac/TableManager.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/TestRunner.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +15 -15
- data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +15 -15
- data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +15 -15
- data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +6 -6
- data/test/performance/tools/mac/TlmViewer.app/Contents/Info.plist +38 -38
- data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +15 -15
- data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +6 -6
- metadata +3 -3
data/lib/cosmos/script/script.rb
CHANGED
@@ -1,76 +1,76 @@
|
|
1
|
-
# encoding: ascii-8bit
|
2
|
-
|
3
|
-
# Copyright 2014 Ball Aerospace & Technologies Corp.
|
4
|
-
# All Rights Reserved.
|
5
|
-
#
|
6
|
-
# This program is free software; you can modify and/or redistribute it
|
7
|
-
# under the terms of the GNU General Public License
|
8
|
-
# as published by the Free Software Foundation; version 3 with
|
9
|
-
# attribution addendums as found in the LICENSE.txt
|
10
|
-
|
11
|
-
require 'cosmos'
|
12
|
-
require 'cosmos/io/json_drb_object'
|
13
|
-
require 'cosmos/tools/cmd_tlm_server/cmd_tlm_server'
|
14
|
-
require 'cosmos/script/cmd_tlm_server'
|
15
|
-
require 'cosmos/script/commands'
|
16
|
-
require 'cosmos/script/telemetry'
|
17
|
-
require 'cosmos/script/limits'
|
18
|
-
require 'cosmos/script/scripting'
|
19
|
-
require 'cosmos/script/tools'
|
20
|
-
|
21
|
-
$cmd_tlm_server = nil
|
22
|
-
$cmd_tlm_disconnect = false
|
23
|
-
|
24
|
-
module Cosmos
|
25
|
-
class CheckError < RuntimeError; end
|
26
|
-
class StopScript < StandardError; end
|
27
|
-
class SkipTestCase < StandardError; end
|
28
|
-
|
29
|
-
module Script
|
30
|
-
# All methods are private so they can only be called by themselves and not
|
31
|
-
# on another object. This is important for the JsonDrbObject class which we
|
32
|
-
# use to communicate with the server. JsonDrbObject implements method_missing
|
33
|
-
# to forward calls to the remote service. If these methods were not private,
|
34
|
-
# they would be included on the $cmd_tlm_server global and would be
|
35
|
-
# called directly instead of being forwarded over the JsonDrb connection to
|
36
|
-
# the real server.
|
37
|
-
private
|
38
|
-
|
39
|
-
# Called when this module is mixed in using "include Cosmos::Script"
|
40
|
-
def self.included(base)
|
41
|
-
$cmd_tlm_disconnect = false
|
42
|
-
$cmd_tlm_server = nil
|
43
|
-
initialize_script_module()
|
44
|
-
end
|
45
|
-
|
46
|
-
def initialize_script_module(config_file = CmdTlmServer::DEFAULT_CONFIG_FILE)
|
47
|
-
if $cmd_tlm_disconnect
|
48
|
-
# Start up a standalone CTS in disconnected mode
|
49
|
-
$cmd_tlm_server = CmdTlmServer.new(config_file, false, true)
|
50
|
-
else
|
51
|
-
# Start a Json connect to the real CTS server
|
52
|
-
$cmd_tlm_server = JsonDRbObject.new('127.0.0.1', System.ports['CTS_API'])
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def shutdown_cmd_tlm
|
57
|
-
$cmd_tlm_server.shutdown if $cmd_tlm_server && !$cmd_tlm_disconnect
|
58
|
-
end
|
59
|
-
|
60
|
-
def set_cmd_tlm_disconnect(disconnect = false, config_file = CmdTlmServer::DEFAULT_CONFIG_FILE)
|
61
|
-
if disconnect != $cmd_tlm_disconnect
|
62
|
-
$cmd_tlm_disconnect = disconnect
|
63
|
-
initialize_script_module(config_file)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def get_cmd_tlm_disconnect
|
68
|
-
return $cmd_tlm_disconnect
|
69
|
-
end
|
70
|
-
|
71
|
-
def script_disconnect
|
72
|
-
$cmd_tlm_server.disconnect if $cmd_tlm_server && !$cmd_tlm_disconnect
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
76
|
-
end
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
|
3
|
+
# Copyright 2014 Ball Aerospace & Technologies Corp.
|
4
|
+
# All Rights Reserved.
|
5
|
+
#
|
6
|
+
# This program is free software; you can modify and/or redistribute it
|
7
|
+
# under the terms of the GNU General Public License
|
8
|
+
# as published by the Free Software Foundation; version 3 with
|
9
|
+
# attribution addendums as found in the LICENSE.txt
|
10
|
+
|
11
|
+
require 'cosmos'
|
12
|
+
require 'cosmos/io/json_drb_object'
|
13
|
+
require 'cosmos/tools/cmd_tlm_server/cmd_tlm_server'
|
14
|
+
require 'cosmos/script/cmd_tlm_server'
|
15
|
+
require 'cosmos/script/commands'
|
16
|
+
require 'cosmos/script/telemetry'
|
17
|
+
require 'cosmos/script/limits'
|
18
|
+
require 'cosmos/script/scripting'
|
19
|
+
require 'cosmos/script/tools'
|
20
|
+
|
21
|
+
$cmd_tlm_server = nil
|
22
|
+
$cmd_tlm_disconnect = false
|
23
|
+
|
24
|
+
module Cosmos
|
25
|
+
class CheckError < RuntimeError; end
|
26
|
+
class StopScript < StandardError; end
|
27
|
+
class SkipTestCase < StandardError; end
|
28
|
+
|
29
|
+
module Script
|
30
|
+
# All methods are private so they can only be called by themselves and not
|
31
|
+
# on another object. This is important for the JsonDrbObject class which we
|
32
|
+
# use to communicate with the server. JsonDrbObject implements method_missing
|
33
|
+
# to forward calls to the remote service. If these methods were not private,
|
34
|
+
# they would be included on the $cmd_tlm_server global and would be
|
35
|
+
# called directly instead of being forwarded over the JsonDrb connection to
|
36
|
+
# the real server.
|
37
|
+
private
|
38
|
+
|
39
|
+
# Called when this module is mixed in using "include Cosmos::Script"
|
40
|
+
def self.included(base)
|
41
|
+
$cmd_tlm_disconnect = false
|
42
|
+
$cmd_tlm_server = nil
|
43
|
+
initialize_script_module()
|
44
|
+
end
|
45
|
+
|
46
|
+
def initialize_script_module(config_file = CmdTlmServer::DEFAULT_CONFIG_FILE)
|
47
|
+
if $cmd_tlm_disconnect
|
48
|
+
# Start up a standalone CTS in disconnected mode
|
49
|
+
$cmd_tlm_server = CmdTlmServer.new(config_file, false, true)
|
50
|
+
else
|
51
|
+
# Start a Json connect to the real CTS server
|
52
|
+
$cmd_tlm_server = JsonDRbObject.new('127.0.0.1', System.ports['CTS_API'])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def shutdown_cmd_tlm
|
57
|
+
$cmd_tlm_server.shutdown if $cmd_tlm_server && !$cmd_tlm_disconnect
|
58
|
+
end
|
59
|
+
|
60
|
+
def set_cmd_tlm_disconnect(disconnect = false, config_file = CmdTlmServer::DEFAULT_CONFIG_FILE)
|
61
|
+
if disconnect != $cmd_tlm_disconnect
|
62
|
+
$cmd_tlm_disconnect = disconnect
|
63
|
+
initialize_script_module(config_file)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def get_cmd_tlm_disconnect
|
68
|
+
return $cmd_tlm_disconnect
|
69
|
+
end
|
70
|
+
|
71
|
+
def script_disconnect
|
72
|
+
$cmd_tlm_server.disconnect if $cmd_tlm_server && !$cmd_tlm_disconnect
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
@@ -1,897 +1,897 @@
|
|
1
|
-
# encoding: ascii-8bit
|
2
|
-
|
3
|
-
# Copyright 2014 Ball Aerospace & Technologies Corp.
|
4
|
-
# All Rights Reserved.
|
5
|
-
#
|
6
|
-
# This program is free software; you can modify and/or redistribute it
|
7
|
-
# under the terms of the GNU General Public License
|
8
|
-
# as published by the Free Software Foundation; version 3 with
|
9
|
-
# attribution addendums as found in the LICENSE.txt
|
10
|
-
|
11
|
-
require 'cosmos/script/extract'
|
12
|
-
|
13
|
-
module Cosmos
|
14
|
-
module Script
|
15
|
-
DEFAULT_TLM_POLLING_RATE = 0.25
|
16
|
-
|
17
|
-
private
|
18
|
-
# Include various methods to extract fields from text
|
19
|
-
include Extract
|
20
|
-
|
21
|
-
def play_wav_file(wav_filename)
|
22
|
-
Cosmos.play_wav_file(wav_filename)
|
23
|
-
end
|
24
|
-
|
25
|
-
def status_bar(message)
|
26
|
-
script_runner = nil
|
27
|
-
ObjectSpace.each_object {|object| if ScriptRunner === object then script_runner = object; break; end}
|
28
|
-
script_runner.script_set_status(message) if script_runner
|
29
|
-
end
|
30
|
-
|
31
|
-
def ask_string(question, blank_or_default = false, password = false)
|
32
|
-
answer = ''
|
33
|
-
default = ''
|
34
|
-
if blank_or_default != true && blank_or_default != false
|
35
|
-
question << " (default = #{blank_or_default})"
|
36
|
-
allow_blank = true
|
37
|
-
else
|
38
|
-
allow_blank = blank_or_default
|
39
|
-
end
|
40
|
-
while answer.empty?
|
41
|
-
print question + " "
|
42
|
-
answer = gets
|
43
|
-
answer.chomp!
|
44
|
-
break if allow_blank
|
45
|
-
end
|
46
|
-
answer = default if answer.empty? and !default.empty?
|
47
|
-
return answer
|
48
|
-
end
|
49
|
-
|
50
|
-
def ask(question, blank_or_default = false, password = false)
|
51
|
-
string = ask_string(question, blank_or_default, password)
|
52
|
-
value = string.convert_to_value
|
53
|
-
return value
|
54
|
-
end
|
55
|
-
|
56
|
-
def prompt(string)
|
57
|
-
prompt_to_continue(string)
|
58
|
-
end
|
59
|
-
|
60
|
-
def message_box(string, *buttons)
|
61
|
-
prompt_message_box(string, buttons)
|
62
|
-
end
|
63
|
-
|
64
|
-
def vertical_message_box(string, *buttons)
|
65
|
-
prompt_vertical_message_box(string, buttons)
|
66
|
-
end
|
67
|
-
|
68
|
-
def combo_box(string, *options)
|
69
|
-
prompt_combo_box(string, options)
|
70
|
-
end
|
71
|
-
|
72
|
-
# Creates a string with the parameters upcased
|
73
|
-
def _upcase(target_name, packet_name, item_name)
|
74
|
-
"#{target_name.upcase} #{packet_name.upcase} #{item_name.upcase}"
|
75
|
-
end
|
76
|
-
|
77
|
-
# Implementaiton of the various check commands. It yields back to the
|
78
|
-
# caller to allow the return of the value through various telemetry calls.
|
79
|
-
# This method should not be called directly by application code.
|
80
|
-
def _check(*args)
|
81
|
-
target_name, packet_name, item_name, comparison_to_eval = check_process_args(args, 'check')
|
82
|
-
value = yield(target_name, packet_name, item_name)
|
83
|
-
if comparison_to_eval
|
84
|
-
check_eval(target_name, packet_name, item_name, comparison_to_eval, value)
|
85
|
-
else
|
86
|
-
Logger.info "CHECK: #{_upcase(target_name, packet_name, item_name)} == #{value}"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
# Check the converted value of a telmetry item against a condition
|
91
|
-
# Always print the value of the telemetry item to STDOUT
|
92
|
-
# If the condition check fails, raise an error
|
93
|
-
# Supports two signatures:
|
94
|
-
# check(target_name, packet_name, item_name, comparison_to_eval)
|
95
|
-
# or
|
96
|
-
# check('target_name packet_name item_name > 1')
|
97
|
-
def check(*args)
|
98
|
-
_check(*args) {|tgt,pkt,item| tlm(tgt,pkt,item) }
|
99
|
-
end
|
100
|
-
|
101
|
-
# Check the formatted value of a telmetry item against a condition
|
102
|
-
# Always print the value of the telemetry item to STDOUT
|
103
|
-
# If the condition check fails, raise an error
|
104
|
-
# Supports two signatures:
|
105
|
-
# check(target_name, packet_name, item_name, comparison_to_eval)
|
106
|
-
# or
|
107
|
-
# check('target_name packet_name item_name > 1')
|
108
|
-
def check_formatted(*args)
|
109
|
-
_check(*args) {|tgt,pkt,item| tlm_formatted(tgt,pkt,item) }
|
110
|
-
end
|
111
|
-
|
112
|
-
# Check the formatted with units value of a telmetry item against a condition
|
113
|
-
# Always print the value of the telemetry item to STDOUT
|
114
|
-
# If the condition check fails, raise an error
|
115
|
-
# Supports two signatures:
|
116
|
-
# check(target_name, packet_name, item_name, comparison_to_eval)
|
117
|
-
# or
|
118
|
-
# check('target_name packet_name item_name > 1')
|
119
|
-
def check_with_units(*args)
|
120
|
-
_check(*args) {|tgt,pkt,item| tlm_with_units(tgt,pkt,item) }
|
121
|
-
end
|
122
|
-
|
123
|
-
# Check the raw value of a telmetry item against a condition
|
124
|
-
# Always print the value of the telemetry item to STDOUT
|
125
|
-
# If the condition check fails, raise an error
|
126
|
-
# Supports two signatures:
|
127
|
-
# check(target_name, packet_name, item_name, comparison_to_eval)
|
128
|
-
# or
|
129
|
-
# check('target_name packet_name item_name > 1')
|
130
|
-
def check_raw(*args)
|
131
|
-
_check(*args) {|tgt,pkt,item| tlm_raw(tgt,pkt,item) }
|
132
|
-
end
|
133
|
-
|
134
|
-
def _check_tolerance(*args)
|
135
|
-
target_name, packet_name, item_name, expected_value, tolerance =
|
136
|
-
check_tolerance_process_args(args, 'check_tolerance')
|
137
|
-
value = yield(target_name, packet_name, item_name)
|
138
|
-
range = (expected_value - tolerance)..(expected_value + tolerance)
|
139
|
-
check_str = "CHECK: #{_upcase(target_name, packet_name, item_name)}"
|
140
|
-
range_str = "range #{range.first} to #{range.last} with value == #{value}"
|
141
|
-
if range.include?(value)
|
142
|
-
Logger.info "#{check_str} was within #{range_str}"
|
143
|
-
else
|
144
|
-
message = "#{check_str} failed to be within #{range_str}"
|
145
|
-
if $cmd_tlm_disconnect
|
146
|
-
Logger.error message
|
147
|
-
else
|
148
|
-
raise CheckError, message
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
# Check the converted value of a telmetry item against an expected value with a tolerance
|
154
|
-
# Always print the value of the telemetry item to STDOUT
|
155
|
-
# If the condition check fails, raise an error
|
156
|
-
# Supports two signatures:
|
157
|
-
# check_tolerance(target_name, packet_name, item_name, expected_value, tolerance)
|
158
|
-
# or
|
159
|
-
# check_tolerance('target_name packet_name item_name', expected_value, tolerance)
|
160
|
-
def check_tolerance(*args)
|
161
|
-
_check_tolerance(*args) {|tgt,pkt,item| tlm(tgt,pkt,item) }
|
162
|
-
end
|
163
|
-
|
164
|
-
# Check the raw value of a telmetry item against an expected value with a tolerance
|
165
|
-
# Always print the value of the telemetry item to STDOUT
|
166
|
-
# If the condition check fails, raise an error
|
167
|
-
# Supports two signatures:
|
168
|
-
# check_tolerance_raw(target_name, packet_name, item_name, expected_value, tolerance)
|
169
|
-
# or
|
170
|
-
# check_tolerance_raw('target_name packet_name item_name', expected_value, tolerance)
|
171
|
-
def check_tolerance_raw(*args)
|
172
|
-
_check_tolerance(*args) {|tgt,pkt,item| tlm_raw(tgt,pkt,item) }
|
173
|
-
end
|
174
|
-
|
175
|
-
# Check to see if an expression is true without waiting. If the expression
|
176
|
-
# is not true, the script will pause.
|
177
|
-
def check_expression(exp_to_eval, context = nil)
|
178
|
-
success = cosmos_script_wait_implementation_expression(exp_to_eval, 0, DEFAULT_TLM_POLLING_RATE, context)
|
179
|
-
if success
|
180
|
-
Logger.info "CHECK: #{exp_to_eval} is TRUE"
|
181
|
-
else
|
182
|
-
message = "CHECK: #{exp_to_eval} is FALSE"
|
183
|
-
if $cmd_tlm_disconnect
|
184
|
-
Logger.error message
|
185
|
-
else
|
186
|
-
raise CheckError, message
|
187
|
-
end
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
# Wait on an expression to be true. On a timeout, the script will continue.
|
192
|
-
# Supports multiple signatures:
|
193
|
-
# wait(time)
|
194
|
-
# wait('target_name packet_name item_name > 1', timeout, polling_rate)
|
195
|
-
# wait('target_name', 'packet_name', 'item_name', comparison_to_eval, timeout, polling_rate)
|
196
|
-
def wait(*args)
|
197
|
-
wait_process_args(args, 'wait', :CONVERTED)
|
198
|
-
end
|
199
|
-
|
200
|
-
# Wait on an expression to be true. On a timeout, the script will continue.
|
201
|
-
# Supports multiple signatures:
|
202
|
-
# wait(time)
|
203
|
-
# wait_raw('target_name packet_name item_name > 1', timeout, polling_rate)
|
204
|
-
# wait_raw('target_name', 'packet_name', 'item_name', comparison_to_eval, timeout, polling_rate)
|
205
|
-
def wait_raw(*args)
|
206
|
-
wait_process_args(args, 'wait_raw', :RAW)
|
207
|
-
end
|
208
|
-
|
209
|
-
def _wait_tolerance(raw, *args)
|
210
|
-
type = (raw ? :RAW : :CONVERTED)
|
211
|
-
type_string = 'wait_tolerance'
|
212
|
-
type_string << '_raw' if raw
|
213
|
-
target_name, packet_name, item_name, expected_value, tolerance, timeout, polling_rate = wait_tolerance_process_args(args, type_string)
|
214
|
-
start_time = Time.now
|
215
|
-
success, value = cosmos_script_wait_implementation_tolerance(target_name, packet_name, item_name, type, expected_value, tolerance, timeout, polling_rate)
|
216
|
-
time = Time.now - start_time
|
217
|
-
range = (expected_value - tolerance)..(expected_value + tolerance)
|
218
|
-
wait_str = "WAIT: #{_upcase(target_name, packet_name, item_name)}"
|
219
|
-
range_str = "range #{range.first} to #{range.last} with value == #{value} after waiting #{time} seconds"
|
220
|
-
if success
|
221
|
-
Logger.info "#{wait_str} was within #{range_str}"
|
222
|
-
else
|
223
|
-
Logger.warn "#{wait_str} failed to be within #{range_str}"
|
224
|
-
end
|
225
|
-
time
|
226
|
-
end
|
227
|
-
|
228
|
-
# Wait on an expression to be true. On a timeout, the script will continue.
|
229
|
-
# Supports multiple signatures:
|
230
|
-
# wait_tolerance('target_name packet_name item_name', expected_value, tolerance, timeout, polling_rate)
|
231
|
-
# wait_tolerance('target_name', 'packet_name', 'item_name', expected_value, tolerance, timeout, polling_rate)
|
232
|
-
def wait_tolerance(*args)
|
233
|
-
_wait_tolerance(false, *args)
|
234
|
-
end
|
235
|
-
|
236
|
-
# Wait on an expression to be true. On a timeout, the script will continue.
|
237
|
-
# Supports multiple signatures:
|
238
|
-
# wait_tolerance_raw('target_name packet_name item_name', expected_value, tolerance, timeout, polling_rate)
|
239
|
-
# wait_tolerance_raw('target_name', 'packet_name', 'item_name', expected_value, tolerance, timeout, polling_rate)
|
240
|
-
def wait_tolerance_raw(*args)
|
241
|
-
_wait_tolerance(true, *args)
|
242
|
-
end
|
243
|
-
|
244
|
-
# Wait on a custom expression to be true
|
245
|
-
def wait_expression(exp_to_eval, timeout, polling_rate = DEFAULT_TLM_POLLING_RATE, context = nil)
|
246
|
-
start_time = Time.now
|
247
|
-
success = cosmos_script_wait_implementation_expression(exp_to_eval, timeout, polling_rate, context)
|
248
|
-
time = Time.now - start_time
|
249
|
-
if success
|
250
|
-
Logger.info "WAIT: #{exp_to_eval} is TRUE after waiting #{time} seconds"
|
251
|
-
else
|
252
|
-
Logger.warn "WAIT: #{exp_to_eval} is FALSE after waiting #{time} seconds"
|
253
|
-
end
|
254
|
-
time
|
255
|
-
end
|
256
|
-
|
257
|
-
def _wait_check(raw, *args)
|
258
|
-
type = (raw ? :RAW : :CONVERTED)
|
259
|
-
target_name, packet_name, item_name, comparison_to_eval, timeout, polling_rate = wait_check_process_args(args, 'wait_check')
|
260
|
-
start_time = Time.now
|
261
|
-
success, value = cosmos_script_wait_implementation(target_name, packet_name, item_name, type, comparison_to_eval, timeout, polling_rate)
|
262
|
-
time = Time.now - start_time
|
263
|
-
check_str = "CHECK: #{_upcase(target_name, packet_name, item_name)} #{comparison_to_eval}"
|
264
|
-
with_value_str = "with value == #{value} after waiting #{time} seconds"
|
265
|
-
if success
|
266
|
-
Logger.info "#{check_str} success #{with_value_str}"
|
267
|
-
else
|
268
|
-
message = "#{check_str} failed #{with_value_str}"
|
269
|
-
if $cmd_tlm_disconnect
|
270
|
-
Logger.error message
|
271
|
-
else
|
272
|
-
raise CheckError, message
|
273
|
-
end
|
274
|
-
end
|
275
|
-
time
|
276
|
-
end
|
277
|
-
|
278
|
-
# Wait for the converted value of a telmetry item against a condition or for a timeout
|
279
|
-
# and then check against the condition
|
280
|
-
# Supports two signatures:
|
281
|
-
# wait_check(target_name, packet_name, item_name, comparison_to_eval, timeout, polling_rate)
|
282
|
-
# or
|
283
|
-
# wait_check('target_name packet_name item_name > 1', timeout, polling_rate)
|
284
|
-
def wait_check(*args)
|
285
|
-
_wait_check(false, *args)
|
286
|
-
end
|
287
|
-
|
288
|
-
# Wait for the raw value of a telmetry item against a condition or for a timeout
|
289
|
-
# and then check against the condition
|
290
|
-
# Supports two signatures:
|
291
|
-
# wait_check_raw(target_name, packet_name, item_name, comparison_to_eval, timeout, polling_rate)
|
292
|
-
# or
|
293
|
-
# wait_check_raw('target_name packet_name item_name > 1', timeout, polling_rate)
|
294
|
-
def wait_check_raw(*args)
|
295
|
-
_wait_check(true, *args)
|
296
|
-
end
|
297
|
-
|
298
|
-
def _wait_check_tolerance(raw, *args)
|
299
|
-
type_string = 'wait_check_tolerance'
|
300
|
-
type_string << '_raw' if raw
|
301
|
-
type = (raw ? :RAW : :CONVERTED)
|
302
|
-
target_name, packet_name, item_name, expected_value, tolerance, timeout, polling_rate = wait_tolerance_process_args(args, type_string)
|
303
|
-
start_time = Time.now
|
304
|
-
success, value = cosmos_script_wait_implementation_tolerance(target_name, packet_name, item_name, type, expected_value, tolerance, timeout, polling_rate)
|
305
|
-
time = Time.now - start_time
|
306
|
-
range = (expected_value - tolerance)..(expected_value + tolerance)
|
307
|
-
check_str = "CHECK: #{_upcase(target_name, packet_name, item_name)}"
|
308
|
-
range_str = "range #{range.first} to #{range.last} with value == #{value} after waiting #{time} seconds"
|
309
|
-
if success
|
310
|
-
Logger.info "#{check_str} was within #{range_str}"
|
311
|
-
else
|
312
|
-
message = "#{check_str} failed to be within #{range_str}"
|
313
|
-
if $cmd_tlm_disconnect
|
314
|
-
Logger.error message
|
315
|
-
else
|
316
|
-
raise CheckError, message
|
317
|
-
end
|
318
|
-
end
|
319
|
-
time
|
320
|
-
end
|
321
|
-
|
322
|
-
def wait_check_tolerance(*args)
|
323
|
-
_wait_check_tolerance(false, *args)
|
324
|
-
end
|
325
|
-
|
326
|
-
def wait_check_tolerance_raw(*args)
|
327
|
-
_wait_check_tolerance(true, *args)
|
328
|
-
end
|
329
|
-
|
330
|
-
# Wait on an expression to be true. On a timeout, the script will pause.
|
331
|
-
def wait_check_expression(exp_to_eval,
|
332
|
-
timeout,
|
333
|
-
polling_rate = DEFAULT_TLM_POLLING_RATE,
|
334
|
-
context = nil)
|
335
|
-
start_time = Time.now
|
336
|
-
success = cosmos_script_wait_implementation_expression(exp_to_eval,
|
337
|
-
timeout,
|
338
|
-
polling_rate,
|
339
|
-
context)
|
340
|
-
time = Time.now - start_time
|
341
|
-
if success
|
342
|
-
Logger.info "CHECK: #{exp_to_eval} is TRUE after waiting #{time} seconds"
|
343
|
-
else
|
344
|
-
message = "CHECK: #{exp_to_eval} is FALSE after waiting #{time} seconds"
|
345
|
-
if $cmd_tlm_disconnect
|
346
|
-
Logger.error message
|
347
|
-
else
|
348
|
-
raise CheckError, message
|
349
|
-
end
|
350
|
-
end
|
351
|
-
time
|
352
|
-
end
|
353
|
-
alias wait_expression_stop_on_timeout wait_check_expression
|
354
|
-
|
355
|
-
# Wait for a telemetry packet to be received a certain number of times or timeout
|
356
|
-
def _wait_packet(check,
|
357
|
-
target_name,
|
358
|
-
packet_name,
|
359
|
-
num_packets,
|
360
|
-
timeout,
|
361
|
-
polling_rate = DEFAULT_TLM_POLLING_RATE)
|
362
|
-
type = (check ? 'CHECK' : 'WAIT')
|
363
|
-
initial_count = tlm(target_name, packet_name, 'RECEIVED_COUNT')
|
364
|
-
start_time = Time.now
|
365
|
-
success, value = cosmos_script_wait_implementation(target_name,
|
366
|
-
packet_name,
|
367
|
-
'RECEIVED_COUNT',
|
368
|
-
:CONVERTED,
|
369
|
-
">= #{initial_count + num_packets}",
|
370
|
-
timeout,
|
371
|
-
polling_rate)
|
372
|
-
time = Time.now - start_time
|
373
|
-
if success
|
374
|
-
Logger.info "#{type}: #{target_name.upcase} #{packet_name.upcase} received #{value - initial_count} times after waiting #{time} seconds"
|
375
|
-
else
|
376
|
-
message = "#{type}: #{target_name.upcase} #{packet_name.upcase} expected to be received #{num_packets} times but only received #{value - initial_count} times after waiting #{time} seconds"
|
377
|
-
if check
|
378
|
-
if $cmd_tlm_disconnect
|
379
|
-
Logger.error message
|
380
|
-
else
|
381
|
-
raise CheckError, message
|
382
|
-
end
|
383
|
-
else
|
384
|
-
Logger.warn message
|
385
|
-
end
|
386
|
-
end
|
387
|
-
time
|
388
|
-
end
|
389
|
-
|
390
|
-
def wait_packet(target_name,
|
391
|
-
packet_name,
|
392
|
-
num_packets,
|
393
|
-
timeout,
|
394
|
-
polling_rate = DEFAULT_TLM_POLLING_RATE)
|
395
|
-
_wait_packet(false, target_name, packet_name, num_packets, timeout, polling_rate)
|
396
|
-
end
|
397
|
-
|
398
|
-
# Wait for a telemetry packet to be received a certain number of times or timeout and raise an error
|
399
|
-
def wait_check_packet(target_name,
|
400
|
-
packet_name,
|
401
|
-
num_packets,
|
402
|
-
timeout,
|
403
|
-
polling_rate = DEFAULT_TLM_POLLING_RATE)
|
404
|
-
_wait_packet(true, target_name, packet_name, num_packets, timeout, polling_rate)
|
405
|
-
end
|
406
|
-
|
407
|
-
def _get_procedure_path(procedure_name)
|
408
|
-
# Handle not-giving an extension
|
409
|
-
procedure_name_with_extension = nil
|
410
|
-
procedure_name_with_extension = procedure_name + '.rb' if File.extname(procedure_name).empty?
|
411
|
-
|
412
|
-
path = nil
|
413
|
-
|
414
|
-
# Find filename in search path
|
415
|
-
($:).each do |directory|
|
416
|
-
if File.exist?(directory + '/' + procedure_name) and not File.directory?(directory + '/' + procedure_name)
|
417
|
-
path = directory + '/' + procedure_name
|
418
|
-
break
|
419
|
-
end
|
420
|
-
|
421
|
-
if procedure_name_with_extension and File.exist?(directory + '/' + procedure_name_with_extension)
|
422
|
-
procedure_name = procedure_name_with_extension
|
423
|
-
path = directory + '/' + procedure_name
|
424
|
-
break
|
425
|
-
end
|
426
|
-
end
|
427
|
-
|
428
|
-
# Handle absolute path
|
429
|
-
path = procedure_name if !path and File.exist?(procedure_name)
|
430
|
-
path = procedure_name_with_extension if !path and procedure_name_with_extension and File.exist?(procedure_name_with_extension)
|
431
|
-
|
432
|
-
raise "Procedure not found : #{procedure_name}" unless path
|
433
|
-
path
|
434
|
-
end
|
435
|
-
|
436
|
-
def check_file_cache_for_instrumented_script(path, md5)
|
437
|
-
instrumented_script = nil
|
438
|
-
cached = true
|
439
|
-
use_file_cache = true
|
440
|
-
|
441
|
-
Cosmos.set_working_dir do
|
442
|
-
cache_path = File.join(System.paths['TMP'], 'script_runner')
|
443
|
-
unless File.directory?(cache_path)
|
444
|
-
# Try to create .cache directory
|
445
|
-
begin
|
446
|
-
Dir.mkdir(cache_path)
|
447
|
-
rescue
|
448
|
-
use_file_cache = false
|
449
|
-
end
|
450
|
-
end
|
451
|
-
|
452
|
-
cache_filename = nil
|
453
|
-
if use_file_cache
|
454
|
-
# Check file based instrumented cache
|
455
|
-
flat_path = path.tr("/", "_").gsub("\\", "_").tr(":", "_").tr(" ", "_")
|
456
|
-
flat_path_with_md5 = flat_path + '_' + md5
|
457
|
-
cache_filename = File.join(cache_path, flat_path_with_md5)
|
458
|
-
end
|
459
|
-
|
460
|
-
if use_file_cache and File.exist?(cache_filename)
|
461
|
-
# Use file cached instrumentation
|
462
|
-
File.open(cache_filename, 'r') {|file| instrumented_script = file.read}
|
463
|
-
else
|
464
|
-
cached = false
|
465
|
-
|
466
|
-
# Build instrumentation
|
467
|
-
file_text = ''
|
468
|
-
begin
|
469
|
-
file_text = File.read(path)
|
470
|
-
rescue Exception => error
|
471
|
-
raise "Error reading procedure file : #{path}"
|
472
|
-
end
|
473
|
-
|
474
|
-
instrumented_script = ScriptRunnerFrame.instrument_script(file_text, path, true)
|
475
|
-
|
476
|
-
# Cache instrumentation into file
|
477
|
-
if use_file_cache
|
478
|
-
begin
|
479
|
-
File.open(cache_filename, 'w') {|file| file.write(instrumented_script)}
|
480
|
-
rescue
|
481
|
-
# Oh well, failed to write cache file
|
482
|
-
end
|
483
|
-
end
|
484
|
-
end
|
485
|
-
end
|
486
|
-
[instrumented_script, cached]
|
487
|
-
end
|
488
|
-
|
489
|
-
def start(procedure_name)
|
490
|
-
cached = true
|
491
|
-
path = _get_procedure_path(procedure_name)
|
492
|
-
|
493
|
-
if defined? ScriptRunnerFrame and ScriptRunnerFrame.instance
|
494
|
-
md5 = nil
|
495
|
-
begin
|
496
|
-
md5 = Cosmos.md5_files([path]).hexdigest
|
497
|
-
rescue Exception => error
|
498
|
-
raise "Error calculating md5 on procedure file : #{path}"
|
499
|
-
end
|
500
|
-
|
501
|
-
# Check RAM based instrumented cache
|
502
|
-
instrumented_cache = ScriptRunnerFrame.instrumented_cache[path]
|
503
|
-
instrumented_script = nil
|
504
|
-
if instrumented_cache and md5 == instrumented_cache[1]
|
505
|
-
# Use cached instrumentation
|
506
|
-
instrumented_script = instrumented_cache[0]
|
507
|
-
else
|
508
|
-
instrumented_script, cached = check_file_cache_for_instrumented_script(path, md5)
|
509
|
-
# Cache instrumentation into RAM
|
510
|
-
ScriptRunnerFrame.instrumented_cache[path] = [instrumented_script, md5]
|
511
|
-
end
|
512
|
-
|
513
|
-
Object.class_eval(instrumented_script, path, 1)
|
514
|
-
else # No ScriptRunnerFrame so just start it locally
|
515
|
-
cached = false
|
516
|
-
begin
|
517
|
-
Kernel::load(path)
|
518
|
-
rescue LoadError => error
|
519
|
-
raise RuntimeError.new("Error loading : #{procedure_name} : #{error.message}")
|
520
|
-
end
|
521
|
-
end
|
522
|
-
# Return whether we had to load and instrument this file, i.e. it was not cached
|
523
|
-
!cached
|
524
|
-
end
|
525
|
-
|
526
|
-
# Require an additional ruby file
|
527
|
-
def load_utility(procedure_name)
|
528
|
-
cached = true
|
529
|
-
if defined? ScriptRunnerFrame and ScriptRunnerFrame.instance
|
530
|
-
saved = ScriptRunnerFrame.instance.use_instrumentation
|
531
|
-
begin
|
532
|
-
ScriptRunnerFrame.instance.use_instrumentation = false
|
533
|
-
cached = start(procedure_name)
|
534
|
-
ensure
|
535
|
-
ScriptRunnerFrame.instance.use_instrumentation = saved
|
536
|
-
end
|
537
|
-
else # Just call start
|
538
|
-
cached = start(procedure_name)
|
539
|
-
end
|
540
|
-
# Return whether we had to load and instrument this file, i.e. it was not cached
|
541
|
-
# This is designed to match the behavior of Ruby's require and load keywords
|
542
|
-
!cached
|
543
|
-
end
|
544
|
-
alias require_utility load_utility
|
545
|
-
|
546
|
-
##########################################
|
547
|
-
# Protected Methods
|
548
|
-
##########################################
|
549
|
-
|
550
|
-
def check_process_args(args, function_name)
|
551
|
-
case args.length
|
552
|
-
when 1
|
553
|
-
target_name, packet_name, item_name, comparison_to_eval = extract_fields_from_check_text(args[0])
|
554
|
-
when 4
|
555
|
-
target_name = args[0]
|
556
|
-
packet_name = args[1]
|
557
|
-
item_name = args[2]
|
558
|
-
comparison_to_eval = args[3]
|
559
|
-
else
|
560
|
-
# Invalid number of arguments
|
561
|
-
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{function_name}()"
|
562
|
-
end
|
563
|
-
return [target_name, packet_name, item_name, comparison_to_eval]
|
564
|
-
end
|
565
|
-
|
566
|
-
def check_tolerance_process_args(args, function_name)
|
567
|
-
case args.length
|
568
|
-
when 3
|
569
|
-
target_name, packet_name, item_name = extract_fields_from_tlm_text(args[0])
|
570
|
-
expected_value = args[1]
|
571
|
-
tolerance = args[2]
|
572
|
-
when 5
|
573
|
-
target_name = args[0]
|
574
|
-
packet_name = args[1]
|
575
|
-
item_name = args[2]
|
576
|
-
expected_value = args[3]
|
577
|
-
tolerance = args[4]
|
578
|
-
else
|
579
|
-
# Invalid number of arguments
|
580
|
-
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{function_name}()"
|
581
|
-
end
|
582
|
-
return [target_name, packet_name, item_name, expected_value, tolerance]
|
583
|
-
end
|
584
|
-
|
585
|
-
def _execute_wait(target_name, packet_name, item_name, value_type, comparison_to_eval, timeout, polling_rate)
|
586
|
-
start_time = Time.now
|
587
|
-
success, value = cosmos_script_wait_implementation(target_name, packet_name, item_name, value_type, comparison_to_eval, timeout, polling_rate)
|
588
|
-
time = Time.now - start_time
|
589
|
-
wait_str = "WAIT: #{_upcase(target_name, packet_name, item_name)} #{comparison_to_eval}"
|
590
|
-
value_str = "with value == #{value} after waiting #{time} seconds"
|
591
|
-
if success
|
592
|
-
Logger.info "#{wait_str} success #{value_str}"
|
593
|
-
else
|
594
|
-
Logger.warn "#{wait_str} failed #{value_str}"
|
595
|
-
end
|
596
|
-
end
|
597
|
-
|
598
|
-
def wait_process_args(args, function_name, value_type)
|
599
|
-
time = nil
|
600
|
-
|
601
|
-
case args.length
|
602
|
-
when 0
|
603
|
-
start_time = Time.now
|
604
|
-
cosmos_script_sleep()
|
605
|
-
time = Time.now - start_time
|
606
|
-
Logger.info("WAIT: Indefinite for actual time of #{time} seconds")
|
607
|
-
when 1
|
608
|
-
if args[0].kind_of? Numeric
|
609
|
-
start_time = Time.now
|
610
|
-
cosmos_script_sleep(args[0])
|
611
|
-
time = Time.now - start_time
|
612
|
-
Logger.info("WAIT: #{args[0]} seconds with actual time of #{time} seconds")
|
613
|
-
else
|
614
|
-
raise "Non-numeric wait time specified"
|
615
|
-
end
|
616
|
-
when 2, 3
|
617
|
-
target_name, packet_name, item_name, comparison_to_eval = extract_fields_from_check_text(args[0])
|
618
|
-
timeout = args[1]
|
619
|
-
if args.length == 3
|
620
|
-
polling_rate = args[2]
|
621
|
-
else
|
622
|
-
polling_rate = DEFAULT_TLM_POLLING_RATE
|
623
|
-
end
|
624
|
-
_execute_wait(target_name, packet_name, item_name, value_type, comparison_to_eval, timeout, polling_rate)
|
625
|
-
|
626
|
-
when 5, 6
|
627
|
-
target_name = args[0]
|
628
|
-
packet_name = args[1]
|
629
|
-
item_name = args[2]
|
630
|
-
comparison_to_eval = args[3]
|
631
|
-
timeout = args[4]
|
632
|
-
if args.length == 6
|
633
|
-
polling_rate = args[5]
|
634
|
-
else
|
635
|
-
polling_rate = DEFAULT_TLM_POLLING_RATE
|
636
|
-
end
|
637
|
-
_execute_wait(target_name, packet_name, item_name, value_type, comparison_to_eval, timeout, polling_rate)
|
638
|
-
|
639
|
-
else
|
640
|
-
# Invalid number of arguments
|
641
|
-
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{function_name}()"
|
642
|
-
end
|
643
|
-
time
|
644
|
-
end
|
645
|
-
|
646
|
-
def wait_tolerance_process_args(args, function_name)
|
647
|
-
case args.length
|
648
|
-
when 4, 5
|
649
|
-
target_name, packet_name, item_name = extract_fields_from_tlm_text(args[0])
|
650
|
-
expected_value = args[1]
|
651
|
-
tolerance = args[2]
|
652
|
-
timeout = args[3]
|
653
|
-
if args.length == 5
|
654
|
-
polling_rate = args[4]
|
655
|
-
else
|
656
|
-
polling_rate = DEFAULT_TLM_POLLING_RATE
|
657
|
-
end
|
658
|
-
when 6, 7
|
659
|
-
target_name = args[0]
|
660
|
-
packet_name = args[1]
|
661
|
-
item_name = args[2]
|
662
|
-
expected_value = args[3]
|
663
|
-
tolerance = args[4]
|
664
|
-
timeout = args[5]
|
665
|
-
if args.length == 7
|
666
|
-
polling_rate = args[6]
|
667
|
-
else
|
668
|
-
polling_rate = DEFAULT_TLM_POLLING_RATE
|
669
|
-
end
|
670
|
-
else
|
671
|
-
# Invalid number of arguments
|
672
|
-
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{function_name}()"
|
673
|
-
end
|
674
|
-
return [target_name, packet_name, item_name, expected_value, tolerance, timeout, polling_rate]
|
675
|
-
end
|
676
|
-
|
677
|
-
def wait_check_process_args(args, function_name)
|
678
|
-
case args.length
|
679
|
-
when 2, 3
|
680
|
-
target_name, packet_name, item_name, comparison_to_eval = extract_fields_from_check_text(args[0])
|
681
|
-
timeout = args[1]
|
682
|
-
if args.length == 3
|
683
|
-
polling_rate = args[2]
|
684
|
-
else
|
685
|
-
polling_rate = DEFAULT_TLM_POLLING_RATE
|
686
|
-
end
|
687
|
-
when 5, 6
|
688
|
-
target_name = args[0]
|
689
|
-
packet_name = args[1]
|
690
|
-
item_name = args[2]
|
691
|
-
comparison_to_eval = args[3]
|
692
|
-
timeout = args[4]
|
693
|
-
if args.length == 6
|
694
|
-
polling_rate = args[5]
|
695
|
-
else
|
696
|
-
polling_rate = DEFAULT_TLM_POLLING_RATE
|
697
|
-
end
|
698
|
-
else
|
699
|
-
# Invalid number of arguments
|
700
|
-
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{function_name}()"
|
701
|
-
end
|
702
|
-
return [target_name, packet_name, item_name, comparison_to_eval, timeout, polling_rate]
|
703
|
-
end
|
704
|
-
|
705
|
-
# sleep in a script - returns true if canceled mid sleep
|
706
|
-
def cosmos_script_sleep(sleep_time = nil)
|
707
|
-
return false if $cmd_tlm_disconnect
|
708
|
-
if defined? ScriptRunnerFrame and ScriptRunnerFrame.instance
|
709
|
-
sleep_time = 30000000 unless sleep_time # Handle infinite wait
|
710
|
-
if sleep_time > 0.0
|
711
|
-
end_time = Time.now + sleep_time
|
712
|
-
until (Time.now >= end_time)
|
713
|
-
sleep(0.01)
|
714
|
-
if ScriptRunnerFrame.instance.pause?
|
715
|
-
ScriptRunnerFrame.instance.perform_pause
|
716
|
-
return true
|
717
|
-
end
|
718
|
-
return true if ScriptRunnerFrame.instance.go?
|
719
|
-
raise StopScript if ScriptRunnerFrame.instance.stop?
|
720
|
-
end
|
721
|
-
end
|
722
|
-
else
|
723
|
-
if sleep_time
|
724
|
-
sleep(sleep_time)
|
725
|
-
else
|
726
|
-
print 'Infinite Wait - Press Enter to Continue: '
|
727
|
-
gets()
|
728
|
-
end
|
729
|
-
end
|
730
|
-
return false
|
731
|
-
end
|
732
|
-
|
733
|
-
def _cosmos_script_wait_implementation(target_name, packet_name, item_name, value_type, timeout, polling_rate)
|
734
|
-
end_time = Time.now + timeout
|
735
|
-
exp_to_eval = yield
|
736
|
-
|
737
|
-
while true
|
738
|
-
work_start = Time.now
|
739
|
-
value = tlm_variable(target_name, packet_name, item_name, value_type)
|
740
|
-
if eval(exp_to_eval)
|
741
|
-
return true, value
|
742
|
-
end
|
743
|
-
break if Time.now >= end_time || $cmd_tlm_disconnect
|
744
|
-
|
745
|
-
delta = Time.now - work_start
|
746
|
-
sleep_time = polling_rate - delta
|
747
|
-
end_delta = end_time - Time.now
|
748
|
-
sleep_time = end_delta if end_delta < sleep_time
|
749
|
-
sleep_time = 0 if sleep_time < 0
|
750
|
-
canceled = cosmos_script_sleep(sleep_time)
|
751
|
-
|
752
|
-
if canceled
|
753
|
-
value = tlm_variable(target_name, packet_name, item_name, value_type)
|
754
|
-
if eval(exp_to_eval)
|
755
|
-
return true, value
|
756
|
-
else
|
757
|
-
return false, value
|
758
|
-
end
|
759
|
-
end
|
760
|
-
end
|
761
|
-
|
762
|
-
return false, value
|
763
|
-
end
|
764
|
-
|
765
|
-
# Wait for a converted telemetry item to pass a comparison
|
766
|
-
def cosmos_script_wait_implementation(target_name, packet_name, item_name, value_type, comparison_to_eval, timeout, polling_rate = DEFAULT_TLM_POLLING_RATE)
|
767
|
-
_cosmos_script_wait_implementation(target_name, packet_name, item_name, value_type, timeout, polling_rate) do
|
768
|
-
"value " + comparison_to_eval
|
769
|
-
end
|
770
|
-
end
|
771
|
-
|
772
|
-
def cosmos_script_wait_implementation_tolerance(target_name, packet_name, item_name, value_type, expected_value, tolerance, timeout, polling_rate = DEFAULT_TLM_POLLING_RATE)
|
773
|
-
_cosmos_script_wait_implementation(target_name, packet_name, item_name, value_type, timeout, polling_rate) do
|
774
|
-
"((#{expected_value} - #{tolerance})..(#{expected_value} + #{tolerance})).include? value"
|
775
|
-
end
|
776
|
-
end
|
777
|
-
|
778
|
-
# Wait on an expression to be true.
|
779
|
-
def cosmos_script_wait_implementation_expression(exp_to_eval, timeout, polling_rate, context)
|
780
|
-
end_time = Time.now + timeout
|
781
|
-
context = ScriptRunnerFrame.instance.script_binding if !context and defined? ScriptRunnerFrame and ScriptRunnerFrame.instance
|
782
|
-
|
783
|
-
while true
|
784
|
-
work_start = Time.now
|
785
|
-
if eval(exp_to_eval, context)
|
786
|
-
return true
|
787
|
-
end
|
788
|
-
break if Time.now >= end_time
|
789
|
-
|
790
|
-
delta = Time.now - work_start
|
791
|
-
sleep_time = polling_rate - delta
|
792
|
-
end_delta = end_time - Time.now
|
793
|
-
sleep_time = end_delta if end_delta < sleep_time
|
794
|
-
sleep_time = 0 if sleep_time < 0
|
795
|
-
canceled = cosmos_script_sleep(sleep_time)
|
796
|
-
|
797
|
-
if canceled
|
798
|
-
if eval(exp_to_eval, context)
|
799
|
-
return true
|
800
|
-
else
|
801
|
-
return nil
|
802
|
-
end
|
803
|
-
end
|
804
|
-
end
|
805
|
-
|
806
|
-
return nil
|
807
|
-
end
|
808
|
-
|
809
|
-
def check_eval(target_name, packet_name, item_name, comparison_to_eval, value)
|
810
|
-
string = "value " + comparison_to_eval
|
811
|
-
check_str = "CHECK: #{_upcase(target_name, packet_name, item_name)} #{comparison_to_eval}"
|
812
|
-
value_str = "with value == #{value}"
|
813
|
-
if eval(string)
|
814
|
-
Logger.info "#{check_str} success #{value_str}"
|
815
|
-
else
|
816
|
-
message = "#{check_str} failed #{value_str}"
|
817
|
-
if $cmd_tlm_disconnect
|
818
|
-
Logger.error message
|
819
|
-
else
|
820
|
-
raise CheckError, message
|
821
|
-
end
|
822
|
-
end
|
823
|
-
end
|
824
|
-
|
825
|
-
def build_cmd_output_string(target_name, cmd_name, cmd_params, raw = false)
|
826
|
-
if raw
|
827
|
-
output_string = 'cmd_raw("'
|
828
|
-
else
|
829
|
-
output_string = 'cmd("'
|
830
|
-
end
|
831
|
-
output_string << target_name + ' ' + cmd_name
|
832
|
-
if cmd_params.nil? or cmd_params.empty?
|
833
|
-
output_string << '")'
|
834
|
-
else
|
835
|
-
params = []
|
836
|
-
cmd_params.each do |key, value|
|
837
|
-
if value.class == String
|
838
|
-
if value.convert_to_value.class == String
|
839
|
-
value = value.inspect
|
840
|
-
if value.length > 256
|
841
|
-
value = value[0..255] + "...'"
|
842
|
-
end
|
843
|
-
value.tr!('"',"'")
|
844
|
-
end
|
845
|
-
end
|
846
|
-
params << "#{key} #{value}"
|
847
|
-
end
|
848
|
-
params = params.join(", ")
|
849
|
-
output_string << ' with ' + params + '")'
|
850
|
-
end
|
851
|
-
return output_string
|
852
|
-
end
|
853
|
-
|
854
|
-
def prompt_for_hazardous(target_name, cmd_name, hazardous_description)
|
855
|
-
message = "Warning: Command #{target_name} #{cmd_name} is Hazardous. "
|
856
|
-
message << "\n#{hazardous_description}\n" if hazardous_description
|
857
|
-
message << "Send? (y,n): "
|
858
|
-
print message
|
859
|
-
answer = gets.chomp
|
860
|
-
if answer.downcase == 'y'
|
861
|
-
return true
|
862
|
-
else
|
863
|
-
return false
|
864
|
-
end
|
865
|
-
end
|
866
|
-
|
867
|
-
def prompt_for_script_abort
|
868
|
-
print "Stop running script? (y,n): "
|
869
|
-
answer = gets.chomp
|
870
|
-
if answer.downcase == 'y'
|
871
|
-
exit
|
872
|
-
else
|
873
|
-
return false # Not aborted - Retry
|
874
|
-
end
|
875
|
-
end
|
876
|
-
|
877
|
-
def prompt_to_continue(string)
|
878
|
-
print "#{string}: "
|
879
|
-
gets.chomp
|
880
|
-
end
|
881
|
-
|
882
|
-
def prompt_message_box(string, buttons)
|
883
|
-
print "#{string} (#{buttons.join(", ")}): "
|
884
|
-
gets.chomp
|
885
|
-
end
|
886
|
-
|
887
|
-
def prompt_vertical_message_box(string, options)
|
888
|
-
prompt_message_box(string, options)
|
889
|
-
end
|
890
|
-
|
891
|
-
def prompt_combo_box(string, options)
|
892
|
-
prompt_message_box(string, options)
|
893
|
-
end
|
894
|
-
|
895
|
-
end # module Script
|
896
|
-
|
897
|
-
end # module Cosmos
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
|
3
|
+
# Copyright 2014 Ball Aerospace & Technologies Corp.
|
4
|
+
# All Rights Reserved.
|
5
|
+
#
|
6
|
+
# This program is free software; you can modify and/or redistribute it
|
7
|
+
# under the terms of the GNU General Public License
|
8
|
+
# as published by the Free Software Foundation; version 3 with
|
9
|
+
# attribution addendums as found in the LICENSE.txt
|
10
|
+
|
11
|
+
require 'cosmos/script/extract'
|
12
|
+
|
13
|
+
module Cosmos
|
14
|
+
module Script
|
15
|
+
DEFAULT_TLM_POLLING_RATE = 0.25
|
16
|
+
|
17
|
+
private
|
18
|
+
# Include various methods to extract fields from text
|
19
|
+
include Extract
|
20
|
+
|
21
|
+
def play_wav_file(wav_filename)
|
22
|
+
Cosmos.play_wav_file(wav_filename)
|
23
|
+
end
|
24
|
+
|
25
|
+
def status_bar(message)
|
26
|
+
script_runner = nil
|
27
|
+
ObjectSpace.each_object {|object| if ScriptRunner === object then script_runner = object; break; end}
|
28
|
+
script_runner.script_set_status(message) if script_runner
|
29
|
+
end
|
30
|
+
|
31
|
+
def ask_string(question, blank_or_default = false, password = false)
|
32
|
+
answer = ''
|
33
|
+
default = ''
|
34
|
+
if blank_or_default != true && blank_or_default != false
|
35
|
+
question << " (default = #{blank_or_default})"
|
36
|
+
allow_blank = true
|
37
|
+
else
|
38
|
+
allow_blank = blank_or_default
|
39
|
+
end
|
40
|
+
while answer.empty?
|
41
|
+
print question + " "
|
42
|
+
answer = gets
|
43
|
+
answer.chomp!
|
44
|
+
break if allow_blank
|
45
|
+
end
|
46
|
+
answer = default if answer.empty? and !default.empty?
|
47
|
+
return answer
|
48
|
+
end
|
49
|
+
|
50
|
+
def ask(question, blank_or_default = false, password = false)
|
51
|
+
string = ask_string(question, blank_or_default, password)
|
52
|
+
value = string.convert_to_value
|
53
|
+
return value
|
54
|
+
end
|
55
|
+
|
56
|
+
def prompt(string)
|
57
|
+
prompt_to_continue(string)
|
58
|
+
end
|
59
|
+
|
60
|
+
def message_box(string, *buttons)
|
61
|
+
prompt_message_box(string, buttons)
|
62
|
+
end
|
63
|
+
|
64
|
+
def vertical_message_box(string, *buttons)
|
65
|
+
prompt_vertical_message_box(string, buttons)
|
66
|
+
end
|
67
|
+
|
68
|
+
def combo_box(string, *options)
|
69
|
+
prompt_combo_box(string, options)
|
70
|
+
end
|
71
|
+
|
72
|
+
# Creates a string with the parameters upcased
|
73
|
+
def _upcase(target_name, packet_name, item_name)
|
74
|
+
"#{target_name.upcase} #{packet_name.upcase} #{item_name.upcase}"
|
75
|
+
end
|
76
|
+
|
77
|
+
# Implementaiton of the various check commands. It yields back to the
|
78
|
+
# caller to allow the return of the value through various telemetry calls.
|
79
|
+
# This method should not be called directly by application code.
|
80
|
+
def _check(*args)
|
81
|
+
target_name, packet_name, item_name, comparison_to_eval = check_process_args(args, 'check')
|
82
|
+
value = yield(target_name, packet_name, item_name)
|
83
|
+
if comparison_to_eval
|
84
|
+
check_eval(target_name, packet_name, item_name, comparison_to_eval, value)
|
85
|
+
else
|
86
|
+
Logger.info "CHECK: #{_upcase(target_name, packet_name, item_name)} == #{value}"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# Check the converted value of a telmetry item against a condition
|
91
|
+
# Always print the value of the telemetry item to STDOUT
|
92
|
+
# If the condition check fails, raise an error
|
93
|
+
# Supports two signatures:
|
94
|
+
# check(target_name, packet_name, item_name, comparison_to_eval)
|
95
|
+
# or
|
96
|
+
# check('target_name packet_name item_name > 1')
|
97
|
+
def check(*args)
|
98
|
+
_check(*args) {|tgt,pkt,item| tlm(tgt,pkt,item) }
|
99
|
+
end
|
100
|
+
|
101
|
+
# Check the formatted value of a telmetry item against a condition
|
102
|
+
# Always print the value of the telemetry item to STDOUT
|
103
|
+
# If the condition check fails, raise an error
|
104
|
+
# Supports two signatures:
|
105
|
+
# check(target_name, packet_name, item_name, comparison_to_eval)
|
106
|
+
# or
|
107
|
+
# check('target_name packet_name item_name > 1')
|
108
|
+
def check_formatted(*args)
|
109
|
+
_check(*args) {|tgt,pkt,item| tlm_formatted(tgt,pkt,item) }
|
110
|
+
end
|
111
|
+
|
112
|
+
# Check the formatted with units value of a telmetry item against a condition
|
113
|
+
# Always print the value of the telemetry item to STDOUT
|
114
|
+
# If the condition check fails, raise an error
|
115
|
+
# Supports two signatures:
|
116
|
+
# check(target_name, packet_name, item_name, comparison_to_eval)
|
117
|
+
# or
|
118
|
+
# check('target_name packet_name item_name > 1')
|
119
|
+
def check_with_units(*args)
|
120
|
+
_check(*args) {|tgt,pkt,item| tlm_with_units(tgt,pkt,item) }
|
121
|
+
end
|
122
|
+
|
123
|
+
# Check the raw value of a telmetry item against a condition
|
124
|
+
# Always print the value of the telemetry item to STDOUT
|
125
|
+
# If the condition check fails, raise an error
|
126
|
+
# Supports two signatures:
|
127
|
+
# check(target_name, packet_name, item_name, comparison_to_eval)
|
128
|
+
# or
|
129
|
+
# check('target_name packet_name item_name > 1')
|
130
|
+
def check_raw(*args)
|
131
|
+
_check(*args) {|tgt,pkt,item| tlm_raw(tgt,pkt,item) }
|
132
|
+
end
|
133
|
+
|
134
|
+
def _check_tolerance(*args)
|
135
|
+
target_name, packet_name, item_name, expected_value, tolerance =
|
136
|
+
check_tolerance_process_args(args, 'check_tolerance')
|
137
|
+
value = yield(target_name, packet_name, item_name)
|
138
|
+
range = (expected_value - tolerance)..(expected_value + tolerance)
|
139
|
+
check_str = "CHECK: #{_upcase(target_name, packet_name, item_name)}"
|
140
|
+
range_str = "range #{range.first} to #{range.last} with value == #{value}"
|
141
|
+
if range.include?(value)
|
142
|
+
Logger.info "#{check_str} was within #{range_str}"
|
143
|
+
else
|
144
|
+
message = "#{check_str} failed to be within #{range_str}"
|
145
|
+
if $cmd_tlm_disconnect
|
146
|
+
Logger.error message
|
147
|
+
else
|
148
|
+
raise CheckError, message
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Check the converted value of a telmetry item against an expected value with a tolerance
|
154
|
+
# Always print the value of the telemetry item to STDOUT
|
155
|
+
# If the condition check fails, raise an error
|
156
|
+
# Supports two signatures:
|
157
|
+
# check_tolerance(target_name, packet_name, item_name, expected_value, tolerance)
|
158
|
+
# or
|
159
|
+
# check_tolerance('target_name packet_name item_name', expected_value, tolerance)
|
160
|
+
def check_tolerance(*args)
|
161
|
+
_check_tolerance(*args) {|tgt,pkt,item| tlm(tgt,pkt,item) }
|
162
|
+
end
|
163
|
+
|
164
|
+
# Check the raw value of a telmetry item against an expected value with a tolerance
|
165
|
+
# Always print the value of the telemetry item to STDOUT
|
166
|
+
# If the condition check fails, raise an error
|
167
|
+
# Supports two signatures:
|
168
|
+
# check_tolerance_raw(target_name, packet_name, item_name, expected_value, tolerance)
|
169
|
+
# or
|
170
|
+
# check_tolerance_raw('target_name packet_name item_name', expected_value, tolerance)
|
171
|
+
def check_tolerance_raw(*args)
|
172
|
+
_check_tolerance(*args) {|tgt,pkt,item| tlm_raw(tgt,pkt,item) }
|
173
|
+
end
|
174
|
+
|
175
|
+
# Check to see if an expression is true without waiting. If the expression
|
176
|
+
# is not true, the script will pause.
|
177
|
+
def check_expression(exp_to_eval, context = nil)
|
178
|
+
success = cosmos_script_wait_implementation_expression(exp_to_eval, 0, DEFAULT_TLM_POLLING_RATE, context)
|
179
|
+
if success
|
180
|
+
Logger.info "CHECK: #{exp_to_eval} is TRUE"
|
181
|
+
else
|
182
|
+
message = "CHECK: #{exp_to_eval} is FALSE"
|
183
|
+
if $cmd_tlm_disconnect
|
184
|
+
Logger.error message
|
185
|
+
else
|
186
|
+
raise CheckError, message
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# Wait on an expression to be true. On a timeout, the script will continue.
|
192
|
+
# Supports multiple signatures:
|
193
|
+
# wait(time)
|
194
|
+
# wait('target_name packet_name item_name > 1', timeout, polling_rate)
|
195
|
+
# wait('target_name', 'packet_name', 'item_name', comparison_to_eval, timeout, polling_rate)
|
196
|
+
def wait(*args)
|
197
|
+
wait_process_args(args, 'wait', :CONVERTED)
|
198
|
+
end
|
199
|
+
|
200
|
+
# Wait on an expression to be true. On a timeout, the script will continue.
|
201
|
+
# Supports multiple signatures:
|
202
|
+
# wait(time)
|
203
|
+
# wait_raw('target_name packet_name item_name > 1', timeout, polling_rate)
|
204
|
+
# wait_raw('target_name', 'packet_name', 'item_name', comparison_to_eval, timeout, polling_rate)
|
205
|
+
def wait_raw(*args)
|
206
|
+
wait_process_args(args, 'wait_raw', :RAW)
|
207
|
+
end
|
208
|
+
|
209
|
+
def _wait_tolerance(raw, *args)
|
210
|
+
type = (raw ? :RAW : :CONVERTED)
|
211
|
+
type_string = 'wait_tolerance'
|
212
|
+
type_string << '_raw' if raw
|
213
|
+
target_name, packet_name, item_name, expected_value, tolerance, timeout, polling_rate = wait_tolerance_process_args(args, type_string)
|
214
|
+
start_time = Time.now
|
215
|
+
success, value = cosmos_script_wait_implementation_tolerance(target_name, packet_name, item_name, type, expected_value, tolerance, timeout, polling_rate)
|
216
|
+
time = Time.now - start_time
|
217
|
+
range = (expected_value - tolerance)..(expected_value + tolerance)
|
218
|
+
wait_str = "WAIT: #{_upcase(target_name, packet_name, item_name)}"
|
219
|
+
range_str = "range #{range.first} to #{range.last} with value == #{value} after waiting #{time} seconds"
|
220
|
+
if success
|
221
|
+
Logger.info "#{wait_str} was within #{range_str}"
|
222
|
+
else
|
223
|
+
Logger.warn "#{wait_str} failed to be within #{range_str}"
|
224
|
+
end
|
225
|
+
time
|
226
|
+
end
|
227
|
+
|
228
|
+
# Wait on an expression to be true. On a timeout, the script will continue.
|
229
|
+
# Supports multiple signatures:
|
230
|
+
# wait_tolerance('target_name packet_name item_name', expected_value, tolerance, timeout, polling_rate)
|
231
|
+
# wait_tolerance('target_name', 'packet_name', 'item_name', expected_value, tolerance, timeout, polling_rate)
|
232
|
+
def wait_tolerance(*args)
|
233
|
+
_wait_tolerance(false, *args)
|
234
|
+
end
|
235
|
+
|
236
|
+
# Wait on an expression to be true. On a timeout, the script will continue.
|
237
|
+
# Supports multiple signatures:
|
238
|
+
# wait_tolerance_raw('target_name packet_name item_name', expected_value, tolerance, timeout, polling_rate)
|
239
|
+
# wait_tolerance_raw('target_name', 'packet_name', 'item_name', expected_value, tolerance, timeout, polling_rate)
|
240
|
+
def wait_tolerance_raw(*args)
|
241
|
+
_wait_tolerance(true, *args)
|
242
|
+
end
|
243
|
+
|
244
|
+
# Wait on a custom expression to be true
|
245
|
+
def wait_expression(exp_to_eval, timeout, polling_rate = DEFAULT_TLM_POLLING_RATE, context = nil)
|
246
|
+
start_time = Time.now
|
247
|
+
success = cosmos_script_wait_implementation_expression(exp_to_eval, timeout, polling_rate, context)
|
248
|
+
time = Time.now - start_time
|
249
|
+
if success
|
250
|
+
Logger.info "WAIT: #{exp_to_eval} is TRUE after waiting #{time} seconds"
|
251
|
+
else
|
252
|
+
Logger.warn "WAIT: #{exp_to_eval} is FALSE after waiting #{time} seconds"
|
253
|
+
end
|
254
|
+
time
|
255
|
+
end
|
256
|
+
|
257
|
+
def _wait_check(raw, *args)
|
258
|
+
type = (raw ? :RAW : :CONVERTED)
|
259
|
+
target_name, packet_name, item_name, comparison_to_eval, timeout, polling_rate = wait_check_process_args(args, 'wait_check')
|
260
|
+
start_time = Time.now
|
261
|
+
success, value = cosmos_script_wait_implementation(target_name, packet_name, item_name, type, comparison_to_eval, timeout, polling_rate)
|
262
|
+
time = Time.now - start_time
|
263
|
+
check_str = "CHECK: #{_upcase(target_name, packet_name, item_name)} #{comparison_to_eval}"
|
264
|
+
with_value_str = "with value == #{value} after waiting #{time} seconds"
|
265
|
+
if success
|
266
|
+
Logger.info "#{check_str} success #{with_value_str}"
|
267
|
+
else
|
268
|
+
message = "#{check_str} failed #{with_value_str}"
|
269
|
+
if $cmd_tlm_disconnect
|
270
|
+
Logger.error message
|
271
|
+
else
|
272
|
+
raise CheckError, message
|
273
|
+
end
|
274
|
+
end
|
275
|
+
time
|
276
|
+
end
|
277
|
+
|
278
|
+
# Wait for the converted value of a telmetry item against a condition or for a timeout
|
279
|
+
# and then check against the condition
|
280
|
+
# Supports two signatures:
|
281
|
+
# wait_check(target_name, packet_name, item_name, comparison_to_eval, timeout, polling_rate)
|
282
|
+
# or
|
283
|
+
# wait_check('target_name packet_name item_name > 1', timeout, polling_rate)
|
284
|
+
def wait_check(*args)
|
285
|
+
_wait_check(false, *args)
|
286
|
+
end
|
287
|
+
|
288
|
+
# Wait for the raw value of a telmetry item against a condition or for a timeout
|
289
|
+
# and then check against the condition
|
290
|
+
# Supports two signatures:
|
291
|
+
# wait_check_raw(target_name, packet_name, item_name, comparison_to_eval, timeout, polling_rate)
|
292
|
+
# or
|
293
|
+
# wait_check_raw('target_name packet_name item_name > 1', timeout, polling_rate)
|
294
|
+
def wait_check_raw(*args)
|
295
|
+
_wait_check(true, *args)
|
296
|
+
end
|
297
|
+
|
298
|
+
def _wait_check_tolerance(raw, *args)
|
299
|
+
type_string = 'wait_check_tolerance'
|
300
|
+
type_string << '_raw' if raw
|
301
|
+
type = (raw ? :RAW : :CONVERTED)
|
302
|
+
target_name, packet_name, item_name, expected_value, tolerance, timeout, polling_rate = wait_tolerance_process_args(args, type_string)
|
303
|
+
start_time = Time.now
|
304
|
+
success, value = cosmos_script_wait_implementation_tolerance(target_name, packet_name, item_name, type, expected_value, tolerance, timeout, polling_rate)
|
305
|
+
time = Time.now - start_time
|
306
|
+
range = (expected_value - tolerance)..(expected_value + tolerance)
|
307
|
+
check_str = "CHECK: #{_upcase(target_name, packet_name, item_name)}"
|
308
|
+
range_str = "range #{range.first} to #{range.last} with value == #{value} after waiting #{time} seconds"
|
309
|
+
if success
|
310
|
+
Logger.info "#{check_str} was within #{range_str}"
|
311
|
+
else
|
312
|
+
message = "#{check_str} failed to be within #{range_str}"
|
313
|
+
if $cmd_tlm_disconnect
|
314
|
+
Logger.error message
|
315
|
+
else
|
316
|
+
raise CheckError, message
|
317
|
+
end
|
318
|
+
end
|
319
|
+
time
|
320
|
+
end
|
321
|
+
|
322
|
+
def wait_check_tolerance(*args)
|
323
|
+
_wait_check_tolerance(false, *args)
|
324
|
+
end
|
325
|
+
|
326
|
+
def wait_check_tolerance_raw(*args)
|
327
|
+
_wait_check_tolerance(true, *args)
|
328
|
+
end
|
329
|
+
|
330
|
+
# Wait on an expression to be true. On a timeout, the script will pause.
|
331
|
+
def wait_check_expression(exp_to_eval,
|
332
|
+
timeout,
|
333
|
+
polling_rate = DEFAULT_TLM_POLLING_RATE,
|
334
|
+
context = nil)
|
335
|
+
start_time = Time.now
|
336
|
+
success = cosmos_script_wait_implementation_expression(exp_to_eval,
|
337
|
+
timeout,
|
338
|
+
polling_rate,
|
339
|
+
context)
|
340
|
+
time = Time.now - start_time
|
341
|
+
if success
|
342
|
+
Logger.info "CHECK: #{exp_to_eval} is TRUE after waiting #{time} seconds"
|
343
|
+
else
|
344
|
+
message = "CHECK: #{exp_to_eval} is FALSE after waiting #{time} seconds"
|
345
|
+
if $cmd_tlm_disconnect
|
346
|
+
Logger.error message
|
347
|
+
else
|
348
|
+
raise CheckError, message
|
349
|
+
end
|
350
|
+
end
|
351
|
+
time
|
352
|
+
end
|
353
|
+
alias wait_expression_stop_on_timeout wait_check_expression
|
354
|
+
|
355
|
+
# Wait for a telemetry packet to be received a certain number of times or timeout
|
356
|
+
def _wait_packet(check,
|
357
|
+
target_name,
|
358
|
+
packet_name,
|
359
|
+
num_packets,
|
360
|
+
timeout,
|
361
|
+
polling_rate = DEFAULT_TLM_POLLING_RATE)
|
362
|
+
type = (check ? 'CHECK' : 'WAIT')
|
363
|
+
initial_count = tlm(target_name, packet_name, 'RECEIVED_COUNT')
|
364
|
+
start_time = Time.now
|
365
|
+
success, value = cosmos_script_wait_implementation(target_name,
|
366
|
+
packet_name,
|
367
|
+
'RECEIVED_COUNT',
|
368
|
+
:CONVERTED,
|
369
|
+
">= #{initial_count + num_packets}",
|
370
|
+
timeout,
|
371
|
+
polling_rate)
|
372
|
+
time = Time.now - start_time
|
373
|
+
if success
|
374
|
+
Logger.info "#{type}: #{target_name.upcase} #{packet_name.upcase} received #{value - initial_count} times after waiting #{time} seconds"
|
375
|
+
else
|
376
|
+
message = "#{type}: #{target_name.upcase} #{packet_name.upcase} expected to be received #{num_packets} times but only received #{value - initial_count} times after waiting #{time} seconds"
|
377
|
+
if check
|
378
|
+
if $cmd_tlm_disconnect
|
379
|
+
Logger.error message
|
380
|
+
else
|
381
|
+
raise CheckError, message
|
382
|
+
end
|
383
|
+
else
|
384
|
+
Logger.warn message
|
385
|
+
end
|
386
|
+
end
|
387
|
+
time
|
388
|
+
end
|
389
|
+
|
390
|
+
def wait_packet(target_name,
|
391
|
+
packet_name,
|
392
|
+
num_packets,
|
393
|
+
timeout,
|
394
|
+
polling_rate = DEFAULT_TLM_POLLING_RATE)
|
395
|
+
_wait_packet(false, target_name, packet_name, num_packets, timeout, polling_rate)
|
396
|
+
end
|
397
|
+
|
398
|
+
# Wait for a telemetry packet to be received a certain number of times or timeout and raise an error
|
399
|
+
def wait_check_packet(target_name,
|
400
|
+
packet_name,
|
401
|
+
num_packets,
|
402
|
+
timeout,
|
403
|
+
polling_rate = DEFAULT_TLM_POLLING_RATE)
|
404
|
+
_wait_packet(true, target_name, packet_name, num_packets, timeout, polling_rate)
|
405
|
+
end
|
406
|
+
|
407
|
+
def _get_procedure_path(procedure_name)
|
408
|
+
# Handle not-giving an extension
|
409
|
+
procedure_name_with_extension = nil
|
410
|
+
procedure_name_with_extension = procedure_name + '.rb' if File.extname(procedure_name).empty?
|
411
|
+
|
412
|
+
path = nil
|
413
|
+
|
414
|
+
# Find filename in search path
|
415
|
+
($:).each do |directory|
|
416
|
+
if File.exist?(directory + '/' + procedure_name) and not File.directory?(directory + '/' + procedure_name)
|
417
|
+
path = directory + '/' + procedure_name
|
418
|
+
break
|
419
|
+
end
|
420
|
+
|
421
|
+
if procedure_name_with_extension and File.exist?(directory + '/' + procedure_name_with_extension)
|
422
|
+
procedure_name = procedure_name_with_extension
|
423
|
+
path = directory + '/' + procedure_name
|
424
|
+
break
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
428
|
+
# Handle absolute path
|
429
|
+
path = procedure_name if !path and File.exist?(procedure_name)
|
430
|
+
path = procedure_name_with_extension if !path and procedure_name_with_extension and File.exist?(procedure_name_with_extension)
|
431
|
+
|
432
|
+
raise "Procedure not found : #{procedure_name}" unless path
|
433
|
+
path
|
434
|
+
end
|
435
|
+
|
436
|
+
def check_file_cache_for_instrumented_script(path, md5)
|
437
|
+
instrumented_script = nil
|
438
|
+
cached = true
|
439
|
+
use_file_cache = true
|
440
|
+
|
441
|
+
Cosmos.set_working_dir do
|
442
|
+
cache_path = File.join(System.paths['TMP'], 'script_runner')
|
443
|
+
unless File.directory?(cache_path)
|
444
|
+
# Try to create .cache directory
|
445
|
+
begin
|
446
|
+
Dir.mkdir(cache_path)
|
447
|
+
rescue
|
448
|
+
use_file_cache = false
|
449
|
+
end
|
450
|
+
end
|
451
|
+
|
452
|
+
cache_filename = nil
|
453
|
+
if use_file_cache
|
454
|
+
# Check file based instrumented cache
|
455
|
+
flat_path = path.tr("/", "_").gsub("\\", "_").tr(":", "_").tr(" ", "_")
|
456
|
+
flat_path_with_md5 = flat_path + '_' + md5
|
457
|
+
cache_filename = File.join(cache_path, flat_path_with_md5)
|
458
|
+
end
|
459
|
+
|
460
|
+
if use_file_cache and File.exist?(cache_filename)
|
461
|
+
# Use file cached instrumentation
|
462
|
+
File.open(cache_filename, 'r') {|file| instrumented_script = file.read}
|
463
|
+
else
|
464
|
+
cached = false
|
465
|
+
|
466
|
+
# Build instrumentation
|
467
|
+
file_text = ''
|
468
|
+
begin
|
469
|
+
file_text = File.read(path)
|
470
|
+
rescue Exception => error
|
471
|
+
raise "Error reading procedure file : #{path}"
|
472
|
+
end
|
473
|
+
|
474
|
+
instrumented_script = ScriptRunnerFrame.instrument_script(file_text, path, true)
|
475
|
+
|
476
|
+
# Cache instrumentation into file
|
477
|
+
if use_file_cache
|
478
|
+
begin
|
479
|
+
File.open(cache_filename, 'w') {|file| file.write(instrumented_script)}
|
480
|
+
rescue
|
481
|
+
# Oh well, failed to write cache file
|
482
|
+
end
|
483
|
+
end
|
484
|
+
end
|
485
|
+
end
|
486
|
+
[instrumented_script, cached]
|
487
|
+
end
|
488
|
+
|
489
|
+
def start(procedure_name)
|
490
|
+
cached = true
|
491
|
+
path = _get_procedure_path(procedure_name)
|
492
|
+
|
493
|
+
if defined? ScriptRunnerFrame and ScriptRunnerFrame.instance
|
494
|
+
md5 = nil
|
495
|
+
begin
|
496
|
+
md5 = Cosmos.md5_files([path]).hexdigest
|
497
|
+
rescue Exception => error
|
498
|
+
raise "Error calculating md5 on procedure file : #{path}"
|
499
|
+
end
|
500
|
+
|
501
|
+
# Check RAM based instrumented cache
|
502
|
+
instrumented_cache = ScriptRunnerFrame.instrumented_cache[path]
|
503
|
+
instrumented_script = nil
|
504
|
+
if instrumented_cache and md5 == instrumented_cache[1]
|
505
|
+
# Use cached instrumentation
|
506
|
+
instrumented_script = instrumented_cache[0]
|
507
|
+
else
|
508
|
+
instrumented_script, cached = check_file_cache_for_instrumented_script(path, md5)
|
509
|
+
# Cache instrumentation into RAM
|
510
|
+
ScriptRunnerFrame.instrumented_cache[path] = [instrumented_script, md5]
|
511
|
+
end
|
512
|
+
|
513
|
+
Object.class_eval(instrumented_script, path, 1)
|
514
|
+
else # No ScriptRunnerFrame so just start it locally
|
515
|
+
cached = false
|
516
|
+
begin
|
517
|
+
Kernel::load(path)
|
518
|
+
rescue LoadError => error
|
519
|
+
raise RuntimeError.new("Error loading : #{procedure_name} : #{error.message}")
|
520
|
+
end
|
521
|
+
end
|
522
|
+
# Return whether we had to load and instrument this file, i.e. it was not cached
|
523
|
+
!cached
|
524
|
+
end
|
525
|
+
|
526
|
+
# Require an additional ruby file
|
527
|
+
def load_utility(procedure_name)
|
528
|
+
cached = true
|
529
|
+
if defined? ScriptRunnerFrame and ScriptRunnerFrame.instance
|
530
|
+
saved = ScriptRunnerFrame.instance.use_instrumentation
|
531
|
+
begin
|
532
|
+
ScriptRunnerFrame.instance.use_instrumentation = false
|
533
|
+
cached = start(procedure_name)
|
534
|
+
ensure
|
535
|
+
ScriptRunnerFrame.instance.use_instrumentation = saved
|
536
|
+
end
|
537
|
+
else # Just call start
|
538
|
+
cached = start(procedure_name)
|
539
|
+
end
|
540
|
+
# Return whether we had to load and instrument this file, i.e. it was not cached
|
541
|
+
# This is designed to match the behavior of Ruby's require and load keywords
|
542
|
+
!cached
|
543
|
+
end
|
544
|
+
alias require_utility load_utility
|
545
|
+
|
546
|
+
##########################################
|
547
|
+
# Protected Methods
|
548
|
+
##########################################
|
549
|
+
|
550
|
+
def check_process_args(args, function_name)
|
551
|
+
case args.length
|
552
|
+
when 1
|
553
|
+
target_name, packet_name, item_name, comparison_to_eval = extract_fields_from_check_text(args[0])
|
554
|
+
when 4
|
555
|
+
target_name = args[0]
|
556
|
+
packet_name = args[1]
|
557
|
+
item_name = args[2]
|
558
|
+
comparison_to_eval = args[3]
|
559
|
+
else
|
560
|
+
# Invalid number of arguments
|
561
|
+
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{function_name}()"
|
562
|
+
end
|
563
|
+
return [target_name, packet_name, item_name, comparison_to_eval]
|
564
|
+
end
|
565
|
+
|
566
|
+
def check_tolerance_process_args(args, function_name)
|
567
|
+
case args.length
|
568
|
+
when 3
|
569
|
+
target_name, packet_name, item_name = extract_fields_from_tlm_text(args[0])
|
570
|
+
expected_value = args[1]
|
571
|
+
tolerance = args[2]
|
572
|
+
when 5
|
573
|
+
target_name = args[0]
|
574
|
+
packet_name = args[1]
|
575
|
+
item_name = args[2]
|
576
|
+
expected_value = args[3]
|
577
|
+
tolerance = args[4]
|
578
|
+
else
|
579
|
+
# Invalid number of arguments
|
580
|
+
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{function_name}()"
|
581
|
+
end
|
582
|
+
return [target_name, packet_name, item_name, expected_value, tolerance]
|
583
|
+
end
|
584
|
+
|
585
|
+
def _execute_wait(target_name, packet_name, item_name, value_type, comparison_to_eval, timeout, polling_rate)
|
586
|
+
start_time = Time.now
|
587
|
+
success, value = cosmos_script_wait_implementation(target_name, packet_name, item_name, value_type, comparison_to_eval, timeout, polling_rate)
|
588
|
+
time = Time.now - start_time
|
589
|
+
wait_str = "WAIT: #{_upcase(target_name, packet_name, item_name)} #{comparison_to_eval}"
|
590
|
+
value_str = "with value == #{value} after waiting #{time} seconds"
|
591
|
+
if success
|
592
|
+
Logger.info "#{wait_str} success #{value_str}"
|
593
|
+
else
|
594
|
+
Logger.warn "#{wait_str} failed #{value_str}"
|
595
|
+
end
|
596
|
+
end
|
597
|
+
|
598
|
+
def wait_process_args(args, function_name, value_type)
|
599
|
+
time = nil
|
600
|
+
|
601
|
+
case args.length
|
602
|
+
when 0
|
603
|
+
start_time = Time.now
|
604
|
+
cosmos_script_sleep()
|
605
|
+
time = Time.now - start_time
|
606
|
+
Logger.info("WAIT: Indefinite for actual time of #{time} seconds")
|
607
|
+
when 1
|
608
|
+
if args[0].kind_of? Numeric
|
609
|
+
start_time = Time.now
|
610
|
+
cosmos_script_sleep(args[0])
|
611
|
+
time = Time.now - start_time
|
612
|
+
Logger.info("WAIT: #{args[0]} seconds with actual time of #{time} seconds")
|
613
|
+
else
|
614
|
+
raise "Non-numeric wait time specified"
|
615
|
+
end
|
616
|
+
when 2, 3
|
617
|
+
target_name, packet_name, item_name, comparison_to_eval = extract_fields_from_check_text(args[0])
|
618
|
+
timeout = args[1]
|
619
|
+
if args.length == 3
|
620
|
+
polling_rate = args[2]
|
621
|
+
else
|
622
|
+
polling_rate = DEFAULT_TLM_POLLING_RATE
|
623
|
+
end
|
624
|
+
_execute_wait(target_name, packet_name, item_name, value_type, comparison_to_eval, timeout, polling_rate)
|
625
|
+
|
626
|
+
when 5, 6
|
627
|
+
target_name = args[0]
|
628
|
+
packet_name = args[1]
|
629
|
+
item_name = args[2]
|
630
|
+
comparison_to_eval = args[3]
|
631
|
+
timeout = args[4]
|
632
|
+
if args.length == 6
|
633
|
+
polling_rate = args[5]
|
634
|
+
else
|
635
|
+
polling_rate = DEFAULT_TLM_POLLING_RATE
|
636
|
+
end
|
637
|
+
_execute_wait(target_name, packet_name, item_name, value_type, comparison_to_eval, timeout, polling_rate)
|
638
|
+
|
639
|
+
else
|
640
|
+
# Invalid number of arguments
|
641
|
+
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{function_name}()"
|
642
|
+
end
|
643
|
+
time
|
644
|
+
end
|
645
|
+
|
646
|
+
def wait_tolerance_process_args(args, function_name)
|
647
|
+
case args.length
|
648
|
+
when 4, 5
|
649
|
+
target_name, packet_name, item_name = extract_fields_from_tlm_text(args[0])
|
650
|
+
expected_value = args[1]
|
651
|
+
tolerance = args[2]
|
652
|
+
timeout = args[3]
|
653
|
+
if args.length == 5
|
654
|
+
polling_rate = args[4]
|
655
|
+
else
|
656
|
+
polling_rate = DEFAULT_TLM_POLLING_RATE
|
657
|
+
end
|
658
|
+
when 6, 7
|
659
|
+
target_name = args[0]
|
660
|
+
packet_name = args[1]
|
661
|
+
item_name = args[2]
|
662
|
+
expected_value = args[3]
|
663
|
+
tolerance = args[4]
|
664
|
+
timeout = args[5]
|
665
|
+
if args.length == 7
|
666
|
+
polling_rate = args[6]
|
667
|
+
else
|
668
|
+
polling_rate = DEFAULT_TLM_POLLING_RATE
|
669
|
+
end
|
670
|
+
else
|
671
|
+
# Invalid number of arguments
|
672
|
+
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{function_name}()"
|
673
|
+
end
|
674
|
+
return [target_name, packet_name, item_name, expected_value, tolerance, timeout, polling_rate]
|
675
|
+
end
|
676
|
+
|
677
|
+
def wait_check_process_args(args, function_name)
|
678
|
+
case args.length
|
679
|
+
when 2, 3
|
680
|
+
target_name, packet_name, item_name, comparison_to_eval = extract_fields_from_check_text(args[0])
|
681
|
+
timeout = args[1]
|
682
|
+
if args.length == 3
|
683
|
+
polling_rate = args[2]
|
684
|
+
else
|
685
|
+
polling_rate = DEFAULT_TLM_POLLING_RATE
|
686
|
+
end
|
687
|
+
when 5, 6
|
688
|
+
target_name = args[0]
|
689
|
+
packet_name = args[1]
|
690
|
+
item_name = args[2]
|
691
|
+
comparison_to_eval = args[3]
|
692
|
+
timeout = args[4]
|
693
|
+
if args.length == 6
|
694
|
+
polling_rate = args[5]
|
695
|
+
else
|
696
|
+
polling_rate = DEFAULT_TLM_POLLING_RATE
|
697
|
+
end
|
698
|
+
else
|
699
|
+
# Invalid number of arguments
|
700
|
+
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{function_name}()"
|
701
|
+
end
|
702
|
+
return [target_name, packet_name, item_name, comparison_to_eval, timeout, polling_rate]
|
703
|
+
end
|
704
|
+
|
705
|
+
# sleep in a script - returns true if canceled mid sleep
|
706
|
+
def cosmos_script_sleep(sleep_time = nil)
|
707
|
+
return false if $cmd_tlm_disconnect
|
708
|
+
if defined? ScriptRunnerFrame and ScriptRunnerFrame.instance
|
709
|
+
sleep_time = 30000000 unless sleep_time # Handle infinite wait
|
710
|
+
if sleep_time > 0.0
|
711
|
+
end_time = Time.now + sleep_time
|
712
|
+
until (Time.now >= end_time)
|
713
|
+
sleep(0.01)
|
714
|
+
if ScriptRunnerFrame.instance.pause?
|
715
|
+
ScriptRunnerFrame.instance.perform_pause
|
716
|
+
return true
|
717
|
+
end
|
718
|
+
return true if ScriptRunnerFrame.instance.go?
|
719
|
+
raise StopScript if ScriptRunnerFrame.instance.stop?
|
720
|
+
end
|
721
|
+
end
|
722
|
+
else
|
723
|
+
if sleep_time
|
724
|
+
sleep(sleep_time)
|
725
|
+
else
|
726
|
+
print 'Infinite Wait - Press Enter to Continue: '
|
727
|
+
gets()
|
728
|
+
end
|
729
|
+
end
|
730
|
+
return false
|
731
|
+
end
|
732
|
+
|
733
|
+
def _cosmos_script_wait_implementation(target_name, packet_name, item_name, value_type, timeout, polling_rate)
|
734
|
+
end_time = Time.now + timeout
|
735
|
+
exp_to_eval = yield
|
736
|
+
|
737
|
+
while true
|
738
|
+
work_start = Time.now
|
739
|
+
value = tlm_variable(target_name, packet_name, item_name, value_type)
|
740
|
+
if eval(exp_to_eval)
|
741
|
+
return true, value
|
742
|
+
end
|
743
|
+
break if Time.now >= end_time || $cmd_tlm_disconnect
|
744
|
+
|
745
|
+
delta = Time.now - work_start
|
746
|
+
sleep_time = polling_rate - delta
|
747
|
+
end_delta = end_time - Time.now
|
748
|
+
sleep_time = end_delta if end_delta < sleep_time
|
749
|
+
sleep_time = 0 if sleep_time < 0
|
750
|
+
canceled = cosmos_script_sleep(sleep_time)
|
751
|
+
|
752
|
+
if canceled
|
753
|
+
value = tlm_variable(target_name, packet_name, item_name, value_type)
|
754
|
+
if eval(exp_to_eval)
|
755
|
+
return true, value
|
756
|
+
else
|
757
|
+
return false, value
|
758
|
+
end
|
759
|
+
end
|
760
|
+
end
|
761
|
+
|
762
|
+
return false, value
|
763
|
+
end
|
764
|
+
|
765
|
+
# Wait for a converted telemetry item to pass a comparison
|
766
|
+
def cosmos_script_wait_implementation(target_name, packet_name, item_name, value_type, comparison_to_eval, timeout, polling_rate = DEFAULT_TLM_POLLING_RATE)
|
767
|
+
_cosmos_script_wait_implementation(target_name, packet_name, item_name, value_type, timeout, polling_rate) do
|
768
|
+
"value " + comparison_to_eval
|
769
|
+
end
|
770
|
+
end
|
771
|
+
|
772
|
+
def cosmos_script_wait_implementation_tolerance(target_name, packet_name, item_name, value_type, expected_value, tolerance, timeout, polling_rate = DEFAULT_TLM_POLLING_RATE)
|
773
|
+
_cosmos_script_wait_implementation(target_name, packet_name, item_name, value_type, timeout, polling_rate) do
|
774
|
+
"((#{expected_value} - #{tolerance})..(#{expected_value} + #{tolerance})).include? value"
|
775
|
+
end
|
776
|
+
end
|
777
|
+
|
778
|
+
# Wait on an expression to be true.
|
779
|
+
def cosmos_script_wait_implementation_expression(exp_to_eval, timeout, polling_rate, context)
|
780
|
+
end_time = Time.now + timeout
|
781
|
+
context = ScriptRunnerFrame.instance.script_binding if !context and defined? ScriptRunnerFrame and ScriptRunnerFrame.instance
|
782
|
+
|
783
|
+
while true
|
784
|
+
work_start = Time.now
|
785
|
+
if eval(exp_to_eval, context)
|
786
|
+
return true
|
787
|
+
end
|
788
|
+
break if Time.now >= end_time
|
789
|
+
|
790
|
+
delta = Time.now - work_start
|
791
|
+
sleep_time = polling_rate - delta
|
792
|
+
end_delta = end_time - Time.now
|
793
|
+
sleep_time = end_delta if end_delta < sleep_time
|
794
|
+
sleep_time = 0 if sleep_time < 0
|
795
|
+
canceled = cosmos_script_sleep(sleep_time)
|
796
|
+
|
797
|
+
if canceled
|
798
|
+
if eval(exp_to_eval, context)
|
799
|
+
return true
|
800
|
+
else
|
801
|
+
return nil
|
802
|
+
end
|
803
|
+
end
|
804
|
+
end
|
805
|
+
|
806
|
+
return nil
|
807
|
+
end
|
808
|
+
|
809
|
+
def check_eval(target_name, packet_name, item_name, comparison_to_eval, value)
|
810
|
+
string = "value " + comparison_to_eval
|
811
|
+
check_str = "CHECK: #{_upcase(target_name, packet_name, item_name)} #{comparison_to_eval}"
|
812
|
+
value_str = "with value == #{value}"
|
813
|
+
if eval(string)
|
814
|
+
Logger.info "#{check_str} success #{value_str}"
|
815
|
+
else
|
816
|
+
message = "#{check_str} failed #{value_str}"
|
817
|
+
if $cmd_tlm_disconnect
|
818
|
+
Logger.error message
|
819
|
+
else
|
820
|
+
raise CheckError, message
|
821
|
+
end
|
822
|
+
end
|
823
|
+
end
|
824
|
+
|
825
|
+
def build_cmd_output_string(target_name, cmd_name, cmd_params, raw = false)
|
826
|
+
if raw
|
827
|
+
output_string = 'cmd_raw("'
|
828
|
+
else
|
829
|
+
output_string = 'cmd("'
|
830
|
+
end
|
831
|
+
output_string << target_name + ' ' + cmd_name
|
832
|
+
if cmd_params.nil? or cmd_params.empty?
|
833
|
+
output_string << '")'
|
834
|
+
else
|
835
|
+
params = []
|
836
|
+
cmd_params.each do |key, value|
|
837
|
+
if value.class == String
|
838
|
+
if value.convert_to_value.class == String
|
839
|
+
value = value.inspect
|
840
|
+
if value.length > 256
|
841
|
+
value = value[0..255] + "...'"
|
842
|
+
end
|
843
|
+
value.tr!('"',"'")
|
844
|
+
end
|
845
|
+
end
|
846
|
+
params << "#{key} #{value}"
|
847
|
+
end
|
848
|
+
params = params.join(", ")
|
849
|
+
output_string << ' with ' + params + '")'
|
850
|
+
end
|
851
|
+
return output_string
|
852
|
+
end
|
853
|
+
|
854
|
+
def prompt_for_hazardous(target_name, cmd_name, hazardous_description)
|
855
|
+
message = "Warning: Command #{target_name} #{cmd_name} is Hazardous. "
|
856
|
+
message << "\n#{hazardous_description}\n" if hazardous_description
|
857
|
+
message << "Send? (y,n): "
|
858
|
+
print message
|
859
|
+
answer = gets.chomp
|
860
|
+
if answer.downcase == 'y'
|
861
|
+
return true
|
862
|
+
else
|
863
|
+
return false
|
864
|
+
end
|
865
|
+
end
|
866
|
+
|
867
|
+
def prompt_for_script_abort
|
868
|
+
print "Stop running script? (y,n): "
|
869
|
+
answer = gets.chomp
|
870
|
+
if answer.downcase == 'y'
|
871
|
+
exit
|
872
|
+
else
|
873
|
+
return false # Not aborted - Retry
|
874
|
+
end
|
875
|
+
end
|
876
|
+
|
877
|
+
def prompt_to_continue(string)
|
878
|
+
print "#{string}: "
|
879
|
+
gets.chomp
|
880
|
+
end
|
881
|
+
|
882
|
+
def prompt_message_box(string, buttons)
|
883
|
+
print "#{string} (#{buttons.join(", ")}): "
|
884
|
+
gets.chomp
|
885
|
+
end
|
886
|
+
|
887
|
+
def prompt_vertical_message_box(string, options)
|
888
|
+
prompt_message_box(string, options)
|
889
|
+
end
|
890
|
+
|
891
|
+
def prompt_combo_box(string, options)
|
892
|
+
prompt_message_box(string, options)
|
893
|
+
end
|
894
|
+
|
895
|
+
end # module Script
|
896
|
+
|
897
|
+
end # module Cosmos
|