openc3-cosmos-demo 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +729 -0
  3. data/README.md +30 -0
  4. data/Rakefile +45 -0
  5. data/microservices/EXAMPLE/example_target.rb +126 -0
  6. data/microservices/TEMPLATED/scpi_target.rb +82 -0
  7. data/plugin.txt +117 -0
  8. data/targets/EXAMPLE/cmd_tlm/example_cmds.txt +2 -0
  9. data/targets/EXAMPLE/cmd_tlm/example_tlm.txt +5 -0
  10. data/targets/EXAMPLE/lib/example_interface.rb +30 -0
  11. data/targets/EXAMPLE/target.txt +9 -0
  12. data/targets/INST/cmd_tlm/_ccsds_cmd.txt +9 -0
  13. data/targets/INST/cmd_tlm/_ccsds_tlm.txt +19 -0
  14. data/targets/INST/cmd_tlm/inst_cmds.txt +63 -0
  15. data/targets/INST/cmd_tlm/inst_tlm.txt +162 -0
  16. data/targets/INST/cmd_tlm/inst_tlm_override.txt +12 -0
  17. data/targets/INST/data/attitude.bin +0 -0
  18. data/targets/INST/data/position.bin +0 -0
  19. data/targets/INST/lib/example_limits_response.rb +42 -0
  20. data/targets/INST/lib/sim_inst.rb +376 -0
  21. data/targets/INST/procedures/checks.rb +11 -0
  22. data/targets/INST/procedures/collect.rb +18 -0
  23. data/targets/INST/procedures/disconnect.rb +29 -0
  24. data/targets/INST/procedures/file_dialog.rb +15 -0
  25. data/targets/INST/procedures/my_script_suite.rb +46 -0
  26. data/targets/INST/procedures/my_test_suite.rb +45 -0
  27. data/targets/INST/procedures/target_file.rb +21 -0
  28. data/targets/INST/procedures/utilities/clear.rb +7 -0
  29. data/targets/INST/procedures/utilities/collect.rb +14 -0
  30. data/targets/INST/public/ground_error.png +0 -0
  31. data/targets/INST/public/ground_off.png +0 -0
  32. data/targets/INST/public/ground_on.png +0 -0
  33. data/targets/INST/public/satellite.png +0 -0
  34. data/targets/INST/screens/_footer.txt +3 -0
  35. data/targets/INST/screens/adcs.txt +71 -0
  36. data/targets/INST/screens/array.txt +16 -0
  37. data/targets/INST/screens/block.txt +7 -0
  38. data/targets/INST/screens/commanding.txt +47 -0
  39. data/targets/INST/screens/graphs.txt +23 -0
  40. data/targets/INST/screens/ground.txt +45 -0
  41. data/targets/INST/screens/hs.txt +42 -0
  42. data/targets/INST/screens/latest.txt +21 -0
  43. data/targets/INST/screens/launcher.txt +10 -0
  44. data/targets/INST/screens/limits.txt +82 -0
  45. data/targets/INST/screens/other.txt +22 -0
  46. data/targets/INST/screens/params.txt +54 -0
  47. data/targets/INST/screens/simple.txt +6 -0
  48. data/targets/INST/screens/tabs.txt +66 -0
  49. data/targets/INST/screens/web.txt +5 -0
  50. data/targets/INST/tables/bin/ConfigTables.bin +0 -0
  51. data/targets/INST/tables/config/ConfigTables_def.txt +7 -0
  52. data/targets/INST/tables/config/MCConfigurationTable_def.txt +36 -0
  53. data/targets/INST/tables/config/PPSSelectionTable_def.txt +7 -0
  54. data/targets/INST/tables/config/TLMMonitoringTable_def.txt +31 -0
  55. data/targets/INST/tables/procedures/download.rb +16 -0
  56. data/targets/INST/tables/procedures/upload.rb +19 -0
  57. data/targets/INST/target.txt +31 -0
  58. data/targets/SYSTEM/cmd_tlm/limits_groups.txt +6 -0
  59. data/targets/SYSTEM/cmd_tlm/meta_tlm.txt +10 -0
  60. data/targets/SYSTEM/cmd_tlm/system_cmds.txt +41 -0
  61. data/targets/SYSTEM/cmd_tlm/system_tlm.txt +7 -0
  62. data/targets/SYSTEM/lib/example_background_task.rb +69 -0
  63. data/targets/SYSTEM/lib/example_target.rb +115 -0
  64. data/targets/SYSTEM/lib/limits_groups.rb +67 -0
  65. data/targets/SYSTEM/lib/scpi_target.rb +79 -0
  66. data/targets/SYSTEM/procedures/example_test.rb +191 -0
  67. data/targets/SYSTEM/procedures/interactive.rb +38 -0
  68. data/targets/SYSTEM/procedures/limits_api_test.rb +89 -0
  69. data/targets/SYSTEM/procedures/openc3_api_test.rb +286 -0
  70. data/targets/SYSTEM/procedures/run_example_test.rb +3 -0
  71. data/targets/SYSTEM/procedures/test.rb +49 -0
  72. data/targets/SYSTEM/screens/status.txt +12 -0
  73. data/targets/SYSTEM/target.txt +12 -0
  74. data/targets/TEMPLATED/cmd_tlm/templated_cmds.txt +13 -0
  75. data/targets/TEMPLATED/cmd_tlm/templated_tlm.txt +3 -0
  76. data/targets/TEMPLATED/lib/templated_interface.rb +72 -0
  77. data/targets/TEMPLATED/target.txt +8 -0
  78. data/tools/widgets/BigWidget/BigWidget.umd.min.js +4 -0
  79. data/tools/widgets/BigWidget/BigWidget.umd.min.js.map +1 -0
  80. data/tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js +2 -0
  81. data/tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js.map +1 -0
  82. metadata +128 -0
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ ## OpenC3 COSMOS Demo Plugin
2
+
3
+ [Documentation](https://openc3.com)
4
+
5
+ This plugin provides a simple demo configuration for OpenC3 COSMOS that shows off a lot of the features of OpenC3 COSMOS and provides a test environment.
6
+
7
+ ## Getting Started
8
+
9
+ 1. At the OpenC3 COSMOS Admin - Plugins, upload the openc3-cosmos-demo.gem file
10
+
11
+ 2. To build widgets run: yarn && yarn build
12
+
13
+ ## Contributing
14
+
15
+ We encourage you to contribute to OpenC3 COSMOS!
16
+
17
+ Contributing is easy.
18
+
19
+ 1. Fork the project
20
+ 2. Create a feature branch
21
+ 3. Make your changes
22
+ 4. Submit a pull request
23
+
24
+ Before any contributions can be incorporated we do require all contributors to agree to a Contributor License Agreement.
25
+
26
+ This protects both you and us and you retain full rights to any code you write.
27
+
28
+ ## License
29
+
30
+ This OpenC3 COSMOS plugin is released under the AGPLv3.0 with a few addendums. See [LICENSE.txt](LICENSE.txt)
data/Rakefile ADDED
@@ -0,0 +1,45 @@
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2022 Ball Aerospace & Technologies Corp.
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
+ # Modified by OpenC3, Inc.
17
+ # All changes Copyright 2022, OpenC3, Inc.
18
+ # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
22
+
23
+ PLUGIN_NAME = Dir['*.gemspec'][0].split('.')[0..-2].join('.')
24
+
25
+ task :require_version do
26
+ if ENV['VERSION']
27
+ if ENV['VERSION'] =~ /-/
28
+ # Add Timestamp to prerelease versions
29
+ ENV['VERSION'] = ENV['VERSION'] + "." + Time.now.utc.strftime("%Y%m%d%H%M%S")
30
+ end
31
+ else
32
+ puts "VERSION is required: rake <task> VERSION=X.X.X"
33
+ exit 1
34
+ end
35
+ end
36
+
37
+ task :build => [:require_version] do
38
+ _, platform, *_ = RUBY_PLATFORM.split("-")
39
+ if platform == 'mswin32' or platform == 'mingw32'
40
+ puts "Warning: Building gem on Windows will lose file permissions"
41
+ end
42
+ # Build the widgets in the src directory
43
+ system("yarn run build")
44
+ system("gem build #{PLUGIN_NAME}")
45
+ end
@@ -0,0 +1,126 @@
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2022 Ball Aerospace & Technologies Corp.
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
+ # Modified by OpenC3, Inc.
17
+ # All changes Copyright 2022, OpenC3, Inc.
18
+ # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
22
+
23
+ require 'openc3'
24
+ require 'openc3/interfaces'
25
+ require 'openc3/tools/cmd_tlm_server/interface_thread'
26
+
27
+ module OpenC3
28
+ class ExampleTarget
29
+ class ExampleServerInterface < TcpipServerInterface
30
+ def initialize(port)
31
+ super(port.to_i, port.to_i, 5.0, nil, 'LENGTH', 0, 32, 4, 1, 'BIG_ENDIAN', 4, nil, nil, true)
32
+ end
33
+ end
34
+
35
+ class ExampleInterfaceThread < InterfaceThread
36
+ attr_accessor :target_name
37
+
38
+ protected
39
+ def handle_packet(packet)
40
+ identified_packet = System.commands.identify(packet.buffer, [@target_name])
41
+ if identified_packet
42
+ Logger.info "Received command: #{identified_packet.target_name} #{identified_packet.packet_name}"
43
+ else
44
+ Logger.info "Received UNKNOWN command"
45
+ end
46
+ end
47
+ end
48
+
49
+ class ExampleTelemetryThread
50
+ attr_reader :thread
51
+
52
+ def initialize(interface, target_name)
53
+ @interface = interface
54
+ @target_name = target_name
55
+ @sleeper = Sleeper.new
56
+ end
57
+
58
+ def start
59
+ packet = System.telemetry.packet(@target_name, 'STATUS')
60
+ @thread = Thread.new do
61
+ @stop_thread = false
62
+ @sleeper.sleep(5)
63
+ begin
64
+ loop do
65
+ packet.write('PACKET_ID', 1)
66
+ packet.write('STRING', "The time is now: #{Time.now.sys.formatted}")
67
+ @interface.write(packet)
68
+ break if @sleeper.sleep(1)
69
+ end
70
+ rescue Exception => err
71
+ Logger.error "ExampleTelemetryThread unexpectedly died\n#{err.formatted}"
72
+ raise err
73
+ end
74
+ end
75
+ end
76
+
77
+ def stop
78
+ OpenC3.kill_thread(self, @thread)
79
+ end
80
+
81
+ def graceful_kill
82
+ @sleeper.cancel
83
+ end
84
+ end
85
+
86
+ def initialize(target_name, port)
87
+ # Create interface to receive commands and send telemetry
88
+ @target_name = target_name
89
+ @interface = ExampleServerInterface.new(port)
90
+ @interface_thread = nil
91
+ @telemetry_thread = nil
92
+ end
93
+
94
+ def start
95
+ @interface_thread = ExampleInterfaceThread.new(@interface)
96
+ @interface_thread.target_name = @target_name
97
+ @interface_thread.start
98
+ @telemetry_thread = ExampleTelemetryThread.new(@interface, @target_name)
99
+ @telemetry_thread.start
100
+ end
101
+
102
+ def stop
103
+ @telemetry_thread.stop if @telemetry_thread
104
+ @interface_thread.stop if @interface_thread
105
+ end
106
+
107
+ def self.run(target_name, port)
108
+ Logger.level = Logger::INFO
109
+ Thread.abort_on_exception = true
110
+ temp_dir = Dir.mktmpdir
111
+ System.setup_targets([target_name], temp_dir, scope: ENV['OPENC3_SCOPE'])
112
+ target = self.new(target_name, port)
113
+ begin
114
+ target.start
115
+ while true
116
+ sleep 1
117
+ end
118
+ rescue SystemExit, Interrupt
119
+ target.stop
120
+ FileUtils.remove_entry(temp_dir) if File.exist?(temp_dir)
121
+ end
122
+ end
123
+ end
124
+ end
125
+
126
+ OpenC3::ExampleTarget.run(ARGV[0], ARGV[1]) if __FILE__ == $0
@@ -0,0 +1,82 @@
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2022 Ball Aerospace & Technologies Corp.
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
+ # Modified by OpenC3, Inc.
17
+ # All changes Copyright 2022, OpenC3, Inc.
18
+ # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
22
+
23
+ require 'openc3'
24
+ require 'openc3/interfaces'
25
+ require 'openc3/tools/cmd_tlm_server/interface_thread'
26
+
27
+ module OpenC3
28
+ class ScpiTarget
29
+ class ScpiServerInterface < TcpipServerInterface
30
+ def initialize(port)
31
+ super(port.to_i, port.to_i, 5.0, nil, 'TERMINATED', '0xA', '0xA')
32
+ end
33
+ end
34
+
35
+ class ScpiInterfaceThread < InterfaceThread
36
+ def initialize(interface)
37
+ super(interface)
38
+ @index = 0
39
+ end
40
+
41
+ protected
42
+ def handle_packet(packet)
43
+ Logger.info "Received command: #{packet.buffer}"
44
+ if packet.buffer.include?('?')
45
+ @interface.write_raw(@index.to_s + "\x0A")
46
+ end
47
+ @index += 1
48
+ end
49
+ end
50
+
51
+ def initialize(port)
52
+ # Create interface to receive commands and send telemetry
53
+ @target_interface = ScpiServerInterface.new(port)
54
+ @interface_thread = nil
55
+ end
56
+
57
+ def start
58
+ @interface_thread = ScpiInterfaceThread.new(@target_interface)
59
+ @interface_thread.start
60
+ end
61
+
62
+ def stop
63
+ @interface_thread.stop if @interface_thread
64
+ end
65
+
66
+ def self.run(target_name, port)
67
+ Logger.level = Logger::INFO
68
+ temp_dir = Dir.mktmpdir
69
+ System.setup_targets([target_name], temp_dir, scope: ENV['OPENC3_SCOPE'])
70
+ target = self.new(port)
71
+ begin
72
+ target.start
73
+ loop { sleep 1 }
74
+ rescue SystemExit, Interrupt
75
+ target.stop
76
+ FileUtils.remove_entry(temp_dir) if File.exist?(temp_dir)
77
+ end
78
+ end
79
+ end
80
+ end
81
+
82
+ OpenC3::ScpiTarget.run(ARGV[0], ARGV[1]) if __FILE__ == $0
data/plugin.txt ADDED
@@ -0,0 +1,117 @@
1
+ # Note: This plugin includes 4 targets in one plugin to make it easy to install
2
+ # the OpenC3 demo with one plugin. Generally it is better to only have one
3
+ # target per plugin
4
+
5
+ VARIABLE inst_target_name INST
6
+ VARIABLE inst2_target_name INST2
7
+ VARIABLE example_target_name EXAMPLE
8
+ VARIABLE templated_target_name TEMPLATED
9
+ VARIABLE system_target_name SYSTEM
10
+ VARIABLE inst_int_name INST_INT
11
+ VARIABLE inst_router_name INST_ROUTER
12
+ VARIABLE inst2_int_name INST2_INT
13
+ VARIABLE example_int_name EXAMPLE_INT
14
+ VARIABLE templated_int_name TEMPLATED_INT
15
+ VARIABLE demo_tool_name Demo
16
+ VARIABLE example_microservice_name openc3-example
17
+ VARIABLE templated_microservice_name openc3-templated
18
+ VARIABLE example_host openc3-operator
19
+ VARIABLE example_port 9999
20
+ VARIABLE templated_host openc3-operator
21
+ VARIABLE templated_port 5025
22
+ VARIABLE inst_router_port 7779
23
+ VARIABLE log_retain_time 172800
24
+ VARIABLE reduced_log_retain_time 2592000
25
+
26
+ <% include_inst = (inst_target_name.strip.length > 0) %>
27
+ <% include_inst2 = (inst2_target_name.strip.length > 0) %>
28
+ <% include_example = (example_target_name.strip.length > 0) %>
29
+ <% include_templated = (templated_target_name.strip.length > 0) %>
30
+ <% include_system = (system_target_name.strip.length > 0) %>
31
+ <% include_inst_int = (inst_int_name.strip.length > 0) %>
32
+ <% include_inst_router = (inst_router_name.strip.length > 0) %>
33
+ <% include_inst2_int = (inst2_int_name.strip.length > 0) %>
34
+ <% include_example_int = (example_int_name.strip.length > 0) %>
35
+ <% include_templated_int = (templated_int_name.strip.length > 0) %>
36
+ <% include_example_microservice = (example_microservice_name.strip.length > 0) %>
37
+ <% include_templated_microservice = (templated_microservice_name.strip.length > 0) %>
38
+
39
+ <% if include_inst %>
40
+ TARGET INST <%= inst_target_name %>
41
+ LOG_RETAIN_TIME <%= log_retain_time %>
42
+ REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
43
+ TLM_LOG_CYCLE_TIME 300
44
+ <% end %>
45
+
46
+ <% if include_inst2 %>
47
+ TARGET INST <%= inst2_target_name %>
48
+ LOG_RETAIN_TIME <%= log_retain_time %>
49
+ REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
50
+ TLM_LOG_CYCLE_TIME 600
51
+ <% end %>
52
+
53
+ <% if include_example %>
54
+ TARGET EXAMPLE <%= example_target_name %>
55
+ LOG_RETAIN_TIME <%= log_retain_time %>
56
+ REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
57
+ <% end %>
58
+
59
+ <% if include_templated %>
60
+ TARGET TEMPLATED <%= templated_target_name %>
61
+ LOG_RETAIN_TIME <%= log_retain_time %>
62
+ REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
63
+ <% end %>
64
+
65
+ <% if include_system %>
66
+ TARGET SYSTEM <%= system_target_name %>
67
+ LOG_RETAIN_TIME <%= log_retain_time %>
68
+ REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
69
+ <% end %>
70
+
71
+ <% if include_inst and include_inst_int %>
72
+ INTERFACE <%= inst_int_name %> simulated_target_interface.rb sim_inst.rb
73
+ MAP_TARGET <%= inst_target_name %>
74
+ PROTOCOL READ OverrideProtocol
75
+ <% end %>
76
+
77
+ <% if include_inst2 and include_inst2_int %>
78
+ INTERFACE <%= inst2_int_name %> simulated_target_interface.rb sim_inst.rb
79
+ MAP_TARGET <%= inst2_target_name %>
80
+ DONT_LOG
81
+ PROTOCOL READ_WRITE OverrideProtocol
82
+ <% end %>
83
+
84
+ <% if include_example and include_example_int %>
85
+ INTERFACE <%= example_int_name %> example_interface.rb <%= example_host %> <%= example_port %>
86
+ MAP_TARGET <%= example_target_name %>
87
+ DONT_CONNECT
88
+ LOG_RAW
89
+ <% end %>
90
+
91
+ <% if include_templated and include_templated_int %>
92
+ INTERFACE <%= templated_int_name %> templated_interface.rb <%= templated_host %> <%= templated_port %> <%= templated_port %> 5.0 nil TEMPLATE 0xA 0xA
93
+ MAP_TARGET <%= templated_target_name %>
94
+ DONT_CONNECT
95
+ <% end %>
96
+
97
+ <% if include_inst and include_inst_router %>
98
+ ROUTER <%= inst_router_name %> tcpip_server_interface.rb <%= inst_router_port %> <%= inst_router_port %> nil 10.0 PREIDENTIFIED
99
+ MAP_TARGET <%= inst_target_name %>
100
+ <% end %>
101
+
102
+ <% if include_example_microservice %>
103
+ MICROSERVICE EXAMPLE <%= example_microservice_name %>
104
+ WORK_DIR .
105
+ PORT <%= example_port %>
106
+ CMD ruby example_target.rb <%= example_target_name %> <%= example_port %>
107
+ <% end %>
108
+
109
+ <% if include_templated_microservice %>
110
+ MICROSERVICE TEMPLATED <%= templated_microservice_name %>
111
+ WORK_DIR .
112
+ PORT <%= templated_port %>
113
+ CMD ruby scpi_target.rb <%= templated_target_name %> <%= templated_port %>
114
+ <% end %>
115
+
116
+ WIDGET BIG
117
+ WIDGET HELLOWORLD
@@ -0,0 +1,2 @@
1
+ COMMAND <%= target_name %> START BIG_ENDIAN "Starts something on the example target"
2
+ APPEND_ID_PARAMETER PACKET_ID 8 UINT 1 1 1 "Packet id"
@@ -0,0 +1,5 @@
1
+ TELEMETRY <%= target_name %> STATUS BIG_ENDIAN "Health and status from the instrument"
2
+ APPEND_ID_ITEM PACKET_ID 8 UINT 1 "Packet id"
3
+ APPEND_ITEM VALUE 32 UINT "Limits value"
4
+ LIMITS DEFAULT 1 ENABLED 0 1 10 11
5
+ APPEND_ITEM STRING 0 STRING "Time string"
@@ -0,0 +1,30 @@
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2022 Ball Aerospace & Technologies Corp.
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
+ # Modified by OpenC3, Inc.
17
+ # All changes Copyright 2022, OpenC3, Inc.
18
+ # All Rights Reserved
19
+ #
20
+ # This file may also be used under the terms of a commercial license
21
+ # if purchased from OpenC3, Inc.
22
+
23
+ require 'openc3'
24
+ require 'openc3/interfaces/tcpip_client_interface'
25
+
26
+ class ExampleInterface < OpenC3::TcpipClientInterface
27
+ def initialize (hostname, port, write_timeout = 10.0, read_timeout = nil)
28
+ super(hostname, port, port, write_timeout, read_timeout, 'LENGTH', 0, 32, 4, 1, 'BIG_ENDIAN', 4, nil, nil, true)
29
+ end
30
+ end
@@ -0,0 +1,9 @@
1
+ REQUIRE example_interface.rb
2
+
3
+ # Ignored Parameters
4
+ # IGNORE_PARAMETER parameter_name
5
+ IGNORE_PARAMETER PACKET_ID
6
+
7
+ IGNORE_ITEM RECEIVED_COUNT
8
+ IGNORE_ITEM RECEIVED_TIMESECONDS
9
+ IGNORE_ITEM RECEIVED_TIMEFORMATTED
@@ -0,0 +1,9 @@
1
+ PARAMETER CCSDSVER 0 3 UINT 0 0 0 "CCSDS primary header version number"
2
+ PARAMETER CCSDSTYPE 3 1 UINT 1 1 1 "CCSDS primary header packet type"
3
+ PARAMETER CCSDSSHF 4 1 UINT 0 0 0 "CCSDS primary header secondary header flag"
4
+ ID_PARAMETER CCSDSAPID 5 11 UINT 0 2047 999 "CCSDS primary header application id"
5
+ PARAMETER CCSDSSEQFLAGS 16 2 UINT 3 3 3 "CCSDS primary header sequence flags"
6
+ PARAMETER CCSDSSEQCNT 18 14 UINT 0 16383 0 "CCSDS primary header sequence count"
7
+ OVERFLOW TRUNCATE
8
+ PARAMETER CCSDSLENGTH 32 16 UINT MIN MAX 12 "CCSDS primary header packet length"
9
+ ID_PARAMETER PKTID 48 16 UINT MIN MAX <%= id %> "Packet id"
@@ -0,0 +1,19 @@
1
+ APPEND_ITEM CCSDSVER 3 UINT "CCSDS packet version number (See CCSDS 133.0-B-1)"
2
+ APPEND_ITEM CCSDSTYPE 1 UINT "CCSDS packet type (command or telemetry)"
3
+ STATE TLM 0
4
+ STATE CMD 1
5
+ APPEND_ITEM CCSDSSHF 1 UINT "CCSDS secondary header flag"
6
+ STATE FALSE 0
7
+ STATE TRUE 1
8
+ APPEND_ID_ITEM CCSDSAPID 11 UINT <%= apid %> "CCSDS application process id"
9
+ APPEND_ITEM CCSDSSEQFLAGS 2 UINT "CCSDS sequence flags"
10
+ STATE FIRST 1
11
+ STATE CONT 0
12
+ STATE LAST 2
13
+ STATE NOGROUP 3
14
+ APPEND_ITEM CCSDSSEQCNT 14 UINT "CCSDS packet sequence count"
15
+ OVERFLOW TRUNCATE
16
+ APPEND_ITEM CCSDSLENGTH 16 UINT "CCSDS packet data length"
17
+ APPEND_ITEM TIMESEC 32 UINT "Seconds since epoch (January 1st, 1970, midnight)"
18
+ APPEND_ITEM TIMEUS 32 UINT "Microseconds of second"
19
+ APPEND_ID_ITEM PKTID 16 UINT 1 "Packet id (The combination of CCSDS_APID and PACKET_ID identify the packet)"
@@ -0,0 +1,63 @@
1
+ COMMAND <%= target_name %> COLLECT BIG_ENDIAN "Starts a collect on the <%= target_name %> target"
2
+ <%= render "_ccsds_cmd.txt", locals: {id: 1} %>
3
+ PARAMETER TYPE 64 16 UINT MIN MAX 0 "Collect type which can be normal or special. Note the special collects are hazarous and require user confirmation."
4
+ REQUIRED
5
+ STATE NORMAL 0
6
+ STATE SPECIAL 1 HAZARDOUS
7
+ PARAMETER DURATION 80 32 FLOAT 0.0 10.0 1.0 "Collect duration"
8
+ PARAMETER OPCODE 112 8 UINT 0x0 0xFF 0xAB "Collect opcode"
9
+ FORMAT_STRING "0x%0X"
10
+ PARAMETER TEMP 120 32 FLOAT 0.0 25.0 0.0 "Collect temperature"
11
+ UNITS Celsius C
12
+
13
+ COMMAND <%= target_name %> ABORT BIG_ENDIAN "Aborts a collect on the <%= target_name %> instrument"
14
+ <%= render "_ccsds_cmd.txt", locals: {id: 2} %>
15
+
16
+ COMMAND <%= target_name %> CLEAR BIG_ENDIAN "Clears counters on the <%= target_name %> instrument"
17
+ HAZARDOUS "Clearing counters may lose valuable information."
18
+ <%= render "_ccsds_cmd.txt", locals: {id: 3} %>
19
+
20
+ COMMAND <%= target_name %> SETPARAMS BIG_ENDIAN "Sets numbered parameters"
21
+ <%= render "_ccsds_cmd.txt", locals: {id: 4} %>
22
+ # ERB syntax:
23
+ <% (1..5).each do |i| %>
24
+ APPEND_PARAMETER VALUE<%= i %> 16 UINT 0 5 1 "Value <%= i %> setting"
25
+ <% end %>
26
+
27
+ SELECT_PARAMETER VALUE5
28
+ POLY_WRITE_CONVERSION 0 2
29
+
30
+ COMMAND <%= target_name %> ASCIICMD BIG_ENDIAN "Enumerated ASCII command"
31
+ <%= render "_ccsds_cmd.txt", locals: {id: 5} %>
32
+ APPEND_PARAMETER STRING 2048 STRING "NOOP" "Enumerated string parameter"
33
+ STATE "NOOP" "NOOP"
34
+ STATE "ARM LASER" "ARM LASER" HAZARDOUS "Arming the laser poses an eye safety hazard."
35
+ STATE "FIRE LASER" "FIRE LASER" HAZARDOUS "WARNING Laser will be fired!"
36
+ APPEND_PARAMETER BINARY 32 STRING 0xDEADBEEF "Binary string"
37
+ APPEND_PARAMETER ASCII 80 STRING "0xDEADBEEF" "ASCII string"
38
+
39
+ COMMAND <%= target_name %> FLTCMD BIG_ENDIAN "Command with float parameters"
40
+ <%= render "_ccsds_cmd.txt", locals: {id: 6} %>
41
+ PARAMETER FLOAT32 64 32 FLOAT MIN MAX 0.0 "Float32 parameter"
42
+ PARAMETER FLOAT64 96 64 FLOAT MIN MAX 0.0 "Float64 parameter"
43
+
44
+ COMMAND <%= target_name %> ARYCMD BIG_ENDIAN "Command with array parameter"
45
+ <%= render "_ccsds_cmd.txt", locals: {id: 7} %>
46
+ ARRAY_PARAMETER ARRAY 64 32 UINT -8 "Array parameter"
47
+ PARAMETER CRC -8 8 UINT MIN MAX 0 "CRC"
48
+
49
+ COMMAND <%= target_name %> SLRPNLDEPLOY BIG_ENDIAN "Deploy solar array panels"
50
+ <%= render "_ccsds_cmd.txt", locals: {id: 8} %>
51
+
52
+ COMMAND <%= target_name %> SLRPNLRESET BIG_ENDIAN "Reset solar array panels"
53
+ <%= render "_ccsds_cmd.txt", locals: {id: 9} %>
54
+
55
+ COMMAND <%= target_name %> MEMLOAD BIG_ENDIAN "Load memory"
56
+ <%= render "_ccsds_cmd.txt", locals: {id: 10} %>
57
+ APPEND_PARAMETER DATA 80 BLOCK "" "Block of data"
58
+
59
+ COMMAND <%= target_name %> QUIET BIG_ENDIAN "Enable/disable no out of limits in the demo"
60
+ <%= render "_ccsds_cmd.txt", locals: {id: 11} %>
61
+ APPEND_PARAMETER STATE 8 UINT 0 1 0
62
+ STATE FALSE 0
63
+ STATE TRUE 1