openc3 6.4.2 → 6.5.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.
- checksums.yaml +4 -4
- data/bin/openc3cli +172 -97
- data/data/config/_graph_params.yaml +4 -4
- data/data/config/conversions.yaml +2 -1
- data/data/config/item_modifiers.yaml +1 -0
- data/data/config/plugins.yaml +14 -1
- data/data/config/processors.yaml +51 -0
- data/data/config/telemetry_modifiers.yaml +1 -0
- data/lib/openc3/api/tlm_api.rb +10 -5
- data/lib/openc3/microservices/interface_microservice.rb +15 -9
- data/lib/openc3/models/plugin_model.rb +5 -4
- data/lib/openc3/models/scope_model.rb +87 -57
- data/lib/openc3/models/script_engine_model.rb +93 -0
- data/lib/openc3/models/script_status_model.rb +4 -0
- data/lib/openc3/models/target_model.rb +7 -1
- data/lib/openc3/script/script.rb +5 -1
- data/lib/openc3/script_engines/script_engine.rb +118 -0
- data/lib/openc3/topics/interface_topic.rb +23 -3
- data/lib/openc3/utilities/cli_generator.rb +42 -15
- data/lib/openc3/utilities/running_script.rb +1460 -0
- data/lib/openc3/version.rb +6 -6
- data/templates/conversion/conversion.py +1 -1
- data/templates/conversion/conversion.rb +1 -1
- data/templates/processor/processor.py +32 -0
- data/templates/processor/processor.rb +36 -0
- data/templates/tool_angular/package.json +2 -2
- data/templates/tool_react/package.json +1 -1
- data/templates/tool_svelte/package.json +1 -1
- data/templates/tool_vue/package.json +3 -3
- data/templates/widget/package.json +2 -2
- metadata +7 -1
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: ascii-8bit
|
2
2
|
|
3
|
-
# Copyright
|
3
|
+
# Copyright 2025 OpenC3, Inc.
|
4
4
|
# All Rights Reserved.
|
5
5
|
#
|
6
6
|
# This program is free software; you can modify and/or redistribute it
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
module OpenC3
|
20
20
|
class CliGenerator
|
21
|
-
GENERATORS = %w(plugin target microservice widget conversion limits_response tool tool_vue tool_angular tool_react tool_svelte)
|
21
|
+
GENERATORS = %w(plugin target microservice widget conversion processor limits_response tool tool_vue tool_angular tool_react tool_svelte)
|
22
22
|
TEMPLATES_DIR = "#{File.dirname(__FILE__)}/../../../templates"
|
23
23
|
|
24
24
|
# Called by openc3cli with ARGV[1..-1]
|
@@ -32,8 +32,8 @@ module OpenC3
|
|
32
32
|
|
33
33
|
def self.check_args(args)
|
34
34
|
args.each do |arg|
|
35
|
-
if arg =~ /\s/
|
36
|
-
abort("#{args[0].to_s.downcase} arguments can not have spaces!")
|
35
|
+
if arg =~ /\s/ and args[0].to_s.downcase[0..3] != 'tool'
|
36
|
+
abort("#{args[0].to_s.downcase} arguments can not have spaces!")
|
37
37
|
end
|
38
38
|
end
|
39
39
|
# All generators except 'plugin' must be within an existing plugin
|
@@ -58,12 +58,12 @@ module OpenC3
|
|
58
58
|
def self.process_template(template_dir, the_binding)
|
59
59
|
Dir.glob("#{template_dir}/**/*", File::FNM_DOTMATCH).each do |file|
|
60
60
|
next if File.basename(file) == '.'
|
61
|
-
if @@language == 'rb'
|
61
|
+
if @@language == 'rb' and File.extname(file) == '.py'
|
62
62
|
# Ignore python files if we're ruby
|
63
|
-
next
|
64
|
-
elsif @@language == 'py'
|
63
|
+
next
|
64
|
+
elsif @@language == 'py' and File.extname(file) == '.rb'
|
65
65
|
# Ignore ruby files if we're python
|
66
|
-
next
|
66
|
+
next
|
67
67
|
end
|
68
68
|
base_name = file.sub("#{template_dir}/", '')
|
69
69
|
next if yield base_name
|
@@ -113,8 +113,8 @@ module OpenC3
|
|
113
113
|
abort("Target #{target_path} already exists!")
|
114
114
|
end
|
115
115
|
target_lib_filename = "#{target_name.downcase}.#{@@language}"
|
116
|
-
target_class = target_lib_filename.filename_to_class_name
|
117
|
-
target_object = target_name.downcase
|
116
|
+
target_class = target_lib_filename.filename_to_class_name # NOSONAR
|
117
|
+
target_object = target_name.downcase # NOSONAR
|
118
118
|
|
119
119
|
process_template("#{TEMPLATES_DIR}/target", binding) do |filename|
|
120
120
|
# Rename the template TARGET to our actual target named after the plugin
|
@@ -175,7 +175,7 @@ module OpenC3
|
|
175
175
|
abort("Microservice #{microservice_path} already exists!")
|
176
176
|
end
|
177
177
|
microservice_filename = "#{microservice_name.downcase}.#{@@language}"
|
178
|
-
microservice_class = microservice_filename.filename_to_class_name
|
178
|
+
microservice_class = microservice_filename.filename_to_class_name # NOSONAR
|
179
179
|
|
180
180
|
process_template("#{TEMPLATES_DIR}/microservice", binding) do |filename|
|
181
181
|
# Rename the template MICROSERVICE to our actual microservice name
|
@@ -310,9 +310,8 @@ module OpenC3
|
|
310
310
|
abort("Target '#{target_name}' does not exist! Conversions must be created for existing targets.")
|
311
311
|
end
|
312
312
|
conversion_name = "#{args[2].upcase.gsub(/_+|-+/, '_')}_CONVERSION"
|
313
|
-
conversion_path = "targets/#{target_name}/lib/"
|
314
313
|
conversion_basename = "#{conversion_name.downcase}.#{@@language}"
|
315
|
-
conversion_class = conversion_basename.filename_to_class_name
|
314
|
+
conversion_class = conversion_basename.filename_to_class_name # NOSONAR
|
316
315
|
conversion_filename = "targets/#{target_name}/lib/#{conversion_basename}"
|
317
316
|
if File.exist?(conversion_filename)
|
318
317
|
abort("Conversion #{conversion_filename} already exists!")
|
@@ -329,6 +328,35 @@ module OpenC3
|
|
329
328
|
return conversion_name
|
330
329
|
end
|
331
330
|
|
331
|
+
def self.generate_processor(args)
|
332
|
+
if args.length < 3 or args.length > 4
|
333
|
+
abort("Usage: cli generate processor <TARGET> <NAME> (--ruby or --python)")
|
334
|
+
end
|
335
|
+
|
336
|
+
# Create the local variables
|
337
|
+
target_name = args[1].upcase
|
338
|
+
unless File.exist?("targets/#{target_name}")
|
339
|
+
abort("Target '#{target_name}' does not exist! Processors must be created for existing targets.")
|
340
|
+
end
|
341
|
+
processor_name = "#{args[2].upcase.gsub(/_+|-+/, '_')}_PROCESSOR"
|
342
|
+
processor_basename = "#{processor_name.downcase}.#{@@language}"
|
343
|
+
processor_class = processor_basename.filename_to_class_name # NOSONAR
|
344
|
+
processor_filename = "targets/#{target_name}/lib/#{processor_basename}"
|
345
|
+
if File.exist?(processor_filename)
|
346
|
+
abort("Processor #{processor_filename} already exists!")
|
347
|
+
end
|
348
|
+
|
349
|
+
process_template("#{TEMPLATES_DIR}/processor", binding) do |filename|
|
350
|
+
filename.sub!("processor.#{@@language}", processor_filename)
|
351
|
+
false
|
352
|
+
end
|
353
|
+
|
354
|
+
puts "Processor #{processor_filename} successfully generated!"
|
355
|
+
puts "To use the processor add the following to a telemetry packet:"
|
356
|
+
puts " PROCESSOR #{args[2].upcase} #{processor_basename} <PARAMS...>"
|
357
|
+
return processor_name
|
358
|
+
end
|
359
|
+
|
332
360
|
def self.generate_limits_response(args)
|
333
361
|
if args.length < 3 or args.length > 4
|
334
362
|
abort("Usage: cli generate limits_response <TARGET> <NAME> (--ruby or --python)")
|
@@ -340,10 +368,9 @@ module OpenC3
|
|
340
368
|
abort("Target '#{target_name}' does not exist! Limits responses must be created for existing targets.")
|
341
369
|
end
|
342
370
|
response_name = "#{args[2].upcase.gsub(/_+|-+/, '_')}_LIMITS_RESPONSE"
|
343
|
-
response_path = "targets/#{target_name}/lib/"
|
344
371
|
response_basename = "#{response_name.downcase}.#{@@language}"
|
345
|
-
response_class = response_basename.filename_to_class_name
|
346
372
|
response_filename = "targets/#{target_name}/lib/#{response_basename}"
|
373
|
+
response_class = response_basename.filename_to_class_name # NOSONAR
|
347
374
|
if File.exist?(response_filename)
|
348
375
|
abort("response #{response_filename} already exists!")
|
349
376
|
end
|