openc3 5.9.1 → 5.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c24a28732bfd8c275b65639cd566b4823d78b70b43781bf14a82e114397e7677
4
- data.tar.gz: a8567e57ec8008d505e7f6a30cd3462e435988a46729908fbc17775f2b92e976
3
+ metadata.gz: 9c37c79f2062a5921e13c3370ce281c443b9abba929ca36f152df7cd1bcea92e
4
+ data.tar.gz: 643d74e05f61eb9016eaefbe5dca61316939e3d4e063fcf4150423cee4d95474
5
5
  SHA512:
6
- metadata.gz: dc287a9895e3ae60c6332389d0b7926bb84aa04d7d65e51c936ba65f66640b179b0baefdcec232d7775a70f2e95d88557faf5e960663c4c28840428e7cb52904
7
- data.tar.gz: 578c1f1fe45512344390492e9aa15d7af851bb81e608fbc874189dcc73bc998c472e62d449c114fb300fc58bb0d9cc269cc3dfbcbb31aaaf76c9003abd63c8e7
6
+ metadata.gz: 25285376d600c16a3d0b6d485a359998fda7226fc3781f639cdde992370291fa7d23b0ce6ca89e02ddcf4e6386dd596839ed4d8c704003b893e37e726ed1a7e4
7
+ data.tar.gz: 3ae81b7ea67047a8e23cfb161aeb77b4e7224e44b2c9c1dc4fa2dd78cb06eae50710b0a5c882cfcaf8da9e0214b6b96e517ec2a6af0b7671f5b8e8a0dc1448fe
@@ -17,7 +17,7 @@
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
19
  #
20
- # This file may also be used under the terms of a commercial license
20
+ # This file may also be used under the terms of a commercial license
21
21
  # if purchased from OpenC3, Inc.
22
22
 
23
23
  # This file contains the implementation of the BinaryAccessor class.
@@ -280,7 +280,10 @@ module OpenC3
280
280
 
281
281
  if upper_bound > lower_bound
282
282
  # Combine bytes into a FixNum
283
- temp_data[1..temp_upper].each_byte { |temp_value| temp = temp << 8; temp = temp + temp_value }
283
+ temp_data[1..temp_upper].each_byte do |temp_value|
284
+ temp = temp << 8
285
+ temp = temp + temp_value
286
+ end
284
287
  end
285
288
 
286
289
  # Shift off unwanted bits at end
@@ -172,7 +172,7 @@ module OpenC3
172
172
 
173
173
  TargetModel.set_packet(target_name, packet_name, packet, scope: scope)
174
174
 
175
- message = "Disabling Limits For '#{target_name} #{packet_name} #{item_name}'"
175
+ message = "Disabling Limits for '#{target_name} #{packet_name} #{item_name}'"
176
176
  Logger.info(message, scope: scope)
177
177
 
178
178
  event = { type: :LIMITS_ENABLE_STATE, target_name: target_name, packet_name: packet_name,
@@ -344,11 +344,11 @@ module OpenC3
344
344
  if action == :enable
345
345
  enabled = true
346
346
  item['limits']['enabled'] = true
347
- message = "Enabling Limits For '#{target_name} #{packet_name} #{item_name}'"
347
+ message = "Enabling Limits for '#{target_name} #{packet_name} #{item_name}'"
348
348
  elsif action == :disable
349
349
  enabled = false
350
350
  item['limits'].delete('enabled')
351
- message = "Disabling Limits For '#{target_name} #{packet_name} #{item_name}'"
351
+ message = "Disabling Limits for '#{target_name} #{packet_name} #{item_name}'"
352
352
  end
353
353
  Logger.info(message, scope: scope)
354
354
 
@@ -115,7 +115,11 @@ module OpenC3
115
115
  def limits_change_callback(packet, item, old_limits_state, value, log_change)
116
116
  return if @cancel_thread
117
117
  packet_time = packet.packet_time
118
- message = "#{packet.target_name} #{packet.packet_name} #{item.name} = #{value} is #{item.limits.state}"
118
+ if value
119
+ message = "#{packet.target_name} #{packet.packet_name} #{item.name} = #{value} is #{item.limits.state}"
120
+ else
121
+ message = "#{packet.target_name} #{packet.packet_name} #{item.name} is disabled"
122
+ end
119
123
  message << " (#{packet.packet_time.sys.formatted})" if packet_time
120
124
 
121
125
  time_nsec = packet_time ? packet_time.to_nsec_from_epoch : Time.now.to_nsec_from_epoch
@@ -389,6 +389,8 @@ module OpenC3
389
389
  status_model = RouterStatusModel.get_model(name: @name, scope: @scope)
390
390
  end
391
391
  status_model.destroy if status_model
392
+ rescue Exception => error
393
+ Logger.error("Error undeploying interface/router model #{@name} in scope #{@scope} due to #{error}")
392
394
  end
393
395
 
394
396
  def unmap_target(target_name, cmd_only: false, tlm_only: false)
@@ -17,7 +17,7 @@
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
19
  #
20
- # This file may also be used under the terms of a commercial license
20
+ # This file may also be used under the terms of a commercial license
21
21
  # if purchased from OpenC3, Inc.
22
22
 
23
23
  require 'openc3/models/model'
@@ -297,6 +297,8 @@ module OpenC3
297
297
  microservices.each do |name, model_instance|
298
298
  model_instance.cleanup
299
299
  end
300
+ rescue Exception => error
301
+ Logger.error("Error undeploying plugin model #{@name} in scope #{@scope} due to #{error}")
300
302
  end
301
303
 
302
304
  # Reinstall
@@ -639,6 +639,8 @@ module OpenC3
639
639
  @@item_map_cache[@name] = nil
640
640
 
641
641
  ConfigTopic.write({ kind: 'deleted', type: 'target', name: @name, plugin: @plugin }, scope: @scope)
642
+ rescue Exception => error
643
+ Logger.error("Error undeploying target model #{@name} in scope #{@scope} due to #{error}")
642
644
  end
643
645
 
644
646
  ##################################################
@@ -247,6 +247,8 @@ module OpenC3
247
247
  ConfigTopic.write({ kind: 'deleted', type: 'tool', name: @folder_name, plugin: @plugin }, scope: @scope)
248
248
  end
249
249
  end
250
+ rescue Exception => error
251
+ Logger.error("Error undeploying tool model #{@name} in scope #{@scope} due to #{error}")
250
252
  end
251
253
 
252
254
  ##################################################
@@ -139,6 +139,8 @@ module OpenC3
139
139
  bucket = Bucket.getClient()
140
140
  bucket.delete_object(bucket: ENV['OPENC3_TOOLS_BUCKET'], key: @bucket_key)
141
141
  bucket.delete_object(bucket: ENV['OPENC3_TOOLS_BUCKET'], key: @bucket_key + '.map')
142
+ rescue Exception => error
143
+ Logger.error("Error undeploying widget model #{@name} in scope #{@scope} due to #{error}")
142
144
  end
143
145
  end
144
146
  end
@@ -17,7 +17,7 @@
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
19
  #
20
- # This file may also be used under the terms of a commercial license
20
+ # This file may also be used under the terms of a commercial license
21
21
  # if purchased from OpenC3, Inc.
22
22
 
23
23
  require 'openc3/packets/binary_accessor'
@@ -518,7 +518,7 @@ module OpenC3
518
518
  # Take the structure mutex to ensure the buffer does not change while you perform activities
519
519
  def synchronize
520
520
  setup_mutex()
521
- @mutex.synchronize { || yield }
521
+ @mutex.synchronize { || yield } #|
522
522
  end
523
523
 
524
524
  # Take the structure mutex to ensure the buffer does not change while you perform activities
@@ -17,7 +17,7 @@
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
19
  #
20
- # This file may also be used under the terms of a commercial license
20
+ # This file may also be used under the terms of a commercial license
21
21
  # if purchased from OpenC3, Inc.
22
22
 
23
23
  require 'openc3/ext/packet' if RUBY_ENGINE == 'ruby' and !ENV['OPENC3_NO_EXT']
@@ -135,14 +135,7 @@ module OpenC3
135
135
  end
136
136
 
137
137
  def bit_offset=(bit_offset)
138
- if 0.class == Integer
139
- # Ruby version >= 2.4.0
140
- raise ArgumentError, "#{@name}: bit_offset must be an Integer" unless Integer === bit_offset
141
- else
142
- # Ruby version < 2.4.0
143
- raise ArgumentError, "#{@name}: bit_offset must be a Fixnum" unless Fixnum === bit_offset
144
- end
145
-
138
+ raise ArgumentError, "#{@name}: bit_offset must be an Integer" unless Integer === bit_offset
146
139
  byte_aligned = ((bit_offset % 8) == 0)
147
140
  if (@data_type == :FLOAT or @data_type == :STRING or @data_type == :BLOCK) and !byte_aligned
148
141
  raise ArgumentError, "#{@name}: bit_offset for :FLOAT, :STRING, and :BLOCK items must be byte aligned"
@@ -156,18 +149,14 @@ module OpenC3
156
149
  end
157
150
 
158
151
  def bit_size=(bit_size)
159
- if 0.class == Integer
160
- # Ruby version >= 2.4.0
161
- raise ArgumentError, "#{name}: bit_size must be an Integer" unless Integer === bit_size
162
- else
163
- # Ruby version < 2.4.0
164
- raise ArgumentError, "#{name}: bit_size must be a Fixnum" unless Fixnum === bit_size
165
- end
152
+ raise ArgumentError, "#{@name}: bit_size must be an Integer" unless Integer === bit_size
166
153
  byte_multiple = ((bit_size % 8) == 0)
167
154
  if bit_size <= 0 and (@data_type == :INT or @data_type == :UINT or @data_type == :FLOAT)
168
155
  raise ArgumentError, "#{@name}: bit_size cannot be negative or zero for :INT, :UINT, and :FLOAT items: #{bit_size}"
169
156
  end
170
- raise ArgumentError, "#{@name}: bit_size for STRING and BLOCK items must be byte multiples" if (@data_type == :STRING or @data_type == :BLOCK) and !byte_multiple
157
+ if (@data_type == :STRING or @data_type == :BLOCK) and !byte_multiple
158
+ raise ArgumentError, "#{@name}: bit_size for STRING and BLOCK items must be byte multiples"
159
+ end
171
160
  if @data_type == :FLOAT and bit_size != 32 and bit_size != 64
172
161
  raise ArgumentError, "#{@name}: bit_size for FLOAT items must be 32 or 64. Given: #{bit_size}"
173
162
  end
@@ -195,13 +184,7 @@ module OpenC3
195
184
 
196
185
  def array_size=(array_size)
197
186
  if array_size
198
- if 0.class == Integer
199
- # Ruby version >= 2.4.0
200
- raise ArgumentError, "#{@name}: array_size must be an Integer" unless Integer === array_size
201
- else
202
- # Ruby version < 2.4.0
203
- raise ArgumentError, "#{@name}: array_size must be a Fixnum" unless Fixnum === array_size
204
- end
187
+ raise ArgumentError, "#{@name}: array_size must be an Integer" unless Integer === array_size
205
188
  raise ArgumentError, "#{@name}: array_size must be a multiple of bit_size" unless @bit_size == 0 or (array_size % @bit_size == 0) or array_size < 0
206
189
  raise ArgumentError, "#{@name}: bit_size cannot be negative or zero for array items" if @bit_size <= 0
207
190
  end
@@ -44,17 +44,14 @@ module OpenC3
44
44
  _check(*args, scope: scope) { |tgt, pkt, item| tlm(tgt, pkt, item, type: type, scope: scope, token: token) }
45
45
  end
46
46
 
47
- # @deprecated Use check with type: :RAW
48
47
  def check_raw(*args, scope: $openc3_scope, token: $openc3_token)
49
48
  check(*args, type: :RAW, scope: scope, token: token)
50
49
  end
51
50
 
52
- # @deprecated Use check with type: :FORMATTED
53
51
  def check_formatted(*args, scope: $openc3_scope, token: $openc3_token)
54
52
  check(*args, type: :FORMATTED, scope: scope, token: token)
55
53
  end
56
54
 
57
- # @deprecated Use check with type: :WITH_UNITS
58
55
  def check_with_units(*args, scope: $openc3_scope, token: $openc3_token)
59
56
  check(*args, type: :WITH_UNITS, scope: scope, token: token)
60
57
  end
@@ -90,10 +87,10 @@ module OpenC3
90
87
  raise "Invalid type '#{type}' for check_tolerance" unless %i(RAW CONVERTED).include?(type)
91
88
 
92
89
  target_name, packet_name, item_name, expected_value, tolerance =
93
- _check_tolerance_process_args(args, scope: scope, token: token)
90
+ _check_tolerance_process_args(args)
94
91
  value = tlm(target_name, packet_name, item_name, type: type, scope: scope, token: token)
95
92
  if value.is_a?(Array)
96
- expected_value, tolerance = array_tolerance_process_args(value.size, expected_value, tolerance, 'check_tolerance', scope: scope, token: token)
93
+ expected_value, tolerance = _array_tolerance_process_args(value.size, expected_value, tolerance, 'check_tolerance')
97
94
 
98
95
  message = ""
99
96
  all_checks_ok = true
@@ -166,23 +163,23 @@ module OpenC3
166
163
  # @param args [String|Array<String>] See the description for calling style
167
164
  # @param type [Symbol] Telemetry type, :RAW, :CONVERTED (default), :FORMATTED, or :WITH_UNITS
168
165
  def wait(*args, type: :CONVERTED, quiet: false, scope: $openc3_scope, token: $openc3_token)
169
- time = nil
166
+ time_diff = nil
170
167
 
171
168
  case args.length
172
169
  # wait() # indefinitely until they click Go
173
170
  when 0
174
171
  start_time = Time.now.sys
175
172
  openc3_script_sleep()
176
- time = Time.now.sys - start_time
177
- Logger.info("WAIT: Indefinite for actual time of #{time} seconds") unless quiet
173
+ time_diff = Time.now.sys - start_time
174
+ Logger.info("WAIT: Indefinite for actual time of #{time_diff} seconds") unless quiet
178
175
 
179
176
  # wait(5) # absolute wait time
180
177
  when 1
181
178
  if args[0].kind_of? Numeric
182
179
  start_time = Time.now.sys
183
180
  openc3_script_sleep(args[0])
184
- time = Time.now.sys - start_time
185
- Logger.info("WAIT: #{args[0]} seconds with actual time of #{time} seconds") unless quiet
181
+ time_diff = Time.now.sys - start_time
182
+ Logger.info("WAIT: #{args[0]} seconds with actual time of #{time_diff} seconds") unless quiet
186
183
  else
187
184
  raise "Non-numeric wait time specified"
188
185
  end
@@ -216,7 +213,7 @@ module OpenC3
216
213
  # Invalid number of arguments
217
214
  raise "ERROR: Invalid number of arguments (#{args.length}) passed to wait()"
218
215
  end
219
- time
216
+ time_diff
220
217
  end
221
218
 
222
219
  # @deprecated Use wait with type: :RAW
@@ -235,11 +232,11 @@ module OpenC3
235
232
  def wait_tolerance(*args, type: :CONVERTED, quiet: false, scope: $openc3_scope, token: $openc3_token)
236
233
  raise "Invalid type '#{type}' for wait_tolerance" unless %i(RAW CONVERTED).include?(type)
237
234
 
238
- target_name, packet_name, item_name, expected_value, tolerance, timeout, polling_rate = _wait_tolerance_process_args(args, scope: scope, token: token)
235
+ target_name, packet_name, item_name, expected_value, tolerance, timeout, polling_rate = _wait_tolerance_process_args(args)
239
236
  start_time = Time.now.sys
240
237
  value = tlm(target_name, packet_name, item_name, type: type, scope: scope, token: token)
241
238
  if value.is_a?(Array)
242
- expected_value, tolerance = array_tolerance_process_args(value.size, expected_value, tolerance, 'wait_tolerance', scope: scope, token: token)
239
+ expected_value, tolerance = _array_tolerance_process_args(value.size, expected_value, tolerance, 'wait_tolerance')
243
240
 
244
241
  success, value = openc3_script_wait_implementation_array_tolerance(value.size, target_name, packet_name, item_name, type, expected_value, tolerance, timeout, polling_rate, scope: scope, token: token)
245
242
  time = Time.now.sys - start_time
@@ -285,13 +282,13 @@ module OpenC3
285
282
  def wait_expression(exp_to_eval, timeout, polling_rate = DEFAULT_TLM_POLLING_RATE, context = nil, quiet: false, scope: $openc3_scope, token: $openc3_token)
286
283
  start_time = Time.now.sys
287
284
  success = openc3_script_wait_implementation_expression(exp_to_eval, timeout, polling_rate, context, scope: scope, token: token)
288
- time = Time.now.sys - start_time
285
+ time_diff = Time.now.sys - start_time
289
286
  if success
290
- Logger.info "WAIT: #{exp_to_eval} is TRUE after waiting #{time} seconds" unless quiet
287
+ Logger.info "WAIT: #{exp_to_eval} is TRUE after waiting #{time_diff} seconds" unless quiet
291
288
  else
292
- Logger.warn "WAIT: #{exp_to_eval} is FALSE after waiting #{time} seconds" unless quiet
289
+ Logger.warn "WAIT: #{exp_to_eval} is FALSE after waiting #{time_diff} seconds" unless quiet
293
290
  end
294
- time
291
+ time_diff
295
292
  end
296
293
 
297
294
  # Wait for the converted value of a telmetry item against a condition or for a timeout
@@ -304,13 +301,13 @@ module OpenC3
304
301
  # @param args [String|Array<String>] See the description for calling style
305
302
  # @param type [Symbol] Telemetry type, :RAW, :CONVERTED (default), :FORMATTED, or :WITH_UNITS
306
303
  def wait_check(*args, type: :CONVERTED, scope: $openc3_scope, token: $openc3_token, &block)
307
- target_name, packet_name, item_name, comparison_to_eval, timeout, polling_rate = _wait_check_process_args(args, scope: scope, token: token)
304
+ target_name, packet_name, item_name, comparison_to_eval, timeout, polling_rate = _wait_check_process_args(args)
308
305
  start_time = Time.now.sys
309
306
  success, value = openc3_script_wait_implementation(target_name, packet_name, item_name, type, comparison_to_eval, timeout, polling_rate, scope: scope, token: token, &block)
310
307
  value = "'#{value}'" if value.is_a? String # Show user the check against a quoted string
311
- time = Time.now.sys - start_time
308
+ time_diff = Time.now.sys - start_time
312
309
  check_str = "CHECK: #{_upcase(target_name, packet_name, item_name)} #{comparison_to_eval}"
313
- with_value_str = "with value == #{value} after waiting #{time} seconds"
310
+ with_value_str = "with value == #{value} after waiting #{time_diff} seconds"
314
311
  if success
315
312
  Logger.info "#{check_str} success #{with_value_str}"
316
313
  else
@@ -321,7 +318,7 @@ module OpenC3
321
318
  raise CheckError, message
322
319
  end
323
320
  end
324
- time
321
+ time_diff
325
322
  end
326
323
 
327
324
  # @deprecated use wait_check with type: :RAW
@@ -341,20 +338,20 @@ module OpenC3
341
338
  def wait_check_tolerance(*args, type: :CONVERTED, scope: $openc3_scope, token: $openc3_token, &block)
342
339
  raise "Invalid type '#{type}' for wait_check_tolerance" unless %i(RAW CONVERTED).include?(type)
343
340
 
344
- target_name, packet_name, item_name, expected_value, tolerance, timeout, polling_rate = _wait_tolerance_process_args(args, scope: scope, token: token)
341
+ target_name, packet_name, item_name, expected_value, tolerance, timeout, polling_rate = _wait_tolerance_process_args(args)
345
342
  start_time = Time.now.sys
346
343
  value = tlm(target_name, packet_name, item_name, type: type, scope: scope, token: token)
347
344
  if value.is_a?(Array)
348
- expected_value, tolerance = array_tolerance_process_args(value.size, expected_value, tolerance, 'wait_check_tolerance', scope: scope, token: token)
345
+ expected_value, tolerance = _array_tolerance_process_args(value.size, expected_value, tolerance, 'wait_check_tolerance')
349
346
 
350
347
  success, value = openc3_script_wait_implementation_array_tolerance(value.size, target_name, packet_name, item_name, type, expected_value, tolerance, timeout, polling_rate, scope: scope, token: token, &block)
351
- time = Time.now.sys - start_time
348
+ time_diff = Time.now.sys - start_time
352
349
 
353
350
  message = ""
354
351
  value.size.times do |i|
355
352
  range = (expected_value[i] - tolerance[i]..expected_value[i] + tolerance[i])
356
353
  check_str = "CHECK: #{_upcase(target_name, packet_name, item_name)}[#{i}]"
357
- range_str = "range #{range.first} to #{range.last} with value == #{value[i]} after waiting #{time} seconds"
354
+ range_str = "range #{range.first} to #{range.last} with value == #{value[i]} after waiting #{time_diff} seconds"
358
355
  if range.include?(value[i])
359
356
  message << "#{check_str} was within #{range_str}\n"
360
357
  else
@@ -373,10 +370,10 @@ module OpenC3
373
370
  end
374
371
  else
375
372
  success, value = openc3_script_wait_implementation_tolerance(target_name, packet_name, item_name, type, expected_value, tolerance, timeout, polling_rate, scope: scope, token: token)
376
- time = Time.now.sys - start_time
373
+ time_diff = Time.now.sys - start_time
377
374
  range = (expected_value - tolerance)..(expected_value + tolerance)
378
375
  check_str = "CHECK: #{_upcase(target_name, packet_name, item_name)}"
379
- range_str = "range #{range.first} to #{range.last} with value == #{value} after waiting #{time} seconds"
376
+ range_str = "range #{range.first} to #{range.last} with value == #{value} after waiting #{time_diff} seconds"
380
377
  if success
381
378
  Logger.info "#{check_str} was within #{range_str}"
382
379
  else
@@ -388,7 +385,7 @@ module OpenC3
388
385
  end
389
386
  end
390
387
  end
391
- time
388
+ time_diff
392
389
  end
393
390
 
394
391
  # @deprecated Use wait_check_tolerance with type: :RAW
@@ -407,18 +404,18 @@ module OpenC3
407
404
  timeout,
408
405
  polling_rate,
409
406
  context, scope: scope, token: token, &block)
410
- time = Time.now.sys - start_time
407
+ time_diff = Time.now.sys - start_time
411
408
  if success
412
- Logger.info "CHECK: #{exp_to_eval} is TRUE after waiting #{time} seconds"
409
+ Logger.info "CHECK: #{exp_to_eval} is TRUE after waiting #{time_diff} seconds"
413
410
  else
414
- message = "CHECK: #{exp_to_eval} is FALSE after waiting #{time} seconds"
411
+ message = "CHECK: #{exp_to_eval} is FALSE after waiting #{time_diff} seconds"
415
412
  if $disconnect
416
413
  Logger.error message
417
414
  else
418
415
  raise CheckError, message
419
416
  end
420
417
  end
421
- time
418
+ time_diff
422
419
  end
423
420
  alias wait_expression_stop_on_timeout wait_check_expression
424
421
 
@@ -483,7 +480,7 @@ module OpenC3
483
480
  ###########################################################################
484
481
  # Scripts Outside of ScriptRunner Support
485
482
  # ScriptRunner overrides these methods to work in the OpenC3 cluster
486
- # They are only here to allow for scripts to have a change to work
483
+ # They are only here to allow for scripts to have a chance to work
487
484
  # unaltered outside of the cluster
488
485
  ###########################################################################
489
486
 
@@ -534,17 +531,17 @@ module OpenC3
534
531
  # caller to allow the return of the value through various telemetry calls.
535
532
  # This method should not be called directly by application code.
536
533
  def _check(*args, scope: $openc3_scope, token: $openc3_token)
537
- target_name, packet_name, item_name, comparison_to_eval = _check_process_args(args, 'check', scope: scope, token: token)
534
+ target_name, packet_name, item_name, comparison_to_eval = _check_process_args(args, 'check')
538
535
 
539
536
  value = yield(target_name, packet_name, item_name)
540
537
  if comparison_to_eval
541
- check_eval(target_name, packet_name, item_name, comparison_to_eval, value, scope: scope)
538
+ _check_eval(target_name, packet_name, item_name, comparison_to_eval, value)
542
539
  else
543
540
  Logger.info "CHECK: #{_upcase(target_name, packet_name, item_name)} == #{value}"
544
541
  end
545
542
  end
546
543
 
547
- def _check_process_args(args, method_name, scope: $openc3_scope, token: $openc3_token)
544
+ def _check_process_args(args, method_name)
548
545
  case args.length
549
546
  when 1
550
547
  target_name, packet_name, item_name, comparison_to_eval = extract_fields_from_check_text(args[0])
@@ -557,10 +554,11 @@ module OpenC3
557
554
  # Invalid number of arguments
