cosmos 3.8.1 → 3.8.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7e36eb7962f4256e6b26441b046cfd7581874e3
4
- data.tar.gz: b46aa8db2bea92c1c4a431f33cf7bc20d72ba2ba
3
+ metadata.gz: d3c46acdd62517e6d5c2d740e931748fb350f256
4
+ data.tar.gz: 49f4f68d13f685e47b64f7ee859526ee4995829e
5
5
  SHA512:
6
- metadata.gz: 2995ae3395b05c078c3d881e3943f31ceaa6517cc4152cc61cf06694a07f5f73bc486ea6170d70b4c5f151a1e11b3d0eac46ac0c3f453b11b80c9f9019df4295
7
- data.tar.gz: e0246fb6ba01c6d8c7448e882d4eea210fd32b7600b86dab5c49137361e042e7d3d460269d592db413a11f8eba8a9d26a7edc3c83d418e6f4c074eaa5015d9bc
6
+ metadata.gz: 4dab21d757b4a8e70e5fdee34b6ea25eefd03f848e14cbc1120cc0114815a1c24c8da6ef2a6e1b72468fa8312100f7935a0ff2a50baf1a6d01278fc97ca7d636
7
+ data.tar.gz: 74e67b0e4d04b9795d0a463a791f4f81e054587d34bf76dbf63679a7991d102dce473722865380909347dbbe48bcbb72c4fa5a08bc36f4fd9b15c107f0d60136
@@ -1,5 +1,5 @@
1
1
  "lib/cosmos/io/json_drb.rb" 0x495EB58B
2
- "lib/cosmos/io/win32_serial_driver.rb" 0xB5AF7D58
2
+ "lib/cosmos/io/win32_serial_driver.rb" 0xAA391322
3
3
  "lib/cosmos/io/io_multiplexer.rb" 0x9C3213AD
4
4
  "lib/cosmos/io/stderr.rb" 0x401624AF
5
5
  "lib/cosmos/io/tcpip_server.rb" 0x2A294912
@@ -18,7 +18,7 @@
18
18
  "lib/cosmos/processors/processor.rb" 0x1FEB7030
19
19
  "lib/cosmos/processors/statistics_processor.rb" 0xE732AE7F
20
20
  "lib/cosmos/processors/watermark_processor.rb" 0x8829E260
21
- "lib/cosmos/version.rb" 0x4EE6A9C7
21
+ "lib/cosmos/version.rb" 0x88B858F6
22
22
  "lib/cosmos/conversions/new_packet_log_conversion.rb" 0x4AA03555
23
23
  "lib/cosmos/conversions/segmented_polynomial_conversion.rb" 0xC498CE81
24
24
  "lib/cosmos/conversions/processor_conversion.rb" 0xC72B73BD
@@ -98,7 +98,7 @@
98
98
  "lib/cosmos/packets/parsers/packet_parser.rb" 0x26478943
99
99
  "lib/cosmos/packets/telemetry.rb" 0x83D17863
100
100
  "lib/cosmos/packets/binary_accessor.rb" 0x7D41D474
101
- "lib/cosmos/packets/packet.rb" 0x3EFBEDE3
101
+ "lib/cosmos/packets/packet.rb" 0xE0279245
102
102
  "lib/cosmos/packets/structure.rb" 0x85F4F979
103
103
  "lib/cosmos/packets/commands.rb" 0x1A33428E
104
104
  "lib/cosmos/packets/limits_response.rb" 0xB836D388
@@ -110,7 +110,7 @@
110
110
  "lib/cosmos/core_ext.rb" 0x1951B346
111
111
  "lib/cosmos/streams/stream_protocol.rb" 0xEC382CA0
112
112
  "lib/cosmos/streams/tcpip_client_stream.rb" 0xA644ADBA
113
- "lib/cosmos/streams/terminated_stream_protocol.rb" 0x5DBDE591
113
+ "lib/cosmos/streams/terminated_stream_protocol.rb" 0x3B45B46D
114
114
  "lib/cosmos/streams/burst_stream_protocol.rb" 0xA9F43F1C
115
115
  "lib/cosmos/streams/tcpip_socket_stream.rb" 0x7096E4FA
116
116
  "lib/cosmos/streams/preidentified_stream_protocol.rb" 0xC258238E
@@ -144,7 +144,7 @@
144
144
  "lib/cosmos/script/cmd_tlm_server.rb" 0x15F91C95
145
145
  "lib/cosmos/script/limits.rb" 0x9CED41D8
146
146
  "lib/cosmos/script/script.rb" 0xF1B3E1F2
