openc3 5.17.0 → 5.18.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.
Potentially problematic release.
This version of openc3 might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/bin/openc3cli +1 -1
- data/data/config/_interfaces.yaml +4 -4
- data/data/config/command_modifiers.yaml +4 -0
- data/data/config/interface_modifiers.yaml +18 -8
- data/data/config/item_modifiers.yaml +34 -26
- data/data/config/microservice.yaml +4 -1
- data/data/config/param_item_modifiers.yaml +16 -0
- data/data/config/parameter_modifiers.yaml +29 -12
- data/data/config/plugins.yaml +3 -3
- data/data/config/screen.yaml +7 -7
- data/data/config/telemetry_modifiers.yaml +9 -4
- data/data/config/widgets.yaml +41 -14
- data/ext/openc3/ext/packet/packet.c +6 -0
- data/lib/openc3/accessors/accessor.rb +1 -0
- data/lib/openc3/accessors/binary_accessor.rb +170 -11
- data/lib/openc3/api/cmd_api.rb +39 -35
- data/lib/openc3/api/config_api.rb +10 -10
- data/lib/openc3/api/interface_api.rb +28 -21
- data/lib/openc3/api/limits_api.rb +29 -29
- data/lib/openc3/api/metrics_api.rb +3 -3
- data/lib/openc3/api/offline_access_api.rb +5 -5
- data/lib/openc3/api/router_api.rb +25 -19
- data/lib/openc3/api/settings_api.rb +10 -10
- data/lib/openc3/api/stash_api.rb +10 -10
- data/lib/openc3/api/target_api.rb +10 -10
- data/lib/openc3/api/tlm_api.rb +44 -44
- data/lib/openc3/conversions/bit_reverse_conversion.rb +60 -0
- data/lib/openc3/conversions/ip_read_conversion.rb +59 -0
- data/lib/openc3/conversions/ip_write_conversion.rb +61 -0
- data/lib/openc3/conversions/object_read_conversion.rb +88 -0
- data/lib/openc3/conversions/object_write_conversion.rb +38 -0
- data/lib/openc3/conversions.rb +6 -1
- data/lib/openc3/io/json_drb.rb +19 -21
- data/lib/openc3/io/json_rpc.rb +14 -13
- data/lib/openc3/microservices/microservice.rb +11 -11
- data/lib/openc3/microservices/scope_cleanup_microservice.rb +1 -1
- data/lib/openc3/microservices/timeline_microservice.rb +76 -51
- data/lib/openc3/models/activity_model.rb +25 -21
- data/lib/openc3/models/scope_model.rb +44 -13
- data/lib/openc3/models/sorted_model.rb +1 -1
- data/lib/openc3/models/target_model.rb +4 -1
- data/lib/openc3/operators/microservice_operator.rb +2 -2
- data/lib/openc3/operators/operator.rb +9 -9
- data/lib/openc3/packets/packet.rb +18 -1
- data/lib/openc3/packets/packet_config.rb +37 -16
- data/lib/openc3/packets/packet_item.rb +5 -0
- data/lib/openc3/packets/structure.rb +67 -3
- data/lib/openc3/packets/structure_item.rb +49 -12
- data/lib/openc3/script/calendar.rb +2 -2
- data/lib/openc3/script/extract.rb +5 -3
- data/lib/openc3/script/web_socket_api.rb +11 -0
- data/lib/openc3/topics/decom_interface_topic.rb +2 -1
- data/lib/openc3/topics/system_events_topic.rb +40 -0
- data/lib/openc3/utilities/authentication.rb +2 -1
- data/lib/openc3/utilities/authorization.rb +2 -2
- data/lib/openc3/version.rb +5 -5
- data/templates/tool_angular/package.json +5 -5
- data/templates/tool_react/package.json +8 -8
- data/templates/tool_svelte/package.json +10 -10
- data/templates/tool_vue/package.json +10 -10
- data/templates/widget/package.json +10 -10
- data/templates/widget/src/Widget.vue +0 -1
- metadata +22 -2
@@ -47,8 +47,8 @@ module OpenC3
|
|
47
47
|
# [[target name, packet name, item name, item limits state], ...]
|
48
48
|
#
|
49
49
|
# @return [Array<Array<String, String, String, String>>]
|
50
|
-
def get_out_of_limits(scope: $openc3_scope, token: $openc3_token)
|
51
|
-
authorize(permission: 'tlm', scope: scope, token: token)
|
50
|
+
def get_out_of_limits(manual: false, scope: $openc3_scope, token: $openc3_token)
|
51
|
+
authorize(permission: 'tlm', manual: manual, scope: scope, token: token)
|
52
52
|
LimitsEventTopic.out_of_limits(scope: scope)
|
53
53
|
end
|
54
54
|
|
@@ -59,7 +59,7 @@ module OpenC3
|
|
59
59
|
# @param ignored_items [Array<Array<String, String, String|nil>>] Array of [TGT, PKT, ITEM] strings
|
60
60
|
# to ignore when determining overall state. Note, ITEM can be nil to indicate to ignore entire packet.
|
61
61
|
# @return [String] The overall limits state for the system, one of 'GREEN', 'YELLOW', 'RED'
|
62
|
-
def get_overall_limits_state(ignored_items = nil, scope: $openc3_scope, token: $openc3_token)
|
62
|
+
def get_overall_limits_state(ignored_items = nil, manual: false, scope: $openc3_scope, token: $openc3_token)
|
63
63
|
# We only need to check out of limits items so call get_out_of_limits() which authorizes
|
64
64
|
out_of_limits = get_out_of_limits(scope: scope, token: token)
|
65
65
|
overall = 'GREEN'
|
@@ -108,9 +108,9 @@ module OpenC3
|
|
108
108
|
#
|
109
109
|
# @param args [String|Array<String>] See the description for calling style
|
110
110
|
# @return [Boolean] Whether limits are enable for the itme
|
111
|
-
def limits_enabled?(*args, scope: $openc3_scope, token: $openc3_token)
|
111
|
+
def limits_enabled?(*args, manual: false, scope: $openc3_scope, token: $openc3_token)
|
112
112
|
target_name, packet_name, item_name = _tlm_process_args(args, 'limits_enabled?', scope: scope)
|
113
|
-
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
113
|
+
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
114
114
|
return TargetModel.packet_item(target_name, packet_name, item_name, scope: scope)['limits']['enabled'] ? true : false
|
115
115
|
end
|
116
116
|
alias limits_enabled limits_enabled?
|
@@ -124,9 +124,9 @@ module OpenC3
|
|
124
124
|
# Favor the first syntax where possible as it is more succinct.
|
125
125
|
#
|
126
126
|
# @param args [String|Array<String>] See the description for calling style
|
127
|
-
def enable_limits(*args, scope: $openc3_scope, token: $openc3_token)
|
127
|
+
def enable_limits(*args, manual: false, scope: $openc3_scope, token: $openc3_token)
|
128
128
|
target_name, packet_name, item_name = _tlm_process_args(args, 'enable_limits', scope: scope)
|
129
|
-
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
129
|
+
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
130
130
|
packet = TargetModel.packet(target_name, packet_name, scope: scope)
|
131
131
|
found_item = nil
|
132
132
|
packet['items'].each do |item|
|
@@ -157,9 +157,9 @@ module OpenC3
|
|
157
157
|
# Favor the first syntax where possible as it is more succinct.
|
158
158
|
#
|
159
159
|
# @param args [String|Array<String>] See the description for calling style
|
160
|
-
def disable_limits(*args, scope: $openc3_scope, token: $openc3_token)
|
160
|
+
def disable_limits(*args, manual: false, scope: $openc3_scope, token: $openc3_token)
|
161
161
|
target_name, packet_name, item_name = _tlm_process_args(args, 'disable_limits', scope: scope)
|
162
|
-
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
162
|
+
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
163
163
|
packet = TargetModel.packet(target_name, packet_name, scope: scope)
|
164
164
|
found_item = nil
|
165
165
|
packet['items'].each do |item|
|
@@ -190,8 +190,8 @@ module OpenC3
|
|
190
190
|
# 'TVAC' => [-25, -10, 50, 55] }
|
191
191
|
#
|
192
192
|
# @return [Hash{String => Array<Number, Number, Number, Number, Number, Number>}]
|
193
|
-
def get_limits(target_name, packet_name, item_name, cache_timeout: nil, scope: $openc3_scope, token: $openc3_token)
|
194
|
-
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
193
|
+
def get_limits(target_name, packet_name, item_name, cache_timeout: nil, manual: false, scope: $openc3_scope, token: $openc3_token)
|
194
|
+
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
195
195
|
limits = {}
|
196
196
|
item = _get_item(target_name, packet_name, item_name, cache_timeout: cache_timeout, scope: scope)
|
197
197
|
item['limits'].each do |key, vals|
|
@@ -207,8 +207,8 @@ module OpenC3
|
|
207
207
|
# is created to avoid overriding existing limits.
|
208
208
|
def set_limits(target_name, packet_name, item_name, red_low, yellow_low, yellow_high, red_high,
|
209
209
|
green_low = nil, green_high = nil, limits_set = 'CUSTOM', persistence = nil, enabled = true,
|
210
|
-
scope: $openc3_scope, token: $openc3_token)
|
211
|
-
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
210
|
+
manual: false, scope: $openc3_scope, token: $openc3_token)
|
211
|
+
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
212
212
|
if (red_low > yellow_low) || (yellow_low >= yellow_high) || (yellow_high > red_high)
|
213
213
|
raise "Invalid limits specified. Ensure yellow limits are within red limits."
|
214
214
|
end
|
@@ -259,38 +259,38 @@ module OpenC3
|
|
259
259
|
# Returns all limits_groups and their members
|
260
260
|
# @since 5.0.0 Returns hash with values
|
261
261
|
# @return [Hash{String => Array<Array<String, String, String>>]
|
262
|
-
def get_limits_groups(scope: $openc3_scope, token: $openc3_token)
|
263
|
-
authorize(permission: 'tlm', scope: scope, token: token)
|
262
|
+
def get_limits_groups(manual: false, scope: $openc3_scope, token: $openc3_token)
|
263
|
+
authorize(permission: 'tlm', manual: manual, scope: scope, token: token)
|
264
264
|
TargetModel.limits_groups(scope: scope)
|
265
265
|
end
|
266
266
|
|
267
267
|
# Enables limits for all the items in the group
|
268
268
|
#
|
269
269
|
# @param group_name [String] Name of the group to enable
|
270
|
-
def enable_limits_group(group_name, scope: $openc3_scope, token: $openc3_token)
|
271
|
-
_limits_group(group_name, action: :enable, scope: scope, token: token)
|
270
|
+
def enable_limits_group(group_name, manual: false, scope: $openc3_scope, token: $openc3_token)
|
271
|
+
_limits_group(group_name, action: :enable, manual: manual, scope: scope, token: token)
|
272
272
|
end
|
273
273
|
|
274
274
|
# Disables limits for all the items in the group
|
275
275
|
#
|
276
276
|
# @param group_name [String] Name of the group to disable
|
277
|
-
def disable_limits_group(group_name, scope: $openc3_scope, token: $openc3_token)
|
278
|
-
_limits_group(group_name, action: :disable, scope: scope, token: token)
|
277
|
+
def disable_limits_group(group_name, manual: false, scope: $openc3_scope, token: $openc3_token)
|
278
|
+
_limits_group(group_name, action: :disable, manual: manual, scope: scope, token: token)
|
279
279
|
end
|
280
280
|
|
281
281
|
# Returns all defined limits sets
|
282
282
|
#
|
283
283
|
# @return [Array<String>] All defined limits sets
|
284
|
-
def get_limits_sets(scope: $openc3_scope, token: $openc3_token)
|
285
|
-
authorize(permission: 'tlm', scope: scope, token: token)
|
284
|
+
def get_limits_sets(manual: false, scope: $openc3_scope, token: $openc3_token)
|
285
|
+
authorize(permission: 'tlm', manual: manual, scope: scope, token: token)
|
286
286
|
LimitsEventTopic.sets(scope: scope).keys
|
287
287
|
end
|
288
288
|
|
289
289
|
# Changes the active limits set that applies to all telemetry
|
290
290
|
#
|
291
291
|
# @param limits_set [String] The name of the limits set
|
292
|
-
def set_limits_set(limits_set, scope: $openc3_scope, token: $openc3_token)
|
293
|
-
authorize(permission: 'tlm_set', scope: scope, token: token)
|
292
|
+
def set_limits_set(limits_set, manual: false, scope: $openc3_scope, token: $openc3_token)
|
293
|
+
authorize(permission: 'tlm_set', manual: manual, scope: scope, token: token)
|
294
294
|
message = "Setting Limits Set: #{limits_set}"
|
295
295
|
Logger.info(message, scope: scope)
|
296
296
|
LimitsEventTopic.write({ type: :LIMITS_SET, set: limits_set.to_s,
|
@@ -300,8 +300,8 @@ module OpenC3
|
|
300
300
|
# Returns the active limits set that applies to all telemetry
|
301
301
|
#
|
302
302
|
# @return [String] The current limits set
|
303
|
-
def get_limits_set(scope: $openc3_scope, token: $openc3_token)
|
304
|
-
authorize(permission: 'tlm', scope: scope, token: token)
|
303
|
+
def get_limits_set(manual: false, scope: $openc3_scope, token: $openc3_token)
|
304
|
+
authorize(permission: 'tlm', manual: manual, scope: scope, token: token)
|
305
305
|
LimitsEventTopic.current_set(scope: scope)
|
306
306
|
end
|
307
307
|
|
@@ -313,8 +313,8 @@ module OpenC3
|
|
313
313
|
# @param count [Integer] The total number of events returned. Default is 100.
|
314
314
|
# @return [Hash, Integer] Event hash followed by the offset. The offset can
|
315
315
|
# be used in subsequent calls to return events from where the last call left off.
|
316
|
-
def get_limits_events(offset = nil, count: 100, scope: $openc3_scope, token: $openc3_token)
|
317
|
-
authorize(permission: 'tlm', scope: scope, token: token)
|
316
|
+
def get_limits_events(offset = nil, count: 100, manual: false, scope: $openc3_scope, token: $openc3_token)
|
317
|
+
authorize(permission: 'tlm', manual: manual, scope: scope, token: token)
|
318
318
|
LimitsEventTopic.read(offset, count: count, scope: scope)
|
319
319
|
end
|
320
320
|
|
@@ -323,8 +323,8 @@ module OpenC3
|
|
323
323
|
###########################################################################
|
324
324
|
|
325
325
|
# Enables or disables a limits group
|
326
|
-
def _limits_group(group_name, action:, scope:, token:)
|
327
|
-
authorize(permission: 'tlm_set', scope: scope, token: token)
|
326
|
+
def _limits_group(group_name, action:, manual:, scope:, token:)
|
327
|
+
authorize(permission: 'tlm_set', manual: manual, scope: scope, token: token)
|
328
328
|
group_name.upcase!
|
329
329
|
group = get_limits_groups(scope: scope, token: token)[group_name]
|
330
330
|
raise "LIMITS_GROUP #{group_name} undefined. Ensure your telemetry definition contains the line: LIMITS_GROUP #{group_name}" unless group
|
@@ -66,15 +66,15 @@ module OpenC3
|
|
66
66
|
SUM_METRICS['text_log_total'] = 0
|
67
67
|
SUM_METRICS['text_log_error_total'] = 0
|
68
68
|
|
69
|
-
def get_metrics(scope: $openc3_scope, token: $openc3_token)
|
70
|
-
authorize(permission: 'system', scope: scope, token: token)
|
69
|
+
def get_metrics(manual: false, scope: $openc3_scope, token: $openc3_token)
|
70
|
+
authorize(permission: 'system', manual: manual, scope: scope, token: token)
|
71
71
|
|
72
72
|
sum_metrics = SUM_METRICS.dup
|
73
73
|
duration_metrics = DURATION_METRICS.dup
|
74
74
|
delay_metrics = DELAY_METRICS.dup
|
75
75
|
|
76
76
|
metrics = MetricModel.all(scope: scope)
|
77
|
-
metrics.each do |
|
77
|
+
metrics.each do |_microservice_name, metrics|
|
78
78
|
next unless metrics and metrics['values']
|
79
79
|
metrics['values'].each do |metric_name, data|
|
80
80
|
value = data['value']
|
@@ -27,10 +27,10 @@ module OpenC3
|
|
27
27
|
'set_offline_access'
|
28
28
|
])
|
29
29
|
|
30
|
-
def offline_access_needed(scope: $openc3_scope, token: $openc3_token)
|
31
|
-
authorize(permission: 'system', scope: scope, token: token)
|
30
|
+
def offline_access_needed(manual: false, scope: $openc3_scope, token: $openc3_token)
|
31
|
+
authorize(permission: 'system', manual: manual, scope: scope, token: token)
|
32
32
|
begin
|
33
|
-
authorize(permission: '
|
33
|
+
authorize(permission: 'script_view', manual: manual, scope: scope, token: token)
|
34
34
|
rescue
|
35
35
|
# Not needed if can't run scripts
|
36
36
|
return false
|
@@ -60,8 +60,8 @@ module OpenC3
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
def set_offline_access(offline_access_token, scope: $openc3_scope, token: $openc3_token)
|
64
|
-
authorize(permission: '
|
63
|
+
def set_offline_access(offline_access_token, manual: false, scope: $openc3_scope, token: $openc3_token)
|
64
|
+
authorize(permission: 'script_view', manual: manual, scope: scope, token: token)
|
65
65
|
info = user_info(token)
|
66
66
|
username = info['username']
|
67
67
|
raise "Invalid username" if not username or username == ''
|
@@ -43,8 +43,8 @@ module OpenC3
|
|
43
43
|
#
|
44
44
|
# @param router_name [String] Router name
|
45
45
|
# @return [Hash] Hash of all the router information
|
46
|
-
def get_router(router_name, scope: $openc3_scope, token: $openc3_token)
|
47
|
-
authorize(permission: 'system', router_name: router_name, scope: scope, token: token)
|
46
|
+
def get_router(router_name, manual: false, scope: $openc3_scope, token: $openc3_token)
|
47
|
+
authorize(permission: 'system', router_name: router_name, manual: manual, scope: scope, token: token)
|
48
48
|
router = RouterModel.get(name: router_name, scope: scope)
|
49
49
|
raise "Router '#{router_name}' does not exist" unless router
|
50
50
|
|
@@ -52,8 +52,8 @@ module OpenC3
|
|
52
52
|
end
|
53
53
|
|
54
54
|
# @return [Array<String>] All the router names
|
55
|
-
def get_router_names(scope: $openc3_scope, token: $openc3_token)
|
56
|
-
authorize(permission: 'system', scope: scope, token: token)
|
55
|
+
def get_router_names(manual: false, scope: $openc3_scope, token: $openc3_token)
|
56
|
+
authorize(permission: 'system', manual: manual, scope: scope, token: token)
|
57
57
|
RouterModel.names(scope: scope)
|
58
58
|
end
|
59
59
|
|
@@ -61,24 +61,27 @@ module OpenC3
|
|
61
61
|
#
|
62
62
|
# @param router_name [String] Name of router
|
63
63
|
# @param router_params [Array] Optional parameters to pass to the router
|
64
|
-
def connect_router(router_name, *router_params, scope: $openc3_scope, token: $openc3_token)
|
65
|
-
|
64
|
+
def connect_router(router_name, *router_params, manual: false, scope: $openc3_scope, token: $openc3_token)
|
65
|
+
# TODO: Check if they have command authority for the targets mapped to this interface
|
66
|
+
authorize(permission: 'system_set', router_name: router_name, manual: manual, scope: scope, token: token)
|
66
67
|
RouterTopic.connect_router(router_name, *router_params, scope: scope)
|
67
68
|
end
|
68
69
|
|
69
70
|
# Disconnects a router and kills its command gathering thread
|
70
71
|
#
|
71
72
|
# @param router_name [String] Name of router
|
72
|
-
def disconnect_router(router_name, scope: $openc3_scope, token: $openc3_token)
|
73
|
-
|
73
|
+
def disconnect_router(router_name, manual: false, scope: $openc3_scope, token: $openc3_token)
|
74
|
+
# TODO: Check if they have command authority for the targets mapped to this interface
|
75
|
+
authorize(permission: 'system_set', router_name: router_name, manual: manual, scope: scope, token: token)
|
74
76
|
RouterTopic.disconnect_router(router_name, scope: scope)
|
75
77
|
end
|
76
78
|
|
77
79
|
# Starts raw logging for a router
|
78
80
|
#
|
79
81
|
# @param router_name [String] The name of the router
|
80
|
-
def start_raw_logging_router(router_name = 'ALL', scope: $openc3_scope, token: $openc3_token)
|
81
|
-
|
82
|
+
def start_raw_logging_router(router_name = 'ALL', manual: false, scope: $openc3_scope, token: $openc3_token)
|
83
|
+
# TODO: Check if they have command authority for the targets mapped to this interface
|
84
|
+
authorize(permission: 'system_set', router_name: router_name, manual: manual, scope: scope, token: token)
|
82
85
|
if router_name == 'ALL'
|
83
86
|
get_router_names().each do |router_name|
|
84
87
|
RouterTopic.start_raw_logging(router_name, scope: scope)
|
@@ -91,8 +94,9 @@ module OpenC3
|
|
91
94
|
# Stop raw logging for a router
|
92
95
|
#
|
93
96
|
# @param router_name [String] The name of the router
|
94
|
-
def stop_raw_logging_router(router_name = 'ALL', scope: $openc3_scope, token: $openc3_token)
|
95
|
-
|
97
|
+
def stop_raw_logging_router(router_name = 'ALL', manual: false, scope: $openc3_scope, token: $openc3_token)
|
98
|
+
# TODO: Check if they have command authority for the targets mapped to this interface
|
99
|
+
authorize(permission: 'system_set', router_name: router_name, manual: manual, scope: scope, token: token)
|
96
100
|
if router_name == 'ALL'
|
97
101
|
get_router_names().each do |router_name|
|
98
102
|
RouterTopic.stop_raw_logging(router_name, scope: scope)
|
@@ -108,10 +112,10 @@ module OpenC3
|
|
108
112
|
# Numeric, Numeric>>] Array of Arrays containing \[name, state, num clients,
|
109
113
|
# TX queue size, RX queue size, TX bytes, RX bytes, Command count,
|
110
114
|
# Telemetry count] for all routers
|
111
|
-
def get_all_router_info(scope: $openc3_scope, token: $openc3_token)
|
112
|
-
authorize(permission: 'system', scope: scope, token: token)
|
115
|
+
def get_all_router_info(manual: false, scope: $openc3_scope, token: $openc3_token)
|
116
|
+
authorize(permission: 'system', manual: manual, scope: scope, token: token)
|
113
117
|
info = []
|
114
|
-
RouterStatusModel.all(scope: scope).each do |
|
118
|
+
RouterStatusModel.all(scope: scope).each do |_router_name, router|
|
115
119
|
info << [router['name'], router['state'], router['clients'], router['txsize'], router['rxsize'],\
|
116
120
|
router['txbytes'], router['rxbytes'], router['rxcnt'], router['txcnt']]
|
117
121
|
end
|
@@ -119,13 +123,15 @@ module OpenC3
|
|
119
123
|
info
|
120
124
|
end
|
121
125
|
|
122
|
-
def router_cmd(router_name, cmd_name, *cmd_params, scope: $openc3_scope, token: $openc3_token)
|
123
|
-
|
126
|
+
def router_cmd(router_name, cmd_name, *cmd_params, manual: false, scope: $openc3_scope, token: $openc3_token)
|
127
|
+
# TODO: Check if they have command authority for the targets mapped to this interface
|
128
|
+
authorize(permission: 'system_set', router_name: router_name, manual: manual, scope: scope, token: token)
|
124
129
|
RouterTopic.router_cmd(router_name, cmd_name, *cmd_params, scope: scope)
|
125
130
|
end
|
126
131
|
|
127
|
-
def router_protocol_cmd(router_name, cmd_name, *cmd_params, read_write: :READ_WRITE, index: -1, scope: $openc3_scope, token: $openc3_token)
|
128
|
-
|
132
|
+
def router_protocol_cmd(router_name, cmd_name, *cmd_params, read_write: :READ_WRITE, index: -1, manual: false, scope: $openc3_scope, token: $openc3_token)
|
133
|
+
# TODO: Check if they have command authority for the targets mapped to this interface
|
134
|
+
authorize(permission: 'system_set', router_name: router_name, manual: manual, scope: scope, token: token)
|
129
135
|
RouterTopic.protocol_cmd(router_name, cmd_name, *cmd_params, read_write: read_write, index: index, scope: scope)
|
130
136
|
end
|
131
137
|
end
|
@@ -34,18 +34,18 @@ module OpenC3
|
|
34
34
|
'save_setting' # DEPRECATED
|
35
35
|
])
|
36
36
|
|
37
|
-
def list_settings(scope: $openc3_scope, token: $openc3_token)
|
38
|
-
authorize(permission: 'system', scope: scope, token: token)
|
37
|
+
def list_settings(manual: false, scope: $openc3_scope, token: $openc3_token)
|
38
|
+
authorize(permission: 'system', manual: manual, scope: scope, token: token)
|
39
39
|
SettingModel.names(scope: scope)
|
40
40
|
end
|
41
41
|
|
42
|
-
def get_all_settings(scope: $openc3_scope, token: $openc3_token)
|
43
|
-
authorize(permission: 'system', scope: scope, token: token)
|
42
|
+
def get_all_settings(manual: false, scope: $openc3_scope, token: $openc3_token)
|
43
|
+
authorize(permission: 'system', manual: manual, scope: scope, token: token)
|
44
44
|
SettingModel.all(scope: scope)
|
45
45
|
end
|
46
46
|
|
47
|
-
def get_setting(name, scope: $openc3_scope, token: $openc3_token)
|
48
|
-
authorize(permission: 'system', scope: scope, token: token)
|
47
|
+
def get_setting(name, manual: false, scope: $openc3_scope, token: $openc3_token)
|
48
|
+
authorize(permission: 'system', manual: manual, scope: scope, token: token)
|
49
49
|
setting = SettingModel.get(name: name, scope: scope)
|
50
50
|
if setting
|
51
51
|
setting['data']
|
@@ -54,15 +54,15 @@ module OpenC3
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
def get_settings(*settings, scope: $openc3_scope, token: $openc3_token)
|
58
|
-
authorize(permission: 'system', scope: scope, token: token)
|
57
|
+
def get_settings(*settings, manual: false, scope: $openc3_scope, token: $openc3_token)
|
58
|
+
authorize(permission: 'system', manual: manual, scope: scope, token: token)
|
59
59
|
result = []
|
60
60
|
settings.each { |name| result << get_setting(name, scope: scope, token: token) }
|
61
61
|
result
|
62
62
|
end
|
63
63
|
|
64
|
-
def set_setting(name, data, scope: $openc3_scope, token: $openc3_token)
|
65
|
-
authorize(permission: 'admin', scope: scope, token: token)
|
64
|
+
def set_setting(name, data, manual: false, scope: $openc3_scope, token: $openc3_token)
|
65
|
+
authorize(permission: 'admin', manual: manual, scope: scope, token: token)
|
66
66
|
SettingModel.set({ name: name, data: data }, scope: scope)
|
67
67
|
LocalMode.save_setting(scope, name, data)
|
68
68
|
end
|
data/lib/openc3/api/stash_api.rb
CHANGED
@@ -29,13 +29,13 @@ module OpenC3
|
|
29
29
|
'stash_delete'
|
30
30
|
])
|
31
31
|
|
32
|
-
def stash_set(key, value, scope: $openc3_scope, token: $openc3_token)
|
33
|
-
authorize(permission: 'script_run', scope: scope, token: token)
|
32
|
+
def stash_set(key, value, manual: false, scope: $openc3_scope, token: $openc3_token)
|
33
|
+
authorize(permission: 'script_run', manual: manual, scope: scope, token: token)
|
34
34
|
StashModel.set( {name: key, value: JSON.generate(value.as_json(:allow_nan => true)) }, scope: scope)
|
35
35
|
end
|
36
36
|
|
37
|
-
def stash_get(key, scope: $openc3_scope, token: $openc3_token)
|
38
|
-
authorize(permission: 'script_view', scope: scope, token: token)
|
37
|
+
def stash_get(key, manual: false, scope: $openc3_scope, token: $openc3_token)
|
38
|
+
authorize(permission: 'script_view', manual: manual, scope: scope, token: token)
|
39
39
|
result = StashModel.get(name: key, scope: scope)
|
40
40
|
if result
|
41
41
|
JSON.parse(result['value'], :allow_nan => true, :create_additions => true)
|
@@ -44,18 +44,18 @@ module OpenC3
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
def stash_all(scope: $openc3_scope, token: $openc3_token)
|
48
|
-
authorize(permission: 'script_view', scope: scope, token: token)
|
47
|
+
def stash_all(manual: false, scope: $openc3_scope, token: $openc3_token)
|
48
|
+
authorize(permission: 'script_view', manual: manual, scope: scope, token: token)
|
49
49
|
StashModel.all(scope: scope).transform_values { |hash| JSON.parse(hash["value"], :allow_nan => true, :create_additions => true) }
|
50
50
|
end
|
51
51
|
|
52
|
-
def stash_keys(scope: $openc3_scope, token: $openc3_token)
|
53
|
-
authorize(permission: 'script_view', scope: scope, token: token)
|
52
|
+
def stash_keys(manual: false, scope: $openc3_scope, token: $openc3_token)
|
53
|
+
authorize(permission: 'script_view', manual: manual, scope: scope, token: token)
|
54
54
|
StashModel.names(scope: scope)
|
55
55
|
end
|
56
56
|
|
57
|
-
def stash_delete(key, scope: $openc3_scope, token: $openc3_token)
|
58
|
-
authorize(permission: 'script_run', scope: scope, token: token)
|
57
|
+
def stash_delete(key, manual: false, scope: $openc3_scope, token: $openc3_token)
|
58
|
+
authorize(permission: 'script_run', manual: manual, scope: scope, token: token)
|
59
59
|
model = StashModel.get_model(name: key, scope: scope)
|
60
60
|
model.destroy if model
|
61
61
|
end
|
@@ -36,8 +36,8 @@ module OpenC3
|
|
36
36
|
# Returns the list of all target names
|
37
37
|
#
|
38
38
|
# @return [Array<String>] All target names
|
39
|
-
def get_target_names(scope: $openc3_scope, token: $openc3_token)
|
40
|
-
authorize(permission: '
|
39
|
+
def get_target_names(manual: false, scope: $openc3_scope, token: $openc3_token)
|
40
|
+
authorize(permission: 'system', manual: manual, scope: scope, token: token)
|
41
41
|
TargetModel.names(scope: scope)
|
42
42
|
end
|
43
43
|
# get_target_list is DEPRECATED
|
@@ -48,21 +48,21 @@ module OpenC3
|
|
48
48
|
# @since 5.0.0
|
49
49
|
# @param target_name [String] Target name
|
50
50
|
# @return [Hash] Hash of all the target properties
|
51
|
-
def get_target(target_name, scope: $openc3_scope, token: $openc3_token)
|
52
|
-
authorize(permission: 'system', target_name: target_name, scope: scope, token: token)
|
51
|
+
def get_target(target_name, manual: false, scope: $openc3_scope, token: $openc3_token)
|
52
|
+
authorize(permission: 'system', target_name: target_name, manual: manual, scope: scope, token: token)
|
53
53
|
TargetModel.get(name: target_name, scope: scope)
|
54
54
|
end
|
55
55
|
|
56
56
|
# Get all targets and their interfaces
|
57
57
|
#
|
58
58
|
# @return [Array<Array<String, String] Array of Arrays \[name, interfaces]
|
59
|
-
def get_target_interfaces(scope: $openc3_scope, token: $openc3_token)
|
60
|
-
authorize(permission: 'system', scope: scope, token: token)
|
59
|
+
def get_target_interfaces(manual: false, scope: $openc3_scope, token: $openc3_token)
|
60
|
+
authorize(permission: 'system', manual: manual, scope: scope, token: token)
|
61
61
|
info = []
|
62
62
|
interfaces = InterfaceModel.all(scope: scope)
|
63
63
|
get_target_names(scope: scope, token: token).each do |target_name|
|
64
64
|
interface_names = []
|
65
|
-
interfaces.each do |
|
65
|
+
interfaces.each do |_name, interface|
|
66
66
|
if interface['target_names'].include? target_name
|
67
67
|
interface_names << interface['name']
|
68
68
|
end
|
@@ -76,8 +76,8 @@ module OpenC3
|
|
76
76
|
# Warning this call can take a long time with many defined packets
|
77
77
|
#
|
78
78
|
# @return [Array<Array<String, String, Numeric, Numeric>] Array of Arrays \[name, interface, cmd_cnt, tlm_cnt]
|
79
|
-
def get_all_target_info(scope: $openc3_scope, token: $openc3_token)
|
80
|
-
authorize(permission: 'system', scope: scope, token: token)
|
79
|
+
def get_all_target_info(manual: false, scope: $openc3_scope, token: $openc3_token)
|
80
|
+
authorize(permission: 'system', manual: manual, scope: scope, token: token)
|
81
81
|
info = []
|
82
82
|
get_target_names(scope: scope, token: token).each do |target_name|
|
83
83
|
cmd_cnt = 0
|
@@ -91,7 +91,7 @@ module OpenC3
|
|
91
91
|
tlm_cnt += Topic.get_cnt("#{scope}__TELEMETRY__{#{target_name}}__#{packet['packet_name']}")
|
92
92
|
end
|
93
93
|
interface_names = []
|
94
|
-
InterfaceModel.all(scope: scope).each do |
|
94
|
+
InterfaceModel.all(scope: scope).each do |_name, interface|
|
95
95
|
if interface['target_names'].include? target_name
|
96
96
|
interface_names << interface['name']
|
97
97
|
end
|