cosmos 3.6.3 → 3.7.0

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +10 -0
  3. data/data/crc.txt +22 -13
  4. data/demo/config/data/crc.txt +2 -1
  5. data/demo/config/targets/INST/screens/limits.txt +51 -0
  6. data/demo/config/targets/INST/screens/other.txt +0 -5
  7. data/ext/cosmos/ext/array/array.c +6 -6
  8. data/ext/cosmos/ext/buffered_file/buffered_file.c +10 -10
  9. data/ext/cosmos/ext/config_parser/config_parser.c +10 -10
  10. data/ext/cosmos/ext/cosmos_io/cosmos_io.c +3 -3
  11. data/ext/cosmos/ext/crc/crc.c +6 -6
  12. data/ext/cosmos/ext/line_graph/line_graph.c +20 -20
  13. data/ext/cosmos/ext/low_fragmentation_array/low_fragmentation_array.c +4 -4
  14. data/ext/cosmos/ext/packet/packet.c +18 -23
  15. data/ext/cosmos/ext/platform/platform.c +1 -1
  16. data/ext/cosmos/ext/polynomial_conversion/polynomial_conversion.c +1 -1
  17. data/ext/cosmos/ext/structure/structure.c +34 -29
  18. data/ext/cosmos/ext/tabbed_plots_config/tabbed_plots_config.c +1 -1
  19. data/ext/cosmos/ext/telemetry/telemetry.c +33 -33
  20. data/lib/cosmos/gui/line_graph/line_graph.rb +25 -1
  21. data/lib/cosmos/gui/line_graph/line_graph_dialog.rb +2 -2
  22. data/lib/cosmos/gui/line_graph/line_graph_drawing.rb +64 -14
  23. data/lib/cosmos/gui/line_graph/line_graph_popups.rb +2 -1
  24. data/lib/cosmos/gui/line_graph/line_graph_scaling.rb +9 -3
  25. data/lib/cosmos/gui/line_graph/line_graph_script.rb +64 -9
  26. data/lib/cosmos/gui/line_graph/lines.rb +24 -11
  27. data/lib/cosmos/interfaces/udp_interface.rb +8 -3
  28. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +1 -1
  29. data/lib/cosmos/tools/tlm_viewer/widgets.rb +8 -1
  30. data/lib/cosmos/tools/tlm_viewer/widgets/canvasdot_widget.rb +79 -0
  31. data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitscolumn_widget.rb +38 -0
  32. data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangebar_widget.rb +1 -1
  33. data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangecolumn_widget.rb +39 -0
  34. data/lib/cosmos/tools/tlm_viewer/widgets/limits_widget.rb +103 -0
  35. data/lib/cosmos/tools/tlm_viewer/widgets/limitsbar_widget.rb +77 -147
  36. data/lib/cosmos/tools/tlm_viewer/widgets/limitscolor_widget.rb +102 -0
  37. data/lib/cosmos/tools/tlm_viewer/widgets/limitscolumn_widget.rb +108 -0
  38. data/lib/cosmos/tools/tlm_viewer/widgets/rangecolumn_widget.rb +57 -0
  39. data/lib/cosmos/tools/tlm_viewer/widgets/valuelimitscolumn_widget.rb +37 -0
  40. data/lib/cosmos/tools/tlm_viewer/widgets/valuerangecolumn_widget.rb +37 -0
  41. data/lib/cosmos/version.rb +5 -5
  42. data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +33 -4
  43. metadata +12 -2
@@ -0,0 +1,108 @@
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2014 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 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
+ require 'cosmos/tools/tlm_viewer/widgets/limits_widget'
12
+
13
+ module Cosmos
14
+
15
+ class LimitscolumnWidget < LimitsWidget
16
+
17
+ def initialize(parent_layout, target_name, packet_name, item_name, value_type = :CONVERTED, width = 30, height = 100)
18
+ super(parent_layout, target_name, packet_name, item_name, value_type, width, height)
19
+ end
20
+
21
+ def LimitscolumnWidget.takes_value?
22
+ return true
23
+ end
24
+
25
+ def paint_implementation(dc)
26
+ limits = get_limits()
27
+ return unless limits
28
+
29
+ widths = calculate_widths(limits, @bar_height)
30
+
31
+ # Set starting points
32
+ x_pos = @x_pad
33
+ y_pos = @y_pad
34
+
35
+ # Draw RED_LOW bar
36
+ dc.addRectColorFill(x_pos, y_pos, @bar_width, widths.red_low, 'red')
37
+ dc.addRectColor(x_pos, y_pos, @bar_width, widths.red_low)
38
+ y_pos += widths.red_low
39
+
40
+ # Draw YELLOW_LOW bar
41
+ dc.addRectColorFill(x_pos, y_pos, @bar_width, widths.yellow_low, 'yellow')
42
+ dc.addRectColor(x_pos, y_pos, @bar_width, widths.yellow_low)
43
+ y_pos += widths.yellow_low
44
+
45
+ if widths.green_high
46
+ # Draw GREEN_LOW bar
47
+ dc.addRectColorFill(x_pos, y_pos, @bar_width, widths.green_low, 'lime')
48
+ dc.addRectColor(x_pos, y_pos, @bar_width, widths.green_low)
49
+ y_pos += widths.green_low
50
+
51
+ # Draw BLUE bar
52
+ dc.addRectColorFill(x_pos, y_pos, @bar_width, widths.blue, 'dodgerblue')
53
+ dc.addRectColor(x_pos, y_pos, @bar_width, widths.blue)
54
+ y_pos += widths.blue
55
+
56
+ # Draw GREEN_HIGH bar
57
+ dc.addRectColorFill(x_pos, y_pos, @bar_width, widths.green_high, 'lime')
58
+ dc.addRectColor(x_pos, y_pos, @bar_width, widths.green_high)
59
+ y_pos += widths.green_high
60
+ else
61
+ # Draw GREEN bar
62
+ dc.addRectColorFill(x_pos, y_pos, @bar_width, widths.green, 'lime')
63
+ dc.addRectColor(x_pos, y_pos, @bar_width, widths.green)
64
+ y_pos += widths.green
65
+ end
66
+
67
+ # Draw YELLOW_HIGH bar
68
+ dc.addRectColorFill(x_pos, y_pos, @bar_width, widths.yellow_high, 'yellow')
69
+ dc.addRectColor(x_pos, y_pos, @bar_width, widths.yellow_high)
70
+ y_pos += widths.yellow_high
71
+
72
+ # Draw RED_HIGH bar
73
+ dc.addRectColorFill(x_pos, y_pos, @bar_width, widths.red_high, 'red')
74
+ dc.addRectColor(x_pos, y_pos, @bar_width, widths.red_high)
75
+ y_pos += widths.red_high
76
+
77
+ # Draw line at current value
78
+ red_low = limits[0]
79
+ red_high = limits[3]
80
+ @bar_scale = (red_high - red_low) / 0.8
81
+ @low_value = red_low - 0.1 * @bar_scale
82
+ @high_value = red_high + 0.1 * @bar_scale
83
+
84
+ @line_pos = @height - (@y_pad + (@value - @low_value) / @bar_scale * @bar_height).to_i
85
+ if @line_pos < @y_pad
86
+ @line_pos = @y_pad
87
+ end
88
+ if @line_pos > @y_pad + @bar_height
89
+ @line_pos = @bar_height + @y_pad
90
+ end
91
+
92
+ dc.addLineColor(@x_pad - 3, @line_pos, @x_pad + @bar_width + 3, @line_pos)
93
+
94
+ # Draw triangle next to current value line
95
+ top_triangle = Qt::Polygon.new(3)
96
+ top_triangle.setPoint(0, @x_pad + @bar_width, @line_pos)
97
+ top_triangle.setPoint(1, @x_pad + @bar_width + 5, @line_pos + 5)
98
+ top_triangle.setPoint(2, @x_pad + @bar_width + 5, @line_pos - 5)
99
+ dc.setBrush(Cosmos::BLACK)
100
+ dc.drawPolygon(top_triangle)
101
+ top_triangle.dispose
102
+
103
+ # Additional drawing for subclasses
104
+ additional_drawing(dc)
105
+ end
106
+ end
107
+
108
+ end # module Cosmos
@@ -0,0 +1,57 @@
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2014 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 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
+ require 'cosmos/tools/tlm_viewer/widgets/limitscolumn_widget'
12
+
13
+ module Cosmos
14
+
15
+ class RangecolumnWidget < LimitscolumnWidget
16
+
17
+ def initialize(parent_layout, target_name, packet_name, item_name, low_value, high_value, value_type = :CONVERTED, width = 30, height = 100)
18
+ super(parent_layout, target_name, packet_name, item_name, value_type, width, height)
19
+ @low_value = low_value.to_s.convert_to_value
20
+ @high_value = high_value.to_s.convert_to_value
21
+ end
22
+
23
+ def paint_implementation(dc)
24
+ # Fill the rectangle with white
25
+ dc.addRectColorFill(@x_pad, @y_pad, @width - @x_pad - @x_pad, @height - @y_pad - @y_pad, "white")
26
+
27
+ # Draw line at current value
28
+ @bar_scale = @high_value - @low_value
29
+
30
+ @line_pos = @height - (@y_pad + (@value - @low_value) / @bar_scale * @bar_height).to_i
31
+ if @line_pos < @y_pad
32
+ @line_pos = @y_pad
33
+ end
34
+ if @line_pos > @y_pad + @bar_height
35
+ @line_pos = @bar_height + @y_pad
36
+ end
37
+
38
+ dc.addLineColor(@x_pad - 3, @line_pos, @x_pad + @bar_width + 3, @line_pos)
39
+
40
+ # Draw triangle above current value line
41
+ top_triangle = Qt::Polygon.new(3)
42
+ top_triangle.setPoint(0, @x_pad + @bar_width, @line_pos)
43
+ top_triangle.setPoint(1, @x_pad + @bar_width + 5, @line_pos + 5)
44
+ top_triangle.setPoint(2, @x_pad + @bar_width + 5, @line_pos - 5)
45
+ dc.setBrush(Cosmos::BLACK)
46
+ dc.drawPolygon(top_triangle)
47
+
48
+ # Draw overall border
49
+ dc.addRectColor(@x_pad, @y_pad, @width - @x_pad - @x_pad, @height - @y_pad - @y_pad)
50
+
51
+ #Additional drawing for subclasses
52
+ additional_drawing(dc)
53
+ end
54
+
55
+ end
56
+
57
+ end # module Cosmos
@@ -0,0 +1,37 @@
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2014 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 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
+ require 'cosmos/tools/tlm_viewer/widgets/widget'
12
+ require 'cosmos/tools/tlm_viewer/widgets/multi_widget'
13
+ require 'cosmos/tools/tlm_viewer/widgets/value_widget'
14
+ require 'cosmos/tools/tlm_viewer/widgets/limitscolumn_widget'
15
+
16
+ module Cosmos
17
+
18
+ class ValuelimitscolumnWidget < Qt::Widget
19
+ include Widget
20
+ include MultiWidget
21
+
22
+ def initialize (parent_layout, target_name, packet_name, item_name, value_type = :WITH_UNITS, characters = 8)
23
+ super(target_name, packet_name, item_name, value_type)
24
+ setLayout(Qt::VBoxLayout.new())
25
+ layout.setSpacing(1)
26
+ layout.setContentsMargins(0,0,0,0)
27
+ @widgets << LimitscolumnWidget.new(layout, target_name, packet_name, item_name, value_type)
28
+ @widgets << ValueWidget.new(layout, target_name, packet_name, item_name, value_type, characters)
29
+ parent_layout.addWidget(self) if parent_layout
30
+ end
31
+
32
+ def self.takes_value?
33
+ return true
34
+ end
35
+ end
36
+
37
+ end # module Cosmos
@@ -0,0 +1,37 @@
1
+ # encoding: ascii-8bit
2
+
3
+ # Copyright 2014 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 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
+ require 'cosmos/tools/tlm_viewer/widgets/widget'
12
+ require 'cosmos/tools/tlm_viewer/widgets/multi_widget'
13
+ require 'cosmos/tools/tlm_viewer/widgets/value_widget'
14
+ require 'cosmos/tools/tlm_viewer/widgets/rangecolumn_widget'
15
+
16
+ module Cosmos
17
+
18
+ class ValuerangecolumnWidget < Qt::Widget
19
+ include Widget
20
+ include MultiWidget
21
+
22
+ def initialize(parent_layout, target_name, packet_name, item_name, low_value, high_value, value_type = :WITH_UNITS, characters = 8, width = 30, height = 100)
23
+ super(target_name, packet_name, item_name, value_type)
24
+ setLayout(Qt::VBoxLayout.new())
25
+ layout.setSpacing(1)
26
+ layout.setContentsMargins(0,0,0,0)
27
+ @widgets << RangecolumnWidget.new(layout, target_name, packet_name, item_name, low_value, high_value, value_type, width, height)
28
+ @widgets << ValueWidget.new(layout, target_name, packet_name, item_name, value_type, characters)
29
+ parent_layout.addWidget(self) if parent_layout
30
+ end
31
+
32
+ def self.takes_value?
33
+ return true
34
+ end
35
+ end
36
+
37
+ end # module Cosmos
@@ -1,12 +1,12 @@
1
1
  # encoding: ascii-8bit
2
2
 
3
- COSMOS_VERSION = '3.6.3'
3
+ COSMOS_VERSION = '3.7.0'
4
4
  module Cosmos
5
5
  module Version
6
6
  MAJOR = '3'
7
- MINOR = '6'
8
- PATCH = '3'
9
- BUILD = '94a14746a45a58b2382cb17b0984f2ec5fd265af'
7
+ MINOR = '7'
8
+ PATCH = '0'
9
+ BUILD = '1f6609f99bf4bd222f5e90ba10462a28c6594166'
10
10
  end
11
- VERSION = '3.6.3'
11
+ VERSION = '3.7.0'
12
12
  end
@@ -444,15 +444,44 @@ module Cosmos
444
444
 
445
445
  context "with BACKGROUND_TASK" do
446
446
  it "creates a background task" do
447
+ background_task_no_args_file = File.join(Cosmos::USERPATH,'lib','cts_config_test_background_task_no_args.rb')
448
+ File.open(background_task_no_args_file,'w') do |file|
449
+ file.puts "require 'cosmos'"
450
+ file.puts "require 'cosmos/tools/cmd_tlm_server/background_task'"
451
+ file.puts "module Cosmos"
452
+ file.puts " class CtsConfigTestBackgroundTaskNoArgs < BackgroundTask"
453
+ file.puts " def initialize()"
454
+ file.puts " super()"
455
+ file.puts " end"
456
+ file.puts " end"
457
+ file.puts "end"
458
+ end
459
+
460
+ background_task_args_file = File.join(Cosmos::USERPATH,'lib','cts_config_test_background_task_args.rb')
461
+ File.open(background_task_args_file,'w') do |file|
462
+ file.puts "require 'cosmos'"
463
+ file.puts "require 'cosmos/tools/cmd_tlm_server/background_task'"
464
+ file.puts "module Cosmos"
465
+ file.puts " class CtsConfigTestBackgroundTaskArgs < BackgroundTask"
466
+ file.puts " def initialize(param1, param2, param3)"
467
+ file.puts " super()"
468
+ file.puts " end"
469
+ file.puts " end"
470
+ file.puts "end"
471
+ end
472
+
447
473
  tf = Tempfile.new('unittest')
448
- tf.puts 'BACKGROUND_TASK cts_config_test_interface.rb'
449
- tf.puts 'BACKGROUND_TASK cts_config_test_interface.rb false'
474
+ tf.puts 'BACKGROUND_TASK cts_config_test_background_task_no_args.rb'
475
+ tf.puts 'BACKGROUND_TASK cts_config_test_background_task_args.rb 1 2 3'
450
476
  tf.close
451
477
  config = CmdTlmServerConfig.new(tf.path)
452
478
  expect(config.background_tasks.length).to eql 2
453
- expect(config.background_tasks[0]).to be_a CtsConfigTestInterface
454
- expect(config.background_tasks[1]).to be_a CtsConfigTestInterface
479
+ expect(config.background_tasks[0]).to be_a CtsConfigTestBackgroundTaskNoArgs
480
+ expect(config.background_tasks[1]).to be_a CtsConfigTestBackgroundTaskArgs
455
481
  tf.unlink
482
+
483
+ File.delete background_task_no_args_file
484
+ File.delete background_task_args_file
456
485
  end
457
486
  end
458
487
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cosmos
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.3
4
+ version: 3.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Melton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-30 00:00:00.000000000 Z
12
+ date: 2015-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -759,6 +759,7 @@ files:
759
759
  - demo/config/targets/INST/screens/ground.txt
760
760
  - demo/config/targets/INST/screens/hs.txt
761
761
  - demo/config/targets/INST/screens/latest.txt
762
+ - demo/config/targets/INST/screens/limits.txt
762
763
  - demo/config/targets/INST/screens/other.txt
763
764
  - demo/config/targets/INST/screens/tabs.txt
764
765
  - demo/config/targets/INST/target.txt
@@ -1432,6 +1433,7 @@ files:
1432
1433
  - lib/cosmos/tools/tlm_viewer/widgets/block_widget.rb
1433
1434
  - lib/cosmos/tools/tlm_viewer/widgets/button_widget.rb
1434
1435
  - lib/cosmos/tools/tlm_viewer/widgets/canvas_widget.rb
1436
+ - lib/cosmos/tools/tlm_viewer/widgets/canvasdot_widget.rb
1435
1437
  - lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb
1436
1438
  - lib/cosmos/tools/tlm_viewer/widgets/canvasimagevalue_widget.rb
1437
1439
  - lib/cosmos/tools/tlm_viewer/widgets/canvaslabel_widget.rb
@@ -1453,15 +1455,21 @@ files:
1453
1455
  - lib/cosmos/tools/tlm_viewer/widgets/labelvalue_widget.rb
1454
1456
  - lib/cosmos/tools/tlm_viewer/widgets/labelvaluedesc_widget.rb
1455
1457
  - lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitsbar_widget.rb
1458
+ - lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitscolumn_widget.rb
1456
1459
  - lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangebar_widget.rb
1460
+ - lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangecolumn_widget.rb
1457
1461
  - lib/cosmos/tools/tlm_viewer/widgets/layout_widget.rb
1462
+ - lib/cosmos/tools/tlm_viewer/widgets/limits_widget.rb
1458
1463
  - lib/cosmos/tools/tlm_viewer/widgets/limitsbar_widget.rb
1464
+ - lib/cosmos/tools/tlm_viewer/widgets/limitscolor_widget.rb
1465
+ - lib/cosmos/tools/tlm_viewer/widgets/limitscolumn_widget.rb
1459
1466
  - lib/cosmos/tools/tlm_viewer/widgets/linegraph_widget.rb
1460
1467
  - lib/cosmos/tools/tlm_viewer/widgets/matrixbycolumns_widget.rb
1461
1468
  - lib/cosmos/tools/tlm_viewer/widgets/multi_widget.rb
1462
1469
  - lib/cosmos/tools/tlm_viewer/widgets/progressbar_widget.rb
1463
1470
  - lib/cosmos/tools/tlm_viewer/widgets/radiobutton_widget.rb
1464
1471
  - lib/cosmos/tools/tlm_viewer/widgets/rangebar_widget.rb
1472
+ - lib/cosmos/tools/tlm_viewer/widgets/rangecolumn_widget.rb
1465
1473
  - lib/cosmos/tools/tlm_viewer/widgets/screenshotbutton_widget.rb
1466
1474
  - lib/cosmos/tools/tlm_viewer/widgets/scrollwindow_widget.rb
1467
1475
  - lib/cosmos/tools/tlm_viewer/widgets/sectionheader_widget.rb
@@ -1475,7 +1483,9 @@ files:
1475
1483
  - lib/cosmos/tools/tlm_viewer/widgets/trendlimitsbar_widget.rb
1476
1484
  - lib/cosmos/tools/tlm_viewer/widgets/value_widget.rb
1477
1485
  - lib/cosmos/tools/tlm_viewer/widgets/valuelimitsbar_widget.rb
1486
+ - lib/cosmos/tools/tlm_viewer/widgets/valuelimitscolumn_widget.rb
1478
1487
  - lib/cosmos/tools/tlm_viewer/widgets/valuerangebar_widget.rb
1488
+ - lib/cosmos/tools/tlm_viewer/widgets/valuerangecolumn_widget.rb
1479
1489
  - lib/cosmos/tools/tlm_viewer/widgets/vertical_widget.rb
1480
1490
  - lib/cosmos/tools/tlm_viewer/widgets/verticalbox_widget.rb
1481
1491
  - lib/cosmos/tools/tlm_viewer/widgets/widget.rb