openc3 5.11.3 → 5.12.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.

Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/bin/openc3cli +26 -12
  4. data/data/config/_id_items.yaml +6 -4
  5. data/data/config/_id_params.yaml +9 -6
  6. data/data/config/_items.yaml +6 -4
  7. data/data/config/_params.yaml +3 -2
  8. data/data/config/interface_modifiers.yaml +1 -1
  9. data/data/config/microservice.yaml +10 -1
  10. data/data/config/plugins.yaml +13 -3
  11. data/data/config/target.yaml +9 -0
  12. data/data/config/target_config.yaml +12 -0
  13. data/data/config/tool.yaml +12 -3
  14. data/lib/openc3/api/api.rb +1 -1
  15. data/lib/openc3/api/cmd_api.rb +24 -24
  16. data/lib/openc3/api/config_api.rb +12 -12
  17. data/lib/openc3/api/limits_api.rb +4 -3
  18. data/lib/openc3/api/settings_api.rb +5 -2
  19. data/lib/openc3/api/tlm_api.rb +7 -10
  20. data/lib/openc3/conversions/unix_time_conversion.rb +8 -6
  21. data/lib/openc3/interfaces/tcpip_server_interface.rb +0 -7
  22. data/lib/openc3/io/json_drb.rb +3 -2
  23. data/lib/openc3/io/json_rpc.rb +6 -6
  24. data/lib/openc3/logs/buffered_packet_log_writer.rb +4 -2
  25. data/lib/openc3/logs/packet_log_writer.rb +22 -7
  26. data/lib/openc3/microservices/cleanup_microservice.rb +8 -1
  27. data/lib/openc3/microservices/decom_microservice.rb +1 -1
  28. data/lib/openc3/microservices/interface_microservice.rb +2 -2
  29. data/lib/openc3/microservices/microservice.rb +5 -2
  30. data/lib/openc3/microservices/reaction_microservice.rb +1 -0
  31. data/lib/openc3/microservices/timeline_microservice.rb +7 -5
  32. data/lib/openc3/migrations/20231022000000_tlm_viewer_config.rb +22 -0
  33. data/lib/openc3/models/activity_model.rb +21 -3
  34. data/lib/openc3/models/cvt_model.rb +2 -1
  35. data/lib/openc3/models/gem_model.rb +4 -1
  36. data/lib/openc3/models/interface_model.rb +11 -5
  37. data/lib/openc3/models/metadata_model.rb +11 -0
  38. data/lib/openc3/models/microservice_model.rb +16 -3
  39. data/lib/openc3/models/model.rb +18 -0
  40. data/lib/openc3/models/note_model.rb +11 -0
  41. data/lib/openc3/models/plugin_model.rb +18 -0
  42. data/lib/openc3/models/python_package_model.rb +104 -0
  43. data/lib/openc3/models/scope_model.rb +2 -0
  44. data/lib/openc3/models/sorted_model.rb +17 -8
  45. data/lib/openc3/models/target_model.rb +53 -18
  46. data/lib/openc3/models/tool_config_model.rb +9 -3
  47. data/lib/openc3/models/tool_model.rb +22 -7
  48. data/lib/openc3/models/widget_model.rb +19 -3
  49. data/lib/openc3/operators/microservice_operator.rb +2 -0
  50. data/lib/openc3/packets/limits.rb +6 -18
  51. data/lib/openc3/packets/packet.rb +1 -0
  52. data/lib/openc3/packets/parsers/format_string_parser.rb +4 -4
  53. data/lib/openc3/packets/parsers/limits_parser.rb +4 -4
  54. data/lib/openc3/packets/parsers/limits_response_parser.rb +5 -5
  55. data/lib/openc3/packets/parsers/processor_parser.rb +4 -4
  56. data/lib/openc3/packets/parsers/state_parser.rb +3 -3
  57. data/lib/openc3/script/api_shared.rb +50 -32
  58. data/lib/openc3/script/calendar.rb +109 -0
  59. data/lib/openc3/script/commands.rb +1 -8
  60. data/lib/openc3/script/{gems.rb → packages.rb} +20 -16
  61. data/lib/openc3/script/script.rb +49 -38
  62. data/lib/openc3/system/system.rb +2 -0
  63. data/lib/openc3/system/target.rb +10 -1
  64. data/lib/openc3/top_level.rb +2 -2
  65. data/lib/openc3/utilities/aws_bucket.rb +3 -2
  66. data/lib/openc3/utilities/bucket_file_cache.rb +1 -1
  67. data/lib/openc3/utilities/local_mode.rb +3 -1
  68. data/lib/openc3/utilities/logger.rb +1 -1
  69. data/lib/openc3/utilities/ruby_lex_utils.rb +0 -8
  70. data/lib/openc3/version.rb +6 -6
  71. data/templates/tool_angular/package.json +14 -14
  72. data/templates/tool_angular/yarn.lock +282 -129
  73. data/templates/tool_react/package.json +11 -11
  74. data/templates/tool_react/yarn.lock +353 -300
  75. data/templates/tool_svelte/package.json +12 -12
  76. data/templates/tool_svelte/src/services/openc3-api.js +16 -60
  77. data/templates/tool_svelte/yarn.lock +338 -212
  78. data/templates/tool_vue/package.json +9 -9
  79. data/templates/tool_vue/yarn.lock +55 -41
  80. data/templates/widget/package.json +10 -10
  81. data/templates/widget/yarn.lock +59 -45
  82. metadata +36 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a810e5031ff4cc16e2e2f171700189e4ba5c6ca041793033eb56129d087016b
4
- data.tar.gz: 61c2caa4d9a234dbffa4cc3ec5192df934b55f9fc3de88b013313ff71208bbfc
3
+ metadata.gz: 056635373017dd511a8d049e778f59c7548c62dbae9b905effb03d447a0775ae
4
+ data.tar.gz: bfe11cbba1792a9741d06f0c3ea9365757d5a3fac0f873cb2a86597796521a11
5
5
  SHA512:
6
- metadata.gz: dab9c2811db9e91bd078b618da8b788c7ea2ae353cd7941fd9afccff77649e8dc5703575e16aa3cd3cd04d6a499b1fd97dd127eae9b2b4cc52c6ae853ad4ebfb
7
- data.tar.gz: 402ab73b30182f61554f085465872a84d47f67238d630012b20f3d385f40d6bb652f6aec640acd5df24d7fe5c349475d07d80a6fc626fb3ac7ea6dd27d32842d
6
+ metadata.gz: d113e832989cef2126d880d5bfb5281185bcf4d393066c8a58797c9178d49165be1c5179609baf665b4bc51d698c1dbd9ed038c580f20c66ac9bdd532eb03d15
7
+ data.tar.gz: 6c6010c3310998627247edb81bd3958206e1756d87973a0c601183bc3f50ad8fddd1a2d22fd85d2368c9094a59f7e27f1031b80606f4bce0839d373a71213cf5
data/Gemfile CHANGED
@@ -7,11 +7,11 @@ gem 'ruby-termios', '>= 0.9' if RbConfig::CONFIG['target_os'] !~ /mswin|mingw|cy
7
7
  gemspec :name => 'openc3'
8
8
 
9
9
  # Include the rails gems for the convenience of custom microservice plugins
10
- gem 'rails', '~> 7.0.0'
10
+ gem 'rails', '~> 7.1.0'
11
11
  gem 'bootsnap', '>= 1.9.3', require: false
12
12
  gem 'rack-cors', '~> 2.0'
13
13
  gem 'tzinfo-data'
14
14
  gem 'rspec-rails', '~> 6.0'
15
15
  gem 'simplecov', '~> 0.20'
16
16
  gem 'simplecov-cobertura', '~> 2.1'
17
- gem 'mock_redis', '0.36'
17
+ gem 'mock_redis', '0.39'
data/bin/openc3cli CHANGED
@@ -72,7 +72,8 @@ def print_usage
72
72
  puts " cli bridge CONFIG_FILENAME # Run COSMOS host bridge"
73
73
  puts " cli bridgegem gem_name variable1=value1 variable2=value2 # Runs bridge using gem bridge.txt"
74
74
  puts " cli bridgesetup CONFIG_FILENAME # Create a default config file"
75
- puts " cli geminstall GEMFILENAME SCOPE # Install loaded gem to /gems"
75
+ puts " cli pkginstall PKGFILENAME SCOPE # Install loaded package (Ruby gem or python package)"
76
+ puts " cli pkguninstall PKGFILENAME SCOPE # Uninstall loaded package (Ruby gem or python package)"
76
77
  puts " cli rubysloc # Counts Ruby SLOC recursively. Run with --help for more info."
77
78
  puts " cli xtce_converter # Convert to and from the XTCE format. Run with --help for more info."
78
79
  puts " cli cstol_converter # Converts CSTOL files (.prc) to COSMOS. Run with --help for more info."
@@ -507,30 +508,43 @@ def unload_plugin(plugin_name, scope:)
507
508
  end
508
509
  end
509
510
 
510
- def cli_gem_install(gem_filename, scope:)
511
+ def cli_pkg_install(filename, scope:)
511
512
  scope ||= 'DEFAULT'
512
513
  check_environment()
513
514
  if $openc3_in_cluster
514
- OpenC3::GemModel.install(gem_filename, scope: scope)
515
+ if File.extname(filename) == '.gem'
516
+ OpenC3::GemModel.install(filename, scope: scope)
517
+ else
518
+ OpenC3::PythonPackageModel.install(filename, scope: scope)
519
+ end
515
520
  else
516
521
  # Outside Cluster
517
522
  require 'openc3/script'
518
- process_name = gem_install(gem_filename, scope: scope)
523
+ process_name = package_install(filename, scope: scope)
519
524
  print "Installing..."
520
525
  wait_process_complete(process_name)
521
526
  end
522
527
  end
523
528
 
524
- def cli_gem_uninstall(gem_filename, scope:)
529
+ def cli_pkg_uninstall(filename, scope:)
525
530
  scope ||= 'DEFAULT'
526
531
  check_environment()
527
532
  if $openc3_in_cluster
528
- OpenC3::GemModel.destroy(gem_filename)
533
+ if File.extname(filename) == '.rb'
534
+ OpenC3::GemModel.destroy(filename)
535
+ else
536
+ OpenC3::PythonPackageModel.destroy(filename, scope: scope)
537
+ end
529
538
  else
530
539
  # Outside Cluster
531
540
  require 'openc3/script'
532
- gem_uninstall(gem_filename, scope: scope)
533
- puts "Success!"
541
+ process_name = package_uninstall(filename, scope: scope)
542
+ if File.extname(filename) == '.rb'
543
+ puts "Uninstalled"
544
+ else
545
+ print "Uninstalling..."
546
+ wait_process_complete(process_name)
547
+ end
534
548
  end
535
549
  end
536
550
 
@@ -637,11 +651,11 @@ if not ARGV[0].nil? # argument(s) given
637
651
  when 'unload'
638
652
  unload_plugin(ARGV[1], scope: ARGV[2])
639
653
 
640
- when 'geminstall'
641
- cli_gem_install(ARGV[1], scope: ARGV[2])
654
+ when 'pkginstall', 'geminstall'
655
+ cli_pkg_install(ARGV[1], scope: ARGV[2])
642
656
 
643
- when 'gemuninstall'
644
- cli_gem_uninstall(ARGV[1], scope: ARGV[2])
657
+ when 'pkguninstall', 'gemuninstall'
658
+ cli_pkg_uninstall(ARGV[1], scope: ARGV[2])
645
659
 
646
660
  when 'generate'
647
661
  OpenC3::CliGenerator.generate(ARGV[1..-1])
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  - name: Bit Size
3
3
  required: true
4
- description: Bit size of this telemetry item. Zero or Negative values may be used
4
+ description:
5
+ Bit size of this telemetry item. Zero or Negative values may be used
5
6
  to indicate that a string fills the packet up to the offset from the end of
6
7
  the packet specified by this value. If Bit Offset is 0 and Bit Size is 0 then
7
8
  this is a derived parameter and the Data Type must be set to 'DERIVED'.
@@ -17,9 +18,10 @@
17
18
  - name: Description
18
19
  required: false
19
20
  description: Description for this telemetry item which must be enclosed with quotes
20
- values: "['\"].*['\"]"
21
+ values: '[''"].*[''"]'
21
22
  - name: Endianness
22
23
  required: false
23
- description: Indicates if the item is to be interpreted in Big Endian or Little Endian format.
24
- See guide on <a href="https://openc3.com/docs/v5/little-endian-bitfields">Little Endian Bitfields</a>.
24
+ description:
25
+ Indicates if the item is to be interpreted in Big Endian or Little Endian format.
26
+ See guide on [Little Endian Bitfields](../guides/little-endian-bitfields.md).
25
27
  values: <%= %w(BIG_ENDIAN LITTLE_ENDIAN) %>
@@ -22,17 +22,19 @@
22
22
  values: .*
23
23
  - name: ID Value
24
24
  required: true
25
- description: Identification value for this parameter. The binary data must
25
+ description:
26
+ Identification value for this parameter. The binary data must
26
27
  match this value for the buffer to be identified as this packet.
27
28
  values: .*
28
29
  - name: Description
29
30
  required: false
30
31
  description: Description for this parameter which must be enclosed with quotes
31
- values: "['\"].*['\"]"
32
+ values: '[''"].*[''"]'
32
33
  - name: Endianness
33
34
  required: false
34
- description: Indicates if the data in this command is to be sent in Big Endian or Little Endian format.
35
- See guide on <a href="https://openc3.com/docs/v5/little-endian-bitfields">Little Endian Bitfields</a>.
35
+ description:
36
+ Indicates if the data in this command is to be sent in Big Endian or Little Endian format.
37
+ See guide on [Little Endian Bitfields](../guides/little-endian-bitfields.md).
36
38
  values: <%= %w(BIG_ENDIAN LITTLE_ENDIAN) %>
37
39
  UINT:
38
40
  parameters: *params
@@ -44,13 +46,14 @@
44
46
  parameters: &sparams
45
47
  - name: Default Value
46
48
  required: true
47
- description: Default value for this parameter. You must provide a default
49
+ description:
50
+ Default value for this parameter. You must provide a default
48
51
  but if you mark the parameter REQUIRED then scripts will be forced to specify a value.
49
52
  values: .*
50
53
  - name: Description
51
54
  required: false
52
55
  description: Description for this parameter which must be enclosed with quotes
53
- values: "['\"].*['\"]"
56
+ values: '[''"].*[''"]'
54
57
  - name: Endianness
55
58
  required: false
56
59
  description: Indicates if the data in this command is to be sent in Big Endian or Little Endian format
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  - name: Bit Size
3
3
  required: true
4
- description: Bit size of this telemetry item. Zero or Negative values may be used
4
+ description:
5
+ Bit size of this telemetry item. Zero or Negative values may be used
5
6
  to indicate that a string fills the packet up to the offset from the end of
6
7
  the packet specified by this value. If Bit Offset is 0 and Bit Size is 0 then
7
8
  this is a derived parameter and the Data Type must be set to 'DERIVED'.
@@ -13,9 +14,10 @@
13
14
  - name: Description
14
15
  required: false
15
16
  description: Description for this telemetry item which must be enclosed with quotes
16
- values: "['\"].*['\"]"
17
+ values: '[''"].*[''"]'
17
18
  - name: Endianness
18
19
  required: false
19
- description: Indicates if the item is to be interpreted in Big Endian or Little Endian format.
20
- See guide on <a href="https://openc3.com/docs/v5/little-endian-bitfields">Little Endian Bitfields</a>.
20
+ description:
21
+ Indicates if the item is to be interpreted in Big Endian or Little Endian format.
22
+ See guide on [Little Endian Bitfields](../guides/little-endian-bitfields.md).
21
23
  values: <%= %w(BIG_ENDIAN LITTLE_ENDIAN) %>
@@ -32,8 +32,9 @@
32
32
  values: '[''"].*[''"]'
33
33
  - name: Endianness
34
34
  required: false
35
- description: Indicates if the data in this command is to be sent in Big Endian or Little Endian format.
36
- See guide on <a href="https://openc3.com/docs/v5/little-endian-bitfields">Little Endian Bitfields</a>.
35
+ description:
36
+ Indicates if the data in this command is to be sent in Big Endian or Little Endian format.
37
+ See guide on [Little Endian Bitfields](../guides/little-endian-bitfields.md).
37
38
  values: <%= %w(BIG_ENDIAN LITTLE_ENDIAN) %>
38
39
  UINT:
39
40
  parameters: *params
@@ -93,7 +93,7 @@ PROTOCOL:
93
93
  Protocols can be either READ, WRITE, or READ_WRITE. READ protocols act on the data
94
94
  received by the interface while write acts on the data before it is sent out. READ_WRITE applies
95
95
  the protocol to both reading and writing.<br/><br/>
96
- For information on creating your own custom protocol please see <a href="https://openc3.com/docs/v5/protocols">https://openc3.com/docs/v5/protocols</a>
96
+ For information on creating your own custom protocol please see [Protocols](../configuration/protocols.md)
97
97
  since: 4.0.0
98
98
  parameters:
99
99
  - name: Type
@@ -4,7 +4,7 @@ MICROSERVICE:
4
4
  description: Defines a microservice that the plugin adds to the OpenC3 system. Microservices are background software processes that perform persistent processing.
5
5
  parameters:
6
6
  - name: Microservice Folder Name
7
- description: The exact name of the microservice folder in the plugin. ie. microservices/<Microservice Folder Name>
7
+ description: The exact name of the microservice folder in the plugin. ie. microservices/MicroserviceFolderName
8
8
  required: true
9
9
  values: .+
10
10
  - name: Microservice Name
@@ -148,3 +148,12 @@ MICROSERVICE:
148
148
  example: |
149
149
  MICROSERVICE CFDP CFDP
150
150
  ROUTE_PREFIX /cfdp
151
+ DISABLE_ERB:
152
+ summary: Disable ERB processing
153
+ description: Disable ERB processing for the entire microservice or a set of regular expressions over its filenames
154
+ since: 5.12.0
155
+ parameters:
156
+ - name: Regex
157
+ required: false
158
+ description: Regex to match against filenames. If match, then no ERB processing
159
+ values: .+
@@ -40,7 +40,7 @@ INTERFACE:
40
40
  description: Ruby file to use when instantiating the interface.
41
41
  values:
42
42
  <%= MetaConfigParser.load('_interfaces.yaml').to_meta_config_yaml(8) %>
43
- documentation: Additional parameters are required. Please see the [Interfaces](/docs/v5/interfaces)
43
+ documentation: Additional parameters are required. Please see the [Interfaces](../configuration/interfaces.md)
44
44
  documentation for more details.
45
45
  ROUTER:
46
46
  modifiers:
@@ -60,7 +60,7 @@ ROUTER:
60
60
  description: Ruby file to use when instantiating the interface.
61
61
  values:
62
62
  <%= MetaConfigParser.load('_interfaces.yaml').to_meta_config_yaml(8) %>
63
- documentation: Additional parameters are required. Please see the [Interfaces](/docs/v5/interfaces)
63
+ documentation: Additional parameters are required. Please see the [Interfaces](../configuration/interfaces.md)
64
64
  documentation for more details.
65
65
  <%= MetaConfigParser.load('target.yaml').to_meta_config_yaml() %>
66
66
  <%= MetaConfigParser.load('microservice.yaml').to_meta_config_yaml() %>
@@ -71,7 +71,17 @@ WIDGET:
71
71
  description: Defines a custom widget that can be used in Telemetry Viewer screens.
72
72
  parameters:
73
73
  - name: Widget Name
74
- description: The name of the widget wil be used to build a path to the widget implementation. For example, `WIDGET HELLOWORLD` will find the as-built file tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js. See the [Custom Widgets](/docs/v5/custom-widgets)
74
+ description: The name of the widget wil be used to build a path to the widget implementation. For example, `WIDGET HELLOWORLD` will find the as-built file tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js. See the [Custom Widgets](../guides/custom-widgets.md)
75
75
  guide for more details.
76
76
  required: true
77
77
  values: .+
78
+ modifiers:
79
+ DISABLE_ERB:
80
+ summary: Disable ERB processing
81
+ description: Disable ERB processing for the entire widget or a set of regular expressions over its filenames
82
+ since: 5.12.0
83
+ parameters:
84
+ - name: Regex
85
+ required: false
86
+ description: Regex to match against filenames. If match, then no ERB processing
87
+ values: .+
@@ -187,3 +187,12 @@ TARGET:
187
187
  description: The packet name. Does not apply to
188
188
  REDUCER or CLEANUP target microservice types.
189
189
  values: .*
190
+ DISABLE_ERB:
191
+ summary: Disable ERB processing
192
+ description: Disable ERB processing for the entire target or a set of regular expressions over its filenames
193
+ since: 5.12.0
194
+ parameters:
195
+ - name: Regex
196
+ required: false
197
+ description: Regex to match against filenames. If match, then no ERB processing
198
+ values: .+
@@ -1,4 +1,16 @@
1
1
  ---
2
+ LANGUAGE:
3
+ summary: Programming language of the target interfaces and microservices
4
+ description: The target language must be either Ruby or Python. The language
5
+ determines how the target's interfaces and microservices are run. Note that
6
+ both Ruby and Python still use ERB to perform templating.
7
+ example: LANGUAGE python
8
+ parameters:
9
+ - language: Programming language
10
+ required: true
11
+ description: Ruby or Python
12
+ values: ["ruby", "python"]
13
+ since: 5.11.1
2
14
  REQUIRE:
3
15
  summary: Requires a Ruby file
4
16
  description:
@@ -5,7 +5,7 @@ TOOL:
5
5
  description: Defines a tool that the plugin adds to the OpenC3 system. Tools are web based applications that make use of the Single-SPA javascript library that allows them to by dynamically added to the running system as independent frontend microservices.
6
6
  parameters:
7
7
  - name: Tool Folder Name
8
- description: The exact name of the tool folder in the plugin. ie. tools/<Tool Folder Name>
8
+ description: The exact name of the tool folder in the plugin. ie. tools/ToolFolderName
9
9
  required: true
10
10
  values: .+
11
11
  - name: Tool Name
@@ -15,11 +15,11 @@ TOOL:
15
15
  modifiers:
16
16
  URL:
17
17
  summary: Url used to access the tool
18
- description: The relative url used to access the tool. Defaults to "/tools/<Tool Folder Name>".
18
+ description: The relative url used to access the tool. Defaults to "/tools/ToolFolderName".
19
19
  parameters:
20
20
  - name: Url
21
21
  required: true
22
- description: The url. If not given defaults to tools/<Tool Folder Name>. Generally should not be given unless linking to external tools.
22
+ description: The url. If not given defaults to tools/ToolFolderName. Generally should not be given unless linking to external tools.
23
23
  values: .+
24
24
  INLINE_URL:
25
25
  summary: Internal url to load a tool
@@ -70,3 +70,12 @@ TOOL:
70
70
  required: true
71
71
  description: Numerical position
72
72
  values: \d+
73
+ DISABLE_ERB:
74
+ summary: Disable ERB processing
75
+ description: Disable ERB processing for the entire tool or a set of regular expressions over its filenames
76
+ since: 5.12.0
77
+ parameters:
78
+ - name: Regex
79
+ required: false
80
+ description: Regex to match against filenames. If match, then no ERB processing
81
+ values: .+
@@ -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 2023, OpenC3, Inc.
18
18
  # All Rights Reserved
19
19
  #
20
20
  # This file may also be used under the terms of a commercial license
@@ -62,39 +62,39 @@ module OpenC3
62
62
  #
63
63
  # Favor the first syntax where possible as it is more succinct.
64
64
  def cmd(*args, **kwargs)
65
- cmd_implementation('cmd', *args, range_check: true, hazardous_check: true, raw: false, **kwargs)
65
+ _cmd_implementation('cmd', *args, range_check: true, hazardous_check: true, raw: false, **kwargs)
66
66
  end
67
67
  def cmd_raw(*args, **kwargs)
68
- cmd_implementation('cmd_raw', *args, range_check: true, hazardous_check: true, raw: true, **kwargs)
68
+ _cmd_implementation('cmd_raw', *args, range_check: true, hazardous_check: true, raw: true, **kwargs)
69
69
  end
70
70
 
71
71
  # Send a command packet to a target without performing any value range
72
72
  # checks on the parameters. Useful for testing to allow sending command
73
73
  # parameters outside the allowable range as defined in the configuration.
74
74
  def cmd_no_range_check(*args, **kwargs)
75
- cmd_implementation('cmd_no_range_check', *args, range_check: false, hazardous_check: true, raw: false, **kwargs)
75
+ _cmd_implementation('cmd_no_range_check', *args, range_check: false, hazardous_check: true, raw: false, **kwargs)
76
76
  end
77
77
  def cmd_raw_no_range_check(*args, **kwargs)
78
- cmd_implementation('cmd_raw_no_range_check', *args, range_check: false, hazardous_check: true, raw: true, **kwargs)
78
+ _cmd_implementation('cmd_raw_no_range_check', *args, range_check: false, hazardous_check: true, raw: true, **kwargs)
79
79
  end
80
80
 
81
81
  # Send a command packet to a target without performing any hazardous checks
82
82
  # both on the command itself and its parameters. Useful in scripts to
83
83
  # prevent popping up warnings to the user.
84
84
  def cmd_no_hazardous_check(*args, **kwargs)
85
- cmd_implementation('cmd_no_hazardous_check', *args, range_check: true, hazardous_check: false, raw: false, **kwargs)
85
+ _cmd_implementation('cmd_no_hazardous_check', *args, range_check: true, hazardous_check: false, raw: false, **kwargs)
86
86
  end
87
87
  def cmd_raw_no_hazardous_check(*args, **kwargs)
88
- cmd_implementation('cmd_raw_no_hazardous_check', *args, range_check: true, hazardous_check: false, raw: true, **kwargs)
88
+ _cmd_implementation('cmd_raw_no_hazardous_check', *args, range_check: true, hazardous_check: false, raw: true, **kwargs)
89
89
  end
90
90
 
91
91
  # Send a command packet to a target without performing any value range
92
92
  # checks or hazardous checks both on the command itself and its parameters.
93
93
  def cmd_no_checks(*args, **kwargs)
94
- cmd_implementation('cmd_no_checks', *args, range_check: false, hazardous_check: false, raw: false, **kwargs)
94
+ _cmd_implementation('cmd_no_checks', *args, range_check: false, hazardous_check: false, raw: false, **kwargs)
95
95
  end
96
96
  def cmd_raw_no_checks(*args, **kwargs)
97
- cmd_implementation('cmd_raw_no_checks', *args, range_check: false, hazardous_check: false, raw: true, **kwargs)
97
+ _cmd_implementation('cmd_raw_no_checks', *args, range_check: false, hazardous_check: false, raw: true, **kwargs)
98
98
  end
99
99
 
100
100
  # Build a command binary
@@ -285,7 +285,7 @@ module OpenC3
285
285
  target_name = target_name.upcase
286
286
  command_name = command_name.upcase
287
287
  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]
288
+ return [target_name, command_name, time.to_i, ((time.to_f - time.to_i) * 1_000_000).to_i]
289
289
  else
290
290
  if target_name.nil?
291
291
  targets = TargetModel.names(scope: scope)
@@ -293,21 +293,22 @@ module OpenC3
293
293
  target_name = target_name.upcase
294
294
  targets = [target_name]
295
295
  end
296
- targets.each do |target_name|
297
- time = 0
298
- command_name = nil
299
- TargetModel.packets(target_name, type: :CMD, scope: scope).each do |packet|
300
- cur_time = CommandDecomTopic.get_cmd_item(target_name, packet["packet_name"], 'RECEIVED_TIMESECONDS', type: :CONVERTED, scope: scope)
296
+ time = 0
297
+ command_name = nil
298
+ targets.each do |cur_target|
299
+ TargetModel.packets(cur_target, type: :CMD, scope: scope).each do |packet|
300
+ cur_time = CommandDecomTopic.get_cmd_item(cur_target, packet["packet_name"], 'RECEIVED_TIMESECONDS', type: :CONVERTED, scope: scope)
301
301
  next unless cur_time
302
302
 
303
303
  if cur_time > time
304
304
  time = cur_time
305
305
  command_name = packet["packet_name"]
306
+ target_name = cur_target
306
307
  end
307
308
  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
309
  end
310
+ target_name = nil unless command_name
311
+ return [target_name, command_name, time.to_i, ((time.to_f - time.to_i) * 1_000_000).to_i]
311
312
  end
312
313
  end
313
314
 
@@ -330,6 +331,9 @@ module OpenC3
330
331
  # @return [Numeric] Transmit count for the command
331
332
  def get_cmd_cnts(target_commands, scope: $openc3_scope, token: $openc3_token)
332
333
  authorize(permission: 'system', scope: scope, token: token)
334
+ unless target_commands.is_a?(Array) and target_commands[0].is_a?(Array)
335
+ raise "get_cmd_cnts takes an array of arrays containing target, packet_name, e.g. [['INST', 'COLLECT'], ['INST', 'ABORT']]"
336
+ end
333
337
  counts = []
334
338
  target_commands.each do |target_name, command_name|
335
339
  target_name = target_name.upcase
@@ -343,7 +347,7 @@ module OpenC3
343
347
  # PRIVATE implementation details
344
348
  ###########################################################################
345
349
 
346
- def cmd_implementation(method_name, *args, range_check:, hazardous_check:, raw:, timeout: nil, log_message: nil,
350
+ def _cmd_implementation(method_name, *args, range_check:, hazardous_check:, raw:, timeout: nil, log_message: nil,
347
351
  scope: $openc3_scope, token: $openc3_token, **kwargs)
348
352
  extract_string_kwargs_to_args(args, kwargs)
349
353
  unless [nil, true, false].include?(log_message)
@@ -399,17 +403,13 @@ module OpenC3
399
403
  end
400
404
  end
401
405
  if log_message
402
- Logger.info(build_cmd_output_string(target_name, cmd_name, cmd_params, packet, raw), scope: scope)
406
+ Logger.info(_build_cmd_output_string(method_name, target_name, cmd_name, cmd_params, packet), scope: scope)
403
407
  end
404
408
  CommandTopic.send_command(command, timeout: timeout, scope: scope)
405
409
  end
406
410
 
407
- def build_cmd_output_string(target_name, cmd_name, cmd_params, packet, raw)
408
- if raw
409
- output_string = 'cmd_raw("'
410
- else
411
- output_string = 'cmd("'
412
- end
411
+ def _build_cmd_output_string(method_name, target_name, cmd_name, cmd_params, packet)
412
+ output_string = "#{method_name}(\""
413
413
  output_string << target_name + ' ' + cmd_name
414
414
  if cmd_params.nil? or cmd_params.empty?
415
415
  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 2022, OpenC3, Inc.
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
- 'get_saved_config',
30
- 'list_configs',
31
- 'load_config',
32
- 'save_config',
33
- 'delete_config'
34
- ])
35
-
36
- # Get a saved configuration zip file
37
- def get_saved_config(configuration_name = nil, scope: $openc3_scope, token: $openc3_token)
38
- raise "Not supported by OpenC3 5"
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 = tlm_process_args(args, 'limits_enabled?', scope: scope)
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 = tlm_process_args(args, 'enable_limits', scope: scope)
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 = tlm_process_args(args, 'disable_limits', scope: scope)
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
- 'save_setting'
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 save_setting(name, data, scope: $openc3_scope, token: $openc3_token)
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