openc3 6.8.1 → 6.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/bin/openc3cli +5 -5
  4. data/data/config/command_modifiers.yaml +9 -1
  5. data/data/config/screen.yaml +1 -1
  6. data/lib/openc3/accessors/json_accessor.rb +5 -5
  7. data/lib/openc3/api/interface_api.rb +71 -4
  8. data/lib/openc3/api/router_api.rb +98 -8
  9. data/lib/openc3/api/stash_api.rb +3 -3
  10. data/lib/openc3/api/tlm_api.rb +1 -1
  11. data/lib/openc3/bridge/bridge_config.rb +1 -1
  12. data/lib/openc3/interfaces/file_interface.rb +18 -0
  13. data/lib/openc3/interfaces/http_client_interface.rb +11 -0
  14. data/lib/openc3/interfaces/http_server_interface.rb +8 -0
  15. data/lib/openc3/interfaces/interface.rb +90 -21
  16. data/lib/openc3/interfaces/mqtt_interface.rb +19 -0
  17. data/lib/openc3/interfaces/mqtt_stream_interface.rb +20 -0
  18. data/lib/openc3/interfaces/protocols/burst_protocol.rb +16 -0
  19. data/lib/openc3/interfaces/protocols/cmd_response_protocol.rb +18 -0
  20. data/lib/openc3/interfaces/protocols/crc_protocol.rb +19 -0
  21. data/lib/openc3/interfaces/protocols/fixed_protocol.rb +17 -1
  22. data/lib/openc3/interfaces/protocols/ignore_packet_protocol.rb +14 -0
  23. data/lib/openc3/interfaces/protocols/length_protocol.rb +25 -1
  24. data/lib/openc3/interfaces/protocols/preidentified_protocol.rb +16 -3
  25. data/lib/openc3/interfaces/protocols/protocol.rb +79 -1
  26. data/lib/openc3/interfaces/protocols/slip_protocol.rb +23 -0
  27. data/lib/openc3/interfaces/protocols/template_protocol.rb +38 -0
  28. data/lib/openc3/interfaces/protocols/terminated_protocol.rb +14 -1
  29. data/lib/openc3/interfaces/serial_interface.rb +14 -0
  30. data/lib/openc3/interfaces/simulated_target_interface.rb +1 -1
  31. data/lib/openc3/interfaces/tcpip_client_interface.rb +16 -2
  32. data/lib/openc3/interfaces/tcpip_server_interface.rb +11 -1
  33. data/lib/openc3/interfaces/udp_interface.rb +14 -0
  34. data/lib/openc3/io/json_api_object.rb +1 -1
  35. data/lib/openc3/io/json_drb.rb +1 -1
  36. data/lib/openc3/io/json_drb_object.rb +1 -1
  37. data/lib/openc3/io/json_rpc.rb +5 -4
  38. data/lib/openc3/logs/packet_log_reader.rb +1 -1
  39. data/lib/openc3/logs/packet_log_writer.rb +6 -6
  40. data/lib/openc3/microservices/decom_microservice.rb +5 -1
  41. data/lib/openc3/microservices/interface_microservice.rb +103 -38
  42. data/lib/openc3/microservices/microservice.rb +4 -4
  43. data/lib/openc3/microservices/queue_microservice.rb +11 -1
  44. data/lib/openc3/microservices/reducer_microservice.rb +1 -1
  45. data/lib/openc3/microservices/router_microservice.rb +28 -25
  46. data/lib/openc3/models/activity_model.rb +18 -17
  47. data/lib/openc3/models/cvt_model.rb +12 -9
  48. data/lib/openc3/models/interface_model.rb +70 -12
  49. data/lib/openc3/models/metadata_model.rb +2 -2
  50. data/lib/openc3/models/microservice_status_model.rb +2 -2
  51. data/lib/openc3/models/model.rb +4 -4
  52. data/lib/openc3/models/note_model.rb +2 -2
  53. data/lib/openc3/models/plugin_model.rb +9 -4
  54. data/lib/openc3/models/queue_model.rb +1 -1
  55. data/lib/openc3/models/reaction_model.rb +6 -6
  56. data/lib/openc3/models/script_engine_model.rb +1 -1
  57. data/lib/openc3/models/script_status_model.rb +3 -3
  58. data/lib/openc3/models/sorted_model.rb +5 -5
  59. data/lib/openc3/models/target_model.rb +11 -11
  60. data/lib/openc3/models/timeline_model.rb +2 -2
  61. data/lib/openc3/models/tool_model.rb +1 -1
  62. data/lib/openc3/models/trigger_group_model.rb +3 -3
  63. data/lib/openc3/models/trigger_model.rb +6 -6
  64. data/lib/openc3/models/widget_model.rb +1 -1
  65. data/lib/openc3/operators/operator.rb +2 -2
  66. data/lib/openc3/packets/json_packet.rb +1 -1
  67. data/lib/openc3/packets/packet.rb +1 -1
  68. data/lib/openc3/script/calendar.rb +2 -2
  69. data/lib/openc3/script/metadata.rb +4 -4
  70. data/lib/openc3/script/queue.rb +2 -2
  71. data/lib/openc3/script/script_runner.rb +9 -9
  72. data/lib/openc3/script/storage.rb +1 -1
  73. data/lib/openc3/script/tables.rb +2 -2
  74. data/lib/openc3/script/web_socket_api.rb +7 -7
  75. data/lib/openc3/tools/cmd_tlm_server/interface_thread.rb +0 -12
  76. data/lib/openc3/tools/table_manager/table_manager_core.rb +1 -1
  77. data/lib/openc3/topics/command_decom_topic.rb +3 -3
  78. data/lib/openc3/topics/command_topic.rb +1 -1
  79. data/lib/openc3/topics/interface_topic.rb +45 -5
  80. data/lib/openc3/topics/limits_event_topic.rb +8 -8
  81. data/lib/openc3/topics/router_topic.rb +42 -3
  82. data/lib/openc3/topics/system_events_topic.rb +1 -1
  83. data/lib/openc3/topics/telemetry_decom_topic.rb +1 -1
  84. data/lib/openc3/utilities/authentication.rb +1 -1
  85. data/lib/openc3/utilities/cosmos_rails_formatter.rb +2 -3
  86. data/lib/openc3/utilities/local_mode.rb +8 -8
  87. data/lib/openc3/utilities/logger.rb +3 -3
  88. data/lib/openc3/utilities/running_script.rb +8 -8
  89. data/lib/openc3/version.rb +6 -6
  90. data/templates/plugin/README.md +3 -3
  91. data/templates/plugin/Rakefile +3 -3
  92. data/templates/plugin/plugin.gemspec +1 -0
  93. data/templates/tool_angular/.gitignore +1 -1
  94. data/templates/tool_angular/package.json +2 -48
  95. data/templates/tool_react/.gitignore +1 -2
  96. data/templates/tool_react/package.json +1 -51
  97. data/templates/tool_svelte/.gitignore +1 -2
  98. data/templates/tool_svelte/package.json +1 -49
  99. data/templates/tool_vue/package.json +3 -36
  100. data/templates/widget/Rakefile +1 -1
  101. data/templates/widget/package.json +2 -28
  102. metadata +9 -9
@@ -51,6 +51,14 @@ module OpenC3
51
51
  # @return [Array<String>] Array of tlm target names associated with this interface
52
52
  attr_accessor :tlm_target_names
53
53
 
54
+ # @return [Hash<String, Boolean>] Hash of enabled state for each cmd_target
55
+ # Disabled cmd targets will ignore all commands sent to the interface microservice for that target
56
+ attr_accessor :cmd_target_enabled
57
+
58
+ # @return [Hash<String, Boolean>] Array of tlm target names associated with this interface
59
+ # Disabled tlm targets will not output telemetry from the interface microservice for that target
60
+ attr_accessor :tlm_target_enabled
61
+
54
62
  # @return [Boolean] Flag indicating if the interface should be connected
55
63
  # to on startup
56
64
  attr_accessor :connect_on_startup
@@ -66,23 +74,13 @@ module OpenC3
66
74
  # this interface
67
75
  attr_accessor :disable_disconnect
68
76
 
69
- # @return [Array] Array of packet logger classes for this interface
70
- attr_accessor :packet_log_writer_pairs
71
-
72
- # @return [Array] Array of stored packet log writers
73
- attr_accessor :stored_packet_log_writer_pairs
74
-
75
77
  # @return [StreamLogPair] StreamLogPair instance or nil
