Class: Modbus::Client
- Inherits:
-
Object
- Object
- Modbus::Client
- Defined in:
- lib/modbus/client.rb
Instance Method Summary collapse
- #connect ⇒ Object
- #connected(conn) ⇒ Object
- #disconnected(conn) ⇒ Object
-
#initialize(uri) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(uri) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 |
# File 'lib/modbus/client.rb', line 11 def initialize(uri) @base_polling_interval = 1 @last_poll_time = Time.now @uri = URI uri end |
Instance Method Details
#connect ⇒ Object
29 30 31 |
# File 'lib/modbus/client.rb', line 29 def connect EM.connect @uri.host, @uri.port, Modbus::Connection::TCPClient, self end |
#connected(conn) ⇒ Object
18 19 20 21 |
# File 'lib/modbus/client.rb', line 18 def connected(conn) @conn = conn schedule_next_poll end |
#disconnected(conn) ⇒ Object
24 25 26 |
# File 'lib/modbus/client.rb', line 24 def disconnected(conn) reconnect end |