openc3 5.0.11 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of openc3 might be problematic. Click here for more details.

Files changed (280) hide show
  1. checksums.yaml +4 -4
  2. data/Guardfile +3 -0
  3. data/LICENSE.txt +7 -5
  4. data/README.md +11 -9
  5. data/Rakefile +3 -0
  6. data/bin/cstol_converter +3 -0
  7. data/bin/openc3cli +29 -18
  8. data/bin/rubysloc +3 -0
  9. data/data/config/screen.yaml +10 -2
  10. data/data/config/target.yaml +1 -1
  11. data/data/config/widgets.yaml +6 -6
  12. data/ext/mkrf_conf.rb +3 -0
  13. data/ext/openc3/ext/array/array.c +3 -0
  14. data/ext/openc3/ext/buffered_file/buffered_file.c +3 -0
  15. data/ext/openc3/ext/config_parser/config_parser.c +3 -0
  16. data/ext/openc3/ext/crc/crc.c +3 -0
  17. data/ext/openc3/ext/openc3_io/openc3_io.c +3 -0
  18. data/ext/openc3/ext/packet/packet.c +3 -0
  19. data/ext/openc3/ext/platform/platform.c +3 -0
  20. data/ext/openc3/ext/polynomial_conversion/polynomial_conversion.c +3 -0
  21. data/ext/openc3/ext/string/string.c +3 -0
  22. data/ext/openc3/ext/structure/structure.c +3 -0
  23. data/ext/openc3/ext/tabbed_plots_config/tabbed_plots_config.c +3 -0
  24. data/ext/openc3/ext/telemetry/telemetry.c +3 -0
  25. data/lib/cosmos.rb +3 -0
  26. data/lib/cosmosc2.rb +3 -0
  27. data/lib/openc3/accessors/accessor.rb +3 -0
  28. data/lib/openc3/accessors/binary_accessor.rb +3 -0
  29. data/lib/openc3/accessors/cbor_accessor.rb +3 -0
  30. data/lib/openc3/accessors/html_accessor.rb +3 -0
  31. data/lib/openc3/accessors/json_accessor.rb +4 -1
  32. data/lib/openc3/accessors/xml_accessor.rb +3 -0
  33. data/lib/openc3/accessors.rb +3 -0
  34. data/lib/openc3/api/api.rb +3 -0
  35. data/lib/openc3/api/authorized_api.rb +3 -0
  36. data/lib/openc3/api/cmd_api.rb +6 -3
  37. data/lib/openc3/api/config_api.rb +3 -0
  38. data/lib/openc3/api/interface_api.rb +6 -2
  39. data/lib/openc3/api/limits_api.rb +54 -61
  40. data/lib/openc3/api/router_api.rb +6 -3
  41. data/lib/openc3/api/settings_api.rb +3 -0
  42. data/lib/openc3/api/target_api.rb +3 -0
  43. data/lib/openc3/api/tlm_api.rb +27 -32
  44. data/lib/openc3/bridge/bridge.rb +3 -0
  45. data/lib/openc3/bridge/bridge_config.rb +3 -0
  46. data/lib/openc3/bridge/bridge_interface_thread.rb +3 -0
  47. data/lib/openc3/bridge/bridge_router_thread.rb +3 -0
  48. data/lib/openc3/ccsds/ccsds_packet.rb +3 -0
  49. data/lib/openc3/ccsds/ccsds_parser.rb +3 -0
  50. data/lib/openc3/config/config_parser.rb +3 -0
  51. data/lib/openc3/config/meta_config_parser.rb +3 -0
  52. data/lib/openc3/conversions/conversion.rb +3 -0
  53. data/lib/openc3/conversions/generic_conversion.rb +3 -0
  54. data/lib/openc3/conversions/packet_time_formatted_conversion.rb +3 -0
  55. data/lib/openc3/conversions/packet_time_seconds_conversion.rb +3 -0
  56. data/lib/openc3/conversions/polynomial_conversion.rb +3 -0
  57. data/lib/openc3/conversions/processor_conversion.rb +3 -0
  58. data/lib/openc3/conversions/received_count_conversion.rb +3 -0
  59. data/lib/openc3/conversions/received_time_formatted_conversion.rb +3 -0
  60. data/lib/openc3/conversions/received_time_seconds_conversion.rb +3 -0
  61. data/lib/openc3/conversions/segmented_polynomial_conversion.rb +3 -0
  62. data/lib/openc3/conversions/unix_time_conversion.rb +3 -0
  63. data/lib/openc3/conversions/unix_time_formatted_conversion.rb +3 -0
  64. data/lib/openc3/conversions/unix_time_seconds_conversion.rb +3 -0
  65. data/lib/openc3/conversions.rb +3 -0
  66. data/lib/openc3/core_ext/array.rb +3 -0
  67. data/lib/openc3/core_ext/binding.rb +3 -0
  68. data/lib/openc3/core_ext/class.rb +3 -0
  69. data/lib/openc3/core_ext/exception.rb +3 -0
  70. data/lib/openc3/core_ext/file.rb +3 -0
  71. data/lib/openc3/core_ext/hash.rb +3 -0
  72. data/lib/openc3/core_ext/io.rb +3 -0
  73. data/lib/openc3/core_ext/kernel.rb +3 -0
  74. data/lib/openc3/core_ext/math.rb +3 -0
  75. data/lib/openc3/core_ext/matrix.rb +3 -0
  76. data/lib/openc3/core_ext/objectspace.rb +3 -0
  77. data/lib/openc3/core_ext/openc3_io.rb +3 -0
  78. data/lib/openc3/core_ext/range.rb +3 -0
  79. data/lib/openc3/core_ext/socket.rb +3 -0
  80. data/lib/openc3/core_ext/string.rb +3 -0
  81. data/lib/openc3/core_ext/stringio.rb +3 -0
  82. data/lib/openc3/core_ext/tempfile.rb +3 -0
  83. data/lib/openc3/core_ext/time.rb +3 -0
  84. data/lib/openc3/core_ext.rb +3 -0
  85. data/lib/openc3/interfaces/interface.rb +3 -0
  86. data/lib/openc3/interfaces/linc_interface.rb +3 -0
  87. data/lib/openc3/interfaces/protocols/burst_protocol.rb +3 -0
  88. data/lib/openc3/interfaces/protocols/crc_protocol.rb +3 -0
  89. data/lib/openc3/interfaces/protocols/fixed_protocol.rb +3 -0
  90. data/lib/openc3/interfaces/protocols/ignore_packet_protocol.rb +3 -0
  91. data/lib/openc3/interfaces/protocols/length_protocol.rb +3 -0
  92. data/lib/openc3/interfaces/protocols/override_protocol.rb +3 -0
  93. data/lib/openc3/interfaces/protocols/preidentified_protocol.rb +3 -0
  94. data/lib/openc3/interfaces/protocols/protocol.rb +3 -0
  95. data/lib/openc3/interfaces/protocols/template_protocol.rb +3 -0
  96. data/lib/openc3/interfaces/protocols/terminated_protocol.rb +3 -0
  97. data/lib/openc3/interfaces/serial_interface.rb +3 -0
  98. data/lib/openc3/interfaces/simulated_target_interface.rb +3 -0
  99. data/lib/openc3/interfaces/stream_interface.rb +3 -0
  100. data/lib/openc3/interfaces/tcpip_client_interface.rb +3 -0
  101. data/lib/openc3/interfaces/tcpip_server_interface.rb +3 -0
  102. data/lib/openc3/interfaces/udp_interface.rb +3 -0
  103. data/lib/openc3/interfaces.rb +3 -0
  104. data/lib/openc3/io/buffered_file.rb +3 -0
  105. data/lib/openc3/io/io_multiplexer.rb +8 -0
  106. data/lib/openc3/io/json_api_object.rb +5 -2
  107. data/lib/openc3/io/json_drb.rb +3 -0
  108. data/lib/openc3/io/json_drb_object.rb +5 -2
  109. data/lib/openc3/io/json_drb_rack.rb +3 -0
  110. data/lib/openc3/io/json_rpc.rb +3 -0
  111. data/lib/openc3/io/openc3_snmp.rb +3 -0
  112. data/lib/openc3/io/posix_serial_driver.rb +3 -0
  113. data/lib/openc3/io/raw_logger.rb +3 -0
  114. data/lib/openc3/io/raw_logger_pair.rb +3 -0
  115. data/lib/openc3/io/serial_driver.rb +3 -0
  116. data/lib/openc3/io/stderr.rb +3 -0
  117. data/lib/openc3/io/stdout.rb +3 -0
  118. data/lib/openc3/io/udp_sockets.rb +3 -0
  119. data/lib/openc3/io/win32_serial_driver.rb +3 -0
  120. data/lib/openc3/logs/buffered_packet_log_reader.rb +65 -0
  121. data/lib/openc3/logs/buffered_packet_log_writer.rb +118 -0
  122. data/lib/openc3/logs/log_writer.rb +94 -41
  123. data/lib/openc3/logs/packet_log_constants.rb +9 -0
  124. data/lib/openc3/logs/packet_log_reader.rb +34 -3
  125. data/lib/openc3/logs/packet_log_writer.rb +85 -20
  126. data/lib/openc3/logs/text_log_writer.rb +9 -5
  127. data/lib/openc3/logs.rb +8 -2
  128. data/lib/openc3/microservices/cleanup_microservice.rb +18 -18
  129. data/lib/openc3/microservices/decom_microservice.rb +30 -24
  130. data/lib/openc3/microservices/interface_microservice.rb +136 -91
  131. data/lib/openc3/microservices/log_microservice.rb +35 -13
  132. data/lib/openc3/microservices/microservice.rb +16 -14
  133. data/lib/openc3/microservices/plugin_microservice.rb +3 -1
  134. data/lib/openc3/microservices/reaction_microservice.rb +4 -1
  135. data/lib/openc3/microservices/reducer_microservice.rb +332 -149
  136. data/lib/openc3/microservices/router_microservice.rb +3 -0
  137. data/lib/openc3/microservices/text_log_microservice.rb +5 -2
  138. data/lib/openc3/microservices/timeline_microservice.rb +4 -1
  139. data/lib/openc3/microservices/trigger_group_microservice.rb +3 -0
  140. data/lib/openc3/models/activity_model.rb +3 -0
  141. data/lib/openc3/models/auth_model.rb +3 -0
  142. data/lib/openc3/models/cvt_model.rb +14 -5
  143. data/lib/openc3/models/environment_model.rb +3 -0
  144. data/lib/openc3/models/gem_model.rb +30 -51
  145. data/lib/openc3/models/info_model.rb +3 -0
  146. data/lib/openc3/models/interface_model.rb +3 -0
  147. data/lib/openc3/models/interface_status_model.rb +4 -1
  148. data/lib/openc3/models/metadata_model.rb +3 -0
  149. data/lib/openc3/models/metric_model.rb +3 -0
  150. data/lib/openc3/models/microservice_model.rb +9 -6
  151. data/lib/openc3/models/microservice_status_model.rb +4 -1
  152. data/lib/openc3/models/model.rb +3 -0
  153. data/lib/openc3/models/note_model.rb +3 -0
  154. data/lib/openc3/models/notification_model.rb +3 -0
  155. data/lib/openc3/models/ping_model.rb +3 -0
  156. data/lib/openc3/models/plugin_model.rb +20 -14
  157. data/lib/openc3/models/process_status_model.rb +4 -1
  158. data/lib/openc3/models/reaction_model.rb +3 -0
  159. data/lib/openc3/models/reducer_model.rb +31 -24
  160. data/lib/openc3/models/router_model.rb +3 -0
  161. data/lib/openc3/models/router_status_model.rb +3 -0
  162. data/lib/openc3/models/scope_model.rb +3 -4
  163. data/lib/openc3/models/settings_model.rb +3 -0
  164. data/lib/openc3/models/sorted_model.rb +3 -0
  165. data/lib/openc3/models/target_model.rb +61 -94
  166. data/lib/openc3/models/timeline_model.rb +4 -1
  167. data/lib/openc3/models/tool_config_model.rb +3 -0
  168. data/lib/openc3/models/tool_model.rb +11 -9
  169. data/lib/openc3/models/trigger_group_model.rb +3 -0
  170. data/lib/openc3/models/trigger_model.rb +3 -0
  171. data/lib/openc3/models/widget_model.rb +18 -11
  172. data/lib/openc3/operators/microservice_operator.rb +3 -0
  173. data/lib/openc3/operators/operator.rb +105 -34
  174. data/lib/openc3/packets/commands.rb +3 -0
  175. data/lib/openc3/packets/json_packet.rb +87 -14
  176. data/lib/openc3/packets/limits.rb +4 -1
  177. data/lib/openc3/packets/limits_response.rb +3 -0
  178. data/lib/openc3/packets/packet.rb +5 -1
  179. data/lib/openc3/packets/packet_config.rb +3 -0
  180. data/lib/openc3/packets/packet_item.rb +9 -3
  181. data/lib/openc3/packets/packet_item_limits.rb +3 -0
  182. data/lib/openc3/packets/parsers/format_string_parser.rb +3 -0
  183. data/lib/openc3/packets/parsers/limits_parser.rb +3 -0
  184. data/lib/openc3/packets/parsers/limits_response_parser.rb +3 -0
  185. data/lib/openc3/packets/parsers/packet_item_parser.rb +3 -0
  186. data/lib/openc3/packets/parsers/packet_parser.rb +3 -0
  187. data/lib/openc3/packets/parsers/processor_parser.rb +3 -0
  188. data/lib/openc3/packets/parsers/state_parser.rb +3 -0
  189. data/lib/openc3/packets/parsers/xtce_converter.rb +3 -0
  190. data/lib/openc3/packets/parsers/xtce_parser.rb +3 -0
  191. data/lib/openc3/packets/structure.rb +3 -0
  192. data/lib/openc3/packets/structure_item.rb +3 -0
  193. data/lib/openc3/packets/telemetry.rb +3 -0
  194. data/lib/openc3/processors/processor.rb +3 -0
  195. data/lib/openc3/processors/statistics_processor.rb +3 -0
  196. data/lib/openc3/processors/watermark_processor.rb +3 -0
  197. data/lib/openc3/processors.rb +3 -0
  198. data/lib/openc3/script/api_shared.rb +35 -6
  199. data/lib/openc3/script/calendar.rb +3 -0
  200. data/lib/openc3/script/commands.rb +3 -0
  201. data/lib/openc3/script/exceptions.rb +3 -0
  202. data/lib/openc3/script/extract.rb +3 -0
  203. data/lib/openc3/script/limits.rb +3 -24
  204. data/lib/openc3/script/script.rb +11 -7
  205. data/lib/openc3/script/script_runner.rb +3 -0
  206. data/lib/openc3/script/storage.rb +33 -16
  207. data/lib/openc3/script/suite.rb +3 -0
  208. data/lib/openc3/script/suite_results.rb +3 -0
  209. data/lib/openc3/script/suite_runner.rb +3 -0
  210. data/lib/openc3/script/telemetry.rb +43 -0
  211. data/lib/openc3/script.rb +3 -0
  212. data/lib/openc3/streams/serial_stream.rb +3 -0
  213. data/lib/openc3/streams/stream.rb +3 -0
  214. data/lib/openc3/streams/tcpip_client_stream.rb +3 -0
  215. data/lib/openc3/streams/tcpip_socket_stream.rb +3 -0
  216. data/lib/openc3/system/system.rb +23 -10
  217. data/lib/openc3/system/system_config.rb +3 -0
  218. data/lib/openc3/system/target.rb +3 -0
  219. data/lib/openc3/system.rb +3 -0
  220. data/lib/openc3/tools/cmd_tlm_server/api.rb +3 -0
  221. data/lib/openc3/tools/cmd_tlm_server/cmd_tlm_server_config.rb +3 -0
  222. data/lib/openc3/tools/cmd_tlm_server/interface_thread.rb +3 -0
  223. data/lib/openc3/tools/table_manager/table.rb +3 -0
  224. data/lib/openc3/tools/table_manager/table_config.rb +3 -0
  225. data/lib/openc3/tools/table_manager/table_item.rb +3 -0
  226. data/lib/openc3/tools/table_manager/table_item_parser.rb +3 -0
  227. data/lib/openc3/tools/table_manager/table_manager_core.rb +3 -0
  228. data/lib/openc3/tools/table_manager/table_parser.rb +3 -0
  229. data/lib/openc3/tools/test_runner/test.rb +3 -0
  230. data/lib/openc3/top_level.rb +3 -0
  231. data/lib/openc3/topics/autonomic_topic.rb +3 -0
  232. data/lib/openc3/topics/calendar_topic.rb +3 -0
  233. data/lib/openc3/topics/command_decom_topic.rb +4 -1
  234. data/lib/openc3/topics/command_topic.rb +6 -1
  235. data/lib/openc3/topics/config_topic.rb +3 -0
  236. data/lib/openc3/topics/interface_topic.rb +9 -2
  237. data/lib/openc3/topics/limits_event_topic.rb +144 -10
  238. data/lib/openc3/topics/notifications_topic.rb +3 -0
  239. data/lib/openc3/topics/router_topic.rb +10 -3
  240. data/lib/openc3/topics/telemetry_decom_topic.rb +26 -20
  241. data/lib/openc3/topics/telemetry_reduced_topics.rb +92 -0
  242. data/lib/openc3/topics/telemetry_topic.rb +5 -2
  243. data/lib/openc3/topics/timeline_topic.rb +3 -0
  244. data/lib/openc3/topics/topic.rb +3 -0
  245. data/lib/openc3/utilities/authentication.rb +3 -0
  246. data/lib/openc3/utilities/authorization.rb +3 -0
  247. data/lib/openc3/utilities/aws_bucket.rb +199 -0
  248. data/lib/openc3/utilities/bucket.rb +82 -0
  249. data/lib/openc3/utilities/bucket_file_cache.rb +264 -0
  250. data/lib/openc3/utilities/bucket_utilities.rb +109 -0
  251. data/lib/openc3/utilities/crc.rb +3 -0
  252. data/lib/openc3/utilities/csv.rb +3 -0
  253. data/lib/openc3/utilities/local_bucket.rb +28 -0
  254. data/lib/openc3/utilities/local_mode.rb +47 -61
  255. data/lib/openc3/utilities/logger.rb +7 -1
  256. data/lib/openc3/utilities/message_log.rb +7 -4
  257. data/lib/openc3/utilities/metric.rb +4 -1
  258. data/lib/openc3/utilities/open_telemetry.rb +96 -0
  259. data/lib/openc3/utilities/process_manager.rb +3 -0
  260. data/lib/openc3/utilities/quaternion.rb +3 -0
  261. data/lib/openc3/utilities/ruby_lex_utils.rb +3 -0
  262. data/lib/openc3/utilities/s3_autoload.rb +3 -3
  263. data/lib/openc3/utilities/simulated_target.rb +3 -0
  264. data/lib/openc3/utilities/sleeper.rb +3 -0
  265. data/lib/openc3/utilities/store.rb +3 -0
  266. data/lib/openc3/utilities/store_autoload.rb +30 -23
  267. data/lib/openc3/utilities/target_file.rb +70 -83
  268. data/lib/openc3/utilities/zip.rb +3 -0
  269. data/lib/openc3/utilities.rb +3 -0
  270. data/lib/openc3/version.rb +6 -6
  271. data/lib/openc3/win32/excel.rb +3 -0
  272. data/lib/openc3/win32/win32.rb +3 -0
  273. data/lib/openc3/win32/win32_main.rb +3 -0
  274. data/lib/openc3.rb +3 -0
  275. data/tasks/gemfile_stats.rake +3 -0
  276. data/tasks/spec.rake +3 -0
  277. data/templates/plugin-template/plugin.gemspec +1 -1
  278. metadata +112 -6
  279. data/lib/openc3/utilities/s3.rb +0 -220
  280. data/lib/openc3/utilities/s3_file_cache.rb +0 -274
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/packets/packet_config'
21
24
  require 'openc3/packets/parsers/packet_item_parser'
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3'
21
24
  require 'openc3/tools/table_manager/table_config'
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/packets/parsers/packet_parser'
21
24
  require 'openc3/tools/table_manager/table'
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/script/suite'
21
24
  require 'openc3/script/exceptions'
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  # This file contains top level functions in the OpenC3 namespace
21
24
 
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/topics/topic'
21
24
 
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/topics/topic'
21
24
 
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/topics/topic'
21
24
 
@@ -30,7 +33,7 @@ module OpenC3
30
33
  msg_hash = { time: packet.received_time.to_nsec_from_epoch,
31
34
  target_name: packet.target_name,
32
35
  packet_name: packet.packet_name,
33
- stored: packet.stored,
36
+ stored: packet.stored.to_s,
34
37
  received_count: packet.received_count }
35
38
  json_hash = {}
36
39
  packet.sorted_items.each do |item|
@@ -16,8 +16,12 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/topics/topic'
24
+ require 'openc3/utilities/open_telemetry'
21
25
 
22
26
  module OpenC3
23
27
  class CommandTopic < Topic
@@ -29,7 +33,7 @@ module OpenC3
29
33
  target_name: packet.target_name,
30
34
  packet_name: packet.packet_name,
31
35
  received_count: packet.received_count,
32
- stored: packet.stored,
36
+ stored: packet.stored.to_s,
33
37
  buffer: packet.buffer(false) }
34
38
  Topic.write_topic(topic, msg_hash)
35
39
  end
@@ -41,6 +45,7 @@ module OpenC3
41
45
  # Save the existing cmd_params Hash and JSON generate before writing to the topic
42
46
  cmd_params = command['cmd_params']
43
47
  command['cmd_params'] = JSON.generate(command['cmd_params'].as_json(:allow_nan => true))
48
+ OpenC3.inject_context(command)
44
49
  cmd_id = Topic.write_topic("{#{scope}__CMD}TARGET__#{command['target_name']}", command, '*', 100)
45
50
  # TODO: This timeout is fine for most but can we get the write_timeout from the interface here?
46
51
  time = Time.now
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/topics/topic'
21
24
 
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/topics/topic'
21
24
 
@@ -48,8 +51,12 @@ module OpenC3
48
51
  Topic.write_topic("{#{scope}__CMD}INTERFACE__#{interface_name}", { 'raw' => data }, '*', 100)
49
52
  end
50
53
 
51
- def self.connect_interface(interface_name, scope:)
52
- Topic.write_topic("{#{scope}__CMD}INTERFACE__#{interface_name}", { 'connect' => 'true' }, '*', 100)
54
+ def self.connect_interface(interface_name, *interface_params, scope:)
55
+ if interface_params && !interface_params.empty?
56
+ Topic.write_topic("{#{scope}__CMD}INTERFACE__#{interface_name}", { 'connect' => 'true', 'params' => JSON.generate(interface_params) }, '*', 100)
57
+ else
58
+ Topic.write_topic("{#{scope}__CMD}INTERFACE__#{interface_name}", { 'connect' => 'true' }, '*', 100)
59
+ end
53
60
  end
54
61
 
55
62
  def self.disconnect_interface(interface_name, scope:)
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/topics/topic'
21
24
 
@@ -23,6 +26,7 @@ module OpenC3
23
26
  # LimitsEventTopic keeps track of not only the <SCOPE>__openc3_limits_events topic
24
27
  # but also the ancillary key value stores. The LIMITS_CHANGE event updates the
25
28
  # <SCOPE>__current_limits key. The LIMITS_SET event updates the <SCOPE>__limits_sets.
29
+ # The LIMITS_SETTINGS event updates the <SCOPE>__current_limits_settings.
26
30
  # While this isn't a clean separation of topics (streams) and models (key-value)
27
31
  # it helps maintain consistency as the topic and model are linked.
28
32
  class LimitsEventTopic < Topic
@@ -40,6 +44,36 @@ module OpenC3
40
44
  Store.hset("#{scope}__limits_sets", event[:limits_set], 'false')
41
45
  end
42
46
 
47
+ field = "#{event[:target_name]}__#{event[:packet_name]}__#{event[:item_name]}"
48
+ limits_settings = Store.hget("#{scope}__current_limits_settings", field)
49
+ if limits_settings
50
+ limits_settings = JSON.parse(limits_settings, :allow_nan => true, :create_additions => true)
51
+ else
52
+ limits_settings = {}
53
+ end
54
+ limits = {}
55
+ limits['red_low'] = event[:red_low]
56
+ limits['yellow_low'] = event[:yellow_low]
57
+ limits['yellow_high'] = event[:yellow_high]
58
+ limits['red_high'] = event[:red_high]
59
+ limits['green_low'] = event[:green_low] if event[:green_low] && event[:green_high]
60
+ limits['green_high'] = event[:green_high] if event[:green_low] && event[:green_high]
61
+ limits_settings[event[:limits_set]] = limits
62
+ limits_settings['persistence_setting'] = event[:persistence] if event[:persistence]
63
+ limits_settings['enabled'] = event[:enabled] if not event[:enabled].nil?
64
+ Store.hset("#{scope}__current_limits_settings", field, JSON.generate(limits_settings, :allow_nan => true))
65
+
66
+ when :LIMITS_ENABLE_STATE
67
+ field = "#{event[:target_name]}__#{event[:packet_name]}__#{event[:item_name]}"
68
+ limits_settings = Store.hget("#{scope}__current_limits_settings", field)
69
+ if limits_settings
70
+ limits_settings = JSON.parse(limits_settings, :allow_nan => true, :create_additions => true)
71
+ else
72
+ limits_settings = {}
73
+ end
74
+ limits_settings['enabled'] = event[:enabled]
75
+ Store.hset("#{scope}__current_limits_settings", field, JSON.generate(limits_settings, :allow_nan => true))
76
+
43
77
  when :LIMITS_SET