76
78
  attr_accessor :stream_log_pair
77
79
 
78
80
  # @return [Array<Routers>] Array of routers that receive packets
79
- # read from the interface
81
+ # read from the interface (used by Bridge)
80
82
  attr_accessor :routers
81
83
 
82
- # @return [Array<Routers>] Array of cmd routers that mirror packets
83
- # sent from the interface
84
- attr_accessor :cmd_routers
85
-
86
84
  # @return [Integer] The number of packets read from this interface
87
85
  attr_accessor :read_count
88
86
 
@@ -119,6 +117,9 @@ module OpenC3
119
117
  # @return [Array<[Protocol Class, Protocol Args, Protocol kind (:READ, :WRITE, :READ_WRITE)>] Info to recreate protocols
120
118
  attr_accessor :protocol_info
121
119
 
120
+ # @return [Boolean] Whether to save raw data in the interface and protocols
121
+ attr_accessor :save_raw_data
122
+
122
123
  # @return [String] Most recently read raw data
123
124
  attr_accessor :read_raw_data
124
125
 
@@ -151,14 +152,14 @@ module OpenC3
151
152
  @target_names = []
152
153
  @cmd_target_names = []
153
154
  @tlm_target_names = []
155
+ @cmd_target_enabled = {}
156
+ @tlm_target_enabled = {}
154
157
  @connect_on_startup = true
155
158
  @auto_reconnect = true
156
159
  @reconnect_delay = 5.0
157
160
  @disable_disconnect = false
158
- @packet_log_writer_pairs = []
159
- @stored_packet_log_writer_pairs = []
161
+ @stream_log_pair = nil
160
162
  @routers = []
161
- @cmd_routers = []
162
163
  @read_count = 0
163
164
  @write_count = 0
164
165
  @bytes_read = 0
@@ -174,6 +175,7 @@ module OpenC3
174
175
  @read_protocols = []
175
176
  @write_protocols = []
176
177
  @protocol_info = []
178
+ @save_raw_data = true
177
179
  @read_raw_data = ''
178
180
  @written_raw_data = ''
179
181
  @read_raw_data_time = nil
@@ -276,6 +278,7 @@ module OpenC3
276
278
  # Otherwise we can hold off outputting other packets where all the data has already
277
279
  # been received
278
280
  extra = nil
281
+ blank_test = false
279
282
  if !first or @read_protocols.length <= 0
280
283
  # Read data for a packet
281
284
  data, extra = read_interface()
@@ -286,20 +289,28 @@ module OpenC3
286
289
  else
287
290
  data = ''
288
291
  first = false
292
+ blank_test = true
289
293
  end
290
294
 
291
295
  @read_protocols.each do |protocol|
292
296
  # Extra check is for backwards compatibility
297
+ protocol.read_protocol_input_base(data, extra) unless blank_test
293
298
  if extra
294
299
  data, extra = protocol.read_data(data, extra)
295
300
  else
296
301
  data, extra = protocol.read_data(data)
297
302
  end
303
+ protocol.read_protocol_output_base(data, extra) unless blank_test
298
304
  if data == :DISCONNECT
299
305
  Logger.info("#{@name}: Protocol #{protocol.class} read_data requested disconnect")
300
306
  return nil
301
307
  end
302
308
  break if data == :STOP
309
+ if blank_test
310
+ # This means the blank test returned something so we can log
311
+ protocol.read_protocol_input_base('', nil)
312
+ protocol.read_protocol_output_base(data, extra)
313
+ end
303
314
  end
304
315
  next if data == :STOP
305
316
 
@@ -357,11 +368,13 @@ module OpenC3
357
368
  # Potentially modify packet data
358
369
  @write_protocols.each do |protocol|
359
370
  # Extra check is for backwards compatibility
371
+ protocol.write_protocol_input_base(data, extra)
360
372
  if extra
361
373
  data, extra = protocol.write_data(data, extra)
362
374
  else
363
375
  data, extra = protocol.write_data(data)
364
376
  end
377
+ protocol.write_protocol_output_base(data, extra)
365
378
  if data == :DISCONNECT
366
379
  Logger.info("#{@name}: Protocol #{protocol.class} write_data requested disconnect")
367
380
  disconnect()
@@ -482,13 +495,13 @@ module OpenC3
482
495
  other_interface.target_names = self.target_names.clone
483
496
  other_interface.cmd_target_names = self.cmd_target_names.clone
484
497
  other_interface.tlm_target_names = self.tlm_target_names.clone
498
+ other_interface.cmd_target_enabled = self.cmd_target_enabled.clone
499
+ other_interface.tlm_target_enabled = self.tlm_target_enabled.clone
485
500
  other_interface.connect_on_startup = self.connect_on_startup
486
501
  other_interface.auto_reconnect = self.auto_reconnect
487
502
  other_interface.reconnect_delay = self.reconnect_delay
488
503
  other_interface.disable_disconnect = self.disable_disconnect
489
- other_interface.packet_log_writer_pairs = self.packet_log_writer_pairs.clone
490
504
  other_interface.routers = self.routers.clone
491
- other_interface.cmd_routers = self.cmd_routers.clone
492
505
  other_interface.read_count = self.read_count
493
506
  other_interface.write_count = self.write_count
494
507
  other_interface.bytes_read = self.bytes_read
@@ -498,7 +511,14 @@ module OpenC3
498
511
  # read_queue_size is the number of packets in the queue so don't copy
499
512
  # write_queue_size is the number of packets in the queue so don't copy
500
513
  self.options.each do |option_name, option_values|
501
- other_interface.set_option(option_name, option_values)
514
+ if option_values and Array === option_values[0]
515
+ # Properly Handle option that supports multiple instances
516
+ option_values.each do |ovs|
517
+ other_interface.set_option(option_name, ovs)
518
+ end
519
+ else
520
+ other_interface.set_option(option_name, option_values)
521
+ end
502
522
  end
503
523
  other_interface.protocol_info = []
504
524
  self.protocol_info.each do |protocol_class, protocol_args, read_write|
@@ -552,8 +572,10 @@ module OpenC3
552
572
  #
553
573
  # @return [String] Raw packet data
554
574
  def read_interface_base(data, _extra = nil)
555
- @read_raw_data_time = Time.now
556
- @read_raw_data = data.clone
575
+ if @save_raw_data
576
+ @read_raw_data_time = Time.now
577
+ @read_raw_data = data.clone
578
+ end
557
579
  @bytes_read += data.length
558
580
  @stream_log_pair.read_log.write(data) if @stream_log_pair
559
581
  end
@@ -565,8 +587,10 @@ module OpenC3
565
587
  # @param data [String] Raw packet data
566
588
  # @return [String] The exact data written
567
589
  def write_interface_base(data, _extra = nil)
568
- @written_raw_data_time = Time.now
569
- @written_raw_data = data.clone
590
+ if @save_raw_data
591
+ @written_raw_data_time = Time.now
592
+ @written_raw_data = data.clone
593
+ end
570
594
  @bytes_written += data.length
571
595
  @stream_log_pair.write_log.write(data) if @stream_log_pair
572
596
  end
@@ -646,5 +670,50 @@ module OpenC3
646
670
  end
647
671
  return handled
648
672
  end
673
+
674
+ def details
675
+ result = as_json()
676
+ result['cmd_target_names'] = @cmd_target_names
677
+ result['tlm_target_names'] = @tlm_target_names
678
+ result['cmd_target_enabled'] = @cmd_target_enabled
679
+ result['tlm_target_enabled'] = @tlm_target_enabled
680
+ result['connect_on_startup'] = @connect_on_startup
681
+ result['auto_reconnect'] = @auto_reconnect
682
+ result['reconnect_delay'] = @reconnect_delay
683
+ result['disable_disconnect'] = @disable_disconnect
684
+ result['read_allowed'] = @read_allowed
685
+ result['write_allowed'] = @write_allowed
686
+ result['write_raw_allowed'] = @write_raw_allowed
687
+ result['read_raw_data'] = @read_raw_data
688
+ result['written_raw_data'] = @written_raw_data
689
+ if @read_raw_data_time
690
+ result['read_raw_data_time'] = @read_raw_data_time.iso8601
691
+ else
692
+ result['read_raw_data_time'] = nil
693
+ end
694
+ if @written_raw_data_time
695
+ result['written_raw_data_time'] = @written_raw_data_time.iso8601
696
+ else
697
+ result['written_raw_data_time'] = nil
698
+ end
699
+
700
+ if @stream_log_pair and (@stream_log_pair.write_log.logging_enabled or @stream_log_pair.read_log.logging_enabled)
701
+ result['stream_log'] = true
702
+ else
703
+ result['stream_log'] = false
704
+ end
705
+
706
+ result['options'] = @options
707
+ result['read_protocols'] = []
708
+ @read_protocols.each do |read_protocol|
709
+ result['read_protocols'] << read_protocol.read_details
710
+ end
711
+ result['write_protocols'] = []
712
+ @write_protocols.each do |write_protocol|
713
+ result['write_protocols'] << write_protocol.write_details
714
+ end
715
+
716
+ return result
717
+ end
649
718
  end
