openc3 5.14.0 → 5.14.2

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.

Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/bin/openc3cli +19 -15
  3. data/bin/pipinstall +9 -0
  4. data/data/config/target_config.yaml +2 -1
  5. data/lib/openc3/config/config_parser.rb +12 -12
  6. data/lib/openc3/conversions/conversion.rb +4 -4
  7. data/lib/openc3/interfaces/interface.rb +25 -18
  8. data/lib/openc3/microservices/decom_microservice.rb +4 -2
  9. data/lib/openc3/microservices/interface_microservice.rb +27 -23
  10. data/lib/openc3/microservices/log_microservice.rb +6 -1
  11. data/lib/openc3/microservices/microservice.rb +28 -0
  12. data/lib/openc3/models/microservice_model.rb +5 -1
  13. data/lib/openc3/models/plugin_model.rb +11 -7
  14. data/lib/openc3/models/target_model.rb +36 -4
  15. data/lib/openc3/operators/microservice_operator.rb +23 -21
  16. data/lib/openc3/packets/commands.rb +4 -0
  17. data/lib/openc3/packets/limits_response.rb +1 -1
  18. data/lib/openc3/packets/packet_config.rb +78 -31
  19. data/lib/openc3/packets/packet_item.rb +3 -2
  20. data/lib/openc3/packets/packet_item_limits.rb +2 -1
  21. data/lib/openc3/packets/parsers/limits_response_parser.rb +21 -10
  22. data/lib/openc3/packets/parsers/processor_parser.rb +19 -10
  23. data/lib/openc3/packets/telemetry.rb +4 -0
  24. data/lib/openc3/system/system.rb +31 -1
  25. data/lib/openc3/system/system_config.rb +9 -10
  26. data/lib/openc3/system/target.rb +6 -6
  27. data/lib/openc3/utilities/cli_generator.rb +18 -3
  28. data/lib/openc3/utilities/python_proxy.rb +52 -0
  29. data/lib/openc3/version.rb +5 -5
  30. data/templates/conversion/conversion.py +1 -1
  31. data/templates/conversion/conversion.rb +1 -1
  32. data/templates/limits_response/response.py +2 -2
  33. data/templates/limits_response/response.rb +2 -2
  34. data/templates/microservice/microservices/TEMPLATE/microservice.py +6 -3
  35. data/templates/target/targets/TARGET/lib/target.py +2 -2
  36. data/templates/target/targets/TARGET/target.txt +2 -0
  37. data/templates/tool_angular/package.json +2 -2
  38. data/templates/tool_svelte/package.json +1 -1
  39. data/templates/tool_svelte/src/services/config-parser.js +5 -6
  40. data/templates/tool_svelte/src/services/openc3-api.js +9 -1
  41. data/templates/tool_vue/package.json +2 -2
  42. data/templates/widget/package.json +2 -2
  43. metadata +4 -2
@@ -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 2022, OpenC3, Inc.
17
+ # All changes Copyright 2024, 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'
@@ -30,7 +30,6 @@ require 'openc3/logs'
30
30
  require 'fileutils'
31
31
  require 'openc3/utilities/zip'
32
32
  require 'bundler'
33
- require 'thread'
34
33
 
35
34
  module OpenC3
36
35
  # System is the primary entry point into the OpenC3 framework. It captures
@@ -90,7 +89,7 @@ module OpenC3
90
89
  # @param targets_config_dir [String] The configuration directory to
91
90
  # search for the target command and telemetry files.
92
91
  def process_file(filename, targets_config_dir)
93
- parser = ConfigParser.new("https://openc3.com/docs/v5")
92
+ parser = ConfigParser.new("https://docs.openc3.com/docs")
94
93
 
95
94
  # First pass - Everything except targets
96
95
  parser.parse_file(filename) do |keyword, parameters|
@@ -192,7 +191,7 @@ module OpenC3
192
191
  # If any of the targets original directory name matches the
193
192
  # current directory then it must have been already processed by
194
193
  # DECLARE_TARGET so we skip it.
195
- next if @targets.select { |name, target| target.original_name == dir_filename }.length > 0
194
+ next if @targets.select { |_name, target| target.original_name == dir_filename }.length > 0
196
195
  next if dir_filename == 'SYSTEM'
197
196
 
198
197
  target = Target.new(dir_filename, nil, targets_config_dir)
@@ -352,7 +351,7 @@ module OpenC3
352
351
  # If any of the targets original directory name matches the
353
352
  # current directory then it must have been already processed by
354
353
  # DECLARE_TARGET so we skip it.
