openc3 5.4.1 → 5.4.2
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.
- checksums.yaml +4 -4
- data/lib/openc3/api/tlm_api.rb +11 -4
- data/lib/openc3/microservices/interface_microservice.rb +21 -15
- data/lib/openc3/models/cvt_model.rb +33 -0
- data/lib/openc3/script/api_shared.rb +5 -5
- data/lib/openc3/script/telemetry.rb +37 -0
- data/lib/openc3/version.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08e9c285070449047388f035c8c56522154ed54cd9e075dc3b52e87f17a7ff0e'
|
4
|
+
data.tar.gz: d52d4c20ffd7f7ea1593d19df3be807d7dc4cc787e30390d11f8c1b90103c186
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e242af794c1263642f951c46867ce5fa543ccef505c60c0d6a4015c91503acf8d62b3b7b8dd40b91ec4c252013b4a40eec21d0bb3055bc5f6ae11e370c48fbe
|
7
|
+
data.tar.gz: 06b2ad289fcd4bfbfa23a896469b1d9d4b55b017e4535eb060a101147b4b757535f071dd622121f78923a2d0e1923795e109b94d3c6917933e0ce74e11c586cd
|
data/lib/openc3/api/tlm_api.rb
CHANGED
@@ -37,6 +37,7 @@ module OpenC3
|
|
37
37
|
'set_tlm',
|
38
38
|
'inject_tlm',
|
39
39
|
'override_tlm',
|
40
|
+
'get_overrides',
|
40
41
|
'normalize_tlm',
|
41
42
|
'get_tlm_buffer',
|
42
43
|
'get_tlm_packet',
|
@@ -169,6 +170,12 @@ module OpenC3
|
|
169
170
|
CvtModel.override(target_name, packet_name, item_name, value, type: type.intern, scope: scope)
|
170
171
|
end
|
171
172
|
|
173
|
+
# Get the list of CVT overrides
|
174
|
+
def get_overrides(scope: $openc3_scope, token: $openc3_token)
|
175
|
+
authorize(permission: 'tlm', scope: scope, token: token)
|
176
|
+
CvtModel.overrides(scope: scope)
|
177
|
+
end
|
178
|
+
|
172
179
|
# Normalize a telemetry item in a packet to its default behavior. Called
|
173
180
|
# after override_tlm to restore standard processing.
|
174
181
|
#
|
@@ -394,7 +401,7 @@ module OpenC3
|
|
394
401
|
return nil
|
395
402
|
end
|
396
403
|
|
397
|
-
def tlm_process_args(args,
|
404
|
+
def tlm_process_args(args, method_name, scope: $openc3_scope, token: $openc3_token)
|
398
405
|
case args.length
|
399
406
|
when 1
|
400
407
|
target_name, packet_name, item_name = extract_fields_from_tlm_text(args[0])
|
@@ -404,7 +411,7 @@ module OpenC3
|
|
404
411
|
item_name = args[2]
|
405
412
|
else
|
406
413
|
# Invalid number of arguments
|
407
|
-
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{
|
414
|
+
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{method_name}()"
|
408
415
|
end
|
409
416
|
if packet_name == 'LATEST'
|
410
417
|
latest = -1
|
@@ -429,7 +436,7 @@ module OpenC3
|
|
429
436
|
return [target_name, packet_name, item_name]
|
430
437
|
end
|
431
438
|
|
432
|
-
def set_tlm_process_args(args,
|
439
|
+
def set_tlm_process_args(args, method_name, scope: $openc3_scope, token: $openc3_token)
|
433
440
|
case args.length
|
434
441
|
when 1
|
435
442
|
target_name, packet_name, item_name, value = extract_fields_from_set_tlm_text(args[0])
|
@@ -440,7 +447,7 @@ module OpenC3
|
|
440
447
|
value = args[3]
|
441
448
|
else
|
442
449
|
# Invalid number of arguments
|
443
|
-
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{
|
450
|
+
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{method_name}()"
|
444
451
|
end
|
445
452
|
# Determine if this item exists, it will raise appropriate errors if not
|
446
453
|
TargetModel.packet_item(target_name, packet_name, item_name, scope: scope)
|
@@ -362,14 +362,18 @@ module OpenC3
|
|
362
362
|
@interface.tlm_target_names.each do |target_name|
|
363
363
|
# Initialize the target's packet counters based on the Topic stream
|
364
364
|
# Prevents packet count resetting to 0 when interface restarts
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
365
|
+
begin
|
366
|
+
System.telemetry.packets(target_name).each do |packet_name, packet|
|
367
|
+
topic = "#{@scope}__TELEMETRY__{#{target_name}}__#{packet_name}"
|
368
|
+
msg_id, msg_hash = Topic.get_newest_message(topic)
|
369
|
+
if msg_id
|
370
|
+
packet.received_count = msg_hash['received_count'].to_i
|
371
|
+
else
|
372
|
+
packet.received_count = 0
|
373
|
+
end
|
372
374
|
end
|
375
|
+
rescue
|
376
|
+
# Handle targets without telemetry
|
373
377
|
end
|
374
378
|
end
|
375
379
|
if @interface.connect_on_startup
|
@@ -649,15 +653,17 @@ module OpenC3
|
|
649
653
|
# Need to make sure that @cancel_thread is set and the interface disconnected within
|
650
654
|
# mutex to ensure that connect() is not called when we want to stop()
|
651
655
|
@cancel_thread = true
|
652
|
-
@handler_thread.stop
|
653
|
-
@interface_thread_sleeper.cancel
|
654
|
-
@interface
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
656
|
+
@handler_thread.stop if @handler_thread
|
657
|
+
@interface_thread_sleeper.cancel if @interface_thread_sleeper
|
658
|
+
if @interface
|
659
|
+
@interface.disconnect
|
660
|
+
if @interface_or_router == 'INTERFACE'
|
661
|
+
valid_interface = InterfaceStatusModel.get_model(name: @interface.name, scope: @scope)
|
662
|
+
else
|
663
|
+
valid_interface = RouterStatusModel.get_model(name: @interface.name, scope: @scope)
|
664
|
+
end
|
665
|
+
valid_interface.destroy if valid_interface
|
659
666
|
end
|
660
|
-
valid_interface.destroy if valid_interface
|
661
667
|
end
|
662
668
|
end
|
663
669
|
|
@@ -21,6 +21,7 @@
|
|
21
21
|
# if purchased from OpenC3, Inc.
|
22
22
|
|
23
23
|
require 'openc3/utilities/store'
|
24
|
+
require 'openc3/models/target_model'
|
24
25
|
|
25
26
|
module OpenC3
|
26
27
|
class CvtModel
|
@@ -144,6 +145,38 @@ module OpenC3
|
|
144
145
|
results
|
145
146
|
end
|
146
147
|
|
148
|
+
# Return all the overrides
|
149
|
+
def self.overrides(scope: $openc3_scope)
|
150
|
+
overrides = []
|
151
|
+
TargetModel.names(scope: scope).each do |target_name|
|
152
|
+
all = Store.hgetall("#{scope}__override__#{target_name}")
|
153
|
+
next if all.nil? or all.empty?
|
154
|
+
all.each do |packet_name, hash|
|
155
|
+
items = JSON.parse(hash, :allow_nan => true, :create_additions => true)
|
156
|
+
items.each do |key, value|
|
157
|
+
item = {}
|
158
|
+
item['target_name'] = target_name
|
159
|
+
item['packet_name'] = packet_name
|
160
|
+
item_name, value_type_key = key.split('__')
|
161
|
+
item['item_name'] = item_name
|
162
|
+
case value_type_key
|
163
|
+
when 'U'
|
164
|
+
item['value_type'] = 'WITH_UNITS'
|
165
|
+
when 'F'
|
166
|
+
item['value_type'] = 'FORMATTED'
|
167
|
+
when 'C'
|
168
|
+
item['value_type'] = 'CONVERTED'
|
169
|
+
else
|
170
|
+
item['value_type'] = 'RAW'
|
171
|
+
end
|
172
|
+
item['value'] = value
|
173
|
+
overrides << item
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
overrides
|
178
|
+
end
|
179
|
+
|
147
180
|
# Override a current value table item such that it always returns the same value
|
148
181
|
# for the given type
|
149
182
|
def self.override(target_name, packet_name, item_name, value, type: :ALL, scope: $openc3_scope)
|
@@ -538,7 +538,7 @@ module OpenC3
|
|
538
538
|
end
|
539
539
|
end
|
540
540
|
|
541
|
-
def _check_process_args(args,
|
541
|
+
def _check_process_args(args, method_name, scope: $openc3_scope, token: $openc3_token)
|
542
542
|
case args.length
|
543
543
|
when 1
|
544
544
|
target_name, packet_name, item_name, comparison_to_eval = extract_fields_from_check_text(args[0])
|
@@ -549,7 +549,7 @@ module OpenC3
|
|
549
549
|
comparison_to_eval = args[3]
|
550
550
|
else
|
551
551
|
# Invalid number of arguments
|
552
|
-
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{
|
552
|
+
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{method_name}()"
|
553
553
|
end
|
554
554
|
return [target_name, packet_name, item_name, comparison_to_eval]
|
555
555
|
end
|
@@ -679,17 +679,17 @@ module OpenC3
|
|
679
679
|
# When testing an array with a tolerance, the expected value and tolerance
|
680
680
|
# can both be supplied as either an array or a single value. If a single
|
681
681
|
# value is passed in, that value will be used for all array elements.
|
682
|
-
def array_tolerance_process_args(array_size, expected_value, tolerance,
|
682
|
+
def array_tolerance_process_args(array_size, expected_value, tolerance, method_name, scope: $openc3_scope, token: $openc3_token)
|
683
683
|
if expected_value.is_a?(Array)
|
684
684
|
if array_size != expected_value.size
|
685
|
-
raise "ERROR: Invalid array size for expected_value passed to #{
|
685
|
+
raise "ERROR: Invalid array size for expected_value passed to #{method_name}()"
|
686
686
|
end
|
687
687
|
else
|
688
688
|
expected_value = Array.new(array_size, expected_value)
|
689
689
|
end
|
690
690
|
if tolerance.is_a?(Array)
|
691
691
|
if array_size != tolerance.size
|
692
|
-
raise "ERROR: Invalid array size for tolerance passed to #{
|
692
|
+
raise "ERROR: Invalid array size for tolerance passed to #{method_name}()"
|
693
693
|
end
|
694
694
|
else
|
695
695
|
tolerance = Array.new(array_size, tolerance)
|
@@ -16,6 +16,8 @@
|
|
16
16
|
# This file may also be used under the terms of a commercial license
|
17
17
|
# if purchased from OpenC3, Inc.
|
18
18
|
|
19
|
+
require 'openc3/script/extract'
|
20
|
+
|
19
21
|
module OpenC3
|
20
22
|
module Script
|
21
23
|
private
|
@@ -39,5 +41,40 @@ module OpenC3
|
|
39
41
|
end
|
40
42
|
return id, packets
|
41
43
|
end
|
44
|
+
|
45
|
+
# inject_tlm, set_tlm, override_tlm, and normalize_tlm are implemented here simply to add a puts
|
46
|
+
# these methods modify the telemetry so the user should be notified in the Script Runner log messages
|
47
|
+
|
48
|
+
def inject_tlm(target_name, packet_name, item_hash = nil, type: :CONVERTED, scope: $openc3_scope, token: $openc3_token)
|
49
|
+
puts "inject_tlm(\"#{target_name}\", \"#{packet_name}\", #{item_hash}, type: #{type})"
|
50
|
+
$api_server.method_missing(:inject_tlm, target_name, packet_name, item_hash, type: type, scope: scope, token: token)
|
51
|
+
end
|
52
|
+
|
53
|
+
def set_tlm(*args, type: :ALL, scope: $openc3_scope, token: $openc3_token)
|
54
|
+
if args.length == 1
|
55
|
+
puts "set_tlm(\"#{args.join('')}\", type: #{type})"
|
56
|
+
else
|
57
|
+
puts "set_tlm(\"#{args.join('", "')}\", type: #{type})"
|
58
|
+
end
|
59
|
+
$api_server.method_missing(:set_tlm, *args, type: type, scope: scope, token: token)
|
60
|
+
end
|
61
|
+
|
62
|
+
def override_tlm(*args, type: :ALL, scope: $openc3_scope, token: $openc3_token)
|
63
|
+
if args.length == 1
|
64
|
+
puts "override_tlm(\"#{args.join('')}\", type: #{type})"
|
65
|
+
else
|
66
|
+
puts "override_tlm(\"#{args.join('", "')}\", type: #{type})"
|
67
|
+
end
|
68
|
+
$api_server.method_missing(:override_tlm, *args, type: type, scope: scope, token: token)
|
69
|
+
end
|
70
|
+
|
71
|
+
def normalize_tlm(*args, type: :ALL, scope: $openc3_scope, token: $openc3_token)
|
72
|
+
if args.length == 1
|
73
|
+
puts "normalize_tlm(\"#{args.join('')}\", type: #{type})"
|
74
|
+
else
|
75
|
+
puts "normalize_tlm(\"#{args.join('", "')}\", type: #{type})"
|
76
|
+
end
|
77
|
+
$api_server.method_missing(:normalize_tlm, *args, type: type, scope: scope, token: token)
|
78
|
+
end
|
42
79
|
end
|
43
80
|
end
|
data/lib/openc3/version.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# encoding: ascii-8bit
|
2
2
|
|
3
|
-
OPENC3_VERSION = '5.4.
|
3
|
+
OPENC3_VERSION = '5.4.2'
|
4
4
|
module OpenC3
|
5
5
|
module Version
|
6
6
|
MAJOR = '5'
|
7
7
|
MINOR = '4'
|
8
|
-
PATCH = '
|
8
|
+
PATCH = '2'
|
9
9
|
OTHER = ''
|
10
|
-
BUILD = '
|
10
|
+
BUILD = '6a7f2b4ff8e1255aa4d9768b539211b175cb9ec7'
|
11
11
|
end
|
12
|
-
VERSION = '5.4.
|
13
|
-
GEM_VERSION = '5.4.
|
12
|
+
VERSION = '5.4.2'
|
13
|
+
GEM_VERSION = '5.4.2'
|
14
14
|
end
|
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.4.
|
4
|
+
version: 5.4.2
|
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-02-
|
12
|
+
date: 2023-02-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|