openc3 5.0.6

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 (307) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +18 -0
  3. data/Guardfile +35 -0
  4. data/LICENSE.txt +727 -0
  5. data/README.md +37 -0
  6. data/Rakefile +131 -0
  7. data/bin/cstol_converter +1178 -0
  8. data/bin/openc3cli +531 -0
  9. data/bin/rubysloc +139 -0
  10. data/data/config/_array_params.yaml +23 -0
  11. data/data/config/_id_items.yaml +24 -0
  12. data/data/config/_id_params.yaml +58 -0
  13. data/data/config/_interfaces.yaml +214 -0
  14. data/data/config/_interfaces.yaml.err +1017 -0
  15. data/data/config/_items.yaml +20 -0
  16. data/data/config/_params.yaml +60 -0
  17. data/data/config/cmd_tlm_server.yaml +136 -0
  18. data/data/config/command.yaml +44 -0
  19. data/data/config/command_modifiers.yaml +160 -0
  20. data/data/config/command_telemetry.yaml +3 -0
  21. data/data/config/interface_modifiers.yaml +104 -0
  22. data/data/config/item_modifiers.yaml +221 -0
  23. data/data/config/microservice.yaml +78 -0
  24. data/data/config/param_item_modifiers.yaml +52 -0
  25. data/data/config/parameter_modifiers.yaml +200 -0
  26. data/data/config/plugins.yaml +80 -0
  27. data/data/config/protocols.yaml +290 -0
  28. data/data/config/screen.yaml +147 -0
  29. data/data/config/table_manager.yaml +89 -0
  30. data/data/config/table_parameter_modifiers.yaml +9 -0
  31. data/data/config/target.yaml +142 -0
  32. data/data/config/target_config.yaml +94 -0
  33. data/data/config/telemetry.yaml +87 -0
  34. data/data/config/telemetry_modifiers.yaml +159 -0
  35. data/data/config/tool.yaml +63 -0
  36. data/data/config/unknown.yaml +3 -0
  37. data/data/config/widgets.yaml +1505 -0
  38. data/ext/mkrf_conf.rb +49 -0
  39. data/ext/openc3/ext/array/array.c +122 -0
  40. data/ext/openc3/ext/array/extconf.rb +13 -0
  41. data/ext/openc3/ext/buffered_file/buffered_file.c +198 -0
  42. data/ext/openc3/ext/buffered_file/extconf.rb +13 -0
  43. data/ext/openc3/ext/config_parser/config_parser.c +280 -0
  44. data/ext/openc3/ext/config_parser/extconf.rb +13 -0
  45. data/ext/openc3/ext/crc/crc.c +351 -0
  46. data/ext/openc3/ext/crc/extconf.rb +13 -0
  47. data/ext/openc3/ext/openc3_io/extconf.rb +13 -0
  48. data/ext/openc3/ext/openc3_io/openc3_io.c +158 -0
  49. data/ext/openc3/ext/packet/extconf.rb +13 -0
  50. data/ext/openc3/ext/packet/packet.c +318 -0
  51. data/ext/openc3/ext/platform/extconf.rb +13 -0
  52. data/ext/openc3/ext/platform/platform.c +134 -0
  53. data/ext/openc3/ext/polynomial_conversion/extconf.rb +13 -0
  54. data/ext/openc3/ext/polynomial_conversion/polynomial_conversion.c +79 -0
  55. data/ext/openc3/ext/string/extconf.rb +13 -0
  56. data/ext/openc3/ext/string/string.c +63 -0
  57. data/ext/openc3/ext/structure/structure.c +1719 -0
  58. data/ext/openc3/ext/tabbed_plots_config/extconf.rb +13 -0
  59. data/ext/openc3/ext/tabbed_plots_config/tabbed_plots_config.c +62 -0
  60. data/ext/openc3/ext/telemetry/extconf.rb +13 -0
  61. data/ext/openc3/ext/telemetry/telemetry.c +336 -0
  62. data/lib/cosmos.rb +20 -0
  63. data/lib/cosmosc2.rb +20 -0
  64. data/lib/openc3/api/api.rb +39 -0
  65. data/lib/openc3/api/authorized_api.rb +30 -0
  66. data/lib/openc3/api/cmd_api.rb +451 -0
  67. data/lib/openc3/api/config_api.rb +58 -0
  68. data/lib/openc3/api/interface_api.rb +117 -0
  69. data/lib/openc3/api/limits_api.rb +375 -0
  70. data/lib/openc3/api/router_api.rb +117 -0
  71. data/lib/openc3/api/settings_api.rb +70 -0
  72. data/lib/openc3/api/target_api.rb +78 -0
  73. data/lib/openc3/api/tlm_api.rb +455 -0
  74. data/lib/openc3/bridge/bridge.rb +54 -0
  75. data/lib/openc3/bridge/bridge_config.rb +167 -0
  76. data/lib/openc3/bridge/bridge_interface_thread.rb +42 -0
  77. data/lib/openc3/bridge/bridge_router_thread.rb +42 -0
  78. data/lib/openc3/ccsds/ccsds_packet.rb +68 -0
  79. data/lib/openc3/ccsds/ccsds_parser.rb +148 -0
  80. data/lib/openc3/config/config_parser.rb +549 -0
  81. data/lib/openc3/config/meta_config_parser.rb +74 -0
  82. data/lib/openc3/conversions/conversion.rb +70 -0
  83. data/lib/openc3/conversions/generic_conversion.rb +83 -0
  84. data/lib/openc3/conversions/packet_time_formatted_conversion.rb +43 -0
  85. data/lib/openc3/conversions/packet_time_seconds_conversion.rb +43 -0
  86. data/lib/openc3/conversions/polynomial_conversion.rb +87 -0
  87. data/lib/openc3/conversions/processor_conversion.rb +70 -0
  88. data/lib/openc3/conversions/received_count_conversion.rb +38 -0
  89. data/lib/openc3/conversions/received_time_formatted_conversion.rb +42 -0
  90. data/lib/openc3/conversions/received_time_seconds_conversion.rb +42 -0
  91. data/lib/openc3/conversions/segmented_polynomial_conversion.rb +171 -0
  92. data/lib/openc3/conversions/unix_time_conversion.rb +68 -0
  93. data/lib/openc3/conversions/unix_time_formatted_conversion.rb +49 -0
  94. data/lib/openc3/conversions/unix_time_seconds_conversion.rb +49 -0
  95. data/lib/openc3/conversions.rb +34 -0
  96. data/lib/openc3/core_ext/array.rb +416 -0
  97. data/lib/openc3/core_ext/binding.rb +29 -0
  98. data/lib/openc3/core_ext/class.rb +72 -0
  99. data/lib/openc3/core_ext/exception.rb +61 -0
  100. data/lib/openc3/core_ext/file.rb +83 -0
  101. data/lib/openc3/core_ext/hash.rb +37 -0
  102. data/lib/openc3/core_ext/io.rb +134 -0
  103. data/lib/openc3/core_ext/kernel.rb +42 -0
  104. data/lib/openc3/core_ext/math.rb +128 -0
  105. data/lib/openc3/core_ext/matrix.rb +156 -0
  106. data/lib/openc3/core_ext/objectspace.rb +36 -0
  107. data/lib/openc3/core_ext/openc3_io.rb +57 -0
  108. data/lib/openc3/core_ext/range.rb +27 -0
  109. data/lib/openc3/core_ext/socket.rb +38 -0
  110. data/lib/openc3/core_ext/string.rb +389 -0
  111. data/lib/openc3/core_ext/stringio.rb +33 -0
  112. data/lib/openc3/core_ext/time.rb +508 -0
  113. data/lib/openc3/core_ext.rb +36 -0
  114. data/lib/openc3/interfaces/interface.rb +498 -0
  115. data/lib/openc3/interfaces/linc_interface.rb +475 -0
  116. data/lib/openc3/interfaces/protocols/burst_protocol.rb +192 -0
  117. data/lib/openc3/interfaces/protocols/crc_protocol.rb +193 -0
  118. data/lib/openc3/interfaces/protocols/fixed_protocol.rb +155 -0
  119. data/lib/openc3/interfaces/protocols/ignore_packet_protocol.rb +56 -0
  120. data/lib/openc3/interfaces/protocols/length_protocol.rb +165 -0
  121. data/lib/openc3/interfaces/protocols/override_protocol.rb +60 -0
  122. data/lib/openc3/interfaces/protocols/preidentified_protocol.rb +206 -0
  123. data/lib/openc3/interfaces/protocols/protocol.rb +82 -0
  124. data/lib/openc3/interfaces/protocols/template_protocol.rb +261 -0
  125. data/lib/openc3/interfaces/protocols/terminated_protocol.rb +93 -0
  126. data/lib/openc3/interfaces/serial_interface.rb +94 -0
  127. data/lib/openc3/interfaces/simulated_target_interface.rb +168 -0
  128. data/lib/openc3/interfaces/stream_interface.rb +81 -0
  129. data/lib/openc3/interfaces/tcpip_client_interface.rb +69 -0
  130. data/lib/openc3/interfaces/tcpip_server_interface.rb +629 -0
  131. data/lib/openc3/interfaces/udp_interface.rb +169 -0
  132. data/lib/openc3/interfaces.rb +44 -0
  133. data/lib/openc3/io/buffered_file.rb +109 -0
  134. data/lib/openc3/io/io_multiplexer.rb +80 -0
  135. data/lib/openc3/io/json_api_object.rb +208 -0
  136. data/lib/openc3/io/json_drb.rb +335 -0
  137. data/lib/openc3/io/json_drb_object.rb +114 -0
  138. data/lib/openc3/io/json_drb_rack.rb +84 -0
  139. data/lib/openc3/io/json_rpc.rb +420 -0
  140. data/lib/openc3/io/openc3_snmp.rb +58 -0
  141. data/lib/openc3/io/posix_serial_driver.rb +156 -0
  142. data/lib/openc3/io/raw_logger.rb +167 -0
  143. data/lib/openc3/io/raw_logger_pair.rb +77 -0
  144. data/lib/openc3/io/serial_driver.rb +105 -0
  145. data/lib/openc3/io/stderr.rb +43 -0
  146. data/lib/openc3/io/stdout.rb +43 -0
  147. data/lib/openc3/io/udp_sockets.rb +194 -0
  148. data/lib/openc3/io/win32_serial_driver.rb +196 -0
  149. data/lib/openc3/logs/log_writer.rb +302 -0
  150. data/lib/openc3/logs/packet_log_constants.rb +62 -0
  151. data/lib/openc3/logs/packet_log_reader.rb +345 -0
  152. data/lib/openc3/logs/packet_log_writer.rb +299 -0
  153. data/lib/openc3/logs/text_log_writer.rb +68 -0
  154. data/lib/openc3/logs.rb +25 -0
  155. data/lib/openc3/microservices/cleanup_microservice.rb +68 -0
  156. data/lib/openc3/microservices/decom_microservice.rb +136 -0
  157. data/lib/openc3/microservices/interface_microservice.rb +532 -0
  158. data/lib/openc3/microservices/log_microservice.rb +108 -0
  159. data/lib/openc3/microservices/microservice.rb +204 -0
  160. data/lib/openc3/microservices/plugin_microservice.rb +43 -0
  161. data/lib/openc3/microservices/reaction_microservice.rb +541 -0
  162. data/lib/openc3/microservices/reducer_microservice.rb +313 -0
  163. data/lib/openc3/microservices/router_microservice.rb +44 -0
  164. data/lib/openc3/microservices/text_log_microservice.rb +84 -0
  165. data/lib/openc3/microservices/timeline_microservice.rb +363 -0
  166. data/lib/openc3/microservices/trigger_group_microservice.rb +638 -0
  167. data/lib/openc3/models/activity_model.rb +319 -0
  168. data/lib/openc3/models/auth_model.rb +65 -0
  169. data/lib/openc3/models/cvt_model.rb +185 -0
  170. data/lib/openc3/models/environment_model.rb +58 -0
  171. data/lib/openc3/models/gem_model.rb +137 -0
  172. data/lib/openc3/models/info_model.rb +31 -0
  173. data/lib/openc3/models/interface_model.rb +281 -0
  174. data/lib/openc3/models/interface_status_model.rb +117 -0
  175. data/lib/openc3/models/metadata_model.rb +139 -0
  176. data/lib/openc3/models/metric_model.rb +59 -0
  177. data/lib/openc3/models/microservice_model.rb +206 -0
  178. data/lib/openc3/models/microservice_status_model.rb +74 -0
  179. data/lib/openc3/models/model.rb +204 -0
  180. data/lib/openc3/models/note_model.rb +122 -0
  181. data/lib/openc3/models/notification_model.rb +40 -0
  182. data/lib/openc3/models/ping_model.rb +35 -0
  183. data/lib/openc3/models/plugin_model.rb +292 -0
  184. data/lib/openc3/models/process_status_model.rb +76 -0
  185. data/lib/openc3/models/reaction_model.rb +322 -0
  186. data/lib/openc3/models/reducer_model.rb +65 -0
  187. data/lib/openc3/models/router_model.rb +35 -0
  188. data/lib/openc3/models/router_status_model.rb +27 -0
  189. data/lib/openc3/models/scope_model.rb +153 -0
  190. data/lib/openc3/models/settings_model.rb +55 -0
  191. data/lib/openc3/models/sorted_model.rb +167 -0
  192. data/lib/openc3/models/target_model.rb +759 -0
  193. data/lib/openc3/models/timeline_model.rb +154 -0
  194. data/lib/openc3/models/tool_config_model.rb +38 -0
  195. data/lib/openc3/models/tool_model.rb +262 -0
  196. data/lib/openc3/models/trigger_group_model.rb +186 -0
  197. data/lib/openc3/models/trigger_model.rb +330 -0
  198. data/lib/openc3/models/widget_model.rb +138 -0
  199. data/lib/openc3/operators/microservice_operator.rb +128 -0
  200. data/lib/openc3/operators/operator.rb +277 -0
  201. data/lib/openc3/packets/binary_accessor.rb +1207 -0
  202. data/lib/openc3/packets/commands.rb +373 -0
  203. data/lib/openc3/packets/json_packet.rb +134 -0
  204. data/lib/openc3/packets/limits.rb +271 -0
  205. data/lib/openc3/packets/limits_response.rb +53 -0
  206. data/lib/openc3/packets/packet.rb +1168 -0
  207. data/lib/openc3/packets/packet_config.rb +625 -0
  208. data/lib/openc3/packets/packet_item.rb +586 -0
  209. data/lib/openc3/packets/packet_item_limits.rb +162 -0
  210. data/lib/openc3/packets/parsers/format_string_parser.rb +65 -0
  211. data/lib/openc3/packets/parsers/limits_parser.rb +159 -0
  212. data/lib/openc3/packets/parsers/limits_response_parser.rb +61 -0
  213. data/lib/openc3/packets/parsers/packet_item_parser.rb +272 -0
  214. data/lib/openc3/packets/parsers/packet_parser.rb +134 -0
  215. data/lib/openc3/packets/parsers/processor_parser.rb +73 -0
  216. data/lib/openc3/packets/parsers/state_parser.rb +127 -0
  217. data/lib/openc3/packets/parsers/xtce_converter.rb +442 -0
  218. data/lib/openc3/packets/parsers/xtce_parser.rb +722 -0
  219. data/lib/openc3/packets/structure.rb +553 -0
  220. data/lib/openc3/packets/structure_item.rb +365 -0
  221. data/lib/openc3/packets/telemetry.rb +487 -0
  222. data/lib/openc3/processors/processor.rb +86 -0
  223. data/lib/openc3/processors/statistics_processor.rb +82 -0
  224. data/lib/openc3/processors/watermark_processor.rb +58 -0
  225. data/lib/openc3/processors.rb +24 -0
  226. data/lib/openc3/script/api_shared.rb +828 -0
  227. data/lib/openc3/script/calendar.rb +89 -0
  228. data/lib/openc3/script/commands.rb +227 -0
  229. data/lib/openc3/script/exceptions.rb +29 -0
  230. data/lib/openc3/script/extract.rb +161 -0
  231. data/lib/openc3/script/limits.rb +60 -0
  232. data/lib/openc3/script/script.rb +299 -0
  233. data/lib/openc3/script/script_runner.rb +238 -0
  234. data/lib/openc3/script/storage.rb +146 -0
  235. data/lib/openc3/script/suite.rb +542 -0
  236. data/lib/openc3/script/suite_results.rb +196 -0
  237. data/lib/openc3/script/suite_runner.rb +217 -0
  238. data/lib/openc3/script.rb +21 -0
  239. data/lib/openc3/streams/serial_stream.rb +167 -0
  240. data/lib/openc3/streams/stream.rb +63 -0
  241. data/lib/openc3/streams/tcpip_client_stream.rb +116 -0
  242. data/lib/openc3/streams/tcpip_socket_stream.rb +195 -0
  243. data/lib/openc3/system/system.rb +127 -0
  244. data/lib/openc3/system/system_config.rb +411 -0
  245. data/lib/openc3/system/target.rb +269 -0
  246. data/lib/openc3/system.rb +24 -0
  247. data/lib/openc3/tools/cmd_tlm_server/api.rb +20 -0
  248. data/lib/openc3/tools/cmd_tlm_server/cmd_tlm_server_config.rb +320 -0
  249. data/lib/openc3/tools/cmd_tlm_server/interface_thread.rb +294 -0
  250. data/lib/openc3/tools/table_manager/table.rb +77 -0
  251. data/lib/openc3/tools/table_manager/table_config.rb +273 -0
  252. data/lib/openc3/tools/table_manager/table_item.rb +90 -0
  253. data/lib/openc3/tools/table_manager/table_item_parser.rb +66 -0
  254. data/lib/openc3/tools/table_manager/table_manager_core.rb +333 -0
  255. data/lib/openc3/tools/table_manager/table_parser.rb +93 -0
  256. data/lib/openc3/tools/test_runner/test.rb +67 -0
  257. data/lib/openc3/top_level.rb +595 -0
  258. data/lib/openc3/topics/autonomic_topic.rb +52 -0
  259. data/lib/openc3/topics/calendar_topic.rb +44 -0
  260. data/lib/openc3/topics/command_decom_topic.rb +76 -0
  261. data/lib/openc3/topics/command_topic.rb +83 -0
  262. data/lib/openc3/topics/config_topic.rb +68 -0
  263. data/lib/openc3/topics/interface_topic.rb +73 -0
  264. data/lib/openc3/topics/limits_event_topic.rb +109 -0
  265. data/lib/openc3/topics/notifications_topic.rb +28 -0
  266. data/lib/openc3/topics/router_topic.rb +85 -0
  267. data/lib/openc3/topics/telemetry_decom_topic.rb +54 -0
  268. data/lib/openc3/topics/telemetry_topic.rb +36 -0
  269. data/lib/openc3/topics/timeline_topic.rb +45 -0
  270. data/lib/openc3/topics/topic.rb +53 -0
  271. data/lib/openc3/utilities/authentication.rb +141 -0
  272. data/lib/openc3/utilities/authorization.rb +51 -0
  273. data/lib/openc3/utilities/crc.rb +278 -0
  274. data/lib/openc3/utilities/csv.rb +153 -0
  275. data/lib/openc3/utilities/logger.rb +187 -0
  276. data/lib/openc3/utilities/message_log.rb +91 -0
  277. data/lib/openc3/utilities/metric.rb +141 -0
  278. data/lib/openc3/utilities/process_manager.rb +139 -0
  279. data/lib/openc3/utilities/quaternion.rb +257 -0
  280. data/lib/openc3/utilities/ruby_lex_utils.rb +568 -0
  281. data/lib/openc3/utilities/s3.rb +202 -0
  282. data/lib/openc3/utilities/s3_autoload.rb +9 -0
  283. data/lib/openc3/utilities/s3_file_cache.rb +274 -0
  284. data/lib/openc3/utilities/simulated_target.rb +117 -0
  285. data/lib/openc3/utilities/sleeper.rb +51 -0
  286. data/lib/openc3/utilities/store.rb +23 -0
  287. data/lib/openc3/utilities/store_autoload.rb +237 -0
  288. data/lib/openc3/utilities/zip.rb +21 -0
  289. data/lib/openc3/utilities.rb +35 -0
  290. data/lib/openc3/version.rb +14 -0
  291. data/lib/openc3/win32/excel.rb +132 -0
  292. data/lib/openc3/win32/win32.rb +402 -0
  293. data/lib/openc3/win32/win32_main.rb +333 -0
  294. data/lib/openc3.rb +49 -0
  295. data/tasks/gemfile_stats.rake +113 -0
  296. data/tasks/spec.rake +30 -0
  297. data/templates/plugin-template/README.md +15 -0
  298. data/templates/plugin-template/Rakefile +12 -0
  299. data/templates/plugin-template/plugin.gemspec +23 -0
  300. data/templates/plugin-template/plugin.txt +9 -0
  301. data/templates/plugin-template/targets/TARGET/cmd_tlm/cmd.txt +8 -0
  302. data/templates/plugin-template/targets/TARGET/cmd_tlm/tlm.txt +8 -0
  303. data/templates/plugin-template/targets/TARGET/lib/target.rb +10 -0
  304. data/templates/plugin-template/targets/TARGET/procedures/procedure.rb +3 -0
  305. data/templates/plugin-template/targets/TARGET/screens/status.txt +9 -0
  306. data/templates/plugin-template/targets/TARGET/target.txt +5 -0
  307. metadata +849 -0
