Class: LadderDrive::Protocol::Emulator::EmuProtocol

Inherits:
Keyence::KvProtocol show all
Defined in:
lib/ladder_drive/protocol/emulator/emu_protocol.rb

Constant Summary

Constants inherited from Protocol

Protocol::TIMEOUT

Instance Attribute Summary

Attributes inherited from Protocol

#host, #port

Instance Method Summary collapse

Methods inherited from Keyence::KvProtocol

#available_bits_range, #available_words_range, #close, #device_by_name, #dump_packet, #get_bits_from_device, #get_words_from_device, #open, #open!, #receive, #set_bits_to_device, #set_words_to_device

Methods inherited from Protocol

#[], #[]=, #available_bits_range, #available_words_range, #close, #destination_ipv4, #device_by_name, #get_bit_from_device, #get_bits_from_device, #get_from_devices, #get_word_from_device, #get_words_from_device, #log_level, #log_level=, #open, #self_ipv4, #set_bit_to_device, #set_bits_to_device, #set_to_devices, #set_word_to_device, #set_words_to_device

Constructor Details

#initialize(options = {}) ⇒ EmuProtocol

Returns a new instance of EmuProtocol.



30
31
32
33
# File 'lib/ladder_drive/protocol/emulator/emu_protocol.rb', line 30

def initialize options={}
  options.merge host:"localhost", port:5555
  super
end

Instance Method Details

#execute(line) ⇒ Object



35
36
37
38
# File 'lib/ladder_drive/protocol/emulator/emu_protocol.rb', line 35

def execute line
  @socket.puts(line)
  @socket.gets
end