rmodbus 1.2.4 → 1.2.5
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 +4 -4
- data/NEWS.md +4 -0
- data/lib/rmodbus/rtu.rb +1 -1
- data/lib/rmodbus/version.rb +1 -1
- data/spec/read_rtu_response_spec.rb +2 -1
- data/spec/rtu_client_spec.rb +20 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a128d842465a1355308265efa0273d2cb629b26e
|
4
|
+
data.tar.gz: ed76681a42ad97e7fe9284418460ffd6f240babb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ea5518db02422ac0b7202b7c0a44e1abf38a781ba537d0b1ddc10400bdbe808f9be5d155c5711deb26feb29beb2175382dacf3d849b6f3d5c90c558446f9ea3
|
7
|
+
data.tar.gz: eef59e76702b87da4b515c89ba91bdc65398c475081dbc47b13b9253de77fc6a185e4828565ac19e77c83ad5a6827f2427c34c57aefa9666e320b929e768204a
|
data/NEWS.md
CHANGED
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
|
62
|
+
raise e unless win_platform || e.is_a?(EOFError) # EOFError means we are done
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
data/lib/rmodbus/version.rb
CHANGED
@@ -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 =
|
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
|
data/spec/rtu_client_spec.rb
CHANGED
@@ -31,11 +31,7 @@ describe ModBus::RTUClient do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should return value of registers"do
|
34
|
-
request =
|
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
|
+
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-
|
11
|
+
date: 2015-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|