cosmosc2-demo 5.0.2.pre.beta2

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.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +693 -0
  3. data/README.md +31 -0
  4. data/Rakefile +35 -0
  5. data/microservices/EXAMPLE/example_target.rb +123 -0
  6. data/microservices/TEMPLATED/scpi_target.rb +79 -0
  7. data/plugin.txt +100 -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 +27 -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 +53 -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 +39 -0
  20. data/targets/INST/lib/sim_inst.rb +343 -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/my_script_suite.rb +46 -0
  25. data/targets/INST/procedures/my_test_suite.rb +45 -0
  26. data/targets/INST/procedures/target_file.rb +21 -0
  27. data/targets/INST/procedures/utilities/clear.rb +7 -0
  28. data/targets/INST/procedures/utilities/collect.rb +14 -0
  29. data/targets/INST/public/ground_error.png +0 -0
  30. data/targets/INST/public/ground_off.png +0 -0
  31. data/targets/INST/public/ground_on.png +0 -0
  32. data/targets/INST/public/satellite.png +0 -0
  33. data/targets/INST/screens/_footer.txt +3 -0
  34. data/targets/INST/screens/adcs.txt +71 -0
  35. data/targets/INST/screens/array.txt +15 -0
  36. data/targets/INST/screens/block.txt +6 -0
  37. data/targets/INST/screens/commanding.txt +34 -0
  38. data/targets/INST/screens/graphs.txt +17 -0
  39. data/targets/INST/screens/ground.txt +46 -0
  40. data/targets/INST/screens/hs.txt +42 -0
  41. data/targets/INST/screens/latest.txt +21 -0
  42. data/targets/INST/screens/limits.txt +82 -0
  43. data/targets/INST/screens/other.txt +37 -0
  44. data/targets/INST/screens/params.txt +54 -0
  45. data/targets/INST/screens/simple.txt +6 -0
  46. data/targets/INST/screens/tabs.txt +66 -0
  47. data/targets/INST/screens/web.txt +5 -0
  48. data/targets/INST/tables/bin/ConfigTables.bin +0 -0
  49. data/targets/INST/tables/config/ConfigTables_def.txt +8 -0
  50. data/targets/INST/tables/config/MCConfigurationTable_def.txt +36 -0
  51. data/targets/INST/tables/config/PPSSelectionTable_def.txt +7 -0
  52. data/targets/INST/tables/config/TLMMonitoringTable_def.txt +31 -0
  53. data/targets/INST/target.txt +31 -0
  54. data/targets/SYSTEM/cmd_tlm/limits_groups.txt +6 -0
  55. data/targets/SYSTEM/cmd_tlm/meta_tlm.txt +10 -0
  56. data/targets/SYSTEM/cmd_tlm/system_cmds.txt +41 -0
  57. data/targets/SYSTEM/cmd_tlm/system_tlm.txt +7 -0
  58. data/targets/SYSTEM/lib/example_background_task.rb +66 -0
  59. data/targets/SYSTEM/lib/example_target.rb +112 -0
  60. data/targets/SYSTEM/lib/limits_groups.rb +64 -0
  61. data/targets/SYSTEM/lib/scpi_target.rb +76 -0
  62. data/targets/SYSTEM/procedures/cosmos_api_test.rb +286 -0
  63. data/targets/SYSTEM/procedures/example_test.rb +191 -0
  64. data/targets/SYSTEM/procedures/interactive.rb +38 -0
  65. data/targets/SYSTEM/procedures/run_example_test.rb +3 -0
  66. data/targets/SYSTEM/procedures/test.rb +49 -0
  67. data/targets/SYSTEM/screens/status.txt +12 -0
  68. data/targets/SYSTEM/target.txt +12 -0
  69. data/targets/TEMPLATED/cmd_tlm/templated_cmds.txt +13 -0
  70. data/targets/TEMPLATED/cmd_tlm/templated_tlm.txt +3 -0
  71. data/targets/TEMPLATED/lib/templated_interface.rb +69 -0
  72. data/targets/TEMPLATED/target.txt +8 -0
  73. data/tools/widgets/BigWidget/BigWidget.umd.min.js +2 -0
  74. data/tools/widgets/BigWidget/BigWidget.umd.min.js.map +1 -0
  75. data/tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js +2 -0
  76. data/tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js.map +1 -0
  77. metadata +123 -0
@@ -0,0 +1,191 @@
1
+ load 'cosmos/tools/test_runner/test.rb'
2
+
3
+ # This Test demonstrates the usage of the setup and teardown methods
4
+ # as well as defining two tests. Notice that the setup and teardown
5
+ # methods must be called exactly that. Other test methods must start
6
+ # with 'test_' to be processed.
7
+ class ExampleTest < Cosmos::Test
8
+ def initialize
9
+ super()
10
+ end
11
+
12
+ # Setup the test case by doing stuff
13
+ def setup
14
+ status_bar("setup")
15
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
16
+ wait(2)
17
+ end
18
+
19
+ # test_1 verifies requirement 1
20
+ def test_case_with_long_name_1
21
+ status_bar("test_case_with_long_name_1")
22
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
23
+ Cosmos::Test.puts "This test verifies requirement 1"
24
+ wait(2)
25
+ end
26
+
27
+ # test_2 verifies requirement 2
28
+ def test_2
29
+ status_bar("test_2")
30
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
31
+ Cosmos::Test.puts "This test verifies requirement 2"
32
+ if $manual
33
+ answer = ask "Are you sure?"
34
+ else
35
+ answer = 'y'
36
+ end
37
+ wait(2)
38
+ end
39
+
40
+ def test_3xx
41
+ status_bar("test_3xx")
42
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
43
+ wait 1
44
+ end
45
+
46
+ # Teardown the test case by doing other stuff
47
+ def teardown
48
+ status_bar("teardown")
49
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
50
+ wait(2)
51
+ end
52
+
53
+ def helper_method
54
+ end
55
+ end
56
+
57
+ # This is an ExampleTestSuite which only runs ExampleTest
58
+ class ExampleTestSuite < Cosmos::TestSuite
59
+ def initialize
60
+ super()
61
+ add_test('ExampleTest')
62
+ end
63
+ end
64
+
65
+ # ExampleTest2 runs test_3 and test_4.
66
+ class ExampleTest2 < Cosmos::Test
67
+ def setup
68
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
69
+ wait(2)
70
+ end
71
+
72
+ # ExampleTest2::test_2 is different from ExampleTest::test_2
73
+ def test_2
74
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
75
+ raise "BAD"
76
+ puts "continuing past the exception"
77
+ wait 2
78
+ end
79
+
80
+ def test_3
81
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
82
+ raise SkipTestCase, "test_3 unimplemented"
83
+ wait(2)
84
+ end
85
+
86
+ def test_4
87
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
88
+ if non_existent
89
+ puts "can't get here"
90
+ else
91
+ puts "can't get here either"
92
+ end
93
+ wait(2)
94
+ end
95
+
96
+ def teardown
97
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
98
+ wait(2)
99
+ end
100
+ end
101
+
102
+ class ExampleTestSuite2 < Cosmos::TestSuite
103
+ def initialize
104
+ super()
105
+ add_test('ExampleTest2')
106
+ end
107
+ end
108
+
109
+ class ExampleTestSuite3 < Cosmos::TestSuite
110
+ # This setup applies to the entire test suite
111
+ def setup
112
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
113
+ wait(2)
114
+ end
115
+
116
+ def initialize
117
+ super()
118
+ add_test_setup('ExampleTest')
119
+ # This line raises a runtime error because ExampleTest3 has no setup method
120
+ # add_test_setup('ExampleTest3')
121
+ # This line raises a runtime error because ExampleTest3 has no test_50 method
122
+ # add_test_case('ExampleTest3', 'test_50')
123
+ add_test('ExampleTest')
124
+ add_test('ExampleTest2')
125
+ add_test_teardown('ExampleTest')
126
+ end
127
+
128
+ # This teardown applies to the entire test suite
129
+ def teardown
130
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
131
+ wait(2)
132
+ end
133
+ end
134
+
135
+ class ExampleTest3 < Cosmos::Test
136
+ def test_5
137
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
138
+ puts "\000\001\002"
139
+ check_expression("false == true")
140
+ wait(2)
141
+ end
142
+
143
+ def test_6
144
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
145
+ wait(2)
146
+ end
147
+ end
148
+
149
+ class ExampleTestSuite4 < Cosmos::TestSuite
150
+ # This setup applies to the entire test suite
151
+ def setup
152
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
153
+ wait(2)
154
+ end
155
+
156
+ def initialize
157
+ super()
158
+ add_test_setup('ExampleTest')
159
+ add_test_case('ExampleTest', 'test_2')
160
+ add_test_case('ExampleTest', 'test_3xx')
161
+ add_test_teardown('ExampleTest')
162
+ end
163
+
164
+ # This teardown applies to the entire test suite
165
+ def teardown
166
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
167
+ wait(2)
168
+ end
169
+ end
170
+
171
+ class ExampleTestSuite5 < Cosmos::TestSuite
172
+ def initialize
173
+ super()
174
+ add_test_teardown('ExampleTest')
175
+ end
176
+
177
+ # This teardown applies to the entire test suite
178
+ def teardown
179
+ puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
180
+ wait(2)
181
+ end
182
+ end
183
+
184
+ class EmptyTestSuite < Cosmos::TestSuite
185
+ def initialize
186
+ super()
187
+ end
188
+ end
189
+
190
+ class EmptyTest < Cosmos::Test
191
+ end
@@ -0,0 +1,38 @@
1
+ # This script checks all the interactive APIs
2
+ prompt("Would you like to continue?")
3
+ answer = combo_box("This is a plain combo box", 'one', 'two', 'three', informative: nil)
4
+ puts "answer:#{answer}"
5
+ answer = combo_box("This is a combo box with info", 'one', 'two', 'three', informative: 'This is informative')
6
+ puts "answer:#{answer}"
7
+ answer = combo_box("This is a combo box with details", 'one', 'two', 'three', informative: nil, details: 'This is some details')
8
+ puts "answer:#{answer}"
9
+ answer = combo_box("This is a combo box with info & details", 'one', 'two', 'three', informative: 'This is informative', details: 'Details details details!')
10
+ puts "answer:#{answer}"
11
+ answer = combo_box("This is a combo box", 'one', 'two', 'three', text_color: 'blue', background_color: 'grey', font_size: 20, font_family: 'courier', details: "Some more stuff")
12
+ puts "answer:#{answer}"
13
+ answer = prompt("This is a test", text_color: 'blue', background_color: 'grey', font_size: 20, font_family: 'courier', informative: "Informative text", details: "Some more stuff")
14
+ puts "answer:#{answer}"
15
+ answer = prompt("This is a test", font_size: 30, details: "Some more stuff", informative: nil)
16
+ puts "answer:#{answer}"
17
+ answer = message_box('This is a message box', 'one', 'two', 'three', text_color: 'blue', background_color: 'grey', font_size: 20, font_family: 'courier', informative: "Informative stuff", details: "Some more stuff")
18
+ puts "answer:#{answer}"
19
+ answer = vertical_message_box('This is a message box', 'one', 'two', 'three', text_color: 'blue', background_color: 'grey', font_size: 20, font_family: 'courier', informative: "Informative stuff", details: "Some more stuff")
20
+ puts "answer:#{answer}"
21
+ answer = ask("Let me ask you a question", "default")
22
+ puts "answer:#{answer} class:#{answer.class}"
23
+ raise "Not a string" unless answer.is_a? String
24
+ answer = ask("Let me ask you a question", 10)
25
+ puts "answer:#{answer} class:#{answer.class}"
26
+ raise "Not an integer" unless answer.is_a? Integer
27
+ answer = ask("Let me ask you a question", 10.5)
28
+ puts "answer:#{answer} class:#{answer.class}"
29
+ raise "Not a float" unless answer.is_a? Float
30
+ answer = ask_string("Let me ask you a question", "default")
31
+ puts "answer:#{answer} class:#{answer.class}"
32
+ answer = ask_string("Let me ask you a question", 10)
33
+ puts "answer:#{answer} class:#{answer.class}"
34
+ raise "Not a string" unless answer.is_a? String
35
+ answer = ask("Enter a blank (return)", true) # allow blank
36
+ puts "answer:#{answer}"
37
+ answer = ask("Password", false, true) # password required
38
+ puts "answer:#{answer}"
@@ -0,0 +1,3 @@
1
+ load_utility 'SYSTEM/procedures/example_test.rb'
2
+
3
+ ExampleTest3.new.run { |result| puts "#{result.test}:#{result.test_case}:#{result.result}" }
@@ -0,0 +1,49 @@
1
+ puts "1"
2
+ puts "2"
3
+ puts "3"
4
+ puts "4"
5
+ puts "5"
6
+ puts "6"
7
+ puts "7"
8
+ puts "8"
9
+ puts "9"
10
+ puts "10"
11
+
12
+ value = ask('Enter the value')
13
+
14
+ cmd("INST CLEAR")
15
+
16
+ 5.times do |index|
17
+ puts index
18
+ end
19
+
20
+ if false
21
+ puts false
22
+ else
23
+ puts true
24
+ end
25
+
26
+ wait_expression('false', 10)
27
+ wait(10)
28
+
29
+ a = [10,
30
+ 11,
31
+ 12,
32
+ 13,
33
+ 14,
34
+ 15]
35
+
36
+ { :X1 => 1,
37
+ :X2 => 2
38
+ }.each {|x, y| puts x}
39
+
40
+
41
+ puts "brown cow"
42
+ yep
43
+ puts "howdy"
44
+
45
+ if yep
46
+ puts "uh oh"
47
+ end
48
+
49
+ puts "done"
@@ -0,0 +1,12 @@
1
+ SCREEN AUTO AUTO 0.5
2
+
3
+ VERTICAL
4
+
5
+ TITLE "Status"
6
+
7
+ LABELVALUE SYSTEM META COSMOS_VERSION
8
+ LABELVALUE INST HEALTH_STATUS COLLECTS
9
+ LABELVALUE INST2 HEALTH_STATUS COLLECTS
10
+ END
11
+
12
+
@@ -0,0 +1,12 @@
1
+ # Ignored Parameters
2
+ IGNORE_PARAMETER PKTID
3
+ IGNORE_PARAMETER CONFIG
4
+ IGNORE_PARAMETER COSMOS_VERSION
5
+ IGNORE_PARAMETER USER_VERSION
6
+ IGNORE_PARAMETER RUBY_VERSION
7
+
8
+ # Ignored Items
9
+ IGNORE_ITEM PKTID
10
+ IGNORE_ITEM RECEIVED_COUNT
11
+ IGNORE_ITEM RECEIVED_TIMESECONDS
12
+ IGNORE_ITEM RECEIVED_TIMEFORMATTED
@@ -0,0 +1,13 @@
1
+ COMMAND <%= target_name %> SETPT_VOLTAGE BIG_ENDIAN "Templated string command"
2
+ APPEND_ID_PARAMETER CMD_ID 8 UINT 0 0 0 "Command Id"
3
+ APPEND_PARAMETER VOLTAGE 64 FLOAT MIN_FLOAT64 MAX_FLOAT64 3.14 "Voltage setting"
4
+ APPEND_PARAMETER CHANNEL 8 UINT 1 4 1 "Desired channel"
5
+ APPEND_PARAMETER CMD_TEMPLATE 1024 STRING "SOUR:VOLT <VOLTAGE>, (@<CHANNEL>)"
6
+
7
+ COMMAND <%= target_name %> GET_SETPT_VOLTAGE BIG_ENDIAN "Templated string command with response"
8
+ DISABLE_MESSAGES
9
+ APPEND_ID_PARAMETER CMD_ID 8 UINT 1 1 1 "Command Id"
10
+ APPEND_PARAMETER CHANNEL 8 UINT 1 4 1 "Desired channel"
11
+ APPEND_PARAMETER CMD_TEMPLATE 512 STRING "SOUR:VOLT?, (@<CHANNEL>)"
12
+ APPEND_PARAMETER RSP_TEMPLATE 512 STRING "<VOLTAGE>"
13
+ APPEND_PARAMETER RSP_PACKET 512 STRING "READ_VOLTAGE"
@@ -0,0 +1,3 @@
1
+ TELEMETRY <%= target_name %> READ_VOLTAGE BIG_ENDIAN "Telemetry response"
2
+ APPEND_ID_ITEM PKT_ID 8 UINT 0 "Packet Id"
3
+ APPEND_ITEM VOLTAGE 64 FLOAT "Voltage"
@@ -0,0 +1,69 @@
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
+ # This program may also be used under the terms of a commercial or
17
+ # enterprise edition license of COSMOS if purchased from the
18
+ # copyright holder
19
+
20
+ require 'cosmos'
21
+
22
+ module Cosmos
23
+
24
+ class TemplatedInterface < TcpipClientInterface
25
+ def initialize(*args)
26
+ super(*args)
27
+ @polling_thread = nil
28
+ @sleeper = Sleeper.new
29
+ end
30
+
31
+ def connect
32
+ super()
33
+
34
+ # Start a thread to poll telemetry
35
+ Thread.new do |thread|
36
+ Cosmos.kill_thread(self, @polling_thread)
37
+ @sleeper = Sleeper.new
38
+ @polling_thread = Thread.current
39
+ begin
40
+ # Wait for the connection to actually occur
41
+ while !connected?
42
+ @sleeper.sleep(1)
43
+ end
44
+ loop do
45
+ cmd("#{@target_names[0]} GET_SETPT_VOLTAGE", scope: ENV['COSMOS_SCOPE'])
46
+ break if @sleeper.sleep(1)
47
+ end
48
+ rescue Errno::ECONNRESET
49
+ # This typically means the target disconnected
50
+ rescue Exception => err
51
+ Logger.error "Polling Thread Unexpectedly Died.\n#{err.formatted}"
52
+ raise err
53
+ end
54
+ end
55
+ end
56
+
57
+ def disconnect
58
+ super()
59
+ # Note: This must be after super or the disconnect process
60
+ # will be interrupted by killing the thread
61
+ Cosmos.kill_thread(self, @polling_thread) if Thread.current != @polling_thread
62
+ @polling_thread = nil
63
+ end
64
+
65
+ def graceful_kill
66
+ @sleeper.cancel
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,8 @@
1
+ REQUIRE templated_interface.rb
2
+
3
+ # Ignored Parameters
4
+ # IGNORE_PARAMETER parameter_name
5
+ IGNORE_PARAMETER CMD_ID
6
+ IGNORE_PARAMETER CMD_TEMPLATE
7
+ IGNORE_PARAMETER RSP_TEMPLATE
8
+ IGNORE_PARAMETER RSP_PACKET