rmodbus 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/NEWS.md CHANGED
@@ -1,3 +1,16 @@
1
+ 2011-08-10 Release 1.0.4
2
+ ====================================
3
+ 1. Fixed issue [#11](https://github.com/flipback/rmodbus/issues/9)
4
+
5
+
6
+ 2011-07-17 Release 1.0.3
7
+ ====================================
8
+
9
+ 1. Fixed issue #10
10
+ 2. Added new options for TCPServer#new and RTUViaTCPServer#new
11
+ :host - ip of host server (default 127.0.0.1)
12
+ :max_connection - maximum (client default 4)
13
+
1
14
  2011-07-1 Release 1.0.2
2
15
  ====================================
3
16
 
data/lib/rmodbus.rb CHANGED
@@ -33,3 +33,4 @@ require 'rmodbus/rtu_via_tcp_slave'
33
33
  require 'rmodbus/rtu_via_tcp_client'
34
34
  require 'rmodbus/rtu_via_tcp_server'
35
35
  require 'rmodbus/proxy'
36
+ require 'rmodbus/version'
data/lib/rmodbus/rtu.rb CHANGED
@@ -38,7 +38,7 @@ module ModBus
38
38
  when 22 then
39
39
  msg += io.read(8)
40
40
  when 0x80..0xff then
41
- msg += io.read(4)
41
+ msg += io.read(3)
42
42
  else
43
43
  raise ModBus::Errors::IllegalFunction, "Illegal function: #{function_code}"
44
44
  end
@@ -13,5 +13,5 @@
13
13
  # GNU General Public License for more details.
14
14
  module ModBus
15
15
  # Package version
16
- VERSION = '1.0.3'
16
+ VERSION = '1.0.4'
17
17
  end
@@ -0,0 +1,14 @@
1
+ require "rmodbus"
2
+ describe ModBus::RTUViaTCPServer do
3
+ it "should have options :host" do
4
+ host = '192.168.0.1'
5
+ srv = ModBus::RTUViaTCPServer.new(1010, 1, :host => '192.168.0.1')
6
+ srv.host.should eql(host)
7
+ end
8
+
9
+ it "should have options :max_connection" do
10
+ max_conn = 5
11
+ srv = ModBus::RTUViaTCPServer.new(1010, 1, :max_connection => 5)
12
+ srv.maxConnections.should eql(max_conn)
13
+ end
14
+ end
@@ -17,7 +17,7 @@ describe TCPServer do
17
17
  @cl.close
18
18
  ModBus::TCPClient.connect('127.0.0.1', 8502) do |cl|
19
19
  lambda { cl.with_slave(2).read_coils(1,3) }.should raise_exception(
20
- ModBus::Errors::ModBusException,
20
+ ModBus::Errors::ModBusException,
21
21
  "Server did not respond"
22
22
  )
23
23
  end
@@ -26,20 +26,20 @@ describe TCPServer do
26
26
  it "should send exception if function not supported" do
27
27
  lambda { @slave.query('0x43') }.should raise_exception(
28
28
  ModBus::Errors::IllegalFunction,
29
- "The function code received in the query is not an allowable action for the server"
29
+ "The function code received in the query is not an allowable action for the server"
30
30
  )
31
31
  end
32
32
 
33
33
  it "should send exception if quanity of out more 0x7d" do
34
34
  lambda { @slave.read_coils(0, 0x7e) }.should raise_exception(
35
- ModBus::Errors::IllegalDataValue,
35
+ ModBus::Errors::IllegalDataValue,
36
36
  "A value contained in the query data field is not an allowable value for server"
37
37
  )
38
38
  end
39
39
 
40
40
  it "should send exception if addr not valid" do
41
41
  lambda { @slave.read_coils(2, 8) }.should raise_exception(
42
- ModBus::Errors::IllegalDataAddress,
42
+ ModBus::Errors::IllegalDataAddress,
43
43
  "The data address received in the query is not an allowable address for the server"
44
44
  )
45
45
  end
@@ -90,10 +90,22 @@ describe TCPServer do
90
90
  @server.holding_registers.should == [1,2,3,1,2,3,4,5,9]
91
91
  end
92
92
 
93
+ it "should have options :host" do
94
+ host = '192.168.0.1'
95
+ srv = ModBus::TCPServer.new(1010, 1, :host => '192.168.0.1')
96
+ srv.host.should eql(host)
97
+ end
98
+
99
+ it "should have options :max_connection" do
100
+ max_conn = 5
101
+ srv = ModBus::TCPServer.new(1010, 1, :max_connection => 5)
102
+ srv.maxConnections.should eql(max_conn)
103
+ end
104
+
93
105
  after do
94
- @cl.close
106
+ @cl.close
95
107
  @server.stop unless @server.stopped?
96
- while GServer.in_service?(8502)
108
+ while GServer.in_service?(8502)
97
109
  end
98
110
  end
99
111
  end
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmodbus
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 31
4
5
  prerelease:
5
- version: 1.0.3
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 4
10
+ version: 1.0.4
6
11
  platform: ruby
7
12
  authors:
8
13
  - A.Timin, J. Sanders, K. Reynolds
@@ -10,7 +15,8 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-07-16 00:00:00 Z
18
+ date: 2011-08-10 00:00:00 +06:00
19
+ default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: serialport
@@ -20,6 +26,9 @@ dependencies:
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
23
32
  version: "0"
24
33
  type: :runtime
25
34
  version_requirements: *id001
@@ -31,6 +40,9 @@ dependencies:
31
40
  requirements:
32
41
  - - ">="
33
42
  - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
34
46
  version: "0"
35
47
  type: :development
36
48
  version_requirements: *id002
@@ -42,6 +54,9 @@ dependencies:
42
54
  requirements:
43
55
  - - ">="
44
56
  - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
45
60
  version: "0"
46
61
  type: :development
47
62
  version_requirements: *id003
@@ -53,6 +68,9 @@ dependencies:
53
68
  requirements:
54
69
  - - ">="
55
70
  - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
56
74
  version: "0"
57
75
  type: :development
58
76
  version_requirements: *id004
@@ -64,6 +82,9 @@ dependencies:
64
82
  requirements:
65
83
  - - ">="
66
84
  - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
67
88
  version: "0"
68
89
  type: :development
69
90
  version_requirements: *id005
@@ -75,6 +96,9 @@ dependencies:
75
96
  requirements:
76
97
  - - ">="
77
98
  - !ruby/object:Gem::Version
99
+ hash: 3
100
+ segments:
101
+ - 0
78
102
  version: "0"
79
103
  type: :development
80
104
  version_requirements: *id006
@@ -86,6 +110,9 @@ dependencies:
86
110
  requirements:
87
111
  - - ">="
88
112
  - !ruby/object:Gem::Version
113
+ hash: 3
114
+ segments:
115
+ - 0
89
116
  version: "0"
90
117
  type: :development
91
118
  version_requirements: *id007
@@ -130,6 +157,7 @@ files:
130
157
  - spec/rtu_via_tcp_client_spec.rb
131
158
  - spec/rtu_server_spec.rb
132
159
  - spec/tcp_client_spec.rb
160
+ - spec/rtu_via_tcp_server_spec.rb
133
161
  - spec/exception_spec.rb
134
162
  - spec/rtu_client_spec.rb
135
163
  - spec/slave_spec.rb
@@ -140,6 +168,7 @@ files:
140
168
  - Rakefile
141
169
  - README.md
142
170
  - NEWS.md
171
+ has_rdoc: true
143
172
  homepage: http://rmodbus.heroku.com
144
173
  licenses: []
145
174
 
@@ -157,17 +186,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
186
  requirements:
158
187
  - - ">="
159
188
  - !ruby/object:Gem::Version
189
+ hash: 3
190
+ segments:
191
+ - 0
160
192
  version: "0"
161
193
  required_rubygems_version: !ruby/object:Gem::Requirement
162
194
  none: false
163
195
  requirements:
164
196
  - - ">="
165
197
  - !ruby/object:Gem::Version
198
+ hash: 3
199
+ segments:
200
+ - 0
166
201
  version: "0"
167
202
  requirements: []
168
203
 
169
204
  rubyforge_project:
170
- rubygems_version: 1.8.5
205
+ rubygems_version: 1.6.2
171
206
  signing_key:
172
207
  specification_version: 3
173
208
  summary: RModBus - free implementation of protocol ModBus