rmodbus 1.2.5 → 1.2.6

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: a128d842465a1355308265efa0273d2cb629b26e
4
- data.tar.gz: ed76681a42ad97e7fe9284418460ffd6f240babb
3
+ metadata.gz: 32a45f98ff103499e6446a926f9819928716602a
4
+ data.tar.gz: 0f883902d6eb8a80330769ca519e69915343d857
5
5
  SHA512:
6
- metadata.gz: 3ea5518db02422ac0b7202b7c0a44e1abf38a781ba537d0b1ddc10400bdbe808f9be5d155c5711deb26feb29beb2175382dacf3d849b6f3d5c90c558446f9ea3
7
- data.tar.gz: eef59e76702b87da4b515c89ba91bdc65398c475081dbc47b13b9253de77fc6a185e4828565ac19e77c83ad5a6827f2427c34c57aefa9666e320b929e768204a
6
+ metadata.gz: e050abe8430ef0b8f58bc953c249b6b8143d90e673889c3ec91723deba0888d8ddf081ba7efcfbba7a3517a1287bce028386e203505156c5cb00a40005fa2ad2
7
+ data.tar.gz: 0badca7a5158d6ab27d094c27f3c1b030a14c70e50079fedf4533041d5f340e6fa871d8383ab3e3f5cfb53fa8dea413efca44bb217e8525b2bec602b01dd81d7
data/NEWS.md CHANGED
@@ -1,3 +1,7 @@
1
+ ###2015-03-21 Release 1.2.6
2
+
3
+ 1. Fixed issue [#35](https://github.com/flipback/rmodbus/issues/35).
4
+
1
5
  ###2015-03-12 Release 1.2.5
2
6
 
3
7
  1. Fixed issue [#34](https://github.com/flipback/rmodbus/issues/34).
data/lib/rmodbus/rtu.rb CHANGED
@@ -17,8 +17,6 @@ module ModBus
17
17
  module RTU
18
18
  private
19
19
 
20
- CHUNK_SIZE = 1500
21
-
22
20
  # We have to read specific amounts of numbers of bytes from the network depending on the function code and content
23
21
  def read_rtu_response(io)
24
22
  # Read the slave_id and function code
@@ -47,20 +45,8 @@ module ModBus
47
45
  end
48
46
 
49
47
  def clean_input_buff
50
- win_platform = RUBY_PLATFORM.include? "mingw"
51
- begin
52
- # Read up to CHUNK_SIZE bytes of trash.
53
- if win_platform
54
- # non-blocking reads are not supported by Windows
55
- @io.readpartial(CHUNK_SIZE)
56
- else
57
- @io.read_nonblock(CHUNK_SIZE)
58
- end
59
- rescue Errno::EAGAIN
60
- # Ignore the fact we couldn't read.
61
- rescue Exception => e
62
- raise e unless win_platform || e.is_a?(EOFError) # EOFError means we are done
63
- end
48
+ # empty the input buffer
49
+ @io.flush_input
64
50
  end
65
51
 
66
52
  def send_rtu_pdu(pdu)
@@ -13,5 +13,5 @@
13
13
  # GNU General Public License for more details.
14
14
  module ModBus
15
15
  # Package version
16
- VERSION = '1.2.5'
16
+ VERSION = '1.2.6'
17
17
  end
data/spec/logging_spec.rb CHANGED
@@ -68,7 +68,7 @@ begin
68
68
  it 'should log rec\send bytes' do
69
69
  request = "\x3\x0\x1\x0\x1"
70
70
  @sp.should_receive(:write).with("\1#{request}\xd5\xca")
71
- @sp.should_receive(:read_nonblock).and_return("\xff\xff") # Clean a garbage
71
+ @sp.should_receive(:flush_input) # Clean a garbage
72
72
  @sp.should_receive(:read).with(2).and_return("\x1\x3")
73
73
  @sp.should_receive(:read).with(1).and_return("\x2")
74
74
  @sp.should_receive(:read).with(4).and_return("\xff\xff\xb9\xf4")
@@ -7,7 +7,7 @@ describe ModBus::RTUClient do
7
7
  SerialPort.should_receive(:new).with("/dev/port1", 9600, 8, 1, 0).and_return(@sp)
8
8
  @sp.stub!(:read_timeout=)
9
9
  @sp.should_receive(:flow_control=).with(SerialPort::NONE)
10
- @sp.stub!(:read_nonblock)
10
+ @sp.stub!(:flush_input)
11
11
 
12
12
  @cl = ModBus::RTUClient.new("/dev/port1", 9600, :data_bits => 8, :stop_bits => 1, :parity => SerialPort::NONE)
13
13
  @slave = @cl.with_slave(1)
@@ -50,15 +50,6 @@ describe ModBus::RTUClient do
50
50
  end
51
51
  end
52
52
 
53
- unless RUBY_PLATFORM.include? "mingw"
54
- it 'should ignore EOFError during clearing the buffer' do
55
- @sp.should_receive(:read_nonblock).and_raise(EOFError)
56
-
57
- request = stab_valid_request
58
- lambda { @slave.query(request)}.should_not raise_error(EOFError)
59
- end
60
- end
61
-
62
53
  it 'should have closed? method' do
63
54
  @sp.should_receive(:closed?).and_return(false)
64
55
  @cl.closed?.should == false
@@ -7,7 +7,7 @@ describe ModBus::RTUViaTCPClient do
7
7
  @sock = mock('Socked')
8
8
  TCPSocket.should_receive(:new).with("127.0.0.1", 10002).and_return(@sock)
9
9
  @sock.stub!(:read_timeout=)
10
- @sock.stub!(:read_nonblock)
10
+ @sock.stub!(:flush_input)
11
11
 
12
12
  @cl = ModBus::RTUViaTCPClient.new("127.0.0.1")
13
13
  @slave = @cl.with_slave(1)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmodbus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - A.Timin, J. Sanders, K. Reynolds
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-12 00:00:00.000000000 Z
11
+ date: 2015-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake