cosmos 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +16 -3
  3. data/autohotkey/tools/ConfigEditor +16 -0
  4. data/autohotkey/tools/packet_viewer.ahk +2 -1
  5. data/autohotkey/tools/tlm_viewer.ahk +2 -0
  6. data/autohotkey/tools/tool_launch.rb +38 -0
  7. data/data/COSMOS_Architecture.png +0 -0
  8. data/data/config/system.yaml +79 -2
  9. data/data/crc.txt +29 -28
  10. data/demo/Gemfile +1 -1
  11. data/demo/config/data/crc.txt +7 -2
  12. data/demo/config/targets/SYSTEM/cmd_tlm/meta_tlm.txt +10 -0
  13. data/demo/config/tools/cmd_tlm_server/cmd_tlm_server.txt +1 -1
  14. data/demo/tools/mac/ConfigEditor.app/Contents/Info.plist +38 -0
  15. data/demo/tools/mac/ConfigEditor.app/Contents/MacOS/ConfigEditor.rb +16 -0
  16. data/demo/tools/mac/ConfigEditor.app/Contents/MacOS/main.sh +10 -0
  17. data/demo/tools/mac/ConfigEditor.app/Contents/MacOS/tool_launch.rb +38 -0
  18. data/demo/tools/mac/ConfigEditor.app/Contents/Resources/appIcon.icns +0 -0
  19. data/install/Gemfile +1 -1
  20. data/install/config/data/crc.txt +6 -1
  21. data/install/config/targets/SYSTEM/cmd_tlm/meta_tlm.txt +9 -0
  22. data/install/tools/mac/ConfigEditor.app/Contents/Info.plist +38 -0
  23. data/install/tools/mac/ConfigEditor.app/Contents/MacOS/ConfigEditor.rb +16 -0
  24. data/install/tools/mac/ConfigEditor.app/Contents/MacOS/main.sh +10 -0
  25. data/install/tools/mac/ConfigEditor.app/Contents/MacOS/tool_launch.rb +38 -0
  26. data/install/tools/mac/ConfigEditor.app/Contents/Resources/appIcon.icns +0 -0
  27. data/lib/cosmos/gui/dialogs/set_tlm_dialog.rb +3 -0
  28. data/lib/cosmos/gui/dialogs/tlm_graph_dialog.rb +7 -13
  29. data/lib/cosmos/interfaces/interface.rb +1 -1
  30. data/lib/cosmos/packets/commands.rb +5 -0
  31. data/lib/cosmos/packets/packet.rb +8 -0
  32. data/lib/cosmos/packets/packet_item.rb +9 -0
  33. data/lib/cosmos/script/api_shared.rb +1 -29
  34. data/lib/cosmos/script/scripting.rb +2 -4
  35. data/lib/cosmos/script/telemetry.rb +38 -22
  36. data/lib/cosmos/system/system.rb +51 -53
  37. data/lib/cosmos/tools/cmd_tlm_server/api.rb +27 -4
  38. data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +1 -7
  39. data/lib/cosmos/tools/config_editor/config_editor.rb +9 -1
  40. data/lib/cosmos/tools/config_editor/config_editor_frame.rb +16 -1
  41. data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +1 -9
  42. data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +1 -1
  43. data/lib/cosmos/tools/tlm_viewer/widgets/canvas_clickable.rb +33 -0
  44. data/lib/cosmos/tools/tlm_viewer/widgets/canvas_widget.rb +14 -6
  45. data/lib/cosmos/tools/tlm_viewer/widgets/canvasdot_widget.rb +15 -17
  46. data/lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb +5 -3
  47. data/lib/cosmos/tools/tlm_viewer/widgets/canvasimagevalue_widget.rb +17 -15
  48. data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabel_widget.rb +13 -6
  49. data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabelvalue_widget.rb +5 -7
  50. data/lib/cosmos/tools/tlm_viewer/widgets/canvasline_widget.rb +2 -4
  51. data/lib/cosmos/tools/tlm_viewer/widgets/canvaslinevalue_widget.rb +8 -11
  52. data/lib/cosmos/tools/tlm_viewer/widgets/canvasvalue_widget.rb +2 -4
  53. data/lib/cosmos/top_level.rb +14 -0
  54. data/lib/cosmos/utilities/ruby_lex_utils.rb +1 -1
  55. data/lib/cosmos/version.rb +4 -4
  56. data/spec/install/config/targets/INST/cmd_tlm/inst_tlm.txt +3 -3
  57. data/spec/install/config/targets/SYSTEM/cmd_tlm/meta_tlm.txt +10 -0
  58. data/spec/packets/commands_spec.rb +10 -0
  59. data/spec/packets/packet_spec.rb +62 -0
  60. data/spec/script/telemetry_spec.rb +8 -6
  61. data/spec/system/system_spec.rb +192 -0
  62. data/spec/system/target_spec.rb +6 -5
  63. metadata +18 -5
  64. data/demo/config/targets/SYSTEM/cmd_tlm/meta_cmd_tlm.txt +0 -16
  65. data/install/config/targets/SYSTEM/cmd_tlm/meta_cmd_tlm.txt +0 -14
  66. data/spec/install/config/targets/SYSTEM/cmd_tlm/meta_cmd_tlm.txt +0 -16
