Module: ModBus::Server

Included in:
RTUServer, RTUViaTCPServer, TCPServer
Defined in:
lib/rmodbus/server.rb,
lib/rmodbus/server/slave.rb

Overview

Module for implementation ModBus server

Defined Under Namespace

Classes: Slave

Constant Summary collapse

FUNCS =
[1, 2, 3, 4, 5, 6, 15, 16, 22, 23].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#promiscuousObject

Returns the value of attribute promiscuous.



8
9
10
# File 'lib/rmodbus/server.rb', line 8

def promiscuous
  @promiscuous
end

#request_callbackObject

Returns the value of attribute request_callback.



8
9
10
# File 'lib/rmodbus/server.rb', line 8

def request_callback
  @request_callback
end

#response_callbackObject

Returns the value of attribute response_callback.



8
9
10
# File 'lib/rmodbus/server.rb', line 8

def response_callback
  @response_callback
end

Instance Method Details

#with_slave(uid) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/rmodbus/server.rb', line 12

def with_slave(uid)
  slave = slaves[uid] ||= Server::Slave.new
  if block_given?
    yield slave
  else
    slave
  end
end