lib/lxi/device.rb in lxi_rb-0.2.3 vs lib/lxi/device.rb in lxi_rb-0.2.6
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
module Lxi
class Device
include FFI
attr_accessor :id, :address, :port, :name, :timeout, :protocol
@@ -15,10 +16,10 @@
yield self if block_given?
end
def connect
- raise Error, 'LXI Library Initialisation Error' unless Lxi.lxi_init == LXI_OK
+ init_lxi_session
@id = Lxi.lxi_connect(@address, @port, @name, @timeout, @protocol)
raise Error, 'LXI Connection Error' if @id == LXI_ERROR
true