adams-visiona 1.0.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 (1783) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTING.txt +50 -0
  3. data/Dockerfile +71 -0
  4. data/Gemfile +11 -0
  5. data/Guardfile +27 -0
  6. data/LICENSE.txt +879 -0
  7. data/Manifest.txt +1781 -0
  8. data/README.md +15 -0
  9. data/Rakefile +345 -0
  10. data/adams-visiona.gemspec +107 -0
  11. data/appveyor.yml +32 -0
  12. data/autohotkey/config/data/attitude.bin +0 -0
  13. data/autohotkey/config/data/diamond.STL +58 -0
  14. data/autohotkey/config/data/groundoff.gif +0 -0
  15. data/autohotkey/config/data/groundon.gif +0 -0
  16. data/autohotkey/config/data/position.bin +0 -0
  17. data/autohotkey/config/data/satellite.gif +0 -0
  18. data/autohotkey/config/data/tada.wav +0 -0
  19. data/autohotkey/config/system/system.txt +29 -0
  20. data/autohotkey/config/targets/INST/cmd_tlm/inst_cmds.txt +126 -0
  21. data/autohotkey/config/targets/INST/cmd_tlm/inst_tlm.txt +270 -0
  22. data/autohotkey/config/targets/INST/cmd_tlm_server.txt +5 -0
  23. data/autohotkey/config/targets/INST/doc/README.txt +1 -0
  24. data/autohotkey/config/targets/INST/lib/example_limits_response.rb +30 -0
  25. data/autohotkey/config/targets/INST/lib/sim_inst.rb +307 -0
  26. data/autohotkey/config/targets/INST/screens/_footer.txt +4 -0
  27. data/autohotkey/config/targets/INST/screens/adcs.txt +46 -0
  28. data/autohotkey/config/targets/INST/screens/array.txt +7 -0
  29. data/autohotkey/config/targets/INST/screens/block.txt +8 -0
  30. data/autohotkey/config/targets/INST/screens/commanding.txt +30 -0
  31. data/autohotkey/config/targets/INST/screens/extra.txt +19 -0
  32. data/autohotkey/config/targets/INST/screens/graphs.txt +14 -0
  33. data/autohotkey/config/targets/INST/screens/ground.txt +25 -0
  34. data/autohotkey/config/targets/INST/screens/health_status.txt +33 -0
  35. data/autohotkey/config/targets/INST/screens/hs.txt +46 -0
  36. data/autohotkey/config/targets/INST/screens/image.txt +21 -0
  37. data/autohotkey/config/targets/INST/screens/latest.txt +23 -0
  38. data/autohotkey/config/targets/INST/screens/mech.txt +25 -0
  39. data/autohotkey/config/targets/INST/screens/other.txt +25 -0
  40. data/autohotkey/config/targets/INST/screens/params.txt +25 -0
  41. data/autohotkey/config/targets/INST/screens/tabs.txt +68 -0
  42. data/autohotkey/config/targets/INST/sequences/run_sequence.txt +1 -0
  43. data/autohotkey/config/targets/INST/target.txt +27 -0
  44. data/autohotkey/config/targets/META/cmd_tlm/meta_cmd.txt +10 -0
  45. data/autohotkey/config/targets/META/cmd_tlm/meta_tlm.txt +9 -0
  46. data/autohotkey/config/targets/META/screens/data.txt +12 -0
  47. data/autohotkey/config/targets/SYSTEM/cmd_tlm/limits_groups.txt +7 -0
  48. data/autohotkey/config/targets/SYSTEM/cmd_tlm/meta_cmd_tlm.txt +16 -0
  49. data/autohotkey/config/targets/SYSTEM/cmd_tlm/system_cmds.txt +41 -0
  50. data/autohotkey/config/targets/SYSTEM/cmd_tlm/system_tlm.txt +7 -0
  51. data/autohotkey/config/targets/SYSTEM/screens/error.txt +11 -0
  52. data/autohotkey/config/targets/SYSTEM/screens/limits_change.txt +14 -0
  53. data/autohotkey/config/targets/SYSTEM/screens/meta.txt +14 -0
  54. data/autohotkey/config/targets/SYSTEM/target.txt +12 -0
  55. data/autohotkey/config/tools/cmd_sender/cmd_sender.txt +1 -0
  56. data/autohotkey/config/tools/cmd_sequence/cmd_sequence.txt +2 -0
  57. data/autohotkey/config/tools/cmd_tlm_server/cmd_tlm_server.txt +22 -0
  58. data/autohotkey/config/tools/data_viewer/data_viewer.txt +11 -0
  59. data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
  60. data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
  61. data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
  62. data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
  63. data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  64. data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
  65. data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  66. data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  67. data/autohotkey/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
  68. data/autohotkey/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
  69. data/autohotkey/config/tools/handbook_creator/default_toc.xsl +59 -0
  70. data/autohotkey/config/tools/handbook_creator/handbook_creator.txt +49 -0
  71. data/autohotkey/config/tools/handbook_creator/templates/command_packets.html.erb +86 -0
  72. data/autohotkey/config/tools/handbook_creator/templates/command_toc.html.erb +38 -0
  73. data/autohotkey/config/tools/handbook_creator/templates/footer.html.erb +9 -0
  74. data/autohotkey/config/tools/handbook_creator/templates/header.html.erb +25 -0
  75. data/autohotkey/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -0
  76. data/autohotkey/config/tools/handbook_creator/templates/nav.html.erb +27 -0
  77. data/autohotkey/config/tools/handbook_creator/templates/overview.html.erb +1 -0
  78. data/autohotkey/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -0
  79. data/autohotkey/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -0
  80. data/autohotkey/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -0
  81. data/autohotkey/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -0
  82. data/autohotkey/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -0
  83. data/autohotkey/config/tools/handbook_creator/templates/title.html.erb +1 -0
  84. data/autohotkey/config/tools/launcher/launcher.txt +38 -0
  85. data/autohotkey/config/tools/limits_monitor/README.txt +1 -0
  86. data/autohotkey/config/tools/opengl_builder/error.txt +1 -0
  87. data/autohotkey/config/tools/script_runner/script_runner.txt +3 -0
  88. data/autohotkey/config/tools/table_manager/ConfigTables_def.txt +6 -0
  89. data/autohotkey/config/tools/table_manager/OldOneDimensionalTable_def.txt +19 -0
  90. data/autohotkey/config/tools/table_manager/OldTwoDimensionalTable_def.txt +248 -0
  91. data/autohotkey/config/tools/table_manager/OneDimensionalTable_def.txt +31 -0
  92. data/autohotkey/config/tools/table_manager/SubTables/OneDimensionalSubTable_def.txt +31 -0
  93. data/autohotkey/config/tools/table_manager/SubTables/TwoDimensionalSubTable_def.txt +28 -0
  94. data/autohotkey/config/tools/table_manager/TwoDimensionalTable_def.txt +28 -0
  95. data/autohotkey/config/tools/test_runner/test_runner.txt +8 -0
  96. data/autohotkey/config/tools/test_runner/test_runner2.txt +11 -0
  97. data/autohotkey/config/tools/test_runner/test_runner3.txt +7 -0
  98. data/autohotkey/config/tools/test_runner/test_runner4.txt +1 -0
  99. data/autohotkey/config/tools/tlm_extractor/tlm_extractor.txt +14 -0
  100. data/autohotkey/config/tools/tlm_extractor/tlm_extractor2.txt +9 -0
  101. data/autohotkey/config/tools/tlm_grapher/README.txt +1 -0
  102. data/autohotkey/config/tools/tlm_grapher/bad.txt +50 -0
  103. data/autohotkey/config/tools/tlm_grapher/temp1-4.txt +51 -0
  104. data/autohotkey/config/tools/tlm_grapher/test2.txt +111 -0
  105. data/autohotkey/config/tools/tlm_viewer/tlm_viewer.txt +24 -0
  106. data/autohotkey/config/tools/tlm_viewer/tlm_viewer2.txt +4 -0
  107. data/autohotkey/config/tools/tlm_viewer/tlm_viewer3.txt +3 -0
  108. data/autohotkey/lib/cmd_sequence_exporter.rb +52 -0
  109. data/autohotkey/lib/example_background_task.rb +42 -0
  110. data/autohotkey/lib/user_version.rb +3 -0
  111. data/autohotkey/outputs/handbooks/README.txt +1 -0
  112. data/autohotkey/outputs/logs/bigtlm.bin +0 -0
  113. data/autohotkey/outputs/logs/cmd.bin +0 -0
  114. data/autohotkey/outputs/logs/tlm.bin +0 -0
  115. data/autohotkey/outputs/saved_config/README.txt +1 -0
  116. data/autohotkey/outputs/sequences/bad_sequence.txt +1 -0
  117. data/autohotkey/outputs/sequences/bad_sequence2.txt +1 -0
  118. data/autohotkey/outputs/sequences/saved_sequence.txt +3 -0
  119. data/autohotkey/outputs/tables/README.txt +1 -0
  120. data/autohotkey/outputs/tmp/README.txt +1 -0
  121. data/autohotkey/procedures/clear_util.rb +7 -0
  122. data/autohotkey/procedures/collect.rb +18 -0
  123. data/autohotkey/procedures/collect_util.rb +14 -0
  124. data/autohotkey/procedures/example_test.rb +71 -0
  125. data/autohotkey/procedures/example_test2.rb +74 -0
  126. data/autohotkey/procedures/script_test.rb +21 -0
  127. data/autohotkey/procedures/syntax_error.rb +18 -0
  128. data/autohotkey/tools/CmdExtractorAHK +16 -0
  129. data/autohotkey/tools/CmdSender +14 -0
  130. data/autohotkey/tools/CmdSenderAHK +18 -0
  131. data/autohotkey/tools/CmdSenderAHK2 +18 -0
  132. data/autohotkey/tools/CmdSequence +14 -0
  133. data/autohotkey/tools/CmdSequenceAHK +23 -0
  134. data/autohotkey/tools/CmdSequenceAHK2 +16 -0
  135. data/autohotkey/tools/CmdTlmServer +14 -0
  136. data/autohotkey/tools/CmdTlmServerAHK +28 -0
  137. data/autohotkey/tools/CmdTlmServerAHK2 +17 -0
  138. data/autohotkey/tools/ConfigEditor +16 -0
  139. data/autohotkey/tools/ConfigEditorAHK +19 -0
  140. data/autohotkey/tools/DataViewer +14 -0
  141. data/autohotkey/tools/DataViewerAHK +17 -0
  142. data/autohotkey/tools/HandbookCreatorAHK +20 -0
  143. data/autohotkey/tools/LauncherAHK +17 -0
  144. data/autohotkey/tools/LimitsMonitorAHK +20 -0
  145. data/autohotkey/tools/OpenGLBuilderAHK +24 -0
  146. data/autohotkey/tools/PacketViewer +14 -0
  147. data/autohotkey/tools/PacketViewerAHK +18 -0
  148. data/autohotkey/tools/PacketViewerAHK2 +17 -0
  149. data/autohotkey/tools/Replay +14 -0
  150. data/autohotkey/tools/ReplayAHK +17 -0
  151. data/autohotkey/tools/ScriptRunner +14 -0
  152. data/autohotkey/tools/ScriptRunnerAHK +20 -0
  153. data/autohotkey/tools/ScriptRunnerAHK2 +17 -0
  154. data/autohotkey/tools/TableManager +14 -0
  155. data/autohotkey/tools/TableManagerAHK +25 -0
  156. data/autohotkey/tools/TableManagerAHK2 +18 -0
  157. data/autohotkey/tools/TableManagerAHK3 +18 -0
  158. data/autohotkey/tools/TableManagerAHK4 +24 -0
  159. data/autohotkey/tools/TestRunner +15 -0
  160. data/autohotkey/tools/TestRunnerAHK +17 -0
  161. data/autohotkey/tools/TestRunnerAHK2 +17 -0
  162. data/autohotkey/tools/TestRunnerAHK3 +17 -0
  163. data/autohotkey/tools/TestRunnerAHK4 +17 -0
  164. data/autohotkey/tools/TestRunnerAHK5 +17 -0
  165. data/autohotkey/tools/TestRunnerAHK6 +17 -0
  166. data/autohotkey/tools/TlmExtractor +15 -0
  167. data/autohotkey/tools/TlmExtractorAHK +19 -0
  168. data/autohotkey/tools/TlmExtractorAHK2 +16 -0
  169. data/autohotkey/tools/TlmExtractorAHK3 +16 -0
  170. data/autohotkey/tools/TlmGrapher +14 -0
  171. data/autohotkey/tools/TlmGrapherAHK +19 -0
  172. data/autohotkey/tools/TlmGrapherAHK2 +23 -0
  173. data/autohotkey/tools/TlmGrapherAHK3 +17 -0
  174. data/autohotkey/tools/TlmGrapherAHK4 +17 -0
  175. data/autohotkey/tools/TlmViewer +14 -0
  176. data/autohotkey/tools/TlmViewerAHK +28 -0
  177. data/autohotkey/tools/TlmViewerAHK2 +22 -0
  178. data/autohotkey/tools/TlmViewerAHK3 +23 -0
  179. data/autohotkey/tools/TlmViewerAHK4 +22 -0
  180. data/autohotkey/tools/TlmViewerAHK5 +18 -0
  181. data/autohotkey/tools/autohotkey.rb +38 -0
  182. data/autohotkey/tools/cmd_extractor.ahk +52 -0
  183. data/autohotkey/tools/cmd_sender.ahk +208 -0
  184. data/autohotkey/tools/cmd_sender2.ahk +4 -0
  185. data/autohotkey/tools/cmd_sequence.ahk +233 -0
  186. data/autohotkey/tools/cmd_sequence2.ahk +23 -0
  187. data/autohotkey/tools/cmd_tlm_server.ahk +90 -0
  188. data/autohotkey/tools/cmd_tlm_server2.ahk +45 -0
  189. data/autohotkey/tools/config_editor.ahk +197 -0
  190. data/autohotkey/tools/data_viewer.ahk +140 -0
  191. data/autohotkey/tools/handbook_creator.ahk +32 -0
  192. data/autohotkey/tools/launcher.ahk +42 -0
  193. data/autohotkey/tools/limits_monitor.ahk +121 -0
  194. data/autohotkey/tools/open_gl_builder.ahk +133 -0
  195. data/autohotkey/tools/packet_viewer.ahk +224 -0
  196. data/autohotkey/tools/packet_viewer2.ahk +9 -0
  197. data/autohotkey/tools/replay.ahk +103 -0
  198. data/autohotkey/tools/script_runner.ahk +602 -0
  199. data/autohotkey/tools/script_runner2.ahk +50 -0
  200. data/autohotkey/tools/table_manager.ahk +291 -0
  201. data/autohotkey/tools/test_runner.ahk +262 -0
  202. data/autohotkey/tools/test_runner2.ahk +49 -0
  203. data/autohotkey/tools/test_runner3.ahk +11 -0
  204. data/autohotkey/tools/test_runner5.ahk +8 -0
  205. data/autohotkey/tools/test_runner6.ahk +5 -0
  206. data/autohotkey/tools/tlm_extractor.ahk +356 -0
  207. data/autohotkey/tools/tlm_grapher.ahk +670 -0
  208. data/autohotkey/tools/tlm_grapher2.ahk +115 -0
  209. data/autohotkey/tools/tlm_grapher3.ahk +23 -0
  210. data/autohotkey/tools/tlm_viewer.ahk +140 -0
  211. data/autohotkey/tools/tlm_viewer2.ahk +49 -0
  212. data/autohotkey/tools/tlm_viewer4.ahk +4 -0
  213. data/autohotkey/tools/tlm_viewer5.ahk +19 -0
  214. data/autohotkey/tools/tool_launch.rb +38 -0
  215. data/bin/cosmos +303 -0
  216. data/bin/cstol_converter +1166 -0
  217. data/bin/dart_import +4 -0
  218. data/bin/dart_util +4 -0
  219. data/bin/exchndl20-x64.dll +0 -0
  220. data/bin/exchndl20.dll +0 -0
  221. data/bin/exchndl21-x64.dll +0 -0
  222. data/bin/exchndl21.dll +0 -0
  223. data/bin/exchndl22-x64.dll +0 -0
  224. data/bin/exchndl22.dll +0 -0
  225. data/bin/mgwhelp-x64.dll +0 -0
  226. data/bin/mgwhelp.dll +0 -0
  227. data/bin/rubysloc +130 -0
  228. data/bin/xtce_converter +83 -0
  229. data/data/COSMOS_64x64.bmp +0 -0
  230. data/data/COSMOS_64x64.ico +0 -0
  231. data/data/COSMOS_64x64.png +0 -0
  232. data/data/COSMOS_Architecture.png +0 -0
  233. data/data/CheckBoxCheck.gif +0 -0
  234. data/data/CheckBoxEmpty.gif +0 -0
  235. data/data/Earthmap1024x512.gif +0 -0
  236. data/data/about.txt +4 -0
  237. data/data/add_database.png +0 -0
  238. data/data/add_plot.png +0 -0
  239. data/data/add_tab.png +0 -0
  240. data/data/blank.png +0 -0
  241. data/data/bug.png +0 -0
  242. data/data/checkmark.png +0 -0
  243. data/data/close.png +0 -0
  244. data/data/cmd_extractor.png +0 -0
  245. data/data/cmd_sender.png +0 -0
  246. data/data/cmd_sequence.png +0 -0
  247. data/data/config/_array_params.yaml +23 -0
  248. data/data/config/_id_items.yaml +24 -0
  249. data/data/config/_id_params.yaml +58 -0
  250. data/data/config/_interfaces.yaml +210 -0
  251. data/data/config/_items.yaml +20 -0
  252. data/data/config/_params.yaml +58 -0
  253. data/data/config/cmd_sequence.yaml +14 -0
  254. data/data/config/cmd_tlm_server.yaml +136 -0
  255. data/data/config/command.yaml +40 -0
  256. data/data/config/command_modifiers.yaml +160 -0
  257. data/data/config/command_telemetry.yaml +3 -0
  258. data/data/config/data_viewer.yaml +43 -0
  259. data/data/config/handbook_creator.yaml +23 -0
  260. data/data/config/housekeeping_params.yaml +85 -0
  261. data/data/config/interface_modifiers.yaml +97 -0
  262. data/data/config/item_modifiers.yaml +221 -0
  263. data/data/config/launcher.yaml +127 -0
  264. data/data/config/limits_monitor.yaml +53 -0
  265. data/data/config/linegraph_params.yaml +30 -0
  266. data/data/config/linegraph_plot.yaml +106 -0
  267. data/data/config/page_modifiers.yaml +128 -0
  268. data/data/config/param_item_modifiers.yaml +51 -0
  269. data/data/config/parameter_modifiers.yaml +200 -0
  270. data/data/config/protocols.yaml +273 -0
  271. data/data/config/screen.yaml +153 -0
  272. data/data/config/script_runner.yaml +24 -0
  273. data/data/config/system.yaml +371 -0
  274. data/data/config/table_manager.yaml +83 -0
  275. data/data/config/table_parameter_modifiers.yaml +9 -0
  276. data/data/config/target.yaml +92 -0
  277. data/data/config/telemetry.yaml +80 -0
  278. data/data/config/telemetry_modifiers.yaml +159 -0
  279. data/data/config/test_runner.yaml +119 -0
  280. data/data/config/tlm_extractor.yaml +109 -0
  281. data/data/config/tlm_grapher.yaml +78 -0
  282. data/data/config/tlm_viewer.yaml +112 -0
  283. data/data/config/unknown.yaml +3 -0
  284. data/data/config/widgets.yaml +1502 -0
  285. data/data/config/xy_params.yaml +50 -0
  286. data/data/config/xy_plot.yaml +12 -0
  287. data/data/config_editor.png +0 -0
  288. data/data/copy.png +0 -0
  289. data/data/cosmos.xcf +0 -0
  290. data/data/cosmos_word.gif +0 -0
  291. data/data/crc.txt +470 -0
  292. data/data/critical.wav +0 -0
  293. data/data/cts.png +0 -0
  294. data/data/cut.png +0 -0
  295. data/data/dart.png +0 -0
  296. data/data/data_viewer.png +0 -0
  297. data/data/delete.png +0 -0
  298. data/data/delete_database.png +0 -0
  299. data/data/delete_plot.png +0 -0
  300. data/data/delete_tab.png +0 -0
  301. data/data/diamond.STL +58 -0
  302. data/data/disconnected.png +0 -0
  303. data/data/edit.png +0 -0
  304. data/data/edit_database.png +0 -0
  305. data/data/edit_plot.png +0 -0
  306. data/data/edit_tab.png +0 -0
  307. data/data/end-26.png +0 -0
  308. data/data/fast_forward-26.png +0 -0
  309. data/data/file.png +0 -0
  310. data/data/handbook_creator.png +0 -0
  311. data/data/help.png +0 -0
  312. data/data/html-32.png +0 -0
  313. data/data/information.wav +0 -0
  314. data/data/input.wav +0 -0
  315. data/data/launcher.png +0 -0
  316. data/data/legal.gif +0 -0
  317. data/data/legal.txt +8 -0
  318. data/data/limits_monitor.png +0 -0
  319. data/data/message.wav +0 -0
  320. data/data/moonmap1k.gif +0 -0
  321. data/data/multi.png +0 -0
  322. data/data/open.png +0 -0
  323. data/data/open_in_browser-32.png +0 -0
  324. data/data/opengl_builder.png +0 -0
  325. data/data/packet_viewer.png +0 -0
  326. data/data/pdf-32.png +0 -0
  327. data/data/play-26.png +0 -0
  328. data/data/question.wav +0 -0
  329. data/data/redo.png +0 -0
  330. data/data/replay.png +0 -0
  331. data/data/reverse-play-26.png +0 -0
  332. data/data/rewind-26.png +0 -0
  333. data/data/running.png +0 -0
  334. data/data/save.png +0 -0
  335. data/data/save_as.png +0 -0
  336. data/data/screenshot.png +0 -0
  337. data/data/script_runner.png +0 -0
  338. data/data/search-14.png +0 -0
  339. data/data/search.png +0 -0
  340. data/data/send_file.png +0 -0
  341. data/data/skip_to_start-26.png +0 -0
  342. data/data/spinner.gif +0 -0
  343. data/data/splash.gif +0 -0
  344. data/data/stop-26.png +0 -0
  345. data/data/table_manager.png +0 -0
  346. data/data/test_runner.png +0 -0
  347. data/data/tlm_extractor.png +0 -0
  348. data/data/tlm_grapher.png +0 -0
  349. data/data/tlm_viewer.png +0 -0
  350. data/data/undo.png +0 -0
  351. data/data/warning.wav +0 -0
  352. data/demo/Gemfile +13 -0
  353. data/demo/Launcher +16 -0
  354. data/demo/Launcher.bat +1 -0
  355. data/demo/Launcher2.bat +1 -0
  356. data/demo/LauncherMini.bat +1 -0
  357. data/demo/Rakefile +83 -0
  358. data/demo/config/dart/Gemfile +49 -0
  359. data/demo/config/data/attitude.bin +0 -0
  360. data/demo/config/data/crc.txt +294 -0
  361. data/demo/config/data/diamond.STL +58 -0
  362. data/demo/config/data/hselectoff.gif +0 -0
  363. data/demo/config/data/hselecton.gif +0 -0
  364. data/demo/config/data/hswitchoff.gif +0 -0
  365. data/demo/config/data/hswitchon.gif +0 -0
  366. data/demo/config/data/meta_init.txt +1 -0
  367. data/demo/config/data/position.bin +0 -0
  368. data/demo/config/data/poweroff.gif +0 -0
  369. data/demo/config/data/poweron.gif +0 -0
  370. data/demo/config/data/satellite.gif +0 -0
  371. data/demo/config/data/tada.wav +0 -0
  372. data/demo/config/data/vswitchoff.gif +0 -0
  373. data/demo/config/data/vswitchon.gif +0 -0
  374. data/demo/config/system/system.txt +90 -0
  375. data/demo/config/system/system2.txt +75 -0
  376. data/demo/config/system/system_alt_ports.txt +80 -0
  377. data/demo/config/targets/DART/cmd_tlm/dart_cmds.txt +2 -0
  378. data/demo/config/targets/DART/cmd_tlm/dart_tlm.txt +40 -0
  379. data/demo/config/targets/DART/cmd_tlm_server.txt +6 -0
  380. data/demo/config/targets/DART/screens/status.txt +54 -0
  381. data/demo/config/targets/DART/target.txt +7 -0
  382. data/demo/config/targets/EXAMPLE/cmd_tlm/example_cmds.txt +2 -0
  383. data/demo/config/targets/EXAMPLE/cmd_tlm/example_tlm.txt +5 -0
  384. data/demo/config/targets/EXAMPLE/cmd_tlm_server.txt +7 -0
  385. data/demo/config/targets/EXAMPLE/lib/example_interface.rb +18 -0
  386. data/demo/config/targets/EXAMPLE/target.txt +9 -0
  387. data/demo/config/targets/INST/cmd_tlm/_ccsds_cmd.txt +9 -0
  388. data/demo/config/targets/INST/cmd_tlm/_ccsds_tlm.txt +19 -0
  389. data/demo/config/targets/INST/cmd_tlm/inst_cmds.txt +58 -0
  390. data/demo/config/targets/INST/cmd_tlm/inst_tlm.txt +169 -0
  391. data/demo/config/targets/INST/cmd_tlm/inst_tlm_override.txt +12 -0
  392. data/demo/config/targets/INST/cmd_tlm_server.txt +8 -0
  393. data/demo/config/targets/INST/cmd_tlm_server2.txt +7 -0
  394. data/demo/config/targets/INST/doc/README.txt +1 -0
  395. data/demo/config/targets/INST/lib/example_limits_response.rb +30 -0
  396. data/demo/config/targets/INST/lib/inst_dump_component.rb +34 -0
  397. data/demo/config/targets/INST/lib/sim_inst.rb +333 -0
  398. data/demo/config/targets/INST/procedures/checks.rb +11 -0
  399. data/demo/config/targets/INST/procedures/collect.rb +18 -0
  400. data/demo/config/targets/INST/procedures/disconnect.rb +29 -0
  401. data/demo/config/targets/INST/procedures/utilities/clear.rb +7 -0
  402. data/demo/config/targets/INST/procedures/utilities/collect.rb +14 -0
  403. data/demo/config/targets/INST/screens/_footer.txt +4 -0
  404. data/demo/config/targets/INST/screens/adcs.txt +71 -0
  405. data/demo/config/targets/INST/screens/array.txt +15 -0
  406. data/demo/config/targets/INST/screens/block.txt +8 -0
  407. data/demo/config/targets/INST/screens/commanding.txt +42 -0
  408. data/demo/config/targets/INST/screens/graphs.txt +14 -0
  409. data/demo/config/targets/INST/screens/ground.txt +47 -0
  410. data/demo/config/targets/INST/screens/ground_error.gif +0 -0
  411. data/demo/config/targets/INST/screens/ground_off.gif +0 -0
  412. data/demo/config/targets/INST/screens/ground_on.gif +0 -0
  413. data/demo/config/targets/INST/screens/hs.txt +43 -0
  414. data/demo/config/targets/INST/screens/latest.txt +23 -0
  415. data/demo/config/targets/INST/screens/limits.txt +81 -0
  416. data/demo/config/targets/INST/screens/other.txt +34 -0
  417. data/demo/config/targets/INST/screens/params.txt +54 -0
  418. data/demo/config/targets/INST/screens/satellite.gif +0 -0
  419. data/demo/config/targets/INST/screens/spacing_box.txt +44 -0
  420. data/demo/config/targets/INST/screens/spacing_grid.txt +78 -0
  421. data/demo/config/targets/INST/screens/tabs.txt +68 -0
  422. data/demo/config/targets/INST/sequences/sequence.tsv +3 -0
  423. data/demo/config/targets/INST/tables/EventAction.csv +9 -0
  424. data/demo/config/targets/INST/tables/EventAction.dat +0 -0
  425. data/demo/config/targets/INST/tables/McConfigTable.csv +20 -0
  426. data/demo/config/targets/INST/tables/McConfigTable.dat +0 -0
  427. data/demo/config/targets/INST/target.txt +38 -0
  428. data/demo/config/targets/INST/tools/data_viewer/data_viewer.txt +2 -0
  429. data/demo/config/targets/INST/tools/data_viewer/data_viewer2.txt +2 -0
  430. data/demo/config/targets/INST/tools/table_manager/EventAction_def.txt +6 -0
  431. data/demo/config/targets/INST/tools/table_manager/McConfigTable_def.txt +38 -0
  432. data/demo/config/targets/SYSTEM/cmd_tlm/limits_groups.txt +6 -0
  433. data/demo/config/targets/SYSTEM/cmd_tlm/meta_tlm.txt +10 -0
  434. data/demo/config/targets/SYSTEM/cmd_tlm/override.txt +29 -0
  435. data/demo/config/targets/SYSTEM/cmd_tlm/system_cmds.txt +41 -0
  436. data/demo/config/targets/SYSTEM/cmd_tlm/system_tlm.txt +7 -0
  437. data/demo/config/targets/SYSTEM/cmd_tlm_server.txt +6 -0
  438. data/demo/config/targets/SYSTEM/lib/limits_groups.rb +55 -0
  439. data/demo/config/targets/SYSTEM/screens/status.txt +12 -0
  440. data/demo/config/targets/SYSTEM/target.txt +12 -0
  441. data/demo/config/targets/TEMPLATED/cmd_tlm/templated_cmds.txt +13 -0
  442. data/demo/config/targets/TEMPLATED/cmd_tlm/templated_tlm.txt +3 -0
  443. data/demo/config/targets/TEMPLATED/cmd_tlm_server.txt +6 -0
  444. data/demo/config/targets/TEMPLATED/lib/templated_interface.rb +59 -0
  445. data/demo/config/targets/TEMPLATED/target.txt +8 -0
  446. data/demo/config/tools/cmd_sequence/cmd_sequence.txt +2 -0
  447. data/demo/config/tools/cmd_tlm_server/cmd_tlm_server.txt +45 -0
  448. data/demo/config/tools/cmd_tlm_server/cmd_tlm_server2.txt +42 -0
  449. data/demo/config/tools/cmd_tlm_server/cmd_tlm_server_chain.txt +18 -0
  450. data/demo/config/tools/data_viewer/data_viewer.txt +23 -0
  451. data/demo/config/tools/example_application.css +58 -0
  452. data/demo/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
  453. data/demo/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
  454. data/demo/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
  455. data/demo/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
  456. data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  457. data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
  458. data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  459. data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  460. data/demo/config/tools/handbook_creator/assets/img/ball_logo.bmp +0 -0
  461. data/demo/config/tools/handbook_creator/assets/img/ball_logo.gif +0 -0
  462. data/demo/config/tools/handbook_creator/assets/img/ball_logo.jpg +0 -0
  463. data/demo/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
  464. data/demo/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
  465. data/demo/config/tools/handbook_creator/assets/js/html5shiv.js +8 -0
  466. data/demo/config/tools/handbook_creator/assets/js/jquery-1.10.2.min.js +6 -0
  467. data/demo/config/tools/handbook_creator/assets/js/respond.min.js +6 -0
  468. data/demo/config/tools/handbook_creator/default_toc.xsl +59 -0
  469. data/demo/config/tools/handbook_creator/handbook_creator.txt +66 -0
  470. data/demo/config/tools/handbook_creator/templates/command_packets.html.erb +88 -0
  471. data/demo/config/tools/handbook_creator/templates/command_toc.html.erb +38 -0
  472. data/demo/config/tools/handbook_creator/templates/footer.html.erb +9 -0
  473. data/demo/config/tools/handbook_creator/templates/header.html.erb +25 -0
  474. data/demo/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -0
  475. data/demo/config/tools/handbook_creator/templates/nav.html.erb +27 -0
  476. data/demo/config/tools/handbook_creator/templates/overview.html.erb +1 -0
  477. data/demo/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -0
  478. data/demo/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -0
  479. data/demo/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -0
  480. data/demo/config/tools/handbook_creator/templates/telemetry_packets.html.erb +82 -0
  481. data/demo/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -0
  482. data/demo/config/tools/handbook_creator/templates/title.html.erb +1 -0
  483. data/demo/config/tools/launcher/launcher.css +7 -0
  484. data/demo/config/tools/launcher/launcher.txt +49 -0
  485. data/demo/config/tools/launcher/launcher2.css +10 -0
  486. data/demo/config/tools/launcher/launcher2.txt +48 -0
  487. data/demo/config/tools/launcher/launcher_mini.txt +45 -0
  488. data/demo/config/tools/limits_monitor/README.txt +1 -0
  489. data/demo/config/tools/opengl_builder/README.txt +1 -0
  490. data/demo/config/tools/script_runner/script_runner.txt +2 -0
  491. data/demo/config/tools/table_manager/ConfigTables_def.txt +8 -0
  492. data/demo/config/tools/table_manager/ExampleTableDefinition.txt +24 -0
  493. data/demo/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +37 -0
  494. data/demo/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +34 -0
  495. data/demo/config/tools/table_manager/PPSSelectionTable_def.txt +9 -0
  496. data/demo/config/tools/table_manager/TLMMonitoringTable_def.txt +31 -0
  497. data/demo/config/tools/test_runner/test_runner.css +45 -0
  498. data/demo/config/tools/test_runner/test_runner.txt +19 -0
  499. data/demo/config/tools/tlm_extractor/_adcs_time.txt +2 -0
  500. data/demo/config/tools/tlm_extractor/tlm_extractor.txt +13 -0
  501. data/demo/config/tools/tlm_extractor/tlm_extractor2.txt +2 -0
  502. data/demo/config/tools/tlm_extractor/tlm_extractor3.txt +2 -0
  503. data/demo/config/tools/tlm_extractor/tlm_extractor4.txt +2 -0
  504. data/demo/config/tools/tlm_grapher/README.txt +1 -0
  505. data/demo/config/tools/tlm_viewer/tlm_viewer.txt +41 -0
  506. data/demo/lib/cmd_sequence_exporter.rb +52 -0
  507. data/demo/lib/example_background_task.rb +57 -0
  508. data/demo/lib/example_target.rb +103 -0
  509. data/demo/lib/scpi_target.rb +68 -0
  510. data/demo/lib/user_version.rb +3 -0
  511. data/demo/outputs/dart/data/README.txt +1 -0
  512. data/demo/outputs/handbooks/README.txt +1 -0
  513. data/demo/outputs/logs/README.txt +1 -0
  514. data/demo/outputs/saved_config/README.txt +1 -0
  515. data/demo/outputs/sequences/sequence.tsv +4 -0
  516. data/demo/outputs/tables/README.txt +1 -0
  517. data/demo/outputs/tmp/README.txt +1 -0
  518. data/demo/procedures/cosmos_api_test.rb +314 -0
  519. data/demo/procedures/example_test.rb +192 -0
  520. data/demo/procedures/interactive.rb +22 -0
  521. data/demo/procedures/local_screen_example.rb +51 -0
  522. data/demo/procedures/plot_test.rb +8 -0
  523. data/demo/procedures/replay_test.rb +32 -0
  524. data/demo/procedures/run_example_test.rb +3 -0
  525. data/demo/procedures/test.rb +51 -0
  526. data/demo/tools/CmdExtractor +16 -0
  527. data/demo/tools/CmdExtractor.bat +9 -0
  528. data/demo/tools/CmdSender +16 -0
  529. data/demo/tools/CmdSender.bat +9 -0
  530. data/demo/tools/CmdSequence +16 -0
  531. data/demo/tools/CmdSequence.bat +9 -0
  532. data/demo/tools/CmdTlmServer +16 -0
  533. data/demo/tools/CmdTlmServer.bat +9 -0
  534. data/demo/tools/ConfigEditor +16 -0
  535. data/demo/tools/ConfigEditor.bat +9 -0
  536. data/demo/tools/Dart +16 -0
  537. data/demo/tools/Dart.bat +9 -0
  538. data/demo/tools/DataViewer +16 -0
  539. data/demo/tools/DataViewer.bat +9 -0
  540. data/demo/tools/ExampleTarget +16 -0
  541. data/demo/tools/ExampleTarget.bat +9 -0
  542. data/demo/tools/HandbookCreator +16 -0
  543. data/demo/tools/HandbookCreator.bat +9 -0
  544. data/demo/tools/Launcher +16 -0
  545. data/demo/tools/Launcher.bat +9 -0
  546. data/demo/tools/LimitsMonitor +16 -0
  547. data/demo/tools/LimitsMonitor.bat +9 -0
  548. data/demo/tools/OpenGLBuilder +16 -0
  549. data/demo/tools/OpenGLBuilder.bat +9 -0
  550. data/demo/tools/PacketViewer +16 -0
  551. data/demo/tools/PacketViewer.bat +9 -0
  552. data/demo/tools/Replay +16 -0
  553. data/demo/tools/Replay.bat +9 -0
  554. data/demo/tools/ScpiTarget +16 -0
  555. data/demo/tools/ScpiTarget.bat +9 -0
  556. data/demo/tools/ScriptRunner +16 -0
  557. data/demo/tools/ScriptRunner.bat +9 -0
  558. data/demo/tools/TableManager +16 -0
  559. data/demo/tools/TableManager.bat +9 -0
  560. data/demo/tools/TestRunner +16 -0
  561. data/demo/tools/TestRunner.bat +9 -0
  562. data/demo/tools/TlmExtractor +16 -0
  563. data/demo/tools/TlmExtractor.bat +9 -0
  564. data/demo/tools/TlmGrapher +16 -0
  565. data/demo/tools/TlmGrapher.bat +9 -0
  566. data/demo/tools/TlmViewer +16 -0
  567. data/demo/tools/TlmViewer.bat +9 -0
  568. data/demo/tools/ToolLaunch.bat +72 -0
  569. data/demo/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -0
  570. data/demo/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +16 -0
  571. data/demo/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +10 -0
  572. data/demo/tools/mac/CmdExtractor.app/Contents/MacOS/tool_launch.rb +38 -0
  573. data/demo/tools/mac/CmdExtractor.app/Contents/Resources/appIcon.icns +0 -0
  574. data/demo/tools/mac/CmdSender.app/Contents/Info.plist +38 -0
  575. data/demo/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +16 -0
  576. data/demo/tools/mac/CmdSender.app/Contents/MacOS/main.sh +10 -0
  577. data/demo/tools/mac/CmdSender.app/Contents/MacOS/tool_launch.rb +38 -0
  578. data/demo/tools/mac/CmdSender.app/Contents/Resources/appIcon.icns +0 -0
  579. data/demo/tools/mac/CmdSequence.app/Contents/Info.plist +38 -0
  580. data/demo/tools/mac/CmdSequence.app/Contents/MacOS/CmdSequence.rb +16 -0
  581. data/demo/tools/mac/CmdSequence.app/Contents/MacOS/main.sh +10 -0
  582. data/demo/tools/mac/CmdSequence.app/Contents/MacOS/tool_launch.rb +38 -0
  583. data/demo/tools/mac/CmdSequence.app/Contents/Resources/appIcon.icns +0 -0
  584. data/demo/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -0
  585. data/demo/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +16 -0
  586. data/demo/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +10 -0
  587. data/demo/tools/mac/CmdTlmServer.app/Contents/MacOS/tool_launch.rb +38 -0
  588. data/demo/tools/mac/CmdTlmServer.app/Contents/Resources/appIcon.icns +0 -0
  589. data/demo/tools/mac/ConfigEditor.app/Contents/Info.plist +38 -0
  590. data/demo/tools/mac/ConfigEditor.app/Contents/MacOS/ConfigEditor.rb +16 -0
  591. data/demo/tools/mac/ConfigEditor.app/Contents/MacOS/main.sh +10 -0
  592. data/demo/tools/mac/ConfigEditor.app/Contents/MacOS/tool_launch.rb +38 -0
  593. data/demo/tools/mac/ConfigEditor.app/Contents/Resources/appIcon.icns +0 -0
  594. data/demo/tools/mac/DataViewer.app/Contents/Info.plist +38 -0
  595. data/demo/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +16 -0
  596. data/demo/tools/mac/DataViewer.app/Contents/MacOS/main.sh +10 -0
  597. data/demo/tools/mac/DataViewer.app/Contents/MacOS/tool_launch.rb +38 -0
  598. data/demo/tools/mac/DataViewer.app/Contents/Resources/appIcon.icns +0 -0
  599. data/demo/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -0
  600. data/demo/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +16 -0
  601. data/demo/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +10 -0
  602. data/demo/tools/mac/HandbookCreator.app/Contents/MacOS/tool_launch.rb +38 -0
  603. data/demo/tools/mac/HandbookCreator.app/Contents/Resources/appIcon.icns +0 -0
  604. data/demo/tools/mac/Launcher.app/Contents/Info.plist +38 -0
  605. data/demo/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +16 -0
  606. data/demo/tools/mac/Launcher.app/Contents/MacOS/main.sh +10 -0
  607. data/demo/tools/mac/Launcher.app/Contents/MacOS/tool_launch.rb +38 -0
  608. data/demo/tools/mac/Launcher.app/Contents/Resources/appIcon.icns +0 -0
  609. data/demo/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -0
  610. data/demo/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +16 -0
  611. data/demo/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +10 -0
  612. data/demo/tools/mac/LimitsMonitor.app/Contents/MacOS/tool_launch.rb +38 -0
  613. data/demo/tools/mac/LimitsMonitor.app/Contents/Resources/appIcon.icns +0 -0
  614. data/demo/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -0
  615. data/demo/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +16 -0
  616. data/demo/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +10 -0
  617. data/demo/tools/mac/OpenGLBuilder.app/Contents/MacOS/tool_launch.rb +38 -0
  618. data/demo/tools/mac/OpenGLBuilder.app/Contents/Resources/appIcon.icns +0 -0
  619. data/demo/tools/mac/PacketViewer.app/Contents/Info.plist +38 -0
  620. data/demo/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +16 -0
  621. data/demo/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +10 -0
  622. data/demo/tools/mac/PacketViewer.app/Contents/MacOS/tool_launch.rb +38 -0
  623. data/demo/tools/mac/PacketViewer.app/Contents/Resources/appIcon.icns +0 -0
  624. data/demo/tools/mac/Replay.app/Contents/Info.plist +38 -0
  625. data/demo/tools/mac/Replay.app/Contents/MacOS/Replay.rb +16 -0
  626. data/demo/tools/mac/Replay.app/Contents/MacOS/main.sh +10 -0
  627. data/demo/tools/mac/Replay.app/Contents/MacOS/tool_launch.rb +38 -0
  628. data/demo/tools/mac/Replay.app/Contents/Resources/appIcon.icns +0 -0
  629. data/demo/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -0
  630. data/demo/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +16 -0
  631. data/demo/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +10 -0
  632. data/demo/tools/mac/ScriptRunner.app/Contents/MacOS/tool_launch.rb +38 -0
  633. data/demo/tools/mac/ScriptRunner.app/Contents/Resources/appIcon.icns +0 -0
  634. data/demo/tools/mac/TableManager.app/Contents/Info.plist +38 -0
  635. data/demo/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +16 -0
  636. data/demo/tools/mac/TableManager.app/Contents/MacOS/main.sh +10 -0
  637. data/demo/tools/mac/TableManager.app/Contents/MacOS/tool_launch.rb +38 -0
  638. data/demo/tools/mac/TableManager.app/Contents/Resources/appIcon.icns +0 -0
  639. data/demo/tools/mac/TestRunner.app/Contents/Info.plist +38 -0
  640. data/demo/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +16 -0
  641. data/demo/tools/mac/TestRunner.app/Contents/MacOS/main.sh +10 -0
  642. data/demo/tools/mac/TestRunner.app/Contents/MacOS/tool_launch.rb +38 -0
  643. data/demo/tools/mac/TestRunner.app/Contents/Resources/appIcon.icns +0 -0
  644. data/demo/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -0
  645. data/demo/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +16 -0
  646. data/demo/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +10 -0
  647. data/demo/tools/mac/TlmExtractor.app/Contents/MacOS/tool_launch.rb +38 -0
  648. data/demo/tools/mac/TlmExtractor.app/Contents/Resources/appIcon.icns +0 -0
  649. data/demo/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -0
  650. data/demo/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +16 -0
  651. data/demo/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +10 -0
  652. data/demo/tools/mac/TlmGrapher.app/Contents/MacOS/tool_launch.rb +38 -0
  653. data/demo/tools/mac/TlmGrapher.app/Contents/Resources/appIcon.icns +0 -0
  654. data/demo/tools/mac/TlmViewer.app/Contents/Info.plist +38 -0
  655. data/demo/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +16 -0
  656. data/demo/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +10 -0
  657. data/demo/tools/mac/TlmViewer.app/Contents/MacOS/tool_launch.rb +38 -0
  658. data/demo/tools/mac/TlmViewer.app/Contents/Resources/appIcon.icns +0 -0
  659. data/demo/tools/tool_launch.rb +38 -0
  660. data/ext/cosmos/ext/array/array.c +111 -0
  661. data/ext/cosmos/ext/array/extconf.rb +13 -0
  662. data/ext/cosmos/ext/buffered_file/buffered_file.c +167 -0
  663. data/ext/cosmos/ext/buffered_file/extconf.rb +13 -0
  664. data/ext/cosmos/ext/config_parser/config_parser.c +236 -0
  665. data/ext/cosmos/ext/config_parser/extconf.rb +13 -0
  666. data/ext/cosmos/ext/cosmos_io/cosmos_io.c +145 -0
  667. data/ext/cosmos/ext/cosmos_io/extconf.rb +13 -0
  668. data/ext/cosmos/ext/crc/crc.c +341 -0
  669. data/ext/cosmos/ext/crc/extconf.rb +13 -0
  670. data/ext/cosmos/ext/line_graph/extconf.rb +13 -0
  671. data/ext/cosmos/ext/line_graph/line_graph.c +460 -0
  672. data/ext/cosmos/ext/low_fragmentation_array/extconf.rb +13 -0
  673. data/ext/cosmos/ext/low_fragmentation_array/low_fragmentation_array.c +265 -0
  674. data/ext/cosmos/ext/packet/extconf.rb +13 -0
  675. data/ext/cosmos/ext/packet/packet.c +273 -0
  676. data/ext/cosmos/ext/platform/extconf.rb +13 -0
  677. data/ext/cosmos/ext/platform/platform.c +136 -0
  678. data/ext/cosmos/ext/polynomial_conversion/extconf.rb +13 -0
  679. data/ext/cosmos/ext/polynomial_conversion/polynomial_conversion.c +69 -0
  680. data/ext/cosmos/ext/string/extconf.rb +13 -0
  681. data/ext/cosmos/ext/string/string.c +49 -0
  682. data/ext/cosmos/ext/structure/structure.c +1493 -0
  683. data/ext/cosmos/ext/tabbed_plots_config/extconf.rb +13 -0
  684. data/ext/cosmos/ext/tabbed_plots_config/tabbed_plots_config.c +51 -0
  685. data/ext/cosmos/ext/telemetry/extconf.rb +13 -0
  686. data/ext/cosmos/ext/telemetry/telemetry.c +307 -0
  687. data/ext/mkrf_conf.rb +40 -0
  688. data/extensions/vscode/.gitignore +4 -0
  689. data/extensions/vscode/.vscode/launch.json +32 -0
  690. data/extensions/vscode/.vscode/settings.json +13 -0
  691. data/extensions/vscode/.vscode/tasks.json +79 -0
  692. data/extensions/vscode/License.txt +879 -0
  693. data/extensions/vscode/README.md +9 -0
  694. data/extensions/vscode/client/License.txt +879 -0
  695. data/extensions/vscode/client/README.md +39 -0
  696. data/extensions/vscode/client/cosmos.configuration.json +23 -0
  697. data/extensions/vscode/client/images/icon.png +0 -0
  698. data/extensions/vscode/client/package-lock.json +414 -0
  699. data/extensions/vscode/client/package.json +105 -0
  700. data/extensions/vscode/client/src/extension.ts +132 -0
  701. data/extensions/vscode/client/src/screen_preview.rb +25 -0
  702. data/extensions/vscode/client/syntaxes/cosmos.tmLanguage.json +219 -0
  703. data/extensions/vscode/client/tsconfig.json +17 -0
  704. data/extensions/vscode/package-lock.json +26 -0
  705. data/extensions/vscode/package.json +35 -0
  706. data/extensions/vscode/server/License.txt +879 -0
  707. data/extensions/vscode/server/package-lock.json +236 -0
  708. data/extensions/vscode/server/package.json +29 -0
  709. data/extensions/vscode/server/src/server.ts +59 -0
  710. data/extensions/vscode/server/tsconfig.json +16 -0
  711. data/install/Gemfile +13 -0
  712. data/install/Launcher +16 -0
  713. data/install/Launcher.bat +1 -0
  714. data/install/Rakefile +81 -0
  715. data/install/config/dart/Gemfile +49 -0
  716. data/install/config/data/README.txt +1 -0
  717. data/install/config/data/crc.txt +179 -0
  718. data/install/config/system/system.txt +75 -0
  719. data/install/config/targets/SYSTEM/cmd_tlm/meta_tlm.txt +9 -0
  720. data/install/config/targets/SYSTEM/target.txt +12 -0
  721. data/install/config/tools/cmd_tlm_server/cmd_tlm_server.txt +3 -0
  722. data/install/config/tools/data_viewer/data_viewer.txt +4 -0
  723. data/install/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
  724. data/install/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
  725. data/install/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
  726. data/install/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
  727. data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  728. data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
  729. data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  730. data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  731. data/install/config/tools/handbook_creator/assets/img/ball_logo.bmp +0 -0
  732. data/install/config/tools/handbook_creator/assets/img/ball_logo.gif +0 -0
  733. data/install/config/tools/handbook_creator/assets/img/ball_logo.jpg +0 -0
  734. data/install/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
  735. data/install/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
  736. data/install/config/tools/handbook_creator/assets/js/html5shiv.js +8 -0
  737. data/install/config/tools/handbook_creator/assets/js/jquery-1.10.2.min.js +6 -0
  738. data/install/config/tools/handbook_creator/assets/js/respond.min.js +6 -0
  739. data/install/config/tools/handbook_creator/default_toc.xsl +59 -0
  740. data/install/config/tools/handbook_creator/handbook_creator.txt +49 -0
  741. data/install/config/tools/handbook_creator/templates/command_packets.html.erb +86 -0
  742. data/install/config/tools/handbook_creator/templates/command_toc.html.erb +38 -0
  743. data/install/config/tools/handbook_creator/templates/footer.html.erb +9 -0
  744. data/install/config/tools/handbook_creator/templates/header.html.erb +25 -0
  745. data/install/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -0
  746. data/install/config/tools/handbook_creator/templates/nav.html.erb +27 -0
  747. data/install/config/tools/handbook_creator/templates/overview.html.erb +1 -0
  748. data/install/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -0
  749. data/install/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -0
  750. data/install/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -0
  751. data/install/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -0
  752. data/install/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -0
  753. data/install/config/tools/handbook_creator/templates/title.html.erb +1 -0
  754. data/install/config/tools/launcher/launcher.txt +43 -0
  755. data/install/config/tools/limits_monitor/README.txt +1 -0
  756. data/install/config/tools/opengl_builder/README.txt +1 -0
  757. data/install/config/tools/script_runner/script_runner.txt +3 -0
  758. data/install/config/tools/table_manager/README.txt +1 -0
  759. data/install/config/tools/test_runner/test_runner.txt +8 -0
  760. data/install/config/tools/tlm_extractor/README.txt +1 -0
  761. data/install/config/tools/tlm_grapher/README.txt +1 -0
  762. data/install/config/tools/tlm_viewer/tlm_viewer.txt +5 -0
  763. data/install/lib/user_version.rb +3 -0
  764. data/install/outputs/dart/data/README.txt +1 -0
  765. data/install/outputs/dart/logs/README.txt +1 -0
  766. data/install/outputs/handbooks/README.txt +1 -0
  767. data/install/outputs/logs/README.txt +1 -0
  768. data/install/outputs/saved_config/README.txt +1 -0
  769. data/install/outputs/tables/README.txt +1 -0
  770. data/install/outputs/tmp/README.txt +1 -0
  771. data/install/procedures/README.txt +1 -0
  772. data/install/tools/CmdExtractor +16 -0
  773. data/install/tools/CmdExtractor.bat +9 -0
  774. data/install/tools/CmdSender +16 -0
  775. data/install/tools/CmdSender.bat +9 -0
  776. data/install/tools/CmdSequence +16 -0
  777. data/install/tools/CmdSequence.bat +9 -0
  778. data/install/tools/CmdTlmServer +16 -0
  779. data/install/tools/CmdTlmServer.bat +9 -0
  780. data/install/tools/ConfigEditor +16 -0
  781. data/install/tools/ConfigEditor.bat +9 -0
  782. data/install/tools/Dart +16 -0
  783. data/install/tools/Dart.bat +9 -0
  784. data/install/tools/DataViewer +16 -0
  785. data/install/tools/DataViewer.bat +9 -0
  786. data/install/tools/HandbookCreator +16 -0
  787. data/install/tools/HandbookCreator.bat +9 -0
  788. data/install/tools/Launcher +16 -0
  789. data/install/tools/Launcher.bat +9 -0
  790. data/install/tools/LimitsMonitor +16 -0
  791. data/install/tools/LimitsMonitor.bat +9 -0
  792. data/install/tools/OpenGLBuilder +16 -0
  793. data/install/tools/OpenGLBuilder.bat +9 -0
  794. data/install/tools/PacketViewer +16 -0
  795. data/install/tools/PacketViewer.bat +9 -0
  796. data/install/tools/Replay +16 -0
  797. data/install/tools/Replay.bat +9 -0
  798. data/install/tools/ScriptRunner +16 -0
  799. data/install/tools/ScriptRunner.bat +9 -0
  800. data/install/tools/TableManager +16 -0
  801. data/install/tools/TableManager.bat +9 -0
  802. data/install/tools/TestRunner +16 -0
  803. data/install/tools/TestRunner.bat +9 -0
  804. data/install/tools/TlmExtractor +16 -0
  805. data/install/tools/TlmExtractor.bat +9 -0
  806. data/install/tools/TlmGrapher +16 -0
  807. data/install/tools/TlmGrapher.bat +9 -0
  808. data/install/tools/TlmViewer +16 -0
  809. data/install/tools/TlmViewer.bat +9 -0
  810. data/install/tools/ToolLaunch.bat +72 -0
  811. data/install/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -0
  812. data/install/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +16 -0
  813. data/install/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +10 -0
  814. data/install/tools/mac/CmdExtractor.app/Contents/MacOS/tool_launch.rb +38 -0
  815. data/install/tools/mac/CmdExtractor.app/Contents/Resources/appIcon.icns +0 -0
  816. data/install/tools/mac/CmdSender.app/Contents/Info.plist +38 -0
  817. data/install/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +16 -0
  818. data/install/tools/mac/CmdSender.app/Contents/MacOS/main.sh +10 -0
  819. data/install/tools/mac/CmdSender.app/Contents/MacOS/tool_launch.rb +38 -0
  820. data/install/tools/mac/CmdSender.app/Contents/Resources/appIcon.icns +0 -0
  821. data/install/tools/mac/CmdSequence.app/Contents/Info.plist +38 -0
  822. data/install/tools/mac/CmdSequence.app/Contents/MacOS/CmdSequence.rb +16 -0
  823. data/install/tools/mac/CmdSequence.app/Contents/MacOS/main.sh +10 -0
  824. data/install/tools/mac/CmdSequence.app/Contents/MacOS/tool_launch.rb +38 -0
  825. data/install/tools/mac/CmdSequence.app/Contents/Resources/appIcon.icns +0 -0
  826. data/install/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -0
  827. data/install/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +16 -0
  828. data/install/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +10 -0
  829. data/install/tools/mac/CmdTlmServer.app/Contents/MacOS/tool_launch.rb +38 -0
  830. data/install/tools/mac/CmdTlmServer.app/Contents/Resources/appIcon.icns +0 -0
  831. data/install/tools/mac/ConfigEditor.app/Contents/Info.plist +38 -0
  832. data/install/tools/mac/ConfigEditor.app/Contents/MacOS/ConfigEditor.rb +16 -0
  833. data/install/tools/mac/ConfigEditor.app/Contents/MacOS/main.sh +10 -0
  834. data/install/tools/mac/ConfigEditor.app/Contents/MacOS/tool_launch.rb +38 -0
  835. data/install/tools/mac/ConfigEditor.app/Contents/Resources/appIcon.icns +0 -0
  836. data/install/tools/mac/DataViewer.app/Contents/Info.plist +38 -0
  837. data/install/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +16 -0
  838. data/install/tools/mac/DataViewer.app/Contents/MacOS/main.sh +10 -0
  839. data/install/tools/mac/DataViewer.app/Contents/MacOS/tool_launch.rb +38 -0
  840. data/install/tools/mac/DataViewer.app/Contents/Resources/appIcon.icns +0 -0
  841. data/install/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -0
  842. data/install/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +16 -0
  843. data/install/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +10 -0
  844. data/install/tools/mac/HandbookCreator.app/Contents/MacOS/tool_launch.rb +38 -0
  845. data/install/tools/mac/HandbookCreator.app/Contents/Resources/appIcon.icns +0 -0
  846. data/install/tools/mac/Launcher.app/Contents/Info.plist +38 -0
  847. data/install/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +16 -0
  848. data/install/tools/mac/Launcher.app/Contents/MacOS/main.sh +10 -0
  849. data/install/tools/mac/Launcher.app/Contents/MacOS/tool_launch.rb +38 -0
  850. data/install/tools/mac/Launcher.app/Contents/Resources/appIcon.icns +0 -0
  851. data/install/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -0
  852. data/install/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +16 -0
  853. data/install/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +10 -0
  854. data/install/tools/mac/LimitsMonitor.app/Contents/MacOS/tool_launch.rb +38 -0
  855. data/install/tools/mac/LimitsMonitor.app/Contents/Resources/appIcon.icns +0 -0
  856. data/install/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -0
  857. data/install/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +16 -0
  858. data/install/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +10 -0
  859. data/install/tools/mac/OpenGLBuilder.app/Contents/MacOS/tool_launch.rb +38 -0
  860. data/install/tools/mac/OpenGLBuilder.app/Contents/Resources/appIcon.icns +0 -0
  861. data/install/tools/mac/PacketViewer.app/Contents/Info.plist +38 -0
  862. data/install/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +16 -0
  863. data/install/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +10 -0
  864. data/install/tools/mac/PacketViewer.app/Contents/MacOS/tool_launch.rb +38 -0
  865. data/install/tools/mac/PacketViewer.app/Contents/Resources/appIcon.icns +0 -0
  866. data/install/tools/mac/Replay.app/Contents/Info.plist +38 -0
  867. data/install/tools/mac/Replay.app/Contents/MacOS/Replay.rb +16 -0
  868. data/install/tools/mac/Replay.app/Contents/MacOS/main.sh +10 -0
  869. data/install/tools/mac/Replay.app/Contents/MacOS/tool_launch.rb +38 -0
  870. data/install/tools/mac/Replay.app/Contents/Resources/appIcon.icns +0 -0
  871. data/install/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -0
  872. data/install/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +16 -0
  873. data/install/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +10 -0
  874. data/install/tools/mac/ScriptRunner.app/Contents/MacOS/tool_launch.rb +38 -0
  875. data/install/tools/mac/ScriptRunner.app/Contents/Resources/appIcon.icns +0 -0
  876. data/install/tools/mac/TableManager.app/Contents/Info.plist +38 -0
  877. data/install/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +16 -0
  878. data/install/tools/mac/TableManager.app/Contents/MacOS/main.sh +10 -0
  879. data/install/tools/mac/TableManager.app/Contents/MacOS/tool_launch.rb +38 -0
  880. data/install/tools/mac/TableManager.app/Contents/Resources/appIcon.icns +0 -0
  881. data/install/tools/mac/TestRunner.app/Contents/Info.plist +38 -0
  882. data/install/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +16 -0
  883. data/install/tools/mac/TestRunner.app/Contents/MacOS/main.sh +10 -0
  884. data/install/tools/mac/TestRunner.app/Contents/MacOS/tool_launch.rb +38 -0
  885. data/install/tools/mac/TestRunner.app/Contents/Resources/appIcon.icns +0 -0
  886. data/install/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -0
  887. data/install/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +16 -0
  888. data/install/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +10 -0
  889. data/install/tools/mac/TlmExtractor.app/Contents/MacOS/tool_launch.rb +38 -0
  890. data/install/tools/mac/TlmExtractor.app/Contents/Resources/appIcon.icns +0 -0
  891. data/install/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -0
  892. data/install/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +16 -0
  893. data/install/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +10 -0
  894. data/install/tools/mac/TlmGrapher.app/Contents/MacOS/tool_launch.rb +38 -0
  895. data/install/tools/mac/TlmGrapher.app/Contents/Resources/appIcon.icns +0 -0
  896. data/install/tools/mac/TlmViewer.app/Contents/Info.plist +38 -0
  897. data/install/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +16 -0
  898. data/install/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +10 -0
  899. data/install/tools/mac/TlmViewer.app/Contents/MacOS/tool_launch.rb +38 -0
  900. data/install/tools/mac/TlmViewer.app/Contents/Resources/appIcon.icns +0 -0
  901. data/install/tools/tool_launch.rb +38 -0
  902. data/lib/cosmos/ccsds/ccsds_packet.rb +63 -0
  903. data/lib/cosmos/ccsds/ccsds_parser.rb +143 -0
  904. data/lib/cosmos/config/config_parser.rb +506 -0
  905. data/lib/cosmos/config/meta_config_parser.rb +57 -0
  906. data/lib/cosmos/conversions/conversion.rb +52 -0
  907. data/lib/cosmos/conversions/generic_conversion.rb +67 -0
  908. data/lib/cosmos/conversions/new_packet_log_conversion.rb +52 -0
  909. data/lib/cosmos/conversions/packet_time_formatted_conversion.rb +38 -0
  910. data/lib/cosmos/conversions/packet_time_seconds_conversion.rb +38 -0
  911. data/lib/cosmos/conversions/polynomial_conversion.rb +79 -0
  912. data/lib/cosmos/conversions/processor_conversion.rb +56 -0
  913. data/lib/cosmos/conversions/received_count_conversion.rb +33 -0
  914. data/lib/cosmos/conversions/received_time_formatted_conversion.rb +37 -0
  915. data/lib/cosmos/conversions/received_time_seconds_conversion.rb +37 -0
  916. data/lib/cosmos/conversions/segmented_polynomial_conversion.rb +139 -0
  917. data/lib/cosmos/conversions/unix_time_conversion.rb +57 -0
  918. data/lib/cosmos/conversions/unix_time_formatted_conversion.rb +44 -0
  919. data/lib/cosmos/conversions/unix_time_seconds_conversion.rb +44 -0
  920. data/lib/cosmos/conversions.rb +15 -0
  921. data/lib/cosmos/core_ext/array.rb +397 -0
  922. data/lib/cosmos/core_ext/class.rb +63 -0
  923. data/lib/cosmos/core_ext/cosmos_io.rb +46 -0
  924. data/lib/cosmos/core_ext/exception.rb +52 -0
  925. data/lib/cosmos/core_ext/file.rb +76 -0
  926. data/lib/cosmos/core_ext/hash.rb +28 -0
  927. data/lib/cosmos/core_ext/io.rb +122 -0
  928. data/lib/cosmos/core_ext/kernel.rb +33 -0
  929. data/lib/cosmos/core_ext/math.rb +119 -0
  930. data/lib/cosmos/core_ext/matrix.rb +149 -0
  931. data/lib/cosmos/core_ext/objectspace.rb +27 -0
  932. data/lib/cosmos/core_ext/range.rb +18 -0
  933. data/lib/cosmos/core_ext/socket.rb +32 -0
  934. data/lib/cosmos/core_ext/string.rb +351 -0
  935. data/lib/cosmos/core_ext/stringio.rb +24 -0
  936. data/lib/cosmos/core_ext/time.rb +483 -0
  937. data/lib/cosmos/core_ext.rb +18 -0
  938. data/lib/cosmos/dart/.rspec +1 -0
  939. data/lib/cosmos/dart/Rakefile +7 -0
  940. data/lib/cosmos/dart/app/assets/config/manifest.js +4 -0
  941. data/lib/cosmos/dart/app/assets/images/.keep +0 -0
  942. data/lib/cosmos/dart/app/assets/javascripts/application.js +13 -0
  943. data/lib/cosmos/dart/app/assets/javascripts/cable.js +13 -0
  944. data/lib/cosmos/dart/app/assets/stylesheets/application.css.scss +15 -0
  945. data/lib/cosmos/dart/app/channels/application_cable/channel.rb +4 -0
  946. data/lib/cosmos/dart/app/channels/application_cable/connection.rb +4 -0
  947. data/lib/cosmos/dart/app/controllers/application_controller.rb +3 -0
  948. data/lib/cosmos/dart/app/jobs/application_job.rb +2 -0
  949. data/lib/cosmos/dart/app/mailers/application_mailer.rb +4 -0
  950. data/lib/cosmos/dart/app/models/application_record.rb +3 -0
  951. data/lib/cosmos/dart/app/models/item.rb +6 -0
  952. data/lib/cosmos/dart/app/models/item_to_decom_table_mapping.rb +9 -0
  953. data/lib/cosmos/dart/app/models/packet.rb +4 -0
  954. data/lib/cosmos/dart/app/models/packet_config.rb +7 -0
  955. data/lib/cosmos/dart/app/models/packet_log.rb +3 -0
  956. data/lib/cosmos/dart/app/models/packet_log_entry.rb +41 -0
  957. data/lib/cosmos/dart/app/models/status.rb +2 -0
  958. data/lib/cosmos/dart/app/models/system_config.rb +2 -0
  959. data/lib/cosmos/dart/app/models/target.rb +4 -0
  960. data/lib/cosmos/dart/app/views/layouts/application.html.erb +14 -0
  961. data/lib/cosmos/dart/app/views/layouts/mailer.html.erb +13 -0
  962. data/lib/cosmos/dart/app/views/layouts/mailer.text.erb +1 -0
  963. data/lib/cosmos/dart/bin/bundle +3 -0
  964. data/lib/cosmos/dart/bin/rails +4 -0
  965. data/lib/cosmos/dart/bin/rake +4 -0
  966. data/lib/cosmos/dart/bin/setup +34 -0
  967. data/lib/cosmos/dart/bin/update +29 -0
  968. data/lib/cosmos/dart/config/application.rb +29 -0
  969. data/lib/cosmos/dart/config/boot.rb +3 -0
  970. data/lib/cosmos/dart/config/cable.yml +9 -0
  971. data/lib/cosmos/dart/config/database.yml +25 -0
  972. data/lib/cosmos/dart/config/environment.rb +5 -0
  973. data/lib/cosmos/dart/config/environments/development.rb +62 -0
  974. data/lib/cosmos/dart/config/environments/production.rb +84 -0
  975. data/lib/cosmos/dart/config/environments/test.rb +42 -0
  976. data/lib/cosmos/dart/config/initializers/application_controller_renderer.rb +6 -0
  977. data/lib/cosmos/dart/config/initializers/assets.rb +12 -0
  978. data/lib/cosmos/dart/config/initializers/backtrace_silencers.rb +7 -0
  979. data/lib/cosmos/dart/config/initializers/cookies_serializer.rb +5 -0
  980. data/lib/cosmos/dart/config/initializers/filter_parameter_logging.rb +4 -0
  981. data/lib/cosmos/dart/config/initializers/inflections.rb +16 -0
  982. data/lib/cosmos/dart/config/initializers/mime_types.rb +4 -0
  983. data/lib/cosmos/dart/config/initializers/new_framework_defaults.rb +25 -0
  984. data/lib/cosmos/dart/config/initializers/session_store.rb +3 -0
  985. data/lib/cosmos/dart/config/initializers/wrap_parameters.rb +14 -0
  986. data/lib/cosmos/dart/config/locales/en.yml +23 -0
  987. data/lib/cosmos/dart/config/puma.rb +47 -0
  988. data/lib/cosmos/dart/config/routes.rb +3 -0
  989. data/lib/cosmos/dart/config/secrets.yml +22 -0
  990. data/lib/cosmos/dart/config.ru +5 -0
  991. data/lib/cosmos/dart/db/migrate/20170406172907_create_targets.rb +8 -0
  992. data/lib/cosmos/dart/db/migrate/20170406172927_create_packets.rb +10 -0
  993. data/lib/cosmos/dart/db/migrate/20170406172937_create_packet_logs.rb +9 -0
  994. data/lib/cosmos/dart/db/migrate/20170406172943_create_packet_log_entries.rb +16 -0
  995. data/lib/cosmos/dart/db/migrate/20170406183500_change_packet_log_entries_primary_key.rb +5 -0
  996. data/lib/cosmos/dart/db/migrate/20170407153618_add_unique_requirements.rb +7 -0
  997. data/lib/cosmos/dart/db/migrate/20170511155447_add_meta_id_to_packet_log_entries.rb +6 -0
  998. data/lib/cosmos/dart/db/migrate/20170523185056_rename_received_time_and_add_is_tlm_to_packet_log_entries.rb +7 -0
  999. data/lib/cosmos/dart/db/migrate/20170525201157_create_items.rb +10 -0
  1000. data/lib/cosmos/dart/db/migrate/20170525201315_create_system_configs.rb +9 -0
  1001. data/lib/cosmos/dart/db/migrate/20170525201624_create_packet_configs.rb +11 -0
  1002. data/lib/cosmos/dart/db/migrate/20170525201745_create_item_to_decom_table_mappings.rb +12 -0
  1003. data/lib/cosmos/dart/db/migrate/20170525201939_create_decom_tables.rb +12 -0
  1004. data/lib/cosmos/dart/db/migrate/20170525202051_add_decom_state_to_packet_log_entry.rb +5 -0
  1005. data/lib/cosmos/dart/db/migrate/20170913160409_update_items.rb +6 -0
  1006. data/lib/cosmos/dart/db/migrate/20170913160558_update_item_to_decom_table_mapping.rb +11 -0
  1007. data/lib/cosmos/dart/db/migrate/20170913160916_udpate_decom_table.rb +6 -0
  1008. data/lib/cosmos/dart/db/migrate/20170913212026_add_ready_to_packet_configs.rb +5 -0
  1009. data/lib/cosmos/dart/db/migrate/20170913223556_modify_tables.rb +9 -0
  1010. data/lib/cosmos/dart/db/migrate/20170914215744_modify_mapping_table.rb +6 -0
  1011. data/lib/cosmos/dart/db/migrate/20170919201433_add_system_config_id_to_packet_config.rb +11 -0
  1012. data/lib/cosmos/dart/db/migrate/20170919210307_add_max_table_index_to_packet_configs.rb +5 -0
  1013. data/lib/cosmos/dart/db/migrate/20171215225546_add_ready_to_packet_log_entries.rb +5 -0
  1014. data/lib/cosmos/dart/db/migrate/20180116214338_add_index_for_ple_ready_to_packet_log_entries.rb +5 -0
  1015. data/lib/cosmos/dart/db/migrate/20180423205644_create_statuses.rb +22 -0
  1016. data/lib/cosmos/dart/db/migrate/20180425211340_add_decom_state_index.rb +5 -0
  1017. data/lib/cosmos/dart/db/migrate/20180509204705_remove_indexes.rb +29 -0
  1018. data/lib/cosmos/dart/db/migrate/20180510160002_remove_timestamps_from_ples.rb +6 -0
  1019. data/lib/cosmos/dart/db/migrate/20180511194944_add_packet_log_id_to_tables.rb +18 -0
  1020. data/lib/cosmos/dart/db/schema.rb +109 -0
  1021. data/lib/cosmos/dart/db/seeds.rb +15 -0
  1022. data/lib/cosmos/dart/examples/dart_decom_client.rb +45 -0
  1023. data/lib/cosmos/dart/examples/dart_stream_client.rb +97 -0
  1024. data/lib/cosmos/dart/lib/dart_common.rb +755 -0
  1025. data/lib/cosmos/dart/lib/dart_constants.rb +15 -0
  1026. data/lib/cosmos/dart/lib/dart_database_cleaner.rb +223 -0
  1027. data/lib/cosmos/dart/lib/dart_decom_query.rb +285 -0
  1028. data/lib/cosmos/dart/lib/dart_decommutator.rb +304 -0
  1029. data/lib/cosmos/dart/lib/dart_importer.rb +184 -0
  1030. data/lib/cosmos/dart/lib/dart_logging.rb +50 -0
  1031. data/lib/cosmos/dart/lib/dart_master_query.rb +71 -0
  1032. data/lib/cosmos/dart/lib/dart_packet_log_writer.rb +157 -0
  1033. data/lib/cosmos/dart/lib/dart_reducer_manager.rb +116 -0
  1034. data/lib/cosmos/dart/lib/dart_reducer_worker_thread.rb +305 -0
  1035. data/lib/cosmos/dart/lib/dart_tcpip_server_interface.rb +142 -0
  1036. data/lib/cosmos/dart/processes/dart.rb +148 -0
  1037. data/lib/cosmos/dart/processes/dart_decom_server.rb +40 -0
  1038. data/lib/cosmos/dart/processes/dart_import.rb +64 -0
  1039. data/lib/cosmos/dart/processes/dart_ingester.rb +132 -0
  1040. data/lib/cosmos/dart/processes/dart_master.rb +44 -0
  1041. data/lib/cosmos/dart/processes/dart_reducer.rb +28 -0
  1042. data/lib/cosmos/dart/processes/dart_stream_server.rb +32 -0
  1043. data/lib/cosmos/dart/processes/dart_util.rb +262 -0
  1044. data/lib/cosmos/dart/processes/dart_worker.rb +38 -0
  1045. data/lib/cosmos/dart/spec/dart/dart_common_spec.rb +333 -0
  1046. data/lib/cosmos/dart/spec/dart/dart_database_cleaner_spec.rb +455 -0
  1047. data/lib/cosmos/dart/spec/dart/dart_decom_query_spec.rb +154 -0
  1048. data/lib/cosmos/dart/spec/dart/dart_decommutator_spec.rb +337 -0
  1049. data/lib/cosmos/dart/spec/dart/dart_importer_spec.rb +84 -0
  1050. data/lib/cosmos/dart/spec/dart/dart_logging_spec.rb +30 -0
  1051. data/lib/cosmos/dart/spec/dart/dart_packet_log_writer_spec.rb +152 -0
  1052. data/lib/cosmos/dart/spec/dart/dart_reducer_manager_spec.rb +290 -0
  1053. data/lib/cosmos/dart/spec/dart/dart_tcpip_server_interface_spec.rb +240 -0
  1054. data/lib/cosmos/dart/spec/rails_helper.rb +60 -0
  1055. data/lib/cosmos/dart/spec/spec_helper.rb +139 -0
  1056. data/lib/cosmos/ext/.keep +0 -0
  1057. data/lib/cosmos/gui/choosers/combobox_chooser.rb +141 -0
  1058. data/lib/cosmos/gui/choosers/file_chooser.rb +85 -0
  1059. data/lib/cosmos/gui/choosers/float_chooser.rb +67 -0
  1060. data/lib/cosmos/gui/choosers/integer_chooser.rb +69 -0
  1061. data/lib/cosmos/gui/choosers/string_chooser.rb +35 -0
  1062. data/lib/cosmos/gui/choosers/telemetry_chooser.rb +326 -0
  1063. data/lib/cosmos/gui/choosers/value_chooser.rb +67 -0
  1064. data/lib/cosmos/gui/dialogs/about_dialog.rb +166 -0
  1065. data/lib/cosmos/gui/dialogs/calendar_dialog.rb +140 -0
  1066. data/lib/cosmos/gui/dialogs/cmd_details_dialog.rb +51 -0
  1067. data/lib/cosmos/gui/dialogs/cmd_tlm_raw_dialog.rb +167 -0
  1068. data/lib/cosmos/gui/dialogs/dart_dialog.rb +60 -0
  1069. data/lib/cosmos/gui/dialogs/details_dialog.rb +205 -0
  1070. data/lib/cosmos/gui/dialogs/exception_dialog.rb +121 -0
  1071. data/lib/cosmos/gui/dialogs/exception_list_dialog.rb +60 -0
  1072. data/lib/cosmos/gui/dialogs/find_replace_dialog.rb +272 -0
  1073. data/lib/cosmos/gui/dialogs/interface_raw_dialog.rb +143 -0
  1074. data/lib/cosmos/gui/dialogs/legal_dialog.rb +184 -0
  1075. data/lib/cosmos/gui/dialogs/packet_log_dialog.rb +97 -0
  1076. data/lib/cosmos/gui/dialogs/progress_dialog.rb +313 -0
  1077. data/lib/cosmos/gui/dialogs/pry_dialog.rb +169 -0
  1078. data/lib/cosmos/gui/dialogs/scroll_text_dialog.rb +48 -0
  1079. data/lib/cosmos/gui/dialogs/select_dialog.rb +59 -0
  1080. data/lib/cosmos/gui/dialogs/set_tlm_dialog.rb +159 -0
  1081. data/lib/cosmos/gui/dialogs/splash.rb +145 -0
  1082. data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +202 -0
  1083. data/lib/cosmos/gui/dialogs/tlm_edit_dialog.rb +79 -0
  1084. data/lib/cosmos/gui/dialogs/tlm_graph_dialog.rb +110 -0
  1085. data/lib/cosmos/gui/line_graph/line_graph.rb +482 -0
  1086. data/lib/cosmos/gui/line_graph/line_graph_dialog.rb +36 -0
  1087. data/lib/cosmos/gui/line_graph/line_graph_drawing.rb +521 -0
  1088. data/lib/cosmos/gui/line_graph/line_graph_popups.rb +112 -0
  1089. data/lib/cosmos/gui/line_graph/line_graph_scaling.rb +452 -0
  1090. data/lib/cosmos/gui/line_graph/line_graph_script.rb +81 -0
  1091. data/lib/cosmos/gui/line_graph/lines.rb +304 -0
  1092. data/lib/cosmos/gui/line_graph/overview_graph.rb +474 -0
  1093. data/lib/cosmos/gui/opengl/earth_model.rb +25 -0
  1094. data/lib/cosmos/gui/opengl/gl_bounds.rb +55 -0
  1095. data/lib/cosmos/gui/opengl/gl_light.rb +38 -0
  1096. data/lib/cosmos/gui/opengl/gl_material.rb +28 -0
  1097. data/lib/cosmos/gui/opengl/gl_scene.rb +78 -0
  1098. data/lib/cosmos/gui/opengl/gl_shape.rb +148 -0
  1099. data/lib/cosmos/gui/opengl/gl_viewer.rb +715 -0
  1100. data/lib/cosmos/gui/opengl/gl_viewport.rb +34 -0
  1101. data/lib/cosmos/gui/opengl/moon_model.rb +25 -0
  1102. data/lib/cosmos/gui/opengl/opengl.rb +14 -0
  1103. data/lib/cosmos/gui/opengl/stl_reader.rb +210 -0
  1104. data/lib/cosmos/gui/opengl/stl_shape.rb +127 -0
  1105. data/lib/cosmos/gui/opengl/texture_mapped_sphere.rb +204 -0
  1106. data/lib/cosmos/gui/qt.rb +858 -0
  1107. data/lib/cosmos/gui/qt_tool.rb +524 -0
  1108. data/lib/cosmos/gui/text/completion.rb +403 -0
  1109. data/lib/cosmos/gui/text/completion_line_edit.rb +30 -0
  1110. data/lib/cosmos/gui/text/completion_text_edit.rb +198 -0
  1111. data/lib/cosmos/gui/text/ruby_editor.rb +505 -0
  1112. data/lib/cosmos/gui/utilities/analyze_log.rb +153 -0
  1113. data/lib/cosmos/gui/utilities/classification_banner.rb +60 -0
  1114. data/lib/cosmos/gui/utilities/screenshot.rb +33 -0
  1115. data/lib/cosmos/gui/utilities/script_module_gui.rb +390 -0
  1116. data/lib/cosmos/gui/widgets/dart_frame.rb +142 -0
  1117. data/lib/cosmos/gui/widgets/dart_meta_frame.rb +145 -0
  1118. data/lib/cosmos/gui/widgets/full_text_search_line_edit.rb +171 -0
  1119. data/lib/cosmos/gui/widgets/packet_log_frame.rb +374 -0
  1120. data/lib/cosmos/gui/widgets/realtime_button_bar.rb +99 -0
  1121. data/lib/cosmos/interfaces/cmd_tlm_server_interface.rb +134 -0
  1122. data/lib/cosmos/interfaces/dart_status_interface.rb +91 -0
  1123. data/lib/cosmos/interfaces/interface.rb +456 -0
  1124. data/lib/cosmos/interfaces/linc_interface.rb +459 -0
  1125. data/lib/cosmos/interfaces/protocols/burst_protocol.rb +183 -0
  1126. data/lib/cosmos/interfaces/protocols/crc_protocol.rb +183 -0
  1127. data/lib/cosmos/interfaces/protocols/fixed_protocol.rb +144 -0
  1128. data/lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb +46 -0
  1129. data/lib/cosmos/interfaces/protocols/length_protocol.rb +154 -0
  1130. data/lib/cosmos/interfaces/protocols/override_protocol.rb +52 -0
  1131. data/lib/cosmos/interfaces/protocols/preidentified_protocol.rb +187 -0
  1132. data/lib/cosmos/interfaces/protocols/protocol.rb +73 -0
  1133. data/lib/cosmos/interfaces/protocols/template_protocol.rb +253 -0
  1134. data/lib/cosmos/interfaces/protocols/terminated_protocol.rb +83 -0
  1135. data/lib/cosmos/interfaces/serial_interface.rb +91 -0
  1136. data/lib/cosmos/interfaces/simulated_target_interface.rb +149 -0
  1137. data/lib/cosmos/interfaces/stream_interface.rb +65 -0
  1138. data/lib/cosmos/interfaces/tcpip_client_interface.rb +60 -0
  1139. data/lib/cosmos/interfaces/tcpip_server_interface.rb +624 -0
  1140. data/lib/cosmos/interfaces/udp_interface.rb +154 -0
  1141. data/lib/cosmos/interfaces.rb +24 -0
  1142. data/lib/cosmos/io/buffered_file.rb +100 -0
  1143. data/lib/cosmos/io/cosmos_snmp.rb +50 -0
  1144. data/lib/cosmos/io/io_multiplexer.rb +75 -0
  1145. data/lib/cosmos/io/json_drb.rb +307 -0
  1146. data/lib/cosmos/io/json_drb_object.rb +172 -0
  1147. data/lib/cosmos/io/json_drb_rack.rb +99 -0
  1148. data/lib/cosmos/io/json_rpc.rb +394 -0
  1149. data/lib/cosmos/io/posix_serial_driver.rb +187 -0
  1150. data/lib/cosmos/io/raw_logger.rb +170 -0
  1151. data/lib/cosmos/io/raw_logger_pair.rb +71 -0
  1152. data/lib/cosmos/io/serial_driver.rb +101 -0
  1153. data/lib/cosmos/io/stderr.rb +36 -0
  1154. data/lib/cosmos/io/stdout.rb +36 -0
  1155. data/lib/cosmos/io/udp_sockets.rb +196 -0
  1156. data/lib/cosmos/io/win32_serial_driver.rb +187 -0
  1157. data/lib/cosmos/packet_logs/ccsds_log_reader.rb +104 -0
  1158. data/lib/cosmos/packet_logs/packet_log_reader.rb +504 -0
  1159. data/lib/cosmos/packet_logs/packet_log_writer.rb +353 -0
  1160. data/lib/cosmos/packet_logs/packet_log_writer_pair.rb +30 -0
  1161. data/lib/cosmos/packet_logs.rb +6 -0
  1162. data/lib/cosmos/packets/binary_accessor.rb +1201 -0
  1163. data/lib/cosmos/packets/commands.rb +361 -0
  1164. data/lib/cosmos/packets/limits.rb +264 -0
  1165. data/lib/cosmos/packets/limits_response.rb +42 -0
  1166. data/lib/cosmos/packets/packet.rb +1075 -0
  1167. data/lib/cosmos/packets/packet_config.rb +614 -0
  1168. data/lib/cosmos/packets/packet_item.rb +442 -0
  1169. data/lib/cosmos/packets/packet_item_limits.rb +128 -0
  1170. data/lib/cosmos/packets/parsers/format_string_parser.rb +58 -0
  1171. data/lib/cosmos/packets/parsers/limits_parser.rb +147 -0
  1172. data/lib/cosmos/packets/parsers/limits_response_parser.rb +52 -0
  1173. data/lib/cosmos/packets/parsers/macro_parser.rb +121 -0
  1174. data/lib/cosmos/packets/parsers/packet_item_parser.rb +252 -0
  1175. data/lib/cosmos/packets/parsers/packet_parser.rb +124 -0
  1176. data/lib/cosmos/packets/parsers/processor_parser.rb +63 -0
  1177. data/lib/cosmos/packets/parsers/state_parser.rb +118 -0
  1178. data/lib/cosmos/packets/parsers/xtce_converter.rb +428 -0
  1179. data/lib/cosmos/packets/parsers/xtce_parser.rb +694 -0
  1180. data/lib/cosmos/packets/structure.rb +557 -0
  1181. data/lib/cosmos/packets/structure_item.rb +326 -0
  1182. data/lib/cosmos/packets/telemetry.rb +470 -0
  1183. data/lib/cosmos/processors/new_packet_log_processor.rb +39 -0
  1184. data/lib/cosmos/processors/processor.rb +76 -0
  1185. data/lib/cosmos/processors/statistics_processor.rb +72 -0
  1186. data/lib/cosmos/processors/watermark_processor.rb +49 -0
  1187. data/lib/cosmos/processors.rb +6 -0
  1188. data/lib/cosmos/script/api_shared.rb +995 -0
  1189. data/lib/cosmos/script/cmd_tlm_server.rb +216 -0
  1190. data/lib/cosmos/script/commands.rb +177 -0
  1191. data/lib/cosmos/script/extract.rb +141 -0
  1192. data/lib/cosmos/script/limits.rb +120 -0
  1193. data/lib/cosmos/script/replay.rb +60 -0
  1194. data/lib/cosmos/script/script.rb +149 -0
  1195. data/lib/cosmos/script/scripting.rb +146 -0
  1196. data/lib/cosmos/script/telemetry.rb +218 -0
  1197. data/lib/cosmos/script/tools.rb +121 -0
  1198. data/lib/cosmos/script.rb +9 -0
  1199. data/lib/cosmos/streams/serial_stream.rb +160 -0
  1200. data/lib/cosmos/streams/stream.rb +54 -0
  1201. data/lib/cosmos/streams/tcpip_client_stream.rb +113 -0
  1202. data/lib/cosmos/streams/tcpip_socket_stream.rb +186 -0
  1203. data/lib/cosmos/system/system.rb +1029 -0
  1204. data/lib/cosmos/system/target.rb +262 -0
  1205. data/lib/cosmos/system.rb +4 -0
  1206. data/lib/cosmos/tools/cmd_extractor/cmd_extractor.rb +470 -0
  1207. data/lib/cosmos/tools/cmd_sender/cmd_param_table_item_delegate.rb +94 -0
  1208. data/lib/cosmos/tools/cmd_sender/cmd_params.rb +382 -0
  1209. data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +533 -0
  1210. data/lib/cosmos/tools/cmd_sender/cmd_sender_text_edit.rb +70 -0
  1211. data/lib/cosmos/tools/cmd_sequence/cmd_sequence.rb +769 -0
  1212. data/lib/cosmos/tools/cmd_sequence/sequence_item.rb +221 -0
  1213. data/lib/cosmos/tools/cmd_sequence/sequence_list.rb +206 -0
  1214. data/lib/cosmos/tools/cmd_tlm_server/api.rb +1694 -0
  1215. data/lib/cosmos/tools/cmd_tlm_server/background_task.rb +54 -0
  1216. data/lib/cosmos/tools/cmd_tlm_server/background_tasks.rb +82 -0
  1217. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +785 -0
  1218. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +294 -0
  1219. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +650 -0
  1220. data/lib/cosmos/tools/cmd_tlm_server/commanding.rb +132 -0
  1221. data/lib/cosmos/tools/cmd_tlm_server/connections.rb +175 -0
  1222. data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +216 -0
  1223. data/lib/cosmos/tools/cmd_tlm_server/gui/logging_tab.rb +181 -0
  1224. data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +163 -0
  1225. data/lib/cosmos/tools/cmd_tlm_server/gui/replay_tab.rb +319 -0
  1226. data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +270 -0
  1227. data/lib/cosmos/tools/cmd_tlm_server/gui/targets_tab.rb +93 -0
  1228. data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +292 -0
  1229. data/lib/cosmos/tools/cmd_tlm_server/interfaces.rb +153 -0
  1230. data/lib/cosmos/tools/cmd_tlm_server/limits_groups_background_task.rb +124 -0
  1231. data/lib/cosmos/tools/cmd_tlm_server/packet_logging.rb +161 -0
  1232. data/lib/cosmos/tools/cmd_tlm_server/replay_backend.rb +511 -0
  1233. data/lib/cosmos/tools/cmd_tlm_server/router_thread.rb +71 -0
  1234. data/lib/cosmos/tools/cmd_tlm_server/routers.rb +144 -0
  1235. data/lib/cosmos/tools/config_editor/config_editor.rb +918 -0
  1236. data/lib/cosmos/tools/config_editor/config_editor_frame.rb +686 -0
  1237. data/lib/cosmos/tools/config_editor/system_config_dialog.rb +158 -0
  1238. data/lib/cosmos/tools/data_viewer/data_viewer.rb +789 -0
  1239. data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +121 -0
  1240. data/lib/cosmos/tools/data_viewer/dump_component.rb +34 -0
  1241. data/lib/cosmos/tools/data_viewer/text_component.rb +77 -0
  1242. data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +182 -0
  1243. data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +380 -0
  1244. data/lib/cosmos/tools/launcher/launcher.rb +195 -0
  1245. data/lib/cosmos/tools/launcher/launcher_config.rb +245 -0
  1246. data/lib/cosmos/tools/launcher/launcher_multitool.rb +40 -0
  1247. data/lib/cosmos/tools/launcher/launcher_tool.rb +116 -0
  1248. data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +1029 -0
  1249. data/lib/cosmos/tools/opengl_builder/opengl_builder.rb +416 -0
  1250. data/lib/cosmos/tools/opengl_builder/scene_config.rb +118 -0
  1251. data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +641 -0
  1252. data/lib/cosmos/tools/replay/replay.rb +17 -0
  1253. data/lib/cosmos/tools/script_runner/script_audit.rb +148 -0
  1254. data/lib/cosmos/tools/script_runner/script_runner.rb +1066 -0
  1255. data/lib/cosmos/tools/script_runner/script_runner_config.rb +53 -0
  1256. data/lib/cosmos/tools/script_runner/script_runner_frame.rb +1985 -0
  1257. data/lib/cosmos/tools/table_manager/table.rb +61 -0
  1258. data/lib/cosmos/tools/table_manager/table_config.rb +191 -0
  1259. data/lib/cosmos/tools/table_manager/table_item.rb +58 -0
  1260. data/lib/cosmos/tools/table_manager/table_item_parser.rb +48 -0
  1261. data/lib/cosmos/tools/table_manager/table_manager.rb +1152 -0
  1262. data/lib/cosmos/tools/table_manager/table_manager_core.rb +320 -0
  1263. data/lib/cosmos/tools/table_manager/table_parser.rb +75 -0
  1264. data/lib/cosmos/tools/test_runner/results_writer.rb +287 -0
  1265. data/lib/cosmos/tools/test_runner/test.rb +540 -0
  1266. data/lib/cosmos/tools/test_runner/test_runner.rb +1302 -0
  1267. data/lib/cosmos/tools/test_runner/test_runner_chooser.rb +353 -0
  1268. data/lib/cosmos/tools/tlm_extractor/text_item_chooser.rb +60 -0
  1269. data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +1305 -0
  1270. data/lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb +535 -0
  1271. data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +131 -0
  1272. data/lib/cosmos/tools/tlm_grapher/data_object_adders/housekeeping_data_object_adder.rb +92 -0
  1273. data/lib/cosmos/tools/tlm_grapher/data_object_adders/singlexy_data_object_adder.rb +44 -0
  1274. data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +95 -0
  1275. data/lib/cosmos/tools/tlm_grapher/data_object_editors/data_object_editor.rb +61 -0
  1276. data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +250 -0
  1277. data/lib/cosmos/tools/tlm_grapher/data_object_editors/linegraph_data_object_editor.rb +141 -0
  1278. data/lib/cosmos/tools/tlm_grapher/data_object_editors/singlexy_data_object_editor.rb +30 -0
  1279. data/lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb +210 -0
  1280. data/lib/cosmos/tools/tlm_grapher/data_objects/data_object.rb +232 -0
  1281. data/lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb +503 -0
  1282. data/lib/cosmos/tools/tlm_grapher/data_objects/linegraph_data_object.rb +173 -0
  1283. data/lib/cosmos/tools/tlm_grapher/data_objects/singlexy_data_object.rb +21 -0
  1284. data/lib/cosmos/tools/tlm_grapher/data_objects/xy_data_object.rb +381 -0
  1285. data/lib/cosmos/tools/tlm_grapher/plot_editors/linegraph_plot_editor.rb +191 -0
  1286. data/lib/cosmos/tools/tlm_grapher/plot_editors/plot_editor.rb +28 -0
  1287. data/lib/cosmos/tools/tlm_grapher/plot_editors/singlexy_plot_editor.rb +30 -0
  1288. data/lib/cosmos/tools/tlm_grapher/plot_editors/xy_plot_editor.rb +59 -0
  1289. data/lib/cosmos/tools/tlm_grapher/plot_gui_objects/linegraph_plot_gui_object.rb +173 -0
  1290. data/lib/cosmos/tools/tlm_grapher/plot_gui_objects/singlexy_plot_gui_object.rb +27 -0
  1291. data/lib/cosmos/tools/tlm_grapher/plot_gui_objects/xy_plot_gui_object.rb +74 -0
  1292. data/lib/cosmos/tools/tlm_grapher/plots/linegraph_plot.rb +209 -0
  1293. data/lib/cosmos/tools/tlm_grapher/plots/plot.rb +69 -0
  1294. data/lib/cosmos/tools/tlm_grapher/plots/singlexy_plot.rb +20 -0
  1295. data/lib/cosmos/tools/tlm_grapher/plots/xy_plot.rb +61 -0
  1296. data/lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb +1291 -0
  1297. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_config.rb +447 -0
  1298. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_dart_thread.rb +164 -0
  1299. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_data_object_editor.rb +107 -0
  1300. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_logfile_thread.rb +114 -0
  1301. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_plot_editor.rb +101 -0
  1302. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_realtime_thread.rb +79 -0
  1303. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tab.rb +57 -0
  1304. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tool.rb +1079 -0
  1305. data/lib/cosmos/tools/tlm_grapher/tlm_grapher.rb +104 -0
  1306. data/lib/cosmos/tools/tlm_viewer/screen.rb +590 -0
  1307. data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +615 -0
  1308. data/lib/cosmos/tools/tlm_viewer/tlm_viewer_config.rb +314 -0
  1309. data/lib/cosmos/tools/tlm_viewer/widgets/aging_widget.rb +109 -0
  1310. data/lib/cosmos/tools/tlm_viewer/widgets/array_widget.rb +65 -0
  1311. data/lib/cosmos/tools/tlm_viewer/widgets/backgroundbutton_widget.rb +54 -0
  1312. data/lib/cosmos/tools/tlm_viewer/widgets/block_widget.rb +56 -0
  1313. data/lib/cosmos/tools/tlm_viewer/widgets/button_widget.rb +39 -0
  1314. data/lib/cosmos/tools/tlm_viewer/widgets/canvas_clickable.rb +47 -0
  1315. data/lib/cosmos/tools/tlm_viewer/widgets/canvas_widget.rb +84 -0
  1316. data/lib/cosmos/tools/tlm_viewer/widgets/canvasdot_widget.rb +78 -0
  1317. data/lib/cosmos/tools/tlm_viewer/widgets/canvasellipse_widget.rb +40 -0
  1318. data/lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb +48 -0
  1319. data/lib/cosmos/tools/tlm_viewer/widgets/canvasimagevalue_widget.rb +109 -0
  1320. data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabel_widget.rb +45 -0
  1321. data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabelvalue_widget.rb +55 -0
  1322. data/lib/cosmos/tools/tlm_viewer/widgets/canvasline_widget.rb +55 -0
  1323. data/lib/cosmos/tools/tlm_viewer/widgets/canvaslinevalue_widget.rb +67 -0
  1324. data/lib/cosmos/tools/tlm_viewer/widgets/canvasvalue_widget.rb +131 -0
  1325. data/lib/cosmos/tools/tlm_viewer/widgets/checkbutton_widget.rb +40 -0
  1326. data/lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb +32 -0
  1327. data/lib/cosmos/tools/tlm_viewer/widgets/formatfontvalue_widget.rb +31 -0
  1328. data/lib/cosmos/tools/tlm_viewer/widgets/formatvalue_widget.rb +32 -0
  1329. data/lib/cosmos/tools/tlm_viewer/widgets/horizontal_widget.rb +27 -0
  1330. data/lib/cosmos/tools/tlm_viewer/widgets/horizontalbox_widget.rb +30 -0
  1331. data/lib/cosmos/tools/tlm_viewer/widgets/horizontalline_widget.rb +24 -0
  1332. data/lib/cosmos/tools/tlm_viewer/widgets/label_widget.rb +31 -0
  1333. data/lib/cosmos/tools/tlm_viewer/widgets/labelformatvalue_widget.rb +38 -0
  1334. data/lib/cosmos/tools/tlm_viewer/widgets/labelled_widget.rb +58 -0
  1335. data/lib/cosmos/tools/tlm_viewer/widgets/labelprogressbar_widget.rb +37 -0
  1336. data/lib/cosmos/tools/tlm_viewer/widgets/labeltrendlimitsbar_widget.rb +36 -0
  1337. data/lib/cosmos/tools/tlm_viewer/widgets/labelvalue_widget.rb +58 -0
  1338. data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluedesc_widget.rb +40 -0
  1339. data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitsbar_widget.rb +36 -0
  1340. data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitscolumn_widget.rb +37 -0
  1341. data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangebar_widget.rb +36 -0
  1342. data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangecolumn_widget.rb +38 -0
  1343. data/lib/cosmos/tools/tlm_viewer/widgets/layout_widget.rb +32 -0
  1344. data/lib/cosmos/tools/tlm_viewer/widgets/led_widget.rb +108 -0
  1345. data/lib/cosmos/tools/tlm_viewer/widgets/limits_widget.rb +163 -0
  1346. data/lib/cosmos/tools/tlm_viewer/widgets/limitsbar_widget.rb +130 -0
  1347. data/lib/cosmos/tools/tlm_viewer/widgets/limitscolor_widget.rb +108 -0
  1348. data/lib/cosmos/tools/tlm_viewer/widgets/limitscolumn_widget.rb +130 -0
  1349. data/lib/cosmos/tools/tlm_viewer/widgets/linegraph_widget.rb +62 -0
  1350. data/lib/cosmos/tools/tlm_viewer/widgets/matrixbycolumns_widget.rb +59 -0
  1351. data/lib/cosmos/tools/tlm_viewer/widgets/multi_widget.rb +114 -0
  1352. data/lib/cosmos/tools/tlm_viewer/widgets/progressbar_widget.rb +39 -0
  1353. data/lib/cosmos/tools/tlm_viewer/widgets/radiobutton_widget.rb +41 -0
  1354. data/lib/cosmos/tools/tlm_viewer/widgets/rangebar_widget.rb +63 -0
  1355. data/lib/cosmos/tools/tlm_viewer/widgets/rangecolumn_widget.rb +63 -0
  1356. data/lib/cosmos/tools/tlm_viewer/widgets/screenshotbutton_widget.rb +35 -0
  1357. data/lib/cosmos/tools/tlm_viewer/widgets/scrollwindow_widget.rb +34 -0
  1358. data/lib/cosmos/tools/tlm_viewer/widgets/sectionheader_widget.rb +32 -0
  1359. data/lib/cosmos/tools/tlm_viewer/widgets/spacer_widget.rb +53 -0
  1360. data/lib/cosmos/tools/tlm_viewer/widgets/tabbook_widget.rb +25 -0
  1361. data/lib/cosmos/tools/tlm_viewer/widgets/tabitem_widget.rb +27 -0
  1362. data/lib/cosmos/tools/tlm_viewer/widgets/textbox_widget.rb +56 -0
  1363. data/lib/cosmos/tools/tlm_viewer/widgets/textfield_widget.rb +25 -0
  1364. data/lib/cosmos/tools/tlm_viewer/widgets/timegraph_widget.rb +86 -0
  1365. data/lib/cosmos/tools/tlm_viewer/widgets/title_widget.rb +21 -0
  1366. data/lib/cosmos/tools/tlm_viewer/widgets/trendbar_widget.rb +125 -0
  1367. data/lib/cosmos/tools/tlm_viewer/widgets/trendlimitsbar_widget.rb +48 -0
  1368. data/lib/cosmos/tools/tlm_viewer/widgets/value_widget.rb +43 -0
  1369. data/lib/cosmos/tools/tlm_viewer/widgets/valuelimitsbar_widget.rb +36 -0
  1370. data/lib/cosmos/tools/tlm_viewer/widgets/valuelimitscolumn_widget.rb +36 -0
  1371. data/lib/cosmos/tools/tlm_viewer/widgets/valuerangebar_widget.rb +36 -0
  1372. data/lib/cosmos/tools/tlm_viewer/widgets/valuerangecolumn_widget.rb +36 -0
  1373. data/lib/cosmos/tools/tlm_viewer/widgets/vertical_widget.rb +37 -0
  1374. data/lib/cosmos/tools/tlm_viewer/widgets/verticalbox_widget.rb +40 -0
  1375. data/lib/cosmos/tools/tlm_viewer/widgets/widget.rb +270 -0
  1376. data/lib/cosmos/tools/tlm_viewer/widgets.rb +65 -0
  1377. data/lib/cosmos/top_level.rb +825 -0
  1378. data/lib/cosmos/utilities/crc.rb +271 -0
  1379. data/lib/cosmos/utilities/csv.rb +190 -0
  1380. data/lib/cosmos/utilities/logger.rb +137 -0
  1381. data/lib/cosmos/utilities/low_fragmentation_array.rb +19 -0
  1382. data/lib/cosmos/utilities/message_log.rb +80 -0
  1383. data/lib/cosmos/utilities/quaternion.rb +258 -0
  1384. data/lib/cosmos/utilities/ruby_lex_utils.rb +312 -0
  1385. data/lib/cosmos/utilities/simulated_target.rb +100 -0
  1386. data/lib/cosmos/utilities/sleeper.rb +44 -0
  1387. data/lib/cosmos/utilities.rb +11 -0
  1388. data/lib/cosmos/version.rb +12 -0
  1389. data/lib/cosmos/win32/excel.rb +123 -0
  1390. data/lib/cosmos/win32/win32.rb +381 -0
  1391. data/lib/cosmos/win32/win32_main.rb +325 -0
  1392. data/lib/cosmos.rb +63 -0
  1393. data/make_gems.sh +10 -0
  1394. data/roodi.yml +24 -0
  1395. data/run_gui_tests.bat +46 -0
  1396. data/spec/ccsds/ccsds_packet_spec.rb +67 -0
  1397. data/spec/ccsds/ccsds_parser_spec.rb +148 -0
  1398. data/spec/config/config_parser_spec.rb +399 -0
  1399. data/spec/conversions/conversion_spec.rb +31 -0
  1400. data/spec/conversions/generic_conversion_spec.rb +45 -0
  1401. data/spec/conversions/new_packet_log_conversion_spec.rb +39 -0
  1402. data/spec/conversions/packet_time_formatted_conversion_spec.rb +58 -0
  1403. data/spec/conversions/packet_time_seconds_conversion_spec.rb +60 -0
  1404. data/spec/conversions/polynomial_conversion_spec.rb +40 -0
  1405. data/spec/conversions/processor_conversion_spec.rb +45 -0
  1406. data/spec/conversions/received_count_conversion_spec.rb +43 -0
  1407. data/spec/conversions/received_time_formatted_conversion_spec.rb +49 -0
  1408. data/spec/conversions/received_time_seconds_conversion_spec.rb +50 -0
  1409. data/spec/conversions/segmented_polynomial_conversion_spec.rb +51 -0
  1410. data/spec/conversions/unix_time_formatted_conversion_spec.rb +74 -0
  1411. data/spec/conversions/unix_time_seconds_conversion_spec.rb +76 -0
  1412. data/spec/core_ext/array_spec.rb +247 -0
  1413. data/spec/core_ext/class_spec.rb +90 -0
  1414. data/spec/core_ext/cosmos_io_spec.rb +77 -0
  1415. data/spec/core_ext/exception_spec.rb +91 -0
  1416. data/spec/core_ext/file_spec.rb +72 -0
  1417. data/spec/core_ext/hash_spec.rb +24 -0
  1418. data/spec/core_ext/io_spec.rb +46 -0
  1419. data/spec/core_ext/kernel_spec.rb +54 -0
  1420. data/spec/core_ext/math_spec.rb +116 -0
  1421. data/spec/core_ext/matrix_spec.rb +127 -0
  1422. data/spec/core_ext/objectspace_spec.rb +32 -0
  1423. data/spec/core_ext/range_spec.rb +21 -0
  1424. data/spec/core_ext/socket_spec.rb +34 -0
  1425. data/spec/core_ext/string_spec.rb +239 -0
  1426. data/spec/core_ext/stringio_spec.rb +21 -0
  1427. data/spec/core_ext/time_spec.rb +222 -0
  1428. data/spec/gui/line_graph/line_clip_spec.rb +324 -0
  1429. data/spec/gui/qt_spec.rb +104 -0
  1430. data/spec/gui/utilities/script_module_gui_spec.rb +83 -0
  1431. data/spec/install/config/data/data.txt +1 -0
  1432. data/spec/install/config/system/system.txt +27 -0
  1433. data/spec/install/config/targets/INST/cmd_tlm/inst_cmd_linc.txt +30 -0
  1434. data/spec/install/config/targets/INST/cmd_tlm/inst_cmds.txt +113 -0
  1435. data/spec/install/config/targets/INST/cmd_tlm/inst_tlm.txt +236 -0
  1436. data/spec/install/config/targets/INST/cmd_tlm/inst_tlm_linc.txt +25 -0
  1437. data/spec/install/config/targets/INST/cmd_tlm_server.txt +5 -0
  1438. data/spec/install/config/targets/INST/lib/sim_inst.rb +305 -0
  1439. data/spec/install/config/targets/INST/screens/hs.txt +42 -0
  1440. data/spec/install/config/targets/INST/target.txt +12 -0
  1441. data/spec/install/config/targets/SYSTEM/cmd_tlm/limits_groups.txt +7 -0
  1442. data/spec/install/config/targets/SYSTEM/cmd_tlm/meta_tlm.txt +10 -0
  1443. data/spec/install/config/targets/SYSTEM/cmd_tlm/system_cmds.txt +41 -0
  1444. data/spec/install/config/targets/SYSTEM/cmd_tlm/system_tlm.txt +7 -0
  1445. data/spec/install/config/targets/SYSTEM/cmd_tlm_server.txt +6 -0
  1446. data/spec/install/config/targets/SYSTEM/screens/status.txt +12 -0
  1447. data/spec/install/config/targets/SYSTEM/target.txt +12 -0
  1448. data/spec/install/config/tools/cmd_tlm_server/cmd_tlm_server.txt +4 -0
  1449. data/spec/install/lib/README.txt +1 -0
  1450. data/spec/install/yaml_docs_spec.rb +132 -0
  1451. data/spec/interfaces/cmd_tlm_server_interface_spec.rb +149 -0
  1452. data/spec/interfaces/interface_spec.rb +513 -0
  1453. data/spec/interfaces/linc_interface_spec.rb +243 -0
  1454. data/spec/interfaces/protocols/burst_protocol_spec.rb +318 -0
  1455. data/spec/interfaces/protocols/crc_protocol_spec.rb +825 -0
  1456. data/spec/interfaces/protocols/fixed_protocol_spec.rb +154 -0
  1457. data/spec/interfaces/protocols/ignore_packet_protocol_spec.rb +243 -0
  1458. data/spec/interfaces/protocols/length_protocol_spec.rb +587 -0
  1459. data/spec/interfaces/protocols/override_protocol_spec.rb +162 -0
  1460. data/spec/interfaces/protocols/preidentified_protocol_spec.rb +368 -0
  1461. data/spec/interfaces/protocols/template_protocol_spec.rb +444 -0
  1462. data/spec/interfaces/protocols/terminated_protocol_spec.rb +174 -0
  1463. data/spec/interfaces/serial_interface_spec.rb +66 -0
  1464. data/spec/interfaces/simulated_target_interface_spec.rb +128 -0
  1465. data/spec/interfaces/tcpip_client_interface_spec.rb +60 -0
  1466. data/spec/interfaces/tcpip_server_interface_spec.rb +157 -0
  1467. data/spec/interfaces/udp_interface_spec.rb +249 -0
  1468. data/spec/io/buffered_file_spec.rb +146 -0
  1469. data/spec/io/io_multiplexer_spec.rb +102 -0
  1470. data/spec/io/json_drb_object_spec.rb +106 -0
  1471. data/spec/io/json_drb_rack_spec.rb +166 -0
  1472. data/spec/io/json_drb_spec.rb +251 -0
  1473. data/spec/io/json_rpc_spec.rb +270 -0
  1474. data/spec/io/posix_serial_driver_spec.rb +87 -0
  1475. data/spec/io/raw_logger_pair_spec.rb +76 -0
  1476. data/spec/io/raw_logger_spec.rb +138 -0
  1477. data/spec/io/serial_driver_spec.rb +64 -0
  1478. data/spec/io/stderr_spec.rb +32 -0
  1479. data/spec/io/stdout_spec.rb +32 -0
  1480. data/spec/io/udp_sockets_spec.rb +139 -0
  1481. data/spec/io/win32_serial_driver_spec.rb +129 -0
  1482. data/spec/packet_logs/packet_log_reader_spec.rb +607 -0
  1483. data/spec/packet_logs/packet_log_writer_pair_spec.rb +30 -0
  1484. data/spec/packet_logs/packet_log_writer_spec.rb +227 -0
  1485. data/spec/packets/binary_accessor_spec.rb +2323 -0
  1486. data/spec/packets/commands_spec.rb +401 -0
  1487. data/spec/packets/limits_response_spec.rb +25 -0
  1488. data/spec/packets/limits_spec.rb +344 -0
  1489. data/spec/packets/packet_config_spec.rb +862 -0
  1490. data/spec/packets/packet_item_limits_spec.rb +161 -0
  1491. data/spec/packets/packet_item_spec.rb +450 -0
  1492. data/spec/packets/packet_spec.rb +1499 -0
  1493. data/spec/packets/parsers/format_string_parser_spec.rb +122 -0
  1494. data/spec/packets/parsers/limits_parser_spec.rb +293 -0
  1495. data/spec/packets/parsers/limits_response_parser_spec.rb +149 -0
  1496. data/spec/packets/parsers/macro_parser_spec.rb +220 -0
  1497. data/spec/packets/parsers/packet_item_parser_spec.rb +405 -0
  1498. data/spec/packets/parsers/packet_parser_spec.rb +99 -0
  1499. data/spec/packets/parsers/processor_parser_spec.rb +114 -0
  1500. data/spec/packets/parsers/state_parser_spec.rb +247 -0
  1501. data/spec/packets/parsers/xtce_parser_spec.rb +395 -0
  1502. data/spec/packets/structure_item_spec.rb +200 -0
  1503. data/spec/packets/structure_spec.rb +657 -0
  1504. data/spec/packets/telemetry_spec.rb +629 -0
  1505. data/spec/processors/new_packet_log_processor_spec.rb +39 -0
  1506. data/spec/processors/processor_spec.rb +55 -0
  1507. data/spec/processors/statistics_processor_spec.rb +95 -0
  1508. data/spec/processors/watermark_processor_spec.rb +51 -0
  1509. data/spec/script/cmd_tlm_server_spec.rb +194 -0
  1510. data/spec/script/commands_disconnect_spec.rb +258 -0
  1511. data/spec/script/commands_spec.rb +283 -0
  1512. data/spec/script/extract_spec.rb +166 -0
  1513. data/spec/script/limits_spec.rb +133 -0
  1514. data/spec/script/script_spec.rb +80 -0
  1515. data/spec/script/scripting_spec.rb +742 -0
  1516. data/spec/script/telemetry_spec.rb +186 -0
  1517. data/spec/script/tools_spec.rb +111 -0
  1518. data/spec/spec_helper.rb +248 -0
  1519. data/spec/streams/serial_stream_spec.rb +122 -0
  1520. data/spec/streams/stream_spec.rb +30 -0
  1521. data/spec/streams/tcpip_client_stream_spec.rb +65 -0
  1522. data/spec/streams/tcpip_socket_stream_spec.rb +231 -0
  1523. data/spec/system/system_spec.rb +1081 -0
  1524. data/spec/system/target_spec.rb +368 -0
  1525. data/spec/tools/cmd_tlm_server/api_spec.rb +1656 -0
  1526. data/spec/tools/cmd_tlm_server/background_task_spec.rb +44 -0
  1527. data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +190 -0
  1528. data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +785 -0
  1529. data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +496 -0
  1530. data/spec/tools/cmd_tlm_server/commanding_spec.rb +171 -0
  1531. data/spec/tools/cmd_tlm_server/connections_spec.rb +231 -0
  1532. data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +319 -0
  1533. data/spec/tools/cmd_tlm_server/interfaces_spec.rb +248 -0
  1534. data/spec/tools/cmd_tlm_server/limits_groups_background_task_spec.rb +153 -0
  1535. data/spec/tools/cmd_tlm_server/packet_logging_spec.rb +139 -0
  1536. data/spec/tools/cmd_tlm_server/router_thread_spec.rb +150 -0
  1537. data/spec/tools/cmd_tlm_server/routers_spec.rb +219 -0
  1538. data/spec/tools/launcher/launcher_config_spec.rb +474 -0
  1539. data/spec/tools/table_manager/table_config_spec.rb +225 -0
  1540. data/spec/tools/table_manager/table_item_parser_spec.rb +61 -0
  1541. data/spec/tools/table_manager/table_item_spec.rb +57 -0
  1542. data/spec/tools/table_manager/table_parser_spec.rb +96 -0
  1543. data/spec/tools/table_manager/table_spec.rb +90 -0
  1544. data/spec/tools/table_manager/tablemanager_core_spec.rb +556 -0
  1545. data/spec/tools/tlm_viewer/tlm_viewer_config_spec.rb +403 -0
  1546. data/spec/top_level/top_level_spec.rb +545 -0
  1547. data/spec/utilities/crc_spec.rb +45 -0
  1548. data/spec/utilities/csv_spec.rb +148 -0
  1549. data/spec/utilities/logger_spec.rb +102 -0
  1550. data/spec/utilities/message_log_spec.rb +84 -0
  1551. data/spec/utilities/quaternion_spec.rb +107 -0
  1552. data/spec/utilities/ruby_lex_utils_spec.rb +86 -0
  1553. data/tasks/gemfile_stats.rake +103 -0
  1554. data/tasks/manifest.rake +22 -0
  1555. data/tasks/spec.rake +23 -0
  1556. data/test/benchmarks/binary_accessor_benchmark.rb +14 -0
  1557. data/test/benchmarks/gsub_benchmark.rb +152 -0
  1558. data/test/benchmarks/is_a_benchmark.rb +34 -0
  1559. data/test/performance/PACKETS.bat +1 -0
  1560. data/test/performance/Rakefile +77 -0
  1561. data/test/performance/THREADS.bat +1 -0
  1562. data/test/performance/config/data/attitude.bin +0 -0
  1563. data/test/performance/config/data/crc.txt +215 -0
  1564. data/test/performance/config/data/diamond.STL +58 -0
  1565. data/test/performance/config/data/groundoff.gif +0 -0
  1566. data/test/performance/config/data/groundon.gif +0 -0
  1567. data/test/performance/config/data/hselectoff.gif +0 -0
  1568. data/test/performance/config/data/hselecton.gif +0 -0
  1569. data/test/performance/config/data/hswitchoff.gif +0 -0
  1570. data/test/performance/config/data/hswitchon.gif +0 -0
  1571. data/test/performance/config/data/meta_init.txt +4 -0
  1572. data/test/performance/config/data/position.bin +0 -0
  1573. data/test/performance/config/data/poweroff.gif +0 -0
  1574. data/test/performance/config/data/poweron.gif +0 -0
  1575. data/test/performance/config/data/satellite.gif +0 -0
  1576. data/test/performance/config/data/tada.wav +0 -0
  1577. data/test/performance/config/data/vswitchoff.gif +0 -0
  1578. data/test/performance/config/data/vswitchon.gif +0 -0
  1579. data/test/performance/config/system/system.txt +0 -0
  1580. data/test/performance/config/system/system_packets.txt +38 -0
  1581. data/test/performance/config/system/system_threads.txt +58 -0
  1582. data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +46 -0
  1583. data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -0
  1584. data/test/performance/config/targets/COSMOS/cmd_tlm_server.txt +6 -0
  1585. data/test/performance/config/targets/COSMOS/screens/limits_change.txt +20 -0
  1586. data/test/performance/config/targets/COSMOS/screens/version.txt +19 -0
  1587. data/test/performance/config/targets/COSMOS/target.txt +11 -0
  1588. data/test/performance/config/targets/PACKET/cmd_tlm/packet_cmds.txt +20 -0
  1589. data/test/performance/config/targets/PACKET/cmd_tlm/packet_tlm.txt +98 -0
  1590. data/test/performance/config/targets/PACKET/cmd_tlm_server.txt +6 -0
  1591. data/test/performance/config/targets/PACKET/lib/packet_interface.rb +22 -0
  1592. data/test/performance/config/targets/PACKET/lib/packet_limits_response.rb +24 -0
  1593. data/test/performance/config/targets/PACKET/screens/status.txt +25 -0
  1594. data/test/performance/config/targets/PACKET/target.txt +28 -0
  1595. data/test/performance/config/targets/SYSTEM/screens/status.txt +12 -0
  1596. data/test/performance/config/targets/THREAD/cmd_tlm/thread_cmds.txt +17 -0
  1597. data/test/performance/config/targets/THREAD/cmd_tlm/thread_tlm.txt +18 -0
  1598. data/test/performance/config/targets/THREAD/cmd_tlm_server.txt +6 -0
  1599. data/test/performance/config/targets/THREAD/lib/thread_interface.rb +22 -0
  1600. data/test/performance/config/targets/THREAD/screens/status.txt +25 -0
  1601. data/test/performance/config/targets/THREAD/target.txt +7 -0
  1602. data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_packets.txt +28 -0
  1603. data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_threads.txt +68 -0
  1604. data/test/performance/config/tools/data_viewer/data_viewer.txt +11 -0
  1605. data/test/performance/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
  1606. data/test/performance/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
  1607. data/test/performance/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
  1608. data/test/performance/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
  1609. data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  1610. data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
  1611. data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  1612. data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  1613. data/test/performance/config/tools/handbook_creator/assets/img/ball_logo.bmp +0 -0
  1614. data/test/performance/config/tools/handbook_creator/assets/img/ball_logo.gif +0 -0
  1615. data/test/performance/config/tools/handbook_creator/assets/img/ball_logo.jpg +0 -0
  1616. data/test/performance/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
  1617. data/test/performance/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
  1618. data/test/performance/config/tools/handbook_creator/assets/js/html5shiv.js +8 -0
  1619. data/test/performance/config/tools/handbook_creator/assets/js/jquery-1.10.2.min.js +6 -0
  1620. data/test/performance/config/tools/handbook_creator/assets/js/respond.min.js +6 -0
  1621. data/test/performance/config/tools/handbook_creator/default_toc.xsl +59 -0
  1622. data/test/performance/config/tools/handbook_creator/handbook_creator.txt +66 -0
  1623. data/test/performance/config/tools/handbook_creator/templates/command_packets.html.erb +86 -0
  1624. data/test/performance/config/tools/handbook_creator/templates/command_toc.html.erb +38 -0
  1625. data/test/performance/config/tools/handbook_creator/templates/footer.html.erb +9 -0
  1626. data/test/performance/config/tools/handbook_creator/templates/header.html.erb +25 -0
  1627. data/test/performance/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -0
  1628. data/test/performance/config/tools/handbook_creator/templates/nav.html.erb +27 -0
  1629. data/test/performance/config/tools/handbook_creator/templates/overview.html.erb +1 -0
  1630. data/test/performance/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -0
  1631. data/test/performance/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -0
  1632. data/test/performance/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -0
  1633. data/test/performance/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -0
  1634. data/test/performance/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -0
  1635. data/test/performance/config/tools/handbook_creator/templates/title.html.erb +1 -0
  1636. data/test/performance/config/tools/launcher/launcher_packets.txt +34 -0
  1637. data/test/performance/config/tools/launcher/launcher_threads.txt +83 -0
  1638. data/test/performance/config/tools/limits_monitor/README.txt +1 -0
  1639. data/test/performance/config/tools/opengl_builder/README.txt +1 -0
  1640. data/test/performance/config/tools/script_runner/script_runner.txt +3 -0
  1641. data/test/performance/config/tools/table_manager/ConfigTables_def.txt +8 -0
  1642. data/test/performance/config/tools/table_manager/ExampleTableDefinition.txt +24 -0
  1643. data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +25 -0
  1644. data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +25 -0
  1645. data/test/performance/config/tools/table_manager/PPSSelectionTable_def.txt +8 -0
  1646. data/test/performance/config/tools/table_manager/TLMMonitoringTable_def.txt +248 -0
  1647. data/test/performance/config/tools/test_runner/test_runner.txt +17 -0
  1648. data/test/performance/config/tools/tlm_extractor/tlm_extractor.txt +13 -0
  1649. data/test/performance/config/tools/tlm_extractor/tlm_extractor2.txt +2 -0
  1650. data/test/performance/config/tools/tlm_extractor/tlm_extractor3.txt +2 -0
  1651. data/test/performance/config/tools/tlm_extractor/tlm_extractor4.txt +2 -0
  1652. data/test/performance/config/tools/tlm_grapher/README.txt +1 -0
  1653. data/test/performance/config/tools/tlm_grapher/tlm_grapher.txt +204 -0
  1654. data/test/performance/config/tools/tlm_viewer/tlm_viewer.txt +13 -0
  1655. data/test/performance/lib/packet_target.rb +126 -0
  1656. data/test/performance/lib/thread_target.rb +120 -0
  1657. data/test/performance/lib/user_version.rb +3 -0
  1658. data/test/performance/outputs/handbooks/README.txt +1 -0
  1659. data/test/performance/outputs/logs/README.txt +1 -0
  1660. data/test/performance/outputs/saved_config/README.txt +1 -0
  1661. data/test/performance/outputs/tables/README.txt +1 -0
  1662. data/test/performance/outputs/tmp/README.txt +1 -0
  1663. data/test/performance/procedures/checks.rb +11 -0
  1664. data/test/performance/procedures/clear_util.rb +7 -0
  1665. data/test/performance/procedures/collect.rb +18 -0
  1666. data/test/performance/procedures/collect_util.rb +14 -0
  1667. data/test/performance/procedures/cosmos_api_test.rb +293 -0
  1668. data/test/performance/procedures/disconnect.rb +29 -0
  1669. data/test/performance/procedures/example_test.rb +182 -0
  1670. data/test/performance/procedures/plot_test.rb +8 -0
  1671. data/test/performance/procedures/procedure.rb +3 -0
  1672. data/test/performance/procedures/run_example_test.rb +3 -0
  1673. data/test/performance/procedures/test.rb +51 -0
  1674. data/test/performance/tools/CmdExtractor +14 -0
  1675. data/test/performance/tools/CmdExtractor.bat +59 -0
  1676. data/test/performance/tools/CmdSender +14 -0
  1677. data/test/performance/tools/CmdSender.bat +59 -0
  1678. data/test/performance/tools/CmdTlmServer +16 -0
  1679. data/test/performance/tools/CmdTlmServer.bat +59 -0
  1680. data/test/performance/tools/CmdTlmServerMemProf +20 -0
  1681. data/test/performance/tools/CmdTlmServerMemProf.bat +59 -0
  1682. data/test/performance/tools/DataViewer +14 -0
  1683. data/test/performance/tools/DataViewer.bat +59 -0
  1684. data/test/performance/tools/HandbookCreator +14 -0
  1685. data/test/performance/tools/HandbookCreator.bat +61 -0
  1686. data/test/performance/tools/Launcher +14 -0
  1687. data/test/performance/tools/Launcher.bat +59 -0
  1688. data/test/performance/tools/LimitsMonitor +14 -0
  1689. data/test/performance/tools/LimitsMonitor.bat +59 -0
  1690. data/test/performance/tools/OpenGLBuilder +14 -0
  1691. data/test/performance/tools/OpenGLBuilder.bat +59 -0
  1692. data/test/performance/tools/PacketTarget +14 -0
  1693. data/test/performance/tools/PacketTarget.bat +59 -0
  1694. data/test/performance/tools/PacketViewer +14 -0
  1695. data/test/performance/tools/PacketViewer.bat +59 -0
  1696. data/test/performance/tools/Replay +14 -0
  1697. data/test/performance/tools/Replay.bat +59 -0
  1698. data/test/performance/tools/ScpiTarget +14 -0
  1699. data/test/performance/tools/ScpiTarget.bat +59 -0
  1700. data/test/performance/tools/ScriptRunner +14 -0
  1701. data/test/performance/tools/ScriptRunner.bat +59 -0
  1702. data/test/performance/tools/TableManager +14 -0
  1703. data/test/performance/tools/TableManager.bat +59 -0
  1704. data/test/performance/tools/TestRunner +14 -0
  1705. data/test/performance/tools/TestRunner.bat +59 -0
  1706. data/test/performance/tools/ThreadTarget +14 -0
  1707. data/test/performance/tools/ThreadTarget.bat +59 -0
  1708. data/test/performance/tools/TlmExtractor +14 -0
  1709. data/test/performance/tools/TlmExtractor.bat +59 -0
  1710. data/test/performance/tools/TlmGrapher +14 -0
  1711. data/test/performance/tools/TlmGrapher.bat +59 -0
  1712. data/test/performance/tools/TlmGrapherMemProf +19 -0
  1713. data/test/performance/tools/TlmGrapherMemProf.bat +59 -0
  1714. data/test/performance/tools/TlmViewer +14 -0
  1715. data/test/performance/tools/TlmViewer.bat +59 -0
  1716. data/test/performance/tools/TlmViewerMemProf +19 -0
  1717. data/test/performance/tools/TlmViewerMemProf.bat +59 -0
  1718. data/test/performance/tools/identify_performance.rb +82 -0
  1719. data/test/performance/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -0
  1720. data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +15 -0
  1721. data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +6 -0
  1722. data/test/performance/tools/mac/CmdExtractor.app/Contents/Resources/appIcon.icns +0 -0
  1723. data/test/performance/tools/mac/CmdSender.app/Contents/Info.plist +38 -0
  1724. data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +15 -0
  1725. data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/main.sh +6 -0
  1726. data/test/performance/tools/mac/CmdSender.app/Contents/Resources/appIcon.icns +0 -0
  1727. data/test/performance/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -0
  1728. data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +15 -0
  1729. data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +6 -0
  1730. data/test/performance/tools/mac/CmdTlmServer.app/Contents/Resources/appIcon.icns +0 -0
  1731. data/test/performance/tools/mac/DataViewer.app/Contents/Info.plist +38 -0
  1732. data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +15 -0
  1733. data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/main.sh +6 -0
  1734. data/test/performance/tools/mac/DataViewer.app/Contents/Resources/appIcon.icns +0 -0
  1735. data/test/performance/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -0
  1736. data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +15 -0
  1737. data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +6 -0
  1738. data/test/performance/tools/mac/HandbookCreator.app/Contents/Resources/appIcon.icns +0 -0
  1739. data/test/performance/tools/mac/Launcher.app/Contents/Info.plist +38 -0
  1740. data/test/performance/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +15 -0
  1741. data/test/performance/tools/mac/Launcher.app/Contents/MacOS/main.sh +6 -0
  1742. data/test/performance/tools/mac/Launcher.app/Contents/Resources/appIcon.icns +0 -0
  1743. data/test/performance/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -0
  1744. data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +15 -0
  1745. data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +6 -0
  1746. data/test/performance/tools/mac/LimitsMonitor.app/Contents/Resources/appIcon.icns +0 -0
  1747. data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -0
  1748. data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +15 -0
  1749. data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +6 -0
  1750. data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Resources/appIcon.icns +0 -0
  1751. data/test/performance/tools/mac/PacketViewer.app/Contents/Info.plist +38 -0
  1752. data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +15 -0
  1753. data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +6 -0
  1754. data/test/performance/tools/mac/PacketViewer.app/Contents/Resources/appIcon.icns +0 -0
  1755. data/test/performance/tools/mac/Replay.app/Contents/Info.plist +38 -0
  1756. data/test/performance/tools/mac/Replay.app/Contents/MacOS/Replay.rb +15 -0
  1757. data/test/performance/tools/mac/Replay.app/Contents/MacOS/main.sh +6 -0
  1758. data/test/performance/tools/mac/Replay.app/Contents/Resources/appIcon.icns +0 -0
  1759. data/test/performance/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -0
  1760. data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +15 -0
  1761. data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +6 -0
  1762. data/test/performance/tools/mac/ScriptRunner.app/Contents/Resources/appIcon.icns +0 -0
  1763. data/test/performance/tools/mac/TableManager.app/Contents/Info.plist +38 -0
  1764. data/test/performance/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +15 -0
  1765. data/test/performance/tools/mac/TableManager.app/Contents/MacOS/main.sh +6 -0
  1766. data/test/performance/tools/mac/TableManager.app/Contents/Resources/appIcon.icns +0 -0
  1767. data/test/performance/tools/mac/TestRunner.app/Contents/Info.plist +38 -0
  1768. data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +15 -0
  1769. data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/main.sh +6 -0
  1770. data/test/performance/tools/mac/TestRunner.app/Contents/Resources/appIcon.icns +0 -0
  1771. data/test/performance/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -0
  1772. data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +15 -0
  1773. data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +6 -0
  1774. data/test/performance/tools/mac/TlmExtractor.app/Contents/Resources/appIcon.icns +0 -0
  1775. data/test/performance/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -0
  1776. data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +15 -0
  1777. data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +6 -0
  1778. data/test/performance/tools/mac/TlmGrapher.app/Contents/Resources/appIcon.icns +0 -0
  1779. data/test/performance/tools/mac/TlmViewer.app/Contents/Info.plist +38 -0
  1780. data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +15 -0
  1781. data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +6 -0
  1782. data/test/performance/tools/mac/TlmViewer.app/Contents/Resources/appIcon.icns +0 -0
  1783. metadata +2286 -0
