cosmos 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.gitignore +48 -48
- data/.travis.yml +7 -7
- data/CONTRIBUTING.txt +50 -50
- data/Gemfile +6 -6
- data/Guardfile +27 -27
- data/LICENSE.txt +879 -879
- data/Manifest.txt +1116 -1114
- data/README.md +109 -107
- data/Rakefile +214 -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 +247 -247
- 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 -294
- 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.rb +18 -18
- 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 +20 -20
- 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/Replay.bat +59 -59
- 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/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 +18 -18
- data/autohotkey/tools/TlmViewerAHK3 +18 -18
- data/autohotkey/tools/TlmViewerAHK4 +18 -18
- data/autohotkey/tools/TlmViewerAHK5 +18 -18
- data/autohotkey/tools/autohotkey.rb +37 -37
- data/autohotkey/tools/cmd_extractor.ahk +27 -27
- data/autohotkey/tools/cmd_sender.ahk +182 -162
- data/autohotkey/tools/cmd_tlm_server.ahk +89 -89
- data/autohotkey/tools/cmd_tlm_server2.ahk +45 -45
- data/autohotkey/tools/data_viewer.ahk +135 -135
- data/autohotkey/tools/handbook_creator.ahk +23 -23
- data/autohotkey/tools/launcher.ahk +41 -41
- data/autohotkey/tools/limits_monitor.ahk +70 -70
- data/autohotkey/tools/open_gl_builder.ahk +134 -134
- data/autohotkey/tools/packet_viewer.ahk +143 -143
- data/autohotkey/tools/packet_viewer2.ahk +9 -9
- data/autohotkey/tools/replay.ahk +98 -98
- data/autohotkey/tools/script_runner.ahk +589 -589
- data/autohotkey/tools/script_runner2.ahk +34 -31
- data/autohotkey/tools/table_manager.ahk +220 -220
- data/autohotkey/tools/test_runner.ahk +262 -259
- data/autohotkey/tools/test_runner2.ahk +52 -52
- data/autohotkey/tools/test_runner3.ahk +13 -13
- data/autohotkey/tools/tlm_extractor.ahk +272 -272
- data/autohotkey/tools/tlm_grapher.ahk +642 -642
- 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 -49
- 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 +98 -97
- data/data/about.txt +4 -4
- data/data/crc.txt +306 -305
- data/data/diamond.STL +57 -57
- data/data/legal.txt +9 -9
- data/demo/Gemfile +6 -6
- data/demo/Launcher +15 -15
- data/demo/Launcher.bat +59 -59
- data/demo/Rakefile +61 -61
- data/demo/config/data/crc.txt +222 -206
- data/demo/config/data/diamond.STL +57 -57
- data/demo/config/data/meta_init.txt +4 -4
- data/demo/config/system/system.txt +34 -34
- 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 +3 -3
- 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 -294
- 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 -12
- 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 +54 -48
- data/demo/config/targets/TEMPLATED/target.txt +6 -6
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server.txt +33 -33
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server2.txt +29 -29
- 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 +86 -86
- 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 +80 -80
- 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 -52
- data/demo/lib/example_target.rb +113 -108
- 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 +182 -182
- 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 +15 -15
- data/demo/tools/CmdExtractor.bat +59 -59
- data/demo/tools/CmdSender +15 -15
- data/demo/tools/CmdSender.bat +59 -59
- data/demo/tools/CmdTlmServer +15 -15
- data/demo/tools/CmdTlmServer.bat +59 -59
- data/demo/tools/DataViewer +15 -15
- data/demo/tools/DataViewer.bat +59 -59
- data/demo/tools/ExampleTarget +15 -15
- data/demo/tools/ExampleTarget.bat +59 -59
- data/demo/tools/HandbookCreator +15 -15
- data/demo/tools/HandbookCreator.bat +61 -61
- data/demo/tools/Launcher +15 -15
- data/demo/tools/Launcher.bat +59 -59
- data/demo/tools/LimitsMonitor +15 -15
- data/demo/tools/LimitsMonitor.bat +59 -59
- data/demo/tools/OpenGLBuilder +15 -15
- data/demo/tools/OpenGLBuilder.bat +59 -59
- data/demo/tools/PacketViewer +15 -15
- data/demo/tools/PacketViewer.bat +59 -59
- data/demo/tools/Replay +15 -15
- data/demo/tools/Replay.bat +59 -59
- data/demo/tools/ScpiTarget +15 -15
- data/demo/tools/ScpiTarget.bat +59 -59
- data/demo/tools/ScriptRunner +15 -15
- data/demo/tools/ScriptRunner.bat +59 -59
- data/demo/tools/TableManager +15 -15
- data/demo/tools/TableManager.bat +59 -59
- data/demo/tools/TestRunner +15 -15
- data/demo/tools/TestRunner.bat +59 -59
- data/demo/tools/TlmExtractor +15 -15
- data/demo/tools/TlmExtractor.bat +59 -59
- data/demo/tools/TlmGrapher +15 -15
- data/demo/tools/TlmGrapher.bat +59 -59
- data/demo/tools/TlmViewer +15 -15
- data/demo/tools/TlmViewer.bat +59 -59
- data/demo/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +15 -15
- data/demo/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/CmdSender.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +15 -15
- data/demo/tools/mac/CmdSender.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +15 -15
- data/demo/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/DataViewer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +15 -15
- data/demo/tools/mac/DataViewer.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +15 -15
- data/demo/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/Launcher.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +15 -15
- data/demo/tools/mac/Launcher.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +15 -15
- data/demo/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +15 -15
- data/demo/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/PacketViewer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +15 -15
- data/demo/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/Replay.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/Replay.app/Contents/MacOS/Replay.rb +15 -15
- data/demo/tools/mac/Replay.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +15 -15
- data/demo/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/TableManager.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +15 -15
- data/demo/tools/mac/TableManager.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/TestRunner.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +15 -15
- data/demo/tools/mac/TestRunner.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +15 -15
- data/demo/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +15 -15
- data/demo/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +6 -6
- data/demo/tools/mac/TlmViewer.app/Contents/Info.plist +38 -38
- data/demo/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +15 -15
- data/demo/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +6 -6
- 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 +261 -261
- 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 +81 -81
- 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 +894 -894
- 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 +306 -306
- data/ext/mkrf_conf.rb +40 -40
- data/install/Gemfile +6 -6
- data/install/Launcher +14 -14
- data/install/Launcher.bat +59 -59
- data/install/Rakefile +61 -61
- data/install/config/data/crc.txt +134 -133
- 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 +39 -39
- 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 +15 -15
- data/install/tools/CmdExtractor.bat +59 -59
- data/install/tools/CmdSender +15 -15
- data/install/tools/CmdSender.bat +59 -59
- data/install/tools/CmdTlmServer +15 -15
- data/install/tools/CmdTlmServer.bat +59 -59
- data/install/tools/DataViewer +15 -15
- data/install/tools/DataViewer.bat +59 -59
- data/install/tools/HandbookCreator +15 -15
- data/install/tools/HandbookCreator.bat +61 -61
- data/install/tools/Launcher +15 -15
- data/install/tools/Launcher.bat +59 -59
- data/install/tools/LimitsMonitor +15 -15
- data/install/tools/LimitsMonitor.bat +59 -59
- data/install/tools/OpenGLBuilder +15 -15
- data/install/tools/OpenGLBuilder.bat +59 -59
- data/install/tools/PacketViewer +15 -15
- data/install/tools/PacketViewer.bat +59 -59
- data/install/tools/Replay +15 -15
- data/install/tools/Replay.bat +59 -59
- data/install/tools/ScriptRunner +15 -15
- data/install/tools/ScriptRunner.bat +59 -59
- data/install/tools/TableManager +15 -15
- data/install/tools/TableManager.bat +59 -59
- data/install/tools/TestRunner +15 -15
- data/install/tools/TestRunner.bat +59 -59
- data/install/tools/TlmExtractor +15 -15
- data/install/tools/TlmExtractor.bat +59 -59
- data/install/tools/TlmGrapher +15 -15
- data/install/tools/TlmGrapher.bat +59 -59
- data/install/tools/TlmViewer +15 -15
- data/install/tools/TlmViewer.bat +59 -59
- data/install/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -38
- data/install/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +15 -15
- data/install/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/CmdSender.app/Contents/Info.plist +38 -38
- data/install/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +15 -15
- data/install/tools/mac/CmdSender.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +15 -15
- data/install/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/DataViewer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +15 -15
- data/install/tools/mac/DataViewer.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -38
- data/install/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +15 -15
- data/install/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/Launcher.app/Contents/Info.plist +38 -38
- data/install/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +15 -15
- data/install/tools/mac/Launcher.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -38
- data/install/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +15 -15
- data/install/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -38
- data/install/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +15 -15
- data/install/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/PacketViewer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +15 -15
- data/install/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/Replay.app/Contents/Info.plist +38 -38
- data/install/tools/mac/Replay.app/Contents/MacOS/Replay.rb +15 -15
- data/install/tools/mac/Replay.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -38
- data/install/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +15 -15
- data/install/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/TableManager.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +15 -15
- data/install/tools/mac/TableManager.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/TestRunner.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +15 -15
- data/install/tools/mac/TestRunner.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +15 -15
- data/install/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +15 -15
- data/install/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +6 -6
- data/install/tools/mac/TlmViewer.app/Contents/Info.plist +38 -38
- data/install/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +15 -15
- data/install/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +6 -6
- 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 +310 -310
- data/lib/cosmos/core_ext/stringio.rb +24 -24
- data/lib/cosmos/core_ext/time.rb +446 -446
- 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 +317 -317
- data/lib/cosmos/gui/dialogs/about_dialog.rb +128 -128
- 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 +196 -196
- data/lib/cosmos/gui/dialogs/legal_dialog.rb +169 -168
- data/lib/cosmos/gui/dialogs/packet_log_dialog.rb +118 -118
- data/lib/cosmos/gui/dialogs/progress_dialog.rb +270 -262
- data/lib/cosmos/gui/dialogs/pry_dialog.rb +165 -161
- 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 +113 -113
- 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 +494 -494
- data/lib/cosmos/gui/line_graph/line_graph_popups.rb +116 -116
- data/lib/cosmos/gui/line_graph/line_graph_scaling.rb +460 -460
- 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 +459 -459
- 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 -712
- 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 +813 -786
- data/lib/cosmos/gui/qt_tool.rb +378 -373
- 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 +395 -395
- data/lib/cosmos/gui/utilities/screenshot.rb +25 -25
- data/lib/cosmos/gui/utilities/script_module_gui.rb +203 -203
- 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 -149
- data/lib/cosmos/interfaces/interface.rb +213 -213
- 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 -128
- data/lib/cosmos/interfaces/stream_interface.rb +156 -156
- data/lib/cosmos/interfaces/tcpip_client_interface.rb +60 -60
- data/lib/cosmos/interfaces/tcpip_server_interface.rb +154 -154
- data/lib/cosmos/interfaces/udp_interface.rb +173 -173
- 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 +344 -320
- data/lib/cosmos/io/json_drb_object.rb +137 -137
- 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 +583 -532
- data/lib/cosmos/io/udp_sockets.rb +152 -152
- data/lib/cosmos/io/win32_serial_driver.rb +147 -147
- data/lib/cosmos/packet_logs.rb +6 -6
- data/lib/cosmos/packet_logs/meta_packet_log_writer.rb +107 -107
- data/lib/cosmos/packet_logs/packet_log_reader.rb +441 -439
- data/lib/cosmos/packet_logs/packet_log_writer.rb +321 -309
- data/lib/cosmos/packet_logs/packet_log_writer_pair.rb +30 -30
- data/lib/cosmos/packets/binary_accessor.rb +921 -921
- data/lib/cosmos/packets/commands.rb +291 -291
- data/lib/cosmos/packets/limits.rb +263 -263
- data/lib/cosmos/packets/limits_response.rb +38 -38
- data/lib/cosmos/packets/packet.rb +714 -699
- data/lib/cosmos/packets/packet_config.rb +1034 -1034
- data/lib/cosmos/packets/packet_item.rb +317 -317
- data/lib/cosmos/packets/packet_item_limits.rb +128 -128
- data/lib/cosmos/packets/structure.rb +421 -386
- data/lib/cosmos/packets/structure_item.rb +233 -233
- data/lib/cosmos/packets/telemetry.rb +317 -317
- 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/extract.rb +115 -115
- data/lib/cosmos/script/script.rb +1513 -1493
- 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 +152 -143
- data/lib/cosmos/streams/stream.rb +57 -57
- data/lib/cosmos/streams/stream_protocol.rb +369 -369
- data/lib/cosmos/streams/tcpip_client_stream.rb +77 -77
- data/lib/cosmos/streams/tcpip_socket_stream.rb +139 -139
- 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 +558 -558
- data/lib/cosmos/system/target.rb +178 -178
- data/lib/cosmos/tools/cmd_extractor/cmd_extractor.rb +254 -253
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +716 -716
- 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 +936 -940
- data/lib/cosmos/tools/cmd_tlm_server/background_task.rb +46 -46
- data/lib/cosmos/tools/cmd_tlm_server/background_tasks.rb +67 -63
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +511 -497
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +241 -241
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +1033 -1008
- data/lib/cosmos/tools/cmd_tlm_server/commanding.rb +112 -112
- data/lib/cosmos/tools/cmd_tlm_server/connections.rb +176 -176
- data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +241 -221
- 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 +628 -600
- data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +167 -167
- data/lib/cosmos/tools/data_viewer/dump_component.rb +40 -40
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +149 -149
- data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +360 -360
- data/lib/cosmos/tools/launcher/launcher.rb +184 -184
- data/lib/cosmos/tools/launcher/launcher_config.rb +175 -167
- data/lib/cosmos/tools/launcher/launcher_multitool.rb +40 -41
- data/lib/cosmos/tools/launcher/launcher_tool.rb +104 -104
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +796 -768
- 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 +525 -525
- data/lib/cosmos/tools/replay/replay.rb +495 -488
- data/lib/cosmos/tools/replay/replay_server.rb +91 -91
- data/lib/cosmos/tools/script_runner/script_audit.rb +147 -139
- data/lib/cosmos/tools/script_runner/script_runner.rb +914 -914
- data/lib/cosmos/tools/script_runner/script_runner_config.rb +40 -40
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +1892 -1859
- 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 +480 -480
- data/lib/cosmos/tools/test_runner/test_runner.rb +1157 -1157
- data/lib/cosmos/tools/test_runner/test_runner_chooser.rb +338 -338
- data/lib/cosmos/tools/tlm_extractor/text_item_chooser.rb +60 -60
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +1008 -1008
- 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 +94 -94
- 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 +180 -180
- 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 +173 -173
- data/lib/cosmos/tools/tlm_grapher/data_objects/data_object.rb +177 -177
- data/lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb +412 -409
- 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 -320
- 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 +1278 -1278
- 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 +111 -95
- 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 +72 -66
- 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 -458
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +563 -544
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer_config.rb +287 -287
- 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 +70 -70
- data/lib/cosmos/tools/tlm_viewer/widgets/block_widget.rb +61 -61
- 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 +647 -596
- data/lib/cosmos/utilities.rb +11 -10
- 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 +74 -74
- 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 -0
- 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 +311 -311
- data/roodi.yml +24 -24
- data/run_gui_tests.bat +32 -32
- 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 +151 -151
- data/spec/gui/line_graph/line_clip_spec.rb +322 -322
- 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 -294
- 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 -131
- data/spec/interfaces/linc_interface_spec.rb +199 -199
- 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 +54 -54
- data/spec/interfaces/tcpip_server_interface_spec.rb +151 -151
- data/spec/interfaces/udp_interface_spec.rb +175 -177
- 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 +99 -99
- 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 +61 -61
- 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 +408 -408
- data/spec/packet_logs/packet_log_writer_pair_spec.rb +30 -30
- data/spec/packet_logs/packet_log_writer_spec.rb +223 -223
- data/spec/packets/binary_accessor_spec.rb +2073 -2073
- data/spec/packets/commands_spec.rb +369 -369
- data/spec/packets/limits_response_spec.rb +25 -25
- data/spec/packets/limits_spec.rb +326 -326
- data/spec/packets/packet_config_spec.rb +1620 -1620
- 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 +1057 -949
- data/spec/packets/structure_item_spec.rb +195 -195
- data/spec/packets/structure_spec.rb +419 -419
- data/spec/packets/telemetry_spec.rb +535 -535
- 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/script_spec.rb +654 -654
- data/spec/spec_helper.rb +154 -148
- data/spec/streams/burst_stream_protocol_spec.rb +32 -32
- data/spec/streams/fixed_stream_protocol_spec.rb +110 -110
- data/spec/streams/length_stream_protocol_spec.rb +297 -297
- data/spec/streams/preidentified_stream_protocol_spec.rb +118 -118
- data/spec/streams/serial_stream_spec.rb +105 -105
- data/spec/streams/stream_protocol_spec.rb +332 -332
- data/spec/streams/stream_spec.rb +29 -29
- data/spec/streams/tcpip_client_stream_spec.rb +54 -54
- data/spec/streams/tcpip_socket_stream_spec.rb +146 -146
- data/spec/streams/template_stream_protocol_spec.rb +151 -151
- data/spec/streams/terminated_stream_protocol_spec.rb +123 -123
- data/spec/system/system_spec.rb +645 -645
- data/spec/system/target_spec.rb +248 -248
- data/spec/tools/cmd_tlm_server/api_spec.rb +1087 -1113
- 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 +411 -411
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +415 -415
- data/spec/tools/cmd_tlm_server/commanding_spec.rb +123 -123
- data/spec/tools/cmd_tlm_server/connections_spec.rb +147 -147
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +306 -306
- data/spec/tools/cmd_tlm_server/interfaces_spec.rb +252 -238
- data/spec/tools/cmd_tlm_server/packet_logging_spec.rb +143 -143
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +98 -101
- data/spec/tools/cmd_tlm_server/routers_spec.rb +223 -208
- data/spec/top_level/top_level_spec.rb +334 -321
- 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
- metadata +18 -2
|
@@ -1,1034 +1,1034 @@
|
|
|
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/config/config_parser'
|
|
12
|
-
require 'cosmos/packets/packet'
|
|
13
|
-
require 'cosmos/conversions'
|
|
14
|
-
require 'cosmos/processors'
|
|
15
|
-
require 'ostruct'
|
|
16
|
-
|
|
17
|
-
module Cosmos
|
|
18
|
-
|
|
19
|
-
class PacketConfig
|
|
20
|
-
# @return [String] The name of this configuration. To be used by higher
|
|
21
|
-
# level classes to store information about the current PacketConfig.
|
|
22
|
-
attr_accessor :name
|
|
23
|
-
|
|
24
|
-
# @return [Hash<String=>Packet>] Hash of all the telemetry packets
|
|
25
|
-
# keyed by the packet name.
|
|
26
|
-
attr_reader :telemetry
|
|
27
|
-
|
|
28
|
-
# @return [Hash<String=>Packet>] Hash of all the command packets
|
|
29
|
-
# keyed by the packet name.
|
|
30
|
-
attr_reader :commands
|
|
31
|
-
|
|
32
|
-
# @return [Hash<String=>Array(String, String, String)>] Hash of all the
|
|
33
|
-
# limits groups keyed by the group name. The value is a three element
|
|
34
|
-
# array consisting of the target_name, packet_name, and item_name.
|
|
35
|
-
attr_reader :limits_groups
|
|
36
|
-
|
|
37
|
-
# @return [Array<Symbol>] The defined limits sets for all items in the
|
|
38
|
-
# packet. This will always include :DEFAULT.
|
|
39
|
-
attr_reader :limits_sets
|
|
40
|
-
|
|
41
|
-
# @return [Array<String>] Array of strings listing all the warnings
|
|
42
|
-
# that were created while parsing the configuration file.
|
|
43
|
-
attr_reader :warnings
|
|
44
|
-
|
|
45
|
-
# @return [Hash<String=>Hash<String=>Array(Packet)>>] Hash of hashes keyed
|
|
46
|
-
# first by the target name and then by the item name. This results in an
|
|
47
|
-
# array of packets containing that target and item. This structure is
|
|
48
|
-
# used to perform lookups when the packet and item are known but the
|
|
49
|
-
# packet is not.
|
|
50
|
-
attr_reader :latest_data
|
|
51
|
-
|
|
52
|
-
def initialize
|
|
53
|
-
@name = nil
|
|
54
|
-
@telemetry = {}
|
|
55
|
-
@commands = {}
|
|
56
|
-
@limits_groups = {}
|
|
57
|
-
@limits_sets = [:DEFAULT]
|
|
58
|
-
# Hash of Hashes. First index by target name and then item name.
|
|
59
|
-
# Returns an array of packets with that target and item.
|
|
60
|
-
@latest_data = {}
|
|
61
|
-
@warnings = []
|
|
62
|
-
|
|
63
|
-
# Create unknown packets
|
|
64
|
-
@commands['UNKNOWN']
|
|
65
|
-
@commands['UNKNOWN'] = {}
|
|
66
|
-
@commands['UNKNOWN']['UNKNOWN'] = Packet.new('UNKNOWN', 'UNKNOWN', :BIG_ENDIAN)
|
|
67
|
-
@telemetry['UNKNOWN']
|
|
68
|
-
@telemetry['UNKNOWN'] = {}
|
|
69
|
-
@telemetry['UNKNOWN']['UNKNOWN'] = Packet.new('UNKNOWN', 'UNKNOWN', :BIG_ENDIAN)
|
|
70
|
-
|
|
71
|
-
# Used during packet processing
|
|
72
|
-
@current_target_name = nil
|
|
73
|
-
@current_packet_name = nil
|
|
74
|
-
@current_cmd_or_tlm = nil
|
|
75
|
-
@current_packet = nil
|
|
76
|
-
@current_item = nil
|
|
77
|
-
@current_limits_group = nil
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
#########################################################################
|
|
81
|
-
# The following methods process a command or telemetry packet config file
|
|
82
|
-
#########################################################################
|
|
83
|
-
|
|
84
|
-
# Processes a COSMOS configuration file and uses the keywords to build up
|
|
85
|
-
# knowledge of the commands, telemetry, and limits groups.
|
|
86
|
-
#
|
|
87
|
-
# @param filename [String] The name of the configuration file
|
|
88
|
-
# @param target_name [String] The target name
|
|
89
|
-
def process_file(filename, target_name)
|
|
90
|
-
@converted_type = nil
|
|
91
|
-
@converted_bit_size = nil
|
|
92
|
-
@proc_text = ''
|
|
93
|
-
@building_generic_conversion = false
|
|
94
|
-
@macro_append = OpenStruct.new
|
|
95
|
-
@macro_append.building = false
|
|
96
|
-
@macro_append.list = []
|
|
97
|
-
@macro_append.indices = []
|
|
98
|
-
@macro_append.format = ''
|
|
99
|
-
@macro_append.format_order = ''
|
|
100
|
-
|
|
101
|
-
target_name = target_name.upcase
|
|
102
|
-
|
|
103
|
-
parser = ConfigParser.new("https://github.com/BallAerospace/COSMOS/wiki/Command-and-Telemetry-Configuration")
|
|
104
|
-
parser.parse_file(filename) do |keyword, params|
|
|
105
|
-
|
|
106
|
-
if @building_generic_conversion
|
|
107
|
-
case keyword
|
|
108
|
-
# Complete a generic conversion
|
|
109
|
-
when 'GENERIC_READ_CONVERSION_END', 'GENERIC_WRITE_CONVERSION_END'
|
|
110
|
-
parser.verify_num_parameters(0, 0, keyword)
|
|
111
|
-
@current_item.read_conversion =
|
|
112
|
-
GenericConversion.new(@proc_text,
|
|
113
|
-
@converted_type,
|
|
114
|
-
@converted_bit_size) if keyword.include? "READ"
|
|
115
|
-
@current_item.write_conversion =
|
|
116
|
-
GenericConversion.new(@proc_text,
|
|
117
|
-
@converted_type,
|
|
118
|
-
@converted_bit_size) if keyword.include? "WRITE"
|
|
119
|
-
@building_generic_conversion = false
|
|
120
|
-
# Add the current config.line to the conversion being built
|
|
121
|
-
else
|
|
122
|
-
@proc_text << parser.line << "\n"
|
|
123
|
-
end # case keyword
|
|
124
|
-
|
|
125
|
-
else # not building generic conversion
|
|
126
|
-
|
|
127
|
-
case keyword
|
|
128
|
-
|
|
129
|
-
# Start a new packet
|
|
130
|
-
when 'COMMAND', 'TELEMETRY'
|
|
131
|
-
process_packet(parser, keyword, params, target_name)
|
|
132
|
-
|
|
133
|
-
# Select an existing packet for editing
|
|
134
|
-
when 'SELECT_COMMAND', 'SELECT_TELEMETRY'
|
|
135
|
-
usage = "#{keyword} <TARGET NAME> <PACKET NAME>"
|
|
136
|
-
finish_packet()
|
|
137
|
-
parser.verify_num_parameters(2, 2, usage)
|
|
138
|
-
@current_target_name = target_name
|
|
139
|
-
@current_target_name = params[0].upcase if target_name == 'SYSTEM'
|
|
140
|
-
@current_packet_name = params[1].upcase
|
|
141
|
-
|
|
142
|
-
@current_packet = nil
|
|
143
|
-
if keyword.include?('COMMAND')
|
|
144
|
-
@current_cmd_or_tlm = 'Command'
|
|
145
|
-
if @commands[@current_target_name]
|
|
146
|
-
@current_packet = @commands[@current_target_name][@current_packet_name]
|
|
147
|
-
end
|
|
148
|
-
else
|
|
149
|
-
@current_cmd_or_tlm = 'Telemetry'
|
|
150
|
-
if @telemetry[@current_target_name]
|
|
151
|
-
@current_packet = @telemetry[@current_target_name][@current_packet_name]
|
|
152
|
-
end
|
|
153
|
-
end
|
|
154
|
-
raise parser.error("Packet not found", usage) unless @current_packet
|
|
155
|
-
|
|
156
|
-
# Start the creation of a new limits group
|
|
157
|
-
when 'LIMITS_GROUP'
|
|
158
|
-
usage = "LIMITS_GROUP <GROUP NAME>"
|
|
159
|
-
parser.verify_num_parameters(1, 1, usage)
|
|
160
|
-
@current_limits_group = params[0].to_s.upcase
|
|
161
|
-
@limits_groups[@current_limits_group] = [] unless @limits_groups.include?(@current_limits_group)
|
|
162
|
-
|
|
163
|
-
# Add a telemetry item to the limits group
|
|
164
|
-
when 'LIMITS_GROUP_ITEM'
|
|
165
|
-
usage = "LIMITS_GROUP_ITEM <TARGET NAME> <PACKET NAME> <ITEM NAME>"
|
|
166
|
-
parser.verify_num_parameters(3, 3, usage)
|
|
167
|
-
@limits_groups[@current_limits_group] << [params[0].to_s.upcase, params[1].to_s.upcase, params[2].to_s.upcase] if @current_limits_group
|
|
168
|
-
|
|
169
|
-
#######################################################################
|
|
170
|
-
# All the following keywords must have a current packet defined
|
|
171
|
-
#######################################################################
|
|
172
|
-
when 'SELECT_ITEM', 'SELECT_PARAMETER', 'ITEM', 'PARAMETER', 'ID_ITEM', 'ID_PARAMETER', 'ARRAY_ITEM', 'ARRAY_PARAMETER', 'APPEND_ITEM', 'APPEND_PARAMETER', 'APPEND_ID_ITEM', 'APPEND_ID_PARAMETER', 'APPEND_ARRAY_ITEM', 'APPEND_ARRAY_PARAMETER', 'MACRO_APPEND_START', 'MACRO_APPEND_END', 'ALLOW_SHORT', 'HAZARDOUS', 'PROCESSOR', 'META', 'DISABLE_MESSAGES', 'HIDDEN', 'DISABLED'
|
|
173
|
-
raise parser.error("No current packet for #{keyword}") unless @current_packet
|
|
174
|
-
process_current_packet(parser, keyword, params)
|
|
175
|
-
|
|
176
|
-
#######################################################################
|
|
177
|
-
# All the following keywords must have a current item defined
|
|
178
|
-
#######################################################################
|
|
179
|
-
when 'STATE', 'READ_CONVERSION', 'WRITE_CONVERSION', 'POLY_READ_CONVERSION', 'POLY_WRITE_CONVERSION', 'SEG_POLY_READ_CONVERSION', 'SEG_POLY_WRITE_CONVERSION', 'GENERIC_READ_CONVERSION_START', 'GENERIC_WRITE_CONVERSION_START', 'REQUIRED', 'LIMITS', 'LIMITS_RESPONSE', 'UNITS', 'FORMAT_STRING', 'DESCRIPTION', 'MINIMUM_VALUE', 'MAXIMUM_VALUE', 'DEFAULT_VALUE', 'OVERFLOW'
|
|
180
|
-
raise parser.error("No current item for #{keyword}") unless @current_item
|
|
181
|
-
process_current_item(parser, keyword, params)
|
|
182
|
-
|
|
183
|
-
else
|
|
184
|
-
# blank config.lines will have a nil keyword and should not raise an exception
|
|
185
|
-
raise parser.error("Unknown keyword '#{keyword}'") if keyword
|
|
186
|
-
end # case keyword
|
|
187
|
-
|
|
188
|
-
end # if building_generic_conversion
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
# Complete the last defined packet
|
|
192
|
-
finish_packet()
|
|
193
|
-
end
|
|
194
|
-
|
|
195
|
-
protected
|
|
196
|
-
|
|
197
|
-
def process_current_packet(parser, keyword, params)
|
|
198
|
-
case keyword
|
|
199
|
-
|
|
200
|
-
# Select an item in the current telemetry packet for editing
|
|
201
|
-
when 'SELECT_PARAMETER', 'SELECT_ITEM'
|
|
202
|
-
if (@current_cmd_or_tlm == 'Command') && (keyword.split('_')[1] == 'ITEM')
|
|
203
|
-
raise parser.error("SELECT_ITEM only applies to telemetry packets")
|
|
204
|
-
end
|
|
205
|
-
if (@current_cmd_or_tlm == 'Telemetry') && (keyword.split('_')[1] == 'PARAMETER')
|
|
206
|
-
raise parser.error("SELECT_PARAMETER only applies to command packets")
|
|
207
|
-
end
|
|
208
|
-
usage = "#{keyword} <#{keyword.split('_')[1]} NAME>"
|
|
209
|
-
finish_item()
|
|
210
|
-
parser.verify_num_parameters(1, 1, usage)
|
|
211
|
-
begin
|
|
212
|
-
@current_item = @current_packet.get_item(params[0])
|
|
213
|
-
rescue # Rescue the default execption to provide a nicer error message
|
|
214
|
-
raise parser.error("#{params[0]} not found in #{@current_cmd_or_tlm.downcase} packet #{@current_target_name} #{@current_packet_name}", usage)
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
# Start a new telemetry item in the current packet
|
|
218
|
-
when 'ITEM', 'PARAMETER', 'ID_ITEM', 'ID_PARAMETER', 'ARRAY_ITEM', 'ARRAY_PARAMETER', 'APPEND_ITEM', 'APPEND_PARAMETER', 'APPEND_ID_ITEM', 'APPEND_ID_PARAMETER', 'APPEND_ARRAY_ITEM', 'APPEND_ARRAY_PARAMETER'
|
|
219
|
-
start_item(parser, keyword, params)
|
|
220
|
-
|
|
221
|
-
# Start the creation of a macro-expanded list of items
|
|
222
|
-
# This simulates an array of structures of multiple items in the packet by repeating
|
|
223
|
-
# each item in the list multiple times with a different "index" added to the name.
|
|
224
|
-
when 'MACRO_APPEND_START'
|
|
225
|
-
process_macro_append_start(parser, keyword, params)
|
|
226
|
-
|
|
227
|
-
# End the creation of a macro-expanded list of items
|
|
228
|
-
when 'MACRO_APPEND_END'
|
|
229
|
-
process_macro_append_end(parser, keyword) # no params for END
|
|
230
|
-
|
|
231
|
-
# Allow this packet to be received with less data than the defined length
|
|
232
|
-
# without generating a warning.
|
|
233
|
-
when 'ALLOW_SHORT'
|
|
234
|
-
@current_packet.short_buffer_allowed = true
|
|
235
|
-
|
|
236
|
-
# Mark the current command as hazardous
|
|
237
|
-
when 'HAZARDOUS'
|
|
238
|
-
usage = "HAZARDOUS <HAZARDOUS DESCRIPTION (Optional)>"
|
|
239
|
-
parser.verify_num_parameters(0, 1, usage)
|
|
240
|
-
@current_packet.hazardous = true
|
|
241
|
-
@current_packet.hazardous_description = params[0] if params[0]
|
|
242
|
-
|
|
243
|
-
# Define a processor class that will be called once when a packet is received
|
|
244
|
-
when 'PROCESSOR'
|
|
245
|
-
process_processor(parser, keyword, params)
|
|
246
|
-
|
|
247
|
-
when 'DISABLE_MESSAGES'
|
|
248
|
-
usage = "#{keyword}"
|
|
249
|
-
parser.verify_num_parameters(0, 0, usage)
|
|
250
|
-
@current_packet.messages_disabled = true
|
|
251
|
-
|
|
252
|
-
# Store user defined metadata for the packet or a packet item
|
|
253
|
-
when 'META'
|
|
254
|
-
usage = "META <META NAME> <META VALUES (optional)>"
|
|
255
|
-
parser.verify_num_parameters(1, nil, usage)
|
|
256
|
-
if params.length > 1
|
|
257
|
-
meta_values = params[1..-1]
|
|
258
|
-
else
|
|
259
|
-
meta_values = []
|
|
260
|
-
end
|
|
261
|
-
if @current_item
|
|
262
|
-
# Item META
|
|
263
|
-
@current_item.meta[params[0].to_s.upcase] = meta_values
|
|
264
|
-
else
|
|
265
|
-
# Packet META
|
|
266
|
-
@current_packet.meta[params[0].to_s.upcase] = meta_values
|
|
267
|
-
end
|
|
268
|
-
|
|
269
|
-
when 'HIDDEN'
|
|
270
|
-
usage = "#{keyword}"
|
|
271
|
-
parser.verify_num_parameters(0, 0, usage)
|
|
272
|
-
@current_packet.hidden = true
|
|
273
|
-
|
|
274
|
-
when 'DISABLED'
|
|
275
|
-
usage = "#{keyword}"
|
|
276
|
-
parser.verify_num_parameters(0, 0, usage)
|
|
277
|
-
@current_packet.hidden = true
|
|
278
|
-
@current_packet.disabled = true
|
|
279
|
-
|
|
280
|
-
end
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
def process_current_item(parser, keyword, params)
|
|
284
|
-
case keyword
|
|
285
|
-
|
|
286
|
-
# Add a state to the current telemety item
|
|
287
|
-
when 'STATE'
|
|
288
|
-
process_state(parser, keyword, params)
|
|
289
|
-
|
|
290
|
-
# Apply a conversion to the current item after it is read to or
|
|
291
|
-
# written from the packet
|
|
292
|
-
when 'READ_CONVERSION', 'WRITE_CONVERSION'
|
|
293
|
-
usage = "#{keyword} <conversion class filename> <custom parameters> ..."
|
|
294
|
-
parser.verify_num_parameters(1, nil, usage)
|
|
295
|
-
begin
|
|
296
|
-
# require should be performed in target.txt
|
|
297
|
-
klass = params[0].filename_to_class_name.to_class
|
|
298
|
-
raise parser.error("#{params[0].filename_to_class_name} class not found. Did you require the file in target.txt?", usage) unless klass
|
|
299
|
-
@current_item.send("#{keyword.downcase}=".to_sym,
|
|
300
|
-
klass.new(*params[1..(params.length - 1)]))
|
|
301
|
-
rescue Exception => err
|
|
302
|
-
raise parser.error(err)
|
|
303
|
-
end
|
|
304
|
-
|
|
305
|
-
# Apply a polynomial conversion to the current item
|
|
306
|
-
when 'POLY_READ_CONVERSION', 'POLY_WRITE_CONVERSION'
|
|
307
|
-
usage = "#{keyword} <C0> <C1> <C2> ..."
|
|
308
|
-
parser.verify_num_parameters(1, nil, usage)
|
|
309
|
-
@current_item.read_conversion = PolynomialConversion.new(params) if keyword.include? "READ"
|
|
310
|
-
@current_item.write_conversion = PolynomialConversion.new(params) if keyword.include? "WRITE"
|
|
311
|
-
|
|
312
|
-
# Apply a segmented polynomial conversion to the current item
|
|
313
|
-
# after it is read from the telemetry packet
|
|
314
|
-
when 'SEG_POLY_READ_CONVERSION'
|
|
315
|
-
usage = "SEG_POLY_READ_CONVERSION <Lower Bound> <C0> <C1> <C2> ..."
|
|
316
|
-
parser.verify_num_parameters(2, nil, usage)
|
|
317
|
-
if !(@current_item.read_conversion &&
|
|
318
|
-
SegmentedPolynomialConversion === @current_item.read_conversion)
|
|
319
|
-
@current_item.read_conversion = SegmentedPolynomialConversion.new
|
|
320
|
-
end
|
|
321
|
-
@current_item.read_conversion.add_segment(params[0].to_f, *params[1..-1])
|
|
322
|
-
|
|
323
|
-
# Apply a segmented polynomial conversion to the current item
|
|
324
|
-
# before it is written to the telemetry packet
|
|
325
|
-
when 'SEG_POLY_WRITE_CONVERSION'
|
|
326
|
-
usage = "SEG_POLY_WRITE_CONVERSION <Lower Bound> <C0> <C1> <C2> ..."
|
|
327
|
-
parser.verify_num_parameters(2, nil, usage)
|
|
328
|
-
if !(@current_item.write_conversion &&
|
|
329
|
-
SegmentedPolynomialConversion === @current_item.write_conversion)
|
|
330
|
-
@current_item.write_conversion = SegmentedPolynomialConversion.new
|
|
331
|
-
end
|
|
332
|
-
@current_item.write_conversion.add_segment(params[0].to_f, *params[1..-1])
|
|
333
|
-
|
|
334
|
-
# Start the definition of a generic conversion.
|
|
335
|
-
# All config.lines following this config.line are considered part
|
|
336
|
-
# of the conversion until an end of conversion marker is found
|
|
337
|
-
when 'GENERIC_READ_CONVERSION_START', 'GENERIC_WRITE_CONVERSION_START'
|
|
338
|
-
usage = "#{keyword} <Converted Type (optional)> <Converted Bit Size (optional)>"
|
|
339
|
-
parser.verify_num_parameters(0, 2, usage)
|
|
340
|
-
@proc_text = ''
|
|
341
|
-
@building_generic_conversion = true
|
|
342
|
-
@converted_type = nil
|
|
343
|
-
@converted_bit_size = nil
|
|
344
|
-
if params[0]
|
|
345
|
-
@converted_type = params[0].upcase.intern
|
|
346
|
-
raise parser.error("Invalid converted_type: #{@converted_type}.") unless [:INT, :UINT, :FLOAT, :STRING, :BLOCK].include? @converted_type
|
|
347
|
-
end
|
|
348
|
-
@converted_bit_size = Integer(params[1]) if params[1]
|
|
349
|
-
|
|
350
|
-
# Define a set of limits for the current telemetry item
|
|
351
|
-
when 'LIMITS'
|
|
352
|
-
process_limits(parser, keyword, params)
|
|
353
|
-
|
|
354
|
-
# Define a response class that will be called when the limits state of the
|
|
355
|
-
# current item changes.
|
|
356
|
-
when 'LIMITS_RESPONSE'
|
|
357
|
-
process_limits_response(parser, keyword, params)
|
|
358
|
-
|
|
359
|
-
# Define a printf style formatting string for the current telemetry item
|
|
360
|
-
when 'FORMAT_STRING'
|
|
361
|
-
process_format_string(parser, keyword, params)
|
|
362
|
-
|
|
363
|
-
# Define the units of the current telemetry item
|
|
364
|
-
when 'UNITS'
|
|
365
|
-
usage = "UNITS <FULL UNITS NAME> <ABBREVIATED UNITS NAME>"
|
|
366
|
-
parser.verify_num_parameters(2, 2, usage)
|
|
367
|
-
@current_item.units_full = params[0]
|
|
368
|
-
@current_item.units = params[1]
|
|
369
|
-
|
|
370
|
-
# Update the description for the current telemetry item
|
|
371
|
-
when 'DESCRIPTION'
|
|
372
|
-
usage = "DESCRIPTION <DESCRIPTION>"
|
|
373
|
-
parser.verify_num_parameters(1, 1, usage)
|
|
374
|
-
@current_item.description = params[0]
|
|
375
|
-
|
|
376
|
-
# Mark the current command parameter as required.
|
|
377
|
-
# This means it must be given a value and not just use its default.
|
|
378
|
-
when 'REQUIRED'
|
|
379
|
-
usage = "REQUIRED"
|
|
380
|
-
parser.verify_num_parameters(0, 0, usage)
|
|
381
|
-
if @current_cmd_or_tlm == 'Command'
|
|
382
|
-
@current_item.required = true
|
|
383
|
-
else
|
|
384
|
-
raise parser.error("#{keyword} only applies to command parameters")
|
|
385
|
-
end
|
|
386
|
-
|
|
387
|
-
# Update the mimimum value for the current command parameter
|
|
388
|
-
when 'MINIMUM_VALUE'
|
|
389
|
-
if @current_cmd_or_tlm == 'Telemetry'
|
|
390
|
-
raise parser.error("#{keyword} only applies to command parameters")
|
|
391
|
-
end
|
|
392
|
-
usage = "MINIMUM_VALUE <MINIMUM VALUE>"
|
|
393
|
-
parser.verify_num_parameters(1, 1, usage)
|
|
394
|
-
@current_item.range =
|
|
395
|
-
Range.new(ConfigParser.handle_defined_constants(
|
|
396
|
-
params[0].convert_to_value), @current_item.range.end)
|
|
397
|
-
|
|
398
|
-
# Update the maximum value for the current command parameter
|
|
399
|
-
when 'MAXIMUM_VALUE'
|
|
400
|
-
if @current_cmd_or_tlm == 'Telemetry'
|
|
401
|
-
raise parser.error("#{keyword} only applies to command parameters")
|
|
402
|
-
end
|
|
403
|
-
usage = "MAXIMUM_VALUE <MAXIMUM VALUE>"
|
|
404
|
-
parser.verify_num_parameters(1, 1, usage)
|
|
405
|
-
@current_item.range =
|
|
406
|
-
Range.new(@current_item.range.begin,
|
|
407
|
-
ConfigParser.handle_defined_constants(params[0].convert_to_value))
|
|
408
|
-
|
|
409
|
-
# Update the default value for the current command parameter
|
|
410
|
-
when 'DEFAULT_VALUE'
|
|
411
|
-
if @current_cmd_or_tlm == 'Telemetry'
|
|
412
|
-
raise parser.error("#{keyword} only applies to command parameters")
|
|
413
|
-
end
|
|
414
|
-
usage = "DEFAULT_VALUE <DEFAULT VALUE>"
|
|
415
|
-
parser.verify_num_parameters(1, 1, usage)
|
|
416
|
-
if ((@current_item.data_type == :STRING) ||
|
|
417
|
-
(@current_item.data_type == :BLOCK))
|
|
418
|
-
@current_item.default = params[0]
|
|
419
|
-
else
|
|
420
|
-
@current_item.default =
|
|
421
|
-
ConfigParser.handle_defined_constants(params[0].convert_to_value)
|
|
422
|
-
end
|
|
423
|
-
|
|
424
|
-
# Update the overflow type for the current command parameter
|
|
425
|
-
when 'OVERFLOW'
|
|
426
|
-
usage = "OVERFLOW <OVERFLOW VALUE - ERROR, ERROR_ALLOW_HEX, TRUNCATE, or SATURATE>"
|
|
427
|
-
parser.verify_num_parameters(1, 1, usage)
|
|
428
|
-
@current_item.overflow = params[0].to_s.upcase.intern
|
|
429
|
-
|
|
430
|
-
end
|
|
431
|
-
end
|
|
432
|
-
|
|
433
|
-
####################################################
|
|
434
|
-
# The following methods process a particular keyword
|
|
435
|
-
|
|
436
|
-
def process_macro_append_start(parser, keyword, params)
|
|
437
|
-
@macro_append.building = true
|
|
438
|
-
|
|
439
|
-
usage = '#{keyword} <FIRST INDEX> <LAST INDEX> [NAME FORMAT]'
|
|
440
|
-
parser.verify_num_parameters(2, 3, usage)
|
|
441
|
-
|
|
442
|
-
# Store the params
|
|
443
|
-
first_index = params[0].to_i
|
|
444
|
-
last_index = params[1].to_i
|
|
445
|
-
@macro_append.indices = [first_index, last_index].sort
|
|
446
|
-
@macro_append.indices = (@macro_append.indices[0]..@macro_append.indices[1]).to_a
|
|
447
|
-
@macro_append.indices.reverse! if first_index > last_index
|
|
448
|
-
@macro_append.format = params[2] ? params[2] : '%s%d'
|
|
449
|
-
spos = @macro_append.format.index(/%\d*s/)
|
|
450
|
-
dpos = @macro_append.format.index(/%\d*d/)
|
|
451
|
-
raise parser.error("Invalid NAME FORMAT (#{@macro_append.format}) for MACRO_APPEND_START", usage) unless spos and dpos
|
|
452
|
-
if spos < dpos
|
|
453
|
-
@macro_append.format_order = 'sd'
|
|
454
|
-
else
|
|
455
|
-
@macro_append.format_order = 'ds'
|
|
456
|
-
end
|
|
457
|
-
end
|
|
458
|
-
|
|
459
|
-
def process_macro_append_end(parser, keyword)
|
|
460
|
-
update_cache = false
|
|
461
|
-
finish_item()
|
|
462
|
-
parser.verify_num_parameters(0, 0, keyword)
|
|
463
|
-
raise parser.error("Missing MACRO_APPEND_START before this config.line.", keyword) unless @macro_append.building
|
|
464
|
-
raise parser.error("No items appended in MACRO_APPEND list", keyword) unless @macro_append.list.length > 0
|
|
465
|
-
|
|
466
|
-
# Get first index, remove from array
|
|
467
|
-
first = @macro_append.indices.shift
|
|
468
|
-
|
|
469
|
-
# Rename the items in the list using the first index
|
|
470
|
-
items = @current_packet.items
|
|
471
|
-
@macro_append.list.each do |name|
|
|
472
|
-
item = items[name]
|
|
473
|
-
items.delete name
|
|
474
|
-
if @macro_append.format_order == 'sd'
|
|
475
|
-
first_name = sprintf(@macro_append.format, name, first)
|
|
476
|
-
else
|
|
477
|
-
first_name = sprintf(@macro_append.format, first, name)
|
|
478
|
-
end
|
|
479
|
-
item.name = first_name
|
|
480
|
-
items[first_name] = item
|
|
481
|
-
end
|
|
482
|
-
|
|
483
|
-
# Append multiple copies of the items in the list
|
|
484
|
-
@macro_append.indices.each do |index|
|
|
485
|
-
@macro_append.list.each do |name|
|
|
486
|
-
if @macro_append.format_order == 'sd'
|
|
487
|
-
first_name = sprintf(@macro_append.format, name, first)
|
|
488
|
-
this_name = sprintf(@macro_append.format, name, index)
|
|
489
|
-
else
|
|
490
|
-
first_name = sprintf(@macro_append.format, first, name)
|
|
491
|
-
this_name = sprintf(@macro_append.format, index, name)
|
|
492
|
-
end
|
|
493
|
-
first_item = items[first_name]
|
|
494
|
-
format_string = nil
|
|
495
|
-
format_string = first_item.format_string if first_item.format_string
|
|
496
|
-
this_item = @current_packet.append_item(this_name,
|
|
497
|
-
first_item.bit_size,
|
|
498
|
-
first_item.data_type,
|
|
499
|
-
first_item.array_size,
|
|
500
|
-
first_item.endianness,
|
|
501
|
-
first_item.overflow,
|
|
502
|
-
format_string,
|
|
503
|
-
first_item.read_conversion,
|
|
504
|
-
first_item.write_conversion,
|
|
505
|
-
first_item.id_value)
|
|
506
|
-
this_item.states = first_item.states if first_item.states
|
|
507
|
-
this_item.description = first_item.description if first_item.description
|
|
508
|
-
this_item.units_full = first_item.units_full if first_item.units_full
|
|
509
|
-
this_item.units = first_item.units if first_item.units
|
|
510
|
-
this_item.default = first_item.default
|
|
511
|
-
this_item.range = first_item.range if first_item.range
|
|
512
|
-
this_item.required = first_item.required
|
|
513
|
-
this_item.hazardous = first_item.hazardous
|
|
514
|
-
if first_item.state_colors
|
|
515
|
-
this_item.state_colors = first_item.state_colors
|
|
516
|
-
update_cache = true
|
|
517
|
-
end
|
|
518
|
-
if first_item.limits
|
|
519
|
-
this_item.limits = first_item.limits
|
|
520
|
-
update_cache = true
|
|
521
|
-
end
|
|
522
|
-
end
|
|
523
|
-
end
|
|
524
|
-
@current_packet.update_limits_items_cache if update_cache
|
|
525
|
-
|
|
526
|
-
@macro_append.building = false
|
|
527
|
-
@macro_append.indices = []
|
|
528
|
-
@macro_append.list = []
|
|
529
|
-
end
|
|
530
|
-
|
|
531
|
-
def process_state(parser, keyword, params)
|
|
532
|
-
if @current_cmd_or_tlm == 'Command'
|
|
533
|
-
usage = "#{keyword} <STATE NAME> <STATE VALUE> <HAZARDOUS (Optional)> <Hazardous Description (Optional)>"
|
|
534
|
-
parser.verify_num_parameters(2, 4, usage)
|
|
535
|
-
else
|
|
536
|
-
usage = "#{keyword} <STATE NAME> <STATE VALUE> <COLOR: GREEN/YELLOW/RED (Optional)>"
|
|
537
|
-
parser.verify_num_parameters(2, 3, usage)
|
|
538
|
-
end
|
|
539
|
-
@current_item.states ||= {}
|
|
540
|
-
if @current_item.states[params[0].upcase]
|
|
541
|
-
msg = "Duplicate state defined on line #{parser.line_number}: #{parser.line}"
|
|
542
|
-
Logger.instance.warn(msg)
|
|
543
|
-
@warnings << msg
|
|
544
|
-
end
|
|
545
|
-
if @current_item.data_type == :STRING or @current_item.data_type == :BLOCK
|
|
546
|
-
@current_item.states[params[0].upcase] = params[1]
|
|
547
|
-
else
|
|
548
|
-
@current_item.states[params[0].upcase] = params[1].convert_to_value
|
|
549
|
-
end
|
|
550
|
-
if params[2]
|
|
551
|
-
if @current_cmd_or_tlm == 'Command'
|
|
552
|
-
if params[2].upcase == 'HAZARDOUS'
|
|
553
|
-
@current_item.hazardous ||= {}
|
|
554
|
-
if params[3]
|
|
555
|
-
@current_item.hazardous[params[0].upcase] = params[3]
|
|
556
|
-
else
|
|
557
|
-
@current_item.hazardous[params[0].upcase] = ""
|
|
558
|
-
end
|
|
559
|
-
else
|
|
560
|
-
raise parser.error("HAZARDOUS expected as third parameter for this line.", usage)
|
|
561
|
-
end
|
|
562
|
-
else
|
|
563
|
-
if params[2]
|
|
564
|
-
color = params[2].upcase.to_sym
|
|
565
|
-
unless PacketItem::STATE_COLORS.include? color
|
|
566
|
-
raise parser.error("Invalid state color #{color}. Must be one of #{PacketItem::STATE_COLORS.join(' ')}.", usage)
|
|
567
|
-
end
|
|
568
|
-
@current_item.limits ||= Limits.new
|
|
569
|
-
@current_item.limits.enabled = true
|
|
570
|
-
@current_item.state_colors ||= {}
|
|
571
|
-
@current_item.state_colors[params[0].upcase] = color
|
|
572
|
-
@current_packet.update_limits_items_cache
|
|
573
|
-
end
|
|
574
|
-
end
|
|
575
|
-
end
|
|
576
|
-
end
|
|
577
|
-
|
|
578
|
-
def process_limits(parser, keyword, params)
|
|
579
|
-
if @current_cmd_or_tlm == 'Command'
|
|
580
|
-
raise parser.error("#{keyword} only applies to telemetry items")
|
|
581
|
-
end
|
|
582
|
-
usage = "#{keyword} <LIMITS SET> <PERSISTENCE> <ENABLED/DISABLED> <RED LOW LIMIT> <YELLOW LOW LIMIT> <YELLOW HIGH LIMIT> <RED HIGH LIMIT> <GREEN LOW LIMIT (Optional)> <GREEN HIGH LIMIT (Optional)>"
|
|
583
|
-
parser.verify_num_parameters(7, 9, usage)
|
|
584
|
-
|
|
585
|
-
begin
|
|
586
|
-
persistence = Integer(params[1])
|
|
587
|
-
red_low = Float(params[3])
|
|
588
|
-
yellow_low = Float(params[4])
|
|
589
|
-
yellow_high = Float(params[5])
|
|
590
|
-
red_high = Float(params[6])
|
|
591
|
-
rescue
|
|
592
|
-
raise parser.error("Invalid persistence or limits values. Ensure persistence is an integer. Limits can be integers or floats.", usage)
|
|
593
|
-
end
|
|
594
|
-
|
|
595
|
-
enabled = params[2].upcase
|
|
596
|
-
if enabled != 'ENABLED' and enabled != 'DISABLED'
|
|
597
|
-
raise parser.error("Initial state must be ENABLED or DISABLED.", usage)
|
|
598
|
-
end
|
|
599
|
-
|
|
600
|
-
# Verify valid limits are specified
|
|
601
|
-
if (red_low > yellow_low) or (yellow_low >= yellow_high) or (yellow_high > red_high)
|
|
602
|
-
raise parser.error("Invalid limits specified. Ensure yellow limits are within red limits.", usage)
|
|
603
|
-
end
|
|
604
|
-
if params.length != 7
|
|
605
|
-
begin
|
|
606
|
-
green_low = Float(params[7])
|
|
607
|
-
green_high = Float(params[8])
|
|
608
|
-
rescue
|
|
609
|
-
raise parser.error("Invalid green limits values. Limits can be integers or floats.", usage)
|
|
610
|
-
end
|
|
611
|
-
|
|
612
|
-
if (yellow_low > green_low) or (green_low >= green_high) or (green_high > yellow_high)
|
|
613
|
-
raise parser.error("Invalid limits specified. Ensure green limits are within yellow limits.", usage)
|
|
614
|
-
end
|
|
615
|
-
end
|
|
616
|
-
|
|
617
|
-
limits_set = params[0].upcase.to_sym
|
|
618
|
-
@limits_sets << limits_set
|
|
619
|
-
@limits_sets.uniq!
|
|
620
|
-
# Initialize the limits values. Values must be initialized with a :DEFAULT key
|
|
621
|
-
if !@current_item.limits.values
|
|
622
|
-
if limits_set == :DEFAULT
|
|
623
|
-
@current_item.limits.values = {:DEFAULT => []}
|
|
624
|
-
else
|
|
625
|
-
raise parser.error("DEFAULT limits must be defined for #{@current_packet.target_name} #{@current_packet.packet_name} #{@current_item.name} before setting limits set #{limits_set}")
|
|
626
|
-
end
|
|
627
|
-
end
|
|
628
|
-
if limits_set != :DEFAULT
|
|
629
|
-
msg = nil
|
|
630
|
-
if (enabled == 'ENABLED' and @current_item.limits.enabled != true) or (enabled != 'ENABLED' and @current_item.limits.enabled != false)
|
|
631
|
-
msg = "#{@current_cmd_or_tlm} Item #{@current_target_name} #{@current_packet_name} #{@current_item.name} #{limits_set} limits enable setting conflict with DEFAULT"
|
|
632
|
-
end
|
|
633
|
-
if @current_item.limits.persistence_setting != persistence
|
|
634
|
-
msg = "#{@current_cmd_or_tlm} Item #{@current_target_name} #{@current_packet_name} #{@current_item.name} #{limits_set} limits persistence setting conflict with DEFAULT"
|
|
635
|
-
end
|
|
636
|
-
if msg
|
|
637
|
-
Logger.instance.warn msg
|
|
638
|
-
@warnings << msg
|
|
639
|
-
end
|
|
640
|
-
end
|
|
641
|
-
@current_item.limits.enabled = true if enabled == 'ENABLED'
|
|
642
|
-
values = @current_item.limits.values
|
|
643
|
-
if params.length == 7
|
|
644
|
-
values[limits_set] = [red_low, yellow_low, yellow_high, red_high]
|
|
645
|
-
else
|
|
646
|
-
values[limits_set] = [red_low, yellow_low, yellow_high, red_high, green_low, green_high]
|
|
647
|
-
end
|
|
648
|
-
@current_item.limits.values = values
|
|
649
|
-
@current_item.limits.persistence_setting = persistence
|
|
650
|
-
@current_item.limits.persistence_count = 0
|
|
651
|
-
@current_packet.update_limits_items_cache
|
|
652
|
-
end
|
|
653
|
-
|
|
654
|
-
def process_limits_response(parser, keyword, params)
|
|
655
|
-
if @current_cmd_or_tlm == 'Command'
|
|
656
|
-
raise parser.error("#{keyword} only applies to telemetry items")
|
|
657
|
-
end
|
|
658
|
-
usage = "#{keyword} <RESPONSE CLASS FILENAME> <RESPONSE SPECIFIC OPTIONS>"
|
|
659
|
-
parser.verify_num_parameters(1, nil, usage)
|
|
660
|
-
|
|
661
|
-
begin
|
|
662
|
-
# require should be performed in target.txt
|
|
663
|
-
klass = params[0].filename_to_class_name.to_class
|
|
664
|
-
raise parser.error("#{params[0].filename_to_class_name} class not found. Did you require the file in target.txt?", usage) unless klass
|
|
665
|
-
if params[1]
|
|
666
|
-
@current_item.limits.response = klass.new(*params[1..(params.length - 1)])
|
|
667
|
-
else
|
|
668
|
-
@current_item.limits.response = klass.new
|
|
669
|
-
end
|
|
670
|
-
rescue Exception => err
|
|
671
|
-
raise parser.error(err, usage)
|
|
672
|
-
end
|
|
673
|
-
end
|
|
674
|
-
|
|
675
|
-
def process_processor(parser, keyword, params)
|
|
676
|
-
if @current_cmd_or_tlm == 'Command'
|
|
677
|
-
raise parser.error("#{keyword} only applies to telemetry packets")
|
|
678
|
-
end
|
|
679
|
-
usage = "#{keyword} <PROCESSOR NAME> <PROCESSOR CLASS FILENAME> <PROCESSOR SPECIFIC OPTIONS>"
|
|
680
|
-
parser.verify_num_parameters(2, nil, usage)
|
|
681
|
-
|
|
682
|
-
begin
|
|
683
|
-
# require should be performed in target.txt
|
|
684
|
-
klass = params[1].filename_to_class_name.to_class
|
|
685
|
-
raise parser.error("#{params[1].filename_to_class_name} class not found. Did you require the file in target.txt?", usage) unless klass
|
|
686
|
-
if params[2]
|
|
687
|
-
processor = klass.new(*params[2..(params.length - 1)])
|
|
688
|
-
else
|
|
689
|
-
processor = klass.new
|
|
690
|
-
end
|
|
691
|
-
raise ArgumentError, "processor must be a Cosmos::Processor but is a #{processor.class}" unless Cosmos::Processor === processor
|
|
692
|
-
processor.name = params[0]
|
|
693
|
-
@current_packet.processors[params[0].to_s.upcase] = processor
|
|
694
|
-
rescue Exception => err
|
|
695
|
-
raise parser.error(err, usage)
|
|
696
|
-
end
|
|
697
|
-
end
|
|
698
|
-
|
|
699
|
-
def process_format_string(parser, keyword, params)
|
|
700
|
-
usage = "#{keyword} <PRINTF STYLE STRING>"
|
|
701
|
-
parser.verify_num_parameters(1, 1, usage)
|
|
702
|
-
@current_item.format_string = params[0]
|
|
703
|
-
unless @current_item.read_conversion
|
|
704
|
-
# Check format string as long as a read conversion has not been defined
|
|
705
|
-
begin
|
|
706
|
-
case @current_item.data_type
|
|
707
|
-
when :INT, :UINT
|
|
708
|
-
sprintf(@current_item.format_string, 0)
|
|
709
|
-
when :FLOAT
|
|
710
|
-
sprintf(@current_item.format_string, 0.0)
|
|
711
|
-
when :STRING, :BLOCK
|
|
712
|
-
sprintf(@current_item.format_string, 'Hello')
|
|
713
|
-
else
|
|
714
|
-
# Nothing to do
|
|
715
|
-
end
|
|
716
|
-
rescue Exception
|
|
717
|
-
raise parser.error("Invalid #{keyword} specified for type #{@current_item.data_type}: #{params[0]}", usage)
|
|
718
|
-
end
|
|
719
|
-
end
|
|
720
|
-
end
|
|
721
|
-
|
|
722
|
-
def process_packet(parser, keyword, params, target_name)
|
|
723
|
-
finish_packet()
|
|
724
|
-
|
|
725
|
-
usage = "#{keyword} <TARGET NAME> <PACKET NAME> <ENDIANNESS: BIG_ENDIAN/LITTLE_ENDIAN> <DESCRIPTION (Optional)>"
|
|
726
|
-
parser.verify_num_parameters(3, 4, usage)
|
|
727
|
-
target_name = params[0].to_s.upcase if target_name == 'SYSTEM'
|
|
728
|
-
packet_name = params[1].to_s.upcase
|
|
729
|
-
endianness = params[2].to_s.upcase.intern
|
|
730
|
-
description = params[3].to_s
|
|
731
|
-
if endianness != :BIG_ENDIAN and endianness != :LITTLE_ENDIAN
|
|
732
|
-
raise parser.error("Invalid endianness #{params[2]}. Must be BIG_ENDIAN or LITTLE_ENDIAN.", usage)
|
|
733
|
-
end
|
|
734
|
-
|
|
735
|
-
@current_target_name = target_name
|
|
736
|
-
@current_packet_name = packet_name
|
|
737
|
-
@current_cmd_or_tlm = keyword.capitalize
|
|
738
|
-
|
|
739
|
-
# Be sure there is not already a packet by this name
|
|
740
|
-
if @current_cmd_or_tlm == 'Command'
|
|
741
|
-
if @commands[@current_target_name]
|
|
742
|
-
if @commands[@current_target_name][@current_packet_name]
|
|
743
|
-
msg = "#{@current_cmd_or_tlm} Packet #{@current_target_name} #{@current_packet_name} redefined."
|
|
744
|
-
Logger.instance.warn msg
|
|
745
|
-
@warnings << msg
|
|
746
|
-
end
|
|
747
|
-
end
|
|
748
|
-
else
|
|
749
|
-
if @telemetry[@current_target_name]
|
|
750
|
-
if @telemetry[@current_target_name][@current_packet_name]
|
|
751
|
-
msg = "#{@current_cmd_or_tlm} Packet #{@current_target_name} #{@current_packet_name} redefined."
|
|
752
|
-
Logger.instance.warn msg
|
|
753
|
-
@warnings << msg
|
|
754
|
-
end
|
|
755
|
-
end
|
|
756
|
-
end
|
|
757
|
-
|
|
758
|
-
@current_packet = Packet.new(@current_target_name, @current_packet_name, endianness, description)
|
|
759
|
-
|
|
760
|
-
# Add received time packet items
|
|
761
|
-
if @current_cmd_or_tlm == 'Telemetry'
|
|
762
|
-
item = @current_packet.define_item('RECEIVED_TIMESECONDS', 0, 0, :DERIVED, nil, @current_packet.default_endianness, :ERROR, '%0.6f', ReceivedTimeSecondsConversion.new)
|
|
763
|
-
item.description = 'COSMOS Received Time (UTC, Floating point, Unix epoch)'
|
|
764
|
-
item = @current_packet.define_item('RECEIVED_TIMEFORMATTED', 0, 0, :DERIVED, nil, @current_packet.default_endianness, :ERROR, nil, ReceivedTimeFormattedConversion.new)
|
|
765
|
-
item.description = 'COSMOS Received Time (Local time zone, Formatted string)'
|
|
766
|
-
item = @current_packet.define_item('RECEIVED_COUNT', 0, 0, :DERIVED, nil, @current_packet.default_endianness, :ERROR, nil, ReceivedCountConversion.new)
|
|
767
|
-
item.description = 'COSMOS packet received count'
|
|
768
|
-
|
|
769
|
-
unless @telemetry[@current_target_name]
|
|
770
|
-
@telemetry[@current_target_name] = {}
|
|
771
|
-
@latest_data[@current_target_name] = {}
|
|
772
|
-
end
|
|
773
|
-
else
|
|
774
|
-
@commands[@current_target_name] ||= {}
|
|
775
|
-
end
|
|
776
|
-
end
|
|
777
|
-
|
|
778
|
-
# Add current packet into hash if it exists
|
|
779
|
-
def finish_packet
|
|
780
|
-
finish_item()
|
|
781
|
-
if @current_packet
|
|
782
|
-
# Review bit offset to look for overlapping definitions
|
|
783
|
-
# This will allow gaps in the packet, but not allow the same bits to be
|
|
784
|
-
# used for multiple variables.
|
|
785
|
-
expected_next_offset = nil
|
|
786
|
-
previous_item = nil
|
|
787
|
-
@current_packet.sorted_items.each do |item|
|
|
788
|
-
if expected_next_offset and item.bit_offset < expected_next_offset
|
|
789
|
-
msg = "Bit definition overlap at bit offset #{item.bit_offset} for #{@current_cmd_or_tlm} packet #{@current_target_name} #{@current_packet_name} items #{item.name} and #{previous_item.name}"
|
|
790
|
-
Logger.instance.warn(msg)
|
|
791
|
-
@warnings << msg
|
|
792
|
-
end
|
|
793
|
-
if item.array_size
|
|
794
|
-
if item.array_size > 0
|
|
795
|
-
expected_next_offset = item.bit_offset + item.array_size
|
|
796
|
-
else
|
|
797
|
-
expected_next_offset = item.array_size
|
|
798
|
-
end
|
|
799
|
-
else
|
|
800
|
-
expected_next_offset = nil
|
|
801
|
-
if item.bit_offset > 0
|
|
802
|
-
# Handle little-endian bit fields
|
|
803
|
-
byte_aligned = ((item.bit_offset % 8) == 0)
|
|
804
|
-
if item.endianness == :LITTLE_ENDIAN and (item.data_type == :INT or item.data_type == :UINT) and !(byte_aligned and (item.bit_size == 8 or item.bit_size == 16 or item.bit_size == 32 or item.bit_size == 64))
|
|
805
|
-
# Bitoffset always refers to the most significant bit of a bitfield
|
|
806
|
-
bits_remaining_in_last_byte = 8 - (item.bit_offset % 8)
|
|
807
|
-
if item.bit_size > bits_remaining_in_last_byte
|
|
808
|
-
expected_next_offset = item.bit_offset + bits_remaining_in_last_byte
|
|
809
|
-
end
|
|
810
|
-
end
|
|
811
|
-
end
|
|
812
|
-
unless expected_next_offset
|
|
813
|
-
if item.bit_size > 0
|
|
814
|
-
expected_next_offset = item.bit_offset + item.bit_size
|
|
815
|
-
else
|
|
816
|
-
expected_next_offset = item.bit_size
|
|
817
|
-
end
|
|
818
|
-
end
|
|
819
|
-
end
|
|
820
|
-
previous_item = item
|
|
821
|
-
|
|
822
|
-
# Check command default and range data types if no write conversion is present
|
|
823
|
-
item.check_default_and_range_data_types if @current_cmd_or_tlm == 'Command'
|
|
824
|
-
end
|
|
825
|
-
|
|
826
|
-
# commit packet to memory
|
|
827
|
-
if @current_cmd_or_tlm == 'Command'
|
|
828
|
-
@commands[@current_target_name][@current_packet_name] = @current_packet
|
|
829
|
-
else
|
|
830
|
-
@telemetry[@current_target_name][@current_packet_name] = @current_packet
|
|
831
|
-
end
|
|
832
|
-
@current_packet = nil
|
|
833
|
-
@current_item = nil
|
|
834
|
-
end
|
|
835
|
-
end
|
|
836
|
-
|
|
837
|
-
# There are many different usages of the ITEM keword so parse the keyword
|
|
838
|
-
# and parameters to generate the correct usage information.
|
|
839
|
-
def generate_item_usage(keyword, params)
|
|
840
|
-
usage = "#{keyword} <ITEM NAME> "
|
|
841
|
-
usage << "<BIT OFFSET> " unless keyword.include?("APPEND")
|
|
842
|
-
if keyword.include?("ARRAY")
|
|
843
|
-
usage << "<ARRAY ITEM BIT SIZE> "
|
|
844
|
-
else
|
|
845
|
-
usage << "<BIT SIZE> "
|
|
846
|
-
end
|
|
847
|
-
if keyword.include?("PARAMETER")
|
|
848
|
-
if keyword.include?("ARRAY")
|
|
849
|
-
usage << "<TYPE: INT/UINT/FLOAT/STRING/BLOCK> "
|
|
850
|
-
else
|
|
851
|
-
if keyword.include?("APPEND")
|
|
852
|
-
data_type = params[2].upcase.to_sym
|
|
853
|
-
else
|
|
854
|
-
data_type = params[3].upcase.to_sym
|
|
855
|
-
end
|
|
856
|
-
if data_type == :STRING or data_type == :BLOCK
|
|
857
|
-
if keyword.include?("ID")
|
|
858
|
-
usage << "<TYPE: STRING/BLOCK> "
|
|
859
|
-
else
|
|
860
|
-
usage << "<TYPE: STRING/BLOCK> <DEFAULT VALUE>"
|
|
861
|
-
end
|
|
862
|
-
else
|
|
863
|
-
if keyword.include?("ID")
|
|
864
|
-
usage << "<TYPE: INT/UINT/FLOAT> <MIN VALUE> <MAX VALUE> "
|
|
865
|
-
else
|
|
866
|
-
usage << "<TYPE: INT/UINT/FLOAT/DERIVED> <MIN VALUE> <MAX VALUE> <DEFAULT VALUE>"
|
|
867
|
-
end
|
|
868
|
-
end
|
|
869
|
-
end
|
|
870
|
-
else
|
|
871
|
-
usage << "<TYPE: INT/UINT/FLOAT/STRING/BLOCK/DERIVED> "
|
|
872
|
-
end
|
|
873
|
-
usage << "<TOTAL ARRAY BIT SIZE> " if keyword.include?("ARRAY")
|
|
874
|
-
if keyword.include?("ID")
|
|
875
|
-
if keyword.include?("PARAMETER")
|
|
876
|
-
usage << "<DEFAULT AND ID VALUE> "
|
|
877
|
-
else
|
|
878
|
-
usage << "<ID VALUE> "
|
|
879
|
-
end
|
|
880
|
-
end
|
|
881
|
-
usage << "<DESCRIPTION (Optional)> <ENDIANNESS (Optional)>"
|
|
882
|
-
return usage
|
|
883
|
-
end
|
|
884
|
-
|
|
885
|
-
def start_item(parser, keyword, params)
|
|
886
|
-
finish_item()
|
|
887
|
-
|
|
888
|
-
usage = generate_item_usage(keyword, params)
|
|
889
|
-
max_options = usage.count("<")
|
|
890
|
-
parser.verify_num_parameters(max_options-2, max_options, usage)
|
|
891
|
-
begin
|
|
892
|
-
if params[max_options-1]
|
|
893
|
-
endianness = params[max_options-1].to_s.upcase.intern
|
|
894
|
-
if endianness != :BIG_ENDIAN and endianness != :LITTLE_ENDIAN
|
|
895
|
-
raise parser.error("Invalid endianness #{params[2]}. Must be BIG_ENDIAN or LITTLE_ENDIAN.", usage)
|
|
896
|
-
end
|
|
897
|
-
else
|
|
898
|
-
endianness = @current_packet.default_endianness
|
|
899
|
-
end
|
|
900
|
-
|
|
901
|
-
case keyword
|
|
902
|
-
when /ITEM/
|
|
903
|
-
raise parser.error("ITEM types are only valid with TELEMETRY", usage) if @current_cmd_or_tlm == 'Command'
|
|
904
|
-
# If this is an APPEND we don't have a bit offset so the index
|
|
905
|
-
# into the parameters changes
|
|
906
|
-
index = (keyword =~ /APPEND/) ? 3 : 4
|
|
907
|
-
id_value = (keyword =~ /ID_ITEM/) ? params[index] : nil
|
|
908
|
-
array_size = (keyword =~ /ARRAY_ITEM/) ? Integer(params[index]) : nil
|
|
909
|
-
case keyword
|
|
910
|
-
when 'ITEM', 'ID_ITEM', 'ARRAY_ITEM'
|
|
911
|
-
@current_item = @current_packet.define_item(params[0], # name
|
|
912
|
-
Integer(params[1]), # bit offset
|
|
913
|
-
Integer(params[2]), # bit size
|
|
914
|
-
params[3].upcase.to_sym, # data_type
|
|
915
|
-
array_size, # array size
|
|
916
|
-
endianness, # endianness
|
|
917
|
-
:ERROR, # overflow
|
|
918
|
-
nil, # format string
|
|
919
|
-
nil, # read conversion
|
|
920
|
-
nil, # write conversion
|
|
921
|
-
id_value) # id value
|
|
922
|
-
when 'APPEND_ITEM', 'APPEND_ID_ITEM', 'APPEND_ARRAY_ITEM'
|
|
923
|
-
@current_item = @current_packet.append_item(params[0], # name
|
|
924
|
-
Integer(params[1]), # bit size
|
|
925
|
-
params[2].upcase.to_sym, # data_type
|
|
926
|
-
array_size, # array size
|
|
927
|
-
endianness, # endianness
|
|
928
|
-
:ERROR, # overflow
|
|
929
|
-
nil, # format string
|
|
930
|
-
nil, # read conversion
|
|
931
|
-
nil, # write conversion
|
|
932
|
-
id_value) # id value
|
|
933
|
-
end
|
|
934
|
-
when 'PARAMETER', 'ID_PARAMETER', 'ARRAY_PARAMETER'
|
|
935
|
-
raise parser.error("PARAMETER types are only valid with COMMAND", usage) if @current_cmd_or_tlm == 'Telemetry'
|
|
936
|
-
data_type = params[3].upcase.to_sym
|
|
937
|
-
id_value = nil
|
|
938
|
-
if keyword == 'ID_PARAMETER'
|
|
939
|
-
if data_type == :DERIVED
|
|
940
|
-
raise "DERIVED data type not allowed"
|
|
941
|
-
elsif data_type == :STRING or data_type == :BLOCK
|
|
942
|
-
id_value = params[4]
|
|
943
|
-
else
|
|
944
|
-
id_value = params[6]
|
|
945
|
-
end
|
|
946
|
-
end
|
|
947
|
-
array_size = (keyword == 'ARRAY_PARAMETER') ? Integer(params[4]) : nil
|
|
948
|
-
@current_item = @current_packet.define_item(params[0], # name
|
|
949
|
-
Integer(params[1]), # bit offset
|
|
950
|
-
Integer(params[2]), # bit size
|
|
951
|
-
data_type, # data_type
|
|
952
|
-
array_size, # array size
|
|
953
|
-
endianness, # endianness
|
|
954
|
-
:ERROR, # overflow
|
|
955
|
-
nil, # format string
|
|
956
|
-
nil, # read conversion
|
|
957
|
-
nil, # write conversion
|
|
958
|
-
id_value) # id value
|
|
959
|
-
if keyword == 'ARRAY_PARAMETER'
|
|
960
|
-
@current_item.default = []
|
|
961
|
-
else
|
|
962
|
-
if data_type == :STRING or data_type == :BLOCK
|
|
963
|
-
@current_item.default = params[4]
|
|
964
|
-
else
|
|
965
|
-
@current_item.range =
|
|
966
|
-
(ConfigParser.handle_defined_constants(params[4].convert_to_value))..(ConfigParser.handle_defined_constants(params[5].convert_to_value))
|
|
967
|
-
@current_item.default = ConfigParser.handle_defined_constants(params[6].convert_to_value)
|
|
968
|
-
end
|
|
969
|
-
end
|
|
970
|
-
when 'APPEND_PARAMETER', 'APPEND_ID_PARAMETER', 'APPEND_ARRAY_PARAMETER'
|
|
971
|
-
raise parser.error("PARAMETER types are only valid with COMMAND", usage) if @current_cmd_or_tlm == 'Telemetry'
|
|
972
|
-
data_type = params[2].upcase.to_sym
|
|
973
|
-
id_value = nil
|
|
974
|
-
if keyword == 'APPEND_ID_PARAMETER'
|
|
975
|
-
if data_type == :DERIVED
|
|
976
|
-
raise "DERIVED data type not allowed"
|
|
977
|
-
elsif data_type == :STRING or data_type == :BLOCK
|
|
978
|
-
id_value = params[3]
|
|
979
|
-
else
|
|
980
|
-
id_value = params[5]
|
|
981
|
-
end
|
|
982
|
-
end
|
|
983
|
-
array_size = (keyword == 'APPEND_ARRAY_PARAMETER') ? Integer(params[3]) : nil
|
|
984
|
-
@current_item = @current_packet.append_item(params[0], # name
|
|
985
|
-
Integer(params[1]), # bit size
|
|
986
|
-
data_type, # data_type
|
|
987
|
-
array_size, # array size
|
|
988
|
-
endianness, # endianness
|
|
989
|
-
:ERROR, # overflow
|
|
990
|
-
nil, # format string
|
|
991
|
-
nil, # read conversion
|
|
992
|
-
nil, # write conversion
|
|
993
|
-
id_value) # id value
|
|
994
|
-
if keyword == 'APPEND_ARRAY_PARAMETER'
|
|
995
|
-
@current_item.default = []
|
|
996
|
-
else
|
|
997
|
-
if data_type == :STRING or data_type == :BLOCK
|
|
998
|
-
@current_item.default = params[3]
|
|
999
|
-
else
|
|
1000
|
-
@current_item.range =
|
|
1001
|
-
(ConfigParser.handle_defined_constants(params[3].convert_to_value))..(ConfigParser.handle_defined_constants(params[4].convert_to_value))
|
|
1002
|
-
@current_item.default = ConfigParser.handle_defined_constants(params[5].convert_to_value)
|
|
1003
|
-
end
|
|
1004
|
-
end
|
|
1005
|
-
end
|
|
1006
|
-
@current_item.description = params[max_options-2] if params[max_options-2]
|
|
1007
|
-
|
|
1008
|
-
if keyword.include?('APPEND') && @macro_append.building
|
|
1009
|
-
@macro_append.list << params[0].upcase
|
|
1010
|
-
end
|
|
1011
|
-
|
|
1012
|
-
# Rescue the item processing since they could also throw configuration errors
|
|
1013
|
-
rescue => err
|
|
1014
|
-
raise parser.error(err, usage)
|
|
1015
|
-
end
|
|
1016
|
-
end
|
|
1017
|
-
|
|
1018
|
-
# Finish updating item in packet
|
|
1019
|
-
def finish_item
|
|
1020
|
-
if @current_item
|
|
1021
|
-
@current_packet.set_item(@current_item)
|
|
1022
|
-
if @current_cmd_or_tlm == 'Telemetry'
|
|
1023
|
-
target_latest_data = @latest_data[@current_target_name]
|
|
1024
|
-
target_latest_data[@current_item.name] ||= []
|
|
1025
|
-
latest_data_packets = target_latest_data[@current_item.name]
|
|
1026
|
-
latest_data_packets << @current_packet unless latest_data_packets.include?(@current_packet)
|
|
1027
|
-
end
|
|
1028
|
-
@current_item = nil
|
|
1029
|
-
end
|
|
1030
|
-
end
|
|
1031
|
-
|
|
1032
|
-
end # class PacketConfig
|
|
1033
|
-
|
|
1034
|
-
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/config/config_parser'
|
|
12
|
+
require 'cosmos/packets/packet'
|
|
13
|
+
require 'cosmos/conversions'
|
|
14
|
+
require 'cosmos/processors'
|
|
15
|
+
require 'ostruct'
|
|
16
|
+
|
|
17
|
+
module Cosmos
|
|
18
|
+
|
|
19
|
+
class PacketConfig
|
|
20
|
+
# @return [String] The name of this configuration. To be used by higher
|
|
21
|
+
# level classes to store information about the current PacketConfig.
|
|
22
|
+
attr_accessor :name
|
|
23
|
+
|
|
24
|
+
# @return [Hash<String=>Packet>] Hash of all the telemetry packets
|
|
25
|
+
# keyed by the packet name.
|
|
26
|
+
attr_reader :telemetry
|
|
27
|
+
|
|
28
|
+
# @return [Hash<String=>Packet>] Hash of all the command packets
|
|
29
|
+
# keyed by the packet name.
|
|
30
|
+
attr_reader :commands
|
|
31
|
+
|
|
32
|
+
# @return [Hash<String=>Array(String, String, String)>] Hash of all the
|
|
33
|
+
# limits groups keyed by the group name. The value is a three element
|
|
34
|
+
# array consisting of the target_name, packet_name, and item_name.
|
|
35
|
+
attr_reader :limits_groups
|
|
36
|
+
|
|
37
|
+
# @return [Array<Symbol>] The defined limits sets for all items in the
|
|
38
|
+
# packet. This will always include :DEFAULT.
|
|
39
|
+
attr_reader :limits_sets
|
|
40
|
+
|
|
41
|
+
# @return [Array<String>] Array of strings listing all the warnings
|
|
42
|
+
# that were created while parsing the configuration file.
|
|
43
|
+
attr_reader :warnings
|
|
44
|
+
|
|
45
|
+
# @return [Hash<String=>Hash<String=>Array(Packet)>>] Hash of hashes keyed
|
|
46
|
+
# first by the target name and then by the item name. This results in an
|
|
47
|
+
# array of packets containing that target and item. This structure is
|
|
48
|
+
# used to perform lookups when the packet and item are known but the
|
|
49
|
+
# packet is not.
|
|
50
|
+
attr_reader :latest_data
|
|
51
|
+
|
|
52
|
+
def initialize
|
|
53
|
+
@name = nil
|
|
54
|
+
@telemetry = {}
|
|
55
|
+
@commands = {}
|
|
56
|
+
@limits_groups = {}
|
|
57
|
+
@limits_sets = [:DEFAULT]
|
|
58
|
+
# Hash of Hashes. First index by target name and then item name.
|
|
59
|
+
# Returns an array of packets with that target and item.
|
|
60
|
+
@latest_data = {}
|
|
61
|
+
@warnings = []
|
|
62
|
+
|
|
63
|
+
# Create unknown packets
|
|
64
|
+
@commands['UNKNOWN']
|
|
65
|
+
@commands['UNKNOWN'] = {}
|
|
66
|
+
@commands['UNKNOWN']['UNKNOWN'] = Packet.new('UNKNOWN', 'UNKNOWN', :BIG_ENDIAN)
|
|
67
|
+
@telemetry['UNKNOWN']
|
|
68
|
+
@telemetry['UNKNOWN'] = {}
|
|
69
|
+
@telemetry['UNKNOWN']['UNKNOWN'] = Packet.new('UNKNOWN', 'UNKNOWN', :BIG_ENDIAN)
|
|
70
|
+
|
|
71
|
+
# Used during packet processing
|
|
72
|
+
@current_target_name = nil
|
|
73
|
+
@current_packet_name = nil
|
|
74
|
+
@current_cmd_or_tlm = nil
|
|
75
|
+
@current_packet = nil
|
|
76
|
+
@current_item = nil
|
|
77
|
+
@current_limits_group = nil
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
#########################################################################
|
|
81
|
+
# The following methods process a command or telemetry packet config file
|
|
82
|
+
#########################################################################
|
|
83
|
+
|
|
84
|
+
# Processes a COSMOS configuration file and uses the keywords to build up
|
|
85
|
+
# knowledge of the commands, telemetry, and limits groups.
|
|
86
|
+
#
|
|
87
|
+
# @param filename [String] The name of the configuration file
|
|
88
|
+
# @param target_name [String] The target name
|
|
89
|
+
def process_file(filename, target_name)
|
|
90
|
+
@converted_type = nil
|
|
91
|
+
@converted_bit_size = nil
|
|
92
|
+
@proc_text = ''
|
|
93
|
+
@building_generic_conversion = false
|
|
94
|
+
@macro_append = OpenStruct.new
|
|
95
|
+
@macro_append.building = false
|
|
96
|
+
@macro_append.list = []
|
|
97
|
+
@macro_append.indices = []
|
|
98
|
+
@macro_append.format = ''
|
|
99
|
+
@macro_append.format_order = ''
|
|
100
|
+
|
|
101
|
+
target_name = target_name.upcase
|
|
102
|
+
|
|
103
|
+
parser = ConfigParser.new("https://github.com/BallAerospace/COSMOS/wiki/Command-and-Telemetry-Configuration")
|
|
104
|
+
parser.parse_file(filename) do |keyword, params|
|
|
105
|
+
|
|
106
|
+
if @building_generic_conversion
|
|
107
|
+
case keyword
|
|
108
|
+
# Complete a generic conversion
|
|
109
|
+
when 'GENERIC_READ_CONVERSION_END', 'GENERIC_WRITE_CONVERSION_END'
|
|
110
|
+
parser.verify_num_parameters(0, 0, keyword)
|
|
111
|
+
@current_item.read_conversion =
|
|
112
|
+
GenericConversion.new(@proc_text,
|
|
113
|
+
@converted_type,
|
|
114
|
+
@converted_bit_size) if keyword.include? "READ"
|
|
115
|
+
@current_item.write_conversion =
|
|
116
|
+
GenericConversion.new(@proc_text,
|
|
117
|
+
@converted_type,
|
|
118
|
+
@converted_bit_size) if keyword.include? "WRITE"
|
|
119
|
+
@building_generic_conversion = false
|
|
120
|
+
# Add the current config.line to the conversion being built
|
|
121
|
+
else
|
|
122
|
+
@proc_text << parser.line << "\n"
|
|
123
|
+
end # case keyword
|
|
124
|
+
|
|
125
|
+
else # not building generic conversion
|
|
126
|
+
|
|
127
|
+
case keyword
|
|
128
|
+
|
|
129
|
+
# Start a new packet
|
|
130
|
+
when 'COMMAND', 'TELEMETRY'
|
|
131
|
+
process_packet(parser, keyword, params, target_name)
|
|
132
|
+
|
|
133
|
+
# Select an existing packet for editing
|
|
134
|
+
when 'SELECT_COMMAND', 'SELECT_TELEMETRY'
|
|
135
|
+
usage = "#{keyword} <TARGET NAME> <PACKET NAME>"
|
|
136
|
+
finish_packet()
|
|
137
|
+
parser.verify_num_parameters(2, 2, usage)
|
|
138
|
+
@current_target_name = target_name
|
|
139
|
+
@current_target_name = params[0].upcase if target_name == 'SYSTEM'
|
|
140
|
+
@current_packet_name = params[1].upcase
|
|
141
|
+
|
|
142
|
+
@current_packet = nil
|
|
143
|
+
if keyword.include?('COMMAND')
|
|
144
|
+
@current_cmd_or_tlm = 'Command'
|
|
145
|
+
if @commands[@current_target_name]
|
|
146
|
+
@current_packet = @commands[@current_target_name][@current_packet_name]
|
|
147
|
+
end
|
|
148
|
+
else
|
|
149
|
+
@current_cmd_or_tlm = 'Telemetry'
|
|
150
|
+
if @telemetry[@current_target_name]
|
|
151
|
+
@current_packet = @telemetry[@current_target_name][@current_packet_name]
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
raise parser.error("Packet not found", usage) unless @current_packet
|
|
155
|
+
|
|
156
|
+
# Start the creation of a new limits group
|
|
157
|
+
when 'LIMITS_GROUP'
|
|
158
|
+
usage = "LIMITS_GROUP <GROUP NAME>"
|
|
159
|
+
parser.verify_num_parameters(1, 1, usage)
|
|
160
|
+
@current_limits_group = params[0].to_s.upcase
|
|
161
|
+
@limits_groups[@current_limits_group] = [] unless @limits_groups.include?(@current_limits_group)
|
|
162
|
+
|
|
163
|
+
# Add a telemetry item to the limits group
|
|
164
|
+
when 'LIMITS_GROUP_ITEM'
|
|
165
|
+
usage = "LIMITS_GROUP_ITEM <TARGET NAME> <PACKET NAME> <ITEM NAME>"
|
|
166
|
+
parser.verify_num_parameters(3, 3, usage)
|
|
167
|
+
@limits_groups[@current_limits_group] << [params[0].to_s.upcase, params[1].to_s.upcase, params[2].to_s.upcase] if @current_limits_group
|
|
168
|
+
|
|
169
|
+
#######################################################################
|
|
170
|
+
# All the following keywords must have a current packet defined
|
|
171
|
+
#######################################################################
|
|
172
|
+
when 'SELECT_ITEM', 'SELECT_PARAMETER', 'ITEM', 'PARAMETER', 'ID_ITEM', 'ID_PARAMETER', 'ARRAY_ITEM', 'ARRAY_PARAMETER', 'APPEND_ITEM', 'APPEND_PARAMETER', 'APPEND_ID_ITEM', 'APPEND_ID_PARAMETER', 'APPEND_ARRAY_ITEM', 'APPEND_ARRAY_PARAMETER', 'MACRO_APPEND_START', 'MACRO_APPEND_END', 'ALLOW_SHORT', 'HAZARDOUS', 'PROCESSOR', 'META', 'DISABLE_MESSAGES', 'HIDDEN', 'DISABLED'
|
|
173
|
+
raise parser.error("No current packet for #{keyword}") unless @current_packet
|
|
174
|
+
process_current_packet(parser, keyword, params)
|
|
175
|
+
|
|
176
|
+
#######################################################################
|
|
177
|
+
# All the following keywords must have a current item defined
|
|
178
|
+
#######################################################################
|
|
179
|
+
when 'STATE', 'READ_CONVERSION', 'WRITE_CONVERSION', 'POLY_READ_CONVERSION', 'POLY_WRITE_CONVERSION', 'SEG_POLY_READ_CONVERSION', 'SEG_POLY_WRITE_CONVERSION', 'GENERIC_READ_CONVERSION_START', 'GENERIC_WRITE_CONVERSION_START', 'REQUIRED', 'LIMITS', 'LIMITS_RESPONSE', 'UNITS', 'FORMAT_STRING', 'DESCRIPTION', 'MINIMUM_VALUE', 'MAXIMUM_VALUE', 'DEFAULT_VALUE', 'OVERFLOW'
|
|
180
|
+
raise parser.error("No current item for #{keyword}") unless @current_item
|
|
181
|
+
process_current_item(parser, keyword, params)
|
|
182
|
+
|
|
183
|
+
else
|
|
184
|
+
# blank config.lines will have a nil keyword and should not raise an exception
|
|
185
|
+
raise parser.error("Unknown keyword '#{keyword}'") if keyword
|
|
186
|
+
end # case keyword
|
|
187
|
+
|
|
188
|
+
end # if building_generic_conversion
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Complete the last defined packet
|
|
192
|
+
finish_packet()
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
protected
|
|
196
|
+
|
|
197
|
+
def process_current_packet(parser, keyword, params)
|
|
198
|
+
case keyword
|
|
199
|
+
|
|
200
|
+
# Select an item in the current telemetry packet for editing
|
|
201
|
+
when 'SELECT_PARAMETER', 'SELECT_ITEM'
|
|
202
|
+
if (@current_cmd_or_tlm == 'Command') && (keyword.split('_')[1] == 'ITEM')
|
|
203
|
+
raise parser.error("SELECT_ITEM only applies to telemetry packets")
|
|
204
|
+
end
|
|
205
|
+
if (@current_cmd_or_tlm == 'Telemetry') && (keyword.split('_')[1] == 'PARAMETER')
|
|
206
|
+
raise parser.error("SELECT_PARAMETER only applies to command packets")
|
|
207
|
+
end
|
|
208
|
+
usage = "#{keyword} <#{keyword.split('_')[1]} NAME>"
|
|
209
|
+
finish_item()
|
|
210
|
+
parser.verify_num_parameters(1, 1, usage)
|
|
211
|
+
begin
|
|
212
|
+
@current_item = @current_packet.get_item(params[0])
|
|
213
|
+
rescue # Rescue the default execption to provide a nicer error message
|
|
214
|
+
raise parser.error("#{params[0]} not found in #{@current_cmd_or_tlm.downcase} packet #{@current_target_name} #{@current_packet_name}", usage)
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Start a new telemetry item in the current packet
|
|
218
|
+
when 'ITEM', 'PARAMETER', 'ID_ITEM', 'ID_PARAMETER', 'ARRAY_ITEM', 'ARRAY_PARAMETER', 'APPEND_ITEM', 'APPEND_PARAMETER', 'APPEND_ID_ITEM', 'APPEND_ID_PARAMETER', 'APPEND_ARRAY_ITEM', 'APPEND_ARRAY_PARAMETER'
|
|
219
|
+
start_item(parser, keyword, params)
|
|
220
|
+
|
|
221
|
+
# Start the creation of a macro-expanded list of items
|
|
222
|
+
# This simulates an array of structures of multiple items in the packet by repeating
|
|
223
|
+
# each item in the list multiple times with a different "index" added to the name.
|
|
224
|
+
when 'MACRO_APPEND_START'
|
|
225
|
+
process_macro_append_start(parser, keyword, params)
|
|
226
|
+
|
|
227
|
+
# End the creation of a macro-expanded list of items
|
|
228
|
+
when 'MACRO_APPEND_END'
|
|
229
|
+
process_macro_append_end(parser, keyword) # no params for END
|
|
230
|
+
|
|
231
|
+
# Allow this packet to be received with less data than the defined length
|
|
232
|
+
# without generating a warning.
|
|
233
|
+
when 'ALLOW_SHORT'
|
|
234
|
+
@current_packet.short_buffer_allowed = true
|
|
235
|
+
|
|
236
|
+
# Mark the current command as hazardous
|
|
237
|
+
when 'HAZARDOUS'
|
|
238
|
+
usage = "HAZARDOUS <HAZARDOUS DESCRIPTION (Optional)>"
|
|
239
|
+
parser.verify_num_parameters(0, 1, usage)
|
|
240
|
+
@current_packet.hazardous = true
|
|
241
|
+
@current_packet.hazardous_description = params[0] if params[0]
|
|
242
|
+
|
|
243
|
+
# Define a processor class that will be called once when a packet is received
|
|
244
|
+
when 'PROCESSOR'
|
|
245
|
+
process_processor(parser, keyword, params)
|
|
246
|
+
|
|
247
|
+
when 'DISABLE_MESSAGES'
|
|
248
|
+
usage = "#{keyword}"
|
|
249
|
+
parser.verify_num_parameters(0, 0, usage)
|
|
250
|
+
@current_packet.messages_disabled = true
|
|
251
|
+
|
|
252
|
+
# Store user defined metadata for the packet or a packet item
|
|
253
|
+
when 'META'
|
|
254
|
+
usage = "META <META NAME> <META VALUES (optional)>"
|
|
255
|
+
parser.verify_num_parameters(1, nil, usage)
|
|
256
|
+
if params.length > 1
|
|
257
|
+
meta_values = params[1..-1]
|
|
258
|
+
else
|
|
259
|
+
meta_values = []
|
|
260
|
+
end
|
|
261
|
+
if @current_item
|
|
262
|
+
# Item META
|
|
263
|
+
@current_item.meta[params[0].to_s.upcase] = meta_values
|
|
264
|
+
else
|
|
265
|
+
# Packet META
|
|
266
|
+
@current_packet.meta[params[0].to_s.upcase] = meta_values
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
when 'HIDDEN'
|
|
270
|
+
usage = "#{keyword}"
|
|
271
|
+
parser.verify_num_parameters(0, 0, usage)
|
|
272
|
+
@current_packet.hidden = true
|
|
273
|
+
|
|
274
|
+
when 'DISABLED'
|
|
275
|
+
usage = "#{keyword}"
|
|
276
|
+
parser.verify_num_parameters(0, 0, usage)
|
|
277
|
+
@current_packet.hidden = true
|
|
278
|
+
@current_packet.disabled = true
|
|
279
|
+
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
def process_current_item(parser, keyword, params)
|
|
284
|
+
case keyword
|
|
285
|
+
|
|
286
|
+
# Add a state to the current telemety item
|
|
287
|
+
when 'STATE'
|
|
288
|
+
process_state(parser, keyword, params)
|
|
289
|
+
|
|
290
|
+
# Apply a conversion to the current item after it is read to or
|
|
291
|
+
# written from the packet
|
|
292
|
+
when 'READ_CONVERSION', 'WRITE_CONVERSION'
|
|
293
|
+
usage = "#{keyword} <conversion class filename> <custom parameters> ..."
|
|
294
|
+
parser.verify_num_parameters(1, nil, usage)
|
|
295
|
+
begin
|
|
296
|
+
# require should be performed in target.txt
|
|
297
|
+
klass = params[0].filename_to_class_name.to_class
|
|
298
|
+
raise parser.error("#{params[0].filename_to_class_name} class not found. Did you require the file in target.txt?", usage) unless klass
|
|
299
|
+
@current_item.send("#{keyword.downcase}=".to_sym,
|
|
300
|
+
klass.new(*params[1..(params.length - 1)]))
|
|
301
|
+
rescue Exception => err
|
|
302
|
+
raise parser.error(err)
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# Apply a polynomial conversion to the current item
|
|
306
|
+
when 'POLY_READ_CONVERSION', 'POLY_WRITE_CONVERSION'
|
|
307
|
+
usage = "#{keyword} <C0> <C1> <C2> ..."
|
|
308
|
+
parser.verify_num_parameters(1, nil, usage)
|
|
309
|
+
@current_item.read_conversion = PolynomialConversion.new(params) if keyword.include? "READ"
|
|
310
|
+
@current_item.write_conversion = PolynomialConversion.new(params) if keyword.include? "WRITE"
|
|
311
|
+
|
|
312
|
+
# Apply a segmented polynomial conversion to the current item
|
|
313
|
+
# after it is read from the telemetry packet
|
|
314
|
+
when 'SEG_POLY_READ_CONVERSION'
|
|
315
|
+
usage = "SEG_POLY_READ_CONVERSION <Lower Bound> <C0> <C1> <C2> ..."
|
|
316
|
+
parser.verify_num_parameters(2, nil, usage)
|
|
317
|
+
if !(@current_item.read_conversion &&
|
|
318
|
+
SegmentedPolynomialConversion === @current_item.read_conversion)
|
|
319
|
+
@current_item.read_conversion = SegmentedPolynomialConversion.new
|
|
320
|
+
end
|
|
321
|
+
@current_item.read_conversion.add_segment(params[0].to_f, *params[1..-1])
|
|
322
|
+
|
|
323
|
+
# Apply a segmented polynomial conversion to the current item
|
|
324
|
+
# before it is written to the telemetry packet
|
|
325
|
+
when 'SEG_POLY_WRITE_CONVERSION'
|
|
326
|
+
usage = "SEG_POLY_WRITE_CONVERSION <Lower Bound> <C0> <C1> <C2> ..."
|
|
327
|
+
parser.verify_num_parameters(2, nil, usage)
|
|
328
|
+
if !(@current_item.write_conversion &&
|
|
329
|
+
SegmentedPolynomialConversion === @current_item.write_conversion)
|
|
330
|
+
@current_item.write_conversion = SegmentedPolynomialConversion.new
|
|
331
|
+
end
|
|
332
|
+
@current_item.write_conversion.add_segment(params[0].to_f, *params[1..-1])
|
|
333
|
+
|
|
334
|
+
# Start the definition of a generic conversion.
|
|
335
|
+
# All config.lines following this config.line are considered part
|
|
336
|
+
# of the conversion until an end of conversion marker is found
|
|
337
|
+
when 'GENERIC_READ_CONVERSION_START', 'GENERIC_WRITE_CONVERSION_START'
|
|
338
|
+
usage = "#{keyword} <Converted Type (optional)> <Converted Bit Size (optional)>"
|
|
339
|
+
parser.verify_num_parameters(0, 2, usage)
|
|
340
|
+
@proc_text = ''
|
|
341
|
+
@building_generic_conversion = true
|
|
342
|
+
@converted_type = nil
|
|
343
|
+
@converted_bit_size = nil
|
|
344
|
+
if params[0]
|
|
345
|
+
@converted_type = params[0].upcase.intern
|
|
346
|
+
raise parser.error("Invalid converted_type: #{@converted_type}.") unless [:INT, :UINT, :FLOAT, :STRING, :BLOCK].include? @converted_type
|
|
347
|
+
end
|
|
348
|
+
@converted_bit_size = Integer(params[1]) if params[1]
|
|
349
|
+
|
|
350
|
+
# Define a set of limits for the current telemetry item
|
|
351
|
+
when 'LIMITS'
|
|
352
|
+
process_limits(parser, keyword, params)
|
|
353
|
+
|
|
354
|
+
# Define a response class that will be called when the limits state of the
|
|
355
|
+
# current item changes.
|
|
356
|
+
when 'LIMITS_RESPONSE'
|
|
357
|
+
process_limits_response(parser, keyword, params)
|
|
358
|
+
|
|
359
|
+
# Define a printf style formatting string for the current telemetry item
|
|
360
|
+
when 'FORMAT_STRING'
|
|
361
|
+
process_format_string(parser, keyword, params)
|
|
362
|
+
|
|
363
|
+
# Define the units of the current telemetry item
|
|
364
|
+
when 'UNITS'
|
|
365
|
+
usage = "UNITS <FULL UNITS NAME> <ABBREVIATED UNITS NAME>"
|
|
366
|
+
parser.verify_num_parameters(2, 2, usage)
|
|
367
|
+
@current_item.units_full = params[0]
|
|
368
|
+
@current_item.units = params[1]
|
|
369
|
+
|
|
370
|
+
# Update the description for the current telemetry item
|
|
371
|
+
when 'DESCRIPTION'
|
|
372
|
+
usage = "DESCRIPTION <DESCRIPTION>"
|
|
373
|
+
parser.verify_num_parameters(1, 1, usage)
|
|
374
|
+
@current_item.description = params[0]
|
|
375
|
+
|
|
376
|
+
# Mark the current command parameter as required.
|
|
377
|
+
# This means it must be given a value and not just use its default.
|
|
378
|
+
when 'REQUIRED'
|
|
379
|
+
usage = "REQUIRED"
|
|
380
|
+
parser.verify_num_parameters(0, 0, usage)
|
|
381
|
+
if @current_cmd_or_tlm == 'Command'
|
|
382
|
+
@current_item.required = true
|
|
383
|
+
else
|
|
384
|
+
raise parser.error("#{keyword} only applies to command parameters")
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
# Update the mimimum value for the current command parameter
|
|
388
|
+
when 'MINIMUM_VALUE'
|
|
389
|
+
if @current_cmd_or_tlm == 'Telemetry'
|
|
390
|
+
raise parser.error("#{keyword} only applies to command parameters")
|
|
391
|
+
end
|
|
392
|
+
usage = "MINIMUM_VALUE <MINIMUM VALUE>"
|
|
393
|
+
parser.verify_num_parameters(1, 1, usage)
|
|
394
|
+
@current_item.range =
|
|
395
|
+
Range.new(ConfigParser.handle_defined_constants(
|
|
396
|
+
params[0].convert_to_value), @current_item.range.end)
|
|
397
|
+
|
|
398
|
+
# Update the maximum value for the current command parameter
|
|
399
|
+
when 'MAXIMUM_VALUE'
|
|
400
|
+
if @current_cmd_or_tlm == 'Telemetry'
|
|
401
|
+
raise parser.error("#{keyword} only applies to command parameters")
|
|
402
|
+
end
|
|
403
|
+
usage = "MAXIMUM_VALUE <MAXIMUM VALUE>"
|
|
404
|
+
parser.verify_num_parameters(1, 1, usage)
|
|
405
|
+
@current_item.range =
|
|
406
|
+
Range.new(@current_item.range.begin,
|
|
407
|
+
ConfigParser.handle_defined_constants(params[0].convert_to_value))
|
|
408
|
+
|
|
409
|
+
# Update the default value for the current command parameter
|
|
410
|
+
when 'DEFAULT_VALUE'
|
|
411
|
+
if @current_cmd_or_tlm == 'Telemetry'
|
|
412
|
+
raise parser.error("#{keyword} only applies to command parameters")
|
|
413
|
+
end
|
|
414
|
+
usage = "DEFAULT_VALUE <DEFAULT VALUE>"
|
|
415
|
+
parser.verify_num_parameters(1, 1, usage)
|
|
416
|
+
if ((@current_item.data_type == :STRING) ||
|
|
417
|
+
(@current_item.data_type == :BLOCK))
|
|
418
|
+
@current_item.default = params[0]
|
|
419
|
+
else
|
|
420
|
+
@current_item.default =
|
|
421
|
+
ConfigParser.handle_defined_constants(params[0].convert_to_value)
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
# Update the overflow type for the current command parameter
|
|
425
|
+
when 'OVERFLOW'
|
|
426
|
+
usage = "OVERFLOW <OVERFLOW VALUE - ERROR, ERROR_ALLOW_HEX, TRUNCATE, or SATURATE>"
|
|
427
|
+
parser.verify_num_parameters(1, 1, usage)
|
|
428
|
+
@current_item.overflow = params[0].to_s.upcase.intern
|
|
429
|
+
|
|
430
|
+
end
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
####################################################
|
|
434
|
+
# The following methods process a particular keyword
|
|
435
|
+
|
|
436
|
+
def process_macro_append_start(parser, keyword, params)
|
|
437
|
+
@macro_append.building = true
|
|
438
|
+
|
|
439
|
+
usage = '#{keyword} <FIRST INDEX> <LAST INDEX> [NAME FORMAT]'
|
|
440
|
+
parser.verify_num_parameters(2, 3, usage)
|
|
441
|
+
|
|
442
|
+
# Store the params
|
|
443
|
+
first_index = params[0].to_i
|
|
444
|
+
last_index = params[1].to_i
|
|
445
|
+
@macro_append.indices = [first_index, last_index].sort
|
|
446
|
+
@macro_append.indices = (@macro_append.indices[0]..@macro_append.indices[1]).to_a
|
|
447
|
+
@macro_append.indices.reverse! if first_index > last_index
|
|
448
|
+
@macro_append.format = params[2] ? params[2] : '%s%d'
|
|
449
|
+
spos = @macro_append.format.index(/%\d*s/)
|
|
450
|
+
dpos = @macro_append.format.index(/%\d*d/)
|
|
451
|
+
raise parser.error("Invalid NAME FORMAT (#{@macro_append.format}) for MACRO_APPEND_START", usage) unless spos and dpos
|
|
452
|
+
if spos < dpos
|
|
453
|
+
@macro_append.format_order = 'sd'
|
|
454
|
+
else
|
|
455
|
+
@macro_append.format_order = 'ds'
|
|
456
|
+
end
|
|
457
|
+
end
|
|
458
|
+
|
|
459
|
+
def process_macro_append_end(parser, keyword)
|
|
460
|
+
update_cache = false
|
|
461
|
+
finish_item()
|
|
462
|
+
parser.verify_num_parameters(0, 0, keyword)
|
|
463
|
+
raise parser.error("Missing MACRO_APPEND_START before this config.line.", keyword) unless @macro_append.building
|
|
464
|
+
raise parser.error("No items appended in MACRO_APPEND list", keyword) unless @macro_append.list.length > 0
|
|
465
|
+
|
|
466
|
+
# Get first index, remove from array
|
|
467
|
+
first = @macro_append.indices.shift
|
|
468
|
+
|
|
469
|
+
# Rename the items in the list using the first index
|
|
470
|
+
items = @current_packet.items
|
|
471
|
+
@macro_append.list.each do |name|
|
|
472
|
+
item = items[name]
|
|
473
|
+
items.delete name
|
|
474
|
+
if @macro_append.format_order == 'sd'
|
|
475
|
+
first_name = sprintf(@macro_append.format, name, first)
|
|
476
|
+
else
|
|
477
|
+
first_name = sprintf(@macro_append.format, first, name)
|
|
478
|
+
end
|
|
479
|
+
item.name = first_name
|
|
480
|
+
items[first_name] = item
|
|
481
|
+
end
|
|
482
|
+
|
|
483
|
+
# Append multiple copies of the items in the list
|
|
484
|
+
@macro_append.indices.each do |index|
|
|
485
|
+
@macro_append.list.each do |name|
|
|
486
|
+
if @macro_append.format_order == 'sd'
|
|
487
|
+
first_name = sprintf(@macro_append.format, name, first)
|
|
488
|
+
this_name = sprintf(@macro_append.format, name, index)
|
|
489
|
+
else
|
|
490
|
+
first_name = sprintf(@macro_append.format, first, name)
|
|
491
|
+
this_name = sprintf(@macro_append.format, index, name)
|
|
492
|
+
end
|
|
493
|
+
first_item = items[first_name]
|
|
494
|
+
format_string = nil
|
|
495
|
+
format_string = first_item.format_string if first_item.format_string
|
|
496
|
+
this_item = @current_packet.append_item(this_name,
|
|
497
|
+
first_item.bit_size,
|
|
498
|
+
first_item.data_type,
|
|
499
|
+
first_item.array_size,
|
|
500
|
+
first_item.endianness,
|
|
501
|
+
first_item.overflow,
|
|
502
|
+
format_string,
|
|
503
|
+
first_item.read_conversion,
|
|
504
|
+
first_item.write_conversion,
|
|
505
|
+
first_item.id_value)
|
|
506
|
+
this_item.states = first_item.states if first_item.states
|
|
507
|
+
this_item.description = first_item.description if first_item.description
|
|
508
|
+
this_item.units_full = first_item.units_full if first_item.units_full
|
|
509
|
+
this_item.units = first_item.units if first_item.units
|
|
510
|
+
this_item.default = first_item.default
|
|
511
|
+
this_item.range = first_item.range if first_item.range
|
|
512
|
+
this_item.required = first_item.required
|
|
513
|
+
this_item.hazardous = first_item.hazardous
|
|
514
|
+
if first_item.state_colors
|
|
515
|
+
this_item.state_colors = first_item.state_colors
|
|
516
|
+
update_cache = true
|
|
517
|
+
end
|
|
518
|
+
if first_item.limits
|
|
519
|
+
this_item.limits = first_item.limits
|
|
520
|
+
update_cache = true
|
|
521
|
+
end
|
|
522
|
+
end
|
|
523
|
+
end
|
|
524
|
+
@current_packet.update_limits_items_cache if update_cache
|
|
525
|
+
|
|
526
|
+
@macro_append.building = false
|
|
527
|
+
@macro_append.indices = []
|
|
528
|
+
@macro_append.list = []
|
|
529
|
+
end
|
|
530
|
+
|
|
531
|
+
def process_state(parser, keyword, params)
|
|
532
|
+
if @current_cmd_or_tlm == 'Command'
|
|
533
|
+
usage = "#{keyword} <STATE NAME> <STATE VALUE> <HAZARDOUS (Optional)> <Hazardous Description (Optional)>"
|
|
534
|
+
parser.verify_num_parameters(2, 4, usage)
|
|
535
|
+
else
|
|
536
|
+
usage = "#{keyword} <STATE NAME> <STATE VALUE> <COLOR: GREEN/YELLOW/RED (Optional)>"
|
|
537
|
+
parser.verify_num_parameters(2, 3, usage)
|
|
538
|
+
end
|
|
539
|
+
@current_item.states ||= {}
|
|
540
|
+
if @current_item.states[params[0].upcase]
|
|
541
|
+
msg = "Duplicate state defined on line #{parser.line_number}: #{parser.line}"
|
|
542
|
+
Logger.instance.warn(msg)
|
|
543
|
+
@warnings << msg
|
|
544
|
+
end
|
|
545
|
+
if @current_item.data_type == :STRING or @current_item.data_type == :BLOCK
|
|
546
|
+
@current_item.states[params[0].upcase] = params[1]
|
|
547
|
+
else
|
|
548
|
+
@current_item.states[params[0].upcase] = params[1].convert_to_value
|
|
549
|
+
end
|
|
550
|
+
if params[2]
|
|
551
|
+
if @current_cmd_or_tlm == 'Command'
|
|
552
|
+
if params[2].upcase == 'HAZARDOUS'
|
|
553
|
+
@current_item.hazardous ||= {}
|
|
554
|
+
if params[3]
|
|
555
|
+
@current_item.hazardous[params[0].upcase] = params[3]
|
|
556
|
+
else
|
|
557
|
+
@current_item.hazardous[params[0].upcase] = ""
|
|
558
|
+
end
|
|
559
|
+
else
|
|
560
|
+
raise parser.error("HAZARDOUS expected as third parameter for this line.", usage)
|
|
561
|
+
end
|
|
562
|
+
else
|
|
563
|
+
if params[2]
|
|
564
|
+
color = params[2].upcase.to_sym
|
|
565
|
+
unless PacketItem::STATE_COLORS.include? color
|
|
566
|
+
raise parser.error("Invalid state color #{color}. Must be one of #{PacketItem::STATE_COLORS.join(' ')}.", usage)
|
|
567
|
+
end
|
|
568
|
+
@current_item.limits ||= Limits.new
|
|
569
|
+
@current_item.limits.enabled = true
|
|
570
|
+
@current_item.state_colors ||= {}
|
|
571
|
+
@current_item.state_colors[params[0].upcase] = color
|
|
572
|
+
@current_packet.update_limits_items_cache
|
|
573
|
+
end
|
|
574
|
+
end
|
|
575
|
+
end
|
|
576
|
+
end
|
|
577
|
+
|
|
578
|
+
def process_limits(parser, keyword, params)
|
|
579
|
+
if @current_cmd_or_tlm == 'Command'
|
|
580
|
+
raise parser.error("#{keyword} only applies to telemetry items")
|
|
581
|
+
end
|
|
582
|
+
usage = "#{keyword} <LIMITS SET> <PERSISTENCE> <ENABLED/DISABLED> <RED LOW LIMIT> <YELLOW LOW LIMIT> <YELLOW HIGH LIMIT> <RED HIGH LIMIT> <GREEN LOW LIMIT (Optional)> <GREEN HIGH LIMIT (Optional)>"
|
|
583
|
+
parser.verify_num_parameters(7, 9, usage)
|
|
584
|
+
|
|
585
|
+
begin
|
|
586
|
+
persistence = Integer(params[1])
|
|
587
|
+
red_low = Float(params[3])
|
|
588
|
+
yellow_low = Float(params[4])
|
|
589
|
+
yellow_high = Float(params[5])
|
|
590
|
+
red_high = Float(params[6])
|
|
591
|
+
rescue
|
|
592
|
+
raise parser.error("Invalid persistence or limits values. Ensure persistence is an integer. Limits can be integers or floats.", usage)
|
|
593
|
+
end
|
|
594
|
+
|
|
595
|
+
enabled = params[2].upcase
|
|
596
|
+
if enabled != 'ENABLED' and enabled != 'DISABLED'
|
|
597
|
+
raise parser.error("Initial state must be ENABLED or DISABLED.", usage)
|
|
598
|
+
end
|
|
599
|
+
|
|
600
|
+
# Verify valid limits are specified
|
|
601
|
+
if (red_low > yellow_low) or (yellow_low >= yellow_high) or (yellow_high > red_high)
|
|
602
|
+
raise parser.error("Invalid limits specified. Ensure yellow limits are within red limits.", usage)
|
|
603
|
+
end
|
|
604
|
+
if params.length != 7
|
|
605
|
+
begin
|
|
606
|
+
green_low = Float(params[7])
|
|
607
|
+
green_high = Float(params[8])
|
|
608
|
+
rescue
|
|
609
|
+
raise parser.error("Invalid green limits values. Limits can be integers or floats.", usage)
|
|
610
|
+
end
|
|
611
|
+
|
|
612
|
+
if (yellow_low > green_low) or (green_low >= green_high) or (green_high > yellow_high)
|
|
613
|
+
raise parser.error("Invalid limits specified. Ensure green limits are within yellow limits.", usage)
|
|
614
|
+
end
|
|
615
|
+
end
|
|
616
|
+
|
|
617
|
+
limits_set = params[0].upcase.to_sym
|
|
618
|
+
@limits_sets << limits_set
|
|
619
|
+
@limits_sets.uniq!
|
|
620
|
+
# Initialize the limits values. Values must be initialized with a :DEFAULT key
|
|
621
|
+
if !@current_item.limits.values
|
|
622
|
+
if limits_set == :DEFAULT
|
|
623
|
+
@current_item.limits.values = {:DEFAULT => []}
|
|
624
|
+
else
|
|
625
|
+
raise parser.error("DEFAULT limits must be defined for #{@current_packet.target_name} #{@current_packet.packet_name} #{@current_item.name} before setting limits set #{limits_set}")
|
|
626
|
+
end
|
|
627
|
+
end
|
|
628
|
+
if limits_set != :DEFAULT
|
|
629
|
+
msg = nil
|
|
630
|
+
if (enabled == 'ENABLED' and @current_item.limits.enabled != true) or (enabled != 'ENABLED' and @current_item.limits.enabled != false)
|
|
631
|
+
msg = "#{@current_cmd_or_tlm} Item #{@current_target_name} #{@current_packet_name} #{@current_item.name} #{limits_set} limits enable setting conflict with DEFAULT"
|
|
632
|
+
end
|
|
633
|
+
if @current_item.limits.persistence_setting != persistence
|
|
634
|
+
msg = "#{@current_cmd_or_tlm} Item #{@current_target_name} #{@current_packet_name} #{@current_item.name} #{limits_set} limits persistence setting conflict with DEFAULT"
|
|
635
|
+
end
|
|
636
|
+
if msg
|
|
637
|
+
Logger.instance.warn msg
|
|
638
|
+
@warnings << msg
|
|
639
|
+
end
|
|
640
|
+
end
|
|
641
|
+
@current_item.limits.enabled = true if enabled == 'ENABLED'
|
|
642
|
+
values = @current_item.limits.values
|
|
643
|
+
if params.length == 7
|
|
644
|
+
values[limits_set] = [red_low, yellow_low, yellow_high, red_high]
|
|
645
|
+
else
|
|
646
|
+
values[limits_set] = [red_low, yellow_low, yellow_high, red_high, green_low, green_high]
|
|
647
|
+
end
|
|
648
|
+
@current_item.limits.values = values
|
|
649
|
+
@current_item.limits.persistence_setting = persistence
|
|
650
|
+
@current_item.limits.persistence_count = 0
|
|
651
|
+
@current_packet.update_limits_items_cache
|
|
652
|
+
end
|
|
653
|
+
|
|
654
|
+
def process_limits_response(parser, keyword, params)
|
|
655
|
+
if @current_cmd_or_tlm == 'Command'
|
|
656
|
+
raise parser.error("#{keyword} only applies to telemetry items")
|
|
657
|
+
end
|
|
658
|
+
usage = "#{keyword} <RESPONSE CLASS FILENAME> <RESPONSE SPECIFIC OPTIONS>"
|
|
659
|
+
parser.verify_num_parameters(1, nil, usage)
|
|
660
|
+
|
|
661
|
+
begin
|
|
662
|
+
# require should be performed in target.txt
|
|
663
|
+
klass = params[0].filename_to_class_name.to_class
|
|
664
|
+
raise parser.error("#{params[0].filename_to_class_name} class not found. Did you require the file in target.txt?", usage) unless klass
|
|
665
|
+
if params[1]
|
|
666
|
+
@current_item.limits.response = klass.new(*params[1..(params.length - 1)])
|
|
667
|
+
else
|
|
668
|
+
@current_item.limits.response = klass.new
|
|
669
|
+
end
|
|
670
|
+
rescue Exception => err
|
|
671
|
+
raise parser.error(err, usage)
|
|
672
|
+
end
|
|
673
|
+
end
|
|
674
|
+
|
|
675
|
+
def process_processor(parser, keyword, params)
|
|
676
|
+
if @current_cmd_or_tlm == 'Command'
|
|
677
|
+
raise parser.error("#{keyword} only applies to telemetry packets")
|
|
678
|
+
end
|
|
679
|
+
usage = "#{keyword} <PROCESSOR NAME> <PROCESSOR CLASS FILENAME> <PROCESSOR SPECIFIC OPTIONS>"
|
|
680
|
+
parser.verify_num_parameters(2, nil, usage)
|
|
681
|
+
|
|
682
|
+
begin
|
|
683
|
+
# require should be performed in target.txt
|
|
684
|
+
klass = params[1].filename_to_class_name.to_class
|
|
685
|
+
raise parser.error("#{params[1].filename_to_class_name} class not found. Did you require the file in target.txt?", usage) unless klass
|
|
686
|
+
if params[2]
|
|
687
|
+
processor = klass.new(*params[2..(params.length - 1)])
|
|
688
|
+
else
|
|
689
|
+
processor = klass.new
|
|
690
|
+
end
|
|
691
|
+
raise ArgumentError, "processor must be a Cosmos::Processor but is a #{processor.class}" unless Cosmos::Processor === processor
|
|
692
|
+
processor.name = params[0]
|
|
693
|
+
@current_packet.processors[params[0].to_s.upcase] = processor
|
|
694
|
+
rescue Exception => err
|
|
695
|
+
raise parser.error(err, usage)
|
|
696
|
+
end
|
|
697
|
+
end
|
|
698
|
+
|
|
699
|
+
def process_format_string(parser, keyword, params)
|
|
700
|
+
usage = "#{keyword} <PRINTF STYLE STRING>"
|
|
701
|
+
parser.verify_num_parameters(1, 1, usage)
|
|
702
|
+
@current_item.format_string = params[0]
|
|
703
|
+
unless @current_item.read_conversion
|
|
704
|
+
# Check format string as long as a read conversion has not been defined
|
|
705
|
+
begin
|
|
706
|
+
case @current_item.data_type
|
|
707
|
+
when :INT, :UINT
|
|
708
|
+
sprintf(@current_item.format_string, 0)
|
|
709
|
+
when :FLOAT
|
|
710
|
+
sprintf(@current_item.format_string, 0.0)
|
|
711
|
+
when :STRING, :BLOCK
|
|
712
|
+
sprintf(@current_item.format_string, 'Hello')
|
|
713
|
+
else
|
|
714
|
+
# Nothing to do
|
|
715
|
+
end
|
|
716
|
+
rescue Exception
|
|
717
|
+
raise parser.error("Invalid #{keyword} specified for type #{@current_item.data_type}: #{params[0]}", usage)
|
|
718
|
+
end
|
|
719
|
+
end
|
|
720
|
+
end
|
|
721
|
+
|
|
722
|
+
def process_packet(parser, keyword, params, target_name)
|
|
723
|
+
finish_packet()
|
|
724
|
+
|
|
725
|
+
usage = "#{keyword} <TARGET NAME> <PACKET NAME> <ENDIANNESS: BIG_ENDIAN/LITTLE_ENDIAN> <DESCRIPTION (Optional)>"
|
|
726
|
+
parser.verify_num_parameters(3, 4, usage)
|
|
727
|
+
target_name = params[0].to_s.upcase if target_name == 'SYSTEM'
|
|
728
|
+
packet_name = params[1].to_s.upcase
|
|
729
|
+
endianness = params[2].to_s.upcase.intern
|
|
730
|
+
description = params[3].to_s
|
|
731
|
+
if endianness != :BIG_ENDIAN and endianness != :LITTLE_ENDIAN
|
|
732
|
+
raise parser.error("Invalid endianness #{params[2]}. Must be BIG_ENDIAN or LITTLE_ENDIAN.", usage)
|
|
733
|
+
end
|
|
734
|
+
|
|
735
|
+
@current_target_name = target_name
|
|
736
|
+
@current_packet_name = packet_name
|
|
737
|
+
@current_cmd_or_tlm = keyword.capitalize
|
|
738
|
+
|
|
739
|
+
# Be sure there is not already a packet by this name
|
|
740
|
+
if @current_cmd_or_tlm == 'Command'
|
|
741
|
+
if @commands[@current_target_name]
|
|
742
|
+
if @commands[@current_target_name][@current_packet_name]
|
|
743
|
+
msg = "#{@current_cmd_or_tlm} Packet #{@current_target_name} #{@current_packet_name} redefined."
|
|
744
|
+
Logger.instance.warn msg
|
|
745
|
+
@warnings << msg
|
|
746
|
+
end
|
|
747
|
+
end
|
|
748
|
+
else
|
|
749
|
+
if @telemetry[@current_target_name]
|
|
750
|
+
if @telemetry[@current_target_name][@current_packet_name]
|
|
751
|
+
msg = "#{@current_cmd_or_tlm} Packet #{@current_target_name} #{@current_packet_name} redefined."
|
|
752
|
+
Logger.instance.warn msg
|
|
753
|
+
@warnings << msg
|
|
754
|
+
end
|
|
755
|
+
end
|
|
756
|
+
end
|
|
757
|
+
|
|
758
|
+
@current_packet = Packet.new(@current_target_name, @current_packet_name, endianness, description)
|
|
759
|
+
|
|
760
|
+
# Add received time packet items
|
|
761
|
+
if @current_cmd_or_tlm == 'Telemetry'
|
|
762
|
+
item = @current_packet.define_item('RECEIVED_TIMESECONDS', 0, 0, :DERIVED, nil, @current_packet.default_endianness, :ERROR, '%0.6f', ReceivedTimeSecondsConversion.new)
|
|
763
|
+
item.description = 'COSMOS Received Time (UTC, Floating point, Unix epoch)'
|
|
764
|
+
item = @current_packet.define_item('RECEIVED_TIMEFORMATTED', 0, 0, :DERIVED, nil, @current_packet.default_endianness, :ERROR, nil, ReceivedTimeFormattedConversion.new)
|
|
765
|
+
item.description = 'COSMOS Received Time (Local time zone, Formatted string)'
|
|
766
|
+
item = @current_packet.define_item('RECEIVED_COUNT', 0, 0, :DERIVED, nil, @current_packet.default_endianness, :ERROR, nil, ReceivedCountConversion.new)
|
|
767
|
+
item.description = 'COSMOS packet received count'
|
|
768
|
+
|
|
769
|
+
unless @telemetry[@current_target_name]
|
|
770
|
+
@telemetry[@current_target_name] = {}
|
|
771
|
+
@latest_data[@current_target_name] = {}
|
|
772
|
+
end
|
|
773
|
+
else
|
|
774
|
+
@commands[@current_target_name] ||= {}
|
|
775
|
+
end
|
|
776
|
+
end
|
|
777
|
+
|
|
778
|
+
# Add current packet into hash if it exists
|
|
779
|
+
def finish_packet
|
|
780
|
+
finish_item()
|
|
781
|
+
if @current_packet
|
|
782
|
+
# Review bit offset to look for overlapping definitions
|
|
783
|
+
# This will allow gaps in the packet, but not allow the same bits to be
|
|
784
|
+
# used for multiple variables.
|
|
785
|
+
expected_next_offset = nil
|
|
786
|
+
previous_item = nil
|
|
787
|
+
@current_packet.sorted_items.each do |item|
|
|
788
|
+
if expected_next_offset and item.bit_offset < expected_next_offset
|
|
789
|
+
msg = "Bit definition overlap at bit offset #{item.bit_offset} for #{@current_cmd_or_tlm} packet #{@current_target_name} #{@current_packet_name} items #{item.name} and #{previous_item.name}"
|
|
790
|
+
Logger.instance.warn(msg)
|
|
791
|
+
@warnings << msg
|
|
792
|
+
end
|
|
793
|
+
if item.array_size
|
|
794
|
+
if item.array_size > 0
|
|
795
|
+
expected_next_offset = item.bit_offset + item.array_size
|
|
796
|
+
else
|
|
797
|
+
expected_next_offset = item.array_size
|
|
798
|
+
end
|
|
799
|
+
else
|
|
800
|
+
expected_next_offset = nil
|
|
801
|
+
if item.bit_offset > 0
|
|
802
|
+
# Handle little-endian bit fields
|
|
803
|
+
byte_aligned = ((item.bit_offset % 8) == 0)
|
|
804
|
+
if item.endianness == :LITTLE_ENDIAN and (item.data_type == :INT or item.data_type == :UINT) and !(byte_aligned and (item.bit_size == 8 or item.bit_size == 16 or item.bit_size == 32 or item.bit_size == 64))
|
|
805
|
+
# Bitoffset always refers to the most significant bit of a bitfield
|
|
806
|
+
bits_remaining_in_last_byte = 8 - (item.bit_offset % 8)
|
|
807
|
+
if item.bit_size > bits_remaining_in_last_byte
|
|
808
|
+
expected_next_offset = item.bit_offset + bits_remaining_in_last_byte
|
|
809
|
+
end
|
|
810
|
+
end
|
|
811
|
+
end
|
|
812
|
+
unless expected_next_offset
|
|
813
|
+
if item.bit_size > 0
|
|
814
|
+
expected_next_offset = item.bit_offset + item.bit_size
|
|
815
|
+
else
|
|
816
|
+
expected_next_offset = item.bit_size
|
|
817
|
+
end
|
|
818
|
+
end
|
|
819
|
+
end
|
|
820
|
+
previous_item = item
|
|
821
|
+
|
|
822
|
+
# Check command default and range data types if no write conversion is present
|
|
823
|
+
item.check_default_and_range_data_types if @current_cmd_or_tlm == 'Command'
|
|
824
|
+
end
|
|
825
|
+
|
|
826
|
+
# commit packet to memory
|
|
827
|
+
if @current_cmd_or_tlm == 'Command'
|
|
828
|
+
@commands[@current_target_name][@current_packet_name] = @current_packet
|
|
829
|
+
else
|
|
830
|
+
@telemetry[@current_target_name][@current_packet_name] = @current_packet
|
|
831
|
+
end
|
|
832
|
+
@current_packet = nil
|
|
833
|
+
@current_item = nil
|
|
834
|
+
end
|
|
835
|
+
end
|
|
836
|
+
|
|
837
|
+
# There are many different usages of the ITEM keword so parse the keyword
|
|
838
|
+
# and parameters to generate the correct usage information.
|
|
839
|
+
def generate_item_usage(keyword, params)
|
|
840
|
+
usage = "#{keyword} <ITEM NAME> "
|
|
841
|
+
usage << "<BIT OFFSET> " unless keyword.include?("APPEND")
|
|
842
|
+
if keyword.include?("ARRAY")
|
|
843
|
+
usage << "<ARRAY ITEM BIT SIZE> "
|
|
844
|
+
else
|
|
845
|
+
usage << "<BIT SIZE> "
|
|
846
|
+
end
|
|
847
|
+
if keyword.include?("PARAMETER")
|
|
848
|
+
if keyword.include?("ARRAY")
|
|
849
|
+
usage << "<TYPE: INT/UINT/FLOAT/STRING/BLOCK> "
|
|
850
|
+
else
|
|
851
|
+
if keyword.include?("APPEND")
|
|
852
|
+
data_type = params[2].upcase.to_sym
|
|
853
|
+
else
|
|
854
|
+
data_type = params[3].upcase.to_sym
|
|
855
|
+
end
|
|
856
|
+
if data_type == :STRING or data_type == :BLOCK
|
|
857
|
+
if keyword.include?("ID")
|
|
858
|
+
usage << "<TYPE: STRING/BLOCK> "
|
|
859
|
+
else
|
|
860
|
+
usage << "<TYPE: STRING/BLOCK> <DEFAULT VALUE>"
|
|
861
|
+
end
|
|
862
|
+
else
|
|
863
|
+
if keyword.include?("ID")
|
|
864
|
+
usage << "<TYPE: INT/UINT/FLOAT> <MIN VALUE> <MAX VALUE> "
|
|
865
|
+
else
|
|
866
|
+
usage << "<TYPE: INT/UINT/FLOAT/DERIVED> <MIN VALUE> <MAX VALUE> <DEFAULT VALUE>"
|
|
867
|
+
end
|
|
868
|
+
end
|
|
869
|
+
end
|
|
870
|
+
else
|
|
871
|
+
usage << "<TYPE: INT/UINT/FLOAT/STRING/BLOCK/DERIVED> "
|
|
872
|
+
end
|
|
873
|
+
usage << "<TOTAL ARRAY BIT SIZE> " if keyword.include?("ARRAY")
|
|
874
|
+
if keyword.include?("ID")
|
|
875
|
+
if keyword.include?("PARAMETER")
|
|
876
|
+
usage << "<DEFAULT AND ID VALUE> "
|
|
877
|
+
else
|
|
878
|
+
usage << "<ID VALUE> "
|
|
879
|
+
end
|
|
880
|
+
end
|
|
881
|
+
usage << "<DESCRIPTION (Optional)> <ENDIANNESS (Optional)>"
|
|
882
|
+
return usage
|
|
883
|
+
end
|
|
884
|
+
|
|
885
|
+
def start_item(parser, keyword, params)
|
|
886
|
+
finish_item()
|
|
887
|
+
|
|
888
|
+
usage = generate_item_usage(keyword, params)
|
|
889
|
+
max_options = usage.count("<")
|
|
890
|
+
parser.verify_num_parameters(max_options-2, max_options, usage)
|
|
891
|
+
begin
|
|
892
|
+
if params[max_options-1]
|
|
893
|
+
endianness = params[max_options-1].to_s.upcase.intern
|
|
894
|
+
if endianness != :BIG_ENDIAN and endianness != :LITTLE_ENDIAN
|
|
895
|
+
raise parser.error("Invalid endianness #{params[2]}. Must be BIG_ENDIAN or LITTLE_ENDIAN.", usage)
|
|
896
|
+
end
|
|
897
|
+
else
|
|
898
|
+
endianness = @current_packet.default_endianness
|
|
899
|
+
end
|
|
900
|
+
|
|
901
|
+
case keyword
|
|
902
|
+
when /ITEM/
|
|
903
|
+
raise parser.error("ITEM types are only valid with TELEMETRY", usage) if @current_cmd_or_tlm == 'Command'
|
|
904
|
+
# If this is an APPEND we don't have a bit offset so the index
|
|
905
|
+
# into the parameters changes
|
|
906
|
+
index = (keyword =~ /APPEND/) ? 3 : 4
|
|
907
|
+
id_value = (keyword =~ /ID_ITEM/) ? params[index] : nil
|
|
908
|
+
array_size = (keyword =~ /ARRAY_ITEM/) ? Integer(params[index]) : nil
|
|
909
|
+
case keyword
|
|
910
|
+
when 'ITEM', 'ID_ITEM', 'ARRAY_ITEM'
|
|
911
|
+
@current_item = @current_packet.define_item(params[0], # name
|
|
912
|
+
Integer(params[1]), # bit offset
|
|
913
|
+
Integer(params[2]), # bit size
|
|
914
|
+
params[3].upcase.to_sym, # data_type
|
|
915
|
+
array_size, # array size
|
|
916
|
+
endianness, # endianness
|
|
917
|
+
:ERROR, # overflow
|
|
918
|
+
nil, # format string
|
|
919
|
+
nil, # read conversion
|
|
920
|
+
nil, # write conversion
|
|
921
|
+
id_value) # id value
|
|
922
|
+
when 'APPEND_ITEM', 'APPEND_ID_ITEM', 'APPEND_ARRAY_ITEM'
|
|
923
|
+
@current_item = @current_packet.append_item(params[0], # name
|
|
924
|
+
Integer(params[1]), # bit size
|
|
925
|
+
params[2].upcase.to_sym, # data_type
|
|
926
|
+
array_size, # array size
|
|
927
|
+
endianness, # endianness
|
|
928
|
+
:ERROR, # overflow
|
|
929
|
+
nil, # format string
|
|
930
|
+
nil, # read conversion
|
|
931
|
+
nil, # write conversion
|
|
932
|
+
id_value) # id value
|
|
933
|
+
end
|
|
934
|
+
when 'PARAMETER', 'ID_PARAMETER', 'ARRAY_PARAMETER'
|
|
935
|
+
raise parser.error("PARAMETER types are only valid with COMMAND", usage) if @current_cmd_or_tlm == 'Telemetry'
|
|
936
|
+
data_type = params[3].upcase.to_sym
|
|
937
|
+
id_value = nil
|
|
938
|
+
if keyword == 'ID_PARAMETER'
|
|
939
|
+
if data_type == :DERIVED
|
|
940
|
+
raise "DERIVED data type not allowed"
|
|
941
|
+
elsif data_type == :STRING or data_type == :BLOCK
|
|
942
|
+
id_value = params[4]
|
|
943
|
+
else
|
|
944
|
+
id_value = params[6]
|
|
945
|
+
end
|
|
946
|
+
end
|
|
947
|
+
array_size = (keyword == 'ARRAY_PARAMETER') ? Integer(params[4]) : nil
|
|
948
|
+
@current_item = @current_packet.define_item(params[0], # name
|
|
949
|
+
Integer(params[1]), # bit offset
|
|
950
|
+
Integer(params[2]), # bit size
|
|
951
|
+
data_type, # data_type
|
|
952
|
+
array_size, # array size
|
|
953
|
+
endianness, # endianness
|
|
954
|
+
:ERROR, # overflow
|
|
955
|
+
nil, # format string
|
|
956
|
+
nil, # read conversion
|
|
957
|
+
nil, # write conversion
|
|
958
|
+
id_value) # id value
|
|
959
|
+
if keyword == 'ARRAY_PARAMETER'
|
|
960
|
+
@current_item.default = []
|
|
961
|
+
else
|
|
962
|
+
if data_type == :STRING or data_type == :BLOCK
|
|
963
|
+
@current_item.default = params[4]
|
|
964
|
+
else
|
|
965
|
+
@current_item.range =
|
|
966
|
+
(ConfigParser.handle_defined_constants(params[4].convert_to_value))..(ConfigParser.handle_defined_constants(params[5].convert_to_value))
|
|
967
|
+
@current_item.default = ConfigParser.handle_defined_constants(params[6].convert_to_value)
|
|
968
|
+
end
|
|
969
|
+
end
|
|
970
|
+
when 'APPEND_PARAMETER', 'APPEND_ID_PARAMETER', 'APPEND_ARRAY_PARAMETER'
|
|
971
|
+
raise parser.error("PARAMETER types are only valid with COMMAND", usage) if @current_cmd_or_tlm == 'Telemetry'
|
|
972
|
+
data_type = params[2].upcase.to_sym
|
|
973
|
+
id_value = nil
|
|
974
|
+
if keyword == 'APPEND_ID_PARAMETER'
|
|
975
|
+
if data_type == :DERIVED
|
|
976
|
+
raise "DERIVED data type not allowed"
|
|
977
|
+
elsif data_type == :STRING or data_type == :BLOCK
|
|
978
|
+
id_value = params[3]
|
|
979
|
+
else
|
|
980
|
+
id_value = params[5]
|
|
981
|
+
end
|
|
982
|
+
end
|
|
983
|
+
array_size = (keyword == 'APPEND_ARRAY_PARAMETER') ? Integer(params[3]) : nil
|
|
984
|
+
@current_item = @current_packet.append_item(params[0], # name
|
|
985
|
+
Integer(params[1]), # bit size
|
|
986
|
+
data_type, # data_type
|
|
987
|
+
array_size, # array size
|
|
988
|
+
endianness, # endianness
|
|
989
|
+
:ERROR, # overflow
|
|
990
|
+
nil, # format string
|
|
991
|
+
nil, # read conversion
|
|
992
|
+
nil, # write conversion
|
|
993
|
+
id_value) # id value
|
|
994
|
+
if keyword == 'APPEND_ARRAY_PARAMETER'
|
|
995
|
+
@current_item.default = []
|
|
996
|
+
else
|
|
997
|
+
if data_type == :STRING or data_type == :BLOCK
|
|
998
|
+
@current_item.default = params[3]
|
|
999
|
+
else
|
|
1000
|
+
@current_item.range =
|
|
1001
|
+
(ConfigParser.handle_defined_constants(params[3].convert_to_value))..(ConfigParser.handle_defined_constants(params[4].convert_to_value))
|
|
1002
|
+
@current_item.default = ConfigParser.handle_defined_constants(params[5].convert_to_value)
|
|
1003
|
+
end
|
|
1004
|
+
end
|
|
1005
|
+
end
|
|
1006
|
+
@current_item.description = params[max_options-2] if params[max_options-2]
|
|
1007
|
+
|
|
1008
|
+
if keyword.include?('APPEND') && @macro_append.building
|
|
1009
|
+
@macro_append.list << params[0].upcase
|
|
1010
|
+
end
|
|
1011
|
+
|
|
1012
|
+
# Rescue the item processing since they could also throw configuration errors
|
|
1013
|
+
rescue => err
|
|
1014
|
+
raise parser.error(err, usage)
|
|
1015
|
+
end
|
|
1016
|
+
end
|
|
1017
|
+
|
|
1018
|
+
# Finish updating item in packet
|
|
1019
|
+
def finish_item
|
|
1020
|
+
if @current_item
|
|
1021
|
+
@current_packet.set_item(@current_item)
|
|
1022
|
+
if @current_cmd_or_tlm == 'Telemetry'
|
|
1023
|
+
target_latest_data = @latest_data[@current_target_name]
|
|
1024
|
+
target_latest_data[@current_item.name] ||= []
|
|
1025
|
+
latest_data_packets = target_latest_data[@current_item.name]
|
|
1026
|
+
latest_data_packets << @current_packet unless latest_data_packets.include?(@current_packet)
|
|
1027
|
+
end
|
|
1028
|
+
@current_item = nil
|
|
1029
|
+
end
|
|
1030
|
+
end
|
|
1031
|
+
|
|
1032
|
+
end # class PacketConfig
|
|
1033
|
+
|
|
1034
|
+
end # module Cosmos
|