rmodbus 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.md +5 -1
- data/lib/rmodbus/rtu.rb +5 -1
- data/lib/rmodbus/rtu_client.rb +1 -3
- data/lib/rmodbus/rtu_via_tcp_client.rb +1 -2
- data/lib/rmodbus/sp.rb +1 -1
- data/lib/rmodbus/tcp.rb +0 -2
- data/lib/rmodbus/tcp_client.rb +1 -2
- data/lib/rmodbus/version.rb +1 -1
- metadata +3 -36
data/NEWS.md
CHANGED
data/lib/rmodbus/rtu.rb
CHANGED
@@ -20,7 +20,11 @@ module ModBus
|
|
20
20
|
# We have to read specific amounts of numbers of bytes from the network depending on the function code and content
|
21
21
|
def read_rtu_response(io)
|
22
22
|
# Read the slave_id and function code
|
23
|
-
|
23
|
+
msg = nil
|
24
|
+
while msg.nil?
|
25
|
+
msg = io.read(2)
|
26
|
+
end
|
27
|
+
|
24
28
|
function_code = msg.getbyte(1)
|
25
29
|
case function_code
|
26
30
|
when 1,2,3,4 then
|
data/lib/rmodbus/rtu_client.rb
CHANGED
@@ -20,7 +20,7 @@ module ModBus
|
|
20
20
|
# end
|
21
21
|
# end
|
22
22
|
#
|
23
|
-
# @see
|
23
|
+
# @see SP#open_serial_port
|
24
24
|
# @see Client#initialize
|
25
25
|
class RTUClient < Client
|
26
26
|
include RTU
|
@@ -28,12 +28,10 @@ module ModBus
|
|
28
28
|
|
29
29
|
protected
|
30
30
|
# Open serial port
|
31
|
-
# @see SP#open_serial_port
|
32
31
|
def open_connection(port, baud=9600, opts = {})
|
33
32
|
open_serial_port(port, baud, opts)
|
34
33
|
end
|
35
34
|
|
36
|
-
# @private
|
37
35
|
def get_slave(uid, io)
|
38
36
|
RTUSlave.new(uid, io)
|
39
37
|
end
|
@@ -21,7 +21,7 @@ module ModBus
|
|
21
21
|
# end
|
22
22
|
# end
|
23
23
|
#
|
24
|
-
# @see
|
24
|
+
# @see TCP#open_tcp_connection
|
25
25
|
# @see Client#initialize
|
26
26
|
class RTUViaTCPClient < Client
|
27
27
|
include RTU
|
@@ -29,7 +29,6 @@ module ModBus
|
|
29
29
|
|
30
30
|
protected
|
31
31
|
# Open TCP\IP connection
|
32
|
-
# @see TCP#open_tcp_connection
|
33
32
|
def open_connection(ipaddr, port = 10002, opts = {})
|
34
33
|
io = open_tcp_connection(ipaddr, port, opts)
|
35
34
|
end
|
data/lib/rmodbus/sp.rb
CHANGED
@@ -35,7 +35,7 @@ module ModBus
|
|
35
35
|
@data_bits = opts[:data_bits] unless opts[:data_bits].nil?
|
36
36
|
@stop_bits = opts[:stop_bits] unless opts[:stop_bits].nil?
|
37
37
|
@parity = opts[:parity] unless opts[:parity].nil?
|
38
|
-
@read_timeout =
|
38
|
+
@read_timeout = opts[:read_timeout] unless opts[:read_timeout].nil?
|
39
39
|
|
40
40
|
io = SerialPort.new(@port, @baud, @data_bits, @stop_bits, @parity)
|
41
41
|
io.read_timeout = @read_timeout
|
data/lib/rmodbus/tcp.rb
CHANGED
data/lib/rmodbus/tcp_client.rb
CHANGED
@@ -21,13 +21,12 @@ module ModBus
|
|
21
21
|
# end
|
22
22
|
#
|
23
23
|
# @see TCPClient#open_connection
|
24
|
-
# @see
|
24
|
+
# @see TCP::open_connection
|
25
25
|
class TCPClient < Client
|
26
26
|
include TCP
|
27
27
|
|
28
28
|
protected
|
29
29
|
# Open TCP\IP connection
|
30
|
-
# @see TCP::open_connection
|
31
30
|
def open_connection(ipaddr, port = 502, opts = {})
|
32
31
|
open_tcp_connection(ipaddr, port, opts)
|
33
32
|
end
|
data/lib/rmodbus/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rmodbus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 23
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 0
|
10
|
-
version: 1.0.0
|
5
|
+
version: 1.0.1
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- A.Timin, J. Sanders, K. Reynolds
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-30 00:00:00 Z
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
16
|
name: serialport
|
@@ -25,9 +20,6 @@ dependencies:
|
|
25
20
|
requirements:
|
26
21
|
- - ">="
|
27
22
|
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 0
|
31
23
|
version: "0"
|
32
24
|
type: :runtime
|
33
25
|
version_requirements: *id001
|
@@ -39,9 +31,6 @@ dependencies:
|
|
39
31
|
requirements:
|
40
32
|
- - ">="
|
41
33
|
- !ruby/object:Gem::Version
|
42
|
-
hash: 3
|
43
|
-
segments:
|
44
|
-
- 0
|
45
34
|
version: "0"
|
46
35
|
type: :development
|
47
36
|
version_requirements: *id002
|
@@ -53,9 +42,6 @@ dependencies:
|
|
53
42
|
requirements:
|
54
43
|
- - ">="
|
55
44
|
- !ruby/object:Gem::Version
|
56
|
-
hash: 3
|
57
|
-
segments:
|
58
|
-
- 0
|
59
45
|
version: "0"
|
60
46
|
type: :development
|
61
47
|
version_requirements: *id003
|
@@ -67,9 +53,6 @@ dependencies:
|
|
67
53
|
requirements:
|
68
54
|
- - ">="
|
69
55
|
- !ruby/object:Gem::Version
|
70
|
-
hash: 3
|
71
|
-
segments:
|
72
|
-
- 0
|
73
56
|
version: "0"
|
74
57
|
type: :development
|
75
58
|
version_requirements: *id004
|
@@ -81,9 +64,6 @@ dependencies:
|
|
81
64
|
requirements:
|
82
65
|
- - ">="
|
83
66
|
- !ruby/object:Gem::Version
|
84
|
-
hash: 3
|
85
|
-
segments:
|
86
|
-
- 0
|
87
67
|
version: "0"
|
88
68
|
type: :development
|
89
69
|
version_requirements: *id005
|
@@ -95,9 +75,6 @@ dependencies:
|
|
95
75
|
requirements:
|
96
76
|
- - ">="
|
97
77
|
- !ruby/object:Gem::Version
|
98
|
-
hash: 3
|
99
|
-
segments:
|
100
|
-
- 0
|
101
78
|
version: "0"
|
102
79
|
type: :development
|
103
80
|
version_requirements: *id006
|
@@ -109,9 +86,6 @@ dependencies:
|
|
109
86
|
requirements:
|
110
87
|
- - ">="
|
111
88
|
- !ruby/object:Gem::Version
|
112
|
-
hash: 3
|
113
|
-
segments:
|
114
|
-
- 0
|
115
89
|
version: "0"
|
116
90
|
type: :development
|
117
91
|
version_requirements: *id007
|
@@ -182,26 +156,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
182
156
|
requirements:
|
183
157
|
- - ">="
|
184
158
|
- !ruby/object:Gem::Version
|
185
|
-
hash: 3
|
186
|
-
segments:
|
187
|
-
- 0
|
188
159
|
version: "0"
|
189
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
161
|
none: false
|
191
162
|
requirements:
|
192
163
|
- - ">="
|
193
164
|
- !ruby/object:Gem::Version
|
194
|
-
hash: 3
|
195
|
-
segments:
|
196
|
-
- 0
|
197
165
|
version: "0"
|
198
166
|
requirements: []
|
199
167
|
|
200
168
|
rubyforge_project:
|
201
|
-
rubygems_version: 1.
|
169
|
+
rubygems_version: 1.8.5
|
202
170
|
signing_key:
|
203
171
|
specification_version: 3
|
204
172
|
summary: RModBus - free implementation of protocol ModBus
|
205
173
|
test_files: []
|
206
174
|
|
207
|
-
has_rdoc:
|