rmodbus 0.5.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.md +52 -0
- data/README.md +87 -0
- data/Rakefile +22 -36
- data/examples/perfomance_rtu.rb +35 -37
- data/examples/perfomance_tcp.rb +36 -38
- data/examples/use_rtu_via_tcp_modbus.rb +8 -5
- data/examples/use_tcp_modbus.rb +10 -6
- data/lib/rmodbus/client.rb +52 -174
- data/lib/rmodbus/common.rb +45 -18
- data/lib/rmodbus/{exceptions.rb → errors.rb} +3 -0
- data/lib/rmodbus/ext.rb +25 -2
- data/lib/rmodbus/proxy.rb +54 -0
- data/lib/rmodbus/{crc16.rb → rtu.rb} +73 -2
- data/lib/rmodbus/rtu_client.rb +20 -116
- data/lib/rmodbus/rtu_server.rb +28 -57
- data/lib/rmodbus/rtu_slave.rb +59 -0
- data/lib/rmodbus/rtu_via_tcp_client.rb +22 -86
- data/lib/rmodbus/rtu_via_tcp_server.rb +31 -95
- data/lib/rmodbus/rtu_via_tcp_slave.rb +58 -0
- data/lib/rmodbus/{parsers.rb → server.rb} +24 -15
- data/lib/rmodbus/slave.rb +268 -0
- data/lib/rmodbus/sp.rb +45 -0
- data/lib/rmodbus/tcp.rb +49 -0
- data/lib/rmodbus/tcp_client.rb +19 -88
- data/lib/rmodbus/tcp_server.rb +16 -19
- data/lib/rmodbus/tcp_slave.rb +64 -0
- data/lib/rmodbus/version.rb +17 -0
- data/lib/rmodbus.rb +20 -4
- data/spec/client_spec.rb +19 -45
- data/spec/exception_spec.rb +26 -27
- data/spec/ext_spec.rb +24 -1
- data/spec/logging_spec.rb +31 -37
- data/spec/proxy_spec.rb +73 -0
- data/spec/read_rtu_response_spec.rb +2 -4
- data/spec/rtu_client_spec.rb +17 -19
- data/spec/rtu_server_spec.rb +1 -3
- data/spec/rtu_via_tcp_client_spec.rb +69 -63
- data/spec/slave_spec.rb +55 -0
- data/spec/tcp_client_spec.rb +77 -69
- data/spec/tcp_server_spec.rb +34 -49
- metadata +123 -37
- data/AUTHORS +0 -3
- data/ChangeLog +0 -82
- data/LICENSE +0 -675
- data/README +0 -53
- data/examples/add_new_function.rb +0 -19
data/README
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
= RModBus
|
2
|
-
|
3
|
-
*RModBus* - free implementation of protocol ModBus.
|
4
|
-
|
5
|
-
== Features
|
6
|
-
|
7
|
-
* Support Ruby 1.8, Ruby 1.9
|
8
|
-
* Support TCP, RTU, RTU over TCP protocols
|
9
|
-
* Support client(master) and server(slave)
|
10
|
-
* Support functions:
|
11
|
-
* 01 (0x01) Read Coils
|
12
|
-
* 02 (0x02) Read Discrete Inputs
|
13
|
-
* 03 (0x03) Read Holding Registers
|
14
|
-
* 04 (0x04) Read Input Registers
|
15
|
-
* 05 (0x05) Write Single Coil
|
16
|
-
* 06 (0x06) Write Single Register
|
17
|
-
* 15 (0x0F) Write Multiple Coils
|
18
|
-
* 16 (0x10) Write Multiple registers
|
19
|
-
* 22 (0x16) Mask Write register
|
20
|
-
|
21
|
-
== Installation
|
22
|
-
|
23
|
-
Download and install RModBus with the following
|
24
|
-
|
25
|
-
$ gem install --remote rmodbus
|
26
|
-
|
27
|
-
== Example
|
28
|
-
|
29
|
-
require 'rmodbus'
|
30
|
-
|
31
|
-
cl = ModBus::TCPClient.new('127.0.0.1', 8502, 1) do |cl|
|
32
|
-
|
33
|
-
puts cl.read_holding_registers(0,4)
|
34
|
-
|
35
|
-
cl.write_multiple_registers(0, [4,4,4])
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
== GitHub
|
40
|
-
|
41
|
-
You can checkout source code from GitHub repositry
|
42
|
-
|
43
|
-
$ git clone git://github.com/flipback/RModBus.git
|
44
|
-
|
45
|
-
== Reference
|
46
|
-
|
47
|
-
Home page: http://rmodbus.heroku.com
|
48
|
-
|
49
|
-
RModBus project: http://rubyforge.org/projects/rmodbus
|
50
|
-
|
51
|
-
RModBud on GitHub: http://github.com/flipback/RModBus
|
52
|
-
|
53
|
-
ModBus community: http://www.modbus-ida.org
|
@@ -1,19 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'rubygems'
|
3
|
-
rescue
|
4
|
-
end
|
5
|
-
require 'rmodbus'
|
6
|
-
|
7
|
-
include ModBus
|
8
|
-
|
9
|
-
class MyTCPClient < TCPClient
|
10
|
-
|
11
|
-
def user_define_function(arg1, arg2)
|
12
|
-
query("\x65" + arg1.to_bytes + arg2.to_bytes)
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
@my_mb = MyTCPClient.new('127.0.0.1', 502, 1)
|
18
|
-
@my_mb.user_define_function(20,13)
|
19
|
-
|