openc3-cosmos-demo 5.3.0 → 5.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/microservices/EXAMPLE/example_target.rb +22 -16
- data/microservices/TEMPLATED/scpi_target.rb +21 -13
- data/plugin.txt +4 -4
- data/targets/INST/cmd_tlm/inst_cmds.txt +2 -2
- data/targets/INST/lib/sim_inst.rb +1 -1
- data/tools/widgets/BigWidget/BigWidget.umd.min.js +2 -2
- data/tools/widgets/BigWidget/BigWidget.umd.min.js.map +1 -1
- data/tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js +1 -1
- data/tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js.map +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0d465be2df9577e161eab29db9550dfb56dada9344298ef8f1c7e91c4e750a8
|
4
|
+
data.tar.gz: 863feefee70c3a92e7d9cc44c893e1502e8fb7a041b4b40944e6bc3c6e5026c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87073b255a6fbf21d9533420edabbc392d86caf411161811b7e459dd783f094daaf8183454baa63e3a02b522b378adb20dca96f6b48f383b95dc631239a273a3
|
7
|
+
data.tar.gz: 45b6239e974c3c8ba5ac85a65bce9eb1c964561d8014803d4224ad3f972dcb4daf0fbed3695b4a49a18e91b8f684ec58663678dc20343396df33c9b75a903f0a
|
@@ -22,10 +22,11 @@
|
|
22
22
|
|
23
23
|
require 'openc3'
|
24
24
|
require 'openc3/interfaces'
|
25
|
+
require 'openc3/microservices/microservice'
|
25
26
|
require 'openc3/tools/cmd_tlm_server/interface_thread'
|
26
27
|
|
27
28
|
module OpenC3
|
28
|
-
class ExampleTarget
|
29
|
+
class ExampleTarget < Microservice
|
29
30
|
class ExampleServerInterface < TcpipServerInterface
|
30
31
|
def initialize(port)
|
31
32
|
super(port.to_i, port.to_i, 5.0, nil, 'LENGTH', 0, 32, 4, 1, 'BIG_ENDIAN', 4, nil, nil, true)
|
@@ -83,9 +84,15 @@ module OpenC3
|
|
83
84
|
end
|
84
85
|
end
|
85
86
|
|
86
|
-
def initialize(
|
87
|
+
def initialize(name)
|
88
|
+
super(name)
|
89
|
+
@sleep_period = 1 # 1 second between runs
|
90
|
+
# @target_names is an array of all the names mapped to this microservice
|
91
|
+
@target_name = @target_names[0] # Should only be 1
|
92
|
+
# ports is an array of arrays consisting of the port number and protocol
|
93
|
+
# e.g. [[1234, "UDP"], [5678, "TCP"]]
|
94
|
+
port = @config["ports"][0][0] # Should only be 1
|
87
95
|
# Create interface to receive commands and send telemetry
|
88
|
-
@target_name = target_name
|
89
96
|
@interface = ExampleServerInterface.new(port)
|
90
97
|
@interface_thread = nil
|
91
98
|
@telemetry_thread = nil
|
@@ -104,23 +111,22 @@ module OpenC3
|
|
104
111
|
@interface_thread.stop if @interface_thread
|
105
112
|
end
|
106
113
|
|
107
|
-
def
|
114
|
+
def run
|
108
115
|
Logger.level = Logger::INFO
|
109
116
|
Thread.abort_on_exception = true
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
end
|
118
|
-
rescue SystemExit, SignalException
|
119
|
-
target.stop
|
120
|
-
FileUtils.remove_entry(temp_dir) if File.exist?(temp_dir)
|
117
|
+
|
118
|
+
@state = 'STARTING'
|
119
|
+
start()
|
120
|
+
@state = 'RUNNING'
|
121
|
+
while true
|
122
|
+
break if @cancel_thread
|
123
|
+
sleep @sleep_period
|
121
124
|
end
|
125
|
+
@state = 'STOPPING'
|
126
|
+
stop()
|
127
|
+
@state = 'STOPPED'
|
122
128
|
end
|
123
129
|
end
|
124
130
|
end
|
125
131
|
|
126
|
-
OpenC3::ExampleTarget.run
|
132
|
+
OpenC3::ExampleTarget.run if __FILE__ == $0
|
@@ -22,10 +22,11 @@
|
|
22
22
|
|
23
23
|
require 'openc3'
|
24
24
|
require 'openc3/interfaces'
|
25
|
+
require 'openc3/microservices/microservice'
|
25
26
|
require 'openc3/tools/cmd_tlm_server/interface_thread'
|
26
27
|
|
27
28
|
module OpenC3
|
28
|
-
class ScpiTarget
|
29
|
+
class ScpiTarget < Microservice
|
29
30
|
class ScpiServerInterface < TcpipServerInterface
|
30
31
|
def initialize(port)
|
31
32
|
super(port.to_i, port.to_i, 5.0, nil, 'TERMINATED', '0xA', '0xA')
|
@@ -48,7 +49,12 @@ module OpenC3
|
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
51
|
-
def initialize(
|
52
|
+
def initialize(name)
|
53
|
+
super(name)
|
54
|
+
@sleep_period = 1 # 1 second between runs
|
55
|
+
# ports is an array of arrays consisting of the port number and protocol
|
56
|
+
# e.g. [[1234, "UDP"], [5678, "TCP"]]
|
57
|
+
port = @config["ports"][0][0] # Should only be 1
|
52
58
|
# Create interface to receive commands and send telemetry
|
53
59
|
@target_interface = ScpiServerInterface.new(port)
|
54
60
|
@interface_thread = nil
|
@@ -63,20 +69,22 @@ module OpenC3
|
|
63
69
|
@interface_thread.stop if @interface_thread
|
64
70
|
end
|
65
71
|
|
66
|
-
def
|
72
|
+
def run
|
67
73
|
Logger.level = Logger::INFO
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
FileUtils.remove_entry(temp_dir) if File.exist?(temp_dir)
|
74
|
+
Thread.abort_on_exception = true
|
75
|
+
|
76
|
+
@state = 'STARTING'
|
77
|
+
start()
|
78
|
+
@state = 'RUNNING'
|
79
|
+
while true
|
80
|
+
break if @cancel_thread
|
81
|
+
sleep @sleep_period
|
77
82
|
end
|
83
|
+
@state = 'STOPPING'
|
84
|
+
stop()
|
85
|
+
@state = 'STOPPED'
|
78
86
|
end
|
79
87
|
end
|
80
88
|
end
|
81
89
|
|
82
|
-
OpenC3::ScpiTarget.run
|
90
|
+
OpenC3::ScpiTarget.run if __FILE__ == $0
|
data/plugin.txt
CHANGED
@@ -97,16 +97,16 @@ VARIABLE reduced_log_retain_time 2592000
|
|
97
97
|
|
98
98
|
<% if include_example_microservice %>
|
99
99
|
MICROSERVICE EXAMPLE <%= example_microservice_name %>
|
100
|
-
|
100
|
+
CMD ruby example_target.rb
|
101
|
+
TARGET_NAME <%= example_target_name %>
|
101
102
|
PORT <%= example_port %>
|
102
|
-
CMD ruby example_target.rb <%= example_target_name %> <%= example_port %>
|
103
103
|
<% end %>
|
104
104
|
|
105
105
|
<% if include_templated_microservice %>
|
106
106
|
MICROSERVICE TEMPLATED <%= templated_microservice_name %>
|
107
|
-
|
107
|
+
CMD ruby scpi_target.rb
|
108
|
+
TARGET_NAME <%= templated_target_name %>
|
108
109
|
PORT <%= templated_port %>
|
109
|
-
CMD ruby scpi_target.rb <%= templated_target_name %> <%= templated_port %>
|
110
110
|
<% end %>
|
111
111
|
|
112
112
|
WIDGET BIG
|
@@ -30,9 +30,9 @@ COMMAND <%= target_name %> SETPARAMS BIG_ENDIAN "Sets numbered parameters"
|
|
30
30
|
COMMAND <%= target_name %> ASCIICMD BIG_ENDIAN "Enumerated ASCII command"
|
31
31
|
<%= render "_ccsds_cmd.txt", locals: {id: 5} %>
|
32
32
|
APPEND_PARAMETER STRING 2048 STRING "NOOP" "Enumerated string parameter"
|
33
|
-
STATE "NOOP" "NOOP" DISABLE_MESSAGES
|
34
33
|
STATE "ARM LASER" "ARM LASER" HAZARDOUS "Arming the laser poses an eye safety hazard."
|
35
34
|
STATE "FIRE LASER" "FIRE LASER" HAZARDOUS "WARNING Laser will be fired!"
|
35
|
+
STATE "NOOP" "NOOP" DISABLE_MESSAGES
|
36
36
|
APPEND_PARAMETER BINARY 32 STRING 0xDEADBEEF "Binary string"
|
37
37
|
APPEND_PARAMETER ASCII 80 STRING "0xDEADBEEF" "ASCII string"
|
38
38
|
|
@@ -59,7 +59,7 @@ COMMAND <%= target_name %> MEMLOAD BIG_ENDIAN "Load memory"
|
|
59
59
|
|
60
60
|
COMMAND <%= target_name %> QUIET BIG_ENDIAN "Enable/disable no out of limits in the demo"
|
61
61
|
<%= render "_ccsds_cmd.txt", locals: {id: 11} %>
|
62
|
-
APPEND_PARAMETER STATE 8 UINT 0 1
|
62
|
+
APPEND_PARAMETER STATE 8 UINT 0 1 1
|
63
63
|
STATE FALSE 0
|
64
64
|
STATE TRUE 1
|
65
65
|
|
@@ -368,7 +368,7 @@ module OpenC3
|
|
368
368
|
|
369
369
|
# Every 10s throw an unknown packet at the server just to demo that
|
370
370
|
data = Array.new(10) { rand(0..255) }.pack("C*")
|
371
|
-
if @get_count % 1000 ==
|
371
|
+
if @get_count % 1000 == 900
|
372
372
|
pending_packets << Packet.new(nil, nil, :BIG_ENDIAN, nil, data)
|
373
373
|
end
|
374
374
|
|