@@ -2,7 +2,7 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- gem 'ruby-termios', '~> 0.9' if RbConfig::CONFIG['target_os'] !~ /mswin|mingw|cygwin/i
5
+ gem 'ruby-termios', '~> 0.9' if RbConfig::CONFIG['target_os'] !~ /mswin|mingw|cygwin/i and RUBY_ENGINE=='ruby'
6
6
  if ENV['COSMOS_DEVEL']
7
7
  gem 'cosmos', :path => ENV['COSMOS_DEVEL']
8
8
  else
@@ -8,7 +8,7 @@
8
8
  "config/targets/SYSTEM/cmd_tlm/system_cmds.txt" 0xD1F6BA0F
9
9
  "config/targets/SYSTEM/cmd_tlm/override.txt" 0x8FE016FF
10
10
  "config/targets/SYSTEM/cmd_tlm/system_tlm.txt" 0xC44F7A0C
11
- "config/targets/SYSTEM/cmd_tlm/meta_cmd_tlm.txt" 0xE876EADC
11
+ "config/targets/SYSTEM/cmd_tlm/meta_tlm.txt" 0x1637F68F
12
12
  "config/targets/SYSTEM/cmd_tlm/limits_groups.txt" 0x64426D51
13
13
  "config/targets/SYSTEM/lib/limits_groups.rb" 0xB2D5A8DA
14
14
  "config/targets/TEMPLATED/target.txt" 0x4A59ED64
@@ -99,7 +99,7 @@
99
99
  "config/tools/tlm_extractor/_adcs_time.txt" 0x3DAD5094
100
100
  "config/tools/tlm_extractor/tlm_extractor2.txt" 0x5C780BD2
101
101
  "config/tools/cmd_tlm_server/cmd_tlm_server2.txt" 0xC5AC2AE0
102
- "config/tools/cmd_tlm_server/cmd_tlm_server.txt" 0x9347D9D9
102
+ "config/tools/cmd_tlm_server/cmd_tlm_server.txt" 0xA15F85F6
103
103
  "config/tools/tlm_grapher/README.txt" 0x93B2C07E
104
104
  "config/tools/opengl_builder/README.txt" 0x93B2C07E
105
105
  "config/tools/limits_monitor/README.txt" 0x93B2C07E
@@ -217,6 +217,11 @@
217
217
  "tools/mac/Launcher.app/Contents/MacOS/tool_launch.rb" 0x0BDB6696
218
218
  "tools/mac/Launcher.app/Contents/MacOS/main.sh" 0x0B32DAE8
219
219
  "tools/mac/Launcher.app/Contents/MacOS/Launcher.rb" 0xFD4E356C