44
78
  sets = sets(scope: scope)
45
79
  raise "Set '#{event[:set]}' does not exist!" unless sets.key?(event[:set])
@@ -52,25 +86,29 @@ module OpenC3
52
86
  raise "Invalid limits event type '#{event[:type]}'"
53
87
  end
54
88
 
55
- Topic.write_topic("#{scope}__openc3_limits_events", event, '*', 1000)
89
+ Topic.write_topic("#{scope}__openc3_limits_events", {event: JSON.generate(event, :allow_nan => true)}, '*', 1000)
56
90
  end
57
91
 
92
+ # Remove the JSON encoding to return hashes directly
58
93
  def self.read(offset = nil, count: 100, scope:)
94
+ final_result = []
59
95
  topic = "#{scope}__openc3_limits_events"
60
96
  if offset
61
97
  result = Topic.read_topics([topic], [offset], nil, count)
62
- if result.empty?
63
- [] # We want to return an empty array rather than an empty hash
64
- else
98
+ if not result.empty?
65
99
  # result is a hash with the topic key followed by an array of results
66
100
  # This returns just the array of arrays [[offset, hash], [offset, hash], ...]
67
- result[topic]
101
+ final_result = result[topic]
68
102
  end
69
103
  else
70
104
  result = Topic.get_newest_message(topic)
71
- return [result] if result
72
- return []
105
+ final_result = [result] if result
73
106
  end
107
+ parsed_result = []
108
+ final_result.each do |offset, hash|
109
+ parsed_result << [offset, JSON.parse(hash['event'], :allow_nan => true, :create_additions => true)]
110
+ end
111
+ return parsed_result
74
112
  end
75
113
 
76
114
  def self.out_of_limits(scope:)
@@ -97,11 +135,107 @@ module OpenC3
97
135
  sets(scope: scope).key('true') || "DEFAULT"
98
136
  end
99
137
 
100
- def self.delete(target_name, packet_name, scope:)
138
+ # Cleanups up the current_limits and current_limits_settings keys for
139
+ # a target or target/packet combination
140
+ def self.delete(target_name, packet_name = nil, scope:)
101
141
  limits = Store.hgetall("#{scope}__current_limits")
102
142
  limits.each do |item, _limits_state|
103
- if item =~ /^#{target_name}__#{packet_name}__/
104
- Store.hdel("#{scope}__current_limits", item)
143
+ if packet_name
144
+ if item =~ /^#{target_name}__#{packet_name}__/
145
+ Store.hdel("#{scope}__current_limits", item)
146
+ end
147
+ else
148
+ if item =~ /^#{target_name}__/
149
+ Store.hdel("#{scope}__current_limits", item)
150
+ end
151
+ end
152
+ end
153
+
154
+ limits_settings = Store.hgetall("#{scope}__current_limits_settings")
155
+ limits_settings.each do |item, _limits_settings|
156
+ if packet_name
157
+ if item =~ /^#{target_name}__#{packet_name}__/
158
+ Store.hdel("#{scope}__current_limits_settings", item)
159
+ end
160
+ else
161
+ if item =~ /^#{target_name}__/
162
+ Store.hdel("#{scope}__current_limits_settings", item)
163
+ end
164
+ end
165
+ end
166
+ end
167
+
168
+ # Update the local System based on overall state
169
+ def self.sync_system(scope:)
170
+ all_limits_settings = Store.hgetall("#{scope}__current_limits_settings")
171
+ telemetry = System.telemetry.all
172
+ all_limits_settings.each do |item, limits_settings|
173
+ target_name, packet_name, item_name = item.split('__')
174
+ target = telemetry[target_name]
175
+ if target
176
+ packet = target[packet_name]
177
+ if packet
178
+ limits_settings = JSON.parse(limits_settings, :allow_nan => true, :create_additions => true)
179
+ enabled = limits_settings['enabled']
180
+ persistence = limits_settings['persistence_setting']
181
+ limits_settings.each do |limits_set, settings|
182
+ next unless Hash === limits_set
183
+ System.limits.set(target_name, packet_name, item_name, settings['red_low'], settings['yellow_low'], settings['yellow_high'], settings['red_high'], settings['green_low'], settings['green_high'], limits_set.to_s.intern, persistence, enabled)
184
+ end
185
+ if not enabled.nil?
186
+ if enabled
187
+ System.limits.enable(target_name, packet_name, item_name)
188
+ else
189
+ System.limits.disable(target_name, packet_name, item_name)
190
+ end
191
+ end
192
+ end
193
+ end
194
+ end
195
+ end
196
+
197
+ # Update the local system based on limits events
198
+ def self.sync_system_thread_body(scope:, block_ms: nil)
199
+ telemetry = System.telemetry.all
200
+ topics = ["#{scope}__openc3_limits_events"]
201
+ Topic.read_topics(topics, nil, block_ms) do |topic, msg_id, event, redis|
202
+ event = JSON.parse(event['event'], :allow_nan => true, :create_additions => true)
203
+ case event['type']
204
+ when 'LIMITS_CHANGE'
205
+ # Ignore
206
+ when 'LIMITS_SETTINGS'
207
+ target_name = event['target_name']
208
+ packet_name = event['packet_name']
209
+ item_name = event['item_name']
210
+ target = telemetry[target_name]
211
+ if target
212
+ packet = target[packet_name]
213
+ if packet
214
+ enabled = ConfigParser.handle_true_false_nil(event['enabled'])
215
+ persistence = event['persistence']
216
+ System.limits.set(target_name, packet_name, item_name, event['red_low'], event['yellow_low'], event['yellow_high'], event['red_high'], event['green_low'], event['green_high'], event['limits_set'], persistence, enabled)
217
+ end
218
+ end
219
+
220
+ when 'LIMITS_ENABLE_STATE'
221
+ target_name = event['target_name']
222
+ packet_name = event['packet_name']
223
+ item_name = event['item_name']
224
+ target = telemetry[target_name]
225
+ if target
226
+ packet = target[packet_name]
227
+ if packet
228
+ enabled = ConfigParser.handle_true_false_nil(event['enabled'])
229
+ if enabled
230
+ System.limits.enable(target_name, packet_name, item_name)
231
+ else
232
+ System.limits.disable(target_name, packet_name, item_name)
233
+ end
234
+ end
235
+ end
236
+
237
+ when 'LIMITS_SET'
238
+ System.limits_set = event['set']
105
239
  end