650
719
  end
@@ -260,5 +260,24 @@ module OpenC3
260
260
  @ca_file.close
261
261
  end
262
262
  end
263
+
264
+ def details
265
+ result = super()
266
+ result['hostname'] = @hostname
267
+ result['port'] = @port
268
+ result['ssl'] = @ssl
269
+ result['ack_timeout'] = @ack_timeout
270
+ result['username'] = @username
271
+ result['password'] = 'Set' if @password
272
+ result['cert'] = 'Set' if @cert
273
+ result['key'] = 'Set' if @key
274
+ result['ca_file'] = 'Set' if @ca_file
275
+ result['options'].delete('PASSWORD')
276
+ result['options'].delete('CERT')
277
+ result['options'].delete('KEY')
278
+ result['options'].delete('CA_FILE')
279
+ result['read_packets_by_topic'] = @read_packets_by_topic
280
+ return result
281
+ end
263
282
  end
264
283
  end
@@ -96,5 +96,25 @@ module OpenC3
96
96
  @ca_file.close
97
97
  end
98
98
  end
99
+
100
+ def details
101
+ result = super()
102
+ result['hostname'] = @hostname
103
+ result['port'] = @port
104
+ result['ssl'] = @ssl
105
+ result['write_topic'] = @write_topic
106
+ result['read_topic'] = @read_topic
107
+ result['ack_timeout'] = @ack_timeout
108
+ result['username'] = @username
109
+ result['password'] = 'Set' if @password
110
+ result['cert'] = 'Set' if @cert
111
+ result['key'] = 'Set' if @key
112
+ result['ca_file'] = 'Set' if @ca_file
113
+ result['options'].delete('PASSWORD')
114
+ result['options'].delete('CERT')
115
+ result['options'].delete('KEY')
116
+ result['options'].delete('CA_FILE')
117
+ return result
118
+ end
99
119
  end
100
120
  end
@@ -209,5 +209,21 @@ module OpenC3
209
209
  @data.length >= 6 ? @data.getbyte(5) : 0))
210
210
  end
211
211
  end
212
+
213
+ def write_details
214
+ result = super()
215
+ result['discard_leading_bytes'] = @discard_leading_bytes
216
+ result['sync_pattern'] = @sync_pattern.inspect
217
+ result['fill_fields'] = @fill_fields
218
+ return result
219
+ end
220
+
221
+ def read_details
222
+ result = super()
223
+ result['discard_leading_bytes'] = @discard_leading_bytes
224
+ result['sync_pattern'] = @sync_pattern.inspect
225
+ result['fill_fields'] = @fill_fields
226
+ return result
227
+ end
212
228
  end
213
229
  end
@@ -112,5 +112,23 @@ module OpenC3
112
112
  Logger.error(msg)
113
113
  raise msg if @raise_exceptions
114
114
  end
115
+
116
+ def write_details
117
+ result = super()
118
+ result['response_timeout'] = @response_timeout
119
+ result['response_polling_period'] = @response_polling_period
120
+ result['raise_exceptions'] = @raise_exceptions
121
+ result['response_packet'] = @response_packet
122
+ return result
123
+ end
124
+
125
+ def read_details
126
+ result = super()
127
+ result['response_timeout'] = @response_timeout
128
+ result['response_polling_period'] = @response_polling_period
129
+ result['raise_exceptions'] = @raise_exceptions
130
+ result['response_packet'] = @response_packet
131
+ return result
132
+ end
115
133
  end
116
134
  end
@@ -199,5 +199,24 @@ module OpenC3
199
199
  end
200
200
  return data, extra
201
201
  end
202
+
203
+ def write_details
204
+ result = super()
205
+ result['write_item_name'] = @write_item_name
206
+ result['endianness'] = @endianness
207
+ result['bit_offset'] = @bit_offset
208
+ result['bit_size'] = @bit_size
209
+ return result
210
+ end
211
+
212
+ def read_details
213
+ result = super()
214
+ result['strip_crc'] = @strip_crc
215
+ result['bad_strategy'] = @bad_strategy
216
+ result['endianness'] = @endianness
217
+ result['bit_offset'] = @bit_offset
218
+ result['bit_size'] = @bit_size
219
+ return result
220
+ end
202
221
  end
203
222
  end
@@ -65,7 +65,7 @@ module OpenC3
65
65
  return packet
66
66
  end
67
67
 
68
- protected
68
+ # protected
69
69
 
70
70
  # Identifies an unknown buffer of data as a Packet. The raw data is
71
71
  # returned but the packet that matched is recorded so it can be set in the
@@ -168,5 +168,21 @@ module OpenC3
168
168
 
169
169
  identify_and_finish_packet()
170
170
  end
171
+
172
+ def write_details
173
+ result = super()
174
+ result['min_id_size'] = @min_id_size
175
+ result['telemetry'] = @telemetry
176
+ result['unknown_raise'] = @unknown_raise
177
+ return result
178
+ end
179
+
180
+ def read_details
181
+ result = super()
182
+ result['min_id_size'] = @min_id_size
183
+ result['telemetry'] = @telemetry
184
+ result['unknown_raise'] = @unknown_raise
185
+ return result
186
+ end
171
187
  end
172
188
  end
@@ -55,5 +55,19 @@ module OpenC3
55
55
 
56
56
  return super(packet)
57
57
  end
58
+
59
+ def write_details
60
+ result = super()
61
+ result['target_name'] = @target_name
62
+ result['packet_name'] = @packet_name
63
+ return result
64
+ end
65
+
66
+ def read_details
67
+ result = super()
68
+ result['target_name'] = @target_name
69
+ result['packet_name'] = @packet_name
70
+ return result
71
+ end
58
72
  end
59
73
  end
@@ -125,7 +125,31 @@ module OpenC3
125
125
  return data, extra
126
126
  end
127
127
 
128
- protected
128
+ def write_details
129
+ result = super()
130
+ result['length_bit_offset'] = @length_bit_offset
131
+ result['length_bit_size'] = @length_bit_size
132
+ result['length_value_offset'] = @length_value_offset
133
+ result['length_bytes_per_count'] = @length_bytes_per_count
134
+ result['length_endianness'] = @length_endianness
135
+ result['length_bytes_needed'] = @length_bytes_needed
136
+ result['max_length'] = @max_length
137
+ return result
138
+ end
139
+
140
+ def read_details
141
+ result = super()
142
+ result['length_bit_offset'] = @length_bit_offset
143
+ result['length_bit_size'] = @length_bit_size
144
+ result['length_value_offset'] = @length_value_offset
145
+ result['length_bytes_per_count'] = @length_bytes_per_count
146
+ result['length_endianness'] = @length_endianness
147
+ result['length_bytes_needed'] = @length_bytes_needed
148
+ result['max_length'] = @max_length
149
+ return result
150
+ end
151
+
152
+ # protected
129
153
 
130
154
  def calculate_length(buffer_length)
131
155
  length = (buffer_length / @length_bytes_per_count) - @length_value_offset
@@ -70,7 +70,7 @@ module OpenC3
70
70
  @write_extra = nil
71
71
  if packet.extra
72
72
  @write_flags |= COSMOS4_EXTRA_FLAG_MASK
73
- @write_extra = packet.extra.as_json(:allow_nan => true).to_json(:allow_nan => true)
73
+ @write_extra = packet.extra.as_json().to_json(allow_nan: true)
74
74
  end
75
75
  return packet
76
76
  end
@@ -95,7 +95,7 @@ module OpenC3
95
95
  return data_to_send, extra
96
96
  end
97
97
 
98
- protected
98
+ # protected
99
99
 
100
100
  def read_length_field_followed_by_string(length_num_bytes)
101
101
  # Read bytes for string length
@@ -161,7 +161,7 @@ module OpenC3
161
161
  @read_extra = read_length_field_followed_by_string(4)
162
162
  return :STOP if @read_extra == :STOP
163
163
 
164
- @read_extra = JSON.parse(@read_extra, :allow_nan => true, :create_additions => true)
164
+ @read_extra = JSON.parse(@read_extra, allow_nan: true, create_additions: true)
165
165
  @reduction_state = :FLAGS_REMOVED
166
166
  end
167
167
 
@@ -203,5 +203,18 @@ module OpenC3
203
203
 
204
204
  raise "Error should never reach end of method #{@reduction_state}"
205
205
  end
206
+
207
+ def write_details
208
+ result = super()
209
+ result['max_length'] = @max_length
210
+ return result
211
+ end
212
+
213
+ def read_details
214
+ result = super()
215
+ result['max_length'] = @max_length
216
+ result['reduction_state'] = @reduction_state
217
+ return result
218
+ end
206
219
  end
207
220
  end
@@ -14,7 +14,7 @@
14
14
  # GNU Affero General Public License for more details.
15
15
 
16
16
  # Modified by OpenC3, Inc.
17
- # All changes Copyright 2022, OpenC3, Inc.
17
+ # All changes Copyright 2025, OpenC3, Inc.
18
18
  # All Rights Reserved
19
19
  #
20
20
  # This file may also be used under the terms of a commercial license
@@ -52,6 +52,50 @@ module OpenC3
52
52
  reset()
53
53
  end
54
54
 
55
+ # Called to provide insight into the protocol read_data for the input data
56
+ def read_protocol_input_base(data, _extra = nil)
57
+ if @interface
58
+ if @interface.save_raw_data
59
+ @read_data_input_time = Time.now
60
+ @read_data_input = data.clone
61
+ end
62
+ # Todo: @interface.stream_log_pair.read_log.write(data) if @interface.stream_log_pair
63
+ end
64
+ end
65
+
66
+ # Called to provide insight into the protocol read_data for the output data
67
+ def read_protocol_output_base(data, _extra = nil)
68
+ if @interface
69
+ if @interface.save_raw_data
70
+ @read_data_output_time = Time.now
71
+ @read_data_output = data.clone
72
+ end
73
+ # Todo: @interface.stream_log_pair.read_log.write(data) if @interface.stream_log_pair
74
+ end
75
+ end
76
+
77
+ # Called to provide insight into the protocol write_data for the input data
78
+ def write_protocol_input_base(data, _extra = nil)
79
+ if @interface
80
+ if @interface.save_raw_data
81
+ @write_data_input_time = Time.now
82
+ @write_data_input = data.clone
83
+ end
84
+ # Todo: @interface.stream_log_pair.write_log.write(data) if @interface.stream_log_pair
85
+ end
86
+ end
87
+
88
+ # Called to provide insight into the protocol write_data for the output data
89
+ def write_protocol_output_base(data, _extra = nil)
90
+ if @interface
91
+ if @interface.save_raw_data
92
+ @write_data_output_time = Time.now
93
+ @write_data_output = data.clone
94
+ end
95
+ # Todo: @interface.stream_log_pair.write_log.write(data) if @interface.stream_log_pair
96
+ end
97
+ end
98
+
55
99
  # Ensure we have some data in case this is the only protocol
56
100
  def read_data(data, extra = nil)
57
101
  if data.length <= 0
@@ -88,5 +132,39 @@ module OpenC3
88
132
  # Default do nothing - Implemented by subclasses
89
133
  return false
90
134
  end
