cosmos 4.2.4-java → 4.3.0-java
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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile +1 -1
- data/Manifest.txt +12 -0
- data/autohotkey/tools/cmd_sequence.ahk +21 -20
- data/autohotkey/tools/cmd_sequence2.ahk +1 -1
- data/autohotkey/tools/config_editor.ahk +1 -1
- data/autohotkey/tools/launcher.ahk +1 -0
- data/autohotkey/tools/packet_viewer.ahk +6 -5
- data/autohotkey/tools/test_runner.ahk +8 -8
- data/bin/cosmos +37 -0
- data/bin/dart_util +0 -0
- data/data/config/item_modifiers.yaml +9 -0
- data/data/crc.txt +91 -86
- data/demo/Rakefile +2 -0
- data/demo/config/dart/Gemfile +1 -1
- data/demo/config/data/crc.txt +8 -5
- data/demo/config/system/system.txt +28 -0
- data/demo/config/system/system2.txt +21 -3
- data/demo/config/system/system_alt_ports.txt +69 -0
- data/demo/config/targets/INST/cmd_tlm/inst_tlm.txt +1 -0
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server_chain.txt +18 -0
- data/demo/procedures/cosmos_api_test.rb +18 -14
- data/demo/procedures/local_screen_example.rb +51 -0
- data/ext/cosmos/ext/cosmos_io/cosmos_io.c +32 -4
- data/ext/cosmos/ext/packet/packet.c +6 -0
- data/ext/mkrf_conf.rb +2 -2
- data/install/config/dart/Gemfile +1 -1
- data/install/config/data/crc.txt +2 -2
- data/install/config/system/system.txt +23 -1
- data/lib/cosmos/conversions.rb +2 -0
- data/lib/cosmos/conversions/packet_time_formatted_conversion.rb +38 -0
- data/lib/cosmos/conversions/packet_time_seconds_conversion.rb +38 -0
- data/lib/cosmos/core_ext/cosmos_io.rb +2 -1
- data/lib/cosmos/dart/Gemfile +1 -1
- data/lib/cosmos/dart/examples/dart_stream_client.rb +6 -2
- data/lib/cosmos/dart/lib/dart_common.rb +1 -1
- data/lib/cosmos/dart/lib/dart_database_cleaner.rb +2 -2
- data/lib/cosmos/dart/lib/dart_decommutator.rb +4 -4
- data/lib/cosmos/dart/lib/dart_importer.rb +3 -3
- data/lib/cosmos/dart/lib/dart_packet_log_writer.rb +2 -2
- data/lib/cosmos/dart/processes/dart_ingester.rb +2 -0
- data/lib/cosmos/dart/processes/dart_util.rb +4 -4
- data/lib/cosmos/dart/spec/dart/dart_reducer_manager_spec.rb +3 -3
- data/lib/cosmos/gui/dialogs/cmd_tlm_raw_dialog.rb +9 -5
- data/lib/cosmos/gui/dialogs/details_dialog.rb +29 -29
- data/lib/cosmos/gui/dialogs/exception_list_dialog.rb +1 -1
- data/lib/cosmos/gui/dialogs/find_replace_dialog.rb +3 -3
- data/lib/cosmos/gui/dialogs/interface_raw_dialog.rb +2 -2
- data/lib/cosmos/gui/dialogs/set_tlm_dialog.rb +1 -1
- data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +10 -10
- data/lib/cosmos/gui/qt.rb +10 -1
- data/lib/cosmos/gui/qt_tool.rb +17 -10
- data/lib/cosmos/gui/text/ruby_editor.rb +47 -8
- data/lib/cosmos/gui/utilities/classification_banner.rb +60 -0
- data/lib/cosmos/gui/utilities/script_module_gui.rb +26 -0
- data/lib/cosmos/interfaces.rb +1 -0
- data/lib/cosmos/interfaces/interface.rb +4 -0
- data/lib/cosmos/interfaces/protocols/ignore_packet_protocol.rb +46 -0
- data/lib/cosmos/interfaces/protocols/preidentified_protocol.rb +68 -23
- data/lib/cosmos/packet_logs/packet_log_reader.rb +69 -26
- data/lib/cosmos/packet_logs/packet_log_writer.rb +13 -1
- data/lib/cosmos/packets/commands.rb +5 -1
- data/lib/cosmos/packets/packet.rb +36 -2
- data/lib/cosmos/packets/packet_config.rb +0 -1
- data/lib/cosmos/packets/parsers/format_string_parser.rb +0 -1
- data/lib/cosmos/packets/parsers/xtce_parser.rb +1 -1
- data/lib/cosmos/packets/telemetry.rb +4 -0
- data/lib/cosmos/script/api_shared.rb +2 -0
- data/lib/cosmos/script/limits.rb +4 -0
- data/lib/cosmos/script/script.rb +27 -11
- data/lib/cosmos/script/telemetry.rb +3 -1
- data/lib/cosmos/script/tools.rb +18 -8
- data/lib/cosmos/system/system.rb +21 -0
- data/lib/cosmos/tools/cmd_extractor/cmd_extractor.rb +26 -24
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +29 -29
- data/lib/cosmos/tools/cmd_sequence/cmd_sequence.rb +65 -40
- data/lib/cosmos/tools/cmd_sequence/sequence_item.rb +6 -6
- data/lib/cosmos/tools/cmd_tlm_server/api.rb +13 -0
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +12 -9
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +7 -1
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +8 -8
- data/lib/cosmos/tools/cmd_tlm_server/commanding.rb +13 -2
- data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +2 -2
- data/lib/cosmos/tools/cmd_tlm_server/gui/logging_tab.rb +13 -13
- data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +4 -4
- data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +8 -8
- data/lib/cosmos/tools/cmd_tlm_server/gui/targets_tab.rb +5 -5
- data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +35 -20
- data/lib/cosmos/tools/cmd_tlm_server/replay_backend.rb +15 -11
- data/lib/cosmos/tools/config_editor/config_editor.rb +69 -69
- data/lib/cosmos/tools/data_viewer/data_viewer.rb +42 -38
- data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +1 -0
- data/lib/cosmos/tools/data_viewer/dump_component.rb +1 -0
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +4 -4
- data/lib/cosmos/tools/launcher/launcher.rb +1 -1
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +28 -24
- data/lib/cosmos/tools/opengl_builder/opengl_builder.rb +42 -42
- data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +56 -53
- data/lib/cosmos/tools/script_runner/script_runner.rb +112 -95
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +48 -30
- data/lib/cosmos/tools/table_manager/table_manager.rb +42 -42
- data/lib/cosmos/tools/test_runner/test_runner.rb +45 -27
- data/lib/cosmos/tools/test_runner/test_runner_chooser.rb +3 -3
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +45 -45
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb +4 -4
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +3 -3
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +7 -7
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb +10 -10
- data/lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb +10 -3
- data/lib/cosmos/tools/tlm_grapher/data_objects/xy_data_object.rb +6 -6
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb +14 -14
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tool.rb +83 -83
- data/lib/cosmos/tools/tlm_viewer/screen.rb +73 -13
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +15 -15
- data/lib/cosmos/tools/tlm_viewer/widgets.rb +1 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasellipse_widget.rb +40 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/timegraph_widget.rb +1 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/widget.rb +6 -1
- data/lib/cosmos/top_level.rb +14 -1
- data/lib/cosmos/version.rb +5 -5
- data/lib/cosmos/win32/excel.rb +63 -12
- data/make_gems.sh +10 -0
- data/spec/conversions/packet_time_formatted_conversion_spec.rb +58 -0
- data/spec/conversions/packet_time_seconds_conversion_spec.rb +60 -0
- data/spec/interfaces/protocols/ignore_packet_protocol_spec.rb +243 -0
- data/spec/interfaces/protocols/preidentified_protocol_spec.rb +227 -4
- data/spec/io/serial_driver_spec.rb +15 -13
- data/spec/packet_logs/packet_log_reader_spec.rb +72 -17
- data/spec/packets/packet_config_spec.rb +5 -16
- data/spec/packets/parsers/format_string_parser_spec.rb +0 -11
- data/spec/packets/parsers/macro_parser_spec.rb +36 -36
- data/spec/packets/parsers/state_parser_spec.rb +36 -0
- data/spec/packets/telemetry_spec.rb +11 -9
- data/spec/script/script_spec.rb +2 -3
- data/spec/script/scripting_spec.rb +2 -1
- data/spec/script/tools_spec.rb +0 -1
- data/spec/tools/cmd_tlm_server/api_spec.rb +28 -20
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +33 -0
- data/spec/tools/cmd_tlm_server/commanding_spec.rb +25 -1
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +15 -0
- data/tasks/gemfile_stats.rake +3 -2
- metadata +14 -2
|
@@ -41,20 +41,22 @@ if RUBY_ENGINE == 'ruby' or Gem.win_platform?
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
it "defers to the posix serial driver on nix" do
|
|
44
|
-
|
|
44
|
+
if RUBY_ENGINE == 'ruby'
|
|
45
|
+
class PosixSerialDriver
|
|
46
|
+
end
|
|
47
|
+
allow(Kernel).to receive(:is_windows?).and_return(false)
|
|
48
|
+
driver = double("PosixSerialDriver")
|
|
49
|
+
expect(driver).to receive(:close)
|
|
50
|
+
expect(driver).to receive(:closed?)
|
|
51
|
+
expect(driver).to receive(:write)
|
|
52
|
+
expect(driver).to receive(:read)
|
|
53
|
+
allow(PosixSerialDriver).to receive(:new).and_return(driver)
|
|
54
|
+
driver = SerialDriver.new('COM1',9600)
|
|
55
|
+
driver.close
|
|
56
|
+
driver.closed?
|
|
57
|
+
driver.write("hi")
|
|
58
|
+
driver.read
|
|
45
59
|
end
|
|
46
|
-
allow(Kernel).to receive(:is_windows?).and_return(false)
|
|
47
|
-
driver = double("PosixSerialDriver")
|
|
48
|
-
expect(driver).to receive(:close)
|
|
49
|
-
expect(driver).to receive(:closed?)
|
|
50
|
-
expect(driver).to receive(:write)
|
|
51
|
-
expect(driver).to receive(:read)
|
|
52
|
-
allow(PosixSerialDriver).to receive(:new).and_return(driver)
|
|
53
|
-
driver = SerialDriver.new('COM1',9600)
|
|
54
|
-
driver.close
|
|
55
|
-
driver.closed?
|
|
56
|
-
driver.write("hi")
|
|
57
|
-
driver.read
|
|
58
60
|
end
|
|
59
61
|
end
|
|
60
62
|
end
|
|
@@ -133,6 +133,34 @@ module Cosmos
|
|
|
133
133
|
expect(pkt3.packet_name).to eql 'PKT3'
|
|
134
134
|
@plr.close
|
|
135
135
|
end
|
|
136
|
+
|
|
137
|
+
it "opens COSMOS2 log files" do
|
|
138
|
+
pkt = System.telemetry.packet("SYSTEM","LIMITS_CHANGE").clone
|
|
139
|
+
filename = File.join(@log_path,'test.bin')
|
|
140
|
+
File.open(filename,'wb') do |file|
|
|
141
|
+
file.write ("COSMOS2_CMD TEST " + (" " * 83))
|
|
142
|
+
file.write [1000,100,4,"TGT1",4,"PKT1"].pack('NNCA4CA4')
|
|
143
|
+
file.write [pkt.buffer.length].pack('N')
|
|
144
|
+
file.write pkt.buffer
|
|
145
|
+
file.write [1000,100,4,"TGT2",4,"PKT2"].pack('NNCA4CA4')
|
|
146
|
+
file.write [pkt.buffer.length].pack('N')
|
|
147
|
+
file.write pkt.buffer
|
|
148
|
+
file.write [1000,100,4,"TGT3",4,"PKT3"].pack('NNCA4CA4')
|
|
149
|
+
file.write [pkt.buffer.length].pack('N')
|
|
150
|
+
file.write pkt.buffer
|
|
151
|
+
end
|
|
152
|
+
expect(@plr.open(filename)).to eql [false, nil]
|
|
153
|
+
pkt1 = @plr.read
|
|
154
|
+
expect(pkt1.target_name).to eql 'TGT1'
|
|
155
|
+
expect(pkt1.packet_name).to eql 'PKT1'
|
|
156
|
+
pkt2 = @plr.read
|
|
157
|
+
expect(pkt2.target_name).to eql 'TGT2'
|
|
158
|
+
expect(pkt2.packet_name).to eql 'PKT2'
|
|
159
|
+
pkt3 = @plr.read
|
|
160
|
+
expect(pkt3.target_name).to eql 'TGT3'
|
|
161
|
+
expect(pkt3.packet_name).to eql 'PKT3'
|
|
162
|
+
@plr.close
|
|
163
|
+
end
|
|
136
164
|
end
|
|
137
165
|
|
|
138
166
|
it "handles saved configuration with errors" do
|
|
@@ -205,10 +233,10 @@ module Cosmos
|
|
|
205
233
|
expect(@plr.log_type).to eql :CMD
|
|
206
234
|
expect(@plr.configuration_name).not_to be_nil
|
|
207
235
|
expect(@plr.hostname).to eql Socket.gethostname
|
|
208
|
-
header_length = 8 + 1 + 6 + 1 + 12 + 4
|
|
209
|
-
meta_header_length = 8 + 1 + 6 + 1 + 4 + 4
|
|
236
|
+
header_length = 1 + 8 + 1 + 6 + 1 + 12 + 4
|
|
237
|
+
meta_header_length = 1 + 8 + 1 + 6 + 1 + 4 + 4
|
|
210
238
|
meta_length = System.telemetry.packet('SYSTEM', 'META').length
|
|
211
|
-
expect(packet_offsets).to eql [PacketLogReader::
|
|
239
|
+
expect(packet_offsets).to eql [PacketLogReader::COSMOS4_HEADER_LENGTH, PacketLogReader::COSMOS4_HEADER_LENGTH + meta_header_length + meta_length, PacketLogReader::COSMOS4_HEADER_LENGTH + meta_header_length + meta_length + header_length + @cmd_packet_length, PacketLogReader::COSMOS4_HEADER_LENGTH + meta_header_length + meta_length + (header_length + @cmd_packet_length) * 2]
|
|
212
240
|
|
|
213
241
|
expect(@plr.open(Dir[File.join(@log_path,"*cmd.bin")][0])).to eql [true, nil]
|
|
214
242
|
pkt = @plr.read_at_offset(packet_offsets[2])
|
|
@@ -223,10 +251,10 @@ module Cosmos
|
|
|
223
251
|
expect(@plr.log_type).to eql :TLM
|
|
224
252
|
expect(@plr.configuration_name).not_to be_nil
|
|
225
253
|
expect(@plr.hostname).to eql Socket.gethostname
|
|
226
|
-
header_length = 8 + 1 + 6 + 1 + 13 + 4
|
|
227
|
-
meta_header_length = 8 + 1 + 6 + 1 + 4 + 4
|
|
254
|
+
header_length = 1 + 8 + 1 + 6 + 1 + 13 + 4
|
|
255
|
+
meta_header_length = 1 + 8 + 1 + 6 + 1 + 4 + 4
|
|
228
256
|
meta_length = System.telemetry.packet('SYSTEM', 'META').length
|
|
229
|
-
expect(packet_offsets).to eql [PacketLogReader::
|
|
257
|
+
expect(packet_offsets).to eql [PacketLogReader::COSMOS4_HEADER_LENGTH, PacketLogReader::COSMOS4_HEADER_LENGTH + meta_header_length + meta_length, PacketLogReader::COSMOS4_HEADER_LENGTH + meta_header_length + meta_length + header_length + @tlm_packet_length, PacketLogReader::COSMOS4_HEADER_LENGTH + meta_header_length + meta_length + (header_length + @tlm_packet_length) * 2]
|
|
230
258
|
|
|
231
259
|
expect(@plr.open(Dir[File.join(@log_path,"*tlm.bin")][0])).to eql [true, nil]
|
|
232
260
|
pkt = @plr.read_at_offset(packet_offsets[2])
|
|
@@ -240,10 +268,10 @@ module Cosmos
|
|
|
240
268
|
describe "each" do
|
|
241
269
|
it "returns packets" do
|
|
242
270
|
index = 0
|
|
243
|
-
meta_header_length = 8 + 1 + 6 + 1 + 4 + 4
|
|
271
|
+
meta_header_length = 1 + 8 + 1 + 6 + 1 + 4 + 4
|
|
244
272
|
meta_length = System.telemetry.packet('SYSTEM', 'META').length
|
|
245
273
|
packet_length = System.commands.packet('SYSTEM', 'STARTLOGGING').length
|
|
246
|
-
packet_header_length = 8 + 1 + 'SYSTEM'.length + 1 + 'STARTLOGGING'.length + 4
|
|
274
|
+
packet_header_length = 1 + 8 + 1 + 'SYSTEM'.length + 1 + 'STARTLOGGING'.length + 4
|
|
247
275
|
bytes_read = 128 + packet_header_length + packet_length + meta_header_length + meta_length
|
|
248
276
|
@plr.each(Dir[File.join(@log_path,"*cmd.bin")][0]) do |packet|
|
|
249
277
|
next if packet.packet_name == 'META'
|
|
@@ -257,7 +285,7 @@ module Cosmos
|
|
|
257
285
|
end
|
|
258
286
|
index = 0
|
|
259
287
|
packet_length = System.telemetry.packet('SYSTEM', 'LIMITS_CHANGE').length
|
|
260
|
-
packet_header_length = 8 + 1 + 'SYSTEM'.length + 1 + 'LIMITS_CHANGE'.length + 4
|
|
288
|
+
packet_header_length = 1 + 8 + 1 + 'SYSTEM'.length + 1 + 'LIMITS_CHANGE'.length + 4
|
|
261
289
|
bytes_read = 128 + packet_header_length + packet_length + meta_header_length + meta_length
|
|
262
290
|
@plr.each(Dir[File.join(@log_path,"*tlm.bin")][0]) do |packet|
|
|
263
291
|
next if packet.packet_name == 'META'
|
|
@@ -294,12 +322,20 @@ module Cosmos
|
|
|
294
322
|
|
|
295
323
|
it "increments the command received count" do
|
|
296
324
|
plw = PacketLogWriter.new(:CMD,'cnt',true,nil,10000000,nil,false)
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
325
|
+
collect_packet = System.commands.packet("INST","COLLECT").clone
|
|
326
|
+
collect_packet.stored = false
|
|
327
|
+
collect_packet.extra = {"vcid" => 2}
|
|
328
|
+
abort_packet = System.commands.packet("INST","ABORT").clone
|
|
329
|
+
abort_packet.stored = true
|
|
330
|
+
abort_packet.extra = {"test" => 1}
|
|
331
|
+
stop_packet = System.commands.packet("SYSTEM","STOPLOGGING").clone
|
|
332
|
+
stop_packet.stored = true
|
|
333
|
+
plw.write(collect_packet)
|
|
334
|
+
plw.write(abort_packet)
|
|
335
|
+
plw.write(abort_packet)
|
|
336
|
+
plw.write(collect_packet)
|
|
337
|
+
plw.write(stop_packet)
|
|
338
|
+
plw.write(abort_packet)
|
|
303
339
|
plw.stop
|
|
304
340
|
|
|
305
341
|
cnt = {}
|
|
@@ -308,6 +344,15 @@ module Cosmos
|
|
|
308
344
|
cnt["#{packet.target_name}_#{packet.packet_name}"] ||= 0
|
|
309
345
|
cnt["#{packet.target_name}_#{packet.packet_name}"] += 1
|
|
310
346
|
expect(packet.received_count).to eql cnt["#{packet.target_name}_#{packet.packet_name}"]
|
|
347
|
+
if packet.packet_name == 'ABORT'
|
|
348
|
+
expect(packet.stored).to eql true
|
|
349
|
+
expect(packet.extra).to eql({"test" => 1})
|
|
350
|
+
elsif packet.packet_name == 'COLLECT'
|
|
351
|
+
expect(packet.stored).to eql false
|
|
352
|
+
expect(packet.extra).to eql({"vcid" => 2})
|
|
353
|
+
elsif packet.packet_name == 'STOPLOGGING'
|
|
354
|
+
expect(packet.stored).to eql true
|
|
355
|
+
end
|
|
311
356
|
end
|
|
312
357
|
|
|
313
358
|
# Resetting a packet should reset only that packet's received_count
|
|
@@ -328,10 +373,13 @@ module Cosmos
|
|
|
328
373
|
|
|
329
374
|
it "increments the telemetry received count" do
|
|
330
375
|
plw = PacketLogWriter.new(:TLM,'cnt',true,nil,10000000,nil,false)
|
|
331
|
-
|
|
376
|
+
hs_packet = System.telemetry.packet("INST","HEALTH_STATUS").clone
|
|
377
|
+
hs_packet.stored = true
|
|
378
|
+
hs_packet.extra = {"vcid" => 2}
|
|
379
|
+
plw.write(hs_packet)
|
|
332
380
|
plw.write(System.telemetry.packet("INST","ADCS").clone)
|
|
333
381
|
plw.write(System.telemetry.packet("INST","ADCS").clone)
|
|
334
|
-
plw.write(
|
|
382
|
+
plw.write(hs_packet)
|
|
335
383
|
plw.write(System.telemetry.packet("INST","ADCS").clone)
|
|
336
384
|
plw.stop
|
|
337
385
|
|
|
@@ -341,6 +389,13 @@ module Cosmos
|
|
|
341
389
|
cnt["#{packet.target_name}_#{packet.packet_name}"] ||= 0
|
|
342
390
|
cnt["#{packet.target_name}_#{packet.packet_name}"] += 1
|
|
343
391
|
expect(packet.received_count).to eql cnt["#{packet.target_name}_#{packet.packet_name}"]
|
|
392
|
+
if packet.packet_name == 'HEALTH_STATUS'
|
|
393
|
+
expect(packet.stored).to eql true
|
|
394
|
+
expect(packet.extra).to eql({"vcid" => 2})
|
|
395
|
+
elsif packet.packet_name == 'ADCS'
|
|
396
|
+
expect(packet.stored).to eql false
|
|
397
|
+
expect(packet.extra).to eql nil
|
|
398
|
+
end
|
|
344
399
|
end
|
|
345
400
|
|
|
346
401
|
# Resetting a packet should reset only that packet's received_count
|
|
@@ -324,11 +324,11 @@ module Cosmos
|
|
|
324
324
|
tf.close
|
|
325
325
|
@pc.process_file(tf.path, "TGT1")
|
|
326
326
|
pkt = @pc.telemetry["TGT1"]["PKT1"]
|
|
327
|
-
expect(pkt.items.length).to eql
|
|
327
|
+
expect(pkt.items.length).to eql 8 # 3 plus the RECEIVED_XXX and PACKET_TIMExxx items
|
|
328
328
|
expect(pkt.items.keys).to include('BYTE1','BYTE2','BYTE3')
|
|
329
|
-
expect(pkt.sorted_items[
|
|
330
|
-
expect(pkt.sorted_items[
|
|
331
|
-
expect(pkt.sorted_items[
|
|
329
|
+
expect(pkt.sorted_items[5].name).to eql 'BYTE1'
|
|
330
|
+
expect(pkt.sorted_items[6].name).to eql 'BYTE2'
|
|
331
|
+
expect(pkt.sorted_items[7].name).to eql 'BYTE3'
|
|
332
332
|
tf.unlink
|
|
333
333
|
end
|
|
334
334
|
end
|
|
@@ -691,17 +691,6 @@ module Cosmos
|
|
|
691
691
|
expect(@pc.telemetry["TGT1"]["PKT1"].read("ITEM1",:WITH_UNITS)).to eql "0 V"
|
|
692
692
|
tf.unlink
|
|
693
693
|
end
|
|
694
|
-
|
|
695
|
-
it "complains if STATE defined" do
|
|
696
|
-
tf = Tempfile.new('unittest')
|
|
697
|
-
tf.puts 'TELEMETRY tgt1 pkt1 LITTLE_ENDIAN "Packet"'
|
|
698
|
-
tf.puts ' ITEM item1 0 8 UINT'
|
|
699
|
-
tf.puts ' STATE ONE 1'
|
|
700
|
-
tf.puts ' UNITS Volts V'
|
|
701
|
-
tf.close
|
|
702
|
-
expect { @pc.process_file(tf.path, "TGT1") }.to raise_error(ConfigParser::Error, /Items with STATE can't define UNITS/)
|
|
703
|
-
tf.unlink
|
|
704
|
-
end
|
|
705
694
|
end
|
|
706
695
|
|
|
707
696
|
context "with META" do
|
|
@@ -842,7 +831,7 @@ module Cosmos
|
|
|
842
831
|
expect(@pc.telemetry["TGT1"]["PKT1"].items["ITEM1"].data_type).to be :DERIVED
|
|
843
832
|
tf.unlink
|
|
844
833
|
end
|
|
845
|
-
end
|
|
834
|
+
end
|
|
846
835
|
|
|
847
836
|
end # describe "process_file"
|
|
848
837
|
end
|
|
@@ -53,17 +53,6 @@ module Cosmos
|
|
|
53
53
|
tf.unlink
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
it "complains if STATE is defined" do
|
|
57
|
-
tf = Tempfile.new('unittest')
|
|
58
|
-
tf.puts 'TELEMETRY tgt1 pkt1 LITTLE_ENDIAN "Packet"'
|
|
59
|
-
tf.puts 'ITEM myitem 0 8 UINT "Test Item"'
|
|
60
|
-
tf.puts 'STATE ONE 1'
|
|
61
|
-
tf.puts "FORMAT_STRING '0x%x'"
|
|
62
|
-
tf.close
|
|
63
|
-
expect { @pc.process_file(tf.path, "TGT1") }.to raise_error(ConfigParser::Error, /Items with STATE can't define FORMAT_STRING/)
|
|
64
|
-
tf.unlink
|
|
65
|
-
end
|
|
66
|
-
|
|
67
56
|
it "complains about invalid format strings" do
|
|
68
57
|
tf = Tempfile.new('unittest')
|
|
69
58
|
tf.puts 'TELEMETRY tgt1 pkt1 LITTLE_ENDIAN "Packet"'
|
|
@@ -69,12 +69,12 @@ module Cosmos
|
|
|
69
69
|
tf.close
|
|
70
70
|
@pc.process_file(tf.path, "TGT1")
|
|
71
71
|
pkt = @pc.telemetry["TGT1"]["PKT1"]
|
|
72
|
-
expect(pkt.items.length).to eql
|
|
72
|
+
expect(pkt.items.length).to eql 9 # 4 plus the RECEIVED_XXX and PACKET_TIMExxx items
|
|
73
73
|
expect(pkt.items.keys).to include('BIT1','BIT2','BIT3','BIT4')
|
|
74
|
-
expect(pkt.sorted_items[
|
|
75
|
-
expect(pkt.sorted_items[
|
|
76
|
-
expect(pkt.sorted_items[
|
|
77
|
-
expect(pkt.sorted_items[
|
|
74
|
+
expect(pkt.sorted_items[5].name).to eql 'BIT4'
|
|
75
|
+
expect(pkt.sorted_items[6].name).to eql 'BIT3'
|
|
76
|
+
expect(pkt.sorted_items[7].name).to eql 'BIT2'
|
|
77
|
+
expect(pkt.sorted_items[8].name).to eql 'BIT1'
|
|
78
78
|
limits_items = []
|
|
79
79
|
pkt.items.each do |name, item|
|
|
80
80
|
limits_items << item if name.include?('BIT')
|
|
@@ -117,24 +117,24 @@ module Cosmos
|
|
|
117
117
|
tf.close
|
|
118
118
|
@pc.process_file(tf.path, "TGT1")
|
|
119
119
|
pkt = @pc.telemetry["TGT1"]["PKT1"]
|
|
120
|
-
expect(pkt.items.length).to eql
|
|
120
|
+
expect(pkt.items.length).to eql 13 # 8 plus the RECEIVED_XXX and PACKET_TIMExxx items
|
|
121
121
|
expect(pkt.items.keys).to include('WORD1','WORD2','WORD3','WORD4','DWORD1','DWORD2','DWORD3','DWORD4')
|
|
122
|
-
expect(pkt.sorted_items[
|
|
123
|
-
expect(pkt.sorted_items[
|
|
124
|
-
expect(pkt.sorted_items[
|
|
125
|
-
expect(pkt.sorted_items[
|
|
126
|
-
expect(pkt.sorted_items[
|
|
127
|
-
expect(pkt.sorted_items[
|
|
128
|
-
expect(pkt.sorted_items[
|
|
129
|
-
expect(pkt.sorted_items[
|
|
130
|
-
expect(pkt.sorted_items[
|
|
131
|
-
expect(pkt.sorted_items[
|
|
132
|
-
expect(pkt.sorted_items[
|
|
133
|
-
expect(pkt.sorted_items[
|
|
134
|
-
expect(pkt.sorted_items[
|
|
135
|
-
expect(pkt.sorted_items[
|
|
136
|
-
expect(pkt.sorted_items[
|
|
137
|
-
expect(pkt.sorted_items[
|
|
122
|
+
expect(pkt.sorted_items[5].name).to eql 'WORD1'
|
|
123
|
+
expect(pkt.sorted_items[5].bit_offset).to eql 0
|
|
124
|
+
expect(pkt.sorted_items[6].name).to eql 'DWORD1'
|
|
125
|
+
expect(pkt.sorted_items[6].bit_offset).to eql 16
|
|
126
|
+
expect(pkt.sorted_items[7].name).to eql 'WORD2'
|
|
127
|
+
expect(pkt.sorted_items[7].bit_offset).to eql 48
|
|
128
|
+
expect(pkt.sorted_items[8].name).to eql 'DWORD2'
|
|
129
|
+
expect(pkt.sorted_items[8].bit_offset).to eql 64
|
|
130
|
+
expect(pkt.sorted_items[9].name).to eql 'WORD3'
|
|
131
|
+
expect(pkt.sorted_items[9].bit_offset).to eql 96
|
|
132
|
+
expect(pkt.sorted_items[10].name).to eql 'DWORD3'
|
|
133
|
+
expect(pkt.sorted_items[10].bit_offset).to eql 112
|
|
134
|
+
expect(pkt.sorted_items[11].name).to eql 'WORD4'
|
|
135
|
+
expect(pkt.sorted_items[11].bit_offset).to eql 144
|
|
136
|
+
expect(pkt.sorted_items[12].name).to eql 'DWORD4'
|
|
137
|
+
expect(pkt.sorted_items[12].bit_offset).to eql 160
|
|
138
138
|
tf.unlink
|
|
139
139
|
end
|
|
140
140
|
|
|
@@ -149,18 +149,18 @@ module Cosmos
|
|
|
149
149
|
tf.close
|
|
150
150
|
@pc.process_file(tf.path, "TGT1")
|
|
151
151
|
pkt = @pc.telemetry["TGT1"]["PKT1"]
|
|
152
|
-
expect(pkt.items.length).to eql
|
|
152
|
+
expect(pkt.items.length).to eql 10 # 5 plus the RECEIVED_XXX and PACKET_TIMExxx items
|
|
153
153
|
expect(pkt.items.keys).to include('BIT1','BIT2','BIT3','BIT4','BIT5')
|
|
154
|
-
expect(pkt.sorted_items[
|
|
155
|
-
expect(pkt.sorted_items[
|
|
156
|
-
expect(pkt.sorted_items[
|
|
157
|
-
expect(pkt.sorted_items[
|
|
158
|
-
expect(pkt.sorted_items[
|
|
159
|
-
expect(pkt.sorted_items[
|
|
160
|
-
expect(pkt.sorted_items[
|
|
161
|
-
expect(pkt.sorted_items[
|
|
162
|
-
expect(pkt.sorted_items[
|
|
163
|
-
expect(pkt.sorted_items[
|
|
154
|
+
expect(pkt.sorted_items[5].name).to eql 'BIT1'
|
|
155
|
+
expect(pkt.sorted_items[5].bit_offset).to eql 0
|
|
156
|
+
expect(pkt.sorted_items[6].name).to eql 'BIT2'
|
|
157
|
+
expect(pkt.sorted_items[6].bit_offset).to eql 16
|
|
158
|
+
expect(pkt.sorted_items[7].name).to eql 'BIT3'
|
|
159
|
+
expect(pkt.sorted_items[7].bit_offset).to eql 32
|
|
160
|
+
expect(pkt.sorted_items[8].name).to eql 'BIT4'
|
|
161
|
+
expect(pkt.sorted_items[8].bit_offset).to eql 48
|
|
162
|
+
expect(pkt.sorted_items[9].name).to eql 'BIT5'
|
|
163
|
+
expect(pkt.sorted_items[9].bit_offset).to eql 64
|
|
164
164
|
limits_items = []
|
|
165
165
|
pkt.items.each do |name, item|
|
|
166
166
|
limits_items << item if name.include?('BIT')
|
|
@@ -179,7 +179,7 @@ module Cosmos
|
|
|
179
179
|
tf.close
|
|
180
180
|
@pc.process_file(tf.path, "TGT1")
|
|
181
181
|
pkt = @pc.telemetry["TGT1"]["PKT1"]
|
|
182
|
-
expect(pkt.items.length).to eql
|
|
182
|
+
expect(pkt.items.length).to eql 10 # 5 plus the RECEIVED_XXX and PACKET_TIMExxx items
|
|
183
183
|
expect(pkt.items.keys).to include('BIT1','BIT2','BIT3','BIT4','BIT5')
|
|
184
184
|
expect(pkt.limits_items.collect{|item| item.name}).to include('BIT1','BIT2','BIT3','BIT4','BIT5')
|
|
185
185
|
tf.unlink
|
|
@@ -194,7 +194,7 @@ module Cosmos
|
|
|
194
194
|
tf.close
|
|
195
195
|
@pc.process_file(tf.path, "TGT1")
|
|
196
196
|
pkt = @pc.telemetry["TGT1"]["PKT1"]
|
|
197
|
-
expect(pkt.items.length).to eql
|
|
197
|
+
expect(pkt.items.length).to eql 10 # 5 plus the RECEIVED_XXX and PACKET_TIMExxx items
|
|
198
198
|
expect(pkt.items.keys).to include('BIT1','BIT2','BIT3','BIT4','BIT5')
|
|
199
199
|
expect(pkt.limits_items).to be_empty
|
|
200
200
|
tf.unlink
|
|
@@ -209,7 +209,7 @@ module Cosmos
|
|
|
209
209
|
tf.close
|
|
210
210
|
@pc.process_file(tf.path, "TGT1")
|
|
211
211
|
pkt = @pc.telemetry["TGT1"]["PKT1"]
|
|
212
|
-
expect(pkt.items.length).to eql
|
|
212
|
+
expect(pkt.items.length).to eql 10 # 5 plus the RECEIVED_XXX and PACKET_TIMExxx items
|
|
213
213
|
expect(pkt.items.keys).to include('08_BIT','09_BIT','10_BIT','11_BIT','12_BIT')
|
|
214
214
|
expect(pkt.limits_items).to be_empty
|
|
215
215
|
tf.unlink
|
|
@@ -119,6 +119,42 @@ module Cosmos
|
|
|
119
119
|
end
|
|
120
120
|
|
|
121
121
|
context "with telemetry" do
|
|
122
|
+
it "defines states on ARRAY items" do
|
|
123
|
+
tf = Tempfile.new('unittest')
|
|
124
|
+
tf.puts 'TELEMETRY tgt1 pkt1 LITTLE_ENDIAN "Description"'
|
|
125
|
+
tf.puts ' APPEND_ARRAY_ITEM item1 8 UINT 40 "state item"'
|
|
126
|
+
tf.puts ' STATE FALSE 0'
|
|
127
|
+
tf.puts ' STATE TRUE 1'
|
|
128
|
+
tf.puts ' STATE ERROR ANY'
|
|
129
|
+
tf.close
|
|
130
|
+
@pc.process_file(tf.path, "TGT1")
|
|
131
|
+
tlm = Telemetry.new(@pc)
|
|
132
|
+
pkt = tlm.packet("TGT1", "PKT1")
|
|
133
|
+
pkt.write("ITEM1", [0,1,2,1,0])
|
|
134
|
+
expect(pkt.read("ITEM1")).to eql ["FALSE","TRUE","ERROR","TRUE","FALSE"]
|
|
135
|
+
tf.unlink
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
it "allows an 'ANY' state" do
|
|
139
|
+
tf = Tempfile.new('unittest')
|
|
140
|
+
tf.puts 'TELEMETRY tgt1 pkt1 LITTLE_ENDIAN "Description"'
|
|
141
|
+
tf.puts ' APPEND_ITEM item1 8 UINT "state item"'
|
|
142
|
+
tf.puts ' STATE FALSE 0'
|
|
143
|
+
tf.puts ' STATE TRUE 1'
|
|
144
|
+
tf.puts ' STATE ERROR ANY'
|
|
145
|
+
tf.close
|
|
146
|
+
@pc.process_file(tf.path, "TGT1")
|
|
147
|
+
tlm = Telemetry.new(@pc)
|
|
148
|
+
pkt = tlm.packet("TGT1", "PKT1")
|
|
149
|
+
pkt.write("ITEM1", 0)
|
|
150
|
+
expect(pkt.read("ITEM1")).to eql "FALSE"
|
|
151
|
+
pkt.write("ITEM1", 1)
|
|
152
|
+
expect(pkt.read("ITEM1")).to eql "TRUE"
|
|
153
|
+
pkt.write("ITEM1", 2)
|
|
154
|
+
expect(pkt.read("ITEM1")).to eql "ERROR"
|
|
155
|
+
tf.unlink
|
|
156
|
+
end
|
|
157
|
+
|
|
122
158
|
it "only allows GREEN YELLOW or RED" do
|
|
123
159
|
tf = Tempfile.new('unittest')
|
|
124
160
|
tf.puts 'TELEMETRY tgt1 pkt1 LITTLE_ENDIAN "Description"'
|
|
@@ -114,21 +114,23 @@ module Cosmos
|
|
|
114
114
|
|
|
115
115
|
it "returns all items from packet TGT1/PKT1" do
|
|
116
116
|
items = @tlm.items("TGT1","PKT1")
|
|
117
|
-
expect(items.length).to eql
|
|
118
|
-
expect(items[0].name).to eql "
|
|
119
|
-
expect(items[1].name).to eql "
|
|
120
|
-
expect(items[2].name).to eql "
|
|
121
|
-
expect(items[3].name).to eql "
|
|
122
|
-
expect(items[4].name).to eql "
|
|
123
|
-
expect(items[5].name).to eql "
|
|
124
|
-
expect(items[6].name).to eql "
|
|
117
|
+
expect(items.length).to eql 9
|
|
118
|
+
expect(items[0].name).to eql "PACKET_TIMESECONDS"
|
|
119
|
+
expect(items[1].name).to eql "PACKET_TIMEFORMATTED"
|
|
120
|
+
expect(items[2].name).to eql "RECEIVED_TIMESECONDS"
|
|
121
|
+
expect(items[3].name).to eql "RECEIVED_TIMEFORMATTED"
|
|
122
|
+
expect(items[4].name).to eql "RECEIVED_COUNT"
|
|
123
|
+
expect(items[5].name).to eql "ITEM1"
|
|
124
|
+
expect(items[6].name).to eql "ITEM2"
|
|
125
|
+
expect(items[7].name).to eql "ITEM3"
|
|
126
|
+
expect(items[8].name).to eql "ITEM4"
|
|
125
127
|
end
|
|
126
128
|
end
|
|
127
129
|
|
|
128
130
|
describe "item_names" do
|
|
129
131
|
it "returns all the items for a given target and packet" do
|
|
130
132
|
items = @tlm.item_names("TGT1","PKT1")
|
|
131
|
-
expect(items).to contain_exactly('RECEIVED_TIMEFORMATTED','RECEIVED_TIMESECONDS','RECEIVED_COUNT','ITEM1','ITEM2','ITEM3','ITEM4')
|
|
133
|
+
expect(items).to contain_exactly('PACKET_TIMEFORMATTED', 'PACKET_TIMESECONDS', 'RECEIVED_TIMEFORMATTED','RECEIVED_TIMESECONDS','RECEIVED_COUNT','ITEM1','ITEM2','ITEM3','ITEM4')
|
|
132
134
|
|
|
133
135
|
items = @tlm.item_names("TGT1","LATEST")
|
|
134
136
|
expect(items).to contain_exactly('ITEM1','ITEM2','ITEM3','ITEM4')
|
data/spec/script/script_spec.rb
CHANGED
|
@@ -67,9 +67,8 @@ module Cosmos
|
|
|
67
67
|
expect { get_limits_groups() }.to raise_error(DRb::DRbConnError)
|
|
68
68
|
expect { set_limits_set("DEFAULT") }.to raise_error(DRb::DRbConnError)
|
|
69
69
|
ignore = []
|
|
70
|
-
ignore << %w(
|
|
71
|
-
ignore << %w(
|
|
72
|
-
ignore << %w(INST HEALTH_STATUS GROUND2STATUS)
|
|
70
|
+
ignore << %w(SYSTEM META COMPUTER)
|
|
71
|
+
ignore << %w(SYSTEM META VERSION)
|
|
73
72
|
expect { get_overall_limits_state(ignore) }.to raise_error(DRb::DRbConnError)
|
|
74
73
|
|
|
75
74
|
clear_disconnected_targets()
|