355
- next if @targets.select { |name, target| target.original_name == target_name }.length > 0
354
+ next if @targets.select { |_name, target| target.original_name == target_name }.length > 0
356
355
 
357
356
  target = Target.new(target_name, nil, nil, nil, spec.gem_dir)
358
357
  @targets[target.name] = target
@@ -377,7 +376,7 @@ module OpenC3
377
376
 
378
377
  # Copy target files into archive
379
378
  zip_targets = []
380
- @targets.each do |target_name, target|
379
+ @targets.each do |_target_name, target|
381
380
  entries = Dir.entries(target.dir) - %w(. ..)
382
381
  zip_target = File.join(zip_file_path, target.original_name)
383
382
  # Check the stored list of targets. We can't ask the zip file
@@ -390,7 +389,7 @@ module OpenC3
390
389
 
391
390
  # Create custom system.txt file
392
391
  zipfile.get_output_stream(File.join(zip_file_path, 'system.txt')) do |file|
393
- @targets.each do |target_name, target|
392
+ @targets.each do |_target_name, target|
394
393
  target_filename = File.basename(target.filename)
395
394
  target_filename = nil unless File.exist?(target.filename)
396
395
  # Create a newline character since Zip opens files in binary mode
@@ -405,8 +404,8 @@ module OpenC3
405
404
  end
406
405
  File.rename(configuration_tmp, configuration)
407
406
  File.chmod(0444, configuration) # Mark readonly
408
- rescue Exception => error
409
- Logger.error "Problem saving configuration to #{configuration}: #{error.class}:#{error.message}\n#{error.backtrace.join("\n")}\n"
407
+ rescue Exception => e
408
+ Logger.error "Problem saving configuration to #{configuration}: #{e.class}:#{e.message}\n#{e.backtrace.join("\n")}\n"
410
409
  end
411
410
  end
412
411
  end
@@ -14,7 +14,7 @@
14
14
  # GNU Affero General Public License for more details.
15
15
 
16
16
  # Modified by OpenC3, Inc.
17
- # All changes Copyright 2022, OpenC3, Inc.
17
+ # All changes Copyright 2024, OpenC3, Inc.
18
18
  # All Rights Reserved
19
19
  #
20
20
  # This file may also be used under the terms of a commercial license
@@ -114,8 +114,8 @@ module OpenC3
114
114
  #
115
115
  # @param filename [String] The target configuration file to parse
116
116
  def process_file(filename)
117
- Logger.instance.info "Processing ruby target definition in file '#{filename}'"
118
- parser = ConfigParser.new("https://openc3.com/docs/v5/target")
117
+ Logger.instance.info "Processing target definition in file '#{filename}'"
118
+ parser = ConfigParser.new("https://docs.openc3.com/docs/configuration/target")
119
119
  parser.parse_file(filename) do |keyword, parameters|
120
120
  case keyword
121
121
  when 'LANGUAGE'
@@ -143,8 +143,8 @@ module OpenC3
143
143
  rescue Exception => err
144
144
  raise parser.error(err.message)
145
145
  end
146
- rescue Exception => err
147
- raise parser.error(err.message)
146
+ rescue Exception => e
147
+ raise parser.error(e.message)
148
148
  end
149
149
 
150
150
  # This code resolves any relative paths to absolute before putting into the @requires array
@@ -196,7 +196,7 @@ module OpenC3
196
196
  end
197
197
  end
198
198
 
199
- def as_json(*a)
199
+ def as_json(*_a)
200
200
  config = {}
201
201
  config['name'] = @name
202
202
  config['requires'] = @requires
@@ -128,6 +128,16 @@ module OpenC3
128
128
  gemspec = File.read(gemspec_filename)
129
129
  gemspec.gsub!('plugin.txt', 'plugin.txt requirements.txt')
130
130
  File.write(gemspec_filename, gemspec)
131
+
132
+ target_txt_filename = "targets/#{target_name}/target.txt"
133
+ target_txt = File.read(target_txt_filename)
134
+ target_txt.gsub!('LANGUAGE ruby', 'LANGUAGE python')
135
+ File.write(target_txt_filename, target_txt)
136
+ end
137
+
138
+ interface_line = "INTERFACE <%= #{target_name.downcase}_target_name %>_INT tcpip_client_interface.rb host.docker.internal 8080 8081 10.0 nil BURST"
139
+ if @@language == 'py'
140
+ interface_line = "INTERFACE <%= #{target_name.downcase}_target_name %>_INT openc3/interfaces/tcpip_client_interface.py host.docker.internal 8080 8081 10.0 None BURST"
131
141
  end
132
142
 
133
143
  # Add this target to plugin.txt
@@ -137,7 +147,7 @@ module OpenC3
137
147
  VARIABLE #{target_name.downcase}_target_name #{target_name}
138
148
 
139
149
  TARGET #{target_name} <%= #{target_name.downcase}_target_name %>
140
- INTERFACE <%= #{target_name.downcase}_target_name %>_INT tcpip_client_interface.rb host.docker.internal 8080 8081 10.0 nil BURST
150
+ #{interface_line}
141
151
  MAP_TARGET <%= #{target_name.downcase}_target_name %>
142
152
  DOC
143
153
  end
@@ -167,12 +177,17 @@ module OpenC3
167
177
  false
168
178
  end
169
179
 
180
+ cmd_line = "CMD ruby #{microservice_name.downcase}.rb"
181
+ if @@language == 'py'
182
+ cmd_line = "CMD python #{microservice_name.downcase}.py"
183
+ end
184
+
170
185
  # Add this microservice to plugin.txt
171
186
  File.open("plugin.txt", 'a') do |file|
172
187
  file.puts <<~DOC
173
188
 
174
189
  MICROSERVICE #{microservice_name} #{microservice_name.downcase.gsub('_','-')}-microservice
175
- CMD ruby #{microservice_name.downcase}.rb
190
+ #{cmd_line}
176
191
  DOC
177
192
  end
178
193
 
@@ -222,7 +237,7 @@ module OpenC3
222
237
  end
223
238
 
224
239
  puts "Widget #{widget_name} successfully generated!"
225
- puts "Please be sure #{widget_name} does not overlap an existing widget: https://openc3.com/docs/v5/telemetry-screens"
240
+ puts "Please be sure #{widget_name} does not overlap an existing widget: https://docs.openc3.com/docs/configuration/telemetry-screens"
226
241
  return widget_name
227
242
  end
228
243
 
@@ -0,0 +1,52 @@
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2024 OpenC3, Inc.
4
+ # All Rights Reserved.
5
+ #
6
+ # This program is free software; you can modify and/or redistribute it
7
+ # under the terms of the GNU Affero General Public License
8
+ # as published by the Free Software Foundation; version 3 with
9
+ # attribution addendums as found in the LICENSE.txt
10
+ #
11
+ # This program is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Affero General Public License for more details.
15
+ #
16
+ # This file may also be used under the terms of a commercial license
17
+ # if purchased from OpenC3, Inc.
18
+
19
+ # TODO: Delegate to actual Python to verify that classes exist
20
+ # and to get proper data from them like converted_type
21
+
22
+ module OpenC3
23
+ class PythonProxy
24
+ attr_accessor :name
25
+ attr_accessor :args
26
+
27
+ def initialize(type, class_name, *params)
28
+ @type = type
29
+ @class_name = class_name
30
+ @params = params
31
+ @args = params
32
+ @name = nil
33
+ end
34
+
35
+ def class
36
+ return @class_name
37
+ end
38
+
39
+ def as_json(*args, **kw_args)
40
+ case @type
41
+ when "Processor"
42
+ return { 'name' => @name, 'class' => @class_name, 'params' => @params }
43
+ when "Conversion"
44
+ return { 'class' => @class_name, 'params' => @params }
45
+ when "LimitsResponse"
46
+ return { "class" => @class_name, 'params' => @params }
47
+ else
48
+ raise "Unknown PythonProxy type: #{@type}"
49
+ end
50
+ end
51
+ end
52
+ end
@@ -1,14 +1,14 @@
1
1
  # encoding: ascii-8bit
2
2
 
3
- OPENC3_VERSION = '5.14.0'
3
+ OPENC3_VERSION = '5.14.2'
4
4
  module OpenC3
5
5
  module Version
6
6
  MAJOR = '5'
7
7
  MINOR = '14'
8
- PATCH = '0'
8
+ PATCH = '2'
9
9
  OTHER = ''
10
- BUILD = 'dd31e4853fa50ed08ee3100e43e75849617d0a47'
10
+ BUILD = 'e5d9da06d95d4404fba6f9fd5a74a130ef176bd4'
11
11
  end
12
- VERSION = '5.14.0'
13
- GEM_VERSION = '5.14.0'
12
+ VERSION = '5.14.2'
13
+ GEM_VERSION = '5.14.2'
14
14
  end
@@ -1,7 +1,7 @@
1
1
  from openc3.conversions.conversion import Conversion
2
2
 
3
3
  # Custom conversion class
4
- # See https://openc3.com/docs/v5/telemetry#read_conversion
4
+ # See https://docs.openc3.com/docs/configuration/telemetry#read_conversion
5
5
  class <%= conversion_class %>(Conversion):
