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.
Files changed (912) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +48 -48
  4. data/.travis.yml +7 -7
  5. data/CONTRIBUTING.txt +50 -50
  6. data/Gemfile +6 -6
  7. data/Guardfile +27 -27
  8. data/LICENSE.txt +879 -879
  9. data/Manifest.txt +1116 -1114
  10. data/README.md +109 -107
  11. data/Rakefile +214 -214
  12. data/autohotkey/config/data/diamond.STL +57 -57
  13. data/autohotkey/config/system/system.txt +34 -34
  14. data/autohotkey/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -41
  15. data/autohotkey/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -15
  16. data/autohotkey/config/targets/COSMOS/cmd_tlm_server.txt +6 -6
  17. data/autohotkey/config/targets/COSMOS/target.txt +5 -5
  18. data/autohotkey/config/targets/INST/cmd_tlm/inst_cmds.txt +121 -121
  19. data/autohotkey/config/targets/INST/cmd_tlm/inst_tlm.txt +247 -247
  20. data/autohotkey/config/targets/INST/cmd_tlm_server.txt +5 -5
  21. data/autohotkey/config/targets/INST/lib/example_limits_response.rb +30 -30
  22. data/autohotkey/config/targets/INST/lib/sim_inst.rb +305 -294
  23. data/autohotkey/config/targets/INST/screens/adcs.txt +46 -46
  24. data/autohotkey/config/targets/INST/screens/array.txt +7 -7
  25. data/autohotkey/config/targets/INST/screens/block.txt +8 -8
  26. data/autohotkey/config/targets/INST/screens/commanding.txt +30 -30
  27. data/autohotkey/config/targets/INST/screens/graphs.txt +14 -14
  28. data/autohotkey/config/targets/INST/screens/ground.txt +25 -25
  29. data/autohotkey/config/targets/INST/screens/health_status.txt +33 -33
  30. data/autohotkey/config/targets/INST/screens/hs.txt +49 -49
  31. data/autohotkey/config/targets/INST/screens/image.txt +21 -21
  32. data/autohotkey/config/targets/INST/screens/latest.txt +23 -23
  33. data/autohotkey/config/targets/INST/screens/mech.txt +25 -25
  34. data/autohotkey/config/targets/INST/screens/other.txt +25 -25
  35. data/autohotkey/config/targets/INST/screens/params.txt +25 -25
  36. data/autohotkey/config/targets/INST/screens/tabs.txt +68 -68
  37. data/autohotkey/config/targets/INST/target.txt +26 -26
  38. data/autohotkey/config/targets/META/cmd_tlm/meta_cmd.txt +10 -10
  39. data/autohotkey/config/targets/META/cmd_tlm/meta_tlm.txt +9 -9
  40. data/autohotkey/config/targets/SYSTEM/cmd_tlm/limits_groups.txt +7 -7
  41. data/autohotkey/config/targets/SYSTEM/screens/error.txt +11 -11
  42. data/autohotkey/config/tools/cmd_tlm_server/cmd_tlm_server.txt +22 -22
  43. data/autohotkey/config/tools/data_viewer/data_viewer.txt +11 -11
  44. data/autohotkey/config/tools/handbook_creator/handbook_creator.txt +49 -49
  45. data/autohotkey/config/tools/handbook_creator/templates/command_packets.html.erb +86 -86
  46. data/autohotkey/config/tools/handbook_creator/templates/command_toc.html.erb +38 -38
  47. data/autohotkey/config/tools/handbook_creator/templates/footer.html.erb +9 -9
  48. data/autohotkey/config/tools/handbook_creator/templates/header.html.erb +25 -25
  49. data/autohotkey/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -13
  50. data/autohotkey/config/tools/handbook_creator/templates/nav.html.erb +27 -27
  51. data/autohotkey/config/tools/handbook_creator/templates/overview.html.erb +1 -1
  52. data/autohotkey/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -23
  53. data/autohotkey/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -33
  54. data/autohotkey/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -41
  55. data/autohotkey/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -80
  56. data/autohotkey/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -38
  57. data/autohotkey/config/tools/handbook_creator/templates/title.html.erb +1 -1
  58. data/autohotkey/config/tools/launcher/launcher.txt +38 -38
  59. data/autohotkey/config/tools/script_runner/script_runner.txt +3 -3
  60. data/autohotkey/config/tools/table_manager/ConfigTables_def.txt +8 -8
  61. data/autohotkey/config/tools/table_manager/OneDimensionalTable_def.txt +19 -19
  62. data/autohotkey/config/tools/table_manager/TwoDimensionalTable_def.txt +248 -248
  63. data/autohotkey/config/tools/test_runner/test_runner.txt +8 -8
  64. data/autohotkey/config/tools/test_runner/test_runner2.txt +11 -11
  65. data/autohotkey/config/tools/test_runner/test_runner3.txt +6 -6
  66. data/autohotkey/config/tools/test_runner/test_runner4.txt +1 -1
  67. data/autohotkey/config/tools/tlm_extractor/tlm_extractor.txt +13 -13
  68. data/autohotkey/config/tools/tlm_extractor/tlm_extractor2.txt +9 -9
  69. data/autohotkey/config/tools/tlm_grapher/bad.txt +50 -50
  70. data/autohotkey/config/tools/tlm_grapher/temp1-4.txt +51 -51
  71. data/autohotkey/config/tools/tlm_grapher/test2.txt +111 -111
  72. data/autohotkey/config/tools/tlm_viewer/tlm_viewer.txt +24 -24
  73. data/autohotkey/config/tools/tlm_viewer/tlm_viewer2.txt +4 -4
  74. data/autohotkey/config/tools/tlm_viewer/tlm_viewer3.txt +3 -3
  75. data/autohotkey/lib/example_background_task.rb +42 -42
  76. data/autohotkey/lib/user_version.rb +3 -3
  77. data/autohotkey/procedures/clear_util.rb +7 -7
  78. data/autohotkey/procedures/collect.rb +18 -18
  79. data/autohotkey/procedures/collect_util.rb +14 -14
  80. data/autohotkey/procedures/example_test.rb +67 -67
  81. data/autohotkey/procedures/example_test2.rb +74 -74
  82. data/autohotkey/procedures/script_test.rb +17 -17
  83. data/autohotkey/procedures/syntax_error.rb +18 -18
  84. data/autohotkey/tools/CmdExtractorAHK +16 -16
  85. data/autohotkey/tools/CmdSender +14 -14
  86. data/autohotkey/tools/CmdSenderAHK +18 -18
  87. data/autohotkey/tools/CmdTlmServer +14 -14
  88. data/autohotkey/tools/CmdTlmServerAHK +28 -28
  89. data/autohotkey/tools/CmdTlmServerAHK2 +17 -17
  90. data/autohotkey/tools/DataViewer +14 -14
  91. data/autohotkey/tools/DataViewerAHK +17 -17
  92. data/autohotkey/tools/HandbookCreatorAHK +20 -20
  93. data/autohotkey/tools/LauncherAHK +17 -17
  94. data/autohotkey/tools/LimitsMonitorAHK +20 -20
  95. data/autohotkey/tools/OpenGLBuilderAHK +20 -20
  96. data/autohotkey/tools/PacketViewer +14 -14
  97. data/autohotkey/tools/PacketViewerAHK +18 -18
  98. data/autohotkey/tools/PacketViewerAHK2 +17 -17
  99. data/autohotkey/tools/Replay +14 -14
  100. data/autohotkey/tools/Replay.bat +59 -59
  101. data/autohotkey/tools/ReplayAHK +17 -17
  102. data/autohotkey/tools/ScriptRunner +14 -14
  103. data/autohotkey/tools/ScriptRunnerAHK +20 -20
  104. data/autohotkey/tools/ScriptRunnerAHK2 +17 -17
  105. data/autohotkey/tools/TableManager +14 -14
  106. data/autohotkey/tools/TableManagerAHK +30 -30
  107. data/autohotkey/tools/TestRunner +15 -15
  108. data/autohotkey/tools/TestRunnerAHK +17 -17
  109. data/autohotkey/tools/TestRunnerAHK2 +17 -17
  110. data/autohotkey/tools/TestRunnerAHK3 +17 -17
  111. data/autohotkey/tools/TestRunnerAHK4 +17 -17
  112. data/autohotkey/tools/TlmExtractor +15 -15
  113. data/autohotkey/tools/TlmExtractorAHK +19 -19
  114. data/autohotkey/tools/TlmExtractorAHK2 +16 -16
  115. data/autohotkey/tools/TlmExtractorAHK3 +16 -16
  116. data/autohotkey/tools/TlmGrapher +14 -14
  117. data/autohotkey/tools/TlmGrapherAHK +19 -19
  118. data/autohotkey/tools/TlmGrapherAHK2 +23 -23
  119. data/autohotkey/tools/TlmGrapherAHK3 +17 -17
  120. data/autohotkey/tools/TlmGrapherAHK4 +17 -17
  121. data/autohotkey/tools/TlmViewer +14 -14
  122. data/autohotkey/tools/TlmViewerAHK +28 -28
  123. data/autohotkey/tools/TlmViewerAHK2 +18 -18
  124. data/autohotkey/tools/TlmViewerAHK3 +18 -18
  125. data/autohotkey/tools/TlmViewerAHK4 +18 -18
  126. data/autohotkey/tools/TlmViewerAHK5 +18 -18
  127. data/autohotkey/tools/autohotkey.rb +37 -37
  128. data/autohotkey/tools/cmd_extractor.ahk +27 -27
  129. data/autohotkey/tools/cmd_sender.ahk +182 -162
  130. data/autohotkey/tools/cmd_tlm_server.ahk +89 -89
  131. data/autohotkey/tools/cmd_tlm_server2.ahk +45 -45
  132. data/autohotkey/tools/data_viewer.ahk +135 -135
  133. data/autohotkey/tools/handbook_creator.ahk +23 -23
  134. data/autohotkey/tools/launcher.ahk +41 -41
  135. data/autohotkey/tools/limits_monitor.ahk +70 -70
  136. data/autohotkey/tools/open_gl_builder.ahk +134 -134
  137. data/autohotkey/tools/packet_viewer.ahk +143 -143
  138. data/autohotkey/tools/packet_viewer2.ahk +9 -9
  139. data/autohotkey/tools/replay.ahk +98 -98
  140. data/autohotkey/tools/script_runner.ahk +589 -589
  141. data/autohotkey/tools/script_runner2.ahk +34 -31
  142. data/autohotkey/tools/table_manager.ahk +220 -220
  143. data/autohotkey/tools/test_runner.ahk +262 -259
  144. data/autohotkey/tools/test_runner2.ahk +52 -52
  145. data/autohotkey/tools/test_runner3.ahk +13 -13
  146. data/autohotkey/tools/tlm_extractor.ahk +272 -272
  147. data/autohotkey/tools/tlm_grapher.ahk +642 -642
  148. data/autohotkey/tools/tlm_grapher2.ahk +115 -115
  149. data/autohotkey/tools/tlm_grapher3.ahk +24 -24
  150. data/autohotkey/tools/tlm_viewer.ahk +133 -133
  151. data/autohotkey/tools/tlm_viewer2.ahk +50 -49
  152. data/autohotkey/tools/tlm_viewer4.ahk +4 -4
  153. data/autohotkey/tools/tlm_viewer5.ahk +20 -20
  154. data/bin/cosmos +96 -96
  155. data/bin/cstol_converter +1166 -1166
  156. data/bin/rubysloc +85 -85
  157. data/cosmos.gemspec +98 -97
  158. data/data/about.txt +4 -4
  159. data/data/crc.txt +306 -305
  160. data/data/diamond.STL +57 -57
  161. data/data/legal.txt +9 -9
  162. data/demo/Gemfile +6 -6
  163. data/demo/Launcher +15 -15
  164. data/demo/Launcher.bat +59 -59
  165. data/demo/Rakefile +61 -61
  166. data/demo/config/data/crc.txt +222 -206
  167. data/demo/config/data/diamond.STL +57 -57
  168. data/demo/config/data/meta_init.txt +4 -4
  169. data/demo/config/system/system.txt +34 -34
  170. data/demo/config/system/system2.txt +33 -33
  171. data/demo/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -41
  172. data/demo/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -15
  173. data/demo/config/targets/COSMOS/cmd_tlm_server.txt +6 -6
  174. data/demo/config/targets/COSMOS/screens/limits_change.txt +20 -20
  175. data/demo/config/targets/COSMOS/screens/version.txt +19 -19
  176. data/demo/config/targets/COSMOS/target.txt +11 -11
  177. data/demo/config/targets/EXAMPLE/cmd_tlm/example_cmds.txt +2 -2
  178. data/demo/config/targets/EXAMPLE/cmd_tlm/example_tlm.txt +3 -3
  179. data/demo/config/targets/EXAMPLE/cmd_tlm_server.txt +6 -6
  180. data/demo/config/targets/EXAMPLE/lib/example_interface.rb +22 -22
  181. data/demo/config/targets/EXAMPLE/target.txt +6 -6
  182. data/demo/config/targets/INST/cmd_tlm/inst_cmds.txt +121 -121
  183. data/demo/config/targets/INST/cmd_tlm/inst_tlm.txt +247 -247
  184. data/demo/config/targets/INST/cmd_tlm_server.txt +5 -5
  185. data/demo/config/targets/INST/lib/example_limits_response.rb +30 -30
  186. data/demo/config/targets/INST/lib/sim_inst.rb +305 -294
  187. data/demo/config/targets/INST/screens/adcs.txt +46 -46
  188. data/demo/config/targets/INST/screens/array.txt +15 -15
  189. data/demo/config/targets/INST/screens/block.txt +8 -8
  190. data/demo/config/targets/INST/screens/commanding.txt +30 -30
  191. data/demo/config/targets/INST/screens/graphs.txt +14 -14
  192. data/demo/config/targets/INST/screens/ground.txt +25 -25
  193. data/demo/config/targets/INST/screens/hs.txt +44 -44
  194. data/demo/config/targets/INST/screens/latest.txt +23 -23
  195. data/demo/config/targets/INST/screens/other.txt +29 -29
  196. data/demo/config/targets/INST/screens/tabs.txt +70 -70
  197. data/demo/config/targets/INST/target.txt +33 -33
  198. data/demo/config/targets/META/cmd_tlm/meta_cmd.txt +10 -10
  199. data/demo/config/targets/META/cmd_tlm/meta_tlm.txt +13 -13
  200. data/demo/config/targets/SYSTEM/cmd_tlm/limits_groups.txt +7 -7
  201. data/demo/config/targets/SYSTEM/cmd_tlm/override.txt +29 -29
  202. data/demo/config/targets/SYSTEM/screens/status.txt +12 -12
  203. data/demo/config/targets/TEMPLATED/cmd_tlm/templated_cmds.txt +13 -12
  204. data/demo/config/targets/TEMPLATED/cmd_tlm/templated_tlm.txt +3 -3
  205. data/demo/config/targets/TEMPLATED/cmd_tlm_server.txt +6 -6
  206. data/demo/config/targets/TEMPLATED/lib/templated_interface.rb +54 -48
  207. data/demo/config/targets/TEMPLATED/target.txt +6 -6
  208. data/demo/config/tools/cmd_tlm_server/cmd_tlm_server.txt +33 -33
  209. data/demo/config/tools/cmd_tlm_server/cmd_tlm_server2.txt +29 -29
  210. data/demo/config/tools/data_viewer/data_viewer.txt +11 -11
  211. data/demo/config/tools/handbook_creator/handbook_creator.txt +66 -66
  212. data/demo/config/tools/handbook_creator/templates/command_packets.html.erb +86 -86
  213. data/demo/config/tools/handbook_creator/templates/command_toc.html.erb +38 -38
  214. data/demo/config/tools/handbook_creator/templates/footer.html.erb +9 -9
  215. data/demo/config/tools/handbook_creator/templates/header.html.erb +25 -25
  216. data/demo/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -13
  217. data/demo/config/tools/handbook_creator/templates/nav.html.erb +27 -27
  218. data/demo/config/tools/handbook_creator/templates/overview.html.erb +1 -1
  219. data/demo/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -23
  220. data/demo/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -33
  221. data/demo/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -41
  222. data/demo/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -80
  223. data/demo/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -38
  224. data/demo/config/tools/handbook_creator/templates/title.html.erb +1 -1
  225. data/demo/config/tools/launcher/launcher.txt +45 -45
  226. data/demo/config/tools/launcher/launcher2.txt +45 -45
  227. data/demo/config/tools/script_runner/script_runner.txt +3 -3
  228. data/demo/config/tools/table_manager/ConfigTables_def.txt +8 -8
  229. data/demo/config/tools/table_manager/ExampleTableDefinition.txt +24 -24
  230. data/demo/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +25 -25
  231. data/demo/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +25 -25
  232. data/demo/config/tools/table_manager/PPSSelectionTable_def.txt +8 -8
  233. data/demo/config/tools/table_manager/TLMMonitoringTable_def.txt +248 -248
  234. data/demo/config/tools/test_runner/test_runner.txt +17 -17
  235. data/demo/config/tools/tlm_extractor/tlm_extractor.txt +13 -13
  236. data/demo/config/tools/tlm_extractor/tlm_extractor2.txt +2 -2
  237. data/demo/config/tools/tlm_extractor/tlm_extractor3.txt +2 -2
  238. data/demo/config/tools/tlm_extractor/tlm_extractor4.txt +2 -2
  239. data/demo/config/tools/tlm_viewer/tlm_viewer.txt +41 -41
  240. data/demo/lib/example_background_task.rb +57 -52
  241. data/demo/lib/example_target.rb +113 -108
  242. data/demo/lib/scpi_target.rb +74 -74
  243. data/demo/lib/user_version.rb +3 -3
  244. data/demo/procedures/checks.rb +11 -11
  245. data/demo/procedures/clear_util.rb +7 -7
  246. data/demo/procedures/collect.rb +18 -18
  247. data/demo/procedures/collect_util.rb +14 -14
  248. data/demo/procedures/cosmos_api_test.rb +293 -293
  249. data/demo/procedures/disconnect.rb +29 -29
  250. data/demo/procedures/example_test.rb +182 -182
  251. data/demo/procedures/plot_test.rb +8 -8
  252. data/demo/procedures/run_example_test.rb +3 -3
  253. data/demo/procedures/test.rb +51 -51
  254. data/demo/tools/CmdExtractor +15 -15
  255. data/demo/tools/CmdExtractor.bat +59 -59
  256. data/demo/tools/CmdSender +15 -15
  257. data/demo/tools/CmdSender.bat +59 -59
  258. data/demo/tools/CmdTlmServer +15 -15
  259. data/demo/tools/CmdTlmServer.bat +59 -59
  260. data/demo/tools/DataViewer +15 -15
  261. data/demo/tools/DataViewer.bat +59 -59
  262. data/demo/tools/ExampleTarget +15 -15
  263. data/demo/tools/ExampleTarget.bat +59 -59
  264. data/demo/tools/HandbookCreator +15 -15
  265. data/demo/tools/HandbookCreator.bat +61 -61
  266. data/demo/tools/Launcher +15 -15
  267. data/demo/tools/Launcher.bat +59 -59
  268. data/demo/tools/LimitsMonitor +15 -15
  269. data/demo/tools/LimitsMonitor.bat +59 -59
  270. data/demo/tools/OpenGLBuilder +15 -15
  271. data/demo/tools/OpenGLBuilder.bat +59 -59
  272. data/demo/tools/PacketViewer +15 -15
  273. data/demo/tools/PacketViewer.bat +59 -59
  274. data/demo/tools/Replay +15 -15
  275. data/demo/tools/Replay.bat +59 -59
  276. data/demo/tools/ScpiTarget +15 -15
  277. data/demo/tools/ScpiTarget.bat +59 -59
  278. data/demo/tools/ScriptRunner +15 -15
  279. data/demo/tools/ScriptRunner.bat +59 -59
  280. data/demo/tools/TableManager +15 -15
  281. data/demo/tools/TableManager.bat +59 -59
  282. data/demo/tools/TestRunner +15 -15
  283. data/demo/tools/TestRunner.bat +59 -59
  284. data/demo/tools/TlmExtractor +15 -15
  285. data/demo/tools/TlmExtractor.bat +59 -59
  286. data/demo/tools/TlmGrapher +15 -15
  287. data/demo/tools/TlmGrapher.bat +59 -59
  288. data/demo/tools/TlmViewer +15 -15
  289. data/demo/tools/TlmViewer.bat +59 -59
  290. data/demo/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -38
  291. data/demo/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +15 -15
  292. data/demo/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +6 -6
  293. data/demo/tools/mac/CmdSender.app/Contents/Info.plist +38 -38
  294. data/demo/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +15 -15
  295. data/demo/tools/mac/CmdSender.app/Contents/MacOS/main.sh +6 -6
  296. data/demo/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -38
  297. data/demo/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +15 -15
  298. data/demo/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +6 -6
  299. data/demo/tools/mac/DataViewer.app/Contents/Info.plist +38 -38
  300. data/demo/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +15 -15
  301. data/demo/tools/mac/DataViewer.app/Contents/MacOS/main.sh +6 -6
  302. data/demo/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -38
  303. data/demo/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +15 -15
  304. data/demo/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +6 -6
  305. data/demo/tools/mac/Launcher.app/Contents/Info.plist +38 -38
  306. data/demo/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +15 -15
  307. data/demo/tools/mac/Launcher.app/Contents/MacOS/main.sh +6 -6
  308. data/demo/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -38
  309. data/demo/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +15 -15
  310. data/demo/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +6 -6
  311. data/demo/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -38
  312. data/demo/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +15 -15
  313. data/demo/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +6 -6
  314. data/demo/tools/mac/PacketViewer.app/Contents/Info.plist +38 -38
  315. data/demo/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +15 -15
  316. data/demo/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +6 -6
  317. data/demo/tools/mac/Replay.app/Contents/Info.plist +38 -38
  318. data/demo/tools/mac/Replay.app/Contents/MacOS/Replay.rb +15 -15
  319. data/demo/tools/mac/Replay.app/Contents/MacOS/main.sh +6 -6
  320. data/demo/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -38
  321. data/demo/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +15 -15
  322. data/demo/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +6 -6
  323. data/demo/tools/mac/TableManager.app/Contents/Info.plist +38 -38
  324. data/demo/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +15 -15
  325. data/demo/tools/mac/TableManager.app/Contents/MacOS/main.sh +6 -6
  326. data/demo/tools/mac/TestRunner.app/Contents/Info.plist +38 -38
  327. data/demo/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +15 -15
  328. data/demo/tools/mac/TestRunner.app/Contents/MacOS/main.sh +6 -6
  329. data/demo/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -38
  330. data/demo/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +15 -15
  331. data/demo/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +6 -6
  332. data/demo/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -38
  333. data/demo/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +15 -15
  334. data/demo/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +6 -6
  335. data/demo/tools/mac/TlmViewer.app/Contents/Info.plist +38 -38
  336. data/demo/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +15 -15
  337. data/demo/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +6 -6
  338. data/ext/cosmos/ext/array/array.c +111 -111
  339. data/ext/cosmos/ext/array/extconf.rb +13 -13
  340. data/ext/cosmos/ext/buffered_file/buffered_file.c +167 -167
  341. data/ext/cosmos/ext/buffered_file/extconf.rb +13 -13
  342. data/ext/cosmos/ext/config_parser/config_parser.c +237 -237
  343. data/ext/cosmos/ext/config_parser/extconf.rb +13 -13
  344. data/ext/cosmos/ext/cosmos_io/cosmos_io.c +117 -117
  345. data/ext/cosmos/ext/cosmos_io/extconf.rb +13 -13
  346. data/ext/cosmos/ext/crc/crc.c +341 -341
  347. data/ext/cosmos/ext/crc/extconf.rb +12 -12
  348. data/ext/cosmos/ext/line_graph/extconf.rb +13 -13
  349. data/ext/cosmos/ext/line_graph/line_graph.c +501 -501
  350. data/ext/cosmos/ext/low_fragmentation_array/extconf.rb +12 -12
  351. data/ext/cosmos/ext/low_fragmentation_array/low_fragmentation_array.c +261 -261
  352. data/ext/cosmos/ext/packet/extconf.rb +13 -13
  353. data/ext/cosmos/ext/packet/packet.c +339 -339
  354. data/ext/cosmos/ext/platform/extconf.rb +13 -13
  355. data/ext/cosmos/ext/platform/platform.c +81 -81
  356. data/ext/cosmos/ext/polynomial_conversion/extconf.rb +13 -13
  357. data/ext/cosmos/ext/polynomial_conversion/polynomial_conversion.c +73 -73
  358. data/ext/cosmos/ext/string/extconf.rb +13 -13
  359. data/ext/cosmos/ext/string/string.c +49 -49
  360. data/ext/cosmos/ext/structure/structure.c +894 -894
  361. data/ext/cosmos/ext/tabbed_plots_config/extconf.rb +13 -13
  362. data/ext/cosmos/ext/tabbed_plots_config/tabbed_plots_config.c +51 -51
  363. data/ext/cosmos/ext/telemetry/extconf.rb +13 -13
  364. data/ext/cosmos/ext/telemetry/telemetry.c +306 -306
  365. data/ext/mkrf_conf.rb +40 -40
  366. data/install/Gemfile +6 -6
  367. data/install/Launcher +14 -14
  368. data/install/Launcher.bat +59 -59
  369. data/install/Rakefile +61 -61
  370. data/install/config/data/crc.txt +134 -133
  371. data/install/config/system/system.txt +29 -29
  372. data/install/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -41
  373. data/install/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -15
  374. data/install/config/targets/COSMOS/cmd_tlm_server.txt +6 -6
  375. data/install/config/targets/COSMOS/screens/limits_change.txt +20 -20
  376. data/install/config/targets/COSMOS/screens/version.txt +19 -19
  377. data/install/config/targets/COSMOS/target.txt +8 -8
  378. data/install/config/tools/cmd_tlm_server/cmd_tlm_server.txt +2 -2
  379. data/install/config/tools/data_viewer/data_viewer.txt +3 -3
  380. data/install/config/tools/handbook_creator/handbook_creator.txt +49 -49
  381. data/install/config/tools/handbook_creator/templates/command_packets.html.erb +86 -86
  382. data/install/config/tools/handbook_creator/templates/command_toc.html.erb +38 -38
  383. data/install/config/tools/handbook_creator/templates/footer.html.erb +9 -9
  384. data/install/config/tools/handbook_creator/templates/header.html.erb +25 -25
  385. data/install/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -13
  386. data/install/config/tools/handbook_creator/templates/nav.html.erb +27 -27
  387. data/install/config/tools/handbook_creator/templates/overview.html.erb +1 -1
  388. data/install/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -23
  389. data/install/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -33
  390. data/install/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -41
  391. data/install/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -80
  392. data/install/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -38
  393. data/install/config/tools/handbook_creator/templates/title.html.erb +1 -1
  394. data/install/config/tools/launcher/launcher.txt +39 -39
  395. data/install/config/tools/script_runner/script_runner.txt +3 -3
  396. data/install/config/tools/test_runner/test_runner.txt +8 -8
  397. data/install/config/tools/tlm_viewer/tlm_viewer.txt +5 -5
  398. data/install/lib/user_version.rb +3 -3
  399. data/install/tools/CmdExtractor +15 -15
  400. data/install/tools/CmdExtractor.bat +59 -59
  401. data/install/tools/CmdSender +15 -15
  402. data/install/tools/CmdSender.bat +59 -59
  403. data/install/tools/CmdTlmServer +15 -15
  404. data/install/tools/CmdTlmServer.bat +59 -59
  405. data/install/tools/DataViewer +15 -15
  406. data/install/tools/DataViewer.bat +59 -59
  407. data/install/tools/HandbookCreator +15 -15
  408. data/install/tools/HandbookCreator.bat +61 -61
  409. data/install/tools/Launcher +15 -15
  410. data/install/tools/Launcher.bat +59 -59
  411. data/install/tools/LimitsMonitor +15 -15
  412. data/install/tools/LimitsMonitor.bat +59 -59
  413. data/install/tools/OpenGLBuilder +15 -15
  414. data/install/tools/OpenGLBuilder.bat +59 -59
  415. data/install/tools/PacketViewer +15 -15
  416. data/install/tools/PacketViewer.bat +59 -59
  417. data/install/tools/Replay +15 -15
  418. data/install/tools/Replay.bat +59 -59
  419. data/install/tools/ScriptRunner +15 -15
  420. data/install/tools/ScriptRunner.bat +59 -59
  421. data/install/tools/TableManager +15 -15
  422. data/install/tools/TableManager.bat +59 -59
  423. data/install/tools/TestRunner +15 -15
  424. data/install/tools/TestRunner.bat +59 -59
  425. data/install/tools/TlmExtractor +15 -15
  426. data/install/tools/TlmExtractor.bat +59 -59
  427. data/install/tools/TlmGrapher +15 -15
  428. data/install/tools/TlmGrapher.bat +59 -59
  429. data/install/tools/TlmViewer +15 -15
  430. data/install/tools/TlmViewer.bat +59 -59
  431. data/install/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -38
  432. data/install/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +15 -15
  433. data/install/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +6 -6
  434. data/install/tools/mac/CmdSender.app/Contents/Info.plist +38 -38
  435. data/install/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +15 -15
  436. data/install/tools/mac/CmdSender.app/Contents/MacOS/main.sh +6 -6
  437. data/install/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -38
  438. data/install/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +15 -15
  439. data/install/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +6 -6
  440. data/install/tools/mac/DataViewer.app/Contents/Info.plist +38 -38
  441. data/install/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +15 -15
  442. data/install/tools/mac/DataViewer.app/Contents/MacOS/main.sh +6 -6
  443. data/install/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -38
  444. data/install/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +15 -15
  445. data/install/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +6 -6
  446. data/install/tools/mac/Launcher.app/Contents/Info.plist +38 -38
  447. data/install/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +15 -15
  448. data/install/tools/mac/Launcher.app/Contents/MacOS/main.sh +6 -6
  449. data/install/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -38
  450. data/install/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +15 -15
  451. data/install/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +6 -6
  452. data/install/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -38
  453. data/install/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +15 -15
  454. data/install/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +6 -6
  455. data/install/tools/mac/PacketViewer.app/Contents/Info.plist +38 -38
  456. data/install/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +15 -15
  457. data/install/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +6 -6
  458. data/install/tools/mac/Replay.app/Contents/Info.plist +38 -38
  459. data/install/tools/mac/Replay.app/Contents/MacOS/Replay.rb +15 -15
  460. data/install/tools/mac/Replay.app/Contents/MacOS/main.sh +6 -6
  461. data/install/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -38
  462. data/install/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +15 -15
  463. data/install/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +6 -6
  464. data/install/tools/mac/TableManager.app/Contents/Info.plist +38 -38
  465. data/install/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +15 -15
  466. data/install/tools/mac/TableManager.app/Contents/MacOS/main.sh +6 -6
  467. data/install/tools/mac/TestRunner.app/Contents/Info.plist +38 -38
  468. data/install/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +15 -15
  469. data/install/tools/mac/TestRunner.app/Contents/MacOS/main.sh +6 -6
  470. data/install/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -38
  471. data/install/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +15 -15
  472. data/install/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +6 -6
  473. data/install/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -38
  474. data/install/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +15 -15
  475. data/install/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +6 -6
  476. data/install/tools/mac/TlmViewer.app/Contents/Info.plist +38 -38
  477. data/install/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +15 -15
  478. data/install/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +6 -6
  479. data/lib/cosmos.rb +63 -63
  480. data/lib/cosmos/ccsds/ccsds_packet.rb +63 -63
  481. data/lib/cosmos/ccsds/ccsds_parser.rb +143 -143
  482. data/lib/cosmos/config/config_parser.rb +324 -324
  483. data/lib/cosmos/conversions.rb +13 -13
  484. data/lib/cosmos/conversions/conversion.rb +47 -47
  485. data/lib/cosmos/conversions/generic_conversion.rb +55 -55
  486. data/lib/cosmos/conversions/new_packet_log_conversion.rb +45 -45
  487. data/lib/cosmos/conversions/polynomial_conversion.rb +57 -57
  488. data/lib/cosmos/conversions/processor_conversion.rb +46 -46
  489. data/lib/cosmos/conversions/received_count_conversion.rb +33 -33
  490. data/lib/cosmos/conversions/received_time_formatted_conversion.rb +37 -37
  491. data/lib/cosmos/conversions/received_time_seconds_conversion.rb +37 -37
  492. data/lib/cosmos/conversions/segmented_polynomial_conversion.rb +128 -128
  493. data/lib/cosmos/conversions/unix_time_conversion.rb +50 -50
  494. data/lib/cosmos/conversions/unix_time_formatted_conversion.rb +44 -44
  495. data/lib/cosmos/conversions/unix_time_seconds_conversion.rb +44 -44
  496. data/lib/cosmos/core_ext.rb +18 -18
  497. data/lib/cosmos/core_ext/array.rb +354 -354
  498. data/lib/cosmos/core_ext/class.rb +51 -51
  499. data/lib/cosmos/core_ext/cosmos_io.rb +29 -29
  500. data/lib/cosmos/core_ext/exception.rb +52 -52
  501. data/lib/cosmos/core_ext/file.rb +75 -75
  502. data/lib/cosmos/core_ext/hash.rb +28 -28
  503. data/lib/cosmos/core_ext/io.rb +75 -75
  504. data/lib/cosmos/core_ext/kernel.rb +38 -38
  505. data/lib/cosmos/core_ext/math.rb +119 -119
  506. data/lib/cosmos/core_ext/matrix.rb +146 -146
  507. data/lib/cosmos/core_ext/objectspace.rb +29 -29
  508. data/lib/cosmos/core_ext/range.rb +22 -22
  509. data/lib/cosmos/core_ext/socket.rb +32 -32
  510. data/lib/cosmos/core_ext/string.rb +310 -310
  511. data/lib/cosmos/core_ext/stringio.rb +24 -24
  512. data/lib/cosmos/core_ext/time.rb +446 -446
  513. data/lib/cosmos/gui/choosers/combobox_chooser.rb +130 -130
  514. data/lib/cosmos/gui/choosers/file_chooser.rb +68 -68
  515. data/lib/cosmos/gui/choosers/float_chooser.rb +82 -82
  516. data/lib/cosmos/gui/choosers/integer_chooser.rb +80 -80
  517. data/lib/cosmos/gui/choosers/string_chooser.rb +53 -53
  518. data/lib/cosmos/gui/choosers/telemetry_chooser.rb +317 -317
  519. data/lib/cosmos/gui/dialogs/about_dialog.rb +128 -128
  520. data/lib/cosmos/gui/dialogs/calendar_dialog.rb +136 -136
  521. data/lib/cosmos/gui/dialogs/cmd_details_dialog.rb +52 -52
  522. data/lib/cosmos/gui/dialogs/cmd_tlm_raw_dialog.rb +149 -149
  523. data/lib/cosmos/gui/dialogs/details_dialog.rb +174 -174
  524. data/lib/cosmos/gui/dialogs/exception_dialog.rb +97 -97
  525. data/lib/cosmos/gui/dialogs/exception_list_dialog.rb +59 -59
  526. data/lib/cosmos/gui/dialogs/find_replace_dialog.rb +196 -196
  527. data/lib/cosmos/gui/dialogs/legal_dialog.rb +169 -168
  528. data/lib/cosmos/gui/dialogs/packet_log_dialog.rb +118 -118
  529. data/lib/cosmos/gui/dialogs/progress_dialog.rb +270 -262
  530. data/lib/cosmos/gui/dialogs/pry_dialog.rb +165 -161
  531. data/lib/cosmos/gui/dialogs/scroll_text_dialog.rb +37 -37
  532. data/lib/cosmos/gui/dialogs/select_dialog.rb +54 -54
  533. data/lib/cosmos/gui/dialogs/set_tlm_dialog.rb +131 -131
  534. data/lib/cosmos/gui/dialogs/splash.rb +113 -113
  535. data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +206 -206
  536. data/lib/cosmos/gui/dialogs/tlm_edit_dialog.rb +81 -81
  537. data/lib/cosmos/gui/line_graph/line_graph.rb +456 -456
  538. data/lib/cosmos/gui/line_graph/line_graph_dialog.rb +34 -34
  539. data/lib/cosmos/gui/line_graph/line_graph_drawing.rb +494 -494
  540. data/lib/cosmos/gui/line_graph/line_graph_popups.rb +116 -116
  541. data/lib/cosmos/gui/line_graph/line_graph_scaling.rb +460 -460
  542. data/lib/cosmos/gui/line_graph/line_graph_script.rb +26 -26
  543. data/lib/cosmos/gui/line_graph/lines.rb +290 -290
  544. data/lib/cosmos/gui/line_graph/overview_graph.rb +459 -459
  545. data/lib/cosmos/gui/opengl/earth_model.rb +22 -22
  546. data/lib/cosmos/gui/opengl/gl_bounds.rb +67 -67
  547. data/lib/cosmos/gui/opengl/gl_light.rb +39 -39
  548. data/lib/cosmos/gui/opengl/gl_material.rb +29 -29
  549. data/lib/cosmos/gui/opengl/gl_scene.rb +72 -72
  550. data/lib/cosmos/gui/opengl/gl_shape.rb +146 -146
  551. data/lib/cosmos/gui/opengl/gl_viewer.rb +724 -712
  552. data/lib/cosmos/gui/opengl/gl_viewport.rb +35 -35
  553. data/lib/cosmos/gui/opengl/moon_model.rb +22 -22
  554. data/lib/cosmos/gui/opengl/opengl.rb +8 -8
  555. data/lib/cosmos/gui/opengl/stl_reader.rb +211 -211
  556. data/lib/cosmos/gui/opengl/stl_shape.rb +124 -124
  557. data/lib/cosmos/gui/opengl/texture_mapped_sphere.rb +202 -202
  558. data/lib/cosmos/gui/qt.rb +813 -786
  559. data/lib/cosmos/gui/qt_tool.rb +378 -373
  560. data/lib/cosmos/gui/text/completion.rb +381 -381
  561. data/lib/cosmos/gui/text/completion_line_edit.rb +30 -30
  562. data/lib/cosmos/gui/text/completion_text_edit.rb +179 -179
  563. data/lib/cosmos/gui/text/ruby_editor.rb +395 -395
  564. data/lib/cosmos/gui/utilities/screenshot.rb +25 -25
  565. data/lib/cosmos/gui/utilities/script_module_gui.rb +203 -203
  566. data/lib/cosmos/gui/widgets/full_text_search_line_edit.rb +161 -161
  567. data/lib/cosmos/gui/widgets/packet_log_frame.rb +305 -305
  568. data/lib/cosmos/gui/widgets/realtime_button_bar.rb +98 -98
  569. data/lib/cosmos/interfaces.rb +11 -11
  570. data/lib/cosmos/interfaces/cmd_tlm_server_interface.rb +153 -149
  571. data/lib/cosmos/interfaces/interface.rb +213 -213
  572. data/lib/cosmos/interfaces/linc_interface.rb +360 -360
  573. data/lib/cosmos/interfaces/serial_interface.rb +76 -76
  574. data/lib/cosmos/interfaces/simulated_target_interface.rb +129 -128
  575. data/lib/cosmos/interfaces/stream_interface.rb +156 -156
  576. data/lib/cosmos/interfaces/tcpip_client_interface.rb +60 -60
  577. data/lib/cosmos/interfaces/tcpip_server_interface.rb +154 -154
  578. data/lib/cosmos/interfaces/udp_interface.rb +173 -173
  579. data/lib/cosmos/io/buffered_file.rb +11 -11
  580. data/lib/cosmos/io/cosmos_snmp.rb +50 -50
  581. data/lib/cosmos/io/io_multiplexer.rb +89 -89
  582. data/lib/cosmos/io/json_drb.rb +344 -320
  583. data/lib/cosmos/io/json_drb_object.rb +137 -137
  584. data/lib/cosmos/io/json_rpc.rb +365 -365
  585. data/lib/cosmos/io/posix_serial_driver.rb +145 -145
  586. data/lib/cosmos/io/raw_logger.rb +174 -174
  587. data/lib/cosmos/io/raw_logger_pair.rb +71 -71
  588. data/lib/cosmos/io/serial_driver.rb +85 -85
  589. data/lib/cosmos/io/stderr.rb +36 -36
  590. data/lib/cosmos/io/stdout.rb +36 -36
  591. data/lib/cosmos/io/tcpip_server.rb +583 -532
  592. data/lib/cosmos/io/udp_sockets.rb +152 -152
  593. data/lib/cosmos/io/win32_serial_driver.rb +147 -147
  594. data/lib/cosmos/packet_logs.rb +6 -6
  595. data/lib/cosmos/packet_logs/meta_packet_log_writer.rb +107 -107
  596. data/lib/cosmos/packet_logs/packet_log_reader.rb +441 -439
  597. data/lib/cosmos/packet_logs/packet_log_writer.rb +321 -309
  598. data/lib/cosmos/packet_logs/packet_log_writer_pair.rb +30 -30
  599. data/lib/cosmos/packets/binary_accessor.rb +921 -921
  600. data/lib/cosmos/packets/commands.rb +291 -291
  601. data/lib/cosmos/packets/limits.rb +263 -263
  602. data/lib/cosmos/packets/limits_response.rb +38 -38
  603. data/lib/cosmos/packets/packet.rb +714 -699
  604. data/lib/cosmos/packets/packet_config.rb +1034 -1034
  605. data/lib/cosmos/packets/packet_item.rb +317 -317
  606. data/lib/cosmos/packets/packet_item_limits.rb +128 -128
  607. data/lib/cosmos/packets/structure.rb +421 -386
  608. data/lib/cosmos/packets/structure_item.rb +233 -233
  609. data/lib/cosmos/packets/telemetry.rb +317 -317
  610. data/lib/cosmos/processors.rb +6 -6
  611. data/lib/cosmos/processors/new_packet_log_processor.rb +34 -34
  612. data/lib/cosmos/processors/processor.rb +71 -71
  613. data/lib/cosmos/processors/statistics_processor.rb +65 -65
  614. data/lib/cosmos/processors/watermark_processor.rb +44 -44
  615. data/lib/cosmos/script.rb +9 -9
  616. data/lib/cosmos/script/extract.rb +115 -115
  617. data/lib/cosmos/script/script.rb +1513 -1493
  618. data/lib/cosmos/streams/burst_stream_protocol.rb +25 -25
  619. data/lib/cosmos/streams/fixed_stream_protocol.rb +111 -111
  620. data/lib/cosmos/streams/length_stream_protocol.rb +140 -140
  621. data/lib/cosmos/streams/preidentified_stream_protocol.rb +118 -118
  622. data/lib/cosmos/streams/serial_stream.rb +152 -143
  623. data/lib/cosmos/streams/stream.rb +57 -57
  624. data/lib/cosmos/streams/stream_protocol.rb +369 -369
  625. data/lib/cosmos/streams/tcpip_client_stream.rb +77 -77
  626. data/lib/cosmos/streams/tcpip_socket_stream.rb +139 -139
  627. data/lib/cosmos/streams/template_stream_protocol.rb +140 -140
  628. data/lib/cosmos/streams/terminated_stream_protocol.rb +81 -81
  629. data/lib/cosmos/system.rb +4 -4
  630. data/lib/cosmos/system/system.rb +558 -558
  631. data/lib/cosmos/system/target.rb +178 -178
  632. data/lib/cosmos/tools/cmd_extractor/cmd_extractor.rb +254 -253
  633. data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +716 -716
  634. data/lib/cosmos/tools/cmd_sender/cmd_sender_item_delegate.rb +77 -77
  635. data/lib/cosmos/tools/cmd_sender/cmd_sender_text_edit.rb +70 -70
  636. data/lib/cosmos/tools/cmd_tlm_server/api.rb +936 -940
  637. data/lib/cosmos/tools/cmd_tlm_server/background_task.rb +46 -46
  638. data/lib/cosmos/tools/cmd_tlm_server/background_tasks.rb +67 -63
  639. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +511 -497
  640. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +241 -241
  641. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +1033 -1008
  642. data/lib/cosmos/tools/cmd_tlm_server/commanding.rb +112 -112
  643. data/lib/cosmos/tools/cmd_tlm_server/connections.rb +176 -176
  644. data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +241 -221
  645. data/lib/cosmos/tools/cmd_tlm_server/interfaces.rb +127 -127
  646. data/lib/cosmos/tools/cmd_tlm_server/packet_logging.rb +132 -132
  647. data/lib/cosmos/tools/cmd_tlm_server/router_thread.rb +66 -66
  648. data/lib/cosmos/tools/cmd_tlm_server/routers.rb +97 -97
  649. data/lib/cosmos/tools/data_viewer/data_viewer.rb +628 -600
  650. data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +167 -167
  651. data/lib/cosmos/tools/data_viewer/dump_component.rb +40 -40
  652. data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +149 -149
  653. data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +360 -360
  654. data/lib/cosmos/tools/launcher/launcher.rb +184 -184
  655. data/lib/cosmos/tools/launcher/launcher_config.rb +175 -167
  656. data/lib/cosmos/tools/launcher/launcher_multitool.rb +40 -41
  657. data/lib/cosmos/tools/launcher/launcher_tool.rb +104 -104
  658. data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +796 -768
  659. data/lib/cosmos/tools/opengl_builder/opengl_builder.rb +416 -416
  660. data/lib/cosmos/tools/opengl_builder/scene_config.rb +118 -118
  661. data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +525 -525
  662. data/lib/cosmos/tools/replay/replay.rb +495 -488
  663. data/lib/cosmos/tools/replay/replay_server.rb +91 -91
  664. data/lib/cosmos/tools/script_runner/script_audit.rb +147 -139
  665. data/lib/cosmos/tools/script_runner/script_runner.rb +914 -914
  666. data/lib/cosmos/tools/script_runner/script_runner_config.rb +40 -40
  667. data/lib/cosmos/tools/script_runner/script_runner_frame.rb +1892 -1859
  668. data/lib/cosmos/tools/table_manager/table.rb +70 -70
  669. data/lib/cosmos/tools/table_manager/table_config.rb +764 -764
  670. data/lib/cosmos/tools/table_manager/table_item.rb +74 -74
  671. data/lib/cosmos/tools/table_manager/table_manager.rb +1065 -1065
  672. data/lib/cosmos/tools/table_manager/table_manager_core.rb +539 -539
  673. data/lib/cosmos/tools/test_runner/results_writer.rb +283 -283
  674. data/lib/cosmos/tools/test_runner/test.rb +480 -480
  675. data/lib/cosmos/tools/test_runner/test_runner.rb +1157 -1157
  676. data/lib/cosmos/tools/test_runner/test_runner_chooser.rb +338 -338
  677. data/lib/cosmos/tools/tlm_extractor/text_item_chooser.rb +60 -60
  678. data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +1008 -1008
  679. data/lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb +371 -371
  680. data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +60 -60
  681. data/lib/cosmos/tools/tlm_grapher/data_object_adders/housekeeping_data_object_adder.rb +75 -75
  682. data/lib/cosmos/tools/tlm_grapher/data_object_adders/singlexy_data_object_adder.rb +44 -44
  683. data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +94 -94
  684. data/lib/cosmos/tools/tlm_grapher/data_object_editors/data_object_editor.rb +61 -61
  685. data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +180 -180
  686. data/lib/cosmos/tools/tlm_grapher/data_object_editors/linegraph_data_object_editor.rb +141 -141
  687. data/lib/cosmos/tools/tlm_grapher/data_object_editors/singlexy_data_object_editor.rb +30 -30
  688. data/lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb +173 -173
  689. data/lib/cosmos/tools/tlm_grapher/data_objects/data_object.rb +177 -177
  690. data/lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb +412 -409
  691. data/lib/cosmos/tools/tlm_grapher/data_objects/linegraph_data_object.rb +176 -176
  692. data/lib/cosmos/tools/tlm_grapher/data_objects/singlexy_data_object.rb +25 -25
  693. data/lib/cosmos/tools/tlm_grapher/data_objects/xy_data_object.rb +323 -320
  694. data/lib/cosmos/tools/tlm_grapher/plot_editors/linegraph_plot_editor.rb +181 -181
  695. data/lib/cosmos/tools/tlm_grapher/plot_editors/plot_editor.rb +28 -28
  696. data/lib/cosmos/tools/tlm_grapher/plot_editors/singlexy_plot_editor.rb +30 -30
  697. data/lib/cosmos/tools/tlm_grapher/plot_editors/xy_plot_editor.rb +59 -59
  698. data/lib/cosmos/tools/tlm_grapher/plot_gui_objects/linegraph_plot_gui_object.rb +172 -172
  699. data/lib/cosmos/tools/tlm_grapher/plot_gui_objects/singlexy_plot_gui_object.rb +27 -27
  700. data/lib/cosmos/tools/tlm_grapher/plot_gui_objects/xy_plot_gui_object.rb +74 -74
  701. data/lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb +201 -201
  702. data/lib/cosmos/tools/tlm_grapher/plots/plot.rb +69 -69
  703. data/lib/cosmos/tools/tlm_grapher/plots/singlexy_plot.rb +20 -20
  704. data/lib/cosmos/tools/tlm_grapher/plots/xy_plot.rb +61 -61
  705. data/lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb +1278 -1278
  706. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_config.rb +430 -430
  707. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_data_object_editor.rb +107 -107
  708. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_logfile_thread.rb +111 -95
  709. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_plot_editor.rb +101 -101
  710. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_realtime_thread.rb +72 -66
  711. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tab.rb +57 -57
  712. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tool.rb +1004 -1004
  713. data/lib/cosmos/tools/tlm_grapher/tlm_grapher.rb +87 -87
  714. data/lib/cosmos/tools/tlm_viewer/screen.rb +486 -458
  715. data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +563 -544
  716. data/lib/cosmos/tools/tlm_viewer/tlm_viewer_config.rb +287 -287
  717. data/lib/cosmos/tools/tlm_viewer/widgets.rb +53 -53
  718. data/lib/cosmos/tools/tlm_viewer/widgets/aging_widget.rb +110 -110
  719. data/lib/cosmos/tools/tlm_viewer/widgets/array_widget.rb +70 -70
  720. data/lib/cosmos/tools/tlm_viewer/widgets/block_widget.rb +61 -61
  721. data/lib/cosmos/tools/tlm_viewer/widgets/button_widget.rb +39 -39
  722. data/lib/cosmos/tools/tlm_viewer/widgets/canvas_widget.rb +62 -62
  723. data/lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb +41 -41
  724. data/lib/cosmos/tools/tlm_viewer/widgets/canvasimagevalue_widget.rb +57 -57
  725. data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabel_widget.rb +37 -37
  726. data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabelvalue_widget.rb +56 -56
  727. data/lib/cosmos/tools/tlm_viewer/widgets/canvasline_widget.rb +55 -55
  728. data/lib/cosmos/tools/tlm_viewer/widgets/canvaslinevalue_widget.rb +66 -66
  729. data/lib/cosmos/tools/tlm_viewer/widgets/canvasvalue_widget.rb +124 -124
  730. data/lib/cosmos/tools/tlm_viewer/widgets/checkbutton_widget.rb +31 -31
  731. data/lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb +30 -30
  732. data/lib/cosmos/tools/tlm_viewer/widgets/formatfontvalue_widget.rb +36 -36
  733. data/lib/cosmos/tools/tlm_viewer/widgets/formatvalue_widget.rb +35 -35
  734. data/lib/cosmos/tools/tlm_viewer/widgets/horizontal_widget.rb +27 -27
  735. data/lib/cosmos/tools/tlm_viewer/widgets/horizontalbox_widget.rb +31 -31
  736. data/lib/cosmos/tools/tlm_viewer/widgets/horizontalline_widget.rb +26 -26
  737. data/lib/cosmos/tools/tlm_viewer/widgets/label_widget.rb +29 -29
  738. data/lib/cosmos/tools/tlm_viewer/widgets/labelformatvalue_widget.rb +39 -39
  739. data/lib/cosmos/tools/tlm_viewer/widgets/labelprogressbar_widget.rb +38 -38
  740. data/lib/cosmos/tools/tlm_viewer/widgets/labeltrendlimitsbar_widget.rb +38 -38
  741. data/lib/cosmos/tools/tlm_viewer/widgets/labelvalue_widget.rb +39 -39
  742. data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluedesc_widget.rb +42 -42
  743. data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitsbar_widget.rb +37 -37
  744. data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangebar_widget.rb +37 -37
  745. data/lib/cosmos/tools/tlm_viewer/widgets/layout_widget.rb +34 -34
  746. data/lib/cosmos/tools/tlm_viewer/widgets/limitsbar_widget.rb +178 -178
  747. data/lib/cosmos/tools/tlm_viewer/widgets/linegraph_widget.rb +54 -54
  748. data/lib/cosmos/tools/tlm_viewer/widgets/matrixbycolumns_widget.rb +47 -47
  749. data/lib/cosmos/tools/tlm_viewer/widgets/multi_widget.rb +116 -116
  750. data/lib/cosmos/tools/tlm_viewer/widgets/progressbar_widget.rb +34 -34
  751. data/lib/cosmos/tools/tlm_viewer/widgets/radiobutton_widget.rb +30 -30
  752. data/lib/cosmos/tools/tlm_viewer/widgets/rangebar_widget.rb +57 -57
  753. data/lib/cosmos/tools/tlm_viewer/widgets/screenshotbutton_widget.rb +34 -34
  754. data/lib/cosmos/tools/tlm_viewer/widgets/scrollwindow_widget.rb +35 -35
  755. data/lib/cosmos/tools/tlm_viewer/widgets/sectionheader_widget.rb +33 -33
  756. data/lib/cosmos/tools/tlm_viewer/widgets/tabbook_widget.rb +26 -26
  757. data/lib/cosmos/tools/tlm_viewer/widgets/tabitem_widget.rb +28 -28
  758. data/lib/cosmos/tools/tlm_viewer/widgets/textbox_widget.rb +47 -47
  759. data/lib/cosmos/tools/tlm_viewer/widgets/textfield_widget.rb +26 -26
  760. data/lib/cosmos/tools/tlm_viewer/widgets/timegraph_widget.rb +88 -88
  761. data/lib/cosmos/tools/tlm_viewer/widgets/title_widget.rb +27 -27
  762. data/lib/cosmos/tools/tlm_viewer/widgets/trendbar_widget.rb +130 -130
  763. data/lib/cosmos/tools/tlm_viewer/widgets/trendlimitsbar_widget.rb +46 -46
  764. data/lib/cosmos/tools/tlm_viewer/widgets/value_widget.rb +43 -43
  765. data/lib/cosmos/tools/tlm_viewer/widgets/valuelimitsbar_widget.rb +37 -37
  766. data/lib/cosmos/tools/tlm_viewer/widgets/valuerangebar_widget.rb +37 -37
  767. data/lib/cosmos/tools/tlm_viewer/widgets/vertical_widget.rb +35 -35
  768. data/lib/cosmos/tools/tlm_viewer/widgets/verticalbox_widget.rb +37 -37
  769. data/lib/cosmos/tools/tlm_viewer/widgets/widget.rb +257 -257
  770. data/lib/cosmos/top_level.rb +647 -596
  771. data/lib/cosmos/utilities.rb +11 -10
  772. data/lib/cosmos/utilities/crc.rb +166 -166
  773. data/lib/cosmos/utilities/csv.rb +83 -83
  774. data/lib/cosmos/utilities/logger.rb +137 -137
  775. data/lib/cosmos/utilities/low_fragmentation_array.rb +11 -11
  776. data/lib/cosmos/utilities/message_log.rb +74 -74
  777. data/lib/cosmos/utilities/quaternion.rb +258 -258
  778. data/lib/cosmos/utilities/ruby_lex_utils.rb +313 -313
  779. data/lib/cosmos/utilities/simulated_target.rb +99 -99
  780. data/lib/cosmos/utilities/sleeper.rb +44 -0
  781. data/lib/cosmos/version.rb +12 -12
  782. data/lib/cosmos/win32/excel.rb +66 -66
  783. data/lib/cosmos/win32/win32.rb +387 -387
  784. data/lib/cosmos/win32/win32_main.rb +311 -311
  785. data/roodi.yml +24 -24
  786. data/run_gui_tests.bat +32 -32
  787. data/spec/ccsds/ccsds_packet_spec.rb +67 -67
  788. data/spec/ccsds/ccsds_parser_spec.rb +148 -148
  789. data/spec/config/config_parser_spec.rb +322 -322
  790. data/spec/conversions/conversion_spec.rb +31 -31
  791. data/spec/conversions/generic_conversion_spec.rb +45 -45
  792. data/spec/conversions/new_packet_log_conversion_spec.rb +39 -39
  793. data/spec/conversions/polynomial_conversion_spec.rb +40 -40
  794. data/spec/conversions/processor_conversion_spec.rb +45 -45
  795. data/spec/conversions/received_count_conversion_spec.rb +43 -43
  796. data/spec/conversions/received_time_formatted_conversion_spec.rb +49 -49
  797. data/spec/conversions/received_time_seconds_conversion_spec.rb +50 -50
  798. data/spec/conversions/segmented_polynomial_conversion_spec.rb +51 -51
  799. data/spec/conversions/unix_time_formatted_conversion_spec.rb +74 -74
  800. data/spec/conversions/unix_time_seconds_conversion_spec.rb +76 -76
  801. data/spec/core_ext/array_spec.rb +186 -186
  802. data/spec/core_ext/class_spec.rb +36 -36
  803. data/spec/core_ext/cosmos_io_spec.rb +77 -77
  804. data/spec/core_ext/exception_spec.rb +91 -91
  805. data/spec/core_ext/file_spec.rb +72 -72
  806. data/spec/core_ext/hash_spec.rb +24 -24
  807. data/spec/core_ext/io_spec.rb +46 -46
  808. data/spec/core_ext/kernel_spec.rb +54 -54
  809. data/spec/core_ext/math_spec.rb +116 -116
  810. data/spec/core_ext/matrix_spec.rb +66 -66
  811. data/spec/core_ext/objectspace_spec.rb +29 -29
  812. data/spec/core_ext/range_spec.rb +21 -21
  813. data/spec/core_ext/socket_spec.rb +32 -32
  814. data/spec/core_ext/string_spec.rb +223 -223
  815. data/spec/core_ext/stringio_spec.rb +21 -21
  816. data/spec/core_ext/time_spec.rb +151 -151
  817. data/spec/gui/line_graph/line_clip_spec.rb +322 -322
  818. data/spec/install/config/system/system.txt +33 -33
  819. data/spec/install/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -41
  820. data/spec/install/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -15
  821. data/spec/install/config/targets/COSMOS/cmd_tlm_server.txt +6 -6
  822. data/spec/install/config/targets/COSMOS/screens/limits_change.txt +20 -20
  823. data/spec/install/config/targets/COSMOS/screens/version.txt +19 -19
  824. data/spec/install/config/targets/COSMOS/target.txt +5 -5
  825. data/spec/install/config/targets/INST/cmd_tlm/inst_cmd_linc.txt +30 -30
  826. data/spec/install/config/targets/INST/cmd_tlm/inst_cmds.txt +111 -111
  827. data/spec/install/config/targets/INST/cmd_tlm/inst_tlm.txt +236 -236
  828. data/spec/install/config/targets/INST/cmd_tlm/inst_tlm_linc.txt +25 -25
  829. data/spec/install/config/targets/INST/cmd_tlm_server.txt +5 -5
  830. data/spec/install/config/targets/INST/lib/sim_inst.rb +305 -294
  831. data/spec/install/config/targets/INST/target.txt +10 -10
  832. data/spec/install/config/targets/META/cmd_tlm/meta_cmd.txt +4 -4
  833. data/spec/install/config/targets/META/cmd_tlm/meta_tlm.txt +4 -4
  834. data/spec/install/config/targets/SYSTEM/cmd_tlm/limits_groups.txt +7 -7
  835. data/spec/interfaces/cmd_tlm_server_interface_spec.rb +150 -150
  836. data/spec/interfaces/interface_spec.rb +130 -131
  837. data/spec/interfaces/linc_interface_spec.rb +199 -199
  838. data/spec/interfaces/serial_interface_spec.rb +56 -56
  839. data/spec/interfaces/simulated_target_interface_spec.rb +128 -128
  840. data/spec/interfaces/stream_interface_spec.rb +157 -157
  841. data/spec/interfaces/tcpip_client_interface_spec.rb +54 -54
  842. data/spec/interfaces/tcpip_server_interface_spec.rb +151 -151
  843. data/spec/interfaces/udp_interface_spec.rb +175 -177
  844. data/spec/io/buffered_file_spec.rb +113 -113
  845. data/spec/io/io_multiplexer_spec.rb +94 -94
  846. data/spec/io/json_drb_object_spec.rb +99 -99
  847. data/spec/io/json_drb_spec.rb +311 -311
  848. data/spec/io/json_rpc_spec.rb +264 -264
  849. data/spec/io/raw_logger_pair_spec.rb +76 -76
  850. data/spec/io/raw_logger_spec.rb +133 -133
  851. data/spec/io/serial_driver_spec.rb +61 -61
  852. data/spec/io/stderr_spec.rb +32 -32
  853. data/spec/io/stdout_spec.rb +32 -32
  854. data/spec/io/tcpip_server_spec.rb +338 -338
  855. data/spec/io/udp_sockets_spec.rb +94 -94
  856. data/spec/io/win32_serial_driver_spec.rb +88 -88
  857. data/spec/packet_logs/meta_packet_log_writer_spec.rb +170 -170
  858. data/spec/packet_logs/packet_log_reader_spec.rb +408 -408
  859. data/spec/packet_logs/packet_log_writer_pair_spec.rb +30 -30
  860. data/spec/packet_logs/packet_log_writer_spec.rb +223 -223
  861. data/spec/packets/binary_accessor_spec.rb +2073 -2073
  862. data/spec/packets/commands_spec.rb +369 -369
  863. data/spec/packets/limits_response_spec.rb +25 -25
  864. data/spec/packets/limits_spec.rb +326 -326
  865. data/spec/packets/packet_config_spec.rb +1620 -1620
  866. data/spec/packets/packet_item_limits_spec.rb +161 -161
  867. data/spec/packets/packet_item_spec.rb +386 -386
  868. data/spec/packets/packet_spec.rb +1057 -949
  869. data/spec/packets/structure_item_spec.rb +195 -195
  870. data/spec/packets/structure_spec.rb +419 -419
  871. data/spec/packets/telemetry_spec.rb +535 -535
  872. data/spec/processors/new_packet_log_processor_spec.rb +39 -39
  873. data/spec/processors/processor_spec.rb +55 -55
  874. data/spec/processors/statistics_processor_spec.rb +60 -60
  875. data/spec/processors/watermark_processor_spec.rb +51 -51
  876. data/spec/script/script_spec.rb +654 -654
  877. data/spec/spec_helper.rb +154 -148
  878. data/spec/streams/burst_stream_protocol_spec.rb +32 -32
  879. data/spec/streams/fixed_stream_protocol_spec.rb +110 -110
  880. data/spec/streams/length_stream_protocol_spec.rb +297 -297
  881. data/spec/streams/preidentified_stream_protocol_spec.rb +118 -118
  882. data/spec/streams/serial_stream_spec.rb +105 -105
  883. data/spec/streams/stream_protocol_spec.rb +332 -332
  884. data/spec/streams/stream_spec.rb +29 -29
  885. data/spec/streams/tcpip_client_stream_spec.rb +54 -54
  886. data/spec/streams/tcpip_socket_stream_spec.rb +146 -146
  887. data/spec/streams/template_stream_protocol_spec.rb +151 -151
  888. data/spec/streams/terminated_stream_protocol_spec.rb +123 -123
  889. data/spec/system/system_spec.rb +645 -645
  890. data/spec/system/target_spec.rb +248 -248
  891. data/spec/tools/cmd_tlm_server/api_spec.rb +1087 -1113
  892. data/spec/tools/cmd_tlm_server/background_task_spec.rb +32 -32
  893. data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +81 -81
  894. data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +411 -411
  895. data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +415 -415
  896. data/spec/tools/cmd_tlm_server/commanding_spec.rb +123 -123
  897. data/spec/tools/cmd_tlm_server/connections_spec.rb +147 -147
  898. data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +306 -306
  899. data/spec/tools/cmd_tlm_server/interfaces_spec.rb +252 -238
  900. data/spec/tools/cmd_tlm_server/packet_logging_spec.rb +143 -143
  901. data/spec/tools/cmd_tlm_server/router_thread_spec.rb +98 -101
  902. data/spec/tools/cmd_tlm_server/routers_spec.rb +223 -208
  903. data/spec/top_level/top_level_spec.rb +334 -321
  904. data/spec/utilities/crc_spec.rb +45 -45
  905. data/spec/utilities/csv_spec.rb +97 -97
  906. data/spec/utilities/logger_spec.rb +102 -102
  907. data/spec/utilities/message_log_spec.rb +89 -89
  908. data/spec/utilities/quaternion_spec.rb +107 -107
  909. data/spec/utilities/ruby_lex_utils_spec.rb +86 -86
  910. data/tasks/manifest.rake +22 -22
  911. data/tasks/spec.rake +23 -23
  912. metadata +18 -2