@@ -0,0 +1,451 @@
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2022 Ball Aerospace & Technologies Corp.
4
+ # All Rights Reserved.
5
+ #
6
+ # This program is free software; you can modify and/or redistribute it
7
+ # under the terms of the GNU Affero General Public License
8
+ # as published by the Free Software Foundation; version 3 with
9
+ # attribution addendums as found in the LICENSE.txt
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Affero General Public License for more details.
15
+
16
+ # Modified by OpenC3, Inc.
17
+ # All changes Copyright 2022, OpenC3, Inc.
18
+ # All Rights Reserved
19
+
20
+ require 'openc3/models/target_model'
21
+ require 'openc3/topics/command_topic'
22
+ require 'openc3/topics/interface_topic'
23
+
24
+ module OpenC3
25
+ module Api
26
+ WHITELIST ||= []
27
+ WHITELIST.concat([
28
+ 'cmd',
29
+ 'cmd_no_range_check',
30
+ 'cmd_no_hazardous_check',
31
+ 'cmd_no_checks',
32
+ 'cmd_raw',
33
+ 'cmd_raw_no_range_check',
34
+ 'cmd_raw_no_hazardous_check',
35
+ 'cmd_raw_no_checks',
36
+ 'send_raw',
37
+ 'get_all_commands',
38
+ 'get_all_command_names',
39
+ 'get_command',
40
+ 'get_parameter',
41
+ 'get_cmd_buffer',
42
+ 'get_cmd_hazardous',
43
+ 'get_cmd_value',
44
+ 'get_cmd_time',
45
+ 'get_cmd_cnt',
46
+ 'get_cmd_cnts',
47
+ ])
48
+
49
+ # Send a command packet to a target.
50
+ #
51
+ # Accepts two different calling styles:
52
+ # cmd("TGT CMD with PARAM1 val, PARAM2 val")
53
+ # cmd('TGT','CMD','PARAM1'=>val,'PARAM2'=>val)
54
+ #
55
+ # Favor the first syntax where possible as it is more succinct.
56
+ #
57
+ # @param args [String|Array<String>] See the description for calling style
58
+ # @return [Array<String, String, Hash>] target_name, command_name, parameters
59
+ def cmd(*args, scope: $openc3_scope, token: $openc3_token, **kwargs)
60
+ args << kwargs unless kwargs.empty?
61
+ cmd_implementation(true, true, false, 'cmd', *args, scope: scope, token: token)
62
+ end
63
+
64
+ # Send a command packet to a target without performing any value range
65
+ # checks on the parameters. Useful for testing to allow sending command
66
+ # parameters outside the allowable range as defined in the configuration.
67
+ #
68
+ # Accepts two different calling styles:
69
+ # cmd_no_range_check("TGT CMD with PARAM1 val, PARAM2 val")
70
+ # cmd_no_range_check('TGT','CMD','PARAM1'=>val,'PARAM2'=>val)
71
+ #
72
+ # Favor the first syntax where possible as it is more succinct.
73
+ #
74
+ # @param (see #cmd)
75
+ # @return (see #cmd)
76
+ def cmd_no_range_check(*args, scope: $openc3_scope, token: $openc3_token, **kwargs)
77
+ args << kwargs unless kwargs.empty?
78
+ cmd_implementation(false, true, false, 'cmd_no_range_check', *args, scope: scope, token: token)
79
+ end
80
+
81
+ # Send a command packet to a target without performing any hazardous checks
82
+ # both on the command itself and its parameters. Useful in scripts to
83
+ # prevent popping up warnings to the user.
84
+ #
85
+ # Accepts two different calling styles:
86
+ # cmd_no_hazardous_check("TGT CMD with PARAM1 val, PARAM2 val")
87
+ # cmd_no_hazardous_check('TGT','CMD','PARAM1'=>val,'PARAM2'=>val)
88
+ #
89
+ # Favor the first syntax where possible as it is more succinct.
90
+ #
91
+ # @param (see #cmd)
92
+ # @return (see #cmd)
93
+ def cmd_no_hazardous_check(*args, scope: $openc3_scope, token: $openc3_token, **kwargs)
94
+ args << kwargs unless kwargs.empty?
95
+ cmd_implementation(true, false, false, 'cmd_no_hazardous_check', *args, scope: scope, token: token)
96
+ end
97
+
98
+ # Send a command packet to a target without performing any value range
99
+ # checks or hazardous checks both on the command itself and its parameters.
100
+ #
101
+ # Accepts two different calling styles:
102
+ # cmd_no_checks("TGT CMD with PARAM1 val, PARAM2 val")
103
+ # cmd_no_checks('TGT','CMD','PARAM1'=>val,'PARAM2'=>val)
104
+ #
105
+ # Favor the first syntax where possible as it is more succinct.
106
+ #
107
+ # @param (see #cmd)
108
+ # @return (see #cmd)
109
+ def cmd_no_checks(*args, scope: $openc3_scope, token: $openc3_token, **kwargs)
110
+ args << kwargs unless kwargs.empty?
111
+ cmd_implementation(false, false, false, 'cmd_no_checks', *args, scope: scope, token: token)
112
+ end
113
+
114
+ # Send a command packet to a target without running conversions.
115
+ #
116
+ # Accepts two different calling styles:
117
+ # cmd_raw("TGT CMD with PARAM1 val, PARAM2 val")
118
+ # cmd_raw('TGT','CMD','PARAM1'=>val,'PARAM2'=>val)
119
+ #
120
+ # Favor the first syntax where possible as it is more succinct.
121
+ #
122
+ # @param args [String|Array<String>] See the description for calling style
123
+ # @return [Array<String, String, Hash>] target_name, command_name, parameters
124
+ def cmd_raw(*args, scope: $openc3_scope, token: $openc3_token, **kwargs)
125
+ args << kwargs unless kwargs.empty?
126
+ cmd_implementation(true, true, true, 'cmd_raw', *args, scope: scope, token: token)
127
+ end
128
+
129
+ # Send a command packet to a target without performing any value range
130
+ # checks on the parameters or running conversions. Useful for testing to allow sending command
131
+ # parameters outside the allowable range as defined in the configuration.
132
+ #
133
+ # Accepts two different calling styles:
134
+ # cmd_raw_no_range_check("TGT CMD with PARAM1 val, PARAM2 val")
135
+ # cmd_raw_no_range_check('TGT','CMD','PARAM1'=>val,'PARAM2'=>val)
136
+ #
137
+ # Favor the first syntax where possible as it is more succinct.
138
+ #
139
+ # @param (see #cmd)
140
+ # @return (see #cmd)
141
+ def cmd_raw_no_range_check(*args, scope: $openc3_scope, token: $openc3_token, **kwargs)
142
+ args << kwargs unless kwargs.empty?
143
+ cmd_implementation(false, true, true, 'cmd_raw_no_range_check', *args, scope: scope, token: token)
144
+ end
145
+
146
+ # Send a command packet to a target without running conversions or performing any hazardous checks
147
+ # both on the command itself and its parameters. Useful in scripts to
148
+ # prevent popping up warnings to the user.
149
+ #
150
+ # Accepts two different calling styles:
151
+ # cmd_raw_no_hazardous_check("TGT CMD with PARAM1 val, PARAM2 val")
152
+ # cmd_raw_no_hazardous_check('TGT','CMD','PARAM1'=>val,'PARAM2'=>val)
153
+ #
154
+ # Favor the first syntax where possible as it is more succinct.
155
+ #
156
+ # @param (see #cmd)
157
+ # @return (see #cmd)
158
+ def cmd_raw_no_hazardous_check(*args, scope: $openc3_scope, token: $openc3_token, **kwargs)
159
+ args << kwargs unless kwargs.empty?
160
+ cmd_implementation(true, false, true, 'cmd_raw_no_hazardous_check', *args, scope: scope, token: token)
161
+ end
162
+
163
+ # Send a command packet to a target without running conversions or performing any value range
164
+ # checks or hazardous checks both on the command itself and its parameters.
165
+ #
166
+ # Accepts two different calling styles:
167
+ # cmd_raw_no_checks("TGT CMD with PARAM1 val, PARAM2 val")
168
+ # cmd_raw_no_checks('TGT','CMD','PARAM1'=>val,'PARAM2'=>val)
169
+ #
170
+ # Favor the first syntax where possible as it is more succinct.
171
+ #
172
+ # @param (see #cmd)
173
+ # @return (see #cmd)
174
+ def cmd_raw_no_checks(*args, scope: $openc3_scope, token: $openc3_token, **kwargs)
175
+ args << kwargs unless kwargs.empty?
176
+ cmd_implementation(false, false, true, 'cmd_raw_no_checks', *args, scope: scope, token: token)
177
+ end
178
+
179
+ # Send a raw binary string to the specified interface.
180
+ #
181
+ # @param interface_name [String] The interface to send the raw binary
182
+ # @param data [String] The raw binary data
183
+ def send_raw(interface_name, data, scope: $openc3_scope, token: $openc3_token)
184
+ authorize(permission: 'cmd_raw', interface_name: interface_name, scope: scope, token: token)
185
+ get_interface(interface_name, scope: scope, token: token) # Check to make sure the interface exists
186
+ InterfaceTopic.write_raw(interface_name, data, scope: scope)
187
+ end
188
+
189
+ # Returns the raw buffer from the most recent specified command packet.
190
+ #
191
+ # @param target_name [String] Target name of the command
192
+ # @param command_name [String] Packet name of the command
193
+ # @return [Hash] command hash with last command buffer
194
+ def get_cmd_buffer(target_name, command_name, scope: $openc3_scope, token: $openc3_token)
195
+ authorize(permission: 'cmd_info', target_name: target_name, packet_name: command_name, scope: scope, token: token)
196
+ TargetModel.packet(target_name, command_name, type: :CMD, scope: scope)
197
+ topic = "#{scope}__COMMAND__{#{target_name}}__#{command_name}"
198
+ msg_id, msg_hash = Topic.get_newest_message(topic)
199
+ if msg_id
200
+ msg_hash['buffer'] = msg_hash['buffer'].b
201
+ return msg_hash
202
+ end
203
+ return nil
204
+ end
205
+
206
+ # Returns an array of all the commands as a hash
207
+ #
208
+ # @since 5.0.0
209
+ # @param target_name [String] Name of the target
210
+ # @return [Array<Hash>] Array of all commands as a hash
211
+ def get_all_commands(target_name, scope: $openc3_scope, token: $openc3_token)
212
+ authorize(permission: 'cmd_info', target_name: target_name, scope: scope, token: token)
213
+ TargetModel.packets(target_name, type: :CMD, scope: scope)
214
+ end
215
+
216
+ # Returns an array of all the command packet names
217
+ #
218
+ # @since 5.0.6
219
+ # @param target_name [String] Name of the target
220
+ # @return [Array<String>] Array of all command packet names
221
+ def get_all_command_names(target_name, scope: $openc3_scope, token: $openc3_token)
222
+ authorize(permission: 'cmd_info', target_name: target_name, scope: scope, token: token)
223
+ TargetModel.packet_names(target_name, type: :CMD, scope: scope)
224
+ end
225
+
226
+ # Returns a hash of the given command
227
+ #
228
+ # @since 5.0.0
229
+ # @param target_name [String] Name of the target
230
+ # @param packet_name [String] Name of the packet
231
+ # @return [Hash] Command as a hash
232
+ def get_command(target_name, packet_name, scope: $openc3_scope, token: $openc3_token)
233
+ authorize(permission: 'cmd_info', target_name: target_name, scope: scope, token: token)
234
+ TargetModel.packet(target_name, packet_name, type: :CMD, scope: scope)
235
+ end
236
+
237
+ # Returns a hash of the given command parameter
238
+ #
239
+ # @since 5.0.0
240
+ # @param target_name [String] Name of the target
241
+ # @param packet_name [String] Name of the packet
242
+ # @param param_name [String] Name of the parameter
243
+ # @return [Hash] Command parameter as a hash
244
+ def get_parameter(target_name, packet_name, param_name, scope: $openc3_scope, token: $openc3_token)
245
+ authorize(permission: 'cmd_info', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
246
+ TargetModel.packet_item(target_name, packet_name, param_name, type: :CMD, scope: scope)
247
+ end
248
+
249
+ # Returns whether the specified command is hazardous
250
+ #
251
+ # Accepts two different calling styles:
252
+ # get_cmd_hazardous("TGT CMD with PARAM1 val, PARAM2 val")
253
+ # get_cmd_hazardous('TGT','CMD',{'PARAM1'=>val,'PARAM2'=>val})
254
+ #
255
+ # @param args [String|Array<String>] See the description for calling style
256
+ # @return [Boolean] Whether the command is hazardous
257
+ def get_cmd_hazardous(*args, scope: $openc3_scope, token: $openc3_token, **kwargs)
258
+ args << kwargs unless kwargs.empty?
259
+ case args.length
260
+ when 1
261
+ target_name, command_name, params = extract_fields_from_cmd_text(args[0], scope: scope)
262
+ when 2, 3
263
+ target_name = args[0]
264
+ command_name = args[1]
265
+ if args.length == 2
266
+ params = {}
267
+ else
268
+ params = args[2]
269
+ end
270
+ else
271
+ # Invalid number of arguments
272
+ raise "ERROR: Invalid number of arguments (#{args.length}) passed to get_cmd_hazardous()"
273
+ end
274
+
275
+ authorize(permission: 'cmd_info', target_name: target_name, packet_name: command_name, scope: scope, token: token)
276
+ packet = TargetModel.packet(target_name, command_name, type: :CMD, scope: scope)
277
+ return true if packet['hazardous']
278
+
279
+ packet['items'].each do |item|
280
+ next unless params.keys.include?(item['name']) && item['states']
281
+
282
+ # States are an array of the name followed by a hash of 'value' and sometimes 'hazardous'
283
+ item['states'].each do |name, hash|
284
+ # To be hazardous the state must be marked hazardous
285
+ # Check if either the state name or value matches the param passed
286
+ if hash['hazardous'] && (name == params[item['name']] || hash['value'].to_f == params[item['name']].to_f)
287
+ return true
288
+ end
289
+ end
290
+ end
291
+
292
+ false
293
+ end
294
+
295
+ # Returns a value from the specified command
296
+ #
297
+ # @param target_name [String] Target name of the command
298
+ # @param command_name [String] Packet name of the command
299
+ # @param parameter_name [String] Parameter name in the command
300
+ # @param value_type [Symbol] How the values should be converted. Must be
301
+ # one of {Packet::VALUE_TYPES}
302
+ # @return [Varies] value
303
+ def get_cmd_value(target_name, command_name, parameter_name, value_type = :CONVERTED, scope: $openc3_scope, token: $openc3_token)
304
+ authorize(permission: 'cmd_info', target_name: target_name, packet_name: command_name, scope: scope, token: token)
305
+ CommandDecomTopic.get_cmd_item(target_name, command_name, parameter_name, type: value_type, scope: scope)
306
+ end
307
+
308
+ # Returns the time the most recent command was sent
309
+ #
310
+ # @param target_name [String] Target name of the command. If not given then
311
+ # the most recent time from all commands will be returned
312
+ # @param command_name [String] Packet name of the command. If not given then
313
+ # then most recent time from the given target will be returned.
314
+ # @return [Array<Target Name, Command Name, Time Seconds, Time Microseconds>]
315
+ def get_cmd_time(target_name = nil, command_name = nil, scope: $openc3_scope, token: $openc3_token)
316
+ authorize(permission: 'cmd_info', target_name: target_name, packet_name: command_name, scope: scope, token: token)
317
+ if target_name and command_name
318
+ time = CommandDecomTopic.get_cmd_item(target_name, command_name, 'RECEIVED_TIMESECONDS', type: :CONVERTED, scope: scope)
319
+ [target_name, command_name, time.to_i, ((time.to_f - time.to_i) * 1_000_000).to_i]
320
+ else
321
+ if target_name.nil?
322
+ targets = TargetModel.names(scope: scope)
323
+ else
324
+ targets = [target_name]
325
+ end
326
+ targets.each do |target_name|
327
+ time = 0
328
+ command_name = nil
329
+ TargetModel.packets(target_name, type: :CMD, scope: scope).each do |packet|
330
+ cur_time = CommandDecomTopic.get_cmd_item(target_name, packet["packet_name"], 'RECEIVED_TIMESECONDS', type: :CONVERTED, scope: scope)
331
+ next unless cur_time
332
+
333
+ if cur_time > time
334
+ time = cur_time
335
+ command_name = packet["packet_name"]
336
+ end
337
+ end
338
+ target_name = nil unless command_name
339
+ return [target_name, command_name, time.to_i, ((time.to_f - time.to_i) * 1_000_000).to_i]
340
+ end
341
+ end
342
+ end
343
+
344
+ # Get the transmit count for a command packet
345
+ #
346
+ # @param target_name [String] Target name of the command
347
+ # @param command_name [String] Packet name of the command
348
+ # @return [Numeric] Transmit count for the command
349
+ def get_cmd_cnt(target_name, command_name, scope: $openc3_scope, token: $openc3_token)
350
+ authorize(permission: 'system', target_name: target_name, packet_name: command_name, scope: scope, token: token)
351
+ TargetModel.packet(target_name, command_name, type: :CMD, scope: scope)
352
+ Topic.get_cnt("#{scope}__COMMAND__{#{target_name}}__#{command_name}")
353
+ end
354
+
355
+ # Get the transmit counts for command packets
356
+ #
357
+ # @param target_commands [Array<Array<String, String>>] Array of arrays containing target_name, packet_name
358
+ # @return [Numeric] Transmit count for the command
359
+ def get_cmd_cnts(target_commands, scope: $openc3_scope, token: $openc3_token)
360
+ authorize(permission: 'system', scope: scope, token: token)
361
+ counts = []
362
+ target_commands.each do |target_name, command_name|
363
+ counts << Topic.get_cnt("#{scope}__COMMAND__{#{target_name}}__#{command_name}")
364
+ end
365
+ counts
366
+ end
367
+
368
+ ###########################################################################
369
+ # PRIVATE implementation details
370
+ ###########################################################################
371
+
372
+ def cmd_implementation(range_check, hazardous_check, raw, method_name, *args, scope:, token:)
373
+ case args.length
374
+ when 1
375
+ target_name, cmd_name, cmd_params = extract_fields_from_cmd_text(args[0], scope: scope)
376
+ when 2, 3
377
+ target_name = args[0]
378
+ cmd_name = args[1]
379
+ if args.length == 2
380
+ cmd_params = {}
381
+ else
382
+ cmd_params = args[2]
383
+ end
384
+ else
385
+ # Invalid number of arguments
386
+ raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{method_name}()"
387
+ end
388
+ authorize(permission: 'cmd', target_name: target_name, packet_name: cmd_name, scope: scope, token: token)
389
+ packet = TargetModel.packet(target_name, cmd_name, type: :CMD, scope: scope)
390
+
391
+ command = {
392
+ 'target_name' => target_name,
393
+ 'cmd_name' => cmd_name,
394
+ 'cmd_params' => cmd_params,
395
+ 'range_check' => range_check,
396
+ 'hazardous_check' => hazardous_check,
397
+ 'raw' => raw
398
+ }
399
+ Logger.info build_cmd_output_string(target_name, cmd_name, cmd_params, packet, raw) if !packet["messages_disabled"]
400
+ CommandTopic.send_command(command, scope: scope)
401
+ end
402
+
403
+ def build_cmd_output_string(target_name, cmd_name, cmd_params, packet, raw)
404
+ if raw
405
+ output_string = 'cmd_raw("'
406
+ else
407
+ output_string = 'cmd("'
408
+ end
409
+ output_string << target_name + ' ' + cmd_name
410
+ if cmd_params.nil? or cmd_params.empty?
411
+ output_string << '")'
412
+ else
413
+ params = []
414
+ cmd_params.each do |key, value|
415
+ next if Packet::RESERVED_ITEM_NAMES.include?(key)
416
+
417
+ item = packet['items'].find { |item| item['name'] == key.to_s }
418
+
419
+ begin
420
+ item_type = item['data_type'].intern
421
+ rescue
422
+ item_type = nil
423
+ end
424
+
425
+ if value.is_a?(String)
426
+ value = value.dup
427
+ if item_type == :BLOCK or item_type == :STRING
428
+ if !value.is_printable?
429
+ value = "0x" + value.simple_formatted
430
+ else
431
+ value = value.inspect
432
+ end
433
+ else
434
+ value = value.convert_to_value.to_s
435
+ end
436
+ if value.length > 256
437
+ value = value[0..255] + "...'"
438
+ end
439
+ value.tr!('"', "'")
440
+ elsif value.is_a?(Array)
441
+ value = "[#{value.join(", ")}]"
442
+ end
443
+ params << "#{key} #{value}"
444
+ end
445
+ params = params.join(", ")
446
+ output_string << ' with ' + params + '")'
447
+ end
448
+ return output_string
449
+ end
450
+ end
451
+ end
@@ -0,0 +1,58 @@
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2022 Ball Aerospace & Technologies Corp.
4
+ # All Rights Reserved.
5
+ #
6
+ # This program is free software; you can modify and/or redistribute it
7
+ # under the terms of the GNU Affero General Public License
8
+ # as published by the Free Software Foundation; version 3 with
9
+ # attribution addendums as found in the LICENSE.txt
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Affero General Public License for more details.
15
+
16
+ # Modified by OpenC3, Inc.
17
+ # All changes Copyright 2022, OpenC3, Inc.
18
+ # All Rights Reserved
19
+
20
+ require 'openc3/models/tool_config_model'
21
+
22
+ module OpenC3
23
+ module Api
24
+ WHITELIST ||= []
25
+ WHITELIST.concat([
26
+ 'get_saved_config',
27
+ 'list_configs',
28
+ 'load_config',
29
+ 'save_config',
30
+ 'delete_config'
31
+ ])
32
+
33
+ # Get a saved configuration zip file
34
+ def get_saved_config(configuration_name = nil, scope: $openc3_scope, token: $openc3_token)
35
+ raise "Not supported by OpenC3 5"
36
+ end
37
+
38
+ def list_configs(tool, scope: $openc3_scope, token: $openc3_token)
39
+ authorize(permission: 'system', scope: scope, token: token)
40
+ ToolConfigModel.list_configs(tool, scope: scope)
41
+ end
42
+
43
+ def load_config(tool, name, scope: $openc3_scope, token: $openc3_token)
44
+ authorize(permission: 'system', scope: scope, token: token)
45
+ ToolConfigModel.load_config(tool, name, scope: scope)
46
+ end
47
+
48
+ def save_config(tool, name, data, scope: $openc3_scope, token: $openc3_token)
49
+ authorize(permission: 'system_set', scope: scope, token: token)
50
+ ToolConfigModel.save_config(tool, name, data, scope: scope)
51
+ end
52
+
53
+ def delete_config(tool, name, scope: $openc3_scope, token: $openc3_token)
54
+ authorize(permission: 'system_set', scope: scope, token: token)
55
+ ToolConfigModel.delete_config(tool, name, scope: scope)
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,117 @@
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2022 Ball Aerospace & Technologies Corp.
4
+ # All Rights Reserved.
5
+ #
6
+ # This program is free software; you can modify and/or redistribute it
7
+ # under the terms of the GNU Affero General Public License
8
+ # as published by the Free Software Foundation; version 3 with
9
+ # attribution addendums as found in the LICENSE.txt
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Affero General Public License for more details.
15
+
16
+ # Modified by OpenC3, Inc.
17
+ # All changes Copyright 2022, OpenC3, Inc.
18
+ # All Rights Reserved
19
+
20
+ require 'openc3/models/interface_model'
21
+ require 'openc3/models/interface_status_model'
22
+ require 'openc3/topics/interface_topic'
23
+
24
+ module OpenC3
25
+ module Api
26
+ WHITELIST ||= []
27
+ WHITELIST.concat([
28
+ 'get_interface',
29
+ 'get_interface_names',
30
+ 'connect_interface',
31
+ 'disconnect_interface',
32
+ 'start_raw_logging_interface',
33
+ 'stop_raw_logging_interface',
34
+ 'get_all_interface_info',
35
+ ])
36
+
37
+ # Get information about an interface
38
+ #
39
+ # @since 5.0.0
40
+ # @param interface_name [String] Interface name
41
+ # @return [Hash] Hash of all the interface information
42
+ def get_interface(interface_name, scope: $openc3_scope, token: $openc3_token)
43
+ authorize(permission: 'system', interface_name: interface_name, scope: scope, token: token)
44
+ interface = InterfaceModel.get(name: interface_name, scope: scope)
45
+ raise "Interface '#{interface_name}' does not exist" unless interface
46
+
47
+ interface.merge(InterfaceStatusModel.get(name: interface_name, scope: scope))
48
+ end
49
+
50
+ # @return [Array<String>] All the interface names
51
+ def get_interface_names(scope: $openc3_scope, token: $openc3_token)
52
+ authorize(permission: 'system', scope: scope, token: token)
53
+ InterfaceModel.names(scope: scope)
54
+ end
55
+
56
+ # Connects an interface and starts its telemetry gathering thread
57
+ #
58
+ # @param interface_name [String] The name of the interface
59
+ def connect_interface(interface_name, scope: $openc3_scope, token: $openc3_token)
60
+ authorize(permission: 'system_set', interface_name: interface_name, scope: scope, token: token)
61
+ InterfaceTopic.connect_interface(interface_name, scope: scope)
62
+ end
63
+
64
+ # Disconnects from an interface and kills its telemetry gathering thread
65
+ #
66
+ # @param interface_name [String] The name of the interface
67
+ def disconnect_interface(interface_name, scope: $openc3_scope, token: $openc3_token)
68
+ authorize(permission: 'system_set', interface_name: interface_name, scope: scope, token: token)
69
+ InterfaceTopic.disconnect_interface(interface_name, scope: scope)
70
+ end
71
+
72
+ # Starts raw logging for an interface
73
+ #
74
+ # @param interface_name [String] The name of the interface
75
+ def start_raw_logging_interface(interface_name = 'ALL', scope: $openc3_scope, token: $openc3_token)
76
+ authorize(permission: 'system_set', interface_name: interface_name, scope: scope, token: token)
77
+ if interface_name == 'ALL'
78
+ get_interface_names().each do |interface_name|
79
+ InterfaceTopic.start_raw_logging(interface_name, scope: scope)
80
+ end
81
+ else
82
+ InterfaceTopic.start_raw_logging(interface_name, scope: scope)
83
+ end
84
+ end
85
+
86
+ # Stop raw logging for an interface
87
+ #
88
+ # @param interface_name [String] The name of the interface
89
+ def stop_raw_logging_interface(interface_name = 'ALL', scope: $openc3_scope, token: $openc3_token)
90
+ authorize(permission: 'system_set', interface_name: interface_name, scope: scope, token: token)
91
+ if interface_name == 'ALL'
92
+ get_interface_names().each do |interface_name|
93
+ InterfaceTopic.stop_raw_logging(interface_name, scope: scope)
94
+ end
95
+ else
96
+ InterfaceTopic.stop_raw_logging(interface_name, scope: scope)
97
+ end
98
+ end
99
+
100
+ # Get information about all interfaces
101
+ #
102
+ # @return [Array<Array<String, Numeric, Numeric, Numeric, Numeric, Numeric,
103
+ # Numeric, Numeric>>] Array of Arrays containing \[name, state, num clients,
104
+ # TX queue size, RX queue size, TX bytes, RX bytes, Command count,
105
+ # Telemetry count] for all interfaces
106
+ def get_all_interface_info(scope: $openc3_scope, token: $openc3_token)
107
+ authorize(permission: 'system', scope: scope, token: token)
108
+ info = []
109
+ InterfaceStatusModel.all(scope: scope).each do |int_name, int|
110
+ info << [int['name'], int['state'], int['clients'], int['txsize'], int['rxsize'],
111
+ int['txbytes'], int['rxbytes'], int['txcnt'], int['rxcnt']]
112
+ end
113
+ info.sort! { |a, b| a[0] <=> b[0] }
114
+ info
115
+ end
116
+ end
117
+ end