cosmos 4.1.1-java → 4.2.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (336) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -2
  3. data/.travis.yml +2 -0
  4. data/.yardopts +1 -0
  5. data/Gemfile +1 -0
  6. data/Manifest.txt +130 -0
  7. data/autohotkey/tools/ConfigEditorAHK +19 -0
  8. data/autohotkey/tools/cmd_extractor.ahk +4 -4
  9. data/autohotkey/tools/cmd_sequence.ahk +9 -5
  10. data/autohotkey/tools/config_editor.ahk +197 -0
  11. data/autohotkey/tools/packet_viewer.ahk +12 -6
  12. data/autohotkey/tools/replay.ahk +29 -29
  13. data/autohotkey/tools/script_runner.ahk +10 -2
  14. data/autohotkey/tools/tlm_extractor.ahk +7 -8
  15. data/autohotkey/tools/tlm_grapher.ahk +21 -9
  16. data/bin/dart_import +2 -0
  17. data/cosmos.gemspec +18 -16
  18. data/data/config/cmd_tlm_server.yaml +9 -0
  19. data/data/config/interface_modifiers.yaml +17 -0
  20. data/data/config/item_modifiers.yaml +3 -3
  21. data/data/crc.txt +184 -90
  22. data/data/dart.png +0 -0
  23. data/demo/Gemfile +1 -0
  24. data/demo/Rakefile +4 -0
  25. data/demo/config/dart/Gemfile +54 -0
  26. data/demo/config/data/crc.txt +28 -21
  27. data/demo/config/system/system.txt +3 -0
  28. data/demo/config/system/system2.txt +3 -0
  29. data/demo/config/targets/INST/cmd_tlm/inst_cmds.txt +3 -3
  30. data/demo/config/targets/INST/cmd_tlm/inst_tlm.txt +1 -1
  31. data/demo/config/targets/INST/lib/sim_inst.rb +1 -1
  32. data/demo/config/targets/INST/screens/adcs.txt +2 -1
  33. data/demo/config/targets/INST/screens/array.txt +1 -1
  34. data/demo/config/targets/INST/screens/block.txt +1 -1
  35. data/demo/config/targets/INST/screens/commanding.txt +7 -2
  36. data/demo/config/targets/INST/screens/graphs.txt +1 -1
  37. data/demo/config/targets/INST/screens/ground.txt +1 -1
  38. data/demo/config/targets/INST/screens/hs.txt +2 -1
  39. data/demo/config/targets/INST/screens/latest.txt +1 -1
  40. data/demo/config/targets/INST/screens/limits.txt +1 -1
  41. data/demo/config/targets/INST/screens/other.txt +1 -1
  42. data/demo/config/targets/INST/screens/tabs.txt +1 -1
  43. data/demo/config/tools/cmd_tlm_server/cmd_tlm_server.txt +2 -2
  44. data/demo/config/tools/cmd_tlm_server/cmd_tlm_server2.txt +3 -1
  45. data/demo/config/tools/launcher/launcher.txt +3 -2
  46. data/demo/tools/Dart +16 -0
  47. data/demo/tools/Dart.bat +9 -0
  48. data/demo/tools/mac/CmdSequence.app/Contents/MacOS/main.sh +0 -0
  49. data/demo/tools/mac/ConfigEditor.app/Contents/MacOS/main.sh +0 -0
  50. data/install/Gemfile +1 -0
  51. data/install/Rakefile +4 -0
  52. data/install/config/dart/Gemfile +54 -0
  53. data/install/config/data/crc.txt +6 -3
  54. data/install/config/system/system.txt +3 -0
  55. data/install/config/tools/launcher/launcher.txt +3 -2
  56. data/install/tools/Dart +16 -0
  57. data/install/tools/Dart.bat +9 -0
  58. data/install/tools/mac/CmdSequence.app/Contents/MacOS/main.sh +0 -0
  59. data/install/tools/mac/ConfigEditor.app/Contents/MacOS/main.sh +0 -0
  60. data/lib/cosmos/core_ext/time.rb +8 -8
  61. data/lib/cosmos/dart/.rspec +1 -0
  62. data/lib/cosmos/dart/Gemfile +69 -0
  63. data/lib/cosmos/dart/Rakefile +7 -0
  64. data/lib/cosmos/dart/app/assets/config/manifest.js +4 -0
  65. data/lib/cosmos/dart/app/assets/images/.keep +0 -0
  66. data/lib/cosmos/dart/app/assets/javascripts/application.js +13 -0
  67. data/lib/cosmos/dart/app/assets/javascripts/cable.js +13 -0
  68. data/lib/cosmos/dart/app/assets/stylesheets/application.css.scss +15 -0
  69. data/lib/cosmos/dart/app/channels/application_cable/channel.rb +4 -0
  70. data/lib/cosmos/dart/app/channels/application_cable/connection.rb +4 -0
  71. data/lib/cosmos/dart/app/controllers/application_controller.rb +3 -0
  72. data/lib/cosmos/dart/app/helpers/application_helper.rb +2 -0
  73. data/lib/cosmos/dart/app/jobs/application_job.rb +2 -0
  74. data/lib/cosmos/dart/app/mailers/application_mailer.rb +4 -0
  75. data/lib/cosmos/dart/app/models/application_record.rb +3 -0
  76. data/lib/cosmos/dart/app/models/item.rb +6 -0
  77. data/lib/cosmos/dart/app/models/item_to_decom_table_mapping.rb +9 -0
  78. data/lib/cosmos/dart/app/models/packet.rb +4 -0
  79. data/lib/cosmos/dart/app/models/packet_config.rb +7 -0
  80. data/lib/cosmos/dart/app/models/packet_log.rb +3 -0
  81. data/lib/cosmos/dart/app/models/packet_log_entry.rb +41 -0
  82. data/lib/cosmos/dart/app/models/system_config.rb +2 -0
  83. data/lib/cosmos/dart/app/models/target.rb +4 -0
  84. data/lib/cosmos/dart/app/views/layouts/application.html.erb +14 -0
  85. data/lib/cosmos/dart/app/views/layouts/mailer.html.erb +13 -0
  86. data/lib/cosmos/dart/app/views/layouts/mailer.text.erb +1 -0
  87. data/lib/cosmos/dart/bin/bundle +3 -0
  88. data/lib/cosmos/dart/bin/rails +4 -0
  89. data/lib/cosmos/dart/bin/rake +4 -0
  90. data/lib/cosmos/dart/bin/setup +34 -0
  91. data/lib/cosmos/dart/bin/update +29 -0
  92. data/lib/cosmos/dart/config.ru +5 -0
  93. data/lib/cosmos/dart/config/application.rb +29 -0
  94. data/lib/cosmos/dart/config/boot.rb +3 -0
  95. data/lib/cosmos/dart/config/cable.yml +9 -0
  96. data/lib/cosmos/dart/config/database.yml +23 -0
  97. data/lib/cosmos/dart/config/environment.rb +5 -0
  98. data/lib/cosmos/dart/config/environments/development.rb +62 -0
  99. data/lib/cosmos/dart/config/environments/production.rb +84 -0
  100. data/lib/cosmos/dart/config/environments/test.rb +42 -0
  101. data/lib/cosmos/dart/config/initializers/application_controller_renderer.rb +6 -0
  102. data/lib/cosmos/dart/config/initializers/assets.rb +12 -0
  103. data/lib/cosmos/dart/config/initializers/backtrace_silencers.rb +7 -0
  104. data/lib/cosmos/dart/config/initializers/cookies_serializer.rb +5 -0
  105. data/lib/cosmos/dart/config/initializers/filter_parameter_logging.rb +4 -0
  106. data/lib/cosmos/dart/config/initializers/inflections.rb +16 -0
  107. data/lib/cosmos/dart/config/initializers/mime_types.rb +4 -0
  108. data/lib/cosmos/dart/config/initializers/new_framework_defaults.rb +25 -0
  109. data/lib/cosmos/dart/config/initializers/session_store.rb +3 -0
  110. data/lib/cosmos/dart/config/initializers/wrap_parameters.rb +14 -0
  111. data/lib/cosmos/dart/config/locales/en.yml +23 -0
  112. data/lib/cosmos/dart/config/puma.rb +47 -0
  113. data/lib/cosmos/dart/config/routes.rb +3 -0
  114. data/lib/cosmos/dart/config/secrets.yml +22 -0
  115. data/lib/cosmos/dart/db/migrate/20170406172907_create_targets.rb +8 -0
  116. data/lib/cosmos/dart/db/migrate/20170406172927_create_packets.rb +10 -0
  117. data/lib/cosmos/dart/db/migrate/20170406172937_create_packet_logs.rb +9 -0
  118. data/lib/cosmos/dart/db/migrate/20170406172943_create_packet_log_entries.rb +16 -0
  119. data/lib/cosmos/dart/db/migrate/20170406183500_change_packet_log_entries_primary_key.rb +5 -0
  120. data/lib/cosmos/dart/db/migrate/20170407153618_add_unique_requirements.rb +7 -0
  121. data/lib/cosmos/dart/db/migrate/20170511155447_add_meta_id_to_packet_log_entries.rb +6 -0
  122. data/lib/cosmos/dart/db/migrate/20170523185056_rename_received_time_and_add_is_tlm_to_packet_log_entries.rb +7 -0
  123. data/lib/cosmos/dart/db/migrate/20170525201157_create_items.rb +10 -0
  124. data/lib/cosmos/dart/db/migrate/20170525201315_create_system_configs.rb +9 -0
  125. data/lib/cosmos/dart/db/migrate/20170525201624_create_packet_configs.rb +11 -0
  126. data/lib/cosmos/dart/db/migrate/20170525201745_create_item_to_decom_table_mappings.rb +12 -0
  127. data/lib/cosmos/dart/db/migrate/20170525201939_create_decom_tables.rb +12 -0
  128. data/lib/cosmos/dart/db/migrate/20170525202051_add_decom_state_to_packet_log_entry.rb +5 -0
  129. data/lib/cosmos/dart/db/migrate/20170913160409_update_items.rb +6 -0
  130. data/lib/cosmos/dart/db/migrate/20170913160558_update_item_to_decom_table_mapping.rb +11 -0
  131. data/lib/cosmos/dart/db/migrate/20170913160916_udpate_decom_table.rb +6 -0
  132. data/lib/cosmos/dart/db/migrate/20170913212026_add_ready_to_packet_configs.rb +5 -0
  133. data/lib/cosmos/dart/db/migrate/20170913223556_modify_tables.rb +9 -0
  134. data/lib/cosmos/dart/db/migrate/20170914215744_modify_mapping_table.rb +6 -0
  135. data/lib/cosmos/dart/db/migrate/20170919201433_add_system_config_id_to_packet_config.rb +11 -0
  136. data/lib/cosmos/dart/db/migrate/20170919210307_add_max_table_index_to_packet_configs.rb +5 -0
  137. data/lib/cosmos/dart/db/migrate/20171215225546_add_ready_to_packet_log_entries.rb +5 -0
  138. data/lib/cosmos/dart/db/migrate/20180116214338_add_index_for_ple_ready_to_packet_log_entries.rb +5 -0
  139. data/lib/cosmos/dart/db/schema.rb +103 -0
  140. data/lib/cosmos/dart/db/seeds.rb +7 -0
  141. data/lib/cosmos/dart/examples/dart_decom_client.rb +45 -0
  142. data/lib/cosmos/dart/examples/dart_stream_client.rb +93 -0
  143. data/lib/cosmos/dart/lib/dart_common.rb +749 -0
  144. data/lib/cosmos/dart/lib/dart_database_cleaner.rb +172 -0
  145. data/lib/cosmos/dart/lib/dart_decom_query.rb +184 -0
  146. data/lib/cosmos/dart/lib/dart_decommutator.rb +235 -0
  147. data/lib/cosmos/dart/lib/dart_importer.rb +154 -0
  148. data/lib/cosmos/dart/lib/dart_logging.rb +50 -0
  149. data/lib/cosmos/dart/lib/dart_packet_log_writer.rb +139 -0
  150. data/lib/cosmos/dart/lib/dart_reducer_manager.rb +85 -0
  151. data/lib/cosmos/dart/lib/dart_reducer_worker_thread.rb +263 -0
  152. data/lib/cosmos/dart/lib/dart_tcpip_server_interface.rb +142 -0
  153. data/lib/cosmos/dart/processes/dart.rb +145 -0
  154. data/lib/cosmos/dart/processes/dart_decom_server.rb +39 -0
  155. data/lib/cosmos/dart/processes/dart_import.rb +63 -0
  156. data/lib/cosmos/dart/processes/dart_ingester.rb +92 -0
  157. data/lib/cosmos/dart/processes/dart_reducer.rb +27 -0
  158. data/lib/cosmos/dart/processes/dart_stream_server.rb +31 -0
  159. data/lib/cosmos/dart/processes/dart_worker.rb +37 -0
  160. data/lib/cosmos/dart/spec/dart/dart_common_spec.rb +333 -0
  161. data/lib/cosmos/dart/spec/dart/dart_database_cleaner_spec.rb +455 -0
  162. data/lib/cosmos/dart/spec/dart/dart_decom_query_spec.rb +153 -0
  163. data/lib/cosmos/dart/spec/dart/dart_decommutator_spec.rb +336 -0
  164. data/lib/cosmos/dart/spec/dart/dart_importer_spec.rb +83 -0
  165. data/lib/cosmos/dart/spec/dart/dart_logging_spec.rb +30 -0
  166. data/lib/cosmos/dart/spec/dart/dart_packet_log_writer_spec.rb +149 -0
  167. data/lib/cosmos/dart/spec/dart/dart_reducer_manager_spec.rb +289 -0
  168. data/lib/cosmos/dart/spec/dart/dart_tcpip_server_interface_spec.rb +241 -0
  169. data/lib/cosmos/dart/spec/rails_helper.rb +60 -0
  170. data/lib/cosmos/dart/spec/spec_helper.rb +139 -0
  171. data/lib/cosmos/gui/dialogs/about_dialog.rb +1 -1
  172. data/lib/cosmos/gui/dialogs/dart_dialog.rb +60 -0
  173. data/lib/cosmos/gui/dialogs/legal_dialog.rb +1 -0
  174. data/lib/cosmos/gui/dialogs/scroll_text_dialog.rb +0 -3
  175. data/lib/cosmos/gui/qt.rb +10 -1
  176. data/lib/cosmos/gui/text/completion.rb +10 -9
  177. data/lib/cosmos/gui/text/completion_text_edit.rb +16 -14
  178. data/lib/cosmos/gui/text/ruby_editor.rb +2 -2
  179. data/lib/cosmos/gui/widgets/dart_frame.rb +142 -0
  180. data/lib/cosmos/gui/widgets/dart_meta_frame.rb +119 -0
  181. data/lib/cosmos/gui/widgets/packet_log_frame.rb +42 -12
  182. data/lib/cosmos/interfaces/interface.rb +1 -2
  183. data/lib/cosmos/interfaces/protocols/crc_protocol.rb +26 -8
  184. data/lib/cosmos/interfaces/protocols/fixed_protocol.rb +8 -2
  185. data/lib/cosmos/interfaces/protocols/protocol.rb +2 -1
  186. data/lib/cosmos/interfaces/protocols/template_protocol.rb +1 -1
  187. data/lib/cosmos/interfaces/stream_interface.rb +1 -0
  188. data/lib/cosmos/interfaces/tcpip_server_interface.rb +2 -3
  189. data/lib/cosmos/io/json_drb_object.rb +1 -1
  190. data/lib/cosmos/io/json_rpc.rb +2 -1
  191. data/lib/cosmos/io/win32_serial_driver.rb +2 -9
  192. data/lib/cosmos/packet_logs/packet_log_writer.rb +1 -1
  193. data/lib/cosmos/packets/packet.rb +22 -12
  194. data/lib/cosmos/packets/packet_config.rb +2 -1
  195. data/lib/cosmos/packets/packet_item.rb +26 -24
  196. data/lib/cosmos/packets/parsers/macro_parser.rb +5 -2
  197. data/lib/cosmos/packets/parsers/packet_item_parser.rb +35 -17
  198. data/lib/cosmos/packets/parsers/packet_parser.rb +3 -10
  199. data/lib/cosmos/packets/parsers/xtce_converter.rb +21 -35
  200. data/lib/cosmos/packets/parsers/xtce_parser.rb +54 -46
  201. data/lib/cosmos/packets/structure.rb +10 -2
  202. data/lib/cosmos/packets/structure_item.rb +22 -8
  203. data/lib/cosmos/processors/statistics_processor.rb +2 -0
  204. data/lib/cosmos/script/api_shared.rb +13 -12
  205. data/lib/cosmos/script/cmd_tlm_server.rb +4 -0
  206. data/lib/cosmos/script/commands.rb +3 -15
  207. data/lib/cosmos/script/script.rb +69 -23
  208. data/lib/cosmos/streams/tcpip_client_stream.rb +2 -2
  209. data/lib/cosmos/system/system.rb +42 -25
  210. data/lib/cosmos/system/target.rb +6 -2
  211. data/lib/cosmos/tools/cmd_extractor/cmd_extractor.rb +177 -36
  212. data/lib/cosmos/tools/cmd_sender/cmd_param_table_item_delegate.rb +3 -2
  213. data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +34 -8
  214. data/lib/cosmos/tools/cmd_sequence/cmd_sequence.rb +80 -25
  215. data/lib/cosmos/tools/cmd_tlm_server/api.rb +19 -4
  216. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +15 -14
  217. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +15 -9
  218. data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +1 -9
  219. data/lib/cosmos/tools/cmd_tlm_server/gui/logging_tab.rb +1 -6
  220. data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +1 -3
  221. data/lib/cosmos/tools/cmd_tlm_server/gui/replay_tab.rb +84 -7
  222. data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +0 -1
  223. data/lib/cosmos/tools/cmd_tlm_server/gui/targets_tab.rb +1 -5
  224. data/lib/cosmos/tools/cmd_tlm_server/limits_groups_background_task.rb +3 -2
  225. data/lib/cosmos/tools/cmd_tlm_server/replay_backend.rb +159 -27
  226. data/lib/cosmos/tools/cmd_tlm_server/routers.rb +1 -1
  227. data/lib/cosmos/tools/config_editor/config_editor.rb +17 -52
  228. data/lib/cosmos/tools/config_editor/config_editor_frame.rb +0 -5
  229. data/lib/cosmos/tools/data_viewer/data_viewer.rb +111 -0
  230. data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +31 -18
  231. data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +12 -3
  232. data/lib/cosmos/tools/script_runner/script_runner.rb +27 -14
  233. data/lib/cosmos/tools/script_runner/script_runner_frame.rb +104 -37
  234. data/lib/cosmos/tools/table_manager/table_config.rb +1 -1
  235. data/lib/cosmos/tools/table_manager/table_item_parser.rb +4 -2
  236. data/lib/cosmos/tools/table_manager/table_manager.rb +0 -5
  237. data/lib/cosmos/tools/table_manager/table_manager_core.rb +0 -1
  238. data/lib/cosmos/tools/test_runner/test.rb +1 -3
  239. data/lib/cosmos/tools/test_runner/test_runner.rb +26 -15
  240. data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +290 -137
  241. data/lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb +122 -25
  242. data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +67 -0
  243. data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +28 -0
  244. data/lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb +36 -0
  245. data/lib/cosmos/tools/tlm_grapher/data_objects/data_object.rb +42 -3
  246. data/lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb +88 -14
  247. data/lib/cosmos/tools/tlm_grapher/data_objects/linegraph_data_object.rb +2 -5
  248. data/lib/cosmos/tools/tlm_grapher/data_objects/singlexy_data_object.rb +2 -6
  249. data/lib/cosmos/tools/tlm_grapher/data_objects/xy_data_object.rb +74 -18
  250. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_config.rb +3 -7
  251. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_dart_thread.rb +159 -0
  252. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tool.rb +49 -2
  253. data/lib/cosmos/tools/tlm_viewer/screen.rb +3 -0
  254. data/lib/cosmos/tools/tlm_viewer/tlm_viewer_config.rb +0 -2
  255. data/lib/cosmos/tools/tlm_viewer/widgets.rb +1 -0
  256. data/lib/cosmos/tools/tlm_viewer/widgets/backgroundbutton_widget.rb +54 -0
  257. data/lib/cosmos/tools/tlm_viewer/widgets/button_widget.rb +5 -5
  258. data/lib/cosmos/top_level.rb +1 -0
  259. data/lib/cosmos/utilities/crc.rb +3 -0
  260. data/lib/cosmos/utilities/csv.rb +1 -0
  261. data/lib/cosmos/utilities/message_log.rb +2 -1
  262. data/lib/cosmos/utilities/simulated_target.rb +8 -8
  263. data/lib/cosmos/version.rb +5 -5
  264. data/lib/cosmos/win32/win32.rb +4 -10
  265. data/run_gui_tests.bat +2 -1
  266. data/spec/config/config_parser_spec.rb +4 -4
  267. data/spec/core_ext/array_spec.rb +1 -1
  268. data/spec/core_ext/exception_spec.rb +12 -12
  269. data/spec/core_ext/file_spec.rb +6 -6
  270. data/spec/core_ext/hash_spec.rb +1 -1
  271. data/spec/core_ext/socket_spec.rb +2 -2
  272. data/spec/core_ext/string_spec.rb +13 -13
  273. data/spec/core_ext/time_spec.rb +0 -2
  274. data/spec/gui/utilities/script_module_gui_spec.rb +3 -3
  275. data/spec/install/config/targets/INST/cmd_tlm/inst_tlm.txt +6 -6
  276. data/spec/install/config/tools/cmd_tlm_server/cmd_tlm_server.txt +4 -0
  277. data/spec/interfaces/cmd_tlm_server_interface_spec.rb +6 -2
  278. data/spec/interfaces/interface_spec.rb +0 -1
  279. data/spec/interfaces/linc_interface_spec.rb +0 -5
  280. data/spec/interfaces/protocols/crc_protocol_spec.rb +201 -85
  281. data/spec/interfaces/protocols/fixed_protocol_spec.rb +33 -9
  282. data/spec/interfaces/protocols/length_protocol_spec.rb +1 -1
  283. data/spec/interfaces/protocols/override_protocol_spec.rb +6 -2
  284. data/spec/interfaces/protocols/preidentified_protocol_spec.rb +1 -5
  285. data/spec/interfaces/protocols/template_protocol_spec.rb +0 -1
  286. data/spec/interfaces/simulated_target_interface_spec.rb +5 -5
  287. data/spec/interfaces/udp_interface_spec.rb +2 -4
  288. data/spec/io/buffered_file_spec.rb +8 -12
  289. data/spec/io/json_drb_spec.rb +9 -9
  290. data/spec/io/json_rpc_spec.rb +4 -4
  291. data/spec/io/raw_logger_spec.rb +4 -3
  292. data/spec/packet_logs/packet_log_reader_spec.rb +3 -6
  293. data/spec/packet_logs/packet_log_writer_spec.rb +4 -4
  294. data/spec/packets/binary_accessor_spec.rb +5 -8
  295. data/spec/packets/commands_spec.rb +2 -2
  296. data/spec/packets/limits_spec.rb +2 -2
  297. data/spec/packets/packet_config_spec.rb +12 -0
  298. data/spec/packets/packet_item_limits_spec.rb +1 -1
  299. data/spec/packets/packet_item_spec.rb +9 -9
  300. data/spec/packets/packet_spec.rb +15 -5
  301. data/spec/packets/parsers/packet_item_parser_spec.rb +27 -0
  302. data/spec/packets/parsers/xtce_parser_spec.rb +27 -30
  303. data/spec/packets/structure_spec.rb +2 -1
  304. data/spec/packets/telemetry_spec.rb +3 -5
  305. data/spec/processors/statistics_processor_spec.rb +35 -0
  306. data/spec/script/cmd_tlm_server_spec.rb +4 -21
  307. data/spec/script/commands_disconnect_spec.rb +46 -58
  308. data/spec/script/commands_spec.rb +40 -61
  309. data/spec/script/limits_spec.rb +1 -21
  310. data/spec/script/script_spec.rb +32 -41
  311. data/spec/script/scripting_spec.rb +166 -185
  312. data/spec/script/telemetry_spec.rb +10 -5
  313. data/spec/script/tools_spec.rb +2 -24
  314. data/spec/spec_helper.rb +11 -5
  315. data/spec/system/system_spec.rb +17 -12
  316. data/spec/tools/cmd_tlm_server/api_spec.rb +21 -10
  317. data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +15 -16
  318. data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +0 -1
  319. data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +16 -27
  320. data/spec/tools/cmd_tlm_server/commanding_spec.rb +2 -6
  321. data/spec/tools/cmd_tlm_server/connections_spec.rb +0 -4
  322. data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +13 -13
  323. data/spec/tools/cmd_tlm_server/interfaces_spec.rb +5 -9
  324. data/spec/tools/cmd_tlm_server/limits_groups_background_task_spec.rb +11 -3
  325. data/spec/tools/cmd_tlm_server/packet_logging_spec.rb +0 -4
  326. data/spec/tools/cmd_tlm_server/router_thread_spec.rb +5 -5
  327. data/spec/tools/cmd_tlm_server/routers_spec.rb +5 -9
  328. data/spec/tools/table_manager/table_config_spec.rb +0 -1
  329. data/spec/tools/table_manager/tablemanager_core_spec.rb +23 -23
  330. data/spec/tools/tlm_viewer/tlm_viewer_config_spec.rb +6 -4
  331. data/spec/top_level/top_level_spec.rb +9 -9
  332. data/spec/utilities/csv_spec.rb +2 -12
  333. data/spec/utilities/logger_spec.rb +6 -6
  334. data/spec/utilities/message_log_spec.rb +3 -11
  335. data/tasks/gemfile_stats.rake +2 -2
  336. metadata +167 -60