220
+ "tools/mac/ConfigEditor.app/Contents/Info.plist" 0x5E9C6081
221
+ "tools/mac/ConfigEditor.app/Contents/Resources/appIcon.icns" 0xD9774799
222
+ "tools/mac/ConfigEditor.app/Contents/MacOS/tool_launch.rb" 0x0BDB6696
223
+ "tools/mac/ConfigEditor.app/Contents/MacOS/main.sh" 0x7C087C20
224
+ "tools/mac/ConfigEditor.app/Contents/MacOS/ConfigEditor.rb" 0xD1205371
220
225
  "tools/mac/TlmGrapher.app/Contents/Info.plist" 0x3623B978
221
226
  "tools/mac/TlmGrapher.app/Contents/Resources/appIcon.icns" 0xCA324F50
222
227
  "tools/mac/TlmGrapher.app/Contents/MacOS/tool_launch.rb" 0x0BDB6696
@@ -0,0 +1,10 @@
1
+ TELEMETRY SYSTEM META BIG_ENDIAN "System Meta Data Telemetry Packet"
2
+ APPEND_ID_ITEM PKTID 8 UINT 1 "Packet Id"
3
+ APPEND_ITEM CONFIG 256 STRING "Configuration Name"
4
+ APPEND_ITEM COSMOS_VERSION 240 STRING "COSMOS Version"
5
+ META READ_ONLY
6
+ APPEND_ITEM USER_VERSION 240 STRING "User Project Version"
7
+ META READ_ONLY
8
+ APPEND_ITEM RUBY_VERSION 240 STRING "Ruby Version"
9
+ META READ_ONLY
10
+ APPEND_ITEM OPERATOR_NAME 512 STRING "Operator Name"
@@ -46,4 +46,4 @@ BACKGROUND_TASK example_background_task.rb
46
46
  STOPPED
47
47
  BACKGROUND_TASK limits_groups.rb 5 # Initial delay to allow interfaces to connect
48
48
 
49
- #COLLECT_METADATA
49
+ COLLECT_METADATA
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>English</string>
7
+ <key>CFBundleDisplayName</key>
8
+ <string>ConfigEditor</string>
9
+ <key>CFBundleExecutable</key>
10
+ <string>main.sh</string>
11
+ <key>CFBundleIconFile</key>
12
+ <string>appIcon.icns</string>
13
+ <key>CFBundleIdentifier</key>
14
+ <string>com.ballaerospace.cosmos.ConfigEditor</string>
15
+ <key>CFBundleInfoDictionaryVersion</key>
16
+ <string>6.0</string>
17
+ <key>CFBundleName</key>
18
+ <string>ConfigEditor</string>
19
+ <key>CFBundlePackageType</key>
20
+ <string>APPL</string>
21
+ <key>CFBundleShortVersionString</key>
22
+ <string>2.0</string>
23
+ <key>CFBundleVersion</key>
24
+ <string>2.0</string>
25
+ <key>LSMinimumSystemVersion</key>
26
+ <string>10.5.0</string>
27
+ <key>NSHumanReadableCopyright</key>
28
+ <string>© 2017 Ball Aerospace</string>
29
+ <key>NSMainNibFile</key>
30
+ <string>MainMenu</string>
31
+ <key>NSPrincipalClass</key>
32
+ <string>NSApplication</string>
33
+ <key>NSAppSleepDisabled</key>
34
+ <true/>
35
+ <key>LSAppNapIsDisabled</key>
36
+ <true/>
37
+ </dict>
38
+ </plist>
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: ascii-8bit
3
+
4
+ # Copyright 2015 Ball Aerospace & Technologies Corp.
5
+ # All Rights Reserved.
6
+ #
7
+ # This program is free software; you can modify and/or redistribute it
8
+ # under the terms of the GNU General Public License
9
+ # as published by the Free Software Foundation; version 3 with
10
+ # attribution addendums as found in the LICENSE.txt
11
+
12
+ require_relative 'tool_launch'
13
+ tool_launch do
14
+ require 'cosmos/tools/config_editor/config_editor'
15
+ Cosmos::ConfigEditor.run
16
+ end
@@ -0,0 +1,10 @@
1
+ #!/bin/bash -l
2
+ TOOLNAME=ConfigEditor
3
+ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4
+ rm $DIR/$TOOLNAME
5
+ if hash rbenv 2>/dev/null; then
6
+ ln -s `rbenv which ruby` $DIR/$TOOLNAME
7
+ else
8
+ ln -s `which ruby` $DIR/$TOOLNAME
9
+ fi
10
+ exec $DIR/$TOOLNAME $DIR/$TOOLNAME.rb "$@" &
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: ascii-8bit
3
+
4
+ # Copyright 2015 Ball Aerospace & Technologies Corp.
5
+ # All Rights Reserved.
6
+ #
7
+ # This program is free software; you can modify and/or redistribute it
8
+ # under the terms of the GNU General Public License
9
+ # as published by the Free Software Foundation; version 3 with
10
+ # attribution addendums as found in the LICENSE.txt
11
+
12
+ def tool_launch
13
+ begin
14
+ require 'bundler/setup'
15
+ require 'cosmos'
16
+ yield
17
+ rescue Exception => error
18
+ popup_error = error; popup_error = $cosmos_fatal_exception if defined? $cosmos_fatal_exception
19
+ begin
20
+ raise error if STDIN.isatty # Have a console
21
+ raise error unless defined? $cosmos_fatal_exception or (error.class != SystemExit and error.class != Interrupt)
22
+ case RUBY_PLATFORM
23
+ when /mingw32/
24
+ require 'fiddle'
25
+ Fiddle::Function.new(Fiddle.dlopen('user32')['MessageBox'], [Fiddle::TYPE_LONG, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_LONG], Fiddle::TYPE_LONG).call(0, "#{popup_error.class}:#{popup_error.message}\n\n#{popup_error.backtrace.join("\n")}\n\nNote: Ctrl-C will copy this information to the clipboard.", "Error Starting COSMOS Tool", 0x50030)
26
+ when /darwin/
27
+ system("osascript -e 'display notification \"#{popup_error.class}:#{popup_error.message}:#{popup_error.backtrace[0].tr("'\"`<>", '')}\" with title \"Error Starting COSMOS Tool\"'")
28
+ else
29
+ message = "#{popup_error.class}:#{popup_error.message}\\n\\n#{popup_error.backtrace.join("\\n").tr("'\"`<>", '')}"
30
+ command = "zenity --info --text=\"#{message}\" --title=\"Error Starting COSMOS Tool\""
31
+ success = system(command)
32
+ system("notify-send \"Error Starting COSMOS Tool\" \"#{message}\"") unless success
33
+ end
34
+ ensure
35
+ raise error
36
+ end
37
+ end
38
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- gem 'ruby-termios', '~> 0.9' if RbConfig::CONFIG['target_os'] !~ /mswin|mingw|cygwin/i
5
+ gem 'ruby-termios', '~> 0.9' if RbConfig::CONFIG['target_os'] !~ /mswin|mingw|cygwin/i and RUBY_ENGINE=='ruby'
6
6
  if ENV['COSMOS_DEVEL']
7
7
  gem 'cosmos', :path => ENV['COSMOS_DEVEL']
8
8
  else
@@ -1,6 +1,6 @@
1
1
  "lib/user_version.rb" 0x8F282EE9
2
2
  "config/targets/SYSTEM/target.txt" 0x07E82776
3
- "config/targets/SYSTEM/cmd_tlm/meta_cmd_tlm.txt" 0x84E416C1
3
+ "config/targets/SYSTEM/cmd_tlm/meta_tlm.txt" 0x07CDABCB
4
4
  "config/data/README.txt" 0x93B2C07E
5
5
  "config/system/system.txt" 0x6CB79668
6
6
  "config/tools/launcher/launcher.txt" 0x2F6ABBDB
@@ -126,6 +126,11 @@
126
126
  "tools/mac/Launcher.app/Contents/MacOS/tool_launch.rb" 0x0BDB6696
127
127
  "tools/mac/Launcher.app/Contents/MacOS/main.sh" 0x0B32DAE8
128
128
  "tools/mac/Launcher.app/Contents/MacOS/Launcher.rb" 0xFD4E356C
129
+ "tools/mac/ConfigEditor.app/Contents/Info.plist" 0x5E9C6081
130
+ "tools/mac/ConfigEditor.app/Contents/Resources/appIcon.icns" 0xD9774799
131
+ "tools/mac/ConfigEditor.app/Contents/MacOS/tool_launch.rb" 0x0BDB6696
132
+ "tools/mac/ConfigEditor.app/Contents/MacOS/main.sh" 0x7C087C20
133
+ "tools/mac/ConfigEditor.app/Contents/MacOS/ConfigEditor.rb" 0xD1205371
129
134
  "tools/mac/TlmGrapher.app/Contents/Info.plist" 0x3623B978
130
135
  "tools/mac/TlmGrapher.app/Contents/Resources/appIcon.icns" 0xCA324F50
131
136
  "tools/mac/TlmGrapher.app/Contents/MacOS/tool_launch.rb" 0x0BDB6696
@@ -0,0 +1,9 @@
1
+ TELEMETRY SYSTEM META BIG_ENDIAN "System Meta Data Telemetry Packet"
2
+ APPEND_ID_ITEM PKTID 8 UINT 1 "Packet Id"
3
+ APPEND_ITEM CONFIG 256 STRING "Configuration Name"
4
+ APPEND_ITEM COSMOS_VERSION 240 STRING "COSMOS Version"
5
+ META READ_ONLY
6
+ APPEND_ITEM USER_VERSION 240 STRING "User Project Version"
7
+ META READ_ONLY
8
+ APPEND_ITEM RUBY_VERSION 240 STRING "Ruby Version"
9
+ META READ_ONLY
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>English</string>
7
+ <key>CFBundleDisplayName</key>
8
+ <string>ConfigEditor</string>
9
+ <key>CFBundleExecutable</key>
10
+ <string>main.sh</string>
11
+ <key>CFBundleIconFile</key>
12
+ <string>appIcon.icns</string>
13
+ <key>CFBundleIdentifier</key>
14
+ <string>com.ballaerospace.cosmos.ConfigEditor</string>
15
+ <key>CFBundleInfoDictionaryVersion</key>
16
+ <string>6.0</string>
17
+ <key>CFBundleName</key>
18
+ <string>ConfigEditor</string>
19
+ <key>CFBundlePackageType</key>
20
+ <string>APPL</string>
21
+ <key>CFBundleShortVersionString</key>
22
+ <string>2.0</string>
23
+ <key>CFBundleVersion</key>
24
+ <string>2.0</string>
25
+ <key>LSMinimumSystemVersion</key>
26
+ <string>10.5.0</string>
27
+ <key>NSHumanReadableCopyright</key>
28
+ <string>© 2017 Ball Aerospace</string>
29
+ <key>NSMainNibFile</key>
30
+ <string>MainMenu</string>
31
+ <key>NSPrincipalClass</key>
32
+ <string>NSApplication</string>
33
+ <key>NSAppSleepDisabled</key>
34
+ <true/>
35
+ <key>LSAppNapIsDisabled</key>
36
+ <true/>
37
+ </dict>
38
+ </plist>
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: ascii-8bit
3
+
4
+ # Copyright 2015 Ball Aerospace & Technologies Corp.
5
+ # All Rights Reserved.
6
+ #
7
+ # This program is free software; you can modify and/or redistribute it
8
+ # under the terms of the GNU General Public License
9
+ # as published by the Free Software Foundation; version 3 with
10
+ # attribution addendums as found in the LICENSE.txt
11
+
12
+ require_relative 'tool_launch'
13
+ tool_launch do
14
+ require 'cosmos/tools/config_editor/config_editor'
15
+ Cosmos::ConfigEditor.run
16
+ end
@@ -0,0 +1,10 @@
1
+ #!/bin/bash -l
2
+ TOOLNAME=ConfigEditor
3
+ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4
+ rm $DIR/$TOOLNAME
5
+ if hash rbenv 2>/dev/null; then
6
+ ln -s `rbenv which ruby` $DIR/$TOOLNAME
7
+ else
8
+ ln -s `which ruby` $DIR/$TOOLNAME
9
+ fi
10
+ exec $DIR/$TOOLNAME $DIR/$TOOLNAME.rb "$@" &
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: ascii-8bit
3
+
4
+ # Copyright 2015 Ball Aerospace & Technologies Corp.
5
+ # All Rights Reserved.
6
+ #
7
+ # This program is free software; you can modify and/or redistribute it
8
+ # under the terms of the GNU General Public License
9
+ # as published by the Free Software Foundation; version 3 with
10
+ # attribution addendums as found in the LICENSE.txt
11
+
12
+ def tool_launch
13
+ begin
14
+ require 'bundler/setup'
15
+ require 'cosmos'
16
+ yield
17
+ rescue Exception => error
18
+ popup_error = error; popup_error = $cosmos_fatal_exception if defined? $cosmos_fatal_exception
19
+ begin
20
+ raise error if STDIN.isatty # Have a console
21
+ raise error unless defined? $cosmos_fatal_exception or (error.class != SystemExit and error.class != Interrupt)
22
+ case RUBY_PLATFORM
23
+ when /mingw32/
24
+ require 'fiddle'
25
+ Fiddle::Function.new(Fiddle.dlopen('user32')['MessageBox'], [Fiddle::TYPE_LONG, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_LONG], Fiddle::TYPE_LONG).call(0, "#{popup_error.class}:#{popup_error.message}\n\n#{popup_error.backtrace.join("\n")}\n\nNote: Ctrl-C will copy this information to the clipboard.", "Error Starting COSMOS Tool", 0x50030)
26
+ when /darwin/
27
+ system("osascript -e 'display notification \"#{popup_error.class}:#{popup_error.message}:#{popup_error.backtrace[0].tr("'\"`<>", '')}\" with title \"Error Starting COSMOS Tool\"'")
28
+ else
29
+ message = "#{popup_error.class}:#{popup_error.message}\\n\\n#{popup_error.backtrace.join("\\n").tr("'\"`<>", '')}"
30
+ command = "zenity --info --text=\"#{message}\" --title=\"Error Starting COSMOS Tool\""
31
+ success = system(command)
32
+ system("notify-send \"Error Starting COSMOS Tool\" \"#{message}\"") unless success
33
+ end
34
+ ensure
35
+ raise error
36
+ end
37
+ end
38
+ end
@@ -92,6 +92,9 @@ module Cosmos
92
92
  @editors << Qt::LineEdit.new
93
93
  @editors[-1].text = item_value.to_s
94
94
  end
95
+ if item.meta.keys && item.meta.keys.include?("READ_ONLY")
96
+ @editors[-1].setEnabled(false)
97
+ end
95
98
  values_layout.addRow(item_name, @editors[-1])
96
99
  if (@editors.length % 10 == 0) && (@items.length > @editors.length)
97
100
  values_layout = Qt::FormLayout.new
@@ -9,7 +9,7 @@
9
9
  # attribution addendums as found in the LICENSE.txt
10
10
 
11
11
  # This file contains the implementation and TlmGraphDialog class. This class
12
- # is used to open a telemetry grapher to graph a telemetry item, typically on
12
+ # is used to open a telemetry grapher to graph a telemetry item, typically on
13
13
  # a right click.
14
14
 
15
15
  require 'cosmos'
@@ -19,7 +19,7 @@ require 'cosmos/script'
19
19
 
20
20
  module Cosmos
21
21
  # Dialog which allows the user to start graphing the given item. If the
22
- # item is a fixed-size array, this allows the user to determine whether to
22
+ # item is a fixed-size array, this allows the user to determine whether to
23
23
  # graph a single index within the array or all indices within the array.
24
24
  # If the item is a variable-sized array, this allows the user to select a
25
25
  # single index to graph.
@@ -41,7 +41,7 @@ module Cosmos
41
41
  num_array_elements = -1
42
42
  end
43
43
  end
44
-
44
+
45
45
  item_string = ""
46
46
 
47
47
  if num_array_elements != 0
@@ -49,13 +49,13 @@ module Cosmos
49
49
  dialog.setWindowTitle("Select array index")
50
50
  dialog_layout = Qt::VBoxLayout.new
51
51
  dialog_layout.addWidget(Qt::Label.new("#{target_name} #{packet_name} #{item_name} is an array."))
52
-
52
+
53
53
  if num_array_elements > 0
54
54
  dialog_layout.addWidget(Qt::Label.new("Select array index to graph or graph all:"))
55
55
  index_chooser = IntegerChooser.new(parent, 'Array Index:', 0, 0, num_array_elements-1)
56
56
  else
57
57
  dialog_layout.addWidget(Qt::Label.new("Select array index to graph:"))
58
- index_chooser = IntegerChooser.new(parent, 'Array Index:', 0, 0)
58
+ index_chooser = IntegerChooser.new(parent, 'Array Index:', 0, 0)
59
59
  end
60
60
  dialog_layout.addWidget(index_chooser)
61
61
 
@@ -99,15 +99,9 @@ module Cosmos
99
99
  item_string << "-i \"#{target_name} #{packet_name} #{item_name}\" "
100
100
  end
101
101
 
102
- # Start grapher if necessary.
102
+ # Start grapher if necessary
103
103
  if !item_string.empty?
104
- if Kernel.is_windows?
105
- Cosmos.run_process("rubyw tools/TlmGrapher #{item_string} --system #{File.basename(System.initial_filename)}")
106
- elsif Kernel.is_mac? and File.exist?("tools/mac/TlmGrapher.app")
107
- Cosmos.run_process("open tools/mac/TlmGrapher.app --args #{item_string} --system #{File.basename(System.initial_filename)}")
108
- else
109
- Cosmos.run_process("ruby tools/TlmGrapher #{item_string} --system #{File.basename(System.initial_filename)}")
110
- end
104
+ Cosmos.run_cosmos_tool("TlmGrapher", "#{item_string} --system #{File.basename(System.initial_filename)}")
111
105
  end
112
106
  end
113
107
  end
@@ -372,7 +372,7 @@ module Cosmos
372
372
  # @param packet [Packet] Packet to extract data from
373
373
  # @return data
374
374
  def convert_packet_to_data(packet)
375
- packet.buffer(false)
375
+ packet.buffer(true) # Copy buffer so logged command isn't modified
376
376
  end
377
377
 
378
378
  # Called to read data and manipulate it until enough data is
@@ -134,6 +134,11 @@ module Cosmos
134
134
  # Lookup the command and create a light weight copy
135
135
  command = packet(target_upcase, packet_upcase).clone
136
136
 
137
+ # Restore the command's buffer to a zeroed string of defined length
138
+ # This will undo any side effects from earlier commands that may have altered the size
139
+ # of the buffer
140
+ command.buffer = "\x00" * command.defined_length
141
+
137
142
  # Set time, parameters, and restore defaults
138
143
  command.received_time = Time.now.sys
139
144
  command.given_values = params
@@ -454,6 +454,11 @@ module Cosmos
454
454
  # can be any type.
455
455
  def read_item(item, value_type = :CONVERTED, buffer = @buffer)
456
456
  value = super(item, :RAW, buffer)
457
+ derived_raw = false
458
+ if item.data_type == :DERIVED && value_type == :RAW
459
+ value_type = :CONVERTED
460
+ derived_raw = true
461
+ end
457
462
  case value_type
458
463
  when :RAW
459
464
  # Done above
@@ -505,6 +510,9 @@ module Cosmos
505
510
  end
506
511
  end
507
512
 
513
+ # Derived raw values perform read_conversions but nothing else
514
+ return value if derived_raw
515
+
508
516
  # Convert from value to state if possible
509
517
  if item.states
510
518
  if Array === value
@@ -248,6 +248,15 @@ module Cosmos
248
248
  @meta ||= {}
249
249
  end
250
250
 
251
+ def meta=(meta)
252
+ if meta
253
+ raise ArgumentError, "#{@name}: meta must be a Hash but is a #{meta.class}" unless Hash === meta
254
+ @meta = meta.clone
255
+ else
256
+ @meta = nil
257
+ end
258
+ end
259
+
251
260
  # Make a light weight clone of this item
252
261
  def clone
253
262
  item = super()