135
+
136
+ def write_details
137
+ result = {'name' => self.class.name.to_s.split("::")[-1]}
138
+ if @write_data_input_time
139
+ result['write_data_input_time'] = @write_data_input_time.iso8601
140
+ else
141
+ result['write_data_input_time'] = nil
142
+ end
143
+ result['write_data_input'] = @write_data_input
144
+ if @write_data_output_time
145
+ result['write_data_output_time'] = @write_data_output_time.iso8601
146
+ else
147
+ result['write_data_output_time'] = nil
148
+ end
149
+ result['write_data_output'] = @write_data_output
150
+ return result
151
+ end
152
+
153
+ def read_details
154
+ result = {'name' => self.class.name.to_s.split("::")[-1]}
155
+ if @read_data_input_time
156
+ result['read_data_input_time'] = @read_data_input_time.iso8601
157
+ else
158
+ result['read_data_input_time'] = nil
159
+ end
160
+ result['read_data_input'] = @read_data_input
161
+ if @read_data_output_time
162
+ result['read_data_output_time'] = @read_data_output_time.iso8601
163
+ else
164
+ result['read_data_output_time'] = nil
165
+ end
166
+ result['read_data_output'] = @read_data_output
167
+ return result
168
+ end
91
169
  end
92
170
  end
@@ -145,6 +145,29 @@ module OpenC3
145
145
  return :STOP
146
146
  end
147
147
  end
148
+
149
+ def write_details
150
+ result = super()
151
+ result['start_char'] = @start_char.inspect
152
+ result['end_char'] = @end_char.inspect
153
+ result['esc_char'] = @esc_char.inspect
154
+ result['esc_end_char'] = @esc_end_char.inspect
155
+ result['esc_esc_char'] = @esc_esc_char.inspect
156
+ result['write_enable_escaping'] = @write_enable_escaping
157
+ return result
158
+ end
159
+
160
+ def read_details
161
+ result = super()
162
+ result['start_char'] = @start_char.inspect
163
+ result['end_char'] = @end_char.inspect
164
+ result['esc_char'] = @esc_char.inspect
165
+ result['esc_end_char'] = @esc_end_char.inspect
166
+ result['esc_esc_char'] = @esc_esc_char.inspect
167
+ result['read_strip_characters'] = @read_strip_characters
168
+ result['read_enable_escaping'] = @read_enable_escaping
169
+ return result
170
+ end
148
171
  end
149
172
 
150
173
  end
@@ -259,5 +259,43 @@ module OpenC3
259
259
  Logger.error(msg)
260
260
  raise msg if @raise_exceptions
261
261
  end
262
+
263
+ def write_details
264
+ result = super()
265
+ result['response_template'] = @response_template
266
+ result['response_packet'] = @response_packet
267
+ result['response_target_name'] = @response_target_name
268
+ result['ignore_lines'] = @ignore_lines
269
+ result['response_lines'] = @response_lines
270
+ result['initial_read_delay'] = @initial_read_delay
271
+ result['response_timeout'] = @response_timeout
272
+ result['response_polling_period'] = @response_polling_period
273
+ if @connect_complete_time
274
+ result['connect_complete_time'] = @connect_complete_time.iso8601
275
+ else
276
+ result['connect_complete_time'] = nil
277
+ end
278
+ result['raise_exceptions'] = @raise_exceptions
279
+ return result
280
+ end
281
+
282
+ def read_details
283
+ result = super()
284
+ result['response_template'] = @response_template
285
+ result['response_packet'] = @response_packet
286
+ result['response_target_name'] = @response_target_name
287
+ result['ignore_lines'] = @ignore_lines
288
+ result['response_lines'] = @response_lines
289
+ result['initial_read_delay'] = @initial_read_delay
290
+ result['response_timeout'] = @response_timeout
291
+ result['response_polling_period'] = @response_polling_period
292
+ if @connect_complete_time
293
+ result['connect_complete_time'] = @connect_complete_time.iso8601
294
+ else
295
+ result['connect_complete_time'] = nil
296
+ end
297
+ result['raise_exceptions'] = @raise_exceptions
298
+ return result
299
+ end
262
300
  end
263
301
  end
@@ -67,7 +67,20 @@ module OpenC3
67
67
  return data, extra
68
68
  end
69
69
 
70
- protected
70
+ def write_details
71
+ result = super()
72
+ result['write_termination_characters'] = @write_termination_characters.inspect
73
+ return result
74
+ end
75
+
76
+ def read_details
77
+ result = super()
78
+ result['read_termination_characters'] = @read_termination_characters.inspect
79
+ result['strip_read_termination'] = @strip_read_termination
80
+ return result
81
+ end
82
+
83
+ # protected
71
84
 
72
85
  def reduce_to_single_packet
73
86
  index = @data.index(@read_termination_characters)