rmodbus 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -10,4 +10,8 @@
10
10
  - add support ruby 1.9.1
11
11
  - fix bug in TCPServer class (it don't close connection after first request now)
12
12
 
13
+ 2009-17-04 Release-0.2.2
14
+ - Make exceptions inherit from StandardError instead of Exception
13
15
 
16
+ 2009-22-06 Release-0.2.3
17
+ - fix bug #26387
@@ -116,6 +116,7 @@ class Array
116
116
  end
117
117
  end
118
118
  s << int16.chr unless mask == 0x01
119
+ s
119
120
  end
120
121
 
121
122
  end
data/spec/ext_spec.rb CHANGED
@@ -2,17 +2,19 @@ require 'rmodbus'
2
2
 
3
3
  describe Array do
4
4
 
5
- before do
6
- @arr = [1,0,1,1, 0,0,1,1, 1,1,0,1, 0,1,1,0, 1,0,1]
5
+ it "should return string reprisent 16bit" do
6
+ arr = [1,0,1,1, 0,0,1,1, 1,1,0,1, 0,1,1,0, 1,0,1]
7
+ arr.bits_to_bytes.should == "\xcd\x6b\x5"
7
8
  end
8
9
 
9
- it "should return string reprisent 16bit" do
10
- @arr.bits_to_bytes.should == "\xcd\x6b\x5"
10
+ it "should return string reprisent 16bit fot 8 bits" do
11
+ arr = [1,0,1,1, 0,0,1,1]
12
+ arr.bits_to_bytes.should == "\xcd"
11
13
  end
12
14
 
13
15
  it "should return string reprisent 16ints" do
14
- @arr = [1,2]
15
- @arr.to_ints16 == "\x0\x1\x0\x2"
16
+ arr = [1,2]
17
+ arr.to_ints16 == "\x0\x1\x0\x2"
16
18
  end
17
19
 
18
20
  end
@@ -20,8 +22,13 @@ end
20
22
  describe String do
21
23
 
22
24
  it "should return array of int16" do
23
- @str = "\x1\x2\x3\x4\x5\x6"
24
- @str.to_array_int16.should == [0x102, 0x304, 0x506]
25
+ str = "\x1\x2\x3\x4\x5\x6"
26
+ str.to_array_int16.should == [0x102, 0x304, 0x506]
27
+ end
28
+
29
+ it "should have convert 2 chars to word" do
30
+ str = "\x1\x1"
31
+ str.to_int16.should == 257
25
32
  end
26
33
 
27
34
  end
@@ -59,10 +59,6 @@ describe TCPServer do
59
59
  @client.read_coils(0,3).should == @server.coils[0,3]
60
60
  end
61
61
 
62
- after do
63
- @server.stop
64
- end
65
-
66
62
  it "should supported function 'read discrete inputs'" do
67
63
  @client.read_discrete_inputs(1,3).should == @server.discret_inputs[1,3]
68
64
  end
@@ -99,6 +95,13 @@ describe TCPServer do
99
95
  @server.holding_registers.should == [1,2,3,1,2,3,4,5,9]
100
96
  end
101
97
 
98
+ it "should valid respond on query reading more than 8 coils at once bug#26387" do
99
+ @server.coils = [0,0,1,1,0,0,1,1,0,0]
100
+ @client.read_coils(0,7)
101
+ @client.read_coils(1,9)
102
+ @client.read_coils(0,8)
103
+ end
104
+
102
105
  after do
103
106
  @client.close if @client
104
107
  @server.stop if @server
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmodbus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - A.Timin, J. Sanders
@@ -9,7 +9,7 @@ autorequire: rmodbus
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-17 00:00:00 -06:00
12
+ date: 2009-06-22 00:00:00 +05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -25,15 +25,15 @@ extra_rdoc_files:
25
25
  - LICENSE
26
26
  - CHANGES
27
27
  files:
28
- - lib/rmodbus/client.rb
28
+ - lib/rmodbus.rb
29
29
  - lib/rmodbus/exceptions.rb
30
30
  - lib/rmodbus/tcp_client.rb
31
+ - lib/rmodbus/client.rb
31
32
  - lib/rmodbus/tcp_server.rb
32
- - lib/rmodbus.rb
33
33
  - examples/add_new_function.rb
34
34
  - examples/use_tcp_modbus.rb
35
- - spec/client_spec.rb
36
35
  - spec/ext_spec.rb
36
+ - spec/client_spec.rb
37
37
  - spec/tcp_client_spec.rb
38
38
  - spec/tcp_server_spec.rb
39
39
  - README
@@ -42,6 +42,8 @@ files:
42
42
  - CHANGES
43
43
  has_rdoc: true
44
44
  homepage:
45
+ licenses: []
46
+
45
47
  post_install_message:
46
48
  rdoc_options:
47
49
  - --title
@@ -66,9 +68,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
68
  requirements: []
67
69
 
68
70
  rubyforge_project:
69
- rubygems_version: 1.3.1
71
+ rubygems_version: 1.3.4
70
72
  signing_key:
71
- specification_version: 2
73
+ specification_version: 3
72
74
  summary: RModBus - free implementation of protocol ModBus
73
75
  test_files: []
74
76