rmodbus 0.5.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. data/NEWS.md +52 -0
  2. data/README.md +87 -0
  3. data/Rakefile +22 -36
  4. data/examples/perfomance_rtu.rb +35 -37
  5. data/examples/perfomance_tcp.rb +36 -38
  6. data/examples/use_rtu_via_tcp_modbus.rb +8 -5
  7. data/examples/use_tcp_modbus.rb +10 -6
  8. data/lib/rmodbus/client.rb +52 -174
  9. data/lib/rmodbus/common.rb +45 -18
  10. data/lib/rmodbus/{exceptions.rb → errors.rb} +3 -0
  11. data/lib/rmodbus/ext.rb +25 -2
  12. data/lib/rmodbus/proxy.rb +54 -0
  13. data/lib/rmodbus/{crc16.rb → rtu.rb} +73 -2
  14. data/lib/rmodbus/rtu_client.rb +20 -116
  15. data/lib/rmodbus/rtu_server.rb +28 -57
  16. data/lib/rmodbus/rtu_slave.rb +59 -0
  17. data/lib/rmodbus/rtu_via_tcp_client.rb +22 -86
  18. data/lib/rmodbus/rtu_via_tcp_server.rb +31 -95
  19. data/lib/rmodbus/rtu_via_tcp_slave.rb +58 -0
  20. data/lib/rmodbus/{parsers.rb → server.rb} +24 -15
  21. data/lib/rmodbus/slave.rb +268 -0
  22. data/lib/rmodbus/sp.rb +45 -0
  23. data/lib/rmodbus/tcp.rb +49 -0
  24. data/lib/rmodbus/tcp_client.rb +19 -88
  25. data/lib/rmodbus/tcp_server.rb +16 -19
  26. data/lib/rmodbus/tcp_slave.rb +64 -0
  27. data/lib/rmodbus/version.rb +17 -0
  28. data/lib/rmodbus.rb +20 -4
  29. data/spec/client_spec.rb +19 -45
  30. data/spec/exception_spec.rb +26 -27
  31. data/spec/ext_spec.rb +24 -1
  32. data/spec/logging_spec.rb +31 -37
  33. data/spec/proxy_spec.rb +73 -0
  34. data/spec/read_rtu_response_spec.rb +2 -4
  35. data/spec/rtu_client_spec.rb +17 -19
  36. data/spec/rtu_server_spec.rb +1 -3
  37. data/spec/rtu_via_tcp_client_spec.rb +69 -63
  38. data/spec/slave_spec.rb +55 -0
  39. data/spec/tcp_client_spec.rb +77 -69
  40. data/spec/tcp_server_spec.rb +34 -49
  41. metadata +123 -37
  42. data/AUTHORS +0 -3
  43. data/ChangeLog +0 -82
  44. data/LICENSE +0 -675
  45. data/README +0 -53
  46. 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
-