@@ -0,0 +1,1493 @@
1
+ /*
2
+ # Copyright 2014 Ball Aerospace & Technologies Corp.
3
+ # All Rights Reserved.
4
+ #
5
+ # This program is free software; you can modify and/or redistribute it
6
+ # under the terms of the GNU Lesser General Public License
7
+ # as published by the Free Software Foundation; version 3 with
8
+ # attribution addendums as found in the LICENSE.txt
9
+ */
10
+
11
+ #include "ruby.h"
12
+ #include "stdio.h"
13
+
14
+ #define TO_BIGNUM(x) (FIXNUM_P(x) ? rb_int2big(FIX2LONG(x)) : x)
15
+ #define BYTE_ALIGNED(x) (((x) % 8) == 0)
16
+
17
+ static const int endianness_check = 1;
18
+ static VALUE HOST_ENDIANNESS = Qnil;
19
+ static VALUE ZERO_STRING = Qnil;
20
+ static VALUE ASCII_8BIT_STRING = Qnil;
21
+
22
+ static VALUE MIN_INT8 = Qnil;
23
+ static VALUE MAX_INT8 = Qnil;
24
+ static VALUE MAX_UINT8 = Qnil;
25
+ static VALUE MIN_INT16 = Qnil;
26
+ static VALUE MAX_INT16 = Qnil;
27
+ static VALUE MAX_UINT16 = Qnil;
28
+ static VALUE MIN_INT32 = Qnil;
29
+ static VALUE MAX_INT32 = Qnil;
30
+ static VALUE MAX_UINT32 = Qnil;
31
+ static VALUE MIN_INT64 = Qnil;
32
+ static VALUE MAX_INT64 = Qnil;
33
+ static VALUE MAX_UINT64 = Qnil;
34
+
35
+ static VALUE mCosmos = Qnil;
36
+ static VALUE cBinaryAccessor = Qnil;
37
+ static VALUE cStructure = Qnil;
38
+ static VALUE cStructureItem = Qnil;
39
+
40
+ static ID id_method_to_s = 0;
41
+ static ID id_method_raise_buffer_error = 0;
42
+ static ID id_method_read_array = 0;
43
+ static ID id_method_force_encoding = 0;
44
+ static ID id_method_freeze = 0;
45
+ static ID id_method_slice = 0;
46
+ static ID id_method_reverse = 0;
47
+ static ID id_method_Integer = 0;
48
+ static ID id_method_Float = 0;
49
+ static ID id_method_kind_of = 0;
50
+
51
+ static ID id_ivar_buffer = 0;
52
+ static ID id_ivar_bit_offset = 0;
53
+ static ID id_ivar_bit_size = 0;
54
+ static ID id_ivar_array_size = 0;
55
+ static ID id_ivar_endianness = 0;
56
+ static ID id_ivar_data_type = 0;
57
+ static ID id_ivar_default_endianness = 0;
58
+ static ID id_ivar_item_class = 0;
59
+ static ID id_ivar_items = 0;
60
+ static ID id_ivar_sorted_items = 0;
61
+ static ID id_ivar_defined_length = 0;
62
+ static ID id_ivar_defined_length_bits = 0;
63
+ static ID id_ivar_pos_bit_size = 0;
64
+ static ID id_ivar_neg_bit_size = 0;
65
+ static ID id_ivar_fixed_size = 0;
66
+ static ID id_ivar_short_buffer_allowed = 0;
67
+ static ID id_ivar_mutex = 0;
68
+ static ID id_ivar_create_index = 0;
69
+
70
+ static ID id_const_ASCII_8BIT_STRING = 0;
71
+ static ID id_const_ZERO_STRING = 0;
72
+
73
+ static VALUE symbol_LITTLE_ENDIAN = Qnil;
74
+ static VALUE symbol_BIG_ENDIAN = Qnil;
75
+ static VALUE symbol_INT = Qnil;
76
+ static VALUE symbol_UINT = Qnil;
77
+ static VALUE symbol_FLOAT = Qnil;
78
+ static VALUE symbol_STRING = Qnil;
79
+ static VALUE symbol_BLOCK = Qnil;
80
+ static VALUE symbol_DERIVED = Qnil;
81
+ static VALUE symbol_read = Qnil;
82
+ static VALUE symbol_write = Qnil;
83
+ static VALUE symbol_TRUNCATE = Qnil;
84
+ static VALUE symbol_SATURATE = Qnil;
85
+ static VALUE symbol_ERROR = Qnil;
86
+ static VALUE symbol_ERROR_ALLOW_HEX = Qnil;
87
+
88
+ /*
89
+ * Perform an left bit shift on a string
90
+ */
91
+ static void left_shift_byte_array (unsigned char* array, int array_length, int shift)
92
+ {
93
+ int current_index = 0;
94
+ int previous_index = 0;
95
+ unsigned char saved_bits = 0;
96
+ unsigned char saved_bits_mask = (0xFF << (8 - shift));
97
+ unsigned char sign_extension_remove_mask = ~(0xFF << shift);
98
+
99
+ for (current_index = 0; current_index < array_length; current_index++)
100
+ {
101
+ /* Save bits that will be lost */
102
+ saved_bits = ((array[current_index] & saved_bits_mask) >> (8 - shift)) & sign_extension_remove_mask;
103
+
104
+ /* Perform shift on current byte */
105
+ array[current_index] <<= shift;
106
+
107
+ /* Add Saved bits to end of previous byte */
108
+ if (current_index > 0)
109
+ {
110
+ array[previous_index] |= saved_bits;
111
+ }
112
+
113
+ /* Update previous index */
114
+ previous_index = current_index;
115
+ }
116
+ }
117
+
118
+ /*
119
+ * Perform an unsigned right bit shift on a string
120
+ */
121
+ static void unsigned_right_shift_byte_array (unsigned char* array, int array_length, int shift)
122
+ {
123
+ int current_index = 0;
124
+ int previous_index = 0;
125
+ unsigned char saved_bits = 0;
126
+ unsigned char saved_bits_mask = ~(0xFF << shift);
127
+ unsigned char sign_extension_remove_mask = ~(0xFF << (8 - shift));
128
+
129
+ for (current_index = array_length - 1; current_index >= 0; current_index--)
130
+ {
131
+ /* Save bits that will be lost */
132
+ saved_bits = (array[current_index] & saved_bits_mask) << (8 - shift);
133
+
134
+ /* Perform shift on current byte */
135
+ array[current_index] = (array[current_index] >> shift) & sign_extension_remove_mask;
136
+
137
+ /* Add Saved bits to beginning of previous byte */
138
+ if (current_index != (array_length - 1))
139
+ {
140
+ array[previous_index] |= saved_bits;
141
+ }
142
+
143
+ /* Update previous index */
144
+ previous_index = current_index;
145
+ }
146
+ }
147
+
148
+ /*
149
+ * Perform an signed right bit shift on a string
150
+ */
151
+ static void signed_right_shift_byte_array (unsigned char* array, int array_length, int shift)
152
+ {
153
+ unsigned char start_bits_mask = (0xFF << (8 - shift));
154
+ int is_signed = (0x80 & array[0]);
155
+
156
+ unsigned_right_shift_byte_array(array, array_length, shift);
157
+
158
+ if (is_signed)
159
+ {
160
+ array[0] |= start_bits_mask;
161
+ }
162
+ }
163
+
164
+ /*
165
+ * Perform an unsigned bit shift on a string
166
+ */
167
+ static void unsigned_shift_byte_array (unsigned char* array, int array_length, int shift)
168
+ {
169
+ if (shift < 0)
170
+ {
171
+ left_shift_byte_array(array, array_length, -shift);
172
+ }
173
+ else if (shift > 0)
174
+ {
175
+ unsigned_right_shift_byte_array(array, array_length, shift);
176
+ }
177
+ }
178
+
179
+ /*
180
+ * Reverse the byte order in a string.
181
+ */
182
+ static void reverse_bytes (unsigned char* array, int array_length)
183
+ {
184
+ int first_index = 0;
185
+ int second_index = 0;
186
+ unsigned char temp_byte = 0;
187
+
188
+ for (first_index = 0; first_index < (array_length / 2); first_index++)
189
+ {
190
+ second_index = array_length - 1 - first_index;
191
+ temp_byte = array[first_index];
192
+ array[first_index] = array[second_index];
193
+ array[second_index] = temp_byte;
194
+ }
195
+ }
196
+
197
+ static void read_aligned_16(int lower_bound, int upper_bound, VALUE endianness, unsigned char *buffer, unsigned char *read_value) {
198
+ if (endianness == HOST_ENDIANNESS)
199
+ {
200
+ read_value[1] = buffer[upper_bound];
201
+ read_value[0] = buffer[lower_bound];
202
+ }
203
+ else
204
+ {
205
+ read_value[0] = buffer[upper_bound];
206
+ read_value[1] = buffer[lower_bound];
207
+ }
208
+ }
209
+
210
+ static void read_aligned_32(int lower_bound, int upper_bound, VALUE endianness, unsigned char *buffer, unsigned char *read_value) {
211
+ if (endianness == HOST_ENDIANNESS)
212
+ {
213
+ read_value[3] = buffer[upper_bound];
214
+ read_value[2] = buffer[upper_bound - 1];
215
+ read_value[1] = buffer[lower_bound + 1];
216
+ read_value[0] = buffer[lower_bound];
217
+ }
218
+ else
219
+ {
220
+ read_value[0] = buffer[upper_bound];
221
+ read_value[1] = buffer[upper_bound - 1];
222
+ read_value[2] = buffer[lower_bound + 1];
223
+ read_value[3] = buffer[lower_bound];
224
+ }
225
+ }
226
+
227
+ static void read_aligned_64(int lower_bound, int upper_bound, VALUE endianness, unsigned char *buffer, unsigned char *read_value) {
228
+ if (endianness == HOST_ENDIANNESS)
229
+ {
230
+ read_value[7] = buffer[upper_bound];
231
+ read_value[6] = buffer[upper_bound - 1];
232
+ read_value[5] = buffer[upper_bound - 2];
233
+ read_value[4] = buffer[upper_bound - 3];
234
+ read_value[3] = buffer[lower_bound + 3];
235
+ read_value[2] = buffer[lower_bound + 2];
236
+ read_value[1] = buffer[lower_bound + 1];
237
+ read_value[0] = buffer[lower_bound];
238
+ }
239
+ else
240
+ {
241
+ read_value[0] = buffer[upper_bound];
242
+ read_value[1] = buffer[upper_bound - 1];
243
+ read_value[2] = buffer[upper_bound - 2];
244
+ read_value[3] = buffer[upper_bound - 3];
245
+ read_value[4] = buffer[lower_bound + 3];
246
+ read_value[5] = buffer[lower_bound + 2];
247
+ read_value[6] = buffer[lower_bound + 1];
248
+ read_value[7] = buffer[lower_bound];
249
+ }
250
+ }
251
+
252
+ static void read_bitfield(int lower_bound, int upper_bound, int bit_offset, int bit_size, int given_bit_offset, int given_bit_size, VALUE endianness, unsigned char* buffer, int buffer_length, unsigned char* read_value) {
253
+ /* Local variables */
254
+ int num_bytes = 0;
255
+ int total_bits = 0;
256
+ int start_bits = 0;
257
+ int end_bits = 0;
258
+ int temp_upper = 0;
259
+ unsigned char end_mask = 0;
260
+
261
+ /* Copy Data For Bitfield into read_value */
262
+ if (endianness == symbol_LITTLE_ENDIAN)
263
+ {
264
+ /* Bitoffset always refers to the most significant bit of a bitfield */
265
+ num_bytes = (((bit_offset % 8) + bit_size - 1) / 8) + 1;
266
+ upper_bound = bit_offset / 8;
267
+ lower_bound = upper_bound - num_bytes + 1;
268
+
269
+ if (lower_bound < 0) {
270
+ rb_raise(rb_eArgError, "LITTLE_ENDIAN bitfield with bit_offset %d and bit_size %d is invalid", given_bit_offset, given_bit_size);
271
+ }
272
+
273
+ memcpy(read_value, &buffer[lower_bound], num_bytes);
274
+ reverse_bytes(read_value, num_bytes);
275
+ }
276
+ else
277
+ {
278
+ num_bytes = upper_bound - lower_bound + 1;
279
+ memcpy(read_value, &buffer[lower_bound], num_bytes);
280
+ }
281
+
282
+ /* Determine temp upper bound */
283
+ temp_upper = upper_bound - lower_bound;
284
+
285
+ /* Handle Bitfield */
286
+ total_bits = (temp_upper + 1) * 8;
287
+ start_bits = bit_offset % 8;
288
+ end_bits = total_bits - start_bits - bit_size;
289
+ end_mask = 0xFF << end_bits;
290
+
291
+ /* Mask off unwanted bits at end */
292
+ read_value[temp_upper] &= end_mask;
293
+
294
+ /* Shift off unwanted bits at beginning */
295
+ unsigned_shift_byte_array(read_value, num_bytes, -start_bits);
296
+ }
297
+
298
+ static void write_bitfield(int lower_bound, int upper_bound, int bit_offset, int bit_size, int given_bit_offset, int given_bit_size, VALUE endianness, unsigned char* buffer, int buffer_length, unsigned char* write_value) {
299
+ /* Local variables */
300
+ int num_bytes = 0;
301
+ int total_bits = 0;
302
+ int start_bits = 0;
303
+ int end_bits = 0;
304
+ int temp_upper = 0;
305
+ unsigned char start_mask = 0;
306
+ unsigned char end_mask = 0;
307
+
308
+ if (endianness == symbol_LITTLE_ENDIAN)
309
+ {
310
+ /* Bitoffset always refers to the most significant bit of a bitfield */
311
+ num_bytes = (((bit_offset % 8) + bit_size - 1) / 8) + 1;
312
+ upper_bound = bit_offset / 8;
313
+ lower_bound = upper_bound - num_bytes + 1;
314
+
315
+ if (lower_bound < 0) {
316
+ rb_raise(rb_eArgError, "LITTLE_ENDIAN bitfield with bit_offset %d and bit_size %d is invalid", given_bit_offset, given_bit_size);
317
+ }
318
+ }
319
+ else
320
+ {
321
+ num_bytes = upper_bound - lower_bound + 1;
322
+ }
323
+
324
+ /* Determine temp upper bound */
325
+ temp_upper = upper_bound - lower_bound;
326
+
327
+ /* Handle Bitfield */
328
+ total_bits = (temp_upper + 1) * 8;
329
+ start_bits = bit_offset % 8;
330
+ start_mask = 0xFF << (8 - start_bits);
331
+ end_bits = total_bits - start_bits - bit_size;
332
+ end_mask = 0xFF >> (8 - end_bits);
333
+
334
+ /* Shift to the right position */
335
+ unsigned_shift_byte_array(write_value, num_bytes, start_bits);
336
+
337
+ if (endianness == symbol_LITTLE_ENDIAN)
338
+ {
339
+ /* Mask in wanted bits at beginning */
340
+ write_value[0] |= buffer[upper_bound] & start_mask;
341
+
342
+ /* Mask in wanted bits at the end */
343
+ write_value[temp_upper] |= buffer[lower_bound] & end_mask;
344
+
345
+ reverse_bytes(write_value, num_bytes);
346
+ }
347
+ else
348
+ {
349
+ /* Mask in wanted bits at beginning */
350
+ write_value[0] |= buffer[lower_bound] & start_mask;
351
+
352
+ /* Mask in wanted bits at the end */
353
+ write_value[temp_upper] |= buffer[upper_bound] & end_mask;
354
+ }
355
+
356
+ /* Write the bytes into the buffer */
357
+ memcpy(&buffer[lower_bound], write_value, num_bytes);
358
+ }
359
+
360
+ /* Check the bit size and bit offset for problems. Recalulate the bit offset
361
+ * and return back through the passed in pointer. */
362
+ static void check_bit_offset_and_size(VALUE self, VALUE type_param, VALUE bit_offset_param, VALUE bit_size_param, VALUE data_type_param, VALUE buffer_param, int *new_bit_offset)
363
+ {
364
+ int bit_offset = NUM2INT(bit_offset_param);
365
+ int bit_size = NUM2INT(bit_size_param);
366
+
367
+ if ((bit_size <= 0) && (data_type_param != symbol_STRING) && (data_type_param != symbol_BLOCK)) {
368
+ rb_raise(rb_eArgError, "bit_size %d must be positive for data types other than :STRING and :BLOCK", bit_size);
369
+ }
370
+
371
+ if ((bit_size <= 0) && (bit_offset < 0)) {
372
+ rb_raise(rb_eArgError, "negative or zero bit_sizes (%d) cannot be given with negative bit_offsets (%d)", bit_size, bit_offset);
373
+ }
374
+
375
+ if (bit_offset < 0) {
376
+ bit_offset = ((RSTRING_LEN(buffer_param)* 8) + bit_offset);
377
+ if (bit_offset < 0) {
378
+ rb_funcall(self, id_method_raise_buffer_error, 5, type_param, buffer_param, data_type_param, bit_offset_param, bit_size_param);
379
+ }
380
+ }
381
+
382
+ *new_bit_offset = bit_offset;
383
+ }
384
+
385
+ /* Returns true if the bit_size is 8, 16, 32, or 64 */
386
+ static int even_bit_size(int bit_size)
387
+ {
388
+ return ((bit_size == 8) || (bit_size == 16) || (bit_size == 32) || (bit_size == 64));
389
+ }
390
+
391
+ /* Calculate the bounds of the string to access the item based on the bit_offset and bit_size.
392
+ * Also determine if the buffer size is sufficient. */
393
+ static int check_bounds_and_buffer_size(int bit_offset, int bit_size, int buffer_length, VALUE endianness, VALUE data_type, int *lower_bound, int *upper_bound)
394
+ {
395
+ int result = 1; /* Assume ok */
396
+
397
+ /* Define bounds of string to access this item */
398
+ *lower_bound = bit_offset / 8;
399
+ *upper_bound = (bit_offset + bit_size - 1) / 8;
400
+
401
+ /* Sanity check buffer size */
402
+ if (*upper_bound >= buffer_length) {
403
+ /* If it's not the special case of little endian bit field then we fail and return 0 */
404
+ if (!( (endianness == symbol_LITTLE_ENDIAN) &&
405
+ ((data_type == symbol_INT) || (data_type == symbol_UINT)) &&
406
+ /* Not byte aligned with an even bit size */
407
+ (!( (BYTE_ALIGNED(bit_offset)) && (even_bit_size(bit_size)) )) &&
408
+ (*lower_bound < buffer_length)
409
+ )) {
410
+ result = 0;
411
+ }
412
+ }
413
+ return result;
414
+ }
415
+
416
+ /*
417
+ * Reads binary data of any data type from a buffer
418
+ *
419
+ * @param bit_offset [Integer] Bit offset to the start of the item. A
420
+ * negative number means to offset from the end of the buffer.
421
+ * @param bit_size [Integer] Size of the item in bits
422
+ * @param data_type [Symbol] {DATA_TYPES}
423
+ * @param buffer [String] Binary string buffer to read from
424
+ * @param endianness [Symbol] {ENDIANNESS}
425
+ * @return [Integer] value read from the buffer
426
+ */
427
+ static VALUE binary_accessor_read(VALUE self, VALUE param_bit_offset, VALUE param_bit_size, VALUE param_data_type, VALUE param_buffer, VALUE param_endianness)
428
+ {
429
+ /* Convert Parameters to C Data Types */
430
+ int bit_offset = FIX2INT(param_bit_offset);
431
+ int bit_size = FIX2INT(param_bit_size);
432
+
433
+ /* Local Variables */
434
+ int given_bit_offset = bit_offset;
435
+ int given_bit_size = bit_size;
436
+ signed char signed_char_value = 0;
437
+ unsigned char unsigned_char_value = 0;
438
+ signed short signed_short_value = 0;
439
+ unsigned short unsigned_short_value = 0;
440
+ signed int signed_int_value = 0;
441
+ signed long signed_long_value = 0;
442
+ unsigned int unsigned_int_value = 0;
443
+ signed long long signed_long_long_value = 0;
444
+ unsigned long long unsigned_long_long_value = 0;
445
+ unsigned char* unsigned_char_array = NULL;
446
+ int array_length = 0;
447
+ char* string = NULL;
448
+ int string_length = 0;
449
+ float float_value = 0.0;
450
+ double double_value = 0.0;
451
+ int shift_needed = 0;
452
+ int shift_count = 0;
453
+ int index = 0;
454
+ int num_bits = 0;
455
+ int num_bytes = 0;
456
+ int num_words = 0;
457
+ int upper_bound = 0;
458
+ int lower_bound = 0;
459
+ volatile VALUE temp_value = Qnil;
460
+ volatile VALUE return_value = Qnil;
461
+
462
+ unsigned char* buffer = NULL;
463
+ long buffer_length = 0;
464
+
465
+ Check_Type(param_buffer, T_STRING);
466
+ buffer = (unsigned char*) RSTRING_PTR(param_buffer);
467
+ buffer_length = RSTRING_LEN(param_buffer);
468
+
469
+ check_bit_offset_and_size(self, symbol_read, param_bit_offset, param_bit_size,
470
+ param_data_type, param_buffer, &bit_offset);
471
+
472
+ /* If passed a negative bit size with strings or blocks
473
+ * recalculate based on the buffer length */
474
+ if ((bit_size <= 0) && ((param_data_type == symbol_STRING) || (param_data_type == symbol_BLOCK))) {
475
+ bit_size = (((int)buffer_length * 8) - bit_offset + bit_size);
476
+ if (bit_size == 0) {
477
+ return rb_str_new2("");
478
+ } else if (bit_size < 0) {
479
+ rb_funcall(self, id_method_raise_buffer_error, 5, symbol_read, param_buffer, param_data_type, param_bit_offset, param_bit_size);
480
+ }
481
+ }
482
+
483
+ if (!check_bounds_and_buffer_size(bit_offset, bit_size, buffer_length, param_endianness, param_data_type, &lower_bound, &upper_bound))
484
+ {
485
+ rb_funcall(self, id_method_raise_buffer_error, 5, symbol_read, param_buffer, param_data_type, param_bit_offset, param_bit_size);
486
+ }
487
+
488
+ if ((param_data_type == symbol_STRING) || (param_data_type == symbol_BLOCK)) {
489
+ /*#######################################
490
+ *# Handle :STRING and :BLOCK data types
491
+ *#######################################*/
492
+
493
+ if (BYTE_ALIGNED(bit_offset)) {
494
+ string_length = upper_bound - lower_bound + 1;
495
+ string = malloc(string_length + 1);
496
+ if (string == NULL) {
497
+ rb_raise(rb_eNoMemError, "malloc of %d returned NULL", string_length + 1);
498
+ }
499
+ memcpy(string, buffer + lower_bound, string_length);
500
+ string[string_length] = 0;
501
+ if (param_data_type == symbol_STRING) {
502
+ return_value = rb_str_new2(string);
503
+ } else /* param_data_type == symbol_BLOCK */ {
504
+ return_value = rb_str_new(string, string_length);
505
+ }
506
+ free(string);
507
+ } else {
508
+ rb_raise(rb_eArgError, "bit_offset %d is not byte aligned for data_type %s", given_bit_offset, RSTRING_PTR(rb_funcall(param_data_type, id_method_to_s, 0)));
509
+ }
510
+
511
+ } else if (param_data_type == symbol_INT) {
512
+ /*###################################
513
+ *# Handle :INT data type
514
+ *###################################*/
515
+
516
+ if ((BYTE_ALIGNED(bit_offset)) && (even_bit_size(bit_size)))
517
+ {
518
+ /*###########################################################
519
+ *# Handle byte-aligned 8, 16, 32, and 64 bit :INT
520
+ *###########################################################*/
521
+
522
+ switch (bit_size) {
523
+ case 8:
524
+ signed_char_value = *((signed char*) &buffer[lower_bound]);
525
+ return_value = INT2FIX(signed_char_value);
526
+ break;
527
+ case 16:
528
+ read_aligned_16(lower_bound, upper_bound, param_endianness, buffer, (unsigned char*) &signed_short_value);
529
+ return_value = INT2FIX(signed_short_value);
530
+ break;
531
+ case 32:
532
+ read_aligned_32(lower_bound, upper_bound, param_endianness, buffer, (unsigned char*) &signed_int_value);
533
+ return_value = INT2NUM(signed_int_value);
534
+ break;
535
+ case 64:
536
+ read_aligned_64(lower_bound, upper_bound, param_endianness, buffer, (unsigned char*) &signed_long_long_value);
537
+ return_value = LL2NUM(signed_long_long_value);
538
+ break;
539
+ }
540
+ } else {
541
+ string_length = ((bit_size - 1)/ 8) + 1;
542
+ array_length = string_length + 4; /* Required number of bytes plus slack */
543
+ unsigned_char_array = (unsigned char*) malloc(array_length);
544
+ if (unsigned_char_array == NULL) {
545
+ rb_raise(rb_eNoMemError, "malloc of %d returned NULL", array_length);
546
+ }
547
+ read_bitfield(lower_bound, upper_bound, bit_offset, bit_size, given_bit_offset, given_bit_size, param_endianness, buffer, (int)buffer_length, unsigned_char_array);
548
+
549
+ num_words = ((string_length - 1) / 4) + 1;
550
+ num_bytes = num_words * 4;
551
+ num_bits = num_bytes * 8;
552
+ shift_needed = num_bits - bit_size;
553
+ shift_count = shift_needed / 8;
554
+ shift_needed = shift_needed % 8;
555
+
556
+ if (bit_size > 1) {
557
+ for (index = 0; index < shift_count; index++) {
558
+ signed_right_shift_byte_array(unsigned_char_array, num_bytes, 8);
559
+ }
560
+
561
+ if (shift_needed > 0) {
562
+ signed_right_shift_byte_array(unsigned_char_array, num_bytes, shift_needed);
563
+ }
564
+ } else {
565
+ for (index = 0; index < shift_count; index++) {
566
+ unsigned_right_shift_byte_array(unsigned_char_array, num_bytes, 8);
567
+ }
568
+
569
+ if (shift_needed > 0) {
570
+ unsigned_right_shift_byte_array(unsigned_char_array, num_bytes, shift_needed);
571
+ }
572
+ }
573
+
574
+ if (HOST_ENDIANNESS == symbol_LITTLE_ENDIAN) {
575
+ for (index = 0; index < num_bytes; index += 4) {
576
+ reverse_bytes(&(unsigned_char_array[index]), 4);
577
+ }
578
+ }
579
+
580
+ if (bit_size <= 31) {
581
+ return_value = INT2FIX(*((int*) unsigned_char_array));
582
+ } else if (bit_size == 32) {
583
+ return_value = INT2NUM(*((int*) unsigned_char_array));
584
+ } else {
585
+ return_value = rb_int2big(*((int*) unsigned_char_array));
586
+ temp_value = INT2FIX(32);
587
+ for (index = 4; index < num_bytes; index += 4) {
588
+ return_value = rb_big_lshift(return_value, temp_value);
589
+ if (FIXNUM_P(return_value)) {
590
+ signed_long_value = FIX2LONG(return_value);
591
+ return_value = rb_int2big(signed_long_value);
592
+ }
593
+ return_value = rb_big_plus(return_value, UINT2NUM(*((unsigned int*) &(unsigned_char_array[index]))));
594
+ if (FIXNUM_P(return_value)) {
595
+ signed_long_value = FIX2LONG(return_value);
596
+ return_value = rb_int2big(signed_long_value);
597
+ }
598
+ }
599
+ return_value = rb_big_norm(return_value);
600
+ }
601
+
602
+ free(unsigned_char_array);
603
+ }
604
+
605
+ } else if (param_data_type == symbol_UINT) {
606
+ /*###################################
607
+ *# Handle :UINT data type
608
+ *###################################*/
609
+
610
+ if ((BYTE_ALIGNED(bit_offset)) && (even_bit_size(bit_size)))
611
+ {
612
+ /*###########################################################
613
+ *# Handle byte-aligned 8, 16, 32, and 64 bit :UINT
614
+ *###########################################################*/
615
+
616
+ switch (bit_size) {
617
+ case 8:
618
+ unsigned_char_value = buffer[lower_bound];
619
+ return_value = INT2FIX(unsigned_char_value);
620
+ break;
621
+ case 16:
622
+ read_aligned_16(lower_bound, upper_bound, param_endianness, buffer, (unsigned char*) &unsigned_short_value);
623
+ return_value = INT2FIX(unsigned_short_value);
624
+ break;
625
+ case 32:
626
+ read_aligned_32(lower_bound, upper_bound, param_endianness, buffer, (unsigned char*) &unsigned_int_value);
627
+ return_value = UINT2NUM(unsigned_int_value);
628
+ break;
629
+ case 64:
630
+ read_aligned_64(lower_bound, upper_bound, param_endianness, buffer, (unsigned char*) &unsigned_long_long_value);
631
+ return_value = ULL2NUM(unsigned_long_long_value);
632
+ break;
633
+ }
634
+ } else {
635
+ string_length = ((bit_size - 1)/ 8) + 1;
636
+ array_length = string_length + 4; /* Required number of bytes plus slack */
637
+ unsigned_char_array = (unsigned char*) malloc(array_length);
638
+ if (unsigned_char_array == NULL) {
639
+ rb_raise(rb_eNoMemError, "malloc of %d returned NULL", array_length);
640
+ }
641
+ read_bitfield(lower_bound, upper_bound, bit_offset, bit_size, given_bit_offset, given_bit_size, param_endianness, buffer, (int)buffer_length, unsigned_char_array);
642
+
643
+ num_words = ((string_length - 1) / 4) + 1;
644
+ num_bytes = num_words * 4;
645
+ num_bits = num_bytes * 8;
646
+ shift_needed = num_bits - bit_size;
647
+ shift_count = shift_needed / 8;
648
+ shift_needed = shift_needed % 8;
649
+
650
+ for (index = 0; index < shift_count; index++) {
651
+ unsigned_right_shift_byte_array(unsigned_char_array, num_bytes, 8);
652
+ }
653
+
654
+ if (shift_needed > 0) {
655
+ unsigned_right_shift_byte_array(unsigned_char_array, num_bytes, shift_needed);
656
+ }
657
+
658
+ if (HOST_ENDIANNESS == symbol_LITTLE_ENDIAN) {
659
+ for (index = 0; index < num_bytes; index += 4) {
660
+ reverse_bytes(&(unsigned_char_array[index]), 4);
661
+ }
662
+ }
663
+
664
+ if (bit_size <= 30) {
665
+ return_value = INT2FIX(*((int*) unsigned_char_array));
666
+ } else if (bit_size <= 32) {
667
+ return_value = UINT2NUM(*((unsigned int*) unsigned_char_array));
668
+ } else {
669
+ return_value = rb_uint2big(*((unsigned int*) unsigned_char_array));
670
+ temp_value = INT2FIX(32);
671
+ for (index = 4; index < num_bytes; index += 4) {
672
+ return_value = rb_big_lshift(return_value, temp_value);
673
+ if (FIXNUM_P(return_value)) {
674
+ signed_long_value = FIX2LONG(return_value);
675
+ return_value = rb_int2big(signed_long_value);
676
+ }
677
+ return_value = rb_big_plus(return_value, UINT2NUM(*((unsigned int*) &(unsigned_char_array[index]))));
678
+ if (FIXNUM_P(return_value)) {
679
+ signed_long_value = FIX2LONG(return_value);
680
+ return_value = rb_int2big(signed_long_value);
681
+ }
682
+ }
683
+ return_value = rb_big_norm(return_value);
684
+ }
685
+
686
+ free(unsigned_char_array);
687
+ }
688
+
689
+ } else if (param_data_type == symbol_FLOAT) {
690
+ /*##########################
691
+ *# Handle :FLOAT data type
692
+ *##########################*/
693
+
694
+ if (BYTE_ALIGNED(bit_offset)) {
695
+ switch (bit_size) {
696
+ case 32:
697
+ read_aligned_32(lower_bound, upper_bound, param_endianness, buffer, (unsigned char*) &float_value);
698
+ return_value = rb_float_new(float_value);
699
+ break;
700
+
701
+ case 64:
702
+ read_aligned_64(lower_bound, upper_bound, param_endianness, buffer, (unsigned char*) &double_value);
703
+ return_value = rb_float_new(double_value);
704
+ break;
705
+
706
+ default:
707
+ rb_raise(rb_eArgError, "bit_size is %d but must be 32 or 64 for data_type %s", given_bit_size, RSTRING_PTR(rb_funcall(param_data_type, id_method_to_s, 0)));
708
+ break;
709
+ };
710
+ } else {
711
+ rb_raise(rb_eArgError, "bit_offset %d is not byte aligned for data_type %s", given_bit_offset, RSTRING_PTR(rb_funcall(param_data_type, id_method_to_s, 0)));
712
+ }
713
+
714
+ } else {
715
+ /*############################
716
+ *# Handle Unknown data types
717
+ *############################*/
718
+
719
+ rb_raise(rb_eArgError, "data_type %s is not recognized", RSTRING_PTR(rb_funcall(param_data_type, id_method_to_s, 0)));
720
+ }
721
+
722
+ return return_value;
723
+ }
724
+
725
+ static VALUE check_overflow(VALUE value, int bit_size, VALUE data_type, VALUE overflow)
726
+ {
727
+ volatile VALUE hex_max_value = Qnil;
728
+ volatile VALUE max_value = Qnil;
729
+ volatile VALUE min_value = INT2NUM(0); /* Default for UINT cases */
730
+
731
+ switch (bit_size) {
732
+ case 8:
733
+ hex_max_value = MAX_UINT8;
734
+ if (data_type == symbol_INT) {
735
+ min_value = MIN_INT8;
736
+ max_value = MAX_INT8;
737
+ } else {
738
+ max_value = MAX_UINT8;
739
+ }
740
+ break;
741
+ case 16:
742
+ hex_max_value = MAX_UINT16;
743
+ if (data_type == symbol_INT) {
744
+ min_value = MIN_INT16;
745
+ max_value = MAX_INT16;
746
+ } else {
747
+ max_value = MAX_UINT16;
748
+ }
749
+ break;
750
+ case 32:
751
+ hex_max_value = MAX_UINT32;
752
+ if (data_type == symbol_INT) {
753
+ min_value = MIN_INT32;
754
+ max_value = MAX_INT32;
755
+ } else {
756
+ max_value = MAX_UINT32;
757
+ }
758
+ break;
759
+ case 64:
760
+ hex_max_value = MAX_UINT64;
761
+ if (data_type == symbol_INT) {
762
+ min_value = MIN_INT64;
763
+ max_value = MAX_INT64;
764
+ } else {
765
+ max_value = MAX_UINT64;
766
+ }
767
+ break;
768
+ default: /* Bitfield */
769
+ if (data_type == symbol_INT) {
770
+ /* Note signed integers must allow up to the maximum unsigned value to support values given in hex */
771
+ if (bit_size > 1) {
772
+ max_value = rb_big_pow(TO_BIGNUM(INT2NUM(2)), INT2NUM(bit_size - 1));
773
+ /* min_value = -(2 ** bit_size - 1) */
774
+ min_value = rb_big_minus(TO_BIGNUM(INT2NUM(0)), max_value);
775
+ /* max_value = (2 ** bit_size - 1) - 1 */
776
+ max_value = rb_big_minus(TO_BIGNUM(max_value), INT2NUM(1));
777
+ /* hex_max_value = (2 ** bit_size) - 1 */
778
+ hex_max_value = rb_big_pow(TO_BIGNUM(INT2NUM(2)), INT2NUM(bit_size));
779
+ hex_max_value = rb_big_minus(TO_BIGNUM(hex_max_value), INT2NUM(1));
780
+ } else { /* 1-bit signed */
781
+ min_value = INT2NUM(-1);
782
+ max_value = INT2NUM(1);
783
+ hex_max_value = INT2NUM(1);
784
+ }
785
+ } else {
786
+ max_value = rb_big_pow(TO_BIGNUM(INT2NUM(2)), INT2NUM(bit_size));
787
+ max_value = rb_big_minus(TO_BIGNUM(max_value), INT2NUM(1));
788
+ hex_max_value = max_value;
789
+ }
790
+ break;
791
+ }
792
+ /* Convert all to Bignum objects so we can do the math the same way */
793
+ value = TO_BIGNUM(value);
794
+ min_value = TO_BIGNUM(min_value);
795
+ max_value = TO_BIGNUM(max_value);
796
+ hex_max_value = TO_BIGNUM(hex_max_value);
797
+
798
+ if (overflow == symbol_TRUNCATE) {
799
+ /* Note this will always convert to unsigned equivalent for signed integers */
800
+ value = rb_big_modulo(value, TO_BIGNUM(rb_big_plus(hex_max_value, INT2NUM(1))));
801
+ } else {
802
+ if (rb_big_cmp(value, max_value) == INT2FIX(1)) {
803
+ if (overflow == symbol_SATURATE) {
804
+ value = max_value;
805
+ } else {
806
+ if ((overflow == symbol_ERROR) || (rb_big_cmp(value, hex_max_value) == INT2FIX(1))) {
807
+ rb_raise(rb_eArgError, "value of %s invalid for %d-bit %s",
808
+ RSTRING_PTR(rb_funcall(value, id_method_to_s, 0)),
809
+ bit_size,
810
+ RSTRING_PTR(rb_funcall(data_type, id_method_to_s, 0)));
811
+ }
812
+ }
813
+ } else if (rb_big_cmp(value, min_value) == INT2FIX(-1)) {
814
+ if (overflow == symbol_SATURATE) {
815
+ value = min_value;
816
+ } else {
817
+ rb_raise(rb_eArgError, "value of %s invalid for %d-bit %s",
818
+ RSTRING_PTR(rb_funcall(value, id_method_to_s, 0)),
819
+ bit_size,
820
+ RSTRING_PTR(rb_funcall(data_type, id_method_to_s, 0)));
821
+ }
822
+ }
823
+ }
824
+
825
+ return rb_big_norm(value);
826
+ }
827
+
828
+ /*
829
+ * Writes binary data of any data type to a buffer
830
+ *
831
+ * @param bit_offset [Integer] Bit offset to the start of the item. A
832
+ * negative number means to offset from the end of the buffer.
833
+ * @param bit_size [Integer] Size of the item in bits
834
+ * @param data_type [Symbol] {DATA_TYPES}
835
+ * @param buffer [String] Binary string buffer to read from
836
+ * @param endianness [Symbol] {ENDIANNESS}
837
+ * @return [Integer] value read from the buffer
838
+ */
839
+ static VALUE binary_accessor_write(VALUE self, VALUE value, VALUE param_bit_offset, VALUE param_bit_size, VALUE param_data_type, VALUE param_buffer, VALUE param_endianness, VALUE param_overflow)
840
+ {
841
+ /* Convert Parameters to C Data Types */
842
+ int bit_offset = NUM2INT(param_bit_offset);
843
+ int bit_size = NUM2INT(param_bit_size);
844
+ /* Local Variables */
845
+ int given_bit_offset = bit_offset;
846
+ int given_bit_size = bit_size;
847
+ int upper_bound = 0;
848
+ int lower_bound = 0;
849
+ int end_bytes = 0;
850
+ int old_upper_bound = 0;
851
+ int byte_size = 0;
852
+
853
+ unsigned long long c_value = 0;
854
+ float float_value = 0.0;
855
+ double double_value = 0.0;
856
+
857
+ unsigned char* buffer = NULL;
858
+ long buffer_length = 0;
859
+ long value_length = 0;
860
+ volatile VALUE temp_shift = Qnil;
861
+ volatile VALUE temp_mask = Qnil;
862
+ volatile VALUE temp_result = Qnil;
863
+
864
+ int string_length = 0;
865
+ unsigned char* unsigned_char_array = NULL;
866
+ int array_length = 0;
867
+ int shift_needed = 0;
868
+ int shift_count = 0;
869
+ int index = 0;
870
+ int num_bits = 0;
871
+ int num_bytes = 0;
872
+ int num_words = 0;
873
+
874
+ Check_Type(param_buffer, T_STRING);
875
+ buffer = (unsigned char*) RSTRING_PTR(param_buffer);
876
+ buffer_length = RSTRING_LEN(param_buffer);
877
+
878
+ check_bit_offset_and_size(self, symbol_write, param_bit_offset, param_bit_size,
879
+ param_data_type, param_buffer, &bit_offset);
880
+
881
+ /* If passed a negative bit size with strings or blocks
882
+ * recalculate based on the value length in bytes */
883
+ if ((bit_size <= 0) && ((param_data_type == symbol_STRING) || (param_data_type == symbol_BLOCK))) {
884
+ if (!RB_TYPE_P(value, T_STRING)) {
885
+ value = rb_funcall(value, id_method_to_s, 0);
886
+ }
887
+ bit_size = RSTRING_LEN(value) * 8;
888
+ }
889
+
890
+ if ((!check_bounds_and_buffer_size(bit_offset, bit_size, buffer_length, param_endianness, param_data_type, &lower_bound, &upper_bound)) && (given_bit_size > 0))
891
+ {
892
+ rb_funcall(self, id_method_raise_buffer_error, 5, symbol_write, param_buffer, param_data_type, param_bit_offset, param_bit_size);
893
+ }
894
+
895
+ /* Check overflow type */
896
+ if ((param_overflow != symbol_TRUNCATE) &&
897
+ (param_overflow != symbol_SATURATE) &&
898
+ (param_overflow != symbol_ERROR) &&
899
+ (param_overflow != symbol_ERROR_ALLOW_HEX)) {
900
+ rb_raise(rb_eArgError, "unknown overflow type %s", RSTRING_PTR(rb_funcall(param_overflow, id_method_to_s, 0)));
901
+ }
902
+
903
+ if ((param_data_type == symbol_STRING) || (param_data_type == symbol_BLOCK)) {
904
+ /*#######################################
905
+ *# Handle :STRING and :BLOCK data types
906
+ *#######################################*/
907
+ /* Force value to be a string */
908
+ if (!RB_TYPE_P(value, T_STRING)) {
909
+ value = rb_funcall(value, id_method_to_s, 0);
910
+ }
911
+
912
+ if (BYTE_ALIGNED(bit_offset)) {
913
+ value_length = RSTRING_LEN(value);
914
+
915
+ if (given_bit_size <= 0) {
916
+ end_bytes = -(given_bit_size / 8);
917
+ old_upper_bound = buffer_length - 1 - end_bytes;
918
+ /* Lower bound + end_bytes can never be more than 1 byte outside of the given buffer */
919
+ if ((lower_bound + end_bytes) > buffer_length)
920
+ {
921
+ rb_funcall(self, id_method_raise_buffer_error, 5, symbol_write, param_buffer, param_data_type, param_bit_offset, param_bit_size);
922
+ }
923
+
924
+ if (old_upper_bound < lower_bound) {
925
+ /* String was completely empty */
926
+ if (end_bytes > 0) {
927
+ /* Preserve bytes at end of buffer */
928
+ rb_str_concat(param_buffer, rb_str_times(ZERO_STRING, INT2FIX(value_length)));
929
+ buffer = (unsigned char*) RSTRING_PTR(param_buffer);
930
+ memmove((buffer + lower_bound + value_length), (buffer + lower_bound), end_bytes);
931
+ }
932
+ } else if (bit_size == 0) {
933
+ /* Remove entire string */
934
+ rb_str_update(param_buffer, lower_bound, old_upper_bound - lower_bound + 1, rb_str_new2(""));
935
+ } else if (upper_bound < old_upper_bound) {
936
+ /* Remove extra bytes from old string */
937
+ rb_str_update(param_buffer, upper_bound + 1, old_upper_bound - upper_bound, rb_str_new2(""));
938
+ } else if ((upper_bound > old_upper_bound) && (end_bytes > 0)) {
939
+ /* Preserve bytes at end of buffer */
940
+ rb_str_concat(param_buffer, rb_str_times(ZERO_STRING, INT2FIX(upper_bound - old_upper_bound)));
941
+ buffer = (unsigned char*) RSTRING_PTR(param_buffer);
942
+ memmove((buffer + upper_bound + 1), (buffer + old_upper_bound + 1), end_bytes);
943
+ }
944
+ } else {
945
+ byte_size = bit_size / 8;
946
+ if (value_length < byte_size) {
947
+ /* Pad the requested size with zeros.
948
+ * Tell Ruby we are going to be modifying the buffer with a memset */
949
+ rb_str_modify(param_buffer);
950
+ memset(RSTRING_PTR(param_buffer) + lower_bound + value_length, 0, byte_size - value_length);
951
+ } else if (value_length > byte_size) {
952
+ if (param_overflow == symbol_TRUNCATE) {
953
+ /* Resize the value to fit the field */
954
+ rb_str_update(value, byte_size, RSTRING_LEN(value) - byte_size, rb_str_new2(""));
955
+ } else {
956
+ rb_raise(rb_eArgError, "value of %d bytes does not fit into %d bytes for data_type %s", (int)value_length, byte_size, RSTRING_PTR(rb_funcall(param_data_type, id_method_to_s, 0)));
957
+ }
958
+ }
959
+ }
960
+ if (bit_size != 0) {
961
+ rb_str_update(param_buffer, lower_bound, RSTRING_LEN(value), value);
962
+ }
963
+ } else {
964
+ rb_raise(rb_eArgError, "bit_offset %d is not byte aligned for data_type %s", given_bit_offset, RSTRING_PTR(rb_funcall(param_data_type, id_method_to_s, 0)));
965
+ }
966
+
967
+ } else if ((param_data_type == symbol_INT) || (param_data_type == symbol_UINT)) {
968
+ /*###################################
969
+ *# Handle :INT data type
970
+ *###################################*/
971
+ value = rb_funcall(rb_mKernel, id_method_Integer, 1, value);
972
+
973
+ if ((BYTE_ALIGNED(bit_offset)) && (even_bit_size(bit_size)))
974
+ {
975
+ /*###########################################################
976
+ *# Handle byte-aligned 8, 16, 32, and 64 bit
977
+ *###########################################################*/
978
+
979
+ value = check_overflow(value, bit_size, param_data_type, param_overflow);
980
+ switch (bit_size) {
981
+ case 8:
982
+ c_value = NUM2CHR(value);
983
+ break;
984
+ case 16:
985
+ c_value = NUM2USHORT(value);
986
+ break;
987
+ case 32:
988
+ c_value = NUM2UINT(value);
989
+ break;
990
+ case 64:
991
+ c_value = NUM2ULL(value);
992
+ break;
993
+ }
994
+ /* If the passed endianess doesn't match the host we reverse the bytes.
995
+ * Then shift the result over so it's at the bottom of the long long value. */
996
+ if (param_endianness != HOST_ENDIANNESS) {
997
+ reverse_bytes((unsigned char *)&c_value, 8);
998
+ c_value = (c_value >> (64 - bit_size));
999
+ }
1000
+ /* Tell Ruby we are going to be modifying the buffer with a memcpy */
1001
+ rb_str_modify(param_buffer);
1002
+ memcpy((RSTRING_PTR(param_buffer) + lower_bound), &c_value, bit_size / 8);
1003
+
1004
+ } else {
1005
+ /*###########################################################
1006
+ *# Handle bit fields
1007
+ *###########################################################*/
1008
+ value = check_overflow(value, bit_size, param_data_type, param_overflow);
1009
+
1010
+ string_length = ((bit_size - 1)/ 8) + 1;
1011
+ array_length = string_length + 4; /* Required number of bytes plus slack */
1012
+ unsigned_char_array = (unsigned char*) malloc(array_length);
1013
+ if (unsigned_char_array == NULL) {
1014
+ rb_raise(rb_eNoMemError, "malloc of %d returned NULL", array_length);
1015
+ }
1016
+
1017
+ num_words = ((string_length - 1) / 4) + 1;
1018
+ num_bytes = num_words * 4;
1019
+ num_bits = num_bytes * 8;
1020
+ shift_needed = num_bits - bit_size;
1021
+ shift_count = shift_needed / 8;
1022
+ shift_needed = shift_needed % 8;
1023
+
1024
+ /* Convert value into array of bytes */
1025
+ if (bit_size <= 30) {
1026
+ *((int *)unsigned_char_array) = FIX2INT(value);
1027
+ } else if (bit_size <= 32) {
1028
+ *((unsigned int *)unsigned_char_array) = NUM2UINT(value);
1029
+ } else {
1030
+ temp_mask = UINT2NUM(0xFFFFFFFF);
1031
+ temp_shift = INT2FIX(32);
1032
+ temp_result = rb_big_and(TO_BIGNUM(value), temp_mask);
1033
+ /* Work around bug where rb_big_and will return Qfalse if given a first parameter of 0 */
1034
+ if (temp_result == Qfalse) { temp_result = INT2FIX(0); }
1035
+ *((unsigned int *)&(unsigned_char_array[num_bytes - 4])) = NUM2UINT(temp_result);
1036
+ for (index = num_bytes - 8; index >= 0; index -= 4) {
1037
+ value = rb_big_rshift(TO_BIGNUM(value), temp_shift);
1038
+ temp_result = rb_big_and(TO_BIGNUM(value), temp_mask);
1039
+ /* Work around bug where rb_big_and will return Qfalse if given a first parameter of 0 */
1040
+ if (temp_result == Qfalse) { temp_result = INT2FIX(0); }
1041
+ *((unsigned int *)&(unsigned_char_array[index])) = NUM2UINT(temp_result);
1042
+ }
1043
+ }
1044
+
1045
+ if (HOST_ENDIANNESS == symbol_LITTLE_ENDIAN) {
1046
+ for (index = 0; index < num_bytes; index += 4) {
1047
+ reverse_bytes(&(unsigned_char_array[index]), 4);
1048
+ }
1049
+ }
1050
+
1051
+ for (index = 0; index < shift_count; index++) {
1052
+ left_shift_byte_array(unsigned_char_array, num_bytes, 8);
1053
+ }
1054
+
1055
+ if (shift_needed > 0) {
1056
+ left_shift_byte_array(unsigned_char_array, num_bytes, shift_needed);
1057
+ }
1058
+
1059
+ rb_str_modify(param_buffer);
1060
+ write_bitfield(lower_bound, upper_bound, bit_offset, bit_size, given_bit_offset, given_bit_size, param_endianness, (unsigned char*) RSTRING_PTR(param_buffer), (int)buffer_length, unsigned_char_array);
1061
+
1062
+ free(unsigned_char_array);
1063
+ }
1064
+
1065
+ } else if (param_data_type == symbol_FLOAT) {
1066
+ /*##########################
1067
+ *# Handle :FLOAT data type
1068
+ *##########################*/
1069
+ value = rb_funcall(rb_mKernel, id_method_Float, 1, value);
1070
+
1071
+ if (BYTE_ALIGNED(bit_offset)) {
1072
+ switch (bit_size) {
1073
+ case 32:
1074
+ float_value = (float)RFLOAT_VALUE(value);
1075
+ if (param_endianness != HOST_ENDIANNESS) {
1076
+ reverse_bytes((unsigned char *)&float_value, 4);
1077
+ }
1078
+ rb_str_modify(param_buffer);
1079
+ memcpy((RSTRING_PTR(param_buffer) + lower_bound), &float_value, 4);
1080
+ break;
1081
+
1082
+ case 64:
1083
+ double_value = RFLOAT_VALUE(value);
1084
+ if (param_endianness != HOST_ENDIANNESS) {
1085
+ reverse_bytes((unsigned char *)&double_value, 8);
1086
+ }
1087
+ rb_str_modify(param_buffer);
1088
+ memcpy((RSTRING_PTR(param_buffer) + lower_bound), &double_value, 8);
1089
+ break;
1090
+
1091
+ default:
1092
+ rb_raise(rb_eArgError, "bit_size is %d but must be 32 or 64 for data_type %s", given_bit_size, RSTRING_PTR(rb_funcall(param_data_type, id_method_to_s, 0)));
1093
+ break;
1094
+ };
1095
+ } else {
1096
+ rb_raise(rb_eArgError, "bit_offset %d is not byte aligned for data_type %s", given_bit_offset, RSTRING_PTR(rb_funcall(param_data_type, id_method_to_s, 0)));
1097
+ }
1098
+
1099
+ } else {
1100
+ /*############################
1101
+ *# Handle Unknown data types
1102
+ *############################*/
1103
+
1104
+ rb_raise(rb_eArgError, "data_type %s is not recognized", RSTRING_PTR(rb_funcall(param_data_type, id_method_to_s, 0)));
1105
+ }
1106
+
1107
+ return value;
1108
+ }
1109
+
1110
+ /*
1111
+ * Returns the actual length as an integer.
1112
+ *
1113
+ * get_int_length(self) #=> 324
1114
+ */
1115
+ static int get_int_length(VALUE self)
1116
+ {
1117
+ volatile VALUE buffer = rb_ivar_get(self, id_ivar_buffer);
1118
+ if (RTEST(buffer)) {
1119
+ return (int)RSTRING_LEN(buffer);
1120
+ } else {
1121
+ return 0;
1122
+ }
1123
+ }
1124
+
1125
+ /*
1126
+ * Returns the actual structure length.
1127
+ *
1128
+ * structure.length #=> 324
1129
+ */
1130
+ static VALUE structure_length(VALUE self) {
1131
+ return INT2FIX(get_int_length(self));
1132
+ }
1133
+
1134
+ static VALUE read_item_internal(VALUE self, VALUE item, VALUE buffer) {
1135
+ volatile VALUE bit_offset = Qnil;
1136
+ volatile VALUE bit_size = Qnil;
1137
+ volatile VALUE data_type = Qnil;
1138
+ volatile VALUE array_size = Qnil;
1139
+ volatile VALUE endianness = Qnil;
1140
+
1141
+ data_type = rb_ivar_get(item, id_ivar_data_type);
1142
+ if (data_type == symbol_DERIVED) {
1143
+ return Qnil;
1144
+ }
1145
+
1146
+ if (RTEST(buffer)) {
1147
+ bit_offset = rb_ivar_get(item, id_ivar_bit_offset);
1148
+ bit_size = rb_ivar_get(item, id_ivar_bit_size);
1149
+ array_size = rb_ivar_get(item, id_ivar_array_size);
1150
+ endianness = rb_ivar_get(item, id_ivar_endianness);
1151
+ if (RTEST(array_size)) {
1152
+ return rb_funcall(cBinaryAccessor, id_method_read_array, 6, bit_offset, bit_size, data_type, array_size, buffer, endianness);
1153
+ } else {
1154
+ return binary_accessor_read(cBinaryAccessor, bit_offset, bit_size, data_type, buffer, endianness);
1155
+ }
1156
+ } else {
1157
+ rb_raise(rb_eRuntimeError, "No buffer given to read_item");
1158
+ }
1159
+ }
1160
+
1161
+ /*
1162
+ * Read an item in the structure
1163
+ *
1164
+ * @param item [StructureItem] Instance of StructureItem or one of its subclasses
1165
+ * @param value_type [Symbol] Not used. Subclasses should overload this
1166
+ * parameter to check whether to perform conversions on the item.
1167
+ * @param buffer [String] The binary buffer to read the item from
1168
+ * @return Value based on the item definition. This could be a string, integer,
1169
+ * float, or array of values.
1170
+ */
1171
+ static VALUE read_item(int argc, VALUE* argv, VALUE self)
1172
+ {
1173
+ volatile VALUE item = Qnil;
1174
+ volatile VALUE buffer = Qnil;
1175
+
1176
+ switch (argc)
1177
+ {
1178
+ case 1:
1179
+ case 2:
1180
+ item = argv[0];
1181
+ buffer = rb_ivar_get(self, id_ivar_buffer);
1182
+ break;
1183
+ case 3:
1184
+ item = argv[0];
1185
+ buffer = argv[2];
1186
+ break;
1187
+ default:
1188
+ /* Invalid number of arguments given */
1189
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..3)", argc);
1190
+ break;
1191
+ };
1192
+
1193
+ return read_item_internal(self, item, buffer);
1194
+ }
1195
+
1196
+ /*
1197
+ * Comparison Operator based on bit_offset. This means that StructureItems
1198
+ * with different names or bit sizes are equal if they have the same bit
1199
+ * offset.
1200
+ */
1201
+ static VALUE structure_item_spaceship(VALUE self, VALUE other_item) {
1202
+ int bit_offset = 0;
1203
+ int other_bit_offset = 0;
1204
+ int bit_size = 0;
1205
+ int other_bit_size = 0;
1206
+ int create_index = 0;
1207
+ int other_create_index = 0;
1208
+ int have_create_index = 0;
1209
+ volatile VALUE v_create_index = Qnil;
1210
+ volatile VALUE v_other_create_index = Qnil;
1211
+
1212
+ if (!RTEST(rb_funcall(other_item, id_method_kind_of, 1, cStructureItem))) {
1213
+ return Qnil;
1214
+ }
1215
+
1216
+ bit_offset = FIX2INT(rb_ivar_get(self, id_ivar_bit_offset));
1217
+ other_bit_offset = FIX2INT(rb_ivar_get(other_item, id_ivar_bit_offset));
1218
+
1219
+ v_create_index = rb_ivar_get(self, id_ivar_create_index);
1220
+ v_other_create_index = rb_ivar_get(other_item, id_ivar_create_index);
1221
+ if (RTEST(v_create_index) && RTEST(v_other_create_index)) {
1222
+ create_index = FIX2INT(v_create_index);
1223
+ other_create_index = FIX2INT(v_other_create_index);
1224
+ have_create_index = 1;
1225
+ }
1226
+
1227
+ /* Handle same bit offset case */
1228
+ if ((bit_offset == 0) && (other_bit_offset == 0)) {
1229
+ /* Both bit_offsets are 0 so sort by bit_size
1230
+ * This allows derived items with bit_size of 0 to be listed first
1231
+ * Compare based on bit size */
1232
+ bit_size = FIX2INT(rb_ivar_get(self, id_ivar_bit_size));
1233
+ other_bit_size = FIX2INT(rb_ivar_get(other_item, id_ivar_bit_size));
1234
+ if (bit_size == other_bit_size) {
1235
+ if (have_create_index) {
1236
+ if (create_index <= other_create_index) {
1237
+ return INT2FIX(-1);
1238
+ } else {
1239
+ return INT2FIX(1);
1240
+ }
1241
+ } else {
1242
+ return INT2FIX(0);
1243
+ }
1244
+ } if (bit_size < other_bit_size) {
1245
+ return INT2FIX(-1);
1246
+ } else {
1247
+ return INT2FIX(1);
1248
+ }
1249
+ }
1250
+
1251
+ /* Handle different bit offsets */
1252
+ if (((bit_offset >= 0) && (other_bit_offset >= 0)) || ((bit_offset < 0) && (other_bit_offset < 0))) {
1253
+ /* Both Have Same Sign */
1254
+ if (bit_offset == other_bit_offset) {
1255
+ if (have_create_index) {
1256
+ if (create_index <= other_create_index) {
1257
+ return INT2FIX(-1);
1258
+ } else {
1259
+ return INT2FIX(1);
1260
+ }
1261
+ } else {
1262
+ return INT2FIX(0);
1263
+ }
1264
+ } else if (bit_offset < other_bit_offset) {
1265
+ return INT2FIX(-1);
1266
+ } else {
1267
+ return INT2FIX(1);
1268
+ }
1269
+ } else {
1270
+ /* Different Signs */
1271
+ if (bit_offset == other_bit_offset) {
1272
+ if (have_create_index) {
1273
+ if (create_index <= other_create_index) {
1274
+ return INT2FIX(-1);
1275
+ } else {
1276
+ return INT2FIX(1);
1277
+ }
1278
+ } else {
1279
+ return INT2FIX(0);
1280
+ }
1281
+ } else if (bit_offset < other_bit_offset) {
1282
+ return INT2FIX(1);
1283
+ } else {
1284
+ return INT2FIX(-1);
1285
+ }
1286
+ }
1287
+ }
1288
+
1289
+ /* Structure constructor
1290
+ *
1291
+ * @param default_endianness [Symbol] Must be one of
1292
+ * {BinaryAccessor::ENDIANNESS}. By default it uses
1293
+ * BinaryAccessor::HOST_ENDIANNESS to determine the endianness of the host platform.
1294
+ * @param buffer [String] Buffer used to store the structure
1295
+ * @param item_class [Class] Class used to instantiate new structure items.
1296
+ * Must be StructureItem or one of its subclasses.
1297
+ */
1298
+ static VALUE structure_initialize(int argc, VALUE* argv, VALUE self) {
1299
+ volatile VALUE default_endianness = Qnil;
1300
+ volatile VALUE buffer = Qnil;
1301
+ volatile VALUE item_class = Qnil;
1302
+
1303
+ switch (argc)
1304
+ {
1305
+ case 0:
1306
+ default_endianness = HOST_ENDIANNESS;
1307
+ buffer = rb_str_new2("");
1308
+ item_class = cStructureItem;
1309
+ break;
1310
+ case 1:
1311
+ default_endianness = argv[0];
1312
+ buffer = rb_str_new2("");
1313
+ item_class = cStructureItem;
1314
+ break;
1315
+ case 2:
1316
+ default_endianness = argv[0];
1317
+ buffer = argv[1];
1318
+ item_class = cStructureItem;
1319
+ break;
1320
+ case 3:
1321
+ default_endianness = argv[0];
1322
+ buffer = argv[1];
1323
+ item_class = argv[2];
1324
+ break;
1325
+ default:
1326
+ /* Invalid number of arguments given */
1327
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 0..3)", argc);
1328
+ break;
1329
+ };
1330
+
1331
+ if ((default_endianness == symbol_BIG_ENDIAN) || (default_endianness == symbol_LITTLE_ENDIAN)) {
1332
+ rb_ivar_set(self, id_ivar_default_endianness, default_endianness);
1333
+ if (RTEST(buffer)) {
1334
+ Check_Type(buffer, T_STRING);
1335
+ rb_funcall(buffer, id_method_force_encoding, 1, ASCII_8BIT_STRING);
1336
+ rb_ivar_set(self, id_ivar_buffer, buffer);
1337
+ } else {
1338
+ rb_ivar_set(self, id_ivar_buffer, Qnil);
1339
+ }
1340
+ rb_ivar_set(self, id_ivar_item_class, item_class);
1341
+ rb_ivar_set(self, id_ivar_items, rb_hash_new());
1342
+ rb_ivar_set(self, id_ivar_sorted_items, rb_ary_new());
1343
+ rb_ivar_set(self, id_ivar_defined_length, INT2FIX(0));
1344
+ rb_ivar_set(self, id_ivar_defined_length_bits, INT2FIX(0));
1345
+ rb_ivar_set(self, id_ivar_pos_bit_size, INT2FIX(0));
1346
+ rb_ivar_set(self, id_ivar_neg_bit_size, INT2FIX(0));
1347
+ rb_ivar_set(self, id_ivar_fixed_size, Qtrue);
1348
+ rb_ivar_set(self, id_ivar_short_buffer_allowed, Qfalse);
1349
+ rb_ivar_set(self, id_ivar_mutex, Qnil);
1350
+ } else {
1351
+ rb_raise(rb_eArgError, "Unrecognized endianness: %s - Must be :BIG_ENDIAN or :LITTLE_ENDIAN", RSTRING_PTR(rb_funcall(default_endianness, id_method_to_s, 0)));
1352
+ }
1353
+
1354
+ return self;
1355
+ }
1356
+
1357
+ /*
1358
+ * Resize the buffer at least the defined length of the structure
1359
+ */
1360
+ static VALUE resize_buffer(VALUE self)
1361
+ {
1362
+ volatile VALUE buffer = rb_ivar_get(self, id_ivar_buffer);
1363
+ if (RTEST(buffer)) {
1364
+ volatile VALUE value_defined_length = rb_ivar_get(self, id_ivar_defined_length);
1365
+ long defined_length = FIX2INT(value_defined_length);
1366
+ long current_length = RSTRING_LEN(buffer);
1367
+
1368
+ /* Extend data size */
1369
+ if (current_length < defined_length)
1370
+ {
1371
+ rb_str_concat(buffer, rb_str_times(ZERO_STRING, INT2FIX(defined_length - current_length)));
1372
+ }
1373
+ }
1374
+
1375
+ return self;
1376
+ }
1377
+
1378
+ /*
1379
+ * Initialize all Packet methods
1380
+ */
1381
+ void Init_structure (void)
1382
+ {
1383
+ int zero = 0;
1384
+ volatile VALUE zero_string = Qnil;
1385
+ volatile VALUE ascii_8bit_string = Qnil;
1386
+
1387
+ mCosmos = rb_define_module("Cosmos");
1388
+ cBinaryAccessor = rb_define_class_under(mCosmos, "BinaryAccessor", rb_cObject);
1389
+
1390
+ id_method_to_s = rb_intern("to_s");
1391
+ id_method_raise_buffer_error = rb_intern("raise_buffer_error");
1392
+ id_method_read_array = rb_intern("read_array");
1393
+ id_method_force_encoding = rb_intern("force_encoding");
1394
+ id_method_freeze = rb_intern("freeze");
1395
+ id_method_slice = rb_intern("slice");
1396
+ id_method_reverse = rb_intern("reverse");
1397
+ id_method_Integer = rb_intern("Integer");
1398
+ id_method_Float = rb_intern("Float");
1399
+ id_method_kind_of = rb_intern("kind_of?");
1400
+
1401
+ MIN_INT8 = INT2NUM(-128);
1402
+ MAX_INT8 = INT2NUM(127);
1403
+ MAX_UINT8 = INT2NUM(255);
1404
+ MIN_INT16 = INT2NUM(-32768);
1405
+ MAX_INT16 = INT2NUM(32767);
1406
+ MAX_UINT16 = INT2NUM(65535);
1407
+ MIN_INT32 = rb_big_pow(TO_BIGNUM(INT2NUM(2)), INT2NUM(31));
1408
+ MIN_INT32 = rb_big_minus(TO_BIGNUM(INT2NUM(0)), MIN_INT32);
1409
+ MAX_INT32 = rb_big_pow(TO_BIGNUM(INT2NUM(2)), INT2NUM(31));
1410
+ MAX_INT32 = rb_big_minus(TO_BIGNUM(MAX_INT32), INT2NUM(1));
1411
+ MAX_UINT32 = rb_big_pow(TO_BIGNUM(INT2NUM(2)), INT2NUM(32));
1412
+ MAX_UINT32 = rb_big_minus(TO_BIGNUM(MAX_UINT32), INT2NUM(1));
1413
+ MIN_INT64 = rb_big_pow(TO_BIGNUM(INT2NUM(2)), INT2NUM(63));
1414
+ MIN_INT64 = rb_big_minus(TO_BIGNUM(INT2NUM(0)), MIN_INT64);
1415
+ MAX_INT64 = rb_big_pow(TO_BIGNUM(INT2NUM(2)), INT2NUM(63));
1416
+ MAX_INT64 = rb_big_minus(TO_BIGNUM(MAX_INT64), INT2NUM(1));
1417
+ MAX_UINT64 = rb_big_pow(TO_BIGNUM(INT2NUM(2)), INT2NUM(64));
1418
+ MAX_UINT64 = rb_big_minus(TO_BIGNUM(MAX_UINT64), INT2NUM(1));
1419
+ rb_define_const(cBinaryAccessor, "MIN_INT8", MIN_INT8);
1420
+ rb_define_const(cBinaryAccessor, "MAX_INT8", MAX_INT8);
1421
+ rb_define_const(cBinaryAccessor, "MAX_UINT8", MAX_UINT8);
1422
+ rb_define_const(cBinaryAccessor, "MIN_INT16", MIN_INT16);
1423
+ rb_define_const(cBinaryAccessor, "MAX_INT16", MAX_INT16);
1424
+ rb_define_const(cBinaryAccessor, "MAX_UINT16", MAX_UINT16);
1425
+ rb_define_const(cBinaryAccessor, "MIN_INT32", MIN_INT32);
1426
+ rb_define_const(cBinaryAccessor, "MAX_INT32", MAX_INT32);
1427
+ rb_define_const(cBinaryAccessor, "MAX_UINT32", MAX_UINT32);
1428
+ rb_define_const(cBinaryAccessor, "MIN_INT64", MIN_INT64);
1429
+ rb_define_const(cBinaryAccessor, "MAX_INT64", MAX_INT64);
1430
+ rb_define_const(cBinaryAccessor, "MAX_UINT64", MAX_UINT64);
1431
+
1432
+ id_ivar_buffer = rb_intern("@buffer");
1433
+ id_ivar_bit_offset = rb_intern("@bit_offset");
1434
+ id_ivar_bit_size = rb_intern("@bit_size");
1435
+ id_ivar_array_size = rb_intern("@array_size");
1436
+ id_ivar_endianness = rb_intern("@endianness");
1437
+ id_ivar_data_type = rb_intern("@data_type");
1438
+ id_ivar_default_endianness = rb_intern("@default_endianness");
1439
+ id_ivar_item_class = rb_intern("@item_class");
1440
+ id_ivar_items = rb_intern("@items");
1441
+ id_ivar_sorted_items = rb_intern("@sorted_items");
1442
+ id_ivar_defined_length = rb_intern("@defined_length");
1443
+ id_ivar_defined_length_bits = rb_intern("@defined_length_bits");
1444
+ id_ivar_pos_bit_size = rb_intern("@pos_bit_size");
1445
+ id_ivar_neg_bit_size = rb_intern("@neg_bit_size");
1446
+ id_ivar_fixed_size = rb_intern("@fixed_size");
1447
+ id_ivar_short_buffer_allowed = rb_intern("@short_buffer_allowed");
1448
+ id_ivar_mutex = rb_intern("@mutex");
1449
+ id_ivar_create_index = rb_intern("@create_index");
1450
+
1451
+ symbol_LITTLE_ENDIAN = ID2SYM(rb_intern("LITTLE_ENDIAN"));
1452
+ symbol_BIG_ENDIAN = ID2SYM(rb_intern("BIG_ENDIAN"));
1453
+ symbol_INT = ID2SYM(rb_intern("INT"));
1454
+ symbol_UINT = ID2SYM(rb_intern("UINT"));
1455
+ symbol_FLOAT = ID2SYM(rb_intern("FLOAT"));
1456
+ symbol_STRING = ID2SYM(rb_intern("STRING"));
1457
+ symbol_BLOCK = ID2SYM(rb_intern("BLOCK"));
1458
+ symbol_DERIVED = ID2SYM(rb_intern("DERIVED"));
1459
+ symbol_read = ID2SYM(rb_intern("read"));
1460
+ symbol_write = ID2SYM(rb_intern("write"));
1461
+ symbol_TRUNCATE = ID2SYM(rb_intern("TRUNCATE"));
1462
+ symbol_SATURATE = ID2SYM(rb_intern("SATURATE"));
1463
+ symbol_ERROR = ID2SYM(rb_intern("ERROR"));
1464
+ symbol_ERROR_ALLOW_HEX = ID2SYM(rb_intern("ERROR_ALLOW_HEX"));
1465
+
1466
+ if ((*((char *) &endianness_check)) == 1) {
1467
+ HOST_ENDIANNESS = symbol_LITTLE_ENDIAN;
1468
+ } else {
1469
+ HOST_ENDIANNESS = symbol_BIG_ENDIAN;
1470
+ }
1471
+
1472
+ rb_define_singleton_method(cBinaryAccessor, "read", binary_accessor_read, 5);
1473
+ rb_define_singleton_method(cBinaryAccessor, "write", binary_accessor_write, 7);
1474
+
1475
+ cStructure = rb_define_class_under(mCosmos, "Structure", rb_cObject);
1476
+ id_const_ZERO_STRING = rb_intern("ZERO_STRING");
1477
+ zero_string = rb_str_new((char*) &zero, 1);
1478
+ rb_funcall(zero_string, id_method_freeze, 0);
1479
+ rb_const_set(cStructure, id_const_ZERO_STRING, zero_string);
1480
+ ZERO_STRING = rb_const_get(cStructure, id_const_ZERO_STRING);
1481
+ id_const_ASCII_8BIT_STRING = rb_intern("ASCII_8BIT_STRING");
1482
+ ascii_8bit_string = rb_str_new2("ASCII-8BIT");
1483
+ rb_funcall(ascii_8bit_string, id_method_freeze, 0);
1484
+ rb_const_set(cStructure, id_const_ASCII_8BIT_STRING, ascii_8bit_string);
1485
+ ASCII_8BIT_STRING = rb_const_get(cStructure, id_const_ASCII_8BIT_STRING);
1486
+ rb_define_method(cStructure, "initialize", structure_initialize, -1);
1487
+ rb_define_method(cStructure, "length", structure_length, 0);
1488
+ rb_define_method(cStructure, "read_item", read_item, -1);
1489
+ rb_define_method(cStructure, "resize_buffer", resize_buffer, 0);
1490
+
1491
+ cStructureItem = rb_define_class_under(mCosmos, "StructureItem", rb_cObject);
1492
+ rb_define_method(cStructureItem, "<=>", structure_item_spaceship, 1);
1493
+ }