147
- "lib/cosmos/script/tools.rb" 0x18E9BE05
147
+ "lib/cosmos/script/tools.rb" 0x6323067F
148
148
  "lib/cosmos/ccsds/ccsds_packet.rb" 0xA30EE27E
149
149
  "lib/cosmos/ccsds/ccsds_parser.rb" 0x89A5FB3A
150
150
  "lib/cosmos/win32/excel.rb" 0xB4D4195E
@@ -60,6 +60,7 @@ module Cosmos
60
60
  Win32::NULL,
61
61
  Win32::OPEN_EXISTING,
62
62
  Win32::FILE_ATTRIBUTE_NORMAL)
63
+ @mutex = Mutex.new
63
64
 
64
65
  # Configure the Comm Port
65
66
  dcb = Win32.get_comm_state(@handle)
@@ -78,7 +79,9 @@ module Cosmos
78
79
  if @handle
79
80
  # Close the Comm Port
80
81
  Win32.close_handle(@handle)
81
- @handle = nil
82
+ @mutex.synchronize do
83
+ @handle = nil
84
+ end
82
85
  end
83
86
  end
84
87
 
@@ -112,11 +115,16 @@ module Cosmos
112
115
 
113
116
  loop do
114
117
  loop do
115
- buffer = Win32.read_file(@handle, @read_max_length - data.length)
118
+ buffer = nil
119
+ @mutex.synchronize do
120
+ break unless @handle
121
+ buffer = Win32.read_file(@handle, @read_max_length - data.length)
122
+ end
123
+ break unless buffer
116
124
  data << buffer
117
- break if buffer.length <= 0 or data.length >= @read_max_length
125
+ break if buffer.length <= 0 or data.length >= @read_max_length or !@handle
118
126
  end
119
- break if data.length > 0
127
+ break if data.length > 0 or !@handle
120
128
  if @read_timeout and sleep_time >= @read_timeout
121
129
  raise Timeout::Error, "Read Timeout"
122
130
  end
@@ -683,6 +683,7 @@ module Cosmos
683
683
  packet.processors[processor_name] = processor.clone
684
684
  end
685
685
  end
686
+ packet.instance_variable_set("@read_conversion_cache".freeze, nil)
686
687
  packet
687
688
  end
688
689
  alias dup clone
@@ -76,7 +76,7 @@ module Cosmos
76
76
  #######################################
77
77
 
78
78
  def _ensure_script_runner_frame
79
- yield if defined? ScriptRunnerFrame && ScriptRunnerFrame.instance
79
+ yield if (defined? ScriptRunnerFrame) && ScriptRunnerFrame.instance
80
80
  end
81
81
 
82
82
  def set_line_delay(delay)
@@ -101,7 +101,7 @@ module Cosmos
101
101
  end
102
102
 
103
103
  def disable_instrumentation
104
- if defined? ScriptRunnerFrame && ScriptRunnerFrame.instance
104
+ if (defined? ScriptRunnerFrame) && ScriptRunnerFrame.instance
105
105
  ScriptRunnerFrame.instance.use_instrumentation = false
106
106
  begin
107
107
  yield
@@ -36,8 +36,8 @@ module Cosmos
36
36
  sync_pattern = nil,
37
37
  fill_sync_pattern = false)
38
38
  @write_termination_characters = write_termination_characters.hex_to_byte_string
39
- @read_termination_characters = read_termination_characters.hex_to_byte_string
40
- @strip_read_termination = ConfigParser.handle_true_false(strip_read_termination)
39
+ @read_termination_characters = read_termination_characters.hex_to_byte_string
40
+ @strip_read_termination = ConfigParser.handle_true_false(strip_read_termination)
41
41
 
42
42
  super(discard_leading_bytes, sync_pattern, fill_sync_pattern)
43
43
  end
@@ -62,10 +62,14 @@ module Cosmos
62
62
 
63
63
  # Reduce to packet data and setup current_data for next packet
64
64
  if index
65
- if @strip_read_termination
66
- packet_data = @data[0..(index - 1)]
65
+ if index > 0
66
+ if @strip_read_termination
67
+ packet_data = @data[0..(index - 1)]
68
+ else
69
+ packet_data = @data[0..(index + @read_termination_characters.length - 1)]
70
+ end
67
71
  else
68
- packet_data = @data[0..(index + @read_termination_characters.length - 1)]
72
+ packet_data = ''
69
73
  end
70
74
  @data.replace(@data[(index + @read_termination_characters.length)..-1])
71
75
  return packet_data
@@ -1,12 +1,12 @@
1
1
  # encoding: ascii-8bit
2
2
 
