rmodbus 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 065a16477ec109fd5521d0f33a2965c5687910fe
4
- data.tar.gz: b244c0be0566f669b0c13c370cab5b5ea168a2ab
3
+ metadata.gz: a128d842465a1355308265efa0273d2cb629b26e
4
+ data.tar.gz: ed76681a42ad97e7fe9284418460ffd6f240babb
5
5
  SHA512:
6
- metadata.gz: caff21950ba72421c1e05b4572abe39e2b0f3cd90d48b4333ed0a9d1107b94e65dd0ab20c06997b949655afb0c21fab85ecdea4e460852d66cb254fcbcaa2ac6
7
- data.tar.gz: 26f021025e08eceb06c889adb6c2fdb522893d920c4b8ff187db0e31e580a128a0d9ef7a1eba348705f47462a790987789d4c8a9d6f62cb8ce108ef5f66cbd32
6
+ metadata.gz: 3ea5518db02422ac0b7202b7c0a44e1abf38a781ba537d0b1ddc10400bdbe808f9be5d155c5711deb26feb29beb2175382dacf3d849b6f3d5c90c558446f9ea3
7
+ data.tar.gz: eef59e76702b87da4b515c89ba91bdc65398c475081dbc47b13b9253de77fc6a185e4828565ac19e77c83ad5a6827f2427c34c57aefa9666e320b929e768204a
data/NEWS.md CHANGED
@@ -1,3 +1,7 @@
1
+ ###2015-03-12 Release 1.2.5
2
+
3
+ 1. Fixed issue [#34](https://github.com/flipback/rmodbus/issues/34).
4
+
1
5
  ###2015-01-29 Release 1.2.4
2
6
 
3
7
  1. Added ruby-2.2 compatibility
data/lib/rmodbus/rtu.rb CHANGED
@@ -59,7 +59,7 @@ module ModBus
59
59
  rescue Errno::EAGAIN
60
60
  # Ignore the fact we couldn't read.
61
61
  rescue Exception => e
62
- raise e unless win_platform && e.is_a?(EOFError) # EOFError means we are done
62
+ raise e unless win_platform || e.is_a?(EOFError) # EOFError means we are done
63
63
  end
64
64
  end
65
65
 
@@ -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.4'
16
+ VERSION = '1.2.5'
17
17
  end
@@ -79,7 +79,8 @@ describe "#read_rtu_response" do
79
79
  end
80
80
 
81
81
  it "should raise exception if function is illegal" do
82
- resp = make_resp("\xff\x0\x1\x0\x2").should raise_error {
82
+ resp = make_resp("\x1f\x0\x1\x0\x2")
83
+ lambda{ @cl_mb.test_read_method(resp)}.should raise_error {
83
84
  ModBus::Errors::IllegalFunction
84
85
  }
85
86
  end
@@ -31,11 +31,7 @@ describe ModBus::RTUClient do
31
31
  end
32
32
 
33
33
  it "should return value of registers"do
34
- request = "\x3\x0\x1\x0\x1"
35
- @sp.should_receive(:write).with("\1#{request}\xd5\xca")
36
- @sp.should_receive(:read).with(2).and_return("\x1\x3")
37
- @sp.should_receive(:read).with(1).and_return("\x2")
38
- @sp.should_receive(:read).with(4).and_return("\xff\xff\xb9\xf4")
34
+ request = stab_valid_request
39
35
  @slave.query(request).should == "\xff\xff"
40
36
  end
41
37
 
@@ -54,6 +50,15 @@ describe ModBus::RTUClient do
54
50
  end
55
51
  end
56
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
+
57
62
  it 'should have closed? method' do
58
63
  @sp.should_receive(:closed?).and_return(false)
59
64
  @cl.closed?.should == false
@@ -72,5 +77,15 @@ describe ModBus::RTUClient do
72
77
  slave.uid = 1
73
78
  end
74
79
  end
80
+
81
+ def stab_valid_request
82
+ request = "\x3\x0\x1\x0\x1"
83
+ @sp.should_receive(:write).with("\1#{request}\xd5\xca")
84
+ @sp.should_receive(:read).with(2).and_return("\x1\x3")
85
+ @sp.should_receive(:read).with(1).and_return("\x2")
86
+ @sp.should_receive(:read).with(4).and_return("\xff\xff\xb9\xf4")
87
+
88
+ request
89
+ end
75
90
  end
76
91
 
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.4
4
+ version: 1.2.5
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-01-29 00:00:00.000000000 Z
11
+ date: 2015-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake