cosmos 4.3.0-java → 4.4.0-java

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