Module: PrologixGpib::Lan
- Included in:
- LanController
- Defined in:
- lib/prologix_gpib/lan.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- DEVICE_PORT =
1234- EOL =
"\r\n".freeze
Instance Method Summary collapse
- #initialize(ip, mode: :controller, address: 9) {|_self| ... } ⇒ Object
- #read ⇒ Object
- #write(command) ⇒ Object
Instance Method Details
#initialize(ip, mode: :controller, address: 9) {|_self| ... } ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/prologix_gpib/lan.rb', line 10 def initialize(ip, mode: :controller, address: 9) open_socket(ip) # open_serial_port(paths) # flush # self.mode = mode # self.address = address # self.auto = :disable # self.eos = 0 yield self if block_given? end |
#read ⇒ Object
30 31 32 33 34 |
# File 'lib/prologix_gpib/lan.rb', line 30 def read return unless connected? @socket.gets.chomp end |
#write(command) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/prologix_gpib/lan.rb', line 23 def write(command) return unless connected? @socket.send "#{command}#{EOL}", 0 sleep 0.1 end |