@@ -165,7 +165,7 @@ module Cosmos
165
165
  # (see PacketConfig#start_item)
166
166
  def start_item(parser)
167
167
  finish_item()
168
- @current_item = TableItemParser.parse(parser, @current_packet)
168
+ @current_item = TableItemParser.parse(parser, @current_packet, @warnings)
169
169
  end
170
170
 
171
171
  # If the table is TWO_DIMENSIONAL all currently defined items are
@@ -12,11 +12,13 @@ require 'cosmos/packets/packet_config'
12
12
  require 'cosmos/packets/packet_item'
13
13
 
14
14
  module Cosmos
15
+ # Extends the PacketItemParser to create TableItems for TableManager
15
16
  class TableItemParser < PacketItemParser
16
17
  # @param parser [ConfigParser] Configuration parser
17
18
  # @param table [Table] Table all parsed items should be added to
18
- def self.parse(parser, table)
19
- parser = TableItemParser.new(parser)
19
+ # # @param warnings [Array<String>] Array of warning strings from PacketConfig
20
+ def self.parse(parser, table, warnings)
21
+ parser = TableItemParser.new(parser, warnings)
20
22
  parser.verify_parameters(PacketConfig::COMMAND)
21
23
  parser.create_table_item(table)
22
24
  end
@@ -357,10 +357,6 @@ module Cosmos
357
357
  @table_commit = Qt::Action.new(tr('Commit to Existing &File'), self)
358
358
  @table_commit.statusTip = tr('Incorporate the current table data into a binary file which already contains the table')
359
359
  @table_commit.connect(SIGNAL('triggered()')) { table_commit() }
360
-
361
- #@table_update = Qt::Action.new(tr('&Update Definition'), self)
362
- #@table_update.statusTip = tr('Change the defaults in the definition file to the displayed table data')
363
- #@table_update.connect(SIGNAL('triggered()')) { table_update() }
364
360
  end
365
361
  end
366
362
 
@@ -392,7 +388,6 @@ module Cosmos
392
388
  table_menu.addSeparator()
393
389
  table_menu.addAction(@table_save)
394
390
  table_menu.addAction(@table_commit)
395
- #table_menu.addAction(@table_update)
396
391
  end
397
392
 
398
393
  # Help Menu
@@ -56,7 +56,6 @@ module Cosmos
56
56
  # @param output_dir [String] Output directory to create the new file
57
57
  # @return [String] Binary file path
58
58
  def file_new(def_path, output_dir)
59
- progress = 0.0
60
59
  process_definition(def_path)
61
60
  yield 0.3 if block_given?
62
61
 
@@ -103,10 +103,8 @@ module Cosmos
103
103
  test_cases << method_name.to_s
104
104
  end
105
105
  end
106
-
107
- # Sort by name
106
+ # Sort by name for all found tests
108
107
  test_cases.sort!
109
-
110
108
  test_cases
111
109
  end
112
110
 
@@ -1122,23 +1122,37 @@ module Cosmos
1122
1122
 
1123
1123
  # Build list of TestSuites and Tests
1124
1124
  @@test_suites = @@test_suites.select {|my_suite| my_suite.name == 'CustomTestSuite'}
1125
- tests = []
1125
+ tests = []
1126
1126
  ObjectSpace.each_object(Class) do |object|
1127
+
1127
1128
  begin
1128
1129
  next if object.name == 'CustomTestSuite'
1129
- if (object.ancestors.include?(TestSuite) &&
1130
- object != TestSuite &&
1131
- !ignored_test_suite_classes.include?(object))
1132
- @@test_suites << object.new
1133
- end
1134
- if (object.ancestors.include?(Test) &&
1135
- object != Test &&
1136
- !ignored_test_classes.include?(object))
1137
- tests << object
1138
- end
1130
+ ancestors = object.ancestors
1139
1131
  rescue
1140
- # Ignore Classes where name, etc may raise exception
1132
+ # Ignore Classes where name or ancestors may raise exception
1141
1133
  # Bundler::Molinillo::DependencyGraph::Action is one example
1134
+ next
1135
+ end
1136
+ if (ancestors.include?(TestSuite) &&
1137
+ object != TestSuite &&
1138
+ !ignored_test_suite_classes.include?(object))
1139
+ # Ensure they didn't override name for some reason
1140
+ if object.instance_methods(false).include?(:name)
1141
+ raise FatalError.new("#{object} redefined the 'name' method. Delete the 'name' method and try again.")
1142
+ end
1143
+ # ObjectSpace.each_object appears to yield objects in the reverse
1144
+ # order that they were parsed by the interpreter so push each
1145
+ # TestSuite object to the front of the array to order as encountered
1146
+ @@test_suites.unshift(object.new)
1147
+ end
1148
+ if (ancestors.include?(Test) &&
1149
+ object != Test &&
1150
+ !ignored_test_classes.include?(object))
1151
+ # Ensure they didn't override self.name for some reason
1152
+ if object.methods(false).include?(:name)
1153
+ raise FatalError.new("#{object} redefined the 'self.name' method. Delete the 'self.name' method and try again.")
1154
+ end
1155
+ tests << object
1142
1156
  end
1143
1157
  end
1144
1158
  # Raise error if no test suites or tests
@@ -1157,7 +1171,6 @@ module Cosmos
1157
1171
  end
1158
1172
 
1159
1173
  # Create TestSuite for unassigned Tests
1160
- @@test_suites.sort!
1161
1174
  @@test_suites.each do |test_suite|
1162
1175
  tests_to_delete = []
1163
1176
  tests.each { |test| tests_to_delete << test if test_suite.tests[test] }
@@ -1183,7 +1196,6 @@ module Cosmos
1183
1196
  OpenStruct.new(:setup=>false, :teardown=>false, :cases=>[])
1184
1197
  cur_suite.tests[test_class.name].cases.concat(test_class.test_cases)
1185
1198
  cur_suite.tests[test_class.name].cases.uniq!
1186
- cur_suite.tests[test_class.name].cases.sort!
1187
1199
  cur_suite.tests[test_class.name].setup = true if test_class.method_defined?(:setup)
1188
1200
  cur_suite.tests[test_class.name].teardown = true if test_class.method_defined?(:teardown)
1189
1201
  when :TEST_CASE
@@ -1193,7 +1205,6 @@ module Cosmos
1193
1205
  if test_class.method_defined?(test_case.intern)
1194
1206
  cur_suite.tests[test_class.name].cases << test_case
1195
1207
  cur_suite.tests[test_class.name].cases.uniq!
1196
- cur_suite.tests[test_class.name].cases.sort!
1197
1208
  else
1198
1209
  raise "#{test_class} does not have a #{test_case} method defined."
1199
1210
  end
@@ -17,6 +17,7 @@ Cosmos.catch_fatal_exception do
17
17
  require 'cosmos/gui/choosers/float_chooser'
18
18
  require 'cosmos/gui/dialogs/splash'
19
19
  require 'cosmos/gui/widgets/packet_log_frame'
20
+ require 'cosmos/gui/widgets/dart_meta_frame'
20
21
  require 'cosmos/gui/dialogs/progress_dialog'
21
22
  require 'cosmos/gui/widgets/full_text_search_line_edit'
22
23
  require 'cosmos/gui/utilities/analyze_log'
@@ -33,6 +34,8 @@ module Cosmos
33
34
  slots 'context_menu(const QPoint&)'
34
35
 
35
36
  FORMATTING_OPTIONS = %w(CONVERTED RAW FORMATTED WITH_UNITS)
37
+ DART_REDUCED_TYPE_OPTIONS = %w(AVG MIN MAX STDDEV)
38
+ DART_REDUCTION_OPTIONS = %w(NONE MINUTE HOUR DAY)
36
39
 
37
40
  class MyListWidget < Qt::ListWidget
38
41
  signals 'enterKeyPressed(int)'
@@ -232,6 +235,9 @@ module Cosmos
232
235
  end
233
236
 
234
237
  def initialize_central_widget
238
+ @resize_timer = Qt::Timer.new
239
+ @resize_timer.connect(SIGNAL('timeout()')) { self.resize(self.width, self.minimumHeight) }
240
+
235
241
  # Create the central widget
236
242
  @central_widget = Qt::Widget.new
237
243
  setCentralWidget(@central_widget)
@@ -390,20 +396,43 @@ module Cosmos
390
396
 
391
397
  @batch_config_box.hide
392
398
 
393
- @file_box = Qt::GroupBox.new("File Selection")
394
- @file_box_layout = Qt::VBoxLayout.new
395
- @file_box.setLayout(@file_box_layout)
396
- @top_layout.addWidget(@file_box)
399
+ # Data Source Selection
400
+ @data_source_layout = Qt::HBoxLayout.new()
401
+ label = Qt::Label.new("Data Source: ")
402
+ @data_source_layout.addWidget(label)
403
+ @log_file_radio = Qt::RadioButton.new("Log File", self)
404
+ @log_file_radio.setChecked(true)
405
+ @log_file_radio.connect(SIGNAL('clicked()')) do
406
+ @packet_log_frame.show_log_fields(true)
407
+ @packet_log_frame.output_filename = ""
408
+ @dart_meta_frame.hide
409
+ @resize_timer.start(100)
410
+ end
411
+ @data_source_layout.addWidget(@log_file_radio)
412
+ @dart_radio = Qt::RadioButton.new("DART Database", self)
413
+ @dart_radio.connect(SIGNAL('clicked()')) do
414
+ @packet_log_frame.show_log_fields(false)
415
+ @packet_log_frame.output_filename = ""
416
+ @dart_meta_frame.show
417
+ @resize_timer.start(100)
418
+ end
419
+ @data_source_layout.addWidget(@dart_radio)
420
+ @data_source_layout.addStretch()
421
+ @top_layout.addLayout(@data_source_layout)
397
422
 
398
423
  # Packet Log Frame
399
424
  @packet_log_frame = PacketLogFrame.new(self, @log_dir, System.default_packet_log_reader.new(*System.default_packet_log_reader_params), @input_filenames, nil, true, true, true, Cosmos::TLM_FILE_PATTERN, Cosmos::TXT_FILE_PATTERN)
400
425
  @packet_log_frame.change_callback = method(:change_callback)
401
- @file_box_layout.addWidget(@packet_log_frame)
426
+ @top_layout.addWidget(@packet_log_frame)
427
+
428
+ @dart_meta_frame = DartMetaFrame.new(self)
429
+ @dart_meta_frame.hide
430
+ @top_layout.addWidget(@dart_meta_frame)
402
431
 
403
432
  # Process and Open Buttons
404
433
  @button_layout = Qt::HBoxLayout.new
405
- @process_button = Qt::PushButton.new('&Process Files')
406
- @process_button.connect(SIGNAL('clicked()')) { process_log_files() }
434
+ @process_button = Qt::PushButton.new('&Process')
435
+ @process_button.connect(SIGNAL('clicked()')) { process() }
407
436
  @button_layout.addWidget(@process_button)
408
437
 
409
438
  @open_button = Qt::PushButton.new('&Open in Text Editor')
@@ -423,7 +452,7 @@ module Cosmos
423
452
  end # def initialize
424
453
 
425
454
  def self.post_options_parsed_hook(options)
426
- if options.input_files
455
+ if options.input_files or options.dart
427
456
  # Process config file
428
457
  raise "Configuration File must be specified for command line processing" unless options.config_file
429
458
 
@@ -431,19 +460,27 @@ module Cosmos
431
460
  tlm_extractor_config = TlmExtractorConfig.new(options.config_file)
432
461
  tlm_extractor_processor = TlmExtractorProcessor.new
433
462
  unless options.output_file
434
- filename = options.input_files[0]
435
- extension = File.extname(filename)
436
- filename_no_extension = filename[0..-(extension.length + 1)]
437
- if tlm_extractor_config.delimiter.to_s.strip == ','
438
- filename = filename_no_extension << '.csv'
463
+ if options.input_files
464
+ filename = options.input_files[0]
465
+ extension = File.extname(filename)
466
+ filename_no_extension = filename[0..-(extension.length + 1)]
467
+ if tlm_extractor_config.delimiter.to_s.strip == ','
468
+ filename = filename_no_extension << '.csv'
469
+ else
470
+ filename = filename_no_extension << '.txt'
471
+ end
472
+ options.output_file = File.join(System.paths['LOGS'], File.basename(filename))
439
473
  else
