cosmos 3.8.3 → 3.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/Manifest.txt +14 -0
- data/Rakefile +35 -2
- data/autohotkey/config/targets/INST/screens/_footer.txt +4 -0
- data/autohotkey/config/targets/INST/screens/hs.txt +1 -4
- data/autohotkey/config/tools/table_manager/OldOneDimensionalTable_def.txt +19 -0
- data/autohotkey/config/tools/table_manager/OldTwoDimensionalTable_def.txt +248 -0
- data/autohotkey/config/tools/table_manager/OneDimensionalTable_def.txt +27 -15
- data/autohotkey/config/tools/table_manager/TwoDimensionalTable_def.txt +12 -232
- data/autohotkey/procedures/example_test.rb +4 -0
- data/autohotkey/tools/TableManagerAHK +4 -9
- data/autohotkey/tools/TableManagerAHK2 +18 -0
- data/autohotkey/tools/TableManagerAHK3 +18 -0
- data/autohotkey/tools/TableManagerAHK4 +24 -0
- data/autohotkey/tools/TlmViewerAHK +1 -1
- data/autohotkey/tools/autohotkey.rb +2 -1
- data/autohotkey/tools/open_gl_builder.ahk +1 -1
- data/autohotkey/tools/table_manager.ahk +141 -70
- data/cosmos.gemspec +3 -3
- data/data/crc.txt +70 -68
- data/data/legal.txt +4 -5
- data/demo/config/data/crc.txt +10 -9
- data/demo/config/targets/INST/screens/_footer.txt +4 -0
- data/demo/config/targets/INST/screens/hs.txt +1 -6
- data/demo/config/targets/INST/screens/limits.txt +3 -11
- data/demo/config/tools/cmd_tlm_server/cmd_tlm_server.txt +1 -0
- data/demo/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +33 -22
- data/demo/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +30 -22
- data/demo/config/tools/table_manager/PPSSelectionTable_def.txt +8 -7
- data/demo/config/tools/table_manager/TLMMonitoringTable_def.txt +13 -13
- data/demo/lib/example_background_task.rb +6 -12
- data/demo/procedures/example_test.rb +5 -0
- data/lib/cosmos/conversions/conversion.rb +3 -7
- data/lib/cosmos/core_ext/class.rb +3 -1
- data/lib/cosmos/core_ext/file.rb +1 -0
- data/lib/cosmos/core_ext/io.rb +18 -0
- data/lib/cosmos/core_ext/range.rb +1 -5
- data/lib/cosmos/core_ext/time.rb +3 -3
- data/lib/cosmos/gui/dialogs/about_dialog.rb +60 -36
- data/lib/cosmos/gui/dialogs/calendar_dialog.rb +10 -14
- data/lib/cosmos/gui/dialogs/cmd_details_dialog.rb +4 -5
- data/lib/cosmos/gui/dialogs/cmd_tlm_raw_dialog.rb +31 -17
- data/lib/cosmos/gui/dialogs/details_dialog.rb +63 -47
- data/lib/cosmos/gui/dialogs/exception_dialog.rb +77 -68
- data/lib/cosmos/gui/dialogs/exception_list_dialog.rb +6 -5
- data/lib/cosmos/gui/dialogs/legal_dialog.rb +34 -21
- data/lib/cosmos/gui/dialogs/packet_log_dialog.rb +19 -43
- data/lib/cosmos/gui/dialogs/progress_dialog.rb +79 -42
- data/lib/cosmos/gui/dialogs/pry_dialog.rb +9 -5
- data/lib/cosmos/gui/dialogs/scroll_text_dialog.rb +6 -4
- data/lib/cosmos/gui/dialogs/select_dialog.rb +23 -18
- data/lib/cosmos/gui/dialogs/set_tlm_dialog.rb +34 -10
- data/lib/cosmos/gui/dialogs/splash.rb +18 -8
- data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +38 -43
- data/lib/cosmos/gui/dialogs/tlm_edit_dialog.rb +51 -53
- data/lib/cosmos/gui/line_graph/line_graph_scaling.rb +1 -1
- data/lib/cosmos/gui/line_graph/lines.rb +1 -1
- data/lib/cosmos/gui/qt.rb +9 -2
- data/lib/cosmos/gui/qt_tool.rb +50 -8
- data/lib/cosmos/gui/widgets/packet_log_frame.rb +53 -27
- data/lib/cosmos/interfaces/linc_interface.rb +103 -62
- data/lib/cosmos/io/json_drb_object.rb +3 -3
- data/lib/cosmos/io/raw_logger.rb +4 -8
- data/lib/cosmos/io/tcpip_server.rb +2 -2
- data/lib/cosmos/packets/binary_accessor.rb +1 -1
- data/lib/cosmos/packets/limits.rb +2 -5
- data/lib/cosmos/packets/packet.rb +1 -1
- data/lib/cosmos/packets/packet_config.rb +54 -19
- data/lib/cosmos/packets/parsers/packet_item_parser.rb +7 -1
- data/lib/cosmos/script/scripting.rb +4 -5
- data/lib/cosmos/system/system.rb +2 -1
- data/lib/cosmos/system/target.rb +4 -0
- data/lib/cosmos/tools/cmd_tlm_server/background_task.rb +13 -5
- data/lib/cosmos/tools/cmd_tlm_server/background_tasks.rb +37 -27
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +6 -2
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +7 -5
- data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +21 -10
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +11 -11
- data/lib/cosmos/tools/script_runner/script_runner.rb +2 -18
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +6 -6
- data/lib/cosmos/tools/table_manager/table.rb +32 -41
- data/lib/cosmos/tools/table_manager/table_config.rb +140 -729
- data/lib/cosmos/tools/table_manager/table_item.rb +20 -36
- data/lib/cosmos/tools/table_manager/table_item_parser.rb +46 -0
- data/lib/cosmos/tools/table_manager/table_manager.rb +754 -691
- data/lib/cosmos/tools/table_manager/table_manager_core.rb +172 -358
- data/lib/cosmos/tools/table_manager/table_parser.rb +75 -0
- data/lib/cosmos/tools/test_runner/results_writer.rb +1 -1
- data/lib/cosmos/tools/test_runner/test_runner.rb +11 -0
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/housekeeping_data_object_adder.rb +2 -2
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/singlexy_data_object_adder.rb +2 -2
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +2 -2
- data/lib/cosmos/tools/tlm_grapher/data_objects/data_object.rb +4 -4
- data/lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb +13 -13
- data/lib/cosmos/tools/tlm_grapher/data_objects/linegraph_data_object.rb +9 -9
- data/lib/cosmos/tools/tlm_grapher/data_objects/xy_data_object.rb +9 -9
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_config.rb +4 -4
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tool.rb +1 -1
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +8 -18
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer_config.rb +7 -4
- data/lib/cosmos/top_level.rb +12 -0
- data/lib/cosmos/version.rb +5 -5
- data/run_gui_tests.bat +6 -0
- data/spec/core_ext/array_spec.rb +1 -1
- data/spec/interfaces/linc_interface_spec.rb +4 -4
- data/spec/io/json_drb_spec.rb +2 -2
- data/spec/io/json_rpc_spec.rb +1 -1
- data/spec/io/raw_logger_spec.rb +5 -1
- data/spec/packet_logs/packet_log_writer_spec.rb +1 -1
- data/spec/packets/packet_config_spec.rb +144 -0
- data/spec/packets/parsers/packet_item_parser_spec.rb +60 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/system/target_spec.rb +5 -1
- data/spec/tools/cmd_tlm_server/background_task_spec.rb +15 -3
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +117 -31
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +4 -0
- data/spec/tools/launcher/launcher_config_spec.rb +1 -1
- data/spec/tools/table_manager/table_config_spec.rb +226 -0
- data/spec/tools/table_manager/table_item_spec.rb +57 -0
- data/spec/tools/table_manager/table_parser_spec.rb +96 -0
- data/spec/tools/table_manager/table_spec.rb +90 -0
- data/spec/tools/table_manager/tablemanager_core_spec.rb +557 -0
- data/spec/top_level/top_level_spec.rb +9 -0
- data/spec/utilities/csv_spec.rb +3 -3
- metadata +30 -11
@@ -1,25 +1,33 @@
|
|
1
|
-
TABLE "MC Configuration" "Memory Control Configuration Table"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
1
|
+
TABLE "MC Configuration" BIG_ENDIAN ONE_DIMENSIONAL "Memory Control Configuration Table"
|
2
|
+
APPEND_PARAMETER "Scrub Region 1 Start Addr" 32 UINT 0 0x03FFFFFB 0
|
3
|
+
FORMAT_STRING "0x%0X"
|
4
|
+
APPEND_PARAMETER "Scrub Region 1 End Addr" 32 UINT 0 0x03FFFFFF 0x03FFFFFF
|
5
|
+
FORMAT_STRING "0x%0X"
|
6
|
+
APPEND_PARAMETER "Scrub Region 1 Error Check Size" 32 UINT 0 0x03FFFFFB 0x10000
|
7
|
+
FORMAT_STRING "0x%0X"
|
8
|
+
APPEND_PARAMETER "Scrub Region 1 Throttle Count" 32 UINT 0 0x03FFFFFF 6000
|
9
|
+
FORMAT_STRING "0x%0X"
|
10
|
+
APPEND_PARAMETER "Scrub Region 1 Throttle Ticks" 32 UINT 0 0x0FFFFFFFF 2
|
11
|
+
FORMAT_STRING "0x%0X"
|
12
|
+
APPEND_PARAMETER "Scrub Region 2 Start Addr" 32 UINT 0 0x03FFFFB 0
|
13
|
+
FORMAT_STRING "0x%0X"
|
14
|
+
APPEND_PARAMETER "Scrub Region 2 End Addr" 32 UINT 0 0x03FFFFF 0x03FFFFF
|
15
|
+
FORMAT_STRING "0x%0X"
|
16
|
+
APPEND_PARAMETER "Scrub Region 2 Error Check Size" 32 UINT 0 0x03FFFFF 0x10000
|
17
|
+
FORMAT_STRING "0x%0X"
|
18
|
+
APPEND_PARAMETER "Scrub Region 2 Throttle Count" 32 UINT 0 0x03FFFFF 6000
|
19
|
+
APPEND_PARAMETER "Scrub Region 2 Throttle Ticks" 32 UINT 0 0x0FFFFFFFF 2
|
20
|
+
APPEND_PARAMETER "Dump Packet Throttle (sec)" 32 UINT 0 0x0FFFFFFFF 2 "Number of seconds to wait between dumping large packets"
|
21
|
+
APPEND_PARAMETER "Memory Scrubbing" 8 UINT 0 1 1
|
14
22
|
STATE DISABLE 0
|
15
23
|
STATE ENABLE 1
|
16
|
-
|
17
|
-
CONSTRAINT_START
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
CONSTRAINT_END
|
24
|
-
|
24
|
+
APPEND_PARAMETER "SIOC Memory Config" 8 UINT 1 3 3
|
25
|
+
#CONSTRAINT_START
|
26
|
+
# if packet.read("Memory Scrubbing") == 'DISABLE'
|
27
|
+
# packet.get_item("SIOC Memory Config").range = (10..20)
|
28
|
+
# else
|
29
|
+
# packet.get_item("SIOC Memory Config").range = (1..3)
|
30
|
+
# end
|
31
|
+
#CONSTRAINT_END
|
32
|
+
APPEND_PARAMETER "Pad" 16 UINT 0 0 0
|
25
33
|
|
@@ -1,8 +1,9 @@
|
|
1
|
-
TABLE "PPS Selection" "Payload Clock Control Pulse Per Second Selection Table"
|
2
|
-
|
3
|
-
STATE
|
4
|
-
STATE
|
5
|
-
|
6
|
-
|
7
|
-
STATE
|
1
|
+
TABLE "PPS Selection" BIG_ENDIAN ONE_DIMENSIONAL "Payload Clock Control Pulse Per Second Selection Table"
|
2
|
+
APPEND_PARAMETER "Primary PPS" 8 UINT 0 1 1
|
3
|
+
STATE CHECKED 1
|
4
|
+
STATE UNCHECKED 0
|
5
|
+
APPEND_PARAMETER "Redundant PPS" 8 UINT 0 1 1
|
6
|
+
UNEDITABLE
|
7
|
+
STATE UNCHECKED 0
|
8
|
+
STATE CHECKED 1
|
8
9
|
|
@@ -1,31 +1,31 @@
|
|
1
|
-
TABLE "TLM Monitoring" "Telemetry Monitoring Table"
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
TABLE "TLM Monitoring" BIG_ENDIAN TWO_DIMENSIONAL 200 "Telemetry Monitoring Table"
|
2
|
+
APPEND_PARAMETER "Threshold" 32 UINT MIN MAX 0 "Telemetry item threshold at which point persistance is incremented"
|
3
|
+
APPEND_PARAMETER "Offset" 32 UINT MIN MAX 0 "Offset into the telemetry packet to monitor"
|
4
|
+
APPEND_PARAMETER "Data Size" 32 UINT 0 3 0 "Amount of data to monitor (bytes)"
|
5
5
|
STATE BITS 0
|
6
6
|
STATE BYTE 1
|
7
7
|
STATE WORD 2
|
8
8
|
STATE LONGWORD 3
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
APPEND_PARAMETER "Bit Mask" 32 UINT MIN MAX 0 "Bit Mask to apply to the Data Size before the value is compared ot the Threshold"
|
10
|
+
APPEND_PARAMETER "Persistence" 32 UINT MIN MAX 0 "Number of times the Threshold must be exceeded before Action is triggered"
|
11
|
+
APPEND_PARAMETER "Type" 32 UINT 0 3 0 "How the Threshold is compared against"
|
12
12
|
STATE LESS_THAN 0
|
13
13
|
STATE GREATER_THAN 1
|
14
14
|
STATE EQUAL_TO 2
|
15
15
|
STATE NOT_EQUAL_TO 3
|
16
|
-
|
16
|
+
APPEND_PARAMETER "Action" 32 UINT 0 4 0 "Action to take when Persistance is met"
|
17
17
|
STATE NO_ACTION_REQUIRED 0
|
18
18
|
STATE INITIATE_RESET 1
|
19
19
|
STATE CHANGE_MODE_SAFE 2
|
20
|
-
|
20
|
+
APPEND_PARAMETER "Group" 32 UINT 1 4 1 "Telemetry group this monitor item belongs to. Groups are automatically enabled due to payload events."
|
21
21
|
STATE ALL_MODES 1
|
22
22
|
STATE SAFE_MODE 2
|
23
|
-
|
23
|
+
APPEND_PARAMETER "Signed" 8 UINT 0 2 0 "Whether to treat the Data Size data as signed or unsigned when comparing to the Threshold"
|
24
24
|
STATE NOT_APPLICABLE 0
|
25
25
|
STATE UNSIGNED 1
|
26
26
|
STATE SIGNED 2
|
27
27
|
|
28
|
-
|
29
|
-
DEFAULT 0x0 0 BITS 0x0 0 LESS_THAN NO_ACTION_REQUIRED ALL_MODES UNSIGNED
|
30
|
-
|
28
|
+
#<% 200.times do %>
|
29
|
+
# DEFAULT 0x0 0 BITS 0x0 0 LESS_THAN NO_ACTION_REQUIRED ALL_MODES UNSIGNED
|
30
|
+
#<% end %>
|
31
31
|
|
@@ -13,25 +13,20 @@
|
|
13
13
|
require 'cosmos/tools/cmd_tlm_server/background_task'
|
14
14
|
|
15
15
|
module Cosmos
|
16
|
-
|
17
|
-
# ExampleBackgroundTask class
|
18
|
-
#
|
19
|
-
# This class is an example background task
|
20
|
-
#
|
16
|
+
# Starts by sleeping 5 seconds then sends up to three collect commands
|
21
17
|
class ExampleBackgroundTask < BackgroundTask
|
22
|
-
|
23
18
|
def initialize
|
24
19
|
super()
|
25
20
|
@name = 'Example Background Task'
|
26
|
-
@sleeper = Sleeper.new
|
27
21
|
end
|
28
22
|
|
29
23
|
def call
|
30
24
|
sent_count = 0
|
25
|
+
@sleeper = Sleeper.new
|
31
26
|
@status = "Sleeping for 5 seconds"
|
32
27
|
return if @sleeper.sleep(5) # allow interfaces time to start
|
33
28
|
loop do
|
34
|
-
#
|
29
|
+
# Start up with at least 3 collects
|
35
30
|
if (tlm('INST', 'HEALTH_STATUS', 'COLLECTS') < 3)
|
36
31
|
begin
|
37
32
|
cmd('INST', 'COLLECT', 'TYPE' => 'NORMAL', 'DURATION' => 1)
|
@@ -50,8 +45,7 @@ module Cosmos
|
|
50
45
|
|
51
46
|
def stop
|
52
47
|
@sleeper.cancel
|
48
|
+
@status = "Stopped at #{Time.now.formatted}"
|
53
49
|
end
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end # module Cosmos
|
50
|
+
end
|
51
|
+
end
|
@@ -11,12 +11,14 @@ class ExampleTest < Cosmos::Test
|
|
11
11
|
|
12
12
|
# Setup the test case by doing stuff
|
13
13
|
def setup
|
14
|
+
status_bar("setup")
|
14
15
|
puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
|
15
16
|
wait(2)
|
16
17
|
end
|
17
18
|
|
18
19
|
# test_1 verifies requirement 1
|
19
20
|
def test_case_with_long_name_1
|
21
|
+
status_bar("test_case_with_long_name_1")
|
20
22
|
puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
|
21
23
|
Cosmos::Test.puts "This test verifies requirement 1"
|
22
24
|
wait(2)
|
@@ -24,6 +26,7 @@ class ExampleTest < Cosmos::Test
|
|
24
26
|
|
25
27
|
# test_2 verifies requirement 2
|
26
28
|
def test_2
|
29
|
+
status_bar("test_2")
|
27
30
|
puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
|
28
31
|
Cosmos::Test.puts "This test verifies requirement 2"
|
29
32
|
if $manual
|
@@ -35,12 +38,14 @@ class ExampleTest < Cosmos::Test
|
|
35
38
|
end
|
36
39
|
|
37
40
|
def test_3xx
|
41
|
+
status_bar("test_3xx")
|
38
42
|
puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
|
39
43
|
wait 1
|
40
44
|
end
|
41
45
|
|
42
46
|
# Teardown the test case by doing other stuff
|
43
47
|
def teardown
|
48
|
+
status_bar("teardown")
|
44
49
|
puts "Running #{Cosmos::Test.current_test_suite}:#{Cosmos::Test.current_test}:#{Cosmos::Test.current_test_case}"
|
45
50
|
wait(2)
|
46
51
|
end
|
@@ -9,10 +9,8 @@
|
|
9
9
|
# attribution addendums as found in the LICENSE.txt
|
10
10
|
|
11
11
|
module Cosmos
|
12
|
-
|
13
12
|
# Performs a general conversion via the implementation of the call method
|
14
13
|
class Conversion
|
15
|
-
|
16
14
|
# @return [Symbol] The converted data type. Must be one of
|
17
15
|
# {Cosmos::StructureItem#data_type}
|
18
16
|
attr_reader :converted_type
|
@@ -42,12 +40,10 @@ module Cosmos
|
|
42
40
|
self.class.to_s.split('::')[-1]
|
43
41
|
end
|
44
42
|
|
45
|
-
# @param
|
43
|
+
# @param read_or_write [String] Either 'READ' or 'WRITE'
|
46
44
|
# @return [String] Config fragment for this conversion
|
47
45
|
def to_config(read_or_write)
|
48
46
|
" #{read_or_write}_CONVERSION #{self.class.name.class_name_to_filename}\n"
|
49
47
|
end
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end # module Cosmos
|
48
|
+
end
|
49
|
+
end
|
@@ -32,7 +32,7 @@ class Class
|
|
32
32
|
# MyClass.test # returns "Test"
|
33
33
|
#
|
34
34
|
# @param args [Array<Symbol>] Array of symbols which should be turned into
|
35
|
-
# instance variables with class method
|
35
|
+
# instance variables with class method readers
|
36
36
|
def instance_attr_reader(*args)
|
37
37
|
args.each do |arg|
|
38
38
|
self.class_eval("def #{arg};@#{arg};end")
|
@@ -40,6 +40,8 @@ class Class
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
# @param args [Array<Symbol>] Array of symbols which should be turned into
|
44
|
+
# instance variables with class method accessors (read and write)
|
43
45
|
def instance_attr_accessor(*args)
|
44
46
|
args.each do |arg|
|
45
47
|
self.class_eval("def #{arg};@#{arg};end")
|
data/lib/cosmos/core_ext/file.rb
CHANGED
data/lib/cosmos/core_ext/io.rb
CHANGED
@@ -13,9 +13,23 @@ require 'cosmos/core_ext/cosmos_io'
|
|
13
13
|
class IO
|
14
14
|
include CosmosIO
|
15
15
|
|
16
|
+
# Initial timeout to call IO.select with. Timeouts are increased by doubling
|
17
|
+
# this value until the SELET_MAX_TIMEOUT value is reached.
|
16
18
|
SELECT_BASE_TIMEOUT = 0.0004
|
19
|
+
# The maximum timeout at which point we call IO.select with whatever
|
20
|
+
# remaining timeout is left.
|
17
21
|
SELECT_MAX_TIMEOUT = 0.016
|
18
22
|
|
23
|
+
# The method is identical to IO.select but instead of calling IO.select with
|
24
|
+
# the full timeout, it calls IO.select with a small timeout and then
|
25
|
+
# doubles the timeout twice until eventually it calls IO.select with the
|
26
|
+
# remaining passed in timeout value.
|
27
|
+
# TODO: Ryan why was this originally done?
|
28
|
+
#
|
29
|
+
# @param read_sockets [Array<IO>] IO objects to wait to be ready to read
|
30
|
+
# @param write_sockets [Array<IO>] IO objects to wait to be ready to write
|
31
|
+
# @param error_array [Array<IO>] IO objects to wait for exceptions
|
32
|
+
# @param timeout [Numeric] Number of seconds to wait
|
19
33
|
def self.fast_select(read_sockets = nil, write_sockets = nil, error_array = nil, timeout = nil)
|
20
34
|
# Always try a zero timeout first
|
21
35
|
current_timeout = SELECT_BASE_TIMEOUT
|
@@ -65,10 +79,14 @@ class IO
|
|
65
79
|
end # while true
|
66
80
|
end # fast_select
|
67
81
|
|
82
|
+
# @param read_sockets [Array<IO>] IO objects to wait to be ready to read
|
83
|
+
# @param timeout [Numeric] Number of seconds to wait
|
68
84
|
def self.fast_read_select(read_sockets, timeout)
|
69
85
|
return fast_select(read_sockets, nil, nil, timeout)
|
70
86
|
end
|
71
87
|
|
88
|
+
# @param write_sockets [Array<IO>] IO objects to wait to be ready to write
|
89
|
+
# @param timeout [Numeric] Number of seconds to wait
|
72
90
|
def self.fast_write_select(write_sockets, timeout)
|
73
91
|
return fast_select(nil, write_sockets, nil, timeout)
|
74
92
|
end
|
data/lib/cosmos/core_ext/time.rb
CHANGED
@@ -339,7 +339,7 @@ class Time
|
|
339
339
|
(day + JULIAN_DATE_OF_CCSDS_EPOCH) + ((ms.to_f + (us / 1000.0)) / MSEC_PER_DAY_FLOAT)
|
340
340
|
end
|
341
341
|
|
342
|
-
# @param [Float] julian date
|
342
|
+
# @param jdate [Float] julian date
|
343
343
|
# @return [Array<day, ms, us>] Julian converted to CCSDS
|
344
344
|
def self.julian2ccsds(jdate)
|
345
345
|
day = jdate - JULIAN_DATE_OF_CCSDS_EPOCH
|
@@ -363,8 +363,8 @@ class Time
|
|
363
363
|
(self.ccsds2julian(day, ms, us) - sec_epoch_jd) * SEC_PER_DAY_FLOAT
|
364
364
|
end
|
365
365
|
|
366
|
-
# @param
|
367
|
-
# @param sec_epoch_jd [Float] Epoch
|
366
|
+
# @param sec [Float] Number of seconds to convert
|
367
|
+
# @param sec_epoch_jd [Float] Epoch of seconds value
|
368
368
|
# @return [Array<day, ms, us>] CCSDS date
|
369
369
|
def self.sec2ccsds(sec, sec_epoch_jd = JULIAN_DATE_OF_CCSDS_EPOCH)
|
370
370
|
self.julian2ccsds((sec / SEC_PER_DAY_FLOAT) + sec_epoch_jd)
|
@@ -9,56 +9,77 @@
|
|
9
9
|
# attribution addendums as found in the LICENSE.txt
|
10
10
|
|
11
11
|
module Cosmos
|
12
|
-
|
12
|
+
# Help->About dialog which is part of all COSMOS tools. Displays the license,
|
13
|
+
# software versions, environment variables, and general COSMOS information.
|
14
|
+
# Also provides a backdoor to a PRY dialog to aid in debugging. See
|
15
|
+
# {PryDialog} for more details.
|
13
16
|
class AboutDialog < Qt::Dialog
|
14
|
-
|
15
|
-
ABOUT_COSMOS
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
ABOUT_COSMOS << "Loaded Gems:\n"
|
17
|
+
# About text to display in the dialog
|
18
|
+
ABOUT_COSMOS = "COSMOS application icons are courtesy of http://icons8.com.\n"\
|
19
|
+
"COSMOS application sounds are courtesy of http://www.freesfx.co.uk.\n"\
|
20
|
+
"\n"\
|
21
|
+
"COSMOS utilizes the QtRuby (http://rubyforge.org/projects/korundum) "\
|
22
|
+
"library under the GNU Lesser General Public License. "\
|
23
|
+
"QtRuby is a Ruby extension module that provides an "\
|
24
|
+
"interface to the Qt Gui Toolkit (http://qt-project.org) by Digia "\
|
25
|
+
"under the GNU Lesser General Public License.\n\n"\
|
26
|
+
"Ruby Version: ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} "\
|
27
|
+
"patchlevel #{RUBY_PATCHLEVEL}) [#{RUBY_PLATFORM}]\n"\
|
28
|
+
"Rubygems Version: #{Gem::VERSION}\n"\
|
29
|
+
"Qt Version: #{Qt::qVersion}\n"\
|
30
|
+
"Cosmos::PATH: #{Cosmos::PATH}\n"\
|
31
|
+
"Cosmos::USERPATH: #{Cosmos::USERPATH}\n\n"\
|
32
|
+
"Environment Variables:\n"\
|
33
|
+
"RUBYLIB: #{ENV['RUBYLIB']}\n"\
|
34
|
+
"RUBYOPT: #{ENV['RUBYOPT']}\n"\
|
35
|
+
"GEM_PATH: #{ENV['GEM_PATH']}\n"\
|
36
|
+
"GEM_HOME: #{ENV['GEM_HOME']}\n\n"\
|
37
|
+
"Loaded Gems:\n"
|
36
38
|
Gem.loaded_specs.values.map {|x| ABOUT_COSMOS << "#{x.name} #{x.version} #{x.platform}\n"}
|
37
39
|
|
38
40
|
@@pry_dialogs = []
|
39
41
|
|
40
|
-
|
42
|
+
# @param parent [Qt::Widget] Part of the dialog (the application)
|
43
|
+
# @param about_string [String] Application specific informational text
|
44
|
+
def initialize(parent, about_string)
|
41
45
|
super(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
|
42
46
|
@saved_text = ''
|
43
47
|
setWindowTitle('About')
|
44
48
|
|
45
|
-
# Get Word Icon
|
46
49
|
filename = File.join(::Cosmos::USERPATH, 'config', 'data', 'cosmos_word.gif')
|
47
50
|
filename = File.join(::Cosmos::PATH, 'data', 'cosmos_word.gif') unless File.exist?(filename)
|
48
51
|
word_icon = Qt::Label.new
|
49
52
|
word_icon.setPixmap(Qt::Pixmap.new(filename))
|
50
53
|
|
51
|
-
copyright = Qt::Label.new("Copyright
|
54
|
+
copyright = Qt::Label.new("Copyright 2017 - Ball Aerospace & Technologies Corp.")
|
55
|
+
copyright.setFont(Cosmos.getFont("Arial", 12))
|
52
56
|
authors = Qt::Label.new("Created by Ryan Melton (ryanmelt) and Jason Thomas (jmthomas)")
|
53
|
-
|
54
|
-
|
55
|
-
|
57
|
+
authors.setFont(Cosmos.getFont("Arial", 12))
|
58
|
+
|
59
|
+
cosmos_layout = Qt::GridLayout.new
|
60
|
+
version = Qt::Label.new("Version: " + COSMOS_VERSION)
|
61
|
+
version.setFont(Cosmos.getFont("Arial", 14))
|
62
|
+
open_cosmos_code = Qt::PushButton.new("Open COSMOS Gem Code") do
|
63
|
+
connect(SIGNAL('clicked()')) { Cosmos.open_file_browser(Cosmos::PATH) }
|
64
|
+
end
|
65
|
+
cosmos_layout.addWidget(version, 0, 0)
|
66
|
+
cosmos_layout.addWidget(open_cosmos_code, 0, 1)
|
67
|
+
|
68
|
+
if USER_VERSION && USER_VERSION != 'Unofficial'
|
69
|
+
user_version = Qt::Label.new("Project Version: " + USER_VERSION)
|
70
|
+
user_version.setFont(Cosmos.getFont("Arial", 14))
|
71
|
+
cosmos_layout.addWidget(user_version, 1, 0)
|
72
|
+
end
|
73
|
+
open_user_code = Qt::PushButton.new("Open Project Code") do
|
74
|
+
connect(SIGNAL('clicked()')) { Cosmos.open_file_browser(Cosmos::USERPATH) }
|
75
|
+
end
|
76
|
+
cosmos_layout.addWidget(open_user_code, 1, 1)
|
77
|
+
|
56
78
|
icon_layout = Qt::VBoxLayout.new do
|
57
79
|
addWidget(word_icon)
|
58
80
|
addWidget(copyright)
|
59
81
|
addWidget(authors)
|
60
|
-
|
61
|
-
addWidget(user_ver) if user_ver
|
82
|
+
addLayout(cosmos_layout)
|
62
83
|
addStretch
|
63
84
|
end
|
64
85
|
|
@@ -68,7 +89,9 @@ module Cosmos
|
|
68
89
|
configurable_about_text = File.read(filename)
|
69
90
|
configurable_about_text.gsub!("\r", '') unless Kernel.is_windows?
|
70
91
|
if Kernel.is_windows?
|
71
|
-
configurable_about_text << "\n"
|
92
|
+
configurable_about_text << "\n" \
|
93
|
+
"Main Application x:#{parent.x} y:#{parent.y} width:#{parent.frameGeometry.width + 16} " \
|
94
|
+
"height:#{parent.frameGeometry.height + 38}\n\n" + ABOUT_COSMOS
|
72
95
|
else
|
73
96
|
configurable_about_text << "\n" + "Main Application x:#{parent.x} y:#{parent.y} width:#{parent.frameGeometry.width} height:#{parent.frameGeometry.height}\n\n" + ABOUT_COSMOS end
|
74
97
|
|
@@ -104,11 +127,14 @@ module Cosmos
|
|
104
127
|
end
|
105
128
|
|
106
129
|
setMaximumWidth(800)
|
130
|
+
ok.setFocus
|
107
131
|
self.raise()
|
108
132
|
exec()
|
109
133
|
dispose()
|
110
134
|
end
|
111
135
|
|
136
|
+
# Register key press events to listen for 'p', 'r', 'y' and popup a {PryDialog}
|
137
|
+
# @param event [Qt::Event] The keypress event
|
112
138
|
def keyPressEvent(event)
|
113
139
|
@saved_text << event.text.to_s
|
114
140
|
if @saved_text[0] == 'p'
|
@@ -131,7 +157,5 @@ module Cosmos
|
|
131
157
|
end
|
132
158
|
super(event)
|
133
159
|
end
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
end # module Cosmos
|
160
|
+
end
|
161
|
+
end
|