6
6
  def __init__(self):
7
7
  super().__init__()
@@ -3,7 +3,7 @@ require 'openc3/conversions/conversion'
3
3
 
4
4
  module OpenC3
5
5
  # Custom conversion class
6
- # See https://openc3.com/docs/v5/telemetry#read_conversion
6
+ # See https://docs.openc3.com/docs/configuration/telemetry#read_conversion
7
7
  class <%= conversion_class %> < Conversion
8
8
  def initialize
9
9
  super()
@@ -24,13 +24,13 @@ class <%= response_class %>(LimitsResponse):
24
24
  pass
25
25
  # GREEN limits are only available if a telemetry item has them defined
26
26
  # COSMOS refers to these as "operational limits"
27
- # See https://openc3.com/docs/v5/telemetry#limits
27
+ # See https://docs.openc3.com/docs/configuration/telemetry#limits
28
28
  case "GREEN_LOW":
29
29
  pass
30
30
  case "GREEN_HIGH":
31
31
  pass
32
32
  # :RED and :YELLOW limits are triggered for STATES with defined RED and YELLOW states
33
- # See https://openc3.com/docs/v5/telemetry#state
33
+ # See https://docs.openc3.com/docs/configuration/telemetry#state
34
34
  case "RED":
35
35
  pass
36
36
  case "YELLOW":
@@ -21,11 +21,11 @@ module OpenC3
21
21
  when :YELLOW_HIGH
22
22
  # GREEN limits are only available if a telemetry item has them defined
23
23
  # COSMOS refers to these as "operational limits"
24
- # See https://openc3.com/docs/v5/telemetry#limits
24
+ # See https://docs.openc3.com/docs/configuration/telemetry#limits
25
25
  when :GREEN_LOW
26
26
  when :GREEN_HIGH
27
27
  # :RED and :YELLOW limits are triggered for STATES with defined RED and YELLOW states
28
- # See https://openc3.com/docs/v5/telemetry#state
28
+ # See https://docs.openc3.com/docs/configuration/telemetry#state
29
29
  when :RED
30
30
  when :YELLOW
31
31
  end
@@ -14,14 +14,17 @@ class <%= microservice_class %>(Microservice):
14
14
  self.period = int(option[1])
15
15
  case _:
16
16
  self.logger.error(
17
- "Unknown option passed to microservice #{@name}: #{option}"
17
+ f"Unknown option passed to microservice {name}: {option}"
18
18
  )
19
19
 
20
- if not self.period:
20
+ if not hasattr(self, 'period'):
21
21
  self.period = 60 # 1 minutes
22
22
  self.sleeper = Sleeper()
23
23
 
24
24
  def run(self):
25
+ # Allow the other target processes to start before running the microservice
26
+ self.sleeper.sleep(self.period)
27
+
25
28
  while True:
26
29
  start_time = time.time()
27
30
  if self.cancel_thread:
@@ -51,4 +54,4 @@ class <%= microservice_class %>(Microservice):
51
54
 
52
55
 
53
56
  if __name__ == "__main__":
54
- <%= microservice_class %>.run()
57
+ <%= microservice_class %>.class_run()
@@ -1,9 +1,9 @@
1
1
  # This class can be used in your scripts like so:
2
- # require_utility '<%= target_class.upcase %>/lib/<%= target_lib_filename %>'
2
+ # load_utility '<%= target_class.upcase %>/lib/<%= target_lib_filename %>'
3
3
  # <%= target_object %> = <%= target_class %>()
4
4
  # <%= target_object %>.utility()
5
5
  # For more information see the OpenC3 scripting guide
6
6
 
7
7
  class <%= target_class %>:
8
- def utility():
8
+ def utility(self):
9
9
  pass
@@ -1,3 +1,5 @@
1
+ LANGUAGE ruby
2
+
1
3
  # Ignored Parameters
2
4
  IGNORE_PARAMETER PKTID
3
5
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "<%= tool_name %>",
3
- "version": "5.14.0",
3
+ "version": "5.14.2",
4
4
  "scripts": {
5
5
  "ng": "ng",
6
6
  "start": "ng serve",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "private": true,
14
14
  "dependencies": {
15
- "@openc3/tool-common": "5.14.0",
15
+ "@openc3/tool-common": "5.14.2",
16
16
  "@angular/animations": "^17.0.8",
17
17
  "@angular/cdk": "^17.0.4",
18
18
  "@angular/common": "^17.0.8",
@@ -11,7 +11,7 @@
11
11
  "smui-theme": "smui-theme compile build/smui.css -i src/theme"
12
12
  },
13
13
  "dependencies": {
14
- "@openc3/tool-common": "5.14.0",
14
+ "@openc3/tool-common": "5.14.2",
15
15
  "@astrouxds/astro-web-components": "7.20.0",
16
16
  "@smui/button": "^7.0.0-beta.16",
17
17
  "@smui/card": "^7.0.0-beta.16",
@@ -13,7 +13,7 @@
13
13
  # GNU Affero General Public License for more details.
14
14
 
15
15
  # Modified by OpenC3, Inc.
16
- # All changes Copyright 2022, OpenC3, Inc.
16
+ # All changes Copyright 2024, OpenC3, Inc.
17
17
  # All Rights Reserved
18
18
  #
19
19
  # This file may also be used under the terms of a commercial license
@@ -39,8 +39,7 @@ export class ConfigParserService {
39
39
  filename = ''
40
40
  line = ''
41
41
  lineNumber = 0
42
- url = 'https://openc3.com/docs/v5'
43
-
42
+ url = 'https://docs.openc3.com/docs'
44
43
  constructor() {}
45
44
 
46
45
  verify_num_parameters(min_num_params, max_num_params, usage = '') {
@@ -53,7 +52,7 @@ export class ConfigParserService {
53
52
  this,
54
53
  `Not enough parameters for ${this.keyword}.`,
55
54
  usage,
56
- this.url
55
+ this.url,
57
56
  )
58
57
  }
59
58
  }
@@ -63,7 +62,7 @@ export class ConfigParserService {
63
62
  this,
64
63
  `Too many parameters for ${this.keyword}.`,
65
64
  usage,
66
- this.url
65
+ this.url,
67
66
  )
68
67
  }
69
68
  }
@@ -98,7 +97,7 @@ export class ConfigParserService {
98
97
  original_filename,
99
98
  yield_non_keyword_lines,
100
99
  remove_quotes,
101
- handler
100
+ handler,
102
101
  ) {
103
102
  let string_concat = false
104
103
  this.line = ''
@@ -13,7 +13,7 @@
13
13
  # GNU Affero General Public License for more details.
14
14
 
15
15
  # Modified by OpenC3, Inc.
16
- # All changes Copyright 2022, OpenC3, Inc.
16
+ # All changes Copyright 2024, OpenC3, Inc.
17
17
  # All Rights Reserved
18
18
  #
19
19
  # This file may also be used under the terms of a commercial license
@@ -164,6 +164,14 @@ export class OpenC3Api {
164
164
  return this.exec('disconnect_interface', [interface_name])
165
165
  }
166
166
 
167
+ interface_cmd(interface_name, command_name, ...command_params) {
168
+ return this.exec('interface_cmd', [
169
+ interface_name,
170
+ command_name,
171
+ ...command_params,
172
+ ])
173
+ }
174
+
167
175
  get_all_router_info() {
168
176
  return this.exec('get_all_router_info', [])
169
177
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "<%= tool_name %>",
3
- "version": "5.14.0",
3
+ "version": "5.14.2",
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.14.0",
14
+ "@openc3/tool-common": "5.14.2",
15
15
  "@astrouxds/astro-web-components": "7.20.0",
16
16
  "axios": "1.6.5",
17
17
  "date-fns": "2.30.0",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "widget",
3
- "version": "5.14.0",
3
+ "version": "5.14.2",
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.14.0",
9
+ "@openc3/tool-common": "5.14.2",
10
10
  "@astrouxds/astro-web-components": "7.20.0",
11
11
  "vue": "2.7.16",
12
12
  "vuetify": "2.7.1"
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.14.0
4
+ version: 5.14.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: 2024-01-18 00:00:00.000000000 Z
12
+ date: 2024-02-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -761,6 +761,7 @@ files:
761
761
  - Rakefile
762
762
  - bin/cstol_converter
763
763
  - bin/openc3cli
764
+ - bin/pipinstall
764
765
  - bin/rubysloc
765
766
  - data/config/_array_params.yaml
766
767
  - data/config/_canvas_values.yaml
@@ -1096,6 +1097,7 @@ files:
1096
1097
  - lib/openc3/utilities/migration.rb
1097
1098
  - lib/openc3/utilities/open_telemetry.rb
1098
1099
  - lib/openc3/utilities/process_manager.rb
1100
+ - lib/openc3/utilities/python_proxy.rb
1099
1101
  - lib/openc3/utilities/quaternion.rb
1100
1102
  - lib/openc3/utilities/redis_secrets.rb
1101
1103
  - lib/openc3/utilities/ruby_lex_utils.rb