440
- filename = filename_no_extension << '.txt'
474
+ options.output_file = File.join(System.paths['LOGS'], File.build_timestamped_filename(['tlmextractor']))
441
475
  end
442
- options.output_file = File.join(System.paths['LOGS'], File.basename(filename))
443
476
  end
444
477
 
445
478
  tlm_extractor_config.output_filename = options.output_file
446
- tlm_extractor_processor.process(options.input_files, [tlm_extractor_config])
479
+ if options.dart
480
+ tlm_extractor_processor.process_dart([tlm_extractor_config])
481
+ else
482
+ tlm_extractor_processor.process(options.input_files, [tlm_extractor_config])
483
+ end
447
484
  puts "Created #{options.output_file}"
448
485
  return false
449
486
  else
@@ -461,6 +498,7 @@ module Cosmos
461
498
  options.auto_size = false
462
499
  options.restore_size = false # always render this the correct size
463
500
  options.title = "Telemetry Extractor"
501
+ options.dart = false
464
502
  option_parser.separator "Telemetry Extractor Specific Options:"
465
503
  option_parser.on("-c", "--config FILE", "Use the specified configuration file") do |arg|
466
504
  options.config_file = File.join(Cosmos::USERPATH, 'config', 'tools', 'tlm_extractor', arg)
@@ -476,6 +514,9 @@ module Cosmos
476
514
  option_parser.on("-o", "--output FILE", "Output results to the specified file") do |arg|
477
515
  options.output_file = arg
478
516
  end
517
+ option_parser.on("--dart", "Query Dart instead of files") do |arg|
518
+ options.dart = true
519
+ end
479
520
  end
480
521
 
481
522
  super(option_parser, options)
@@ -519,13 +560,25 @@ module Cosmos
519
560
  packet_name_or_text = split_item[2]
520
561
  item_name = split_item[3]
521
562
  value_type = split_item[4]
563
+ dart_reduction = split_item[5]
564
+ dart_reduced_type = split_item[6]
522
565
  if value_type
523
566
  value_type = value_type.upcase.intern
524
567
  else
525
568
  value_type = :CONVERTED
526
569
  end
570
+ if dart_reduction
571
+ dart_reduction = dart_reduction.upcase.intern
572
+ else
573
+ dart_reduction = :NONE
574
+ end
575
+ if dart_reduced_type
576
+ dart_reduced_type = dart_reduced_type.upcase.intern
577
+ else
578
+ dart_reduced_type = :AVG
579
+ end
527
580
  if item_type == 'ITEM'
528
- @tlm_extractor_config.add_item(target_name_or_column_name, packet_name_or_text, item_name, value_type)
581
+ @tlm_extractor_config.add_item(target_name_or_column_name, packet_name_or_text, item_name, value_type, dart_reduction, dart_reduced_type)
529
582
  else
530
583
  @tlm_extractor_config.add_text(target_name_or_column_name.remove_quotes, packet_name_or_text.remove_quotes)
531
584
  end
@@ -554,12 +607,16 @@ module Cosmos
554
607
  @downsample_entry.value = @tlm_extractor_config.downsample_seconds
555
608
 
556
609
  clear_config_item_list()
557
- @tlm_extractor_config.items.each do |item_type, target_name_or_column_name, packet_name_or_text, item_name, value_type|
610
+ @tlm_extractor_config.items.each do |item_type, target_name_or_column_name, packet_name_or_text, item_name, value_type, dart_reduction, dart_reduced_type|
558
611
  if item_type == 'ITEM'
559
- if value_type == :CONVERTED
560
- @config_item_list.addItem("#{item_type} #{target_name_or_column_name} #{packet_name_or_text} #{item_name}")
612
+ if dart_reduction == :NONE
613
+ if value_type == :CONVERTED
614
+ @config_item_list.addItem("#{item_type} #{target_name_or_column_name} #{packet_name_or_text} #{item_name}")
615
+ else
616
+ @config_item_list.addItem("#{item_type} #{target_name_or_column_name} #{packet_name_or_text} #{item_name} #{value_type}")
617
+ end
561
618
  else
562
- @config_item_list.addItem("#{item_type} #{target_name_or_column_name} #{packet_name_or_text} #{item_name} #{value_type}")
619
+ @config_item_list.addItem("#{item_type} #{target_name_or_column_name} #{packet_name_or_text} #{item_name} #{value_type} #{dart_reduction} #{dart_reduced_type}")
563
620
  end
564
621
  else
565
622
  @config_item_list.addItem("#{item_type} \"#{target_name_or_column_name}\" \"#{packet_name_or_text}\"")
@@ -576,100 +633,160 @@ module Cosmos
576
633
  end
577
634
 
578
635
  # Handles processing log files
579
- def process_log_files
636
+ def process
580
637
  @cancel = false
581
- begin
582
- @tlm_extractor_processor.packet_log_reader = @packet_log_frame.packet_log_reader
583
- @input_filenames = @packet_log_frame.filenames.sort
584
- @batch_filenames = []
585
- output_extension = '.txt'
586
- batch_name = nil
587
- if @batch_mode_check.checked?
588
- batch_name = @batch_name_entry.text
589
- @batch_filenames_entry.each {|list_item| @batch_filenames << list_item.text}
590
- if @packet_log_frame.output_filename_filter == Cosmos::CSV_FILE_PATTERN
591
- output_extension = '.csv'
592
- else
593
- output_extension = '.txt'
638
+ if @log_file_radio.isChecked
639
+ begin
640
+ @tlm_extractor_processor.packet_log_reader = @packet_log_frame.packet_log_reader
641
+ @input_filenames = @packet_log_frame.filenames.sort
642
+ @batch_filenames = []
643
+ output_extension = '.txt'
644
+ batch_name = nil
645
+ if @batch_mode_check.checked?
646
+ batch_name = @batch_name_entry.text
647
+ @batch_filenames_entry.each {|list_item| @batch_filenames << list_item.text}
648
+ if @packet_log_frame.output_filename_filter == Cosmos::CSV_FILE_PATTERN
649
+ output_extension = '.csv'
650
+ else
651
+ output_extension = '.txt'
652
+ end
594
653
  end
595
- end
596
- return unless pre_process_tests()
597
-
598
- # Configure Tlm Extractor Config
599
- sync_gui_to_config()
654
+ return unless pre_process_tests()
600
655
 
601
- start_time = Time.now.sys
602
- ProgressDialog.execute(self, 'Log File Progress', 600, 300) do |progress_dialog|
603
- progress_dialog.cancel_callback = method(:cancel_callback)
604
- progress_dialog.enable_cancel_button
656
+ # Configure Tlm Extractor Config
657
+ sync_gui_to_config()
605
658
 
606
- begin
607
- current_input_file_index = -1
608
- current_config_file_index = -1
609
- start_packet_count = -1
610
- last_packet_count = -1
611
-
612
- if @batch_filenames.empty?
613
- process_method = :process
614
- process_args = [@input_filenames, [@tlm_extractor_config], @packet_log_frame.time_start, @packet_log_frame.time_end]
615
- else
616
- process_method = :process_batch
617
- process_args = [batch_name, @input_filenames, @log_dir, output_extension, @batch_filenames, @packet_log_frame.time_start, @packet_log_frame.time_end]
618
- end
659
+ start_time = Time.now.sys
660
+ ProgressDialog.execute(self, 'Log File Progress', 600, 300) do |progress_dialog|
661
+ progress_dialog.cancel_callback = method(:cancel_callback)
662
+ progress_dialog.enable_cancel_button
663
+
664
+ begin
665
+ current_input_file_index = -1
666
+ current_config_file_index = -1
667
+ start_packet_count = -1
668
+ last_packet_count = -1
669
+
670
+ if @batch_filenames.empty?
671
+ process_method = :process
672
+ process_args = [@input_filenames, [@tlm_extractor_config], @packet_log_frame.time_start, @packet_log_frame.time_end]
673
+ else
674
+ process_method = :process_batch
675
+ process_args = [batch_name, @input_filenames, @log_dir, output_extension, @batch_filenames, @packet_log_frame.time_start, @packet_log_frame.time_end]
676
+ end
619
677
 
620
- @tlm_extractor_processor.send(process_method, *process_args) do |input_file_index, packet_count, file_progress|
621
- # Handle Cancel
622
- break if @cancel
678
+ @tlm_extractor_processor.send(process_method, *process_args) do |input_file_index, packet_count, file_progress|
679
+ # Handle Cancel
680
+ break if @cancel
623
681
 
624
- # Handle Input File Change
625
- if input_file_index != current_input_file_index
626
- current_input_file_index = input_file_index
682
+ # Handle Input File Change
683
+ if input_file_index != current_input_file_index
684
+ current_input_file_index = input_file_index
627
685
 
628
- if start_packet_count >= 0
629
- # Make sure some packets were found in the previous file
630
- if packet_count == start_packet_count
631
- # No packets found in previous file
632
- progress_dialog.append_text(" WARNING: No packets processed in #{File.basename(@input_filenames[input_file_index - 1])}")
686
+ if start_packet_count >= 0
687
+ # Make sure some packets were found in the previous file
688
+ if packet_count == start_packet_count
689
+ # No packets found in previous file
690
+ progress_dialog.append_text(" WARNING: No packets processed in #{File.basename(@input_filenames[input_file_index - 1])}")
691
+ end
633
692
  end
693
+ start_packet_count = packet_count
694
+
695
+ progress_dialog.append_text("Processing File #{input_file_index + 1}/#{@input_filenames.length}: #{File.basename(@input_filenames[input_file_index])}")
696
+ progress_dialog.set_step_progress(0.0)
697
+ progress_dialog.set_overall_progress((input_file_index).to_f / @input_filenames.length.to_f)
634
698
  end
635
- start_packet_count = packet_count
636
699
 
637
- progress_dialog.append_text("Processing File #{input_file_index + 1}/#{@input_filenames.length}: #{File.basename(@input_filenames[input_file_index])}")
638
- progress_dialog.set_step_progress(0.0)
639
- progress_dialog.set_overall_progress((input_file_index).to_f / @input_filenames.length.to_f)
640
- end
700
+ # Save packet_count
701
+ last_packet_count = packet_count
641
702
 
642
- # Save packet_count
643
- last_packet_count = packet_count
703
+ # Handle Progress Reporting
704
+ progress_dialog.set_step_progress(file_progress)
705
+ end
706
+ # Make sure some packets were found in the previous file
707
+ if start_packet_count == last_packet_count
708
+ # No packets found in previous file
709
+ progress_dialog.append_text(" WARNING: No packets processed in #{File.basename(@input_filenames[-1])}")
710
+ end
644
711
 
645
- # Handle Progress Reporting
646
- progress_dialog.set_step_progress(file_progress)
712
+ rescue => error
713
+ progress_dialog.append_text("Error processing:\n#{error.formatted}\n")
714
+ ensure
715
+ progress_dialog.set_step_progress(1.0) if !@cancel
716
+ progress_dialog.set_overall_progress(1.0) if !@cancel
717
+ progress_dialog.append_text("Runtime: #{Time.now.sys - start_time} s")
718
+ progress_dialog.complete
719
+ if @batch_filenames.empty?
720
+ Qt.execute_in_main_thread(true) do
721
+ @open_button.setEnabled(true)
722
+ @open_excel_button.setEnabled(true) if Kernel.is_windows?
723
+ end
724
+ end
647
725
  end
648
- # Make sure some packets were found in the previous file
649
- if start_packet_count == last_packet_count
650
- # No packets found in previous file
651
- progress_dialog.append_text(" WARNING: No packets processed in #{File.basename(@input_filenames[-1])}")
726
+ end # ProgressDialog.execute
727
+ rescue => error
728
+ Qt::MessageBox.critical(self, 'Error!', "Error Processing Log File(s)\n#{error.formatted}")
729
+ end
730
+ else
731
+ begin
732
+ @batch_filenames = []
733
+ output_extension = '.txt'
734
+ batch_name = nil
735
+ if @batch_mode_check.checked?
736
+ batch_name = @batch_name_entry.text
737
+ @batch_filenames_entry.each {|list_item| @batch_filenames << list_item.text}
738
+ if @packet_log_frame.output_filename_filter == Cosmos::CSV_FILE_PATTERN
739
+ output_extension = '.csv'
740
+ else
741
+ output_extension = '.txt'
652
742
  end
743
+ end
744
+ return unless pre_process_tests()
653
745
 
654
- rescue => error
655
- progress_dialog.append_text("Error processing:\n#{error.formatted}\n")
656
- ensure
657
- progress_dialog.set_step_progress(1.0) if !@cancel
658
- progress_dialog.set_overall_progress(1.0) if !@cancel
659
- progress_dialog.append_text("Runtime: #{Time.now.sys - start_time} s")
660
- progress_dialog.complete
661
- if @batch_filenames.empty?
662
- Qt.execute_in_main_thread(true) do
663
- @open_button.setEnabled(true)
664
- @open_excel_button.setEnabled(true) if Kernel.is_windows?
746
+ # Configure Tlm Extractor Config
747
+ sync_gui_to_config()
748
+
749
+ start_time = Time.now.sys
750
+ ProgressDialog.execute(self, 'DART Query Progress', 600, 300) do |progress_dialog|
751
+ progress_dialog.cancel_callback = method(:cancel_callback)
752
+ progress_dialog.enable_cancel_button
753
+
754
+ begin
755
+ if @batch_filenames.empty?
756
+ process_method = :process_dart
757
+ process_args = [[@tlm_extractor_config], @packet_log_frame.time_start, @packet_log_frame.time_end, @dart_meta_frame.meta_filters]
758
+ else
759
+ process_method = :process_dart_batch
760
+ process_args = [batch_name, @log_dir, output_extension, @batch_filenames, @packet_log_frame.time_start, @packet_log_frame.time_end, @dart_meta_frame.meta_filters]
761
+ end
762
+
763
+ @tlm_extractor_processor.send(process_method, *process_args) do |percentage, message|
764
+ # Handle Cancel
765
+ break if @cancel
766
+ progress_dialog.append_text(message)
767
+ progress_dialog.set_overall_progress(percentage)
768
+ end
769
+
770
+ rescue => error
771
+ progress_dialog.append_text("Error processing:\n#{error.formatted}\n")
772
+ ensure
773
+ progress_dialog.set_step_progress(1.0) if !@cancel
774
+ progress_dialog.set_overall_progress(1.0) if !@cancel
775
+ progress_dialog.append_text("Runtime: #{Time.now.sys - start_time} s")
776
+ progress_dialog.complete
777
+ if @batch_filenames.empty?
778
+ Qt.execute_in_main_thread(true) do
779
+ @open_button.setEnabled(true)
780
+ @open_excel_button.setEnabled(true) if Kernel.is_windows?
781
+ end
665
782
  end
666
783
  end
667
- end
668
- end # ProgressDialog.execute
669
- rescue => error
670
- Qt::MessageBox.critical(self, 'Error!', "Error Processing Log File(s)\n#{error.formatted}")
784
+ end # ProgressDialog.execute
785
+ rescue => error
786
+ Qt::MessageBox.critical(self, 'Error!', "Error Querying DART\n#{error.formatted}")
787
+ end
671
788
  end
672
- end # def process_log_files
789
+ end # def process
673
790
 
674
791
  # Handles options dialog
675
792
  def handle_options
@@ -850,6 +967,32 @@ module Cosmos
850
967
  end
851
968
  layout.addWidget(box)
852
969
 
970
+ label = Qt::Label.new('DART Reduction:')
971
+ layout.addWidget(label)
972
+
973
+ dart_reduction_box = Qt::ComboBox.new
974
+ dart_reduction_box.maxCount = DART_REDUCTION_OPTIONS.length
975
+ DART_REDUCTION_OPTIONS.each {|item| dart_reduction_box.addItem(item) }
976
+ current_reduction = split_item[5]
977
+ current_reduction = 'NONE' unless current_reduction
978
+ if DART_REDUCTION_OPTIONS.index(current_reduction)
979
+ dart_reduction_box.currentIndex = DART_REDUCTION_OPTIONS.index(current_reduction)
980
+ end
981
+ layout.addWidget(dart_reduction_box)
982
+
983
+ label = Qt::Label.new('DART Reduced Type:')
984
+ layout.addWidget(label)
985
+
986
+ dart_reduction_type_box = Qt::ComboBox.new
987
+ dart_reduction_type_box.maxCount = DART_REDUCED_TYPE_OPTIONS.length
988
+ DART_REDUCED_TYPE_OPTIONS.each {|item| dart_reduction_type_box.addItem(item) }
989
+ current_dart_type = split_item[6]
990
+ current_dart_type = 'AVG' unless current_dart_type
991
+ if DART_REDUCED_TYPE_OPTIONS.index(current_dart_type)
992
+ dart_reduction_type_box.currentIndex = DART_REDUCED_TYPE_OPTIONS.index(current_dart_type)
993
+ end
994
+ layout.addWidget(dart_reduction_type_box)
995
+
853
996
  check_box = nil
854
997
  if selected_items.length > 1 and item_index == selected_items[0]
855
998
  check_box = Qt::CheckBox.new('Apply to All?')
@@ -876,11 +1019,15 @@ module Cosmos
876
1019
  set_indexes.each do |set_item_index|
877
1020
  split_item = @config_item_list.item(set_item_index).text.scan ConfigParser::PARSING_REGEX
878
1021
  if split_item[0] == 'ITEM'
879
- # Remove any formatting from the item by only keeping the first four strings
1022
+ # Remove any formatting/dart info from the item by only keeping the first four strings
880
1023
  @config_item_list.item(set_item_index).text = split_item[0..3].join(' ')
881
1024
 
882
- if box.currentIndex != 0
883
- @config_item_list.item(set_item_index).text = "#{@config_item_list.item(set_item_index).text} #{FORMATTING_OPTIONS[box.currentIndex]}"
1025
+ if dart_reduction_box.currentIndex == 0
1026
+ if box.currentIndex != 0
1027
+ @config_item_list.item(set_item_index).text = "#{@config_item_list.item(set_item_index).text} #{FORMATTING_OPTIONS[box.currentIndex]}"
1028
+ end
1029
+ else
1030
+ @config_item_list.item(set_item_index).text = "#{@config_item_list.item(set_item_index).text} #{FORMATTING_OPTIONS[box.currentIndex]} #{DART_REDUCTION_OPTIONS[dart_reduction_box.currentIndex]} #{DART_REDUCED_TYPE_OPTIONS[dart_reduction_type_box.currentIndex]}"
884
1031
  end
885
1032
  end
886
1033
  end
@@ -1047,9 +1194,13 @@ module Cosmos
1047
1194
  return false
1048
1195
  end
1049
1196
 
1050
- unless @packet_log_frame.output_filename
1051
- Qt::MessageBox.critical(self, 'Error', 'No Output File Selected')
1052
- return false
1197
+ if @packet_log_frame.output_filename.to_s.empty?
1198
+ if @log_file_radio.isChecked
1199
+ Qt::MessageBox.critical(self, 'Error', 'No Output File Selected')
1200
+ return false
1201
+ else
1202
+ @packet_log_frame.output_filename = File.join(System.paths['LOGS'], File.build_timestamped_filename(['tlm_extractor', 'dart']))
1203
+ end
1053
1204
  end
1054
1205
 
1055
1206
  if File.exist?(@packet_log_frame.output_filename)
@@ -1070,43 +1221,45 @@ module Cosmos
1070
1221
  end
1071
1222
  end
1072
1223
 
1073
- unless @input_filenames and @input_filenames[0]
1074
- Qt::MessageBox.critical(self, 'Error', 'Please select at least 1 input file')
1075
- return false
1076
- end
1077
-
1078
- # Validate configurations exist for input filenames
1079
- @input_filenames.each do |input_filename|
1080
- Cosmos.check_log_configuration(@tlm_extractor_processor.packet_log_reader, input_filename)
1081
- end
1082
-
1083
- #Validate config information
1084
- @tlm_extractor_processor.packet_log_reader.open(@input_filenames[0])
1085
- @tlm_extractor_processor.packet_log_reader.close
1224
+ if @log_file_radio.isChecked
1225
+ unless @input_filenames and @input_filenames[0]
1226
+ Qt::MessageBox.critical(self, 'Error', 'Please select at least 1 input file')
1227
+ return false
1228
+ end
1086
1229
 
1087
- @config_item_list.each do |item|
1088
- split_item = item.text.split
1089
- item_type = split_item[0]
1090
- target_name = split_item[1]
1091
- packet_name = split_item[2]
1092
- item_name = split_item[3]
1230
+ # Validate configurations exist for input filenames
1231
+ @input_filenames.each do |input_filename|
1232
+ Cosmos.check_log_configuration(@tlm_extractor_processor.packet_log_reader, input_filename)
1233
+ end
1093
1234
 
1094
- if item_type == 'ITEM'
1095
- # Verify Packet
1096
- packet = nil
1097
- begin
1098
- packet = System.telemetry.packet(target_name, packet_name)
1099
- rescue
1100
- Qt::MessageBox.critical(self, 'Error!', "Unknown Packet #{target_name} #{packet_name} specified")
1101
- return false
1102
- end
1235
+ #Validate config information
1236
+ @tlm_extractor_processor.packet_log_reader.open(@input_filenames[0])
1237
+ @tlm_extractor_processor.packet_log_reader.close
1238
+
1239
+ @config_item_list.each do |item|
1240
+ split_item = item.text.split
1241
+ item_type = split_item[0]
1242
+ target_name = split_item[1]
1243
+ packet_name = split_item[2]
1244
+ item_name = split_item[3]
1245
+
1246
+ if item_type == 'ITEM'
1247
+ # Verify Packet
1248
+ packet = nil
1249
+ begin
1250
+ packet = System.telemetry.packet(target_name, packet_name)
1251
+ rescue
1252
+ Qt::MessageBox.critical(self, 'Error!', "Unknown Packet #{target_name} #{packet_name} specified")
1253
+ return false
1254
+ end
1103
1255
 
1104
- # Verify Item
1105
- begin
1106
- packet.get_item(item_name)
1107
- rescue
1108
- Qt::MessageBox.critical(self, 'Error!', "Item #{item_name} not present in packet")
1109
- return false
1256
+ # Verify Item
1257
+ begin
1258
+ packet.get_item(item_name)
1259
+ rescue
1260
+ Qt::MessageBox.critical(self, 'Error!', "Item #{item_name} not present in packet")
1261
+ return false
1262
+ end
1110
1263
  end
1111
1264
  end
1112
1265
  end