@@ -1,41 +1,40 @@
1
- # encoding: ascii-8bit
2
-
3
- # Copyright 2014 Ball Aerospace & Technologies Corp.
4
- # All Rights Reserved.
5
- #
6
- # This program is free software; you can modify and/or redistribute it
7
- # under the terms of the GNU General Public License
8
- # as published by the Free Software Foundation; version 3 with
9
- # attribution addendums as found in the LICENSE.txt
10
-
11
- require 'cosmos'
12
- require 'cosmos/gui/qt'
13
-
14
- module Cosmos
15
-
16
- class LauncherMultitool < Qt::Object
17
- slots 'button_clicked()'
18
-
19
- def initialize(parent, multitool_settings, capture_io)
20
- super(parent)
21
- @multitool_settings = multitool_settings
22
- @capture_io = capture_io
23
- end
24
-
25
- def button_clicked
26
- @multitool_settings.each do |item_type, item|
27
- case item_type
28
- when :TOOL
29
- if @capture_io
30
- Cosmos.run_process_check_output(item)
31
- else
32
- Cosmos.run_process(item)
33
- end
34
- when :DELAY
35
- sleep(item)
36
- end
37
- end
38
- end
39
- end
40
-
41
- end
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2014 Ball Aerospace & Technologies Corp.
4
+ # All Rights Reserved.
5
+ #
6
+ # This program is free software; you can modify and/or redistribute it
7
+ # under the terms of the GNU General Public License
8
+ # as published by the Free Software Foundation; version 3 with
9
+ # attribution addendums as found in the LICENSE.txt
10
+
11
+ require 'cosmos'
12
+ require 'cosmos/gui/qt'
13
+
14
+ module Cosmos
15
+
16
+ class LauncherMultitool < Qt::Object
17
+ slots 'button_clicked()'
18
+
19
+ def initialize(parent, multitool_settings)
20
+ super(parent)
21
+ @multitool_settings = multitool_settings
22
+ end
23
+
24
+ def button_clicked
25
+ @multitool_settings.each do |item_type, item, capture_io|
26
+ case item_type
27
+ when :TOOL
28
+ if capture_io
29
+ Cosmos.run_process_check_output(item)
30
+ else
31
+ Cosmos.run_process(item)
32
+ end
33
+ when :DELAY
34
+ sleep(item)
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ end
@@ -1,104 +1,104 @@
1
- # encoding: ascii-8bit
2
-
3
- # Copyright 2014 Ball Aerospace & Technologies Corp.
4
- # All Rights Reserved.
5
- #
6
- # This program is free software; you can modify and/or redistribute it
7
- # under the terms of the GNU General Public License
8
- # as published by the Free Software Foundation; version 3 with
9
- # attribution addendums as found in the LICENSE.txt
10
-
11
- require 'cosmos'
12
- require 'cosmos/gui/qt'
13
-
14
- module Cosmos
15
-
16
- class LauncherTool < Qt::Object
17
- slots 'button_clicked()'
18
-
19
- def initialize(parent, button_text, shell_command, capture_io, variable_parameters)
20
- super(parent)
21
- @button_text = button_text
22
- @shell_command = shell_command
23
- @capture_io = capture_io
24
- @variable_parameters = variable_parameters
25
- end
26
-
27
- def button_clicked
28
- if @variable_parameters
29
- parameters = parameters_dialog()
30
- if parameters
31
- if @capture_io
32
- Cosmos.run_process_check_output(@shell_command + ' ' + parameters)
33
- else
34
- Cosmos.run_process(@shell_command + ' ' + parameters)
35
- end
36
- end
37
- else
38
- if @capture_io
39
- Cosmos.run_process_check_output(@shell_command)
40
- else
41
- Cosmos.run_process(@shell_command)
42
- end
43
- end
44
- end
45
-
46
- def parameters_dialog
47
- dialog = Qt::Dialog.new(self.parent)
48
- dialog.window_title = "#{@button_text} Options"
49
- layout = Qt::VBoxLayout.new
50
- dialog.layout = layout
51
-
52
- widgets = []
53
- @variable_parameters.each do |parameter_name, parameter_value|
54
- hlayout = Qt::HBoxLayout.new
55
- hlayout.addWidget(Qt::Label.new(parameter_name))
56
- line_edit = Qt::LineEdit.new()
57
- line_edit.setText(parameter_value)
58
- hlayout.addWidget(line_edit)
59
- widgets << line_edit
60
- layout.addLayout(hlayout)
61
- end
62
-
63
- ok_button = Qt::PushButton.new('Ok')
64
- connect(ok_button, SIGNAL('clicked()'), dialog, SLOT('accept()'))
65
- cancel_button = Qt::PushButton.new('Cancel')
66
- connect(cancel_button, SIGNAL('clicked()'), dialog, SLOT('reject()'))
67
-
68
- hlayout = Qt::HBoxLayout.new
69
- hlayout.addWidget(ok_button, 0, Qt::AlignLeft)
70
- hlayout.addWidget(cancel_button, 0, Qt::AlignRight)
71
- layout.addLayout(hlayout)
72
-
73
- dialog.resize(400, 0)
74
- cursor_pos = Qt::Cursor.pos
75
- x_pos = cursor_pos.x - 200
76
- y_pos = cursor_pos.y - 50
77
- if x_pos < 0
78
- x_pos = 0
79
- elsif x_pos > (Qt::Application.desktop.width - dialog.frameGeometry.width)
80
- x_pos = Qt::Application.desktop.width - dialog.frameGeometry.width
81
- end
82
- dialog.move(x_pos, y_pos)
83
-
84
- result = dialog.exec
85
- if result == Qt::Dialog::Accepted
86
- parameters = ''
87
- index = 0
88
- @variable_parameters.each do |parameter_name, parameter_value|
89
- parameters << parameter_name
90
- parameters << ' '
91
- parameters << widgets[index].text
92
- parameters << ' '
93
- index += 1
94
- end
95
- dialog.dispose
96
- return parameters
97
- else
98
- dialog.dispose
99
- return nil
100
- end
101
- end
102
- end
103
-
104
- end
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2014 Ball Aerospace & Technologies Corp.
4
+ # All Rights Reserved.
5
+ #
6
+ # This program is free software; you can modify and/or redistribute it
7
+ # under the terms of the GNU General Public License
8
+ # as published by the Free Software Foundation; version 3 with
9
+ # attribution addendums as found in the LICENSE.txt
10
+
11
+ require 'cosmos'
12
+ require 'cosmos/gui/qt'
13
+
14
+ module Cosmos
15
+
16
+ class LauncherTool < Qt::Object
17
+ slots 'button_clicked()'
18
+
19
+ def initialize(parent, button_text, shell_command, capture_io, variable_parameters)
20
+ super(parent)
21
+ @button_text = button_text
22
+ @shell_command = shell_command
23
+ @capture_io = capture_io
24
+ @variable_parameters = variable_parameters
25
+ end
26
+
27
+ def button_clicked
28
+ if @variable_parameters
29
+ parameters = parameters_dialog()
30
+ if parameters
31
+ if @capture_io
32
+ Cosmos.run_process_check_output(@shell_command + ' ' + parameters)
33
+ else
34
+ Cosmos.run_process(@shell_command + ' ' + parameters)
35
+ end
36
+ end
37
+ else
38
+ if @capture_io
39
+ Cosmos.run_process_check_output(@shell_command)
40
+ else
41
+ Cosmos.run_process(@shell_command)
42
+ end
43
+ end
44
+ end
45
+
46
+ def parameters_dialog
47
+ dialog = Qt::Dialog.new(self.parent)
48
+ dialog.window_title = "#{@button_text} Options"
49
+ layout = Qt::VBoxLayout.new
50
+ dialog.layout = layout
51
+
52
+ widgets = []
53
+ @variable_parameters.each do |parameter_name, parameter_value|
54
+ hlayout = Qt::HBoxLayout.new
55
+ hlayout.addWidget(Qt::Label.new(parameter_name))
56
+ line_edit = Qt::LineEdit.new()
57
+ line_edit.setText(parameter_value)
58
+ hlayout.addWidget(line_edit)
59
+ widgets << line_edit
60
+ layout.addLayout(hlayout)
61
+ end
62
+
63
+ ok_button = Qt::PushButton.new('Ok')
64
+ connect(ok_button, SIGNAL('clicked()'), dialog, SLOT('accept()'))
65
+ cancel_button = Qt::PushButton.new('Cancel')
66
+ connect(cancel_button, SIGNAL('clicked()'), dialog, SLOT('reject()'))
67
+
68
+ hlayout = Qt::HBoxLayout.new
69
+ hlayout.addWidget(ok_button, 0, Qt::AlignLeft)
70
+ hlayout.addWidget(cancel_button, 0, Qt::AlignRight)
71
+ layout.addLayout(hlayout)
72
+
73
+ dialog.resize(400, 0)
74
+ cursor_pos = Qt::Cursor.pos
75
+ x_pos = cursor_pos.x - 200
76
+ y_pos = cursor_pos.y - 50
77
+ if x_pos < 0
78
+ x_pos = 0
79
+ elsif x_pos > (Qt::Application.desktop.width - dialog.frameGeometry.width)
80
+ x_pos = Qt::Application.desktop.width - dialog.frameGeometry.width
81
+ end
82
+ dialog.move(x_pos, y_pos)
83
+
84
+ result = dialog.exec
85
+ if result == Qt::Dialog::Accepted
86
+ parameters = ''
87
+ index = 0
88
+ @variable_parameters.each do |parameter_name, parameter_value|
89
+ parameters << parameter_name
90
+ parameters << ' '
91
+ parameters << widgets[index].text
92
+ parameters << ' '
93
+ index += 1
94
+ end
95
+ dialog.dispose
96
+ return parameters
97
+ else
98
+ dialog.dispose
99
+ return nil
100
+ end
101
+ end
102
+ end
103
+
104
+ end
@@ -1,768 +1,796 @@
1
- # encoding: ascii-8bit
2
-
3
- # Copyright 2014 Ball Aerospace & Technologies Corp.
4
- # All Rights Reserved.
5
- #
6
- # This program is free software; you can modify and/or redistribute it
7
- # under the terms of the GNU General Public License
8
- # as published by the Free Software Foundation; version 3 with
9
- # attribution addendums as found in the LICENSE.txt
10
-
11
- require 'cosmos'
12
- Cosmos.catch_fatal_exception do
13
- require 'cosmos/gui/qt_tool'
14
- require 'cosmos/gui/dialogs/splash'
15
- require 'cosmos/gui/dialogs/cmd_tlm_raw_dialog'
16
- require 'cosmos/script'
17
- require 'cosmos/tools/tlm_viewer/widgets/labelvaluelimitsbar_widget'
18
- end
19
-
20
- class Array
21
- def includes_item?(item)
22
- self.each do |target, pkt_name, item_name|
23
- if ((target == item[0]) and (pkt_name == item[1]) and (item_name == item[2]))
24
- return true
25
- end
26
- end
27
- return false
28
- end
29
-
30
- def delete_item(item)
31
- index = 0
32
- delete_index = nil
33
- self.each do |target, pkt_name, item_name|
34
- if ((target == item[0]) and (pkt_name == item[1]) and (item_name == item[2]))
35
- delete_index = index
36
- break
37
- end
38
- index += 1
39
- end
40
-
41
- self.delete_at(delete_index) if delete_index
42
- return delete_index
43
- end
44
- end
45
-
46
- module Cosmos
47
-
48
- # The LimitsMonitor application displays all the out of limits items
49
- # encountered by the COSMOS server. It provides the ability to ignore and
50
- # restore limits as well as logs all limits events.
51
- class LimitsMonitor < QtTool
52
- slots 'options()'
53
- slots 'reset()'
54
- slots 'handle_clear_ignored_items()'
55
- slots 'handle_view_ignored_items()'
56
- slots 'handle_save_ignored_items()'
57
- slots 'handle_open_ignored_items()'
58
-
59
- # Set up class variables, tab-book with main panel and log panel, menus, and
60
- # status bar on main panel.
61
- #
62
- # @param options [Options] Contains the options for the window.
63
- def initialize(options)
64
- super(options)
65
- Cosmos.load_cosmos_icon("limits_monitor.png")
66
-
67
- @out_of_limits_items = []
68
- @queue_id = nil
69
- @limits_set = nil
70
- @widgets = []
71
- @widget_hframes = []
72
- @value_limits_set = nil
73
- @items = []
74
- @new_items = []
75
- @initialized = false
76
- @overall_limits_state = :STALE
77
- @ignored_items = []
78
- @ignored_filename = nil
79
- @colorblind = false
80
- @new_widgets = []
81
- @buttons = []
82
-
83
- statusBar.showMessage(tr(""))
84
-
85
- initialize_actions()
86
- initialize_menus()
87
- complete_initialize()
88
-
89
- @tabbook = Qt::TabWidget.new(self)
90
- setCentralWidget(@tabbook)
91
- @widget = Qt::Widget.new
92
- @layout = Qt::VBoxLayout.new(@widget)
93
-
94
- @monitored_state_text_field = Qt::LineEdit.new(self)
95
- @monitored_state_text_field.setText('Stale')
96
- @monitored_state_text_field.setAlignment(Qt::AlignCenter)
97
- @monitored_state_text_field.setReadOnly(true)
98
- @palette = Qt::Palette.new()
99
- @palette.setColor(Qt::Palette::Base, Qt::Color.new(255,0,255))
100
- @monitored_state_text_field.setPalette(@palette)
101
- @state_label = Qt::Label.new('Monitored Limits State: ')
102
-
103
- @monitored_state_frame = Qt::HBoxLayout.new
104
- @monitored_state_frame.addWidget(@state_label)
105
- @monitored_state_frame.addWidget(@monitored_state_text_field)
106
- label = Qt::Label.new
107
- filename = File.join(::Cosmos::PATH, 'data', 'spinner.gif')
108
- movie = Qt::Movie.new(filename)
109
- label.setMovie(movie)
110
- movie.start
111
- @monitored_state_frame.addWidget(label)
112
-
113
- @monitored_state_frame.setAlignment(Qt::AlignTop)
114
-
115
- @scroll = Qt::ScrollArea.new
116
- @scroll_widget = Qt::Widget.new
117
- @scroll_layout = Qt::VBoxLayout.new(@scroll_widget)
118
- @scroll_layout.setSizeConstraint(Qt::Layout::SetMinAndMaxSize)
119
-
120
- @scroll.setWidget(@scroll_widget)
121
-
122
- @layout.addLayout(@monitored_state_frame)
123
- @layout.addWidget(@scroll)
124
-
125
- @log_output = Qt::PlainTextEdit.new
126
- @log_output.setReadOnly(true)
127
- @log_output.setMaximumBlockCount(10000)
128
-
129
- @tabbook.addTab(@widget, "Limits")
130
- @tabbook.addTab(@log_output, "Log")
131
-
132
- # Process config file if present
133
- process_config(File.join(::Cosmos::USERPATH, 'config', 'tools', 'limits_monitor', options.config_file)) if options.config_file
134
-
135
- # Start thread to monitor limits
136
- value_thread()
137
- limits_thread()
138
- end # initialize
139
-
140
- # Slot to add items to the front panel when they are out of limits.
141
- #
142
- # @param target_name [String] Target name of out of limits item.
143
- # @param packet_name [String] Packet name of out of limits item.
144
- # @param item_name [String] Item name of out of limits item.
145
- def add_items(target_name, packet_name, item_name)
146
- Qt.execute_in_main_thread(true) do
147
- hlayout = Qt::HBoxLayout.new
148
- hlayout.setSpacing(0)
149
- hlayout.setContentsMargins(0,0,0,0)
150
- @scroll_layout.addLayout(hlayout)
151
-
152
- item = [target_name, packet_name, item_name]
153
- new_widget = LabelvaluelimitsbarWidget.new(hlayout, target_name, packet_name, item_name)
154
- new_widget.set_setting('COLORBLIND', [@colorblind])
155
- new_widget.process_settings
156
-
157
- ignore_button = Qt::PushButton.new('Ignore')
158
- ignore_button.connect(SIGNAL('clicked()')) do
159
- ignore_item(item)
160
- end
161
-
162
- hlayout.addWidget(ignore_button)
163
-
164
- @widget_hframes << hlayout
165
- @new_widgets << new_widget
166
- @widgets << new_widget
167
- @buttons << ignore_button
168
- end
169
- end
170
-
171
- # Slot to update the log panel with limits change information.
172
- #
173
- # @param to_add [String] Text string with information about which item is out of
174
- # limits, what its value is, and what limit was broken (red_low, yellow_low, etc.)
175
- # @param color [int] Integer representing color of text to add.
176
- def update_log(to_add, color)
177
- Qt.execute_in_main_thread(true) do
178
- @tf = Qt::TextCharFormat.new
179
- case color
180
- when 0
181
- brush = Cosmos.getBrush(Cosmos::GREEN)
182
- when 1
183
- brush = Cosmos.getBrush(Cosmos::YELLOW)
184
- when 2
185
- brush = Cosmos.getBrush(Cosmos::RED)
186
- when 3
187
- brush = Cosmos.getBrush(Cosmos::BLUE)
188
- else
189
- brush = Cosmos.getBrush(Cosmos::BLACK)
190
- end
191
- @tf.setForeground(brush)
192
- @log_output.setCurrentCharFormat(@tf)
193
- @log_output.appendPlainText(to_add.chomp)
194
- @tf.dispose
195
- end
196
- end
197
-
198
- # Sets up the menu bar with selectable options and the signal/slot combinations
199
- # for when those options are selected.
200
- def initialize_menus
201
- # File Menu
202
- @file_menu = menuBar.addMenu(tr('&File'))
203
-
204
- @options_action = Qt::Action.new(tr('O&ptions'), self)
205
- @options_action.statusTip = tr('Open the options dialog')
206
- connect(@options_action, SIGNAL('triggered()'), self, SLOT('options()'))
207
-
208
- @reset_action = Qt::Action.new(tr('&Reset'), self)
209
- @reset_action_keyseq = Qt::KeySequence.new(tr('Ctrl+R'))
210
- @reset_action.shortcut = @reset_action_keyseq
211
- @reset_action.statusTip = tr('Reset connection and clear all items. This does not modify the ignored items.')
212
- connect(@reset_action, SIGNAL('triggered()'), self, SLOT('reset()'))
213
-
214
- @open_ignored_action = Qt::Action.new(Cosmos.get_icon('open.png'),
215
- tr('&Open Config'), self)
216
- @open_ignored_action_keyseq = Qt::KeySequence.new(tr('Ctrl+O'))
217
- @open_ignored_action.shortcut = @open_ignored_action_keyseq
218
- @open_ignored_action.statusTip = tr('Open ignored telemetry items configuration file')
219
- connect(@open_ignored_action, SIGNAL('triggered()'), self, SLOT('handle_open_ignored_items()'))
220
-
221
- @save_ignored_action = Qt::Action.new(Cosmos.get_icon('save.png'),
222
- tr('&Save Config'), self)
223
- @save_ignored_action_keyseq = Qt::KeySequence.new(tr('Ctrl+S'))
224
- @save_ignored_action.shortcut = @save_ignored_action_keyseq
225
- @save_ignored_action.statusTip = tr('Save all ignored telemetry items in a configuration file')
226
- connect(@save_ignored_action, SIGNAL('triggered()'), self, SLOT('handle_save_ignored_items()'))
227
-
228
- @clear_ignored_action = Qt::Action.new(tr('&Clear Ignored'), self)
229
- @clear_ignored_action.statusTip = tr('Clear all ignored telemetry items so they become monitored')
230
- connect(@clear_ignored_action, SIGNAL('triggered()'), self, SLOT('handle_clear_ignored_items()'))
231
-
232
- @view_ignored_action = Qt::Action.new(tr('&View Ignored'), self)
233
- @view_ignored_action.statusTip = tr('View the ignored telemetry items list')
234
- connect(@view_ignored_action, SIGNAL('triggered()'), self, SLOT('handle_view_ignored_items()'))
235
-
236
- @file_menu.addAction(@open_ignored_action)
237
- @file_menu.addAction(@save_ignored_action)
238
- @file_menu.addAction(@clear_ignored_action)
239
- @file_menu.addAction(@view_ignored_action)
240
- @file_menu.addSeparator()
241
- @file_menu.addAction(@reset_action)
242
- @file_menu.addAction(@options_action)
243
- @file_menu.addSeparator()
244
- @file_menu.addAction(@exit_action)
245
-
246
- # Help Menu
247
- @about_string = "Limits Monitor displays all telemetry items that are or have been out of limits since it was started or reset."
248
-
249
- initialize_help_menu()
250
- end
251
-
252
- # Slot to handle the options menu item when selected.
253
- def options
254
- Qt::Dialog.new(self) do |dialog|
255
- dialog.setWindowTitle('Options')
256
-
257
- colorblind_box = Qt::CheckBox.new('Colorblind Mode Enabled', self)
258
- if (@colorblind)
259
- colorblind_box.setCheckState(Qt::Checked)
260
- end
261
-
262
- ok = Qt::PushButton.new('Ok') do
263
- connect(SIGNAL('clicked()')) { dialog.accept }
264
- end
265
-
266
- cancel = Qt::PushButton.new('Cancel') do
267
- connect(SIGNAL('clicked()')) { dialog.reject }
268
- end
269
-
270
- buttons = Qt::HBoxLayout.new do
271
- addWidget(ok)
272
- addWidget(cancel)
273
- end
274
-
275
- dialog.layout = Qt::VBoxLayout.new do
276
- addWidget(colorblind_box)
277
- addLayout(buttons)
278
- end
279
-
280
- case dialog.exec
281
- when Qt::Dialog::Accepted
282
- if (colorblind_box.checkState() == Qt::Checked)
283
- @colorblind = true
284
- else
285
- @colorblind = false
286
- end
287
- @widgets.each do |widget|
288
- widget.set_setting('COLORBLIND', [@colorblind])
289
- widget.process_settings
290
- end
291
- end
292
- dialog.dispose
293
- end
294
- end
295
-
296
- # Slot to handle the resent menu item when selected.
297
- def reset
298
- @initialized = false
299
- end
300
-
301
- # Sets up the thread to monitor for broken limits and add them to the log and
302
- # front panel when found.
303
- def limits_thread
304
- @limits_thread = Thread.new do
305
- begin
306
- while true
307
- begin
308
- initialized = nil
309
- Qt.execute_in_main_thread(true) do
310
- initialized = @initialized
311
- end
312
- unless initialized
313
- @limits_set = nil
314
- Qt.execute_in_main_thread(true) do
315
- @out_of_limits_items = []
316
- end
317
- unsubscribe_limits_events(@queue_id) if @queue_id
318
- @queue_id = nil
319
-
320
- handle_reset()
321
-
322
- # Get the current limits set
323
- @limits_set = get_limits_set()
324
-
325
- # Subscribe to limits notifications
326
- @queue_id = subscribe_limits_events(100000)
327
-
328
- # Get initial list of out of limits items
329
- items = get_out_of_limits()
330
- unless items.empty?
331
- Qt.execute_in_main_thread(true) do
332
- items.each do |item|
333
- unless @ignored_items.includes_item?(item) and !@items.includes_item?(item)
334
- @new_items << [item[0], item[1], item[2]]
335
- @out_of_limits_items << [item[0], item[1], item[2]]
336
- end
337
- end
338
- handle_new_items()
339
- end
340
- end
341
-
342
- Qt.execute_in_main_thread(true) do
343
- @initialized = true
344
- if @ignored_items.empty?
345
- statusBar.showMessage(tr(""))
346
- else
347
- statusBar.showMessage('Warning: Some Telemetry Items are Ignored')
348
- end
349
- end
350
-
351
- end
352
-
353
- begin
354
- type, data = get_limits_event(@queue_id, true)
355
- rescue ThreadError
356
- sleep(1)
357
- next
358
- end
359
-
360
- case type
361
- when :LIMITS_CHANGE
362
- item = [data[0], data[1], data[2]]
363
- if data[4] != :GREEN and data[4] != :GREEN_HIGH and data[4] != :GREEN_LOW and data[4] != :BLUE and data[4] != nil
364
- case data[4]
365
- when :YELLOW, :YELLOW_HIGH, :YELLOW_LOW
366
- to_print = Time.now.formatted << ' ' << "WARN: #{data[0]} #{data[1]} #{data[2]} = #{tlm(data[0], data[1], data[2])} is #{data[4]}\n"
367
- update_log(to_print, 1)
368
- when :RED, :RED_HIGH, :RED_LOW
369
- to_print = Time.now.formatted << ' ' << "ERROR: #{data[0]} #{data[1]} #{data[2]} = #{tlm(data[0], data[1], data[2])} is #{data[4]}\n"
370
- update_log(to_print, 2)
371
- end
372
-
373
- # Limits changed to non-green
374
- unless @out_of_limits_items.includes_item?(item) or @ignored_items.includes_item?(item)
375
- @out_of_limits_items << item
376
- @new_items << item
377
- handle_new_items()
378
- end
379
- elsif data[4] == :GREEN or data[4] == :GREEN_HIGH or data[4] == :GREEN_LOW or data[4] == :BLUE
380
- to_print = Time.now.formatted << ' ' << "INFO: #{data[0]} #{data[1]} #{data[2]} = #{tlm(data[0], data[1], data[2])} returned to GREEN\n"
381
-
382
- if data[4] == :BLUE
383
- update_log(to_print, 3)
384
- else
385
- update_log(to_print, 0)
386
- end
387
- end
388
-
389
- when :LIMITS_SET
390
- if @limits_set != data
391
- Qt.execute_in_main_thread(true) do
392
- statusBar.showMessage('Limits Set Changed - Reseting')
393
- @initialized = false
394
- to_print = Time.now.formatted << ' ' << "INFO: Limits Set Changed to: #{data}\n"
395
- update_log(to_print, 4)
396
- end
397
- end
398
-
399
- when :LIMITS_SETTINGS
400
- begin
401
- System.limits.set(data[0], data[1], data[2], data[6], data[7], data[8], data[9], data[10], data[11], data[3], data[4], data[5])
402
- Qt.execute_in_main_thread(true) do
403
- statusBar.showMessage('Limits Settings Changed - Reseting')
404
- @initialized = false
405
- to_print = Time.now.formatted << ' ' << "INFO: Limits Settings Changed: #{data}\n"
406
- update_log(to_print, 4)
407
- end
408
- rescue
409
- # This can fail if we missed setting the DEFAULT limits set earlier - Oh well
410
- end
411
- end
412
-
413
- rescue DRb::DRbConnError
414
- @queue_id = nil
415
- Qt.execute_in_main_thread(true) do
416
- statusBar.showMessage('Error Connecting to Command and Telemetry Server - Reseting')
417
- @initialized = false
418
- end
419
- sleep(1)
420
- end
421
- end # loop
422
- rescue Exception => error
423
- Cosmos.handle_fatal_exception(error)
424
- end
425
- end
426
- end
427
-
428
- # Sets up the thread to monitor the limits values and update them when they
429
- # change, as well as updating the status bar at the top of the front panel.
430
- def value_thread
431
- @value_thread = Thread.new do
432
- begin
433
- begin
434
- while true
435
- unless @items.empty?
436
- Qt.execute_in_main_thread(true) do
437
- begin
438
- # Gather items for widgets
439
- values, limits_states, limits_settings, limits_set = get_tlm_values(@items, :WITH_UNITS)
440
- index = 0
441
- @items.each do |target_name, packet_name, item_name|
442
- begin
443
- System.limits.set(target_name, packet_name, item_name, limits_settings[index][0], limits_settings[index][1], limits_settings[index][2], limits_settings[index][3], limits_settings[index][4], limits_settings[index][5], limits_set) if limits_settings[index]
444
- rescue
445
- # This can fail if we missed setting the DEFAULT limits set earlier - Oh well
446
- end
447
- index += 1
448
- end
449
-
450
- # Handle change in limits set
451
- if limits_set != @value_limits_set
452
- @value_limits_set = limits_set
453
- @widgets.each do |widget|
454
- widget.limits_set = @value_limits_set
455
- end
456
- end
457
-
458
- # Update widgets with values and limits_states
459
- @overall_limits_state = :STALE
460
- (0..(values.length - 1)).each do |widget_index|
461
- limits_state = limits_states[widget_index]
462
- @widgets[widget_index].limits_state = limits_state
463
- @widgets[widget_index].value = values[widget_index]
464
- end
465
-
466
- # Update overall limits state
467
- modify_overall_limits_state(get_overall_limits_state(@ignored_items))
468
- update_overall_limits_state()
469
- rescue DRb::DRbConnError
470
- # Do nothing
471
- end
472
- end
473
- else
474
- @overall_limits_state = :STALE
475
- Qt.execute_in_main_thread(true) do
476
- begin
477
- modify_overall_limits_state(get_overall_limits_state(@ignored_items))
478
- rescue DRb::DRbConnError
479
- # Do nothing
480
- end
481
- update_overall_limits_state()
482
- end
483
- end
484
-
485
- # Sleep until next polling period
486
- sleep(1)
487
- end
488
- rescue DRb::DRbConnError
489
- sleep(1)
490
- end
491
- rescue Exception => error
492
- Cosmos.handle_fatal_exception(error)
493
- end
494
- end
495
- end
496
-
497
- # Checks for the current worst limits state.
498
- #
499
- # @param limits_state [Symbol] State of the current limit being checked.
500
- def modify_overall_limits_state(limits_state)
501
- case @overall_limits_state
502
- when :STALE
503
- @overall_limits_state = limits_state
504
- when :BLUE
505
- if limits_state != nil and limits_state != :STALE
506
- @overall_limits_state = limits_state
507
- end
508
- when :GREEN, :GREEN_HIGH, :GREEN_LOW
509
- if limits_state != nil and limits_state != :STALE and limits_state != :BLUE
510
- @overall_limits_state = limits_state
511
- end
512
- when :YELLOW, :YELLOW_HIGH, :YELLOW_LOW
513
- if limits_state == :RED or limits_state == :RED_HIGH or limits_state == :RED_LOW
514
- @overall_limits_state = limits_state
515
- end
516
- end
517
- end
518
-
519
- # Changes the limits state on the status bar at the top of the screen.
520
- def update_overall_limits_state
521
- text = ''
522
- case @overall_limits_state
523
- when :STALE
524
- palette = Cosmos.getPalette(Cosmos.getColor(0, 0, 0), Cosmos.getColor(255,0,255))
525
- @monitored_state_text_field.setPalette(palette)
526
- text = 'Stale'
527
- when :GREEN, :GREEN_HIGH, :GREEN_LOW
528
- palette = Cosmos.getPalette(Cosmos.getColor(0, 0, 0), Cosmos.getColor(0,255,0))
529
- @monitored_state_text_field.setPalette(palette)
530
- text = 'Green'
531
- when :YELLOW, :YELLOW_HIGH, :YELLOW_LOW
532
- palette = Cosmos.getPalette(Cosmos.getColor(0, 0, 0), Cosmos.getColor(255,255,0))
533
- @monitored_state_text_field.setPalette(palette)
534
- text = 'Yellow'
535
- when :RED, :RED_HIGH, :RED_LOW
536
- palette = Cosmos.getPalette(Cosmos.getColor(0, 0, 0), Cosmos.getColor(255,0,0))
537
- @monitored_state_text_field.setPalette(palette)
538
- text = 'Red'
539
- when :BLUE
540
- palette = Cosmos.getPalette(Cosmos.getColor(0, 0, 0), Cosmos.getColor(0,0,255))
541
- @monitored_state_text_field.setPalette(palette)
542
- text = 'Blue'
543
- end
544
- text << ' - Some Items Ignored' unless @ignored_items.empty?
545
- @monitored_state_text_field.text = text
546
- end
547
-
548
- # Slot to handle when the clear ignored items menu option is selected.
549
- def handle_clear_ignored_items
550
- @ignored_items.clear
551
- @initialized = false
552
- statusBar.showMessage('')
553
- end
554
-
555
- # Slot to handle when the view ignored items menu option is selected.
556
- def handle_view_ignored_items
557
- # Turn Command into scripting text string
558
- string = ''
559
- @ignored_items.each do |item|
560
- string << "#{item[0]} #{item[1]} #{item[2]}\n"
561
- end
562
-
563
- # Show Dialog box with text displaying ignored items
564
- Qt::Dialog.new(self) do |dialog|
565
- dialog.setWindowTitle('Ignored Telemetry Items')
566
- text = Qt::PlainTextEdit.new
567
- text.setReadOnly(true)
568
- text.setPlainText(string) if string
569
-
570
- ok = Qt::PushButton.new('Ok') do
571
- connect(SIGNAL('clicked()')) { dialog.done(0) }
572
- end
573
-
574
- dialog.layout = Qt::VBoxLayout.new do
575
- addWidget(text)
576
- addWidget(ok)
577
- end
578
-
579
- dialog.resize(500, 200)
580
- dialog.exec
581
- dialog.dispose
582
- end
583
- end
584
-
585
- # Slot to handle when the save ignored items menu option is selected.
586
- def handle_save_ignored_items
587
- if @ignored_filename
588
- filename = Qt::FileDialog.getSaveFileName(self, 'Save As...', @ignored_filename, 'Configuration Files (*.txt)')
589
- else
590
- filename = Qt::FileDialog.getSaveFileName(self, 'Save As...', File.join(::Cosmos::USERPATH, 'config', 'tools', 'limits_monitor', 'limits_monitor.txt'), 'Configuration Files (*.txt)')
591
- end
592
- unless filename.nil? or filename.empty?
593
- begin
594
- File.open(filename, "w") do |file|
595
- @ignored_items.each do |target, pkt_name, item_name|
596
- file.puts("IGNORE #{target} #{pkt_name} #{item_name}")
597
- end
598
- end
599
- statusBar.showMessage("#{filename} saved")
600
- rescue => e
601
- statusBar.showMessage("Error Saving Configuration : #{e.message}")
602
- end
603
- end
604
- end
605
-
606
- # Slot to handle when the load ignored items menu option is selected.
607
- def handle_open_ignored_items
608
- if @ignored_filename
609
- filename = Qt::FileDialog::getOpenFileName(self, "Open Configuration File", @ignored_filename)
610
- else
611
- filename = Qt::FileDialog::getOpenFileName(self, "Open Configuration File", File.join(::Cosmos::USERPATH, 'config', 'tools', 'limits_monitor', 'limits_monitor.txt'))
612
- end
613
- unless filename.nil? or filename.empty?
614
- process_config(filename)
615
- end
616
- end
617
-
618
- # Handle config file if present.
619
- #
620
- # @param filename [String] Filename for the config file if present.
621
- def process_config(filename)
622
- @initialized = false
623
- @ignored_items = []
624
-
625
- begin
626
- parser = ConfigParser.new
627
- parser.parse_file(filename) do |keyword, params|
628
- case keyword
629
- when 'IGNORE'
630
- ignore_item([params[0], params[1], params[2]])
631
- end
632
- end
633
- statusBar.showMessage("#{filename} loaded")
634
- rescue => e
635
- statusBar.showMessage("Error Loading Configuration : #{e.message}")
636
- end
637
- end
638
-
639
- # Update front panel to ignore an item when the corresponding button is pressed.
640
- #
641
- # @param item [Array] Array containing the target, packet, and item name of the
642
- # item to ignore.
643
- def ignore_item(item)
644
- Qt.execute_in_main_thread(true) do
645
- @ignored_items << item
646
- delete_index = @items.delete_item(item)
647
- if delete_index
648
- hframe_to_dispose = @widget_hframes[delete_index]
649
- widget_to_dispose = @widgets[delete_index]
650
- button_to_dispose = @buttons[delete_index]
651
- @widgets.delete_at(delete_index)
652
- @buttons.delete_at(delete_index)
653
- @widget_hframes.delete_at(delete_index)
654
- @scroll_layout.removeItem(hframe_to_dispose)
655
- widget_to_dispose.dispose
656
- button_to_dispose.dispose
657
- hframe_to_dispose.dispose
658
- @scroll.repaint
659
- end
660
- statusBar.showMessage('Warning: Some Telemetry Items are Ignored')
661
- end
662
- end
663
-
664
- # Process any new items that become out of limits.
665
- def handle_new_items
666
- @new_widgets = []
667
-
668
- Qt.execute_in_main_thread(true) do
669
- @new_items.each do |target, pkt_name, item_name|
670
- # Create widgets for new items
671
- add_items(target, pkt_name, item_name)
672
- end
673
- end
674
-
675
- # Set initial values
676
-
677
- Qt.execute_in_main_thread(true) do
678
- begin
679
- values, limits_states, limits_settings, limits_set = get_tlm_values(@new_items, :WITH_UNITS)
680
- index = 0
681
- @new_items.each do |target_name, packet_name, item_name|
682
- begin
683
- System.limits.set(target_name, packet_name, item_name, limits_settings[index][0], limits_settings[index][1], limits_settings[index][2], limits_settings[index][3], limits_settings[index][4], limits_settings[index][5], limits_set) if limits_settings[index]
684
- rescue
685
- # This can fail if we missed setting the DEFAULT limits set earlier - Oh well
686
- end
687
- index += 1
688
- end
689
- index = 0
690
-
691
- @new_widgets.each do |widget|
692
- limits_state = limits_states[index]
693
- widget.limits_set = limits_set
694
- widget.limits_state = limits_state
695
- widget.value = values[index]
696
- index += 1
697
- modify_overall_limits_state(limits_state)
698
- end
699
-
700
- update_overall_limits_state()
701
-
702
- @new_items.each do |item|
703
- @items << item
704
- end
705
- @new_items = []
706
- rescue DRb::DRbConnError
707
- statusBar.showMessage('Error Connecting to Command and Telemetry Server - Reseting')
708
- @initialized = false
709
- end
710
- end
711
- end
712
-
713
- # Reset front panel and log when the reset menu option is selected.
714
- def handle_reset
715
- Qt.execute_in_main_thread(true) do
716
- @widgets.each {|widget| widget.dispose}
717
- @buttons.each {|button| button.dispose}
718
- @widget_hframes.each do |hframe|
719
- @scroll_layout.removeItem(hframe)
720
- hframe.dispose
721
- end
722
- @scroll.repaint
723
-
724
- @widgets = []
725
- @new_widgets = []
726
- @buttons = []
727
- @widget_hframes = []
728
- @items = []
729
- @value_limits_set = :DEFAULT
730
-
731
- @overall_limits_state = :STALE
732
- update_overall_limits_state()
733
- end
734
- end
735
-
736
- # Handle the window closing.
737
- def closeEvent(event)
738
- @limits_thread.kill
739
- @value_thread.kill
740
- super(event)
741
- end
742
-
743
- # Initialize tool options.
744
- def self.run(option_parser = nil, options = nil)
745
- Cosmos.catch_fatal_exception do
746
- unless option_parser and options
747
- option_parser, options = create_default_options()
748
- options.width = 600
749
- options.height = 500
750
- options.remember_geometry = false
751
- options.title = "Limits Monitor"
752
- options.auto_size = false
753
- options.config_file = nil
754
- options.production = false
755
- options.no_prompt = false
756
- option_parser.separator "Limits Monitor Specific Options:"
757
- option_parser.on("-c", "--config FILE", "Use the specified configuration file") do |arg|
758
- options.config_file = arg
759
- end
760
- end
761
-
762
- super(option_parser, options)
763
- end
764
- end
765
-
766
- end # class LimitsMonitor
767
-
768
- 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'
12
+ Cosmos.catch_fatal_exception do
13
+ require 'cosmos/gui/qt_tool'
14
+ require 'cosmos/gui/dialogs/splash'
15
+ require 'cosmos/gui/dialogs/cmd_tlm_raw_dialog'
16
+ require 'cosmos/script'
17
+ require 'cosmos/tools/tlm_viewer/widgets/labelvaluelimitsbar_widget'
18
+ end
19
+
20
+ class Array
21
+ def includes_item?(item)
22
+ self.each do |target, pkt_name, item_name|
23
+ if ((target == item[0]) and (pkt_name == item[1]) and (item_name == item[2]))
24
+ return true
25
+ end
26
+ end
27
+ return false
28
+ end
29
+
30
+ def delete_item(item)
31
+ index = 0
32
+ delete_index = nil
33
+ self.each do |target, pkt_name, item_name|
34
+ if ((target == item[0]) and (pkt_name == item[1]) and (item_name == item[2]))
35
+ delete_index = index
36
+ break
37
+ end
38
+ index += 1
39
+ end
40
+
41
+ self.delete_at(delete_index) if delete_index
42
+ return delete_index
43
+ end
44
+ end
45
+
46
+ module Cosmos
47
+
48
+ # The LimitsMonitor application displays all the out of limits items
49
+ # encountered by the COSMOS server. It provides the ability to ignore and
50
+ # restore limits as well as logs all limits events.
51
+ class LimitsMonitor < QtTool
52
+ slots 'options()'
53
+ slots 'reset()'
54
+ slots 'handle_clear_ignored_items()'
55
+ slots 'handle_view_ignored_items()'
56
+ slots 'handle_save_ignored_items()'
57
+ slots 'handle_open_ignored_items()'
58
+
59
+ # Set up class variables, tab-book with main panel and log panel, menus, and
60
+ # status bar on main panel.
61
+ #
62
+ # @param options [Options] Contains the options for the window.
63
+ def initialize(options)
64
+ super(options)
65
+ Cosmos.load_cosmos_icon("limits_monitor.png")
66
+
67
+ @out_of_limits_items = []
68
+ @queue_id = nil
69
+ @limits_set = nil
70
+ @widgets = []
71
+ @widget_hframes = []
72
+ @value_limits_set = nil
73
+ @items = []
74
+ @new_items = []
75
+ @initialized = false
76
+ @overall_limits_state = :STALE
77
+ @ignored_items = []
78
+ @ignored_filename = nil
79
+ @colorblind = false
80
+ @new_widgets = []
81
+ @buttons = []
82
+ @cancel_thread = false
83
+ @limits_sleeper = Sleeper.new
84
+ @value_sleeper = Sleeper.new
85
+
86
+ statusBar.showMessage(tr(""))
87
+
88
+ initialize_actions()
89
+ initialize_menus()
90
+ complete_initialize()
91
+
92
+ @tabbook = Qt::TabWidget.new(self)
93
+ setCentralWidget(@tabbook)
94
+ @widget = Qt::Widget.new
95
+ @layout = Qt::VBoxLayout.new(@widget)
96
+
97
+ @monitored_state_text_field = Qt::LineEdit.new(self)
98
+ @monitored_state_text_field.setText('Stale')
99
+ @monitored_state_text_field.setAlignment(Qt::AlignCenter)
100
+ @monitored_state_text_field.setReadOnly(true)
101
+ @palette = Qt::Palette.new()
102
+ @palette.setColor(Qt::Palette::Base, Qt::Color.new(255,0,255))
103
+ @monitored_state_text_field.setPalette(@palette)
104
+ @state_label = Qt::Label.new('Monitored Limits State: ')
105
+
106
+ @monitored_state_frame = Qt::HBoxLayout.new
107
+ @monitored_state_frame.addWidget(@state_label)
108
+ @monitored_state_frame.addWidget(@monitored_state_text_field)
109
+ label = Qt::Label.new
110
+ filename = File.join(::Cosmos::PATH, 'data', 'spinner.gif')
111
+ movie = Qt::Movie.new(filename)
112
+ label.setMovie(movie)
113
+ movie.start
114
+ @monitored_state_frame.addWidget(label)
115
+
116
+ @monitored_state_frame.setAlignment(Qt::AlignTop)
117
+
118
+ @scroll = Qt::ScrollArea.new
119
+ @scroll_widget = Qt::Widget.new
120
+ @scroll_layout = Qt::VBoxLayout.new(@scroll_widget)
121
+ @scroll_layout.setSizeConstraint(Qt::Layout::SetMinAndMaxSize)
122
+
123
+ @scroll.setWidget(@scroll_widget)
124
+
125
+ @layout.addLayout(@monitored_state_frame)
126
+ @layout.addWidget(@scroll)
127
+
128
+ @log_output = Qt::PlainTextEdit.new
129
+ @log_output.setReadOnly(true)
130
+ @log_output.setMaximumBlockCount(10000)
131
+
132
+ @tabbook.addTab(@widget, "Limits")
133
+ @tabbook.addTab(@log_output, "Log")
134
+
135
+ # Process config file if present
136
+ process_config(File.join(::Cosmos::USERPATH, 'config', 'tools', 'limits_monitor', options.config_file)) if options.config_file
137
+
138
+ # Start thread to monitor limits
139
+ value_thread()
140
+ limits_thread()
141
+ end # initialize
142
+
143
+ # Slot to add items to the front panel when they are out of limits.
144
+ #
145
+ # @param target_name [String] Target name of out of limits item.
146
+ # @param packet_name [String] Packet name of out of limits item.
147
+ # @param item_name [String] Item name of out of limits item.
148
+ def add_items(target_name, packet_name, item_name)
149
+ Qt.execute_in_main_thread(true) do
150
+ hlayout = Qt::HBoxLayout.new
151
+ hlayout.setSpacing(0)
152
+ hlayout.setContentsMargins(0,0,0,0)
153
+ @scroll_layout.addLayout(hlayout)
154
+
155
+ item = [target_name, packet_name, item_name]
156
+ new_widget = LabelvaluelimitsbarWidget.new(hlayout, target_name, packet_name, item_name)
157
+ new_widget.set_setting('COLORBLIND', [@colorblind])
158
+ new_widget.process_settings
159
+
160
+ ignore_button = Qt::PushButton.new('Ignore')
161
+ ignore_button.connect(SIGNAL('clicked()')) do
162
+ ignore_item(item)
163
+ end
164
+
165
+ hlayout.addWidget(ignore_button)
166
+
167
+ @widget_hframes << hlayout
168
+ @new_widgets << new_widget
169
+ @widgets << new_widget
170
+ @buttons << ignore_button
171
+ end
172
+ end
173
+
174
+ # Slot to update the log panel with limits change information.
175
+ #
176
+ # @param to_add [String] Text string with information about which item is out of
177
+ # limits, what its value is, and what limit was broken (red_low, yellow_low, etc.)
178
+ # @param color [int] Integer representing color of text to add.
179
+ def update_log(to_add, color)
180
+ return if @cancel_thread
181
+ Qt.execute_in_main_thread(true) do
182
+ @tf = Qt::TextCharFormat.new
183
+ case color
184
+ when 0
185
+ brush = Cosmos.getBrush(Cosmos::GREEN)
186
+ when 1
187
+ brush = Cosmos.getBrush(Cosmos::YELLOW)
188
+ when 2
189
+ brush = Cosmos.getBrush(Cosmos::RED)
190
+ when 3
191
+ brush = Cosmos.getBrush(Cosmos::BLUE)
192
+ else
193
+ brush = Cosmos.getBrush(Cosmos::BLACK)
194
+ end
195
+ @tf.setForeground(brush)
196
+ @log_output.setCurrentCharFormat(@tf)
197
+ @log_output.appendPlainText(to_add.chomp)
198
+ @tf.dispose
199
+ end
200
+ end
201
+
202
+ # Sets up the menu bar with selectable options and the signal/slot combinations
203
+ # for when those options are selected.
204
+ def initialize_menus
205
+ # File Menu
206
+ @file_menu = menuBar.addMenu(tr('&File'))
207
+
208
+ @options_action = Qt::Action.new(tr('O&ptions'), self)
209
+ @options_action.statusTip = tr('Open the options dialog')
210
+ connect(@options_action, SIGNAL('triggered()'), self, SLOT('options()'))
211
+
212
+ @reset_action = Qt::Action.new(tr('&Reset'), self)
213
+ @reset_action_keyseq = Qt::KeySequence.new(tr('Ctrl+R'))
214
+ @reset_action.shortcut = @reset_action_keyseq
215
+ @reset_action.statusTip = tr('Reset connection and clear all items. This does not modify the ignored items.')
216
+ connect(@reset_action, SIGNAL('triggered()'), self, SLOT('reset()'))
217
+
218
+ @open_ignored_action = Qt::Action.new(Cosmos.get_icon('open.png'),
219
+ tr('&Open Config'), self)
220
+ @open_ignored_action_keyseq = Qt::KeySequence.new(tr('Ctrl+O'))
221
+ @open_ignored_action.shortcut = @open_ignored_action_keyseq
222
+ @open_ignored_action.statusTip = tr('Open ignored telemetry items configuration file')
223
+ connect(@open_ignored_action, SIGNAL('triggered()'), self, SLOT('handle_open_ignored_items()'))
224
+
225
+ @save_ignored_action = Qt::Action.new(Cosmos.get_icon('save.png'),
226
+ tr('&Save Config'), self)
227
+ @save_ignored_action_keyseq = Qt::KeySequence.new(tr('Ctrl+S'))
228
+ @save_ignored_action.shortcut = @save_ignored_action_keyseq
229
+ @save_ignored_action.statusTip = tr('Save all ignored telemetry items in a configuration file')
230
+ connect(@save_ignored_action, SIGNAL('triggered()'), self, SLOT('handle_save_ignored_items()'))
231
+
232
+ @clear_ignored_action = Qt::Action.new(tr('&Clear Ignored'), self)
233
+ @clear_ignored_action.statusTip = tr('Clear all ignored telemetry items so they become monitored')
234
+ connect(@clear_ignored_action, SIGNAL('triggered()'), self, SLOT('handle_clear_ignored_items()'))
235
+
236
+ @view_ignored_action = Qt::Action.new(tr('&View Ignored'), self)
237
+ @view_ignored_action.statusTip = tr('View the ignored telemetry items list')
238
+ connect(@view_ignored_action, SIGNAL('triggered()'), self, SLOT('handle_view_ignored_items()'))
239
+
240
+ @file_menu.addAction(@open_ignored_action)
241
+ @file_menu.addAction(@save_ignored_action)
242
+ @file_menu.addAction(@clear_ignored_action)
243
+ @file_menu.addAction(@view_ignored_action)
244
+ @file_menu.addSeparator()
245
+ @file_menu.addAction(@reset_action)
246
+ @file_menu.addAction(@options_action)
247
+ @file_menu.addSeparator()
248
+ @file_menu.addAction(@exit_action)
249
+
250
+ # Help Menu
251
+ @about_string = "Limits Monitor displays all telemetry items that are or have been out of limits since it was started or reset."
252
+
253
+ initialize_help_menu()
254
+ end
255
+
256
+ # Slot to handle the options menu item when selected.
257
+ def options
258
+ Qt::Dialog.new(self) do |dialog|
259
+ dialog.setWindowTitle('Options')
260
+
261
+ colorblind_box = Qt::CheckBox.new('Colorblind Mode Enabled', self)
262
+ if (@colorblind)
263
+ colorblind_box.setCheckState(Qt::Checked)
264
+ end
265
+
266
+ ok = Qt::PushButton.new('Ok') do
267
+ connect(SIGNAL('clicked()')) { dialog.accept }
268
+ end
269
+
270
+ cancel = Qt::PushButton.new('Cancel') do
271
+ connect(SIGNAL('clicked()')) { dialog.reject }
272
+ end
273
+
274
+ buttons = Qt::HBoxLayout.new do
275
+ addWidget(ok)
276
+ addWidget(cancel)
277
+ end
278
+
279
+ dialog.layout = Qt::VBoxLayout.new do
280
+ addWidget(colorblind_box)
281
+ addLayout(buttons)
282
+ end
283
+
284
+ case dialog.exec
285
+ when Qt::Dialog::Accepted
286
+ if (colorblind_box.checkState() == Qt::Checked)
287
+ @colorblind = true
288
+ else
289
+ @colorblind = false
290
+ end
291
+ @widgets.each do |widget|
292
+ widget.set_setting('COLORBLIND', [@colorblind])
293
+ widget.process_settings
294
+ end
295
+ end
296
+ dialog.dispose
297
+ end
298
+ end
299
+
300
+ # Slot to handle the resent menu item when selected.
301
+ def reset
302
+ @initialized = false
303
+ end
304
+
305
+ # Sets up the thread to monitor for broken limits and add them to the log and
306
+ # front panel when found.
307
+ def limits_thread
308
+ @limits_thread = Thread.new do
309
+ begin
310
+ while true
311
+ break if @cancel_thread
312
+ begin
313
+ initialized = nil
314
+ break if @cancel_thread
315
+ Qt.execute_in_main_thread(true) do
316
+ initialized = @initialized
317
+ end
318
+ unless initialized
319
+ @limits_set = nil
320
+ break if @cancel_thread
321
+ Qt.execute_in_main_thread(true) do
322
+ @out_of_limits_items = []
323
+ end
324
+ unsubscribe_limits_events(@queue_id) if @queue_id
325
+ @queue_id = nil
326
+
327
+ handle_reset()
328
+
329
+ # Get the current limits set
330
+ @limits_set = get_limits_set()
331
+
332
+ # Subscribe to limits notifications
333
+ @queue_id = subscribe_limits_events(100000)
334
+
335
+ # Get initial list of out of limits items
336
+ items = get_out_of_limits()
337
+ unless items.empty?
338
+ break if @cancel_thread
339
+ Qt.execute_in_main_thread(true) do
340
+ items.each do |item|
341
+ unless @ignored_items.includes_item?(item) and !@items.includes_item?(item)
342
+ @new_items << [item[0], item[1], item[2]]
343
+ @out_of_limits_items << [item[0], item[1], item[2]]
344
+ end
345
+ end
346
+ handle_new_items()
347
+ end
348
+ end
349
+
350
+ break if @cancel_thread
351
+ Qt.execute_in_main_thread(true) do
352
+ @initialized = true
353
+ if @ignored_items.empty?
354
+ statusBar.showMessage(tr(""))
355
+ else
356
+ statusBar.showMessage('Warning: Some Telemetry Items are Ignored')
357
+ end
358
+ end
359
+
360
+ end
361
+
362
+ begin
363
+ break if @cancel_thread
364
+ type, data = get_limits_event(@queue_id, true)
365
+ break if @cancel_thread
366
+ rescue ThreadError
367
+ break if @cancel_thread
368
+ break if @limits_sleeper.sleep(1)
369
+ next
370
+ end
371
+
372
+ break if @cancel_thread
373
+
374
+ case type
375
+ when :LIMITS_CHANGE
376
+ item = [data[0], data[1], data[2]]
377
+ if data[4] != :GREEN and data[4] != :GREEN_HIGH and data[4] != :GREEN_LOW and data[4] != :BLUE and data[4] != nil
378
+ case data[4]
379
+ when :YELLOW, :YELLOW_HIGH, :YELLOW_LOW
380
+ to_print = Time.now.formatted << ' ' << "WARN: #{data[0]} #{data[1]} #{data[2]} = #{tlm(data[0], data[1], data[2])} is #{data[4]}\n"
381
+ update_log(to_print, 1)
382
+ when :RED, :RED_HIGH, :RED_LOW
383
+ to_print = Time.now.formatted << ' ' << "ERROR: #{data[0]} #{data[1]} #{data[2]} = #{tlm(data[0], data[1], data[2])} is #{data[4]}\n"
384
+ update_log(to_print, 2)
385
+ end
386
+
387
+ # Limits changed to non-green
388
+ unless @out_of_limits_items.includes_item?(item) or @ignored_items.includes_item?(item)
389
+ @out_of_limits_items << item
390
+ @new_items << item
391
+ handle_new_items()
392
+ end
393
+ elsif data[4] == :GREEN or data[4] == :GREEN_HIGH or data[4] == :GREEN_LOW or data[4] == :BLUE
394
+ to_print = Time.now.formatted << ' ' << "INFO: #{data[0]} #{data[1]} #{data[2]} = #{tlm(data[0], data[1], data[2])} returned to GREEN\n"
395
+
396
+ if data[4] == :BLUE
397
+ update_log(to_print, 3)
398
+ else
399
+ update_log(to_print, 0)
400
+ end
401
+ end
402
+
403
+ when :LIMITS_SET
404
+ if @limits_set != data
405
+ break if @cancel_thread
406
+ Qt.execute_in_main_thread(true) do
407
+ statusBar.showMessage('Limits Set Changed - Reseting')
408
+ @initialized = false
409
+ to_print = Time.now.formatted << ' ' << "INFO: Limits Set Changed to: #{data}\n"
410
+ update_log(to_print, 4)
411
+ end
412
+ break if @cancel_thread
413
+ end
414
+
415
+ when :LIMITS_SETTINGS
416
+ begin
417
+ System.limits.set(data[0], data[1], data[2], data[6], data[7], data[8], data[9], data[10], data[11], data[3], data[4], data[5])
418
+ break if @cancel_thread
419
+ Qt.execute_in_main_thread(true) do
420
+ statusBar.showMessage('Limits Settings Changed - Reseting')
421
+ @initialized = false
422
+ to_print = Time.now.formatted << ' ' << "INFO: Limits Settings Changed: #{data}\n"
423
+ update_log(to_print, 4)
424
+ end
425
+ break if @cancel_thread
426
+ rescue
427
+ # This can fail if we missed setting the DEFAULT limits set earlier - Oh well
428
+ end
429
+ end
430
+
431
+ rescue DRb::DRbConnError
432
+ break if @cancel_thread
433
+ @queue_id = nil
434
+ break if @cancel_thread
435
+ Qt.execute_in_main_thread(true) do
436
+ statusBar.showMessage('Error Connecting to Command and Telemetry Server - Reseting')
437
+ @initialized = false
438
+ end
439
+ break if @cancel_thread
440
+ break if @limits_sleeper.sleep(1)
441
+ end
442
+ end # loop
443
+ rescue Exception => error
444
+ Cosmos.handle_fatal_exception(error)
445
+ end
446
+ end
447
+ end
448
+
449
+ # Sets up the thread to monitor the limits values and update them when they
450
+ # change, as well as updating the status bar at the top of the front panel.
451
+ def value_thread
452
+ @value_thread = Thread.new do
453
+ begin
454
+ while true
455
+ break if @cancel_thread
456
+ unless @items.empty?
457
+ Qt.execute_in_main_thread(true) do
458
+ begin
459
+ # Gather items for widgets
460
+ values, limits_states, limits_settings, limits_set = get_tlm_values(@items, :WITH_UNITS)
461
+ index = 0
462
+ @items.each do |target_name, packet_name, item_name|
463
+ begin
464
+ System.limits.set(target_name, packet_name, item_name, limits_settings[index][0], limits_settings[index][1], limits_settings[index][2], limits_settings[index][3], limits_settings[index][4], limits_settings[index][5], limits_set) if limits_settings[index]
465
+ rescue
466
+ # This can fail if we missed setting the DEFAULT limits set earlier - Oh well
467
+ end
468
+ index += 1
469
+ end
470
+
471
+ # Handle change in limits set
472
+ if limits_set != @value_limits_set
473
+ @value_limits_set = limits_set
474
+ @widgets.each do |widget|
475
+ widget.limits_set = @value_limits_set
476
+ end
477
+ end
478
+
479
+ # Update widgets with values and limits_states
480
+ @overall_limits_state = :STALE
481
+ (0..(values.length - 1)).each do |widget_index|
482
+ limits_state = limits_states[widget_index]
483
+ @widgets[widget_index].limits_state = limits_state
484
+ @widgets[widget_index].value = values[widget_index]
485
+ end
486
+
487
+ # Update overall limits state
488
+ modify_overall_limits_state(get_overall_limits_state(@ignored_items))
489
+ update_overall_limits_state()
490
+ rescue DRb::DRbConnError
491
+ # Do nothing
492
+ end
493
+ end
494
+ else
495
+ @overall_limits_state = :STALE
496
+ break if @cancel_thread
497
+ Qt.execute_in_main_thread(true) do
498
+ begin
499
+ modify_overall_limits_state(get_overall_limits_state(@ignored_items))
500
+ rescue DRb::DRbConnError
501
+ # Do nothing
502
+ end
503
+ update_overall_limits_state()
504
+ end
505
+ end
506
+
507
+ # Sleep until next polling period
508
+ break if @value_sleeper.sleep(1)
509
+ end
510
+ rescue Exception => error
511
+ Cosmos.handle_fatal_exception(error)
512
+ end
513
+ end
514
+ end
515
+
516
+ # Checks for the current worst limits state.
517
+ #
518
+ # @param limits_state [Symbol] State of the current limit being checked.
519
+ def modify_overall_limits_state(limits_state)
520
+ case @overall_limits_state
521
+ when :STALE
522
+ @overall_limits_state = limits_state
523
+ when :BLUE
524
+ if limits_state != nil and limits_state != :STALE
525
+ @overall_limits_state = limits_state
526
+ end
527
+ when :GREEN, :GREEN_HIGH, :GREEN_LOW
528
+ if limits_state != nil and limits_state != :STALE and limits_state != :BLUE
529
+ @overall_limits_state = limits_state
530
+ end
531
+ when :YELLOW, :YELLOW_HIGH, :YELLOW_LOW
532
+ if limits_state == :RED or limits_state == :RED_HIGH or limits_state == :RED_LOW
533
+ @overall_limits_state = limits_state
534
+ end
535
+ end
536
+ end
537
+
538
+ # Changes the limits state on the status bar at the top of the screen.
539
+ def update_overall_limits_state
540
+ text = ''
541
+ case @overall_limits_state
542
+ when :STALE
543
+ palette = Cosmos.getPalette(Cosmos.getColor(0, 0, 0), Cosmos.getColor(255,0,255))
544
+ @monitored_state_text_field.setPalette(palette)
545
+ text = 'Stale'
546
+ when :GREEN, :GREEN_HIGH, :GREEN_LOW
547
+ palette = Cosmos.getPalette(Cosmos.getColor(0, 0, 0), Cosmos.getColor(0,255,0))
548
+ @monitored_state_text_field.setPalette(palette)
549
+ text = 'Green'
550
+ when :YELLOW, :YELLOW_HIGH, :YELLOW_LOW
551
+ palette = Cosmos.getPalette(Cosmos.getColor(0, 0, 0), Cosmos.getColor(255,255,0))
552
+ @monitored_state_text_field.setPalette(palette)
553
+ text = 'Yellow'
554
+ when :RED, :RED_HIGH, :RED_LOW
555
+ palette = Cosmos.getPalette(Cosmos.getColor(0, 0, 0), Cosmos.getColor(255,0,0))
556
+ @monitored_state_text_field.setPalette(palette)
557
+ text = 'Red'
558
+ when :BLUE
559
+ palette = Cosmos.getPalette(Cosmos.getColor(0, 0, 0), Cosmos.getColor(0,0,255))
560
+ @monitored_state_text_field.setPalette(palette)
561
+ text = 'Blue'
562
+ end
563
+ text << ' - Some Items Ignored' unless @ignored_items.empty?
564
+ @monitored_state_text_field.text = text
565
+ end
566
+
567
+ # Slot to handle when the clear ignored items menu option is selected.
568
+ def handle_clear_ignored_items
569
+ @ignored_items.clear
570
+ @initialized = false
571
+ statusBar.showMessage('')
572
+ end
573
+
574
+ # Slot to handle when the view ignored items menu option is selected.
575
+ def handle_view_ignored_items
576
+ # Turn Command into scripting text string
577
+ string = ''
578
+ @ignored_items.each do |item|
579
+ string << "#{item[0]} #{item[1]} #{item[2]}\n"
580
+ end
581
+
582
+ # Show Dialog box with text displaying ignored items
583
+ Qt::Dialog.new(self) do |dialog|
584
+ dialog.setWindowTitle('Ignored Telemetry Items')
585
+ text = Qt::PlainTextEdit.new
586
+ text.setReadOnly(true)
587
+ text.setPlainText(string) if string
588
+
589
+ ok = Qt::PushButton.new('Ok') do
590
+ connect(SIGNAL('clicked()')) { dialog.done(0) }
591
+ end
592
+
593
+ dialog.layout = Qt::VBoxLayout.new do
594
+ addWidget(text)
595
+ addWidget(ok)
596
+ end
597
+
598
+ dialog.resize(500, 200)
599
+ dialog.exec
600
+ dialog.dispose
601
+ end
602
+ end
603
+
604
+ # Slot to handle when the save ignored items menu option is selected.
605
+ def handle_save_ignored_items
606
+ if @ignored_filename
607
+ filename = Qt::FileDialog.getSaveFileName(self, 'Save As...', @ignored_filename, 'Configuration Files (*.txt)')
608
+ else
609
+ filename = Qt::FileDialog.getSaveFileName(self, 'Save As...', File.join(::Cosmos::USERPATH, 'config', 'tools', 'limits_monitor', 'limits_monitor.txt'), 'Configuration Files (*.txt)')
610
+ end
611
+ unless filename.nil? or filename.empty?
612
+ begin
613
+ File.open(filename, "w") do |file|
614
+ @ignored_items.each do |target, pkt_name, item_name|
615
+ file.puts("IGNORE #{target} #{pkt_name} #{item_name}")
616
+ end
617
+ end
618
+ statusBar.showMessage("#{filename} saved")
619
+ rescue => e
620
+ statusBar.showMessage("Error Saving Configuration : #{e.message}")
621
+ end
622
+ end
623
+ end
624
+
625
+ # Slot to handle when the load ignored items menu option is selected.
626
+ def handle_open_ignored_items
627
+ if @ignored_filename
628
+ filename = Qt::FileDialog::getOpenFileName(self, "Open Configuration File", @ignored_filename)
629
+ else
630
+ filename = Qt::FileDialog::getOpenFileName(self, "Open Configuration File", File.join(::Cosmos::USERPATH, 'config', 'tools', 'limits_monitor', 'limits_monitor.txt'))
631
+ end
632
+ unless filename.nil? or filename.empty?
633
+ process_config(filename)
634
+ end
635
+ end
636
+
637
+ # Handle config file if present.
638
+ #
639
+ # @param filename [String] Filename for the config file if present.
640
+ def process_config(filename)
641
+ @initialized = false
642
+ @ignored_items = []
643
+
644
+ begin
645
+ parser = ConfigParser.new
646
+ parser.parse_file(filename) do |keyword, params|
647
+ case keyword
648
+ when 'IGNORE'
649
+ ignore_item([params[0], params[1], params[2]])
650
+ end
651
+ end
652
+ statusBar.showMessage("#{filename} loaded")
653
+ rescue => e
654
+ statusBar.showMessage("Error Loading Configuration : #{e.message}")
655
+ end
656
+ end
657
+
658
+ # Update front panel to ignore an item when the corresponding button is pressed.
659
+ #
660
+ # @param item [Array] Array containing the target, packet, and item name of the
661
+ # item to ignore.
662
+ def ignore_item(item)
663
+ Qt.execute_in_main_thread(true) do
664
+ @ignored_items << item
665
+ delete_index = @items.delete_item(item)
666
+ if delete_index
667
+ hframe_to_dispose = @widget_hframes[delete_index]
668
+ widget_to_dispose = @widgets[delete_index]
669
+ button_to_dispose = @buttons[delete_index]
670
+ @widgets.delete_at(delete_index)
671
+ @buttons.delete_at(delete_index)
672
+ @widget_hframes.delete_at(delete_index)
673
+ @scroll_layout.removeItem(hframe_to_dispose)
674
+ widget_to_dispose.dispose
675
+ button_to_dispose.dispose
676
+ hframe_to_dispose.dispose
677
+ @scroll.repaint
678
+ end
679
+ statusBar.showMessage('Warning: Some Telemetry Items are Ignored')
680
+ end
681
+ end
682
+
683
+ # Process any new items that become out of limits.
684
+ def handle_new_items
685
+ @new_widgets = []
686
+
687
+ Qt.execute_in_main_thread(true) do
688
+ @new_items.each do |target, pkt_name, item_name|
689
+ # Create widgets for new items
690
+ add_items(target, pkt_name, item_name)
691
+ end
692
+ end
693
+
694
+ # Set initial values
695
+
696
+ Qt.execute_in_main_thread(true) do
697
+ begin
698
+ values, limits_states, limits_settings, limits_set = get_tlm_values(@new_items, :WITH_UNITS)
699
+ index = 0
700
+ @new_items.each do |target_name, packet_name, item_name|
701
+ begin
702
+ System.limits.set(target_name, packet_name, item_name, limits_settings[index][0], limits_settings[index][1], limits_settings[index][2], limits_settings[index][3], limits_settings[index][4], limits_settings[index][5], limits_set) if limits_settings[index]
703
+ rescue
704
+ # This can fail if we missed setting the DEFAULT limits set earlier - Oh well
705
+ end
706
+ index += 1
707
+ end
708
+ index = 0
709
+
710
+ @new_widgets.each do |widget|
711
+ limits_state = limits_states[index]
712
+ widget.limits_set = limits_set
713
+ widget.limits_state = limits_state
714
+ widget.value = values[index]
715
+ index += 1
716
+ modify_overall_limits_state(limits_state)
717
+ end
718
+
719
+ update_overall_limits_state()
720
+
721
+ @new_items.each do |item|
722
+ @items << item
723
+ end
724
+ @new_items = []
725
+ rescue DRb::DRbConnError
726
+ statusBar.showMessage('Error Connecting to Command and Telemetry Server - Reseting')
727
+ @initialized = false
728
+ end
729
+ end
730
+ end
731
+
732
+ # Reset front panel and log when the reset menu option is selected.
733
+ def handle_reset
734
+ Qt.execute_in_main_thread(true) do
735
+ @widgets.each {|widget| widget.dispose}
736
+ @buttons.each {|button| button.dispose}
737
+ @widget_hframes.each do |hframe|
738
+ @scroll_layout.removeItem(hframe)
739
+ hframe.dispose
740
+ end
741
+ @scroll.repaint
742
+
743
+ @widgets = []
744
+ @new_widgets = []
745
+ @buttons = []
746
+ @widget_hframes = []
747
+ @items = []
748
+ @value_limits_set = :DEFAULT
749
+
750
+ @overall_limits_state = :STALE
751
+ update_overall_limits_state()
752
+ end
753
+ end
754
+
755
+ # Handle the window closing.
756
+ def closeEvent(event)
757
+ @cancel_thread = true
758
+ @value_sleeper.cancel
759
+ @limits_sleeper.cancel
760
+ script_disconnect()
761
+ Cosmos.kill_thread(self, @limits_thread, 2)
762
+ Cosmos.kill_thread(self, @value_thread, 2)
763
+ super(event)
764
+ end
765
+
766
+ # Gracefully kill threads
767
+ def graceful_kill
768
+ Qt::CoreApplication.processEvents()
769
+ end
770
+
771
+ # Initialize tool options.
772
+ def self.run(option_parser = nil, options = nil)
773
+ Cosmos.catch_fatal_exception do
774
+ unless option_parser and options
775
+ option_parser, options = create_default_options()
776
+ options.width = 600
777
+ options.height = 500
778
+ options.remember_geometry = false
779
+ options.title = "Limits Monitor"
780
+ options.auto_size = false
781
+ options.config_file = nil
782
+ options.production = false
783
+ options.no_prompt = false
784
+ option_parser.separator "Limits Monitor Specific Options:"
785
+ option_parser.on("-c", "--config FILE", "Use the specified configuration file") do |arg|
786
+ options.config_file = arg
787
+ end
788
+ end
789
+
790
+ super(option_parser, options)
791
+ end
792
+ end
793
+
794
+ end # class LimitsMonitor
795
+
796
+ end # module Cosmos