cosmos 4.4.0-java → 4.5.1-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/.dockerignore +2 -0
- data/.gitignore +1 -0
- data/.travis.yml +6 -6
- data/Dockerfile +70 -0
- data/Manifest.txt +37 -2
- data/README.md +9 -0
- data/Rakefile +55 -5
- data/appveyor.yml +18 -8
- data/autohotkey/config/tools/cmd_sequence/cmd_sequence.txt +2 -0
- data/autohotkey/lib/cmd_sequence_exporter.rb +52 -0
- data/autohotkey/procedures/collect.rb +2 -2
- data/autohotkey/procedures/collect_util.rb +1 -1
- data/autohotkey/procedures/script_test.rb +1 -1
- data/autohotkey/tools/CmdSenderAHK2 +18 -0
- data/autohotkey/tools/cmd_extractor.ahk +11 -9
- data/autohotkey/tools/cmd_sender.ahk +35 -7
- data/autohotkey/tools/cmd_sender2.ahk +4 -0
- data/autohotkey/tools/cmd_sequence.ahk +22 -9
- data/autohotkey/tools/config_editor.ahk +4 -4
- data/autohotkey/tools/data_viewer.ahk +1 -1
- data/autohotkey/tools/limits_monitor.ahk +1 -1
- data/autohotkey/tools/packet_viewer.ahk +1 -1
- data/autohotkey/tools/script_runner.ahk +1 -1
- data/autohotkey/tools/test_runner2.ahk +1 -1
- data/autohotkey/tools/tlm_grapher.ahk +1 -1
- data/autohotkey/tools/tlm_grapher3.ahk +1 -1
- data/autohotkey/tools/tlm_viewer.ahk +1 -1
- data/autohotkey/tools/tlm_viewer2.ahk +1 -1
- data/autohotkey/tools/tlm_viewer5.ahk +1 -1
- data/bin/cstol_converter +1 -1
- data/bin/rubysloc +73 -28
- data/bin/xtce_converter +1 -1
- data/cosmos.gemspec +2 -2
- data/data/config/command_modifiers.yaml +16 -1
- data/data/config/interface_modifiers.yaml +3 -2
- data/data/config/param_item_modifiers.yaml +5 -0
- data/data/config/system.yaml +110 -23
- data/data/config/telemetry_modifiers.yaml +16 -1
- data/data/crc.txt +416 -411
- data/demo/Rakefile +4 -4
- data/demo/config/dart/Gemfile +1 -6
- data/demo/config/data/crc.txt +233 -232
- data/demo/config/system/system.txt +17 -6
- data/demo/config/system/system2.txt +17 -6
- data/demo/config/system/system_alt_ports.txt +17 -6
- data/demo/config/targets/INST/cmd_tlm/inst_cmds.txt +4 -4
- data/demo/config/targets/INST/cmd_tlm/inst_tlm.txt +4 -0
- data/demo/config/targets/INST/cmd_tlm/inst_tlm_override.txt +12 -0
- data/demo/config/targets/INST/lib/sim_inst.rb +2 -2
- data/demo/config/targets/INST/target.txt +1 -0
- data/demo/config/tools/handbook_creator/default_toc.xsl +59 -59
- data/demo/procedures/cosmos_api_test.rb +8 -8
- data/ext/cosmos/ext/buffered_file/buffered_file.c +2 -2
- data/ext/cosmos/ext/config_parser/config_parser.c +1 -2
- data/ext/cosmos/ext/line_graph/line_graph.c +53 -94
- data/ext/cosmos/ext/platform/platform.c +56 -21
- data/ext/cosmos/ext/polynomial_conversion/polynomial_conversion.c +4 -8
- data/ext/cosmos/ext/structure/structure.c +12 -0
- data/extensions/vscode/.gitignore +4 -0
- data/extensions/vscode/.vscode/launch.json +32 -0
- data/extensions/vscode/.vscode/settings.json +13 -0
- data/extensions/vscode/.vscode/tasks.json +79 -0
- data/extensions/vscode/License.txt +879 -0
- data/extensions/vscode/README.md +9 -0
- data/extensions/vscode/client/License.txt +879 -0
- data/extensions/vscode/client/README.md +39 -0
- data/extensions/vscode/client/cosmos.configuration.json +23 -0
- data/extensions/vscode/client/images/icon.png +0 -0
- data/extensions/vscode/client/package-lock.json +414 -0
- data/extensions/vscode/client/package.json +105 -0
- data/extensions/vscode/client/src/extension.ts +132 -0
- data/extensions/vscode/client/src/screen_preview.rb +25 -0
- data/extensions/vscode/client/syntaxes/cosmos.tmLanguage.json +219 -0
- data/extensions/vscode/client/tsconfig.json +17 -0
- data/extensions/vscode/package-lock.json +26 -0
- data/extensions/vscode/package.json +35 -0
- data/extensions/vscode/server/License.txt +879 -0
- data/extensions/vscode/server/package-lock.json +236 -0
- data/extensions/vscode/server/package.json +29 -0
- data/extensions/vscode/server/src/server.ts +59 -0
- data/extensions/vscode/server/tsconfig.json +16 -0
- data/install/Rakefile +4 -4
- data/install/config/dart/Gemfile +2 -7
- data/install/config/data/crc.txt +137 -137
- data/install/config/system/system.txt +17 -6
- data/install/config/tools/handbook_creator/default_toc.xsl +59 -59
- data/lib/cosmos/config/config_parser.rb +2 -10
- data/lib/cosmos/core_ext/class.rb +10 -0
- data/lib/cosmos/core_ext/time.rb +5 -3
- data/lib/cosmos/dart/config/boot.rb +1 -1
- data/lib/cosmos/dart/config/database.yml +2 -0
- data/lib/cosmos/dart/examples/dart_decom_client.rb +1 -1
- data/lib/cosmos/dart/lib/dart_common.rb +12 -5
- data/lib/cosmos/dart/lib/dart_constants.rb +15 -0
- data/lib/cosmos/dart/lib/dart_decom_query.rb +5 -6
- data/lib/cosmos/dart/lib/dart_decommutator.rb +64 -54
- data/lib/cosmos/dart/lib/dart_master_query.rb +71 -0
- data/lib/cosmos/dart/lib/dart_reducer_worker_thread.rb +165 -134
- data/lib/cosmos/dart/processes/dart.rb +4 -2
- data/lib/cosmos/dart/processes/dart_decom_server.rb +3 -3
- data/lib/cosmos/dart/processes/dart_ingester.rb +38 -1
- data/lib/cosmos/dart/processes/dart_master.rb +44 -0
- data/lib/cosmos/dart/processes/dart_util.rb +115 -0
- data/lib/cosmos/dart/spec/dart/dart_database_cleaner_spec.rb +2 -2
- data/lib/cosmos/gui/qt.rb +10 -10
- data/lib/cosmos/gui/qt_tool.rb +17 -12
- data/lib/cosmos/gui/text/completion_text_edit.rb +2 -0
- data/lib/cosmos/gui/widgets/dart_meta_frame.rb +22 -3
- data/lib/cosmos/interfaces/dart_status_interface.rb +1 -1
- data/lib/cosmos/interfaces/linc_interface.rb +3 -3
- data/lib/cosmos/interfaces/protocols/burst_protocol.rb +1 -1
- data/lib/cosmos/interfaces/protocols/crc_protocol.rb +1 -1
- data/lib/cosmos/interfaces/protocols/length_protocol.rb +5 -0
- data/lib/cosmos/interfaces/protocols/template_protocol.rb +3 -3
- data/lib/cosmos/interfaces/serial_interface.rb +7 -1
- data/lib/cosmos/interfaces/stream_interface.rb +1 -1
- data/lib/cosmos/interfaces/tcpip_server_interface.rb +16 -16
- data/lib/cosmos/io/io_multiplexer.rb +6 -2
- data/lib/cosmos/io/json_drb.rb +5 -5
- data/lib/cosmos/io/json_drb_object.rb +7 -2
- data/lib/cosmos/io/json_drb_rack.rb +25 -5
- data/lib/cosmos/io/json_rpc.rb +1 -1
- data/lib/cosmos/io/posix_serial_driver.rb +60 -22
- data/lib/cosmos/io/serial_driver.rb +11 -8
- data/lib/cosmos/io/win32_serial_driver.rb +31 -3
- data/lib/cosmos/packet_logs/packet_log_reader.rb +2 -2
- data/lib/cosmos/packets/packet.rb +9 -9
- data/lib/cosmos/packets/packet_config.rb +27 -9
- data/lib/cosmos/packets/parsers/xtce_converter.rb +10 -10
- data/lib/cosmos/packets/parsers/xtce_parser.rb +3 -0
- data/lib/cosmos/packets/structure.rb +35 -5
- data/lib/cosmos/packets/structure_item.rb +5 -1
- data/lib/cosmos/packets/telemetry.rb +7 -1
- data/lib/cosmos/script/api_shared.rb +18 -1
- data/lib/cosmos/script/extract.rb +1 -1
- data/lib/cosmos/script/script.rb +4 -11
- data/lib/cosmos/streams/serial_stream.rb +11 -6
- data/lib/cosmos/system/system.rb +155 -57
- data/lib/cosmos/tools/cmd_sender/cmd_param_table_item_delegate.rb +15 -0
- data/lib/cosmos/tools/cmd_sender/cmd_params.rb +382 -0
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +29 -318
- data/lib/cosmos/tools/cmd_sequence/cmd_sequence.rb +14 -17
- data/lib/cosmos/tools/cmd_sequence/sequence_item.rb +38 -331
- data/lib/cosmos/tools/cmd_sequence/sequence_list.rb +16 -11
- data/lib/cosmos/tools/cmd_tlm_server/api.rb +10 -8
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +2 -2
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +1 -0
- data/lib/cosmos/tools/cmd_tlm_server/gui/logging_tab.rb +1 -1
- data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +29 -26
- data/lib/cosmos/tools/cmd_tlm_server/limits_groups_background_task.rb +1 -1
- data/lib/cosmos/tools/cmd_tlm_server/router_thread.rb +5 -0
- data/lib/cosmos/tools/config_editor/config_editor.rb +34 -3
- data/lib/cosmos/tools/config_editor/config_editor_frame.rb +8 -9
- data/lib/cosmos/tools/config_editor/system_config_dialog.rb +158 -0
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +1 -1
- data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +1 -1
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +7 -4
- data/lib/cosmos/tools/test_runner/test.rb +6 -3
- data/lib/cosmos/tools/test_runner/test_runner.rb +6 -6
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +3 -3
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb +1 -4
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +20 -16
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_dart_thread.rb +21 -17
- data/lib/cosmos/tools/tlm_grapher/tlm_grapher.rb +18 -11
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +17 -6
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasdot_widget.rb +2 -0
- data/lib/cosmos/top_level.rb +1 -1
- data/lib/cosmos/utilities/ruby_lex_utils.rb +34 -30
- data/lib/cosmos/utilities/simulated_target.rb +1 -1
- data/lib/cosmos/version.rb +5 -5
- data/lib/cosmos/win32/excel.rb +23 -17
- data/run_gui_tests.bat +1 -0
- data/spec/core_ext/class_spec.rb +54 -0
- data/spec/core_ext/socket_spec.rb +1 -1
- data/spec/core_ext/time_spec.rb +4 -0
- data/spec/install/yaml_docs_spec.rb +26 -6
- data/spec/interfaces/linc_interface_spec.rb +1 -1
- data/spec/interfaces/protocols/length_protocol_spec.rb +39 -0
- data/spec/interfaces/serial_interface_spec.rb +1 -5
- data/spec/io/json_drb_rack_spec.rb +166 -0
- data/spec/io/json_drb_spec.rb +14 -0
- data/spec/io/json_rpc_spec.rb +4 -5
- data/spec/io/posix_serial_driver_spec.rb +81 -0
- data/spec/io/win32_serial_driver_spec.rb +33 -3
- data/spec/packet_logs/packet_log_reader_spec.rb +36 -37
- data/spec/packets/structure_spec.rb +52 -2
- data/spec/packets/telemetry_spec.rb +29 -1
- data/spec/script/extract_spec.rb +4 -1
- data/spec/system/system_spec.rb +111 -3
- data/spec/tools/cmd_tlm_server/api_spec.rb +12 -12
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +2 -2
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +4 -3
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +2 -3
- data/spec/utilities/logger_spec.rb +3 -3
- data/spec/utilities/message_log_spec.rb +6 -3
- data/tasks/gemfile_stats.rake +22 -13
- data/test/performance/Rakefile +4 -4
- data/test/performance/config/data/crc.txt +67 -48
- metadata +44 -9
- data/demo/outputs/dart/logs/README.txt +0 -1
- data/lib/cosmos/dart/Gemfile +0 -69
|
@@ -196,7 +196,7 @@ module Cosmos
|
|
|
196
196
|
# TODO: Handle nonunique item names
|
|
197
197
|
if item.array_size
|
|
198
198
|
# Requiring parameterRef for argument arrays appears to be a defect in the schema
|
|
199
|
-
xml['xtce'].
|
|
199
|
+
xml['xtce'].public_send("Array#{type}RefEntry".intern, :parameterRef => item.name) do
|
|
200
200
|
set_fixed_value(xml, item) if !packed
|
|
201
201
|
xml['xtce'].DimensionList do
|
|
202
202
|
xml['xtce'].Dimension do
|
|
@@ -211,9 +211,9 @@ module Cosmos
|
|
|
211
211
|
end
|
|
212
212
|
else
|
|
213
213
|
if packed
|
|
214
|
-
xml['xtce'].
|
|
214
|
+
xml['xtce'].public_send("#{type}RefEntry".intern, "#{type.downcase}Ref".intern => item.name)
|
|
215
215
|
else
|
|
216
|
-
xml['xtce'].
|
|
216
|
+
xml['xtce'].public_send("#{type}RefEntry".intern, "#{type.downcase}Ref".intern => item.name) do
|
|
217
217
|
set_fixed_value(xml, item)
|
|
218
218
|
end
|
|
219
219
|
end
|
|
@@ -256,7 +256,7 @@ module Cosmos
|
|
|
256
256
|
attrs[:shortDescription] = item.description if item.description
|
|
257
257
|
attrs[:arrayTypeRef] = (item.name + '_Type')
|
|
258
258
|
attrs[:numberOfDimensions] = '1' # COSMOS Only supports one-dimensional arrays
|
|
259
|
-
xml['xtce'].
|
|
259
|
+
xml['xtce'].public_send('Array' + param_or_arg + 'Type', attrs)
|
|
260
260
|
end
|
|
261
261
|
end
|
|
262
262
|
|
|
@@ -289,7 +289,7 @@ module Cosmos
|
|
|
289
289
|
encoding = 'unsigned'
|
|
290
290
|
end
|
|
291
291
|
if item.states
|
|
292
|
-
xml['xtce'].
|
|
292
|
+
xml['xtce'].public_send('Enumerated' + param_or_arg + 'Type', attrs) do
|
|
293
293
|
to_xtce_endianness(item, xml)
|
|
294
294
|
to_xtce_units(item, xml)
|
|
295
295
|
xml['xtce'].IntegerDataEncoding(:sizeInBits => item.bit_size, :encoding => encoding)
|
|
@@ -308,7 +308,7 @@ module Cosmos
|
|
|
308
308
|
type_string = 'Integer' + param_or_arg + 'Type'
|
|
309
309
|
attrs[:signed] = signed
|
|
310
310
|
end
|
|
311
|
-
xml['xtce'].
|
|
311
|
+
xml['xtce'].public_send(type_string, attrs) do
|
|
312
312
|
to_xtce_endianness(item, xml)
|
|
313
313
|
to_xtce_units(item, xml)
|
|
314
314
|
if (item.read_conversion and item.read_conversion.class == PolynomialConversion) or (item.write_conversion and item.write_conversion.class == PolynomialConversion)
|
|
@@ -330,7 +330,7 @@ module Cosmos
|
|
|
330
330
|
attrs = { :name => (item.name + '_Type'), :sizeInBits => item.bit_size }
|
|
331
331
|
attrs[:initialValue] = item.default if item.default and !item.array_size
|
|
332
332
|
attrs[:shortDescription] = item.description if item.description
|
|
333
|
-
xml['xtce'].
|
|
333
|
+
xml['xtce'].public_send('Float' + param_or_arg + 'Type', attrs) do
|
|
334
334
|
to_xtce_endianness(item, xml)
|
|
335
335
|
to_xtce_units(item, xml)
|
|
336
336
|
if (item.read_conversion and item.read_conversion.class == PolynomialConversion) or (item.write_conversion and item.write_conversion.class == PolynomialConversion)
|
|
@@ -359,7 +359,7 @@ module Cosmos
|
|
|
359
359
|
end
|
|
360
360
|
end
|
|
361
361
|
attrs[:shortDescription] = item.description if item.description
|
|
362
|
-
xml['xtce'].
|
|
362
|
+
xml['xtce'].public_send(string_or_binary + param_or_arg + 'Type', attrs) do
|
|
363
363
|
# Don't call to_xtce_endianness for Strings or Blocks
|
|
364
364
|
to_xtce_units(item, xml)
|
|
365
365
|
if string_or_binary == 'String'
|
|
@@ -382,9 +382,9 @@ module Cosmos
|
|
|
382
382
|
|
|
383
383
|
def to_xtce_item(item, param_or_arg, xml)
|
|
384
384
|
if item.array_size
|
|
385
|
-
xml['xtce'].
|
|
385
|
+
xml['xtce'].public_send(param_or_arg, :name => item.name, "#{param_or_arg.downcase}TypeRef" => item.name + '_ArrayType')
|
|
386
386
|
else
|
|
387
|
-
xml['xtce'].
|
|
387
|
+
xml['xtce'].public_send(param_or_arg, :name => item.name, "#{param_or_arg.downcase}TypeRef" => item.name + '_Type')
|
|
388
388
|
end
|
|
389
389
|
end
|
|
390
390
|
|
|
@@ -59,6 +59,9 @@ module Cosmos
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def parse(filename, target_name)
|
|
62
|
+
# Fortify complains about Path Manipulation here
|
|
63
|
+
# We have previously validated the file is a .xtce file in packet_config
|
|
64
|
+
# The file is opened read-only and then immediately parsed by Nokogiri
|
|
62
65
|
doc = File.open(filename) { |f| Nokogiri::XML(f, nil, nil, Nokogiri::XML::ParseOptions::STRICT | Nokogiri::XML::ParseOptions::NOBLANKS) }
|
|
63
66
|
# Determine the @current_target_name
|
|
64
67
|
xtce_process_element(doc.root)
|
|
@@ -303,6 +303,23 @@ module Cosmos
|
|
|
303
303
|
end
|
|
304
304
|
end
|
|
305
305
|
|
|
306
|
+
# @param name [String] Name of the item to delete in the items Hash
|
|
307
|
+
def delete_item(name)
|
|
308
|
+
item = @items[name.upcase]
|
|
309
|
+
raise ArgumentError, "Unknown item: #{name}" unless item
|
|
310
|
+
|
|
311
|
+
# Find the item to delete in the sorted_items array
|
|
312
|
+
item_index = nil
|
|
313
|
+
@sorted_items.each_with_index do |sorted_item, index|
|
|
314
|
+
if sorted_item.name == item.name
|
|
315
|
+
item_index = index
|
|
316
|
+
break
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
@sorted_items.delete_at(item_index)
|
|
320
|
+
@items.delete(name.upcase)
|
|
321
|
+
end
|
|
322
|
+
|
|
306
323
|
# Write a value to the buffer based on the item definition
|
|
307
324
|
#
|
|
308
325
|
# @param item [StructureItem] Instance of StructureItem or one of its subclasses
|
|
@@ -445,12 +462,14 @@ module Cosmos
|
|
|
445
462
|
extend(MethodMissing)
|
|
446
463
|
end
|
|
447
464
|
|
|
448
|
-
protected
|
|
449
|
-
|
|
450
465
|
# Take the structure mutex to ensure the buffer does not change while you perform activities
|
|
451
466
|
def synchronize
|
|
452
|
-
|
|
453
|
-
@mutex.
|
|
467
|
+
setup_mutex()
|
|
468
|
+
if @mutex.owned?
|
|
469
|
+
yield
|
|
470
|
+
else
|
|
471
|
+
@mutex.synchronize {|| yield}
|
|
472
|
+
end
|
|
454
473
|
end
|
|
455
474
|
|
|
456
475
|
# Take the structure mutex to ensure the buffer does not change while you perform activities
|
|
@@ -459,7 +478,7 @@ module Cosmos
|
|
|
459
478
|
# lower level calls to go forward without getting the mutex
|
|
460
479
|
def synchronize_allow_reads(top = false)
|
|
461
480
|
@mutex_allow_reads ||= false
|
|
462
|
-
|
|
481
|
+
setup_mutex()
|
|
463
482
|
if top
|
|
464
483
|
@mutex.synchronize do
|
|
465
484
|
@mutex_allow_reads = Thread.current
|
|
@@ -483,6 +502,17 @@ module Cosmos
|
|
|
483
502
|
end
|
|
484
503
|
end
|
|
485
504
|
|
|
505
|
+
protected
|
|
506
|
+
|
|
507
|
+
MUTEX = Mutex.new
|
|
508
|
+
|
|
509
|
+
def setup_mutex
|
|
510
|
+
return if @mutex
|
|
511
|
+
MUTEX.synchronize do
|
|
512
|
+
@mutex ||= Mutex.new
|
|
513
|
+
end
|
|
514
|
+
end
|
|
515
|
+
|
|
486
516
|
module MethodMissing
|
|
487
517
|
# Method missing provides reading/writing item values as if they were methods to the class
|
|
488
518
|
def method_missing(name, value = nil)
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
require 'cosmos/ext/packet' if RUBY_ENGINE == 'ruby' and !ENV['COSMOS_NO_EXT']
|
|
12
12
|
|
|
13
13
|
module Cosmos
|
|
14
|
-
|
|
15
14
|
# Maintains knowledge of an item in a Structure. Multiple StructureItems
|
|
16
15
|
# compose a Structure.
|
|
17
16
|
class StructureItem
|
|
@@ -59,6 +58,9 @@ module Cosmos
|
|
|
59
58
|
# @return [Symbol] {BinaryAccessor::OVERFLOW_TYPES}
|
|
60
59
|
attr_reader :overflow
|
|
61
60
|
|
|
61
|
+
# @return [Boolean] Whether this structure item can overlap another item in the same packet
|
|
62
|
+
attr_accessor :overlap
|
|
63
|
+
|
|
62
64
|
# A large buffer size in bits (1 Megabyte)
|
|
63
65
|
LARGE_BUFFER_SIZE_BITS = 1024 * 1024 * 8
|
|
64
66
|
|
|
@@ -73,6 +75,7 @@ module Cosmos
|
|
|
73
75
|
# @param endianness [Symbol] {BinaryAccessor::ENDIANNESS}
|
|
74
76
|
# @param array_size [Integer, nil] Size of the array item in bits. For
|
|
75
77
|
# example, if the bit_size is 8, an array_size of 16 holds two values.
|
|
78
|
+
# @param overflow [Symbol] {BinaryAccessor::OVERFLOW_TYPES}
|
|
76
79
|
def initialize(name, bit_offset, bit_size, data_type, endianness, array_size = nil, overflow = :ERROR)
|
|
77
80
|
@structure_item_constructed = false
|
|
78
81
|
# Assignment order matters due to verifications!
|
|
@@ -83,6 +86,7 @@ module Cosmos
|
|
|
83
86
|
self.bit_size = bit_size
|
|
84
87
|
self.array_size = array_size
|
|
85
88
|
self.overflow = overflow
|
|
89
|
+
self.overlap = false
|
|
86
90
|
@create_index = @@create_index
|
|
87
91
|
@@create_index += 1
|
|
88
92
|
@structure_item_constructed = true
|
|
@@ -437,7 +437,13 @@ module Cosmos
|
|
|
437
437
|
splash.progress = index / total
|
|
438
438
|
end
|
|
439
439
|
|
|
440
|
-
|
|
440
|
+
# Note: System only has declared target structures but telemetry may have more
|
|
441
|
+
system_target = System.targets[target_name]
|
|
442
|
+
if system_target
|
|
443
|
+
ignored_items = system_target.ignored_items
|
|
444
|
+
else
|
|
445
|
+
ignored_items = []
|
|
446
|
+
end
|
|
441
447
|
|
|
442
448
|
packets(target_name).each do |packet_name, packet|
|
|
443
449
|
# We don't audit against hidden or disabled packets
|
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
# attribution addendums as found in the LICENSE.txt
|
|
10
10
|
|
|
11
11
|
module Cosmos
|
|
12
|
+
# Error raised by the API when a check fails
|
|
13
|
+
class CheckError < RuntimeError; end
|
|
14
|
+
# Error raised when a Script should be stopped
|
|
15
|
+
class StopScript < StandardError; end
|
|
16
|
+
# Error raised when a TestCase should be skipped by TestRunner
|
|
17
|
+
class SkipTestCase < StandardError; end
|
|
18
|
+
|
|
12
19
|
module ApiShared
|
|
13
20
|
DEFAULT_TLM_POLLING_RATE = 0.25
|
|
14
21
|
|
|
@@ -825,6 +832,8 @@ module Cosmos
|
|
|
825
832
|
while true
|
|
826
833
|
work_start = Time.now.sys
|
|
827
834
|
value = tlm_variable(target_name, packet_name, item_name, value_type)
|
|
835
|
+
# Fortify: Dynamic Code Evaluation: Code Injection
|
|
836
|
+
# TODO: Is there anyway to sanitize the exp_to_eval?
|
|
828
837
|
if eval(exp_to_eval)
|
|
829
838
|
return true, value
|
|
830
839
|
end
|
|
@@ -839,6 +848,8 @@ module Cosmos
|
|
|
839
848
|
|
|
840
849
|
if canceled
|
|
841
850
|
value = tlm_variable(target_name, packet_name, item_name, value_type)
|
|
851
|
+
# Fortify: Dynamic Code Evaluation: Code Injection
|
|
852
|
+
# TODO: Is there anyway to sanitize the exp_to_eval?
|
|
842
853
|
if eval(exp_to_eval)
|
|
843
854
|
return true, value
|
|
844
855
|
else
|
|
@@ -879,6 +890,8 @@ module Cosmos
|
|
|
879
890
|
|
|
880
891
|
while true
|
|
881
892
|
work_start = Time.now.sys
|
|
893
|
+
# Fortify: Dynamic Code Evaluation: Code Injection
|
|
894
|
+
# TODO: Is there anyway to sanitize the exp_to_eval?
|
|
882
895
|
if eval(exp_to_eval, context)
|
|
883
896
|
return true
|
|
884
897
|
end
|
|
@@ -892,6 +905,8 @@ module Cosmos
|
|
|
892
905
|
canceled = cosmos_script_sleep(sleep_time)
|
|
893
906
|
|
|
894
907
|
if canceled
|
|
908
|
+
# Fortify: Dynamic Code Evaluation: Code Injection
|
|
909
|
+
# TODO: Is there anyway to sanitize the exp_to_eval?
|
|
895
910
|
if eval(exp_to_eval, context)
|
|
896
911
|
return true
|
|
897
912
|
else
|
|
@@ -907,6 +922,8 @@ module Cosmos
|
|
|
907
922
|
string = "value " + comparison_to_eval
|
|
908
923
|
check_str = "CHECK: #{_upcase(target_name, packet_name, item_name)} #{comparison_to_eval}"
|
|
909
924
|
value_str = "with value == #{value}"
|
|
925
|
+
# Fortify: Dynamic Code Evaluation: Code Injection
|
|
926
|
+
# TODO: Is there anyway to sanitize the comparison_to_eval?
|
|
910
927
|
if eval(string)
|
|
911
928
|
Logger.info "#{check_str} success #{value_str}"
|
|
912
929
|
else
|
|
@@ -942,7 +959,7 @@ module Cosmos
|
|
|
942
959
|
end
|
|
943
960
|
|
|
944
961
|
def run_tlm_viewer(action, display_name = '')
|
|
945
|
-
tlm_viewer = JsonDRbObject.new System.connect_hosts['TLMVIEWER_API'], System.ports['TLMVIEWER_API']
|
|
962
|
+
tlm_viewer = JsonDRbObject.new System.connect_hosts['TLMVIEWER_API'], System.ports['TLMVIEWER_API'], 1.0, Cosmos::System.x_csrf_token
|
|
946
963
|
begin
|
|
947
964
|
yield tlm_viewer
|
|
948
965
|
tlm_viewer.disconnect
|
|
@@ -130,7 +130,7 @@ module Cosmos
|
|
|
130
130
|
return [target_name, packet_name, item_name, comparison_to_eval] if split_string.length == 3
|
|
131
131
|
raise "ERROR: Check improperly specified: #{text}" if split_string.length < 4
|
|
132
132
|
split_string = text.split(/ /) # Split on regex spaces to preserve spaces in comparison
|
|
133
|
-
index = split_string.
|
|
133
|
+
index = split_string.rindex(item_name)
|
|
134
134
|
comparison_to_eval = split_string[(index + 1)..(split_string.length - 1)].join(" ")
|
|
135
135
|
raise "ERROR: Use '==' instead of '=': #{text}" if split_string[3] == '='
|
|
136
136
|
return [target_name, packet_name, item_name, comparison_to_eval]
|
data/lib/cosmos/script/script.rb
CHANGED
|
@@ -25,13 +25,6 @@ $disconnect_all_targets = false
|
|
|
25
25
|
$cmd_tlm_replay_mode = false
|
|
26
26
|
|
|
27
27
|
module Cosmos
|
|
28
|
-
# Error raised by the API when a check fails
|
|
29
|
-
class CheckError < RuntimeError; end
|
|
30
|
-
# Error raised when a Script should be stopped
|
|
31
|
-
class StopScript < StandardError; end
|
|
32
|
-
# Error raised when a TestCase should be skipped by TestRunner
|
|
33
|
-
class SkipTestCase < StandardError; end
|
|
34
|
-
|
|
35
28
|
# Provides a proxy to both a disconnected CmdTlmServer instance and the real
|
|
36
29
|
# JsonDRbObject which communicates with the real CmdTlmServer. If targets
|
|
37
30
|
# are disconnected their method calls are forwarded to the disconnected
|
|
@@ -49,9 +42,9 @@ module Cosmos
|
|
|
49
42
|
end
|
|
50
43
|
# Start a Json connect to the real server
|
|
51
44
|
if $cmd_tlm_replay_mode
|
|
52
|
-
@cmd_tlm_server = JsonDRbObject.new(System.connect_hosts['REPLAY_API'], System.ports['REPLAY_API'])
|
|
45
|
+
@cmd_tlm_server = JsonDRbObject.new(System.connect_hosts['REPLAY_API'], System.ports['REPLAY_API'], 1.0, Cosmos::System.x_csrf_token)
|
|
53
46
|
else
|
|
54
|
-
@cmd_tlm_server = JsonDRbObject.new(System.connect_hosts['CTS_API'], System.ports['CTS_API'])
|
|
47
|
+
@cmd_tlm_server = JsonDRbObject.new(System.connect_hosts['CTS_API'], System.ports['CTS_API'], 1.0, Cosmos::System.x_csrf_token)
|
|
55
48
|
end
|
|
56
49
|
end
|
|
57
50
|
|
|
@@ -69,7 +62,7 @@ module Cosmos
|
|
|
69
62
|
@cmd_tlm_server.disconnect
|
|
70
63
|
else
|
|
71
64
|
if $disconnect_all_targets
|
|
72
|
-
return @disconnected.
|
|
65
|
+
return @disconnected.public_send(method_name, *method_params)
|
|
73
66
|
elsif $disconnected_targets
|
|
74
67
|
name_string = nil
|
|
75
68
|
if method_params[0].is_a?(String)
|
|
@@ -86,7 +79,7 @@ module Cosmos
|
|
|
86
79
|
if name_string
|
|
87
80
|
target = name_string.split(" ")[0]
|
|
88
81
|
if $disconnected_targets.include?(target)
|
|
89
|
-
return @disconnected.
|
|
82
|
+
return @disconnected.public_send(method_name, *method_params)
|
|
90
83
|
end
|
|
91
84
|
end
|
|
92
85
|
end
|
|
@@ -35,8 +35,10 @@ module Cosmos
|
|
|
35
35
|
# complete. Pass nil to create no timeout. The {SerialDriver} will
|
|
36
36
|
# continously try to read data until it has received data or an error
|
|
37
37
|
# occurs.
|
|
38
|
-
# @param flow_control [Symbol] Currently supported :NONE
|
|
38
|
+
# @param flow_control [Symbol] Currently supported :NONE, :RTSCTS (default :NONE)
|
|
39
39
|
# @param data_bits [Integer] Number of data bits (default 8)
|
|
40
|
+
# @param struct [Array] Array of arrays of fields and values to set in the
|
|
41
|
+
# Windows DCB or POSIX structure
|
|
40
42
|
def initialize(write_port_name,
|
|
41
43
|
read_port_name,
|
|
42
44
|
baud_rate,
|
|
@@ -45,7 +47,8 @@ module Cosmos
|
|
|
45
47
|
write_timeout,
|
|
46
48
|
read_timeout,
|
|
47
49
|
flow_control = :NONE,
|
|
48
|
-
data_bits = 8
|
|
50
|
+
data_bits = 8,
|
|
51
|
+
struct = [])
|
|
49
52
|
super()
|
|
50
53
|
|
|
51
54
|
# The SerialDriver class will validate the parameters
|
|
@@ -69,7 +72,8 @@ module Cosmos
|
|
|
69
72
|
@write_timeout,
|
|
70
73
|
@read_timeout,
|
|
71
74
|
@flow_control,
|
|
72
|
-
@data_bits
|
|
75
|
+
@data_bits,
|
|
76
|
+
struct)
|
|
73
77
|
else
|
|
74
78
|
@write_serial_port = nil
|
|
75
79
|
end
|
|
@@ -84,7 +88,8 @@ module Cosmos
|
|
|
84
88
|
@write_timeout,
|
|
85
89
|
@read_timeout,
|
|
86
90
|
@flow_control,
|
|
87
|
-
@data_bits
|
|
91
|
+
@data_bits,
|
|
92
|
+
struct)
|
|
88
93
|
end
|
|
89
94
|
else
|
|
90
95
|
@read_serial_port = nil
|
|
@@ -151,5 +156,5 @@ module Cosmos
|
|
|
151
156
|
@connected = false
|
|
152
157
|
end
|
|
153
158
|
end
|
|
154
|
-
end
|
|
155
|
-
end
|
|
159
|
+
end
|
|
160
|
+
end
|