558
555
  raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{method_name}()"
559
556
  end
557
+ raise "Invalid comparison to non-ascii value" unless comparison_to_eval.is_printable?
560
558
  return [target_name, packet_name, item_name, comparison_to_eval]
561
559
  end
562
560
 
563
- def _check_tolerance_process_args(args, scope: $openc3_scope, token: $openc3_token)
561
+ def _check_tolerance_process_args(args)
564
562
  case args.length
565
563
  when 3
566
564
  target_name, packet_name, item_name = extract_fields_from_tlm_text(args[0])
@@ -612,11 +610,11 @@ module OpenC3
612
610
  token: token)
613
611
  # If the packet has not been received the value could be nil
614
612
  value = 0 unless value
615
- time = Time.now.sys - start_time
613
+ time_diff = Time.now.sys - start_time
616
614
  if success
617
- Logger.info "#{type}: #{target_name.upcase} #{packet_name.upcase} received #{value - initial_count} times after waiting #{time} seconds" unless quiet
615
+ Logger.info "#{type}: #{target_name.upcase} #{packet_name.upcase} received #{value - initial_count} times after waiting #{time_diff} seconds" unless quiet
618
616
  else
619
- message = "#{type}: #{target_name.upcase} #{packet_name.upcase} expected to be received #{num_packets} times but only received #{value - initial_count} times after waiting #{time} seconds"
617
+ message = "#{type}: #{target_name.upcase} #{packet_name.upcase} expected to be received #{num_packets} times but only received #{value - initial_count} times after waiting #{time_diff} seconds"
620
618
  if check
621
619
  if $disconnect
622
620
  Logger.error message
@@ -627,16 +625,16 @@ module OpenC3
627
625
  Logger.warn message unless quiet
628
626
  end
629
627
  end
630
- time
628
+ time_diff
631
629
  end
632
630
 
633
631
  def _execute_wait(target_name, packet_name, item_name, value_type, comparison_to_eval, timeout, polling_rate, quiet: false, scope: $openc3_scope, token: $openc3_token)
634
632
  start_time = Time.now.sys
635
633
  success, value = openc3_script_wait_implementation(target_name, packet_name, item_name, value_type, comparison_to_eval, timeout, polling_rate, scope: scope, token: token)
636
634
  value = "'#{value}'" if value.is_a? String # Show user the check against a quoted string
637
- time = Time.now.sys - start_time
635
+ time_diff = Time.now.sys - start_time
638
636
  wait_str = "WAIT: #{_upcase(target_name, packet_name, item_name)} #{comparison_to_eval}"
639
- value_str = "with value == #{value} after waiting #{time} seconds"
637
+ value_str = "with value == #{value} after waiting #{time_diff} seconds"
640
638
  if success
641
639
  Logger.info "#{wait_str} success #{value_str}" unless quiet
642
640
  else
@@ -644,7 +642,7 @@ module OpenC3
644
642
  end
645
643
  end
646
644
 
647
- def _wait_tolerance_process_args(args, scope: $openc3_scope, token: $openc3_token)
645
+ def _wait_tolerance_process_args(args)
648
646
  case args.length
649
647
  when 4, 5
650
648
  target_name, packet_name, item_name = extract_fields_from_tlm_text(args[0])
@@ -686,7 +684,7 @@ module OpenC3
686
684
  # When testing an array with a tolerance, the expected value and tolerance
687
685
  # can both be supplied as either an array or a single value. If a single
688
686
  # value is passed in, that value will be used for all array elements.
689
- def array_tolerance_process_args(array_size, expected_value, tolerance, method_name, scope: $openc3_scope, token: $openc3_token)
687
+ def _array_tolerance_process_args(array_size, expected_value, tolerance, method_name)
690
688
  if expected_value.is_a?(Array)
691
689
  if array_size != expected_value.size
692
690
  raise "ERROR: Invalid array size for expected_value passed to #{method_name}()"
@@ -704,7 +702,7 @@ module OpenC3
704
702
  return [expected_value, tolerance]
705
703
  end
706
704
 
707
- def _wait_check_process_args(args, scope: $openc3_scope, token: $openc3_token)
705
+ def _wait_check_process_args(args)
708
706
  case args.length
709
707
  when 2, 3
710
708
  target_name, packet_name, item_name, comparison_to_eval = extract_fields_from_check_text(args[0])
@@ -849,8 +847,7 @@ module OpenC3
849
847
  end
850
848
  end
851
849
 
852
- def check_eval(target_name, packet_name, item_name, comparison_to_eval, value, scope: $openc3_scope, token: $openc3_token)
853
- raise "Invalid comparison to non-ascii value" unless comparison_to_eval.is_printable?
850
+ def _check_eval(target_name, packet_name, item_name, comparison_to_eval, value)
854
851
  string = "value " + comparison_to_eval
855
852
  check_str = "CHECK: #{_upcase(target_name, packet_name, item_name)} #{comparison_to_eval}"
856
853
  # Show user the check against a quoted string
@@ -405,9 +405,9 @@ end
405
405
  # # Environment variables are already set inside of our containers
406
406
  # # START OUTSIDE OF DOCKER ONLY
407
407
  # $openc3_scope = 'DEFAULT'
408
- # ENV['OPENC3_API_HOSTNAME'] = 'localhost'
408
+ # ENV['OPENC3_API_HOSTNAME'] = '127.0.0.1'
409
409
  # ENV['OPENC3_API_PORT'] = '2900'
410
- # ENV['OPENC3_SCRIPT_API_HOSTNAME'] = 'localhost'
410
+ # ENV['OPENC3_SCRIPT_API_HOSTNAME'] = '127.0.0.1'
411
411
  # ENV['OPENC3_SCRIPT_API_PORT'] = '2900'
412
412
  # ENV['OPENC3_API_PASSWORD'] = 'password'
413
413
  # # END OUTSIDE OF DOCKER ONLY
@@ -17,7 +17,7 @@
17
17
  # All changes Copyright 2022, OpenC3, Inc.
18
18
  # All Rights Reserved
19
19
  #
20
- # This file may also be used under the terms of a commercial license
20
+ # This file may also be used under the terms of a commercial license
21
21
  # if purchased from OpenC3, Inc.
22
22
 
23
23
  require 'openc3/config/config_parser'
@@ -226,8 +226,8 @@ module OpenC3
226
226
  # Process the target's configuration file if it exists
227
227
  def process_target_config_file
228
228
  @filename = File.join(@dir, 'target.txt')
229
- if File.exist?(filename)
230
- process_file(filename)
229
+ if File.exist?(@filename)
230
+ process_file(@filename)
231
231
  else
232
232
  @filename = nil
233
233
  end
@@ -43,7 +43,7 @@ class HazardousError < StandardError
43
43
  attr_accessor :formatted # formatted command for use in resending original
44
44
 
45
45
  def to_s
46
- string = "#{target_name} #{cmd_name} with #{cmd_params} is Hazardous"
46
+ string = "#{target_name} #{cmd_name} with #{cmd_params} is Hazardous "
47
47
  string << "due to '#{hazardous_description}'" if hazardous_description
48
48
  # Pass along the original formatted command so it can be resent
49
49
  string << ".\n#{formatted}"
@@ -98,7 +98,6 @@ module OpenC3
98
98
  rescue OpenC3AuthenticationError
99
99
  return nil
100
100
  end
101
- return nil
102
101
  end
103
102
 
104
103
  private
@@ -213,10 +213,14 @@ module OpenC3
213
213
 
214
214
  def delete_object(bucket:, key:)
215
215
  @client.delete_object(bucket: bucket, key: key)
216
+ rescue Exception
217
+ Logger.error("Error deleting object bucket: #{bucket}, key: #{key}")
216
218
  end
217
219
 
218
220
  def delete_objects(bucket:, keys:)
219
221
  @client.delete_objects(bucket: bucket, delete: { objects: keys.map {|key| { key: key } } })
222
+ rescue Exception
223
+ Logger.error("Error deleting objects bucket: #{bucket}, keys: #{keys}")
220
224
  end
221
225
 
222
226
  def presigned_request(bucket:, key:, method:, internal: true)
@@ -196,12 +196,12 @@ module OpenC3
196
196
  # store.trim_topic('MANGO__TOPIC', 1000, approximate: 'true', limit: 0)
197
197
  #
198
198
  # @param topic [String] the stream key
199
- # @param minid [Integer] mid id length of entries to trim
199
+ # @param minid [Integer] Id to throw away data up to
200
200
  # @param approximate [Boolean] whether to add `~` modifier of maxlen or not
201
- # @param limit [Boolean] whether to add `~` modifier of maxlen or not
201
+ # @param limit [Boolean] number of items to return from the call
202
202
  #
203
203
  # @return [Integer] the number of entries actually deleted
204
- def trim_topic(topic, minid, approximate = 'true', limit: 0)
204
+ def trim_topic(topic, minid, approximate = true, limit: 0)
205
205
  @redis_pool.with do |redis|
206
206
  return redis.xtrim_minid(topic, minid, approximate: approximate, limit: limit)
207
207
  end
@@ -218,8 +218,8 @@ module OpenC3
218
218
  end
219
219
 
220
220
  class Redis
221
- def xtrim_minid(key, minid, approximate: 'true', limit: nil)
222
- args = [:xtrim, key, :MINID, (approximate ? '~' : nil), minid].compact
221
+ def xtrim_minid(key, minid, approximate: true, limit: nil)
222
+ args = [:xtrim, key, :MINID, (approximate ? '~' : '='), minid]
223
223
  args.concat([:LIMIT, limit]) if limit
224
224
  send_command(args)
225
225
  end
@@ -1,14 +1,14 @@
1
1
  # encoding: ascii-8bit
2
2
 
3
- OPENC3_VERSION = '5.9.1'
3
+ OPENC3_VERSION = '5.10.0'
4
4
  module OpenC3
5
5
  module Version
6
6
  MAJOR = '5'
7
- MINOR = '9'
8
- PATCH = '1'
7
+ MINOR = '10'
8
+ PATCH = '0'
9
9
  OTHER = ''
10
- BUILD = 'e60c6e1f7e80f87eae7bc623986940da5449d6ad'
10
+ BUILD = '926e6a3798993710a67729b9599c5a295b210152'
11
11
  end
12
- VERSION = '5.9.1'
13
- GEM_VERSION = '5.9.1'
12
+ VERSION = '5.10.0'
13
+ GEM_VERSION = '5.10.0'
14
14
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "<%= tool_name %>",
3
- "version": "5.9.1",
3
+ "version": "5.10.0",
4
4
  "scripts": {
5
5
  "ng": "ng",
6
6
  "start": "ng serve",
@@ -22,7 +22,7 @@
22
22
  "@angular/platform-browser": "^16.1.3",
23
23
  "@angular/platform-browser-dynamic": "^16.1.3",
24
24
  "@angular/router": "^16.1.3",
25
- "@openc3/tool-common": "5.9.1",
25
+ "@openc3/tool-common": "5.10.0",
26
26
  "rxjs": "~7.8.0",
27
27
  "single-spa": ">=5.9.5",
28
28
  "single-spa-angular": "^8.1.0",
@@ -45,7 +45,7 @@
45
45
  "@emotion/react": "^11.11.1",
46
46
  "@emotion/styled": "^11.11.0",
47
47
  "@mui/material": "^5.13.6",
48
- "@openc3/tool-common": "5.9.1",
48
+ "@openc3/tool-common": "5.10.0",
49
49
  "react": "^18.2.0",
50
50
  "react-dom": "^18.2.0",
51
51
  "single-spa-react": "^5.1.1"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "<%= tool_name %>",
3
- "version": "5.9.1",
3
+ "version": "5.10.0",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -11,7 +11,7 @@
11
11
  "test:components": "vue-cli-service test:components"
12
12
  },
13
13
  "dependencies": {
14
- "@openc3/tool-common": "5.9.1",
14
+ "@openc3/tool-common": "5.10.0",
15
15
  "axios": "0.27.2",
16
16
  "date-fns": "2.30.0",
17
17
  "portal-vue": "2.1.7",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "widget",
3
- "version": "5.9.1",
3
+ "version": "5.10.0",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "build": "vue-cli-service build --target lib --dest tools/widgets/<%= widget_name %> --formats umd-min <%= widget_path %> --name <%= widget_name %>"
7
7
  },
8
8
  "dependencies": {
9
- "@openc3/tool-common": "5.9.1",
9
+ "@openc3/tool-common": "5.10.0",
10
10
  "vue": "2.7.14",
11
11
  "vuetify": "2.6.14"
12
12
  },
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openc3
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.9.1
4
+ version: 5.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Melton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-07-17 00:00:00.000000000 Z
12
+ date: 2023-08-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler