-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from OpenC3/modular_decom
Modular decom
- Loading branch information
Showing
50 changed files
with
4,403 additions
and
1,286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
openc3-init/plugins/packages/openc3-accessor-test/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
tools/* | ||
.DS_Store | ||
node_modules | ||
/dist | ||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
727 changes: 727 additions & 0 deletions
727
openc3-init/plugins/packages/openc3-accessor-test/LICENSE.txt
Large diffs are not rendered by default.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
openc3-init/plugins/packages/openc3-accessor-test/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## OpenC3 Accessor Test Plugin | ||
|
||
[Documentation](https://openc3.com) | ||
|
||
This plugin is used to provide examples of using different accessors | ||
|
||
## Getting Started | ||
|
||
1. At the OpenC3 Admin - Plugins, upload the openc3-accessor-test.gem file | ||
|
||
## Contributing | ||
|
||
We encourage you to contribute to OpenC3! | ||
|
||
Contributing is easy. | ||
|
||
1. Fork the project | ||
2. Create a feature branch | ||
3. Make your changes | ||
4. Submit a pull request | ||
|
||
Before any contributions can be incorporated we do require all contributors to agree to a Contributor License Agreement | ||
|
||
This protects both you and us and you retain full rights to any code you write. | ||
|
||
## License | ||
|
||
This OpenC3 plugin is released under the AGPLv3.0 with a few addendums. See [LICENSE.txt](LICENSE.txt) |
36 changes: 36 additions & 0 deletions
36
openc3-init/plugins/packages/openc3-accessor-test/Rakefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# encoding: ascii-8bit | ||
|
||
# Copyright 2022 OpenC3, Inc. | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can modify and/or redistribute it | ||
# under the terms of the GNU Affero General Public License | ||
# as published by the Free Software Foundation; version 3 with | ||
# attribution addendums as found in the LICENSE.txt | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
|
||
PLUGIN_NAME = Dir['*.gemspec'][0].split('.')[0..-2].join('.') | ||
|
||
task :require_version do | ||
if ENV['VERSION'] | ||
if ENV['VERSION'] =~ /-/ | ||
# Add Timestamp to prerelease versions | ||
ENV['VERSION'] = ENV['VERSION'] + "." + Time.now.utc.strftime("%Y%m%d%H%M%S") | ||
end | ||
else | ||
puts "VERSION is required: rake <task> VERSION=X.X.X" | ||
exit 1 | ||
end | ||
end | ||
|
||
task :build => [:require_version] do | ||
_, platform, *_ = RUBY_PLATFORM.split("-") | ||
if platform == 'mswin32' or platform == 'mingw32' | ||
puts "Warning: Building gem on Windows will lose file permissions" | ||
end | ||
system("gem build #{PLUGIN_NAME}") | ||
end |
37 changes: 37 additions & 0 deletions
37
openc3-init/plugins/packages/openc3-accessor-test/openc3-accessor-test.gemspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# encoding: ascii-8bit | ||
|
||
# Copyright 2022 OpenC3, Inc. | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can modify and/or redistribute it | ||
# under the terms of the GNU Affero General Public License | ||
# as published by the Free Software Foundation; version 3 with | ||
# attribution addendums as found in the LICENSE.txt | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
|
||
spec = Gem::Specification.new do |s| | ||
s.name = 'openc3-accessor-test' | ||
s.summary = 'OpenC3 Accessor Example Plugin' | ||
s.description = <<-EOF | ||
This plugin is used to provide examples of using different accessors | ||
EOF | ||
s.authors = ['Ryan Melton', 'Jason Thomas'] | ||
s.email = ['ryan@openc3.com', 'jason@openc3.com'] | ||
s.homepage = 'https://github.com/OpenC3/openc3' | ||
|
||
s.platform = Gem::Platform::RUBY | ||
|
||
if ENV['VERSION'] | ||
s.version = ENV['VERSION'].dup | ||
else | ||
time = Time.now.strftime("%Y%m%d%H%M%S") | ||
s.version = '0.0.0' + ".#{time}" | ||
end | ||
s.licenses = ['AGPL-3.0-only', 'Nonstandard'] | ||
|
||
s.files = Dir.glob("{targets,lib,procedures,tools,microservices}/**/*") + %w(Rakefile LICENSE.txt README.md plugin.txt) | ||
end |
10 changes: 10 additions & 0 deletions
10
openc3-init/plugins/packages/openc3-accessor-test/plugin.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
VARIABLE access_target_name ACCESS | ||
VARIABLE log_retain_time 172800 | ||
VARIABLE reduced_log_retain_time 2592000 | ||
|
||
TARGET ACCESS <%= access_target_name %> | ||
LOG_RETAIN_TIME <%= log_retain_time %> | ||
REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %> | ||
|
||
INTERFACE <%= access_target_name %> simulated_target_interface.rb sim_access.rb | ||
MAP_TARGET <%= access_target_name %> |
1 change: 1 addition & 0 deletions
1
openc3-init/plugins/packages/openc3-accessor-test/targets/ACCESS/cmd_tlm/_cbor_template.bin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
�gid_itemeitem1edmore�eitem2eitem3�@ �Q�eitem4gExampleeitem5� |
5 changes: 5 additions & 0 deletions
5
openc3-init/plugins/packages/openc3-accessor-test/targets/ACCESS/cmd_tlm/_make_cbor.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'cbor' | ||
data = {"id_item":2, "item1":101, "more": { "item2":12, "item3":3.14, "item4":"Example", "item5":[4, 3, 2, 1] } } | ||
File.open("_cbor_template.bin", 'wb') do |file| | ||
file.write(data.to_cbor) | ||
end |
67 changes: 67 additions & 0 deletions
67
openc3-init/plugins/packages/openc3-accessor-test/targets/ACCESS/cmd_tlm/access_cmds.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
COMMAND <%= target_name %> JSONCMD BIG_ENDIAN "JSON Accessor Command" | ||
ACCESSOR JsonAccessor | ||
TEMPLATE '{"id_item":1, "item1":101, "more": { "item2":12, "item3":3.14, "item4":"Example", "item5":[4, 3, 2, 1] } }' | ||
APPEND_ID_PARAMETER ID_ITEM 32 INT 1 1 1 "Int Item" | ||
KEY $.id_item | ||
APPEND_PARAMETER ITEM1 16 UINT MIN MAX 101 "Int Item 2" | ||
KEY $.item1 | ||
UNITS CELCIUS C | ||
APPEND_PARAMETER ITEM2 16 UINT MIN MAX 12 "Int Item 3" | ||
KEY $.more.item2 | ||
FORMAT_STRING "0x%X" | ||
APPEND_PARAMETER ITEM3 64 FLOAT MIN MAX 3.14 "Float Item" | ||
KEY $.more.item3 | ||
APPEND_PARAMETER ITEM4 128 STRING "Example" "String Item" | ||
KEY $.more.item4 | ||
APPEND_ARRAY_PARAMETER ITEM5 8 UINT 0 "Array Item" | ||
KEY $.more.item5 | ||
|
||
COMMAND <%= target_name %> CBORCMD BIG_ENDIAN "CBOR Accessor Command" | ||
ACCESSOR CborAccessor | ||
TEMPLATE_FILE _cbor_template.bin | ||
APPEND_ID_PARAMETER ID_ITEM 32 INT 2 2 2 "Int Item" | ||
KEY $.id_item | ||
APPEND_PARAMETER ITEM1 16 UINT MIN MAX 101 "Int Item 2" | ||
KEY $.item1 | ||
UNITS CELCIUS C | ||
APPEND_PARAMETER ITEM2 16 UINT MIN MAX 12 "Int Item 3" | ||
KEY $.more.item2 | ||
FORMAT_STRING "0x%X" | ||
APPEND_PARAMETER ITEM3 64 FLOAT MIN MAX 3.14 "Float Item" | ||
KEY $.more.item3 | ||
APPEND_PARAMETER ITEM4 128 STRING "Example" "String Item" | ||
KEY $.more.item4 | ||
APPEND_ARRAY_PARAMETER ITEM5 8 UINT 0 "Array Item" | ||
KEY $.more.item5 | ||
|
||
COMMAND <%= target_name %> XMLCMD BIG_ENDIAN "XML Accessor Command" | ||
ACCESSOR XmlAccessor | ||
TEMPLATE '<html><head><script src="3"></script><noscript>101</noscript></head><body><img src="12"/><div><ul><li>3.14</li><li>Example</li></ul></div><div></div></body></html>' | ||
APPEND_ID_PARAMETER ID_ITEM 32 INT 3 3 3 "Int Item" | ||
KEY "/html/head/script/@src" | ||
APPEND_PARAMETER ITEM1 16 UINT MIN MAX 101 "Int Item 2" | ||
KEY "/html/head/noscript/text()" | ||
UNITS CELCIUS C | ||
APPEND_PARAMETER ITEM2 16 UINT MIN MAX 12 "Int Item 3" | ||
KEY "/html/body/img/@src" | ||
FORMAT_STRING "0x%X" | ||
APPEND_PARAMETER ITEM3 64 FLOAT MIN MAX 3.14 "Float Item" | ||
KEY "/html/body/div/ul/li[1]/text()" | ||
APPEND_PARAMETER ITEM4 128 STRING "Example" "String Item" | ||
KEY "/html/body/div/ul/li[2]/text()" | ||
|
||
COMMAND <%= target_name %> HTMLCMD BIG_ENDIAN "HTML Accessor Command" | ||
ACCESSOR HtmlAccessor | ||
TEMPLATE '<!DOCTYPE html><html lang="en"><head><title>4</title><script src="101"></script></head><body><noscript>12</noscript><img src="3.14" alt="An Image"/><p>Example</p><ul><li>1</li><li>3.14</li></ul></body></html>' | ||
APPEND_ID_PARAMETER ID_ITEM 32 INT 4 4 4 "Int Item" | ||
KEY "/html/head/title/text()" | ||
APPEND_PARAMETER ITEM1 16 UINT MIN MAX 101 "Int Item 2" | ||
KEY "/html/head/script/@src" | ||
UNITS CELCIUS C | ||
APPEND_PARAMETER ITEM2 16 UINT MIN MAX 12 "Int Item 3" | ||
KEY "/html/body/noscript/text()" | ||
FORMAT_STRING "0x%X" | ||
APPEND_PARAMETER ITEM3 64 FLOAT MIN MAX 3.14 "Float Item" | ||
KEY "/html/body/img/@src" | ||
APPEND_PARAMETER ITEM4 128 STRING "Example" "String Item" | ||
KEY "/html/body/p/text()" |
83 changes: 83 additions & 0 deletions
83
openc3-init/plugins/packages/openc3-accessor-test/targets/ACCESS/cmd_tlm/access_tlm.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
TELEMETRY <%= target_name %> JSONTLM BIG_ENDIAN "JSON Accessor Telemetry" | ||
ACCESSOR JsonAccessor | ||
# Template is not required for telemetry, but is useful for simulation | ||
TEMPLATE '{"id_item":1, "item1":101, "more": { "item2":12, "item3":3.14, "item4":"Example", "item5":[4, 3, 2, 1] } }' | ||
APPEND_ID_ITEM ID_ITEM 32 INT 1 "Int Item" | ||
KEY $.id_item | ||
APPEND_ITEM ITEM1 16 UINT "Int Item 2" | ||
KEY $.item1 | ||
GENERIC_READ_CONVERSION_START UINT 16 | ||
value * 2 | ||
GENERIC_READ_CONVERSION_END | ||
UNITS CELCIUS C | ||
APPEND_ITEM ITEM2 16 UINT "Int Item 3" | ||
KEY $.more.item2 | ||
FORMAT_STRING "0x%X" | ||
APPEND_ITEM ITEM3 64 FLOAT "Float Item" | ||
KEY $.more.item3 | ||
APPEND_ITEM ITEM4 128 STRING "String Item" | ||
KEY $.more.item4 | ||
APPEND_ARRAY_ITEM ITEM5 8 UINT 0 "Array Item" | ||
KEY $.more.item5 | ||
|
||
TELEMETRY <%= target_name %> CBORTLM BIG_ENDIAN "CBOR Accessor Telemetry" | ||
ACCESSOR CborAccessor | ||
# Template is not required for telemetry, but is useful for simulation | ||
TEMPLATE_FILE _cbor_template.bin | ||
APPEND_ID_ITEM ID_ITEM 32 INT 2 "Int Item" | ||
KEY $.id_item | ||
APPEND_ITEM ITEM1 16 UINT "Int Item 2" | ||
KEY $.item1 | ||
GENERIC_READ_CONVERSION_START UINT 16 | ||
value * 2 | ||
GENERIC_READ_CONVERSION_END | ||
UNITS CELCIUS C | ||
APPEND_ITEM ITEM2 16 UINT "Int Item 3" | ||
KEY $.more.item2 | ||
FORMAT_STRING "0x%X" | ||
APPEND_ITEM ITEM3 64 FLOAT "Float Item" | ||
KEY $.more.item3 | ||
APPEND_ITEM ITEM4 128 STRING "String Item" | ||
KEY $.more.item4 | ||
APPEND_ARRAY_ITEM ITEM5 8 UINT 0 "Array Item" | ||
KEY $.more.item5 | ||
|
||
TELEMETRY <%= target_name %> XMLTLM BIG_ENDIAN "XML Accessor Telemetry" | ||
ACCESSOR XmlAccessor | ||
# Template is not required for telemetry, but is useful for simulation | ||
TEMPLATE '<html><head><script src="3"></script><noscript>101</noscript></head><body><img src="12"/><div><ul><li>3.14</li><li>Example</li></ul></div><div></div></body></html>' | ||
APPEND_ID_ITEM ID_ITEM 32 INT 3 "Int Item" | ||
KEY "/html/head/script/@src" | ||
APPEND_ITEM ITEM1 16 UINT "Int Item 2" | ||
KEY "/html/head/noscript/text()" | ||
GENERIC_READ_CONVERSION_START UINT 16 | ||
value * 2 | ||
GENERIC_READ_CONVERSION_END | ||
UNITS CELCIUS C | ||
APPEND_ITEM ITEM2 16 UINT "Int Item 3" | ||
KEY "/html/body/img/@src" | ||
FORMAT_STRING "0x%X" | ||
APPEND_ITEM ITEM3 64 FLOAT "Float Item" | ||
KEY "/html/body/div/ul/li[1]/text()" | ||
APPEND_ITEM ITEM4 128 STRING "String Item" | ||
KEY "/html/body/div/ul/li[2]/text()" | ||
|
||
TELEMETRY <%= target_name %> HTMLTLM BIG_ENDIAN "HTML Accessor Telemetry" | ||
ACCESSOR HtmlAccessor | ||
# Template is not required for telemetry, but is useful for simulation | ||
TEMPLATE '<!DOCTYPE html><html lang="en"><head><title>4</title><script src="101"></script></head><body><noscript>12</noscript><img src="3.14" alt="An Image"/><p>Example</p><ul><li>1</li><li>3.14</li></ul></body></html>' | ||
APPEND_ID_ITEM ID_ITEM 32 INT 4 "Int Item" | ||
KEY "/html/head/title/text()" | ||
APPEND_ITEM ITEM1 16 UINT "Int Item 2" | ||
KEY "/html/head/script/@src" | ||
GENERIC_READ_CONVERSION_START UINT 16 | ||
value * 2 | ||
GENERIC_READ_CONVERSION_END | ||
UNITS CELCIUS C | ||
APPEND_ITEM ITEM2 16 UINT "Int Item 3" | ||
KEY "/html/body/noscript/text()" | ||
FORMAT_STRING "0x%X" | ||
APPEND_ITEM ITEM3 64 FLOAT "Float Item" | ||
KEY "/html/body/img/@src" | ||
APPEND_ITEM ITEM4 128 STRING "String Item" | ||
KEY "/html/body/p/text()" |
57 changes: 57 additions & 0 deletions
57
openc3-init/plugins/packages/openc3-accessor-test/targets/ACCESS/lib/sim_access.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# encoding: ascii-8bit | ||
|
||
# Copyright 2022 OpenC3, Inc. | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can modify and/or redistribute it | ||
# under the terms of the GNU Affero General Public License | ||
# as published by the Free Software Foundation; version 3 with | ||
# attribution addendums as found in the LICENSE.txt | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
|
||
# Provides a demonstration of accessors | ||
|
||
require 'openc3' | ||
|
||
module OpenC3 | ||
class SimAccess < SimulatedTarget | ||
def set_rates | ||
set_rate('JSONTLM', 100) | ||
set_rate('CBORTLM', 100) | ||
set_rate('XMLTLM', 100) | ||
set_rate('HTMLTLM', 100) | ||
end | ||
|
||
def tick_period_seconds | ||
return 1 # Override this method to optimize | ||
end | ||
|
||
def tick_increment | ||
return 100 # Override this method to optimize | ||
end | ||
|
||
def write(packet) | ||
name = packet.packet_name.upcase | ||
|
||
json_packet = @tlm_packets['JSONTLM'] | ||
cbor_packet = @tlm_packets['CBORTLM'] | ||
xml_packet = @tlm_packets['XMLTLM'] | ||
html_packet = @tlm_packets['HTMLTLM'] | ||
|
||
case name | ||
when 'JSONCMD' | ||
json_packet.buffer = packet.buffer | ||
when 'CBORCMD' | ||
cbor_packet.buffer = packet.buffer | ||
when 'XMLCMD' | ||
xml_packet.buffer = packet.buffer | ||
when 'HTMLCMD' | ||
html_packet.buffer = packet.buffer | ||
end | ||
end | ||
end | ||
end |
4 changes: 4 additions & 0 deletions
4
openc3-init/plugins/packages/openc3-accessor-test/targets/ACCESS/target.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
IGNORE_PARAMETER ID_ITEM | ||
|
||
CMD_UNIQUE_ID_MODE | ||
TLM_UNIQUE_ID_MODE |
Oops, something went wrong.