3
- COSMOS_VERSION = '3.8.1'
3
+ COSMOS_VERSION = '3.8.2'
4
4
  module Cosmos
5
5
  module Version
6
6
  MAJOR = '3'
7
7
  MINOR = '8'
8
- PATCH = '1'
9
- BUILD = 'fa125f2a38e0aa28f6d3000a80ea5167115172d7'
8
+ PATCH = '2'
9
+ BUILD = '8283169565fc37b09011e37193d511ff15a7d42c'
10
10
  end
11
- VERSION = '3.8.1'
11
+ VERSION = '3.8.2'
12
12
  end
@@ -370,6 +370,21 @@ module Cosmos
370
370
  expect(@p.read_item(i, :CONVERTED, "\x02")).to eql 1
371
371
  end
372
372
 
373
+ it "clears the read conversion cache on clone" do
374
+ @p.append_item("item",8,:UINT)
375
+ i = @p.get_item("ITEM")
376
+ i.read_conversion = GenericConversion.new("value / 2")
377
+ @p.buffer = "\x02"
378
+ expect(@p.read("ITEM", :CONVERTED)).to eql 1
379
+ expect(@p.read_item(i, :CONVERTED)).to eql 1
380
+ cloned = @p.clone
381
+ cloned.buffer = "\x04"
382
+ expect(@p.read("ITEM", :CONVERTED)).to eql 1
383
+ expect(@p.read_item(i, :CONVERTED)).to eql 1
384
+ expect(cloned.read("ITEM", :CONVERTED)).to eql 2
385
+ expect(cloned.read_item(i, :CONVERTED)).to eql 2
386
+ end
387
+
373
388
  it "prevents the read conversion cache from being corrupted" do
374
389
  @p.append_item("item",8,:UINT)
375
390
  i = @p.get_item("ITEM")
@@ -33,48 +33,43 @@ task :gemfile_stats do
33
33
  gem_data.map! {|x| [Date.strptime(x[0], "%Y-%m"), x[1], x[2]]}
34
34
  # Sort first by date and then version number
35
35
  gem_data.sort_by! {|x| [x[0], x[1]] }
36
- # Collect all the minor version numbers counts
37
- new_data = []
38
- gem_data.each do |date, version, count|
39
- if version.split('.')[2] == '0'
40
- new_version = version[0..-2] + 'x'
41
- new_data << [date, new_version, count]
42
- else
43
- new_data[-1][2] += count
44
- end
45
- end
46
- gem_data = new_data
47
36
 
48
37
  g = Gruff::StackedArea.new
49
38
  g.title = 'COSMOS Downloads'
50
- labels = {}
51
- index = 0
52
39
 
40
+ # Build up date labels on the bottom of the graph
41
+ labels = {} # Must be hash with integer keys and label value
42
+ index = 0
53
43
  start_date = gem_data[0][0]
54
44
  end_date = gem_data[-1][0]
55
45
  while (start_date <= end_date)
56
- labels[index] = start_date.strftime("%Y-%m")
46
+ labels[index] = start_date.strftime("%m/%y")
57
47
  index += 1
58
48
  start_date = start_date >> 1
59
49
  end
60
50
 
61
- dataset = []
62
- index = 0
63
- gem_data.each do |date, version, count|
64
- data = []
65
- labels.each do |label|
66
- if date <= Date.strptime(label[1], "%Y-%m")
67
- data << count
68
- else
69
- data << 0
70
- end
51
+ # Create an array of 0s the size of the labels which will hold the D/L counts
52
+ counts = Array.new(labels.length, 0)
53
+ dataset = {}
54
+ gem_data.each do |full_date, full_version, count|
55
+ # Build up just the major minor version: 1.0
56
+ version = full_version.split('.')[0..1].join('.')
57
+ date = full_date.strftime("%m/%y")
58
+ # Find the location in the count array to start adding counts
59
+ index = labels.key(date)
60
+ dataset[version] ||= counts.clone
61
+ # We fill in the count array starting at the first location
62
+ # and going until the end because this is a stacked area graph
63
+ # and all the counts are additive over time
64
+ (index...counts.length).each do |i|
65
+ dataset[version][i] += count
71
66
  end
72
- dataset << [version, data]
73
67
  end
68
+
74
69
  g.labels = labels
75
70
  g.marker_font_size = 12
76
- dataset.each do |data|
77
- g.data(data[0], data[1])
71
+ dataset.each do |version, data|
72
+ g.data(version, data)
78
73
  end
79
74
  g.write('cosmos_downloads.png')
80
75
  end
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.8.1
4
+ version: 3.8.2
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: 2016-05-12 00:00:00.000000000 Z
12
+ date: 2016-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler