openc3 5.11.3 → 5.13.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of openc3 might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/bin/openc3cli +29 -15
- data/data/config/_id_items.yaml +6 -4
- data/data/config/_id_params.yaml +9 -6
- data/data/config/_items.yaml +6 -4
- data/data/config/_params.yaml +3 -2
- data/data/config/graph_settings.yaml +1 -1
- data/data/config/interface_modifiers.yaml +1 -1
- data/data/config/item_modifiers.yaml +1 -2
- data/data/config/microservice.yaml +10 -1
- data/data/config/parameter_modifiers.yaml +13 -14
- data/data/config/plugins.yaml +13 -3
- data/data/config/screen.yaml +1 -2
- data/data/config/target.yaml +9 -0
- data/data/config/target_config.yaml +14 -6
- data/data/config/tool.yaml +12 -3
- data/lib/openc3/api/api.rb +1 -1
- data/lib/openc3/api/cmd_api.rb +123 -59
- data/lib/openc3/api/config_api.rb +12 -12
- data/lib/openc3/api/limits_api.rb +4 -3
- data/lib/openc3/api/settings_api.rb +5 -2
- data/lib/openc3/api/tlm_api.rb +70 -34
- data/lib/openc3/conversions/unix_time_conversion.rb +8 -6
- data/lib/openc3/interfaces/mqtt_interface.rb +11 -9
- data/lib/openc3/interfaces/mqtt_stream_interface.rb +78 -0
- data/lib/openc3/interfaces/tcpip_server_interface.rb +0 -7
- data/lib/openc3/io/json_drb.rb +3 -2
- data/lib/openc3/io/json_rpc.rb +6 -6
- data/lib/openc3/logs/buffered_packet_log_writer.rb +4 -2
- data/lib/openc3/logs/packet_log_reader.rb +2 -2
- data/lib/openc3/logs/packet_log_writer.rb +22 -7
- data/lib/openc3/logs/text_log_writer.rb +3 -2
- data/lib/openc3/microservices/cleanup_microservice.rb +8 -1
- data/lib/openc3/microservices/decom_microservice.rb +1 -1
- data/lib/openc3/microservices/interface_microservice.rb +2 -2
- data/lib/openc3/microservices/microservice.rb +5 -2
- data/lib/openc3/microservices/reaction_microservice.rb +1 -0
- data/lib/openc3/microservices/timeline_microservice.rb +7 -5
- data/lib/openc3/microservices/trigger_group_microservice.rb +2 -1
- data/lib/openc3/migrations/20231022000000_tlm_viewer_config.rb +22 -0
- data/lib/openc3/models/activity_model.rb +21 -3
- data/lib/openc3/models/cvt_model.rb +2 -1
- data/lib/openc3/models/gem_model.rb +4 -1
- data/lib/openc3/models/interface_model.rb +11 -5
- data/lib/openc3/models/metadata_model.rb +11 -0
- data/lib/openc3/models/microservice_model.rb +16 -3
- data/lib/openc3/models/model.rb +18 -0
- data/lib/openc3/models/note_model.rb +11 -0
- data/lib/openc3/models/plugin_model.rb +56 -4
- data/lib/openc3/models/python_package_model.rb +104 -0
- data/lib/openc3/models/scope_model.rb +2 -0
- data/lib/openc3/models/sorted_model.rb +17 -8
- data/lib/openc3/models/target_model.rb +53 -18
- data/lib/openc3/models/tool_config_model.rb +9 -3
- data/lib/openc3/models/tool_model.rb +22 -7
- data/lib/openc3/models/widget_model.rb +19 -3
- data/lib/openc3/operators/microservice_operator.rb +2 -0
- data/lib/openc3/packets/json_packet.rb +46 -15
- data/lib/openc3/packets/limits.rb +6 -18
- data/lib/openc3/packets/packet.rb +1 -0
- data/lib/openc3/packets/packet_config.rb +2 -1
- data/lib/openc3/packets/parsers/format_string_parser.rb +4 -4
- data/lib/openc3/packets/parsers/limits_parser.rb +4 -4
- data/lib/openc3/packets/parsers/limits_response_parser.rb +5 -5
- data/lib/openc3/packets/parsers/processor_parser.rb +4 -4
- data/lib/openc3/packets/parsers/state_parser.rb +3 -3
- data/lib/openc3/packets/parsers/xtce_parser.rb +5 -1
- data/lib/openc3/script/api_shared.rb +81 -63
- data/lib/openc3/script/calendar.rb +109 -0
- data/lib/openc3/script/commands.rb +18 -19
- data/lib/openc3/script/limits.rb +1 -1
- data/lib/openc3/script/{gems.rb → packages.rb} +20 -16
- data/lib/openc3/script/script.rb +49 -38
- data/lib/openc3/script/storage.rb +4 -4
- data/lib/openc3/script/web_socket_api.rb +2 -2
- data/lib/openc3/streams/mqtt_stream.rb +109 -0
- data/lib/openc3/system/system.rb +2 -0
- data/lib/openc3/system/target.rb +10 -1
- data/lib/openc3/top_level.rb +2 -2
- data/lib/openc3/utilities/aws_bucket.rb +3 -2
- data/lib/openc3/utilities/bucket_file_cache.rb +1 -1
- data/lib/openc3/utilities/cli_generator.rb +33 -20
- data/lib/openc3/utilities/local_mode.rb +5 -3
- data/lib/openc3/utilities/logger.rb +18 -17
- data/lib/openc3/utilities/process_manager.rb +1 -1
- data/lib/openc3/utilities/ruby_lex_utils.rb +0 -8
- data/lib/openc3/version.rb +6 -6
- data/templates/conversion/conversion.py +28 -0
- data/templates/conversion/conversion.rb +1 -18
- data/templates/limits_response/response.py +37 -0
- data/templates/limits_response/response.rb +0 -17
- data/templates/microservice/microservices/TEMPLATE/microservice.py +54 -0
- data/templates/microservice/microservices/TEMPLATE/microservice.rb +0 -7
- data/templates/plugin/.gitignore +1 -0
- data/templates/target/targets/TARGET/lib/target.py +9 -0
- data/templates/target/targets/TARGET/procedures/procedure.py +3 -0
- data/templates/tool_angular/package.json +22 -21
- data/templates/tool_angular/yarn.lock +2319 -3156
- data/templates/tool_react/package.json +16 -16
- data/templates/tool_react/yarn.lock +763 -645
- data/templates/tool_svelte/package.json +15 -14
- data/templates/tool_svelte/src/services/openc3-api.js +33 -82
- data/templates/tool_svelte/yarn.lock +748 -538
- data/templates/tool_vue/package.json +15 -14
- data/templates/tool_vue/yarn.lock +150 -64
- data/templates/widget/package.json +14 -13
- data/templates/widget/yarn.lock +133 -58
- metadata +60 -7
data/lib/openc3/api/cmd_api.rb
CHANGED
@@ -39,12 +39,17 @@ module OpenC3
|
|
39
39
|
'cmd_raw_no_range_check',
|
40
40
|
'cmd_raw_no_hazardous_check',
|
41
41
|
'cmd_raw_no_checks',
|
42
|
-
'
|
42
|
+
'build_cmd',
|
43
|
+
'build_command', # DEPRECATED
|
43
44
|
'send_raw',
|
44
|
-
'
|
45
|
-
'
|
46
|
-
'
|
47
|
-
'
|
45
|
+
'get_all_cmds',
|
46
|
+
'get_all_commands', # DEPRECATED
|
47
|
+
'get_all_cmd_names',
|
48
|
+
'get_all_command_names', # DEPRECATED
|
49
|
+
'get_cmd',
|
50
|
+
'get_command', # DEPRECATED
|
51
|
+
'get_param',
|
52
|
+
'get_parameter', # DEPRECATED
|
48
53
|
'get_cmd_buffer',
|
49
54
|
'get_cmd_hazardous',
|
50
55
|
'get_cmd_value',
|
@@ -62,45 +67,45 @@ module OpenC3
|
|
62
67
|
#
|
63
68
|
# Favor the first syntax where possible as it is more succinct.
|
64
69
|
def cmd(*args, **kwargs)
|
65
|
-
|
70
|
+
_cmd_implementation('cmd', *args, range_check: true, hazardous_check: true, raw: false, **kwargs)
|
66
71
|
end
|
67
72
|
def cmd_raw(*args, **kwargs)
|
68
|
-
|
73
|
+
_cmd_implementation('cmd_raw', *args, range_check: true, hazardous_check: true, raw: true, **kwargs)
|
69
74
|
end
|
70
75
|
|
71
76
|
# Send a command packet to a target without performing any value range
|
72
77
|
# checks on the parameters. Useful for testing to allow sending command
|
73
78
|
# parameters outside the allowable range as defined in the configuration.
|
74
79
|
def cmd_no_range_check(*args, **kwargs)
|
75
|
-
|
80
|
+
_cmd_implementation('cmd_no_range_check', *args, range_check: false, hazardous_check: true, raw: false, **kwargs)
|
76
81
|
end
|
77
82
|
def cmd_raw_no_range_check(*args, **kwargs)
|
78
|
-
|
83
|
+
_cmd_implementation('cmd_raw_no_range_check', *args, range_check: false, hazardous_check: true, raw: true, **kwargs)
|
79
84
|
end
|
80
85
|
|
81
86
|
# Send a command packet to a target without performing any hazardous checks
|
82
87
|
# both on the command itself and its parameters. Useful in scripts to
|
83
88
|
# prevent popping up warnings to the user.
|
84
89
|
def cmd_no_hazardous_check(*args, **kwargs)
|
85
|
-
|
90
|
+
_cmd_implementation('cmd_no_hazardous_check', *args, range_check: true, hazardous_check: false, raw: false, **kwargs)
|
86
91
|
end
|
87
92
|
def cmd_raw_no_hazardous_check(*args, **kwargs)
|
88
|
-
|
93
|
+
_cmd_implementation('cmd_raw_no_hazardous_check', *args, range_check: true, hazardous_check: false, raw: true, **kwargs)
|
89
94
|
end
|
90
95
|
|
91
96
|
# Send a command packet to a target without performing any value range
|
92
97
|
# checks or hazardous checks both on the command itself and its parameters.
|
93
98
|
def cmd_no_checks(*args, **kwargs)
|
94
|
-
|
99
|
+
_cmd_implementation('cmd_no_checks', *args, range_check: false, hazardous_check: false, raw: false, **kwargs)
|
95
100
|
end
|
96
101
|
def cmd_raw_no_checks(*args, **kwargs)
|
97
|
-
|
102
|
+
_cmd_implementation('cmd_raw_no_checks', *args, range_check: false, hazardous_check: false, raw: true, **kwargs)
|
98
103
|
end
|
99
104
|
|
100
105
|
# Build a command binary
|
101
106
|
#
|
102
107
|
# @since 5.8.0
|
103
|
-
def
|
108
|
+
def build_cmd(*args, range_check: true, raw: false, scope: $openc3_scope, token: $openc3_token, **kwargs)
|
104
109
|
extract_string_kwargs_to_args(args, kwargs)
|
105
110
|
case args.length
|
106
111
|
when 1
|
@@ -123,6 +128,8 @@ module OpenC3
|
|
123
128
|
authorize(permission: 'cmd_info', target_name: target_name, scope: scope, token: token)
|
124
129
|
DecomInterfaceTopic.build_cmd(target_name, cmd_name, cmd_params, range_check, raw, scope: scope)
|
125
130
|
end
|
131
|
+
# build_command is DEPRECATED
|
132
|
+
alias build_command build_cmd
|
126
133
|
|
127
134
|
# Send a raw binary string to the specified interface.
|
128
135
|
#
|
@@ -140,9 +147,8 @@ module OpenC3
|
|
140
147
|
# @param target_name [String] Target name of the command
|
141
148
|
# @param command_name [String] Packet name of the command
|
142
149
|
# @return [Hash] command hash with last command buffer
|
143
|
-
def get_cmd_buffer(
|
144
|
-
target_name =
|
145
|
-
command_name = command_name.upcase
|
150
|
+
def get_cmd_buffer(*args, scope: $openc3_scope, token: $openc3_token)
|
151
|
+
target_name, command_name = _extract_target_command_names('get_cmd_buffer', *args)
|
146
152
|
authorize(permission: 'cmd_info', target_name: target_name, packet_name: command_name, scope: scope, token: token)
|
147
153
|
TargetModel.packet(target_name, command_name, type: :CMD, scope: scope)
|
148
154
|
topic = "#{scope}__COMMAND__{#{target_name}}__#{command_name}"
|
@@ -159,35 +165,38 @@ module OpenC3
|
|
159
165
|
# @since 5.0.0
|
160
166
|
# @param target_name [String] Name of the target
|
161
167
|
# @return [Array<Hash>] Array of all commands as a hash
|
162
|
-
def
|
168
|
+
def get_all_cmds(target_name, scope: $openc3_scope, token: $openc3_token)
|
163
169
|
target_name = target_name.upcase
|
164
170
|
authorize(permission: 'cmd_info', target_name: target_name, scope: scope, token: token)
|
165
171
|
TargetModel.packets(target_name, type: :CMD, scope: scope)
|
166
172
|
end
|
173
|
+
# get_all_commands is DEPRECATED
|
174
|
+
alias get_all_commands get_all_cmds
|
167
175
|
|
168
176
|
# Returns an array of all the command packet names
|
169
177
|
#
|
170
178
|
# @since 5.0.6
|
171
179
|
# @param target_name [String] Name of the target
|
172
180
|
# @return [Array<String>] Array of all command packet names
|
173
|
-
def
|
181
|
+
def get_all_cmd_names(target_name, scope: $openc3_scope, token: $openc3_token)
|
174
182
|
target_name = target_name.upcase
|
175
183
|
authorize(permission: 'cmd_info', target_name: target_name, scope: scope, token: token)
|
176
184
|
TargetModel.packet_names(target_name, type: :CMD, scope: scope)
|
177
185
|
end
|
186
|
+
# get_all_command_names is DEPRECATED
|
187
|
+
alias get_all_command_names get_all_cmd_names
|
178
188
|
|
179
189
|
# Returns a hash of the given command
|
180
190
|
#
|
181
191
|
# @since 5.0.0
|
182
|
-
# @param target_name [String] Name of the target
|
183
|
-
# @param command_name [String] Name of the packet
|
184
192
|
# @return [Hash] Command as a hash
|
185
|
-
def
|
186
|
-
target_name =
|
187
|
-
command_name = command_name.upcase
|
193
|
+
def get_cmd(*args, scope: $openc3_scope, token: $openc3_token)
|
194
|
+
target_name, command_name = _extract_target_command_names('get_cmd', *args)
|
188
195
|
authorize(permission: 'cmd_info', target_name: target_name, scope: scope, token: token)
|
189
196
|
TargetModel.packet(target_name, command_name, type: :CMD, scope: scope)
|
190
197
|
end
|
198
|
+
# get_command is DEPRECATED
|
199
|
+
alias get_command get_cmd
|
191
200
|
|
192
201
|
# Returns a hash of the given command parameter
|
193
202
|
#
|
@@ -196,13 +205,13 @@ module OpenC3
|
|
196
205
|
# @param command_name [String] Name of the packet
|
197
206
|
# @param parameter_name [String] Name of the parameter
|
198
207
|
# @return [Hash] Command parameter as a hash
|
199
|
-
def
|
200
|
-
target_name =
|
201
|
-
command_name = command_name.upcase
|
202
|
-
parameter_name = parameter_name.upcase
|
208
|
+
def get_param(*args, scope: $openc3_scope, token: $openc3_token)
|
209
|
+
target_name, command_name, parameter_name = _extract_target_command_parameter_names('get_param', *args)
|
203
210
|
authorize(permission: 'cmd_info', target_name: target_name, packet_name: command_name, scope: scope, token: token)
|
204
211
|
TargetModel.packet_item(target_name, command_name, parameter_name, type: :CMD, scope: scope)
|
205
212
|
end
|
213
|
+
# get_parameter is DEPRECATED
|
214
|
+
alias get_parameter get_param
|
206
215
|
|
207
216
|
# Returns whether the specified command is hazardous
|
208
217
|
#
|
@@ -257,19 +266,35 @@ module OpenC3
|
|
257
266
|
end
|
258
267
|
|
259
268
|
# Returns a value from the specified command
|
260
|
-
#
|
261
|
-
#
|
262
|
-
#
|
263
|
-
#
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
269
|
+
# Supports the following call syntax:
|
270
|
+
# get_cmd_value("TGT PKT ITEM", type: :RAW)
|
271
|
+
# get_cmd_value("TGT", "PKT", "ITEM", type: :RAW)
|
272
|
+
# get_cmd_value("TGT", "PKT", "ITEM", :RAW) # DEPRECATED
|
273
|
+
def get_cmd_value(*args, type: :CONVERTED, scope: $openc3_scope, token: $openc3_token)
|
274
|
+
target_name = nil
|
275
|
+
command_name = nil
|
276
|
+
parameter_name = nil
|
277
|
+
case args.length
|
278
|
+
when 1
|
279
|
+
target_name, command_name, parameter_name = args[0].upcase.split
|
280
|
+
when 3
|
281
|
+
target_name = args[0].upcase
|
282
|
+
command_name = args[1].upcase
|
283
|
+
parameter_name = args[2].upcase
|
284
|
+
when 4
|
285
|
+
target_name = args[0].upcase
|
286
|
+
command_name = args[1].upcase
|
287
|
+
parameter_name = args[2].upcase
|
288
|
+
type = args[3].upcase
|
289
|
+
else
|
290
|
+
# Invalid number of arguments
|
291
|
+
raise "ERROR: Invalid number of arguments (#{args.length}) passed to get_cmd_value()"
|
292
|
+
end
|
293
|
+
if target_name.nil? or command_name.nil? or parameter_name.nil?
|
294
|
+
raise "ERROR: Target name, command name and parameter name required. Usage: get_cmd_value(\"TGT CMD PARAM\") or #{method_name}(\"TGT\", \"CMD\", \"PARAM\")"
|
295
|
+
end
|
271
296
|
authorize(permission: 'cmd_info', target_name: target_name, packet_name: command_name, scope: scope, token: token)
|
272
|
-
CommandDecomTopic.get_cmd_item(target_name, command_name, parameter_name, type:
|
297
|
+
CommandDecomTopic.get_cmd_item(target_name, command_name, parameter_name, type: type, scope: scope)
|
273
298
|
end
|
274
299
|
|
275
300
|
# Returns the time the most recent command was sent
|
@@ -285,7 +310,7 @@ module OpenC3
|
|
285
310
|
target_name = target_name.upcase
|
286
311
|
command_name = command_name.upcase
|
287
312
|
time = CommandDecomTopic.get_cmd_item(target_name, command_name, 'RECEIVED_TIMESECONDS', type: :CONVERTED, scope: scope)
|
288
|
-
[target_name, command_name, time.to_i, ((time.to_f - time.to_i) * 1_000_000).to_i]
|
313
|
+
return [target_name, command_name, time.to_i, ((time.to_f - time.to_i) * 1_000_000).to_i]
|
289
314
|
else
|
290
315
|
if target_name.nil?
|
291
316
|
targets = TargetModel.names(scope: scope)
|
@@ -293,21 +318,22 @@ module OpenC3
|
|
293
318
|
target_name = target_name.upcase
|
294
319
|
targets = [target_name]
|
295
320
|
end
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
TargetModel.packets(
|
300
|
-
cur_time = CommandDecomTopic.get_cmd_item(
|
321
|
+
time = 0
|
322
|
+
command_name = nil
|
323
|
+
targets.each do |cur_target|
|
324
|
+
TargetModel.packets(cur_target, type: :CMD, scope: scope).each do |packet|
|
325
|
+
cur_time = CommandDecomTopic.get_cmd_item(cur_target, packet["packet_name"], 'RECEIVED_TIMESECONDS', type: :CONVERTED, scope: scope)
|
301
326
|
next unless cur_time
|
302
327
|
|
303
328
|
if cur_time > time
|
304
329
|
time = cur_time
|
305
330
|
command_name = packet["packet_name"]
|
331
|
+
target_name = cur_target
|
306
332
|
end
|
307
333
|
end
|
308
|
-
target_name = nil unless command_name
|
309
|
-
return [target_name, command_name, time.to_i, ((time.to_f - time.to_i) * 1_000_000).to_i]
|
310
334
|
end
|
335
|
+
target_name = nil unless command_name
|
336
|
+
return [target_name, command_name, time.to_i, ((time.to_f - time.to_i) * 1_000_000).to_i]
|
311
337
|
end
|
312
338
|
end
|
313
339
|
|
@@ -316,9 +342,8 @@ module OpenC3
|
|
316
342
|
# @param target_name [String] Target name of the command
|
317
343
|
# @param command_name [String] Packet name of the command
|
318
344
|
# @return [Numeric] Transmit count for the command
|
319
|
-
def get_cmd_cnt(
|
320
|
-
target_name =
|
321
|
-
command_name = command_name.upcase
|
345
|
+
def get_cmd_cnt(*args, scope: $openc3_scope, token: $openc3_token)
|
346
|
+
target_name, command_name = _extract_target_command_names('get_cmd_cnt', *args)
|
322
347
|
authorize(permission: 'system', target_name: target_name, packet_name: command_name, scope: scope, token: token)
|
323
348
|
TargetModel.packet(target_name, command_name, type: :CMD, scope: scope)
|
324
349
|
Topic.get_cnt("#{scope}__COMMAND__{#{target_name}}__#{command_name}")
|
@@ -330,6 +355,9 @@ module OpenC3
|
|
330
355
|
# @return [Numeric] Transmit count for the command
|
331
356
|
def get_cmd_cnts(target_commands, scope: $openc3_scope, token: $openc3_token)
|
332
357
|
authorize(permission: 'system', scope: scope, token: token)
|
358
|
+
unless target_commands.is_a?(Array) and target_commands[0].is_a?(Array)
|
359
|
+
raise "get_cmd_cnts takes an array of arrays containing target, packet_name, e.g. [['INST', 'COLLECT'], ['INST', 'ABORT']]"
|
360
|
+
end
|
333
361
|
counts = []
|
334
362
|
target_commands.each do |target_name, command_name|
|
335
363
|
target_name = target_name.upcase
|
@@ -343,7 +371,47 @@ module OpenC3
|
|
343
371
|
# PRIVATE implementation details
|
344
372
|
###########################################################################
|
345
373
|
|
346
|
-
def
|
374
|
+
def _extract_target_command_names(method_name, *args)
|
375
|
+
target_name = nil
|
376
|
+
command_name = nil
|
377
|
+
case args.length
|
378
|
+
when 1
|
379
|
+
target_name, command_name = args[0].upcase.split
|
380
|
+
when 2
|
381
|
+
target_name = args[0].upcase
|
382
|
+
command_name = args[1].upcase
|
383
|
+
else
|
384
|
+
# Invalid number of arguments
|
385
|
+
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{method_name}()"
|
386
|
+
end
|
387
|
+
if target_name.nil? or command_name.nil?
|
388
|
+
raise "ERROR: Target name and command name required. Usage: #{method_name}(\"TGT CMD\") or #{method_name}(\"TGT\", \"CMD\")"
|
389
|
+
end
|
390
|
+
return [target_name, command_name]
|
391
|
+
end
|
392
|
+
|
393
|
+
def _extract_target_command_parameter_names(method_name, *args)
|
394
|
+
target_name = nil
|
395
|
+
command_name = nil
|
396
|
+
parameter_name = nil
|
397
|
+
case args.length
|
398
|
+
when 1
|
399
|
+
target_name, command_name, parameter_name = args[0].upcase.split
|
400
|
+
when 3
|
401
|
+
target_name = args[0].upcase
|
402
|
+
command_name = args[1].upcase
|
403
|
+
parameter_name = args[2].upcase
|
404
|
+
else
|
405
|
+
# Invalid number of arguments
|
406
|
+
raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{method_name}()"
|
407
|
+
end
|
408
|
+
if target_name.nil? or command_name.nil? or parameter_name.nil?
|
409
|
+
raise "ERROR: Target name, command name and parameter name required. Usage: #{method_name}(\"TGT CMD PARAM\") or #{method_name}(\"TGT\", \"CMD\", \"PARAM\")"
|
410
|
+
end
|
411
|
+
return [target_name, command_name, parameter_name]
|
412
|
+
end
|
413
|
+
|
414
|
+
def _cmd_implementation(method_name, *args, range_check:, hazardous_check:, raw:, timeout: nil, log_message: nil,
|
347
415
|
scope: $openc3_scope, token: $openc3_token, **kwargs)
|
348
416
|
extract_string_kwargs_to_args(args, kwargs)
|
349
417
|
unless [nil, true, false].include?(log_message)
|
@@ -399,17 +467,13 @@ module OpenC3
|
|
399
467
|
end
|
400
468
|
end
|
401
469
|
if log_message
|
402
|
-
Logger.info(
|
470
|
+
Logger.info(_build_cmd_output_string(method_name, target_name, cmd_name, cmd_params, packet), scope: scope)
|
403
471
|
end
|
404
472
|
CommandTopic.send_command(command, timeout: timeout, scope: scope)
|
405
473
|
end
|
406
474
|
|
407
|
-
def
|
408
|
-
|
409
|
-
output_string = 'cmd_raw("'
|
410
|
-
else
|
411
|
-
output_string = 'cmd("'
|
412
|
-
end
|
475
|
+
def _build_cmd_output_string(method_name, target_name, cmd_name, cmd_params, packet)
|
476
|
+
output_string = "#{method_name}(\""
|
413
477
|
output_string << target_name + ' ' + cmd_name
|
414
478
|
if cmd_params.nil? or cmd_params.empty?
|
415
479
|
output_string << '")'
|
@@ -14,10 +14,10 @@
|
|
14
14
|
# GNU Affero General Public License for more details.
|
15
15
|
|
16
16
|
# Modified by OpenC3, Inc.
|
17
|
-
# All changes Copyright
|
17
|
+
# All changes Copyright 2023, 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/tool_config_model'
|
@@ -26,16 +26,16 @@ module OpenC3
|
|
26
26
|
module Api
|
27
27
|
WHITELIST ||= []
|
28
28
|
WHITELIST.concat([
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
29
|
+
'config_tool_names',
|
30
|
+
'list_configs',
|
31
|
+
'load_config',
|
32
|
+
'save_config',
|
33
|
+
'delete_config'
|
34
|
+
])
|
35
|
+
|
36
|
+
def config_tool_names(scope: $openc3_scope, token: $openc3_token)
|
37
|
+
authorize(permission: 'system', scope: scope, token: token)
|
38
|
+
ToolConfigModel.config_tool_names(scope: scope)
|
39
39
|
end
|
40
40
|
|
41
41
|
def list_configs(tool, scope: $openc3_scope, token: $openc3_token)
|
@@ -109,10 +109,11 @@ module OpenC3
|
|
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
111
|
def limits_enabled?(*args, scope: $openc3_scope, token: $openc3_token)
|
112
|
-
target_name, packet_name, item_name =
|
112
|
+
target_name, packet_name, item_name = _tlm_process_args(args, 'limits_enabled?', scope: scope)
|
113
113
|
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, 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
|
+
alias limits_enabled limits_enabled?
|
116
117
|
|
117
118
|
# Enable limits checking for a telemetry item
|
118
119
|
#
|
@@ -124,7 +125,7 @@ module OpenC3
|
|
124
125
|
#
|
125
126
|
# @param args [String|Array<String>] See the description for calling style
|
126
127
|
def enable_limits(*args, scope: $openc3_scope, token: $openc3_token)
|
127
|
-
target_name, packet_name, item_name =
|
128
|
+
target_name, packet_name, item_name = _tlm_process_args(args, 'enable_limits', scope: scope)
|
128
129
|
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
129
130
|
packet = TargetModel.packet(target_name, packet_name, scope: scope)
|
130
131
|
found_item = nil
|
@@ -157,7 +158,7 @@ module OpenC3
|
|
157
158
|
#
|
158
159
|
# @param args [String|Array<String>] See the description for calling style
|
159
160
|
def disable_limits(*args, scope: $openc3_scope, token: $openc3_token)
|
160
|
-
target_name, packet_name, item_name =
|
161
|
+
target_name, packet_name, item_name = _tlm_process_args(args, 'disable_limits', scope: scope)
|
161
162
|
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
162
163
|
packet = TargetModel.packet(target_name, packet_name, scope: scope)
|
163
164
|
found_item = nil
|
@@ -30,7 +30,8 @@ module OpenC3
|
|
30
30
|
'get_all_settings',
|
31
31
|
'get_setting',
|
32
32
|
'get_settings',
|
33
|
-
'
|
33
|
+
'set_setting',
|
34
|
+
'save_setting' # DEPRECATED
|
34
35
|
])
|
35
36
|
|
36
37
|
def list_settings(scope: $openc3_scope, token: $openc3_token)
|
@@ -60,10 +61,12 @@ module OpenC3
|
|
60
61
|
result
|
61
62
|
end
|
62
63
|
|
63
|
-
def
|
64
|
+
def set_setting(name, data, scope: $openc3_scope, token: $openc3_token)
|
64
65
|
authorize(permission: 'admin', scope: scope, token: token)
|
65
66
|
SettingModel.set({ name: name, data: data }, scope: scope)
|
66
67
|
LocalMode.save_setting(scope, name, data)
|
67
68
|
end
|
69
|
+
# save_setting is DEPRECATED
|
70
|
+
alias save_setting set_setting
|
68
71
|
end
|
69
72
|
end
|