106
240
  end
107
241
  end
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/topics/topic'
21
24
 
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/topics/topic'
21
24
 
@@ -60,12 +63,16 @@ module OpenC3
60
63
  end
61
64
  end
62
65
 
63
- def self.connect_router(router_name, scope:)
64
- Topic.write_topic("{#{scope}__CMD}ROUTER__#{router_name}", { 'connect' => true }, '*', 100)
66
+ def self.connect_router(router_name, *router_params, scope:)
67
+ if router_params && !router_params.empty?
68
+ Topic.write_topic("{#{scope}__CMD}ROUTER__#{router_name}", { 'connect' => 'true', 'params' => JSON.generate(router_params) }, '*', 100)
69
+ else
70
+ Topic.write_topic("{#{scope}__CMD}ROUTER__#{router_name}", { 'connect' => 'true' }, '*', 100)
71
+ end
65
72
  end
66
73
 
67
74
  def self.disconnect_router(router_name, scope:)
68
- Topic.write_topic("{#{scope}__CMD}ROUTER__#{router_name}", { 'disconnect' => true }, '*', 100)
75
+ Topic.write_topic("{#{scope}__CMD}ROUTER__#{router_name}", { 'disconnect' => 'true' }, '*', 100)
69
76
  end
70
77
 
71
78
  def self.start_raw_logging(router_name, scope:)
@@ -16,8 +16,12 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/topics/topic'
24
+ require 'openc3/utilities/open_telemetry'
21
25
 
22
26
  module OpenC3
23
27
  class TelemetryDecomTopic < Topic
@@ -26,28 +30,30 @@ module OpenC3
26
30
  end
27
31
 
28
32
  def self.write_packet(packet, id: nil, scope:)
29
- # Need to build a JSON hash of the decommutated data
30
- # Support "downward typing"
31
- # everything base name is RAW (including DERIVED)
32
- # Request for WITH_UNITS, etc will look down until it finds something
33
- # If nothing - item does not exist - nil
34
- # __ as seperators ITEM1, ITEM1__C, ITEM1__F, ITEM1__U
33
+ OpenC3.in_span("write_packet") do
34
+ # Need to build a JSON hash of the decommutated data
35
+ # Support "downward typing"
36
+ # everything base name is RAW (including DERIVED)
37
+ # Request for WITH_UNITS, etc will look down until it finds something
38
+ # If nothing - item does not exist - nil
39
+ # __ as seperators ITEM1, ITEM1__C, ITEM1__F, ITEM1__U
35
40
 
36
- json_hash = CvtModel.build_json_from_packet(packet)
37
- # Write to stream
38
- msg_hash = {
39
- :time => packet.packet_time.to_nsec_from_epoch,
40
- :stored => packet.stored,
41
- :target_name => packet.target_name,
42
- :packet_name => packet.packet_name,
43
- :received_count => packet.received_count,
44
- :json_data => JSON.generate(json_hash.as_json(:allow_nan => true)),
45
- }
46
- Topic.write_topic("#{scope}__DECOM__{#{packet.target_name}}__#{packet.packet_name}", msg_hash, id)
41
+ json_hash = CvtModel.build_json_from_packet(packet)
42
+ # Write to stream
43
+ msg_hash = {
44
+ :time => packet.packet_time.to_nsec_from_epoch,
45
+ :stored => packet.stored.to_s,
46
+ :target_name => packet.target_name,
47
+ :packet_name => packet.packet_name,
48
+ :received_count => packet.received_count,
49
+ :json_data => JSON.generate(json_hash.as_json(:allow_nan => true)),
50
+ }
51
+ Topic.write_topic("#{scope}__DECOM__{#{packet.target_name}}__#{packet.packet_name}", msg_hash, id)
47
52
 
48
- unless packet.stored
49
- # Also update the current value table with the latest decommutated data
50
- CvtModel.set(json_hash, target_name: packet.target_name, packet_name: packet.packet_name, scope: scope)
53
+ unless packet.stored
54
+ # Also update the current value table with the latest decommutated data
55
+ CvtModel.set(json_hash, target_name: packet.target_name, packet_name: packet.packet_name, scope: scope)
56
+ end
51
57
  end
52
58
  end
53
59
  end
@@ -0,0 +1,92 @@
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
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
22
+
23
+ require 'openc3/topics/topic'
24
+ require 'openc3/utilities/open_telemetry'
25
+
26
+ module OpenC3
27
+ class TelemetryReducedMinuteTopic < Topic
28
+ def self.topics(scope:)
29
+ super(scope, 'REDUCED_MINUTE')
30
+ end
31
+
32
+ def self.write(target_name:, packet_name:, stored:, time:, data:, id: nil, scope:)
33
+ OpenC3.in_span("write") do
34
+ # Write to stream
35
+ msg_hash = {
36
+ :time => time,
37
+ :stored => stored.to_s,
38
+ :target_name => target_name,
39
+ :packet_name => packet_name,
40
+ :json_data => data,
41
+ }
42
+ topic = "#{scope}__REDUCED_MINUTE__{#{target_name}}__#{packet_name}"
43
+ offset = Topic.write_topic(topic, msg_hash, id)
44
+ return topic, offset
45
+ end
46
+ end
47
+ end
48
+
49
+ class TelemetryReducedHourTopic < Topic
50
+ def self.topics(scope:)
51
+ super(scope, 'REDUCED_HOUR')
52
+ end
53
+
54
+ def self.write(target_name:, packet_name:, stored:, time:, data:, id: nil, scope:)
55
+ OpenC3.in_span("write") do
56
+ # Write to stream
57
+ msg_hash = {
58
+ :time => time,
59
+ :stored => stored.to_s,
60
+ :target_name => target_name,
61
+ :packet_name => packet_name,
62
+ :json_data => data,
63
+ }
64
+ topic = "#{scope}__REDUCED_HOUR__{#{target_name}}__#{packet_name}"
65
+ offset = Topic.write_topic(topic, msg_hash, id)
66
+ return topic, offset
67
+ end
68
+ end
69
+ end
70
+
71
+ class TelemetryReducedDayTopic < Topic
72
+ def self.topics(scope:)
73
+ super(scope, 'REDUCED_DAY')
74
+ end
75
+
76
+ def self.write(target_name:, packet_name:, stored:, time:, data:, id: nil, scope:)
77
+ OpenC3.in_span("write") do
78
+ # Write to stream
79
+ msg_hash = {
80
+ :time => time,
81
+ :stored => stored.to_s,
82
+ :target_name => target_name,
83
+ :packet_name => packet_name,
84
+ :json_data => data,
85
+ }
86
+ topic = "#{scope}__REDUCED_DAY__{#{target_name}}__#{packet_name}"
87
+ offset = Topic.write_topic(topic, msg_hash, id)
88
+ return topic, offset
89
+ end
90
+ end
91
+ end
92
+ end
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/topics/topic'
21
24
 
@@ -23,8 +26,8 @@ module OpenC3
23
26
  class TelemetryTopic < Topic
24
27
  def self.write_packet(packet, scope:)
25
28
  msg_hash = {
26
- :time => packet.received_time.to_nsec_from_epoch,
27
- :stored => packet.stored,
29
+ :time => packet.packet_time.to_nsec_from_epoch,
30
+ :stored => packet.stored.to_s,
28
31
  :target_name => packet.target_name,
29
32
  :packet_name => packet.packet_name,
30
33
  :received_count => packet.received_count,
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/topics/topic'
21
24
 
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/utilities/store'
21
24
 
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/version'
21
24
 
@@ -16,6 +16,9 @@
16
16
  # Modified by OpenC3, Inc.
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
19
22
 
20
23
  require 'openc3/models/auth_model'
21
24