rmodbus 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.md +18 -6
- data/lib/rmodbus/proxy.rb +3 -3
- data/lib/rmodbus/version.rb +1 -1
- data/spec/exception_spec.rb +4 -0
- metadata +119 -164
data/NEWS.md
CHANGED
@@ -1,18 +1,26 @@
|
|
1
|
+
2012-04-12 Release 1.1.1
|
2
|
+
==================================
|
3
|
+
1. Fixed issue [#15](https://github.com/flipback/rmodbus/issues/15)
|
4
|
+
|
1
5
|
2011-10-29 Release 1.1.0
|
2
6
|
===================================
|
3
7
|
1. Fixed issue [#12](https://github.com/flipback/rmodbus/issues/12). Added option Slave#raise_exception_on_mismatch to turn to check response and raise exception
|
4
8
|
if it's mismatch.
|
5
9
|
2. Added pass options :debug, :raise_exception_on_mismatch, :read_retry_timeout, :read_retries from clients to slaves
|
6
|
-
|
10
|
+
|
11
|
+
```ruby
|
7
12
|
@cl.debug = true
|
13
|
+
|
8
14
|
@cl.with_slave(1) do |slave_1|
|
9
15
|
slave_1.debug #=> true
|
10
16
|
end
|
17
|
+
|
11
18
|
@cl.with_slave(2) do |slave_2|
|
12
19
|
slave_2.debug = false
|
13
20
|
slave_2.debug #=> false
|
14
21
|
end
|
15
|
-
|
22
|
+
```
|
23
|
+
|
16
24
|
3. Deleted dependency with `serialport` gem. Install it manual for using RTU
|
17
25
|
|
18
26
|
2011-08-10 Release 1.0.4
|
@@ -44,7 +52,8 @@ New API for client part of library
|
|
44
52
|
---------------------------------------
|
45
53
|
|
46
54
|
Example:
|
47
|
-
|
55
|
+
|
56
|
+
```ruby
|
48
57
|
require 'rmodbus'
|
49
58
|
|
50
59
|
ModBus::TCPClient.new('127.0.0.1', 8502) do |cl|
|
@@ -62,7 +71,8 @@ Example:
|
|
62
71
|
slave.holding_registers[16..20] = [1, 2, 3, 4, 5]
|
63
72
|
end
|
64
73
|
end
|
65
|
-
|
74
|
+
```
|
75
|
+
|
66
76
|
for more information [see](http://rdoc.info/gems/rmodbus/1.0.0/frames)
|
67
77
|
|
68
78
|
Conversion to/from 32bit registers
|
@@ -71,7 +81,8 @@ Conversion to/from 32bit registers
|
|
71
81
|
Some modbus devices use two registers to store 32bit values.
|
72
82
|
RModbus provides some helper functions to go back and forth between these two things when reading/writing.
|
73
83
|
The built-in examples assume registers in a particular order but it's trivial to change.
|
74
|
-
|
84
|
+
|
85
|
+
```ruby
|
75
86
|
# Reading values in multiple registers (you can read more than 2 and convert them all so long as they are in multiples of 2)
|
76
87
|
res = slave.holding_registers[0..1]
|
77
88
|
res.inspect => [20342, 17344]
|
@@ -83,7 +94,8 @@ The built-in examples assume registers in a particular order but it's trivial to
|
|
83
94
|
cl.holding_registers[0..1] => [20342, 17344]
|
84
95
|
cl.holding_registers[2..3] = [384.620788574219].from_32f
|
85
96
|
cl.holding_registers[2..3] => [20342, 17344]
|
86
|
-
|
97
|
+
```
|
98
|
+
|
87
99
|
Support JRuby
|
88
100
|
--------------------------------------
|
89
101
|
Now you could use RModBus on JRuby without RTU implementation.
|
data/lib/rmodbus/proxy.rb
CHANGED
@@ -27,7 +27,7 @@ module ModBus
|
|
27
27
|
elsif key.instance_of?(Range)
|
28
28
|
@slave.send("read_#{@type}s", key.first, key.count)
|
29
29
|
else
|
30
|
-
raise ProxyException, "Invalid argument, must be integer or range. Was #{key.class}"
|
30
|
+
raise ModBus::Errors::ProxyException, "Invalid argument, must be integer or range. Was #{key.class}"
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -41,12 +41,12 @@ module ModBus
|
|
41
41
|
@slave.send("write_#{@type}", key, val)
|
42
42
|
elsif key.instance_of?(Range)
|
43
43
|
if key.count != val.size
|
44
|
-
raise ProxyException, "The size of the range must match the size of the values (#{key.count} != #{val.size})"
|
44
|
+
raise ModBus::Errors::ProxyException, "The size of the range must match the size of the values (#{key.count} != #{val.size})"
|
45
45
|
end
|
46
46
|
|
47
47
|
@slave.send("write_#{@type}s", key.first, val)
|
48
48
|
else
|
49
|
-
raise ProxyException, "Invalid argument, must be integer or range. Was #{key.class}"
|
49
|
+
raise ModBus::Errors::ProxyException, "Invalid argument, must be integer or range. Was #{key.class}"
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
data/lib/rmodbus/version.rb
CHANGED
data/spec/exception_spec.rb
CHANGED
@@ -13,6 +13,10 @@ describe ModBus::TCPClient do
|
|
13
13
|
@slave = @cl.with_slave(1)
|
14
14
|
end
|
15
15
|
|
16
|
+
it "should raise ProxException" do
|
17
|
+
lambda { @slave.holding_registers[0..2] = [0,0] }.should raise_error(ModBus::Errors::ProxyException)
|
18
|
+
end
|
19
|
+
|
16
20
|
# Read coil status
|
17
21
|
it "should read coil status" do
|
18
22
|
@slave.read_coils(0, 4).should == [0] * 4
|
metadata
CHANGED
@@ -1,241 +1,196 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rmodbus
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 1.1.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- A.Timin, J. Sanders, K. Reynolds
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-04-12 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: rake
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &19883060 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
33
22
|
type: :development
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: bundler
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: *19883060
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: bundler
|
27
|
+
requirement: &19882460 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
47
33
|
type: :development
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: rspec
|
51
34
|
prerelease: false
|
52
|
-
|
35
|
+
version_requirements: *19882460
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &19881800 !ruby/object:Gem::Requirement
|
53
39
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.9.0
|
61
44
|
type: :development
|
62
|
-
version_requirements: *id003
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
name: rcov
|
65
45
|
prerelease: false
|
66
|
-
|
46
|
+
version_requirements: *19881800
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: simplecov
|
49
|
+
requirement: &19881340 !ruby/object:Gem::Requirement
|
67
50
|
none: false
|
68
|
-
requirements:
|
69
|
-
- -
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
75
55
|
type: :development
|
76
|
-
version_requirements: *id004
|
77
|
-
- !ruby/object:Gem::Dependency
|
78
|
-
name: yard
|
79
56
|
prerelease: false
|
80
|
-
|
57
|
+
version_requirements: *19881340
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: yard
|
60
|
+
requirement: &19880720 !ruby/object:Gem::Requirement
|
81
61
|
none: false
|
82
|
-
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
|
86
|
-
segments:
|
87
|
-
- 0
|
88
|
-
version: "0"
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
89
66
|
type: :development
|
90
|
-
version_requirements: *id005
|
91
|
-
- !ruby/object:Gem::Dependency
|
92
|
-
name: rdiscount
|
93
67
|
prerelease: false
|
94
|
-
|
68
|
+
version_requirements: *19880720
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rdiscount
|
71
|
+
requirement: &19880140 !ruby/object:Gem::Requirement
|
95
72
|
none: false
|
96
|
-
requirements:
|
97
|
-
- -
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
|
100
|
-
segments:
|
101
|
-
- 0
|
102
|
-
version: "0"
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
103
77
|
type: :development
|
104
|
-
version_requirements: *id006
|
105
|
-
- !ruby/object:Gem::Dependency
|
106
|
-
name: pry
|
107
78
|
prerelease: false
|
108
|
-
|
79
|
+
version_requirements: *19880140
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: pry
|
82
|
+
requirement: &19879640 !ruby/object:Gem::Requirement
|
109
83
|
none: false
|
110
|
-
requirements:
|
111
|
-
- -
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
|
114
|
-
segments:
|
115
|
-
- 0
|
116
|
-
version: "0"
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
117
88
|
type: :development
|
118
|
-
version_requirements: *id007
|
119
|
-
- !ruby/object:Gem::Dependency
|
120
|
-
name: serialport
|
121
89
|
prerelease: false
|
122
|
-
|
90
|
+
version_requirements: *19879640
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: serialport
|
93
|
+
requirement: &19811420 !ruby/object:Gem::Requirement
|
123
94
|
none: false
|
124
|
-
requirements:
|
125
|
-
- -
|
126
|
-
- !ruby/object:Gem::Version
|
127
|
-
|
128
|
-
segments:
|
129
|
-
- 0
|
130
|
-
version: "0"
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
131
99
|
type: :development
|
132
|
-
version_requirements: *id008
|
133
|
-
- !ruby/object:Gem::Dependency
|
134
|
-
name: guard-rspec
|
135
100
|
prerelease: false
|
136
|
-
|
101
|
+
version_requirements: *19811420
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: guard-rspec
|
104
|
+
requirement: &19810480 !ruby/object:Gem::Requirement
|
137
105
|
none: false
|
138
|
-
requirements:
|
139
|
-
- -
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
|
142
|
-
segments:
|
143
|
-
- 0
|
144
|
-
version: "0"
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
145
110
|
type: :development
|
146
|
-
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *19810480
|
147
113
|
description:
|
148
114
|
email: atimin@gmail.com
|
149
115
|
executables: []
|
150
|
-
|
151
116
|
extensions: []
|
152
|
-
|
153
|
-
extra_rdoc_files:
|
117
|
+
extra_rdoc_files:
|
154
118
|
- README.md
|
155
119
|
- NEWS.md
|
156
|
-
files:
|
157
|
-
- lib/rmodbus.rb
|
158
|
-
- lib/rmodbus/version.rb
|
120
|
+
files:
|
121
|
+
- lib/rmodbus/slave.rb
|
159
122
|
- lib/rmodbus/errors.rb
|
123
|
+
- lib/rmodbus/rtu_via_tcp_server.rb
|
124
|
+
- lib/rmodbus/tcp_client.rb
|
125
|
+
- lib/rmodbus/rtu.rb
|
126
|
+
- lib/rmodbus/tcp_slave.rb
|
127
|
+
- lib/rmodbus/version.rb
|
128
|
+
- lib/rmodbus/server.rb
|
129
|
+
- lib/rmodbus/client.rb
|
160
130
|
- lib/rmodbus/ext.rb
|
131
|
+
- lib/rmodbus/rtu_slave.rb
|
132
|
+
- lib/rmodbus/rtu_client.rb
|
161
133
|
- lib/rmodbus/rtu_via_tcp_client.rb
|
162
134
|
- lib/rmodbus/sp.rb
|
163
|
-
- lib/rmodbus/
|
164
|
-
- lib/rmodbus/client.rb
|
165
|
-
- lib/rmodbus/slave.rb
|
135
|
+
- lib/rmodbus/rtu_server.rb
|
166
136
|
- lib/rmodbus/tcp_server.rb
|
167
|
-
- lib/rmodbus/
|
137
|
+
- lib/rmodbus/rtu_via_tcp_slave.rb
|
168
138
|
- lib/rmodbus/proxy.rb
|
139
|
+
- lib/rmodbus/tcp.rb
|
169
140
|
- lib/rmodbus/debug.rb
|
170
|
-
- lib/rmodbus/rtu_slave.rb
|
171
|
-
- lib/rmodbus/rtu_server.rb
|
172
|
-
- lib/rmodbus/rtu.rb
|
173
|
-
- lib/rmodbus/rtu_client.rb
|
174
141
|
- lib/rmodbus/options.rb
|
175
|
-
- lib/rmodbus
|
176
|
-
- lib/rmodbus/server.rb
|
177
|
-
- lib/rmodbus/rtu_via_tcp_slave.rb
|
178
|
-
- lib/rmodbus/tcp_slave.rb
|
142
|
+
- lib/rmodbus.rb
|
179
143
|
- examples/simple-xpca-gateway.rb
|
144
|
+
- examples/perfomance_rtu.rb
|
180
145
|
- examples/perfomance_tcp.rb
|
181
|
-
- examples/use_tcp_modbus.rb
|
182
146
|
- examples/use_rtu_via_tcp_modbus.rb
|
183
|
-
- examples/
|
184
|
-
- spec/
|
147
|
+
- examples/use_tcp_modbus.rb
|
148
|
+
- spec/rtu_client_spec.rb
|
185
149
|
- spec/logging_spec.rb
|
186
|
-
- spec/
|
150
|
+
- spec/slave_spec.rb
|
151
|
+
- spec/tcp_server_spec.rb
|
187
152
|
- spec/rtu_server_spec.rb
|
188
|
-
- spec/
|
153
|
+
- spec/read_rtu_response_spec.rb
|
189
154
|
- spec/spec_helper.rb
|
190
155
|
- spec/tcp_client_spec.rb
|
191
|
-
- spec/rtu_via_tcp_server_spec.rb
|
192
|
-
- spec/exception_spec.rb
|
193
|
-
- spec/rtu_client_spec.rb
|
194
|
-
- spec/slave_spec.rb
|
195
156
|
- spec/client_spec.rb
|
196
|
-
- spec/
|
197
|
-
- spec/proxy_spec.rb
|
157
|
+
- spec/exception_spec.rb
|
198
158
|
- spec/ext_spec.rb
|
159
|
+
- spec/proxy_spec.rb
|
160
|
+
- spec/rtu_via_tcp_client_spec.rb
|
161
|
+
- spec/rtu_via_tcp_server_spec.rb
|
162
|
+
- spec/response_mismach_spec.rb
|
199
163
|
- Rakefile
|
200
164
|
- README.md
|
201
165
|
- NEWS.md
|
202
|
-
has_rdoc: true
|
203
166
|
homepage: http://rmodbus.flipback.net
|
204
167
|
licenses: []
|
205
|
-
|
206
168
|
post_install_message:
|
207
|
-
rdoc_options:
|
169
|
+
rdoc_options:
|
208
170
|
- --title
|
209
171
|
- RModBus
|
210
172
|
- --inline-source
|
211
173
|
- --main
|
212
174
|
- README.md
|
213
|
-
require_paths:
|
175
|
+
require_paths:
|
214
176
|
- lib
|
215
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
216
178
|
none: false
|
217
|
-
requirements:
|
218
|
-
- -
|
219
|
-
- !ruby/object:Gem::Version
|
220
|
-
|
221
|
-
|
222
|
-
- 0
|
223
|
-
version: "0"
|
224
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ! '>='
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
225
184
|
none: false
|
226
|
-
requirements:
|
227
|
-
- -
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
|
230
|
-
segments:
|
231
|
-
- 0
|
232
|
-
version: "0"
|
185
|
+
requirements:
|
186
|
+
- - ! '>='
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
233
189
|
requirements: []
|
234
|
-
|
235
190
|
rubyforge_project:
|
236
|
-
rubygems_version: 1.
|
191
|
+
rubygems_version: 1.8.15
|
237
192
|
signing_key:
|
238
193
|
specification_version: 3
|
239
194
|
summary: RModBus - free implementation of protocol ModBus
|
240
195
|
test_files: []
|
241
|
-
|
196
|
+
has_rdoc:
|