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,66 @@
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
+ # This file implements an example background task
21
+
22
+ require 'cosmos/tools/cmd_tlm_server/background_task'
23
+
24
+ module Cosmos
25
+ # Starts by sleeping 5 seconds then sends up to three collect commands
26
+ class ExampleBackgroundTask < BackgroundTask
27
+ def initialize
28
+ super()
29
+ @name = 'Example Background Task'
30
+ # Create Sleeper here in case the task is stopped before call is executed
31
+ @sleeper = Sleeper.new
32
+ end
33
+
34
+ def call
35
+ sent_count = 0
36
+ @sleeper = Sleeper.new
37
+ @status = "Sleeping for 5 seconds"
38
+ return if @sleeper.sleep(5) # allow interfaces time to start
39
+ initial_count = tlm('INST', 'HEALTH_STATUS', 'COLLECTS')
40
+ loop do
41
+ # Start up with at least 3 collects
42
+ count = tlm('INST', 'HEALTH_STATUS', 'COLLECTS')
43
+ if count < (initial_count + 3)
44
+ begin
45
+ cmd('INST', 'COLLECT', 'TYPE' => 'NORMAL', 'DURATION' => 1)
46
+ sent_count += 1
47
+ @status = "Sent COLLECT ##{sent_count} at #{Time.now.sys.formatted}"
48
+ wait("INST HEALTH_STATUS COLLECTS > #{count}", 5)
49
+ @status = "Tlm Updated at #{Time.now.sys.formatted}"
50
+ rescue
51
+ # Oh well - probably disconnected
52
+ end
53
+ else
54
+ break
55
+ end
56
+ return if @sleeper.sleep(1)
57
+ end
58
+ @status = "Finished at #{Time.now.sys.formatted}"
59
+ end
60
+
61
+ def stop
62
+ @sleeper.cancel
63
+ @status = "Stopped at #{Time.now.sys.formatted}"
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,112 @@
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
+ require 'cosmos/interfaces'
22
+ require 'cosmos/tools/cmd_tlm_server/interface_thread'
23
+
24
+ module Cosmos
25
+ class ExampleTarget
26
+ class ExampleServerInterface < TcpipServerInterface
27
+ PORT = 9999
28
+
29
+ def initialize
30
+ super(PORT, PORT, 5.0, nil, 'LENGTH', 0, 32, 4, 1, 'BIG_ENDIAN', 4, nil, nil, true)
31
+ end
32
+ end
33
+
34
+ class ExampleInterfaceThread < InterfaceThread
35
+ protected
36
+ def handle_packet(packet)
37
+ identified_packet = System.commands.identify(packet.buffer, ['EXAMPLE'])
38
+ if identified_packet
39
+ Logger.info "Received command: #{identified_packet.target_name} #{identified_packet.packet_name}"
40
+ else
41
+ Logger.info "Received UNKNOWN command"
42
+ end
43
+ end
44
+ end
45
+
46
+ class ExampleTelemetryThread
47
+ attr_reader :thread
48
+
49
+ def initialize(interface)
50
+ @interface = interface
51
+ @sleeper = Sleeper.new
52
+ end
53
+
54
+ def start
55
+ packet = System.telemetry.packet('EXAMPLE', 'STATUS')
56
+ @thread = Thread.new do
57
+ @stop_thread = false
58
+ begin
59
+ loop do
60
+ packet.write('PACKET_ID', 1)
61
+ packet.write('STRING', "The time is now: #{Time.now.sys.formatted}")
62
+ @interface.write(packet)
63
+ break if @sleeper.sleep(1)
64
+ end
65
+ rescue Exception => err
66
+ Logger.error "ExampleTelemetryThread unexpectedly died\n#{err.formatted}"
67
+ end
68
+ end
69
+ end
70
+
71
+ def stop
72
+ Cosmos.kill_thread(self, @thread)
73
+ end
74
+
75
+ def graceful_kill
76
+ @sleeper.cancel
77
+ end
78
+ end
79
+
80
+ def initialize
81
+ # Create interface to receive commands and send telemetry
82
+ @interface = ExampleServerInterface.new
83
+ @interface_thread = nil
84
+ @telemetry_thread = nil
85
+ end
86
+
87
+ def start
88
+ @interface_thread = ExampleInterfaceThread.new(@interface)
89
+ @interface_thread.start
90
+ @telemetry_thread = ExampleTelemetryThread.new(@interface)
91
+ @telemetry_thread.start
92
+ end
93
+
94
+ def stop
95
+ @telemetry_thread.stop if @telemetry_thread
96
+ @interface_thread.stop if @interface_thread
97
+ end
98
+
99
+ def self.run
100
+ Logger.level = Logger::INFO
101
+ target = self.new
102
+ begin
103
+ target.start
104
+ while true
105
+ sleep 1
106
+ end
107
+ rescue SystemExit, Interrupt
108
+ target.stop
109
+ end
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,64 @@
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/tools/cmd_tlm_server/limits_groups_background_task'
21
+
22
+ module Cosmos
23
+ # Inheriting from the LimitsGroupsBackgroundTask provides a framework for
24
+ # automatically enabling and disabling limits groups based on telemetry.
25
+ class LimitsGroups < LimitsGroupsBackgroundTask
26
+ def initialize(initial_delay = 0, task_delay = 0.5)
27
+ # Initial delay upon starting the server before staring the group checks
28
+ # followed by the background task delay between check iterations
29
+ super(initial_delay, task_delay)
30
+ # Creating a Proc allows for arbitrary code to be executed when a group
31
+ # is enabled or disabled.
32
+ @temp2_enable_code = Proc.new do
33
+ enable_limits_group('INST2_GROUND') # Enable the INST2_GROUND group
34
+ end
35
+ @temp2_disable_code = Proc.new do
36
+ disable_limits_group('INST2_GROUND') # Disable the INST2_GROUND group
37
+ end
38
+ end
39
+
40
+ # This method name is important. It must begin with 'check_' and end with
41
+ # the name of a Limits Group defined by the LIMITS_GROUP keyword. In the
42
+ # demo this is defined in config/targets/SYSTEM/cmd_tlm/limits_groups.txt.
43
+ # Note that there is a LIMITS_GROUP INST2_TEMP2 so we have a match.
44
+ def check_inst2_temp2
45
+ # Inside this method you must call process_group. The first parameter is
46
+ # the number of seconds to delay before enabling the group when the telemetry
47
+ # check is true. When the telemetry check is false the group is instantly
48
+ # disabled. The next two parameters are Proc objects which are called with
49
+ # the group is enabled and disabled respectively. We defined our Proc objects
50
+ # in the constructor to enable and disable the GROUND group.
51
+ process_group(0, @temp2_enable_code, @temp2_disable_code) do
52
+ val = tlm("INST2 HEALTH_STATUS TEMP2")
53
+ # The expression returns TRUE (to enable the group) when the value is
54
+ # not NAN and not Infinite. If the value is NAN or Infinite the group
55
+ # is disabled. Note that this can't prevent false positives because the
56
+ # value has to change to something invalid before we can turn off the group
57
+ # at which point it is too late. Typically you enable or disable a group
58
+ # based on some external telemetry point such as a power supply output
59
+ # to enable a group of items powered by the supply.
60
+ !val.nan? && !val.infinite?
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,76 @@
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
+ require 'cosmos/interfaces'
22
+ require 'cosmos/tools/cmd_tlm_server/interface_thread'
23
+
24
+ module Cosmos
25
+ class ScpiTarget
26
+ class ScpiServerInterface < TcpipServerInterface
27
+ PORT = 5025
28
+
29
+ def initialize
30
+ super(PORT, PORT, 5.0, nil, 'TERMINATED', '0xA', '0xA')
31
+ end
32
+ end
33
+
34
+ class ScpiInterfaceThread < InterfaceThread
35
+ def initialize(interface)
36
+ super(interface)
37
+ @index = 0
38
+ end
39
+
40
+ protected
41
+ def handle_packet(packet)
42
+ Logger.info "Received command: #{packet.buffer}"
43
+ if packet.buffer.include?('?')
44
+ @interface.write_raw(@index.to_s + "\x0A")
45
+ end
46
+ @index += 1
47
+ end
48
+ end
49
+
50
+ def initialize
51
+ # Create interface to receive commands and send telemetry
52
+ @target_interface = ScpiServerInterface.new
53
+ @interface_thread = nil
54
+ end
55
+
56
+ def start
57
+ @interface_thread = ScpiInterfaceThread.new(@target_interface)
58
+ @interface_thread.start
59
+ end
60
+
61
+ def stop
62
+ @interface_thread.stop if @interface_thread
63
+ end
64
+
65
+ def self.run
66
+ Logger.level = Logger::INFO
67
+ target = self.new
68
+ begin
69
+ target.start
70
+ loop { sleep 1 }
71
+ rescue SystemExit, Interrupt
72
+ target.stop
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,286 @@
1
+ # cmd
2
+ cmd("INST ABORT")
3
+ cmd("INST ARYCMD with ARRAY []")
4
+ cmd("INST CLEAR")
5
+ cmd("INST COLLECT with DURATION 1.0, TEMP 0.0, TYPE 'NORMAL'")
6
+ cmd("INST FLTCMD with FLOAT32 0.0, FLOAT64 0.0")
7
+ cmd("INST SETPARAMS with VALUE1 0, VALUE2 0, VALUE3 0, VALUE4 0, VALUE5 0")
8
+ cmd("INST SLRPNLDEPLOY")
9
+ cmd("INST SLRPNLRESET")
10
+ cmd("INST ASCIICMD with STRING 'ARM LASER'")
11
+
12
+ cmd("INST", "ABORT")
13
+ cmd("INST", "ARYCMD", "ARRAY" => [])
14
+ cmd("INST", "CLEAR")
15
+ cmd("INST", "COLLECT", "DURATION" => 1.0, "TEMP" => 0.0, "TYPE" => 'NORMAL')
16
+ cmd("INST", "FLTCMD", "FLOAT32" => 0.0, "FLOAT64" => 0.0)
17
+ cmd("INST", "SETPARAMS", "VALUE1" => 0, "VALUE2" => 0, "VALUE3" => 0, "VALUE4" => 0, "VALUE5" => 0)
18
+ cmd("INST", "SLRPNLDEPLOY")
19
+ cmd("INST", "SLRPNLRESET")
20
+ cmd("INST", "ASCIICMD", "STRING" => 'ARM LASER')
21
+
22
+ # cmd should fail
23
+ begin
24
+ cmd("INST COLLECT with DURATION 11, TYPE 'NORMAL'")
25
+ rescue RuntimeError => e
26
+ raise "Fail" if e.message != "Command parameter 'INST COLLECT DURATION' = 11 not in valid range of 0.0 to 10.0"
27
+ rescue
28
+ raise "Fail"
29
+ end
30
+
31
+ cmd()
32
+ cmd("BOB")
33
+ cmd("BOB", "ABORT")
34
+ cmd("INST", "BOB")
35
+ cmd("INST", "ABORT", "BOB" => "BOB")
36
+ cmd("INST", "ABORT", "TED", "BOB" => "BOB")
37
+ cmd("BOB")
38
+ cmd("BOB ABORT")
39
+ cmd("INST BOB")
40
+
41
+ # cmd_no_range_check
42
+ cmd_no_range_check("INST ABORT")
43
+ cmd_no_range_check("INST ARYCMD with ARRAY []")
44
+ cmd_no_range_check("INST CLEAR")
45
+ cmd_no_range_check("INST COLLECT with DURATION 1.0, TEMP 0.0, TYPE 'NORMAL'")
46
+ cmd_no_range_check("INST FLTCMD with FLOAT32 0.0, FLOAT64 0.0")
47
+ cmd_no_range_check("INST SETPARAMS with VALUE1 0, VALUE2 0, VALUE3 0, VALUE4 0, VALUE5 0")
48
+ cmd_no_range_check("INST SLRPNLDEPLOY")
49
+ cmd_no_range_check("INST SLRPNLRESET")
50
+ cmd_no_range_check("INST ASCIICMD with STRING 'ARM LASER'")
51
+ cmd_no_range_check("INST COLLECT with DURATION 11, TYPE 'NORMAL'")
52
+
53
+ cmd_no_range_check("INST", "ABORT")
54
+ cmd_no_range_check("INST", "ARYCMD", "ARRAY" => [])
55
+ cmd_no_range_check("INST", "CLEAR")
56
+ cmd_no_range_check("INST", "COLLECT", "DURATION" => 1.0, "TEMP" => 0.0, "TYPE" => 'NORMAL')
57
+ cmd_no_range_check("INST", "FLTCMD", "FLOAT32" => 0.0, "FLOAT64" => 0.0)
58
+ cmd_no_range_check("INST", "SETPARAMS", "VALUE1" => 0, "VALUE2" => 0, "VALUE3" => 0, "VALUE4" => 0, "VALUE5" => 0)
59
+ cmd_no_range_check("INST", "SLRPNLDEPLOY")
60
+ cmd_no_range_check("INST", "SLRPNLRESET")
61
+ cmd_no_range_check("INST", "ASCIICMD", "STRING" => 'ARM LASER')
62
+ cmd_no_range_check("INST", "COLLECT", "DURATION" => 11, "TYPE" => 'NORMAL')
63
+
64
+ # cmd_no_range_check should fail
65
+ cmd_no_range_check()
66
+ cmd_no_range_check("BOB")
67
+ cmd_no_range_check("BOB", "ABORT")
68
+ cmd_no_range_check("INST", "BOB")
69
+ cmd_no_range_check("INST", "ABORT", "BOB" => "BOB")
70
+ cmd_no_range_check("INST", "ABORT", "TED", "BOB" => "BOB")
71
+ cmd_no_range_check("BOB")
72
+ cmd_no_range_check("BOB ABORT")
73
+ cmd_no_range_check("INST BOB")
74
+
75
+ # cmd_no_hazardous_check
76
+ cmd_no_hazardous_check("INST ABORT")
77
+ cmd_no_hazardous_check("INST ARYCMD with ARRAY []")
78
+ cmd_no_hazardous_check("INST CLEAR")
79
+ cmd_no_hazardous_check("INST COLLECT with DURATION 1.0, TEMP 0.0, TYPE 'NORMAL'")
80
+ cmd_no_hazardous_check("INST FLTCMD with FLOAT32 0.0, FLOAT64 0.0")
81
+ cmd_no_hazardous_check("INST SETPARAMS with VALUE1 0, VALUE2 0, VALUE3 0, VALUE4 0, VALUE5 0")
82
+ cmd_no_hazardous_check("INST SLRPNLDEPLOY")
83
+ cmd_no_hazardous_check("INST SLRPNLRESET")
84
+ cmd_no_hazardous_check("INST ASCIICMD with STRING 'ARM LASER'")
85
+
86
+ cmd_no_hazardous_check("INST", "ABORT")
87
+ cmd_no_hazardous_check("INST", "ARYCMD", "ARRAY" => [])
88
+ cmd_no_hazardous_check("INST", "CLEAR")
89
+ cmd_no_hazardous_check("INST", "COLLECT", "DURATION" => 1.0, "TEMP" => 0.0, "TYPE" => 'NORMAL')
90
+ cmd_no_hazardous_check("INST", "FLTCMD", "FLOAT32" => 0.0, "FLOAT64" => 0.0)
91
+ cmd_no_hazardous_check("INST", "SETPARAMS", "VALUE1" => 0, "VALUE2" => 0, "VALUE3" => 0, "VALUE4" => 0, "VALUE5" => 0)
92
+ cmd_no_hazardous_check("INST", "SLRPNLDEPLOY")
93
+ cmd_no_hazardous_check("INST", "SLRPNLRESET")
94
+ cmd_no_hazardous_check("INST", "ASCIICMD", "STRING" => 'ARM LASER')
95
+
96
+ # cmd_no_hazardous_check should fail
97
+ cmd_no_hazardous_check("INST COLLECT with DURATION 11, TYPE 'NORMAL'")
98
+ cmd_no_hazardous_check()
99
+ cmd_no_hazardous_check("BOB")
100
+ cmd_no_hazardous_check("BOB", "ABORT")
101
+ cmd_no_hazardous_check("INST", "BOB")
102
+ cmd_no_hazardous_check("INST", "ABORT", "BOB" => "BOB")
103
+ cmd_no_hazardous_check("INST", "ABORT", "TED", "BOB" => "BOB")
104
+ cmd_no_hazardous_check("BOB")
105
+ cmd_no_hazardous_check("BOB ABORT")
106
+ cmd_no_hazardous_check("INST BOB")
107
+
108
+ # cmd_no_checks
109
+ cmd_no_checks("INST ABORT")
110
+ cmd_no_checks("INST ARYCMD with ARRAY []")
111
+ cmd_no_checks("INST CLEAR")
112
+ cmd_no_checks("INST COLLECT with DURATION 1.0, TEMP 0.0, TYPE 'NORMAL'")
113
+ cmd_no_checks("INST FLTCMD with FLOAT32 0.0, FLOAT64 0.0")
114
+ cmd_no_checks("INST SETPARAMS with VALUE1 0, VALUE2 0, VALUE3 0, VALUE4 0, VALUE5 0")
115
+ cmd_no_checks("INST SLRPNLDEPLOY")
116
+ cmd_no_checks("INST SLRPNLRESET")
117
+ cmd_no_checks("INST ASCIICMD with STRING 'ARM LASER'")
118
+ cmd_no_checks("INST COLLECT with DURATION 11, TYPE 'NORMAL'")
119
+
120
+ cmd_no_checks("INST", "ABORT")
121
+ cmd_no_checks("INST", "ARYCMD", "ARRAY" => [])
122
+ cmd_no_checks("INST", "CLEAR")
123
+ cmd_no_checks("INST", "COLLECT", "DURATION" => 1.0, "TEMP" => 0.0, "TYPE" => 'NORMAL')
124
+ cmd_no_checks("INST", "FLTCMD", "FLOAT32" => 0.0, "FLOAT64" => 0.0)
125
+ cmd_no_checks("INST", "SETPARAMS", "VALUE1" => 0, "VALUE2" => 0, "VALUE3" => 0, "VALUE4" => 0, "VALUE5" => 0)
126
+ cmd_no_checks("INST", "SLRPNLDEPLOY")
127
+ cmd_no_checks("INST", "SLRPNLRESET")
128
+ cmd_no_checks("INST", "ASCIICMD", "STRING" => 'ARM LASER')
129
+ cmd_no_checks("INST", "COLLECT", "DURATION" => 11, "TYPE" => 'NORMAL')
130
+
131
+ # cmd_no_checks should fail
132
+ cmd_no_checks()
133
+ cmd_no_checks("BOB")
134
+ cmd_no_checks("BOB", "ABORT")
135
+ cmd_no_checks("INST", "BOB")
136
+ cmd_no_checks("INST", "ABORT", "BOB" => "BOB")
137
+ cmd_no_checks("INST", "ABORT", "TED", "BOB" => "BOB")
138
+ cmd_no_checks("BOB")
139
+ cmd_no_checks("BOB ABORT")
140
+ cmd_no_checks("INST BOB")
141
+
142
+ # send_raw should fail (on demo cmd/tlm server)
143
+ send_raw()
144
+ send_raw("INT1")
145
+ send_raw("INT1", "\x00\x00")
146
+ send_raw("INT1", "\x00\x00", "\x00\x00")
147
+
148
+ # get_all_commands
149
+ expected_cmds = %w(ABORT ARYCMD ASCIICMD CLEAR COLLECT FLTCMD SETPARAMS SLRPNLDEPLOY SLRPNLRESET)
150
+ commands = get_all_commands("INST")
151
+ puts commands.inspect
152
+
153
+ # get_all_commands should fail
154
+ get_all_commands()
155
+ get_all_commands("BOB")
156
+ get_all_commands("BOB", "TED")
157
+
158
+ # get_cmd_hazardous
159
+ hazardous = get_cmd_hazardous("INST", "COLLECT", "TYPE" => "SPECIAL")
160
+ puts hazardous
161
+ hazardous = get_cmd_hazardous("INST", "COLLECT", "TYPE" => "NORMAL")
162
+ puts hazardous
163
+ hazardous = get_cmd_hazardous("INST", "ABORT")
164
+ puts hazardous
165
+ hazardous = get_cmd_hazardous("INST", "CLEAR")
166
+ puts hazardous
167
+
168
+ # get_cmd_hazardous should fail
169
+ get_cmd_hazardous()
170
+ get_cmd_hazardous("INST")
171
+ get_cmd_hazardous("INST", "COLLECT", "BOB" => 5)
172
+ get_cmd_hazardous("INST", "COLLECT", 5)
173
+
174
+ # tlm
175
+ tlm("INST HEALTH_STATUS ARY")
176
+ tlm("INST HEALTH_STATUS ASCIICMD")
177
+ tlm("INST HEALTH_STATUS CCSDSAPID")
178
+ tlm("INST HEALTH_STATUS TEMP1")
179
+
180
+ tlm("INST", "HEALTH_STATUS", "ARY")
181
+ tlm("INST", "HEALTH_STATUS", "ASCIICMD")
182
+ tlm("INST", "HEALTH_STATUS", "CCSDSAPID")
183
+ tlm("INST", "HEALTH_STATUS", "TEMP1")
184
+
185
+ # tlm should fail
186
+ tlm()
187
+ tlm("BOB")
188
+ tlm("INST")
189
+ tlm("INST BOB")
190
+ tlm("INST HEALTH_STATUS")
191
+ tlm("INST HEALTH_STATUS BOB")
192
+ tlm("INST HEALTH_STATUS ARY BOB")
193
+ tlm("INST", "BOB")
194
+ tlm("INST", "HEALTH_STATUS")
195
+ tlm("INST", "HEALTH_STATUS", "BOB")
196
+ tlm("INST", "HEALTH_STATUS", "ARY", "BOB")
197
+
198
+ # tlm_raw
199
+ tlm_raw("INST HEALTH_STATUS ARY")
200
+ tlm_raw("INST HEALTH_STATUS ASCIICMD")
201
+ tlm_raw("INST HEALTH_STATUS CCSDSAPID")
202
+ tlm_raw("INST HEALTH_STATUS TEMP1")
203
+
204
+ tlm_raw("INST", "HEALTH_STATUS", "ARY")
205
+ tlm_raw("INST", "HEALTH_STATUS", "ASCIICMD")
206
+ tlm_raw("INST", "HEALTH_STATUS", "CCSDSAPID")
207
+ tlm_raw("INST", "HEALTH_STATUS", "TEMP1")
208
+
209
+ # tlm_raw should fail
210
+ tlm_raw()
211
+ tlm_raw("BOB")
212
+ tlm_raw("INST")
213
+ tlm_raw("INST BOB")
214
+ tlm_raw("INST HEALTH_STATUS")
215
+ tlm_raw("INST HEALTH_STATUS BOB")
216
+ tlm_raw("INST HEALTH_STATUS ARY BOB")
217
+ tlm_raw("INST", "BOB")
218
+ tlm_raw("INST", "HEALTH_STATUS")
219
+ tlm_raw("INST", "HEALTH_STATUS", "BOB")
220
+ tlm_raw("INST", "HEALTH_STATUS", "ARY", "BOB")
221
+
222
+ # tlm_formatted
223
+ tlm_formatted("INST HEALTH_STATUS ARY")
224
+ tlm_formatted("INST HEALTH_STATUS ASCIICMD")
225
+ tlm_formatted("INST HEALTH_STATUS CCSDSAPID")
226
+ tlm_formatted("INST HEALTH_STATUS TEMP1")
227
+
228
+ tlm_formatted("INST", "HEALTH_STATUS", "ARY")
229
+ tlm_formatted("INST", "HEALTH_STATUS", "ASCIICMD")
230
+ tlm_formatted("INST", "HEALTH_STATUS", "CCSDSAPID")
231
+ tlm_formatted("INST", "HEALTH_STATUS", "TEMP1")
232
+
233
+ # tlm_formatted should fail
234
+ tlm_formatted()
235
+ tlm_formatted("BOB")
236
+ tlm_formatted("INST")
237
+ tlm_formatted("INST BOB")
238
+ tlm_formatted("INST HEALTH_STATUS")
239
+ tlm_formatted("INST HEALTH_STATUS BOB")
240
+ tlm_formatted("INST HEALTH_STATUS ARY BOB")
241
+ tlm_formatted("INST", "BOB")
242
+ tlm_formatted("INST", "HEALTH_STATUS")
243
+ tlm_formatted("INST", "HEALTH_STATUS", "BOB")
244
+ tlm_formatted("INST", "HEALTH_STATUS", "ARY", "BOB")
245
+
246
+ # tlm_with_units
247
+ tlm_with_units("INST HEALTH_STATUS ARY")
248
+ tlm_with_units("INST HEALTH_STATUS ASCIICMD")
249
+ tlm_with_units("INST HEALTH_STATUS CCSDSAPID")
250
+ tlm_with_units("INST HEALTH_STATUS TEMP1")
251
+
252
+ tlm_with_units("INST", "HEALTH_STATUS", "ARY")
253
+ tlm_with_units("INST", "HEALTH_STATUS", "ASCIICMD")
254
+ tlm_with_units("INST", "HEALTH_STATUS", "CCSDSAPID")
255
+ tlm_with_units("INST", "HEALTH_STATUS", "TEMP1")
256
+
257
+ # tlm_with_units should fail
258
+ tlm_with_units()
259
+ tlm_with_units("BOB")
260
+ tlm_with_units("INST")
261
+ tlm_with_units("INST BOB")
262
+ tlm_with_units("INST HEALTH_STATUS")
263
+ tlm_with_units("INST HEALTH_STATUS BOB")
264
+ tlm_with_units("INST HEALTH_STATUS ARY BOB")
265
+ tlm_with_units("INST", "BOB")
266
+ tlm_with_units("INST", "HEALTH_STATUS")
267
+ tlm_with_units("INST", "HEALTH_STATUS", "BOB")
268
+ tlm_with_units("INST", "HEALTH_STATUS", "ARY", "BOB")
269
+
270
+ # override_tlm
271
+ override_tlm("INST HEALTH_STATUS ARY = [0,0,0,0,0,0,0,0,0,0]")
272
+ override_tlm("INST HEALTH_STATUS ASCIICMD = 'HI'")
273
+ override_tlm("INST HEALTH_STATUS CCSDSAPID = 1000")
274
+ override_tlm("INST HEALTH_STATUS TEMP1 = 15")
275
+
276
+ # override_tlm_raw
277
+ override_tlm_raw("INST HEALTH_STATUS ARY = [0,0,0,0,0,0,0,0,0,0]")
278
+ override_tlm_raw("INST HEALTH_STATUS ASCIICMD = 'HI'")
279
+ override_tlm_raw("INST HEALTH_STATUS CCSDSAPID = 1000")
280
+ override_tlm_raw("INST HEALTH_STATUS TEMP1 = 10000")
281
+
282
+ # normalize_tlm
283
+ normalize_tlm("INST HEALTH_STATUS ARY")
284
+ normalize_tlm("INST HEALTH_STATUS ASCIICMD")
285
+ normalize_tlm("INST HEALTH_STATUS CCSDSAPID")
286
+ normalize_tlm("INST HEALTH_STATUS TEMP1")