Class: LgLcd::Open

Inherits:
Object
  • Object
show all
Defined in:
lib/lg-lcd/lib.rb,
lib/lg-lcd/open.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Open

Returns a new instance of Open.



204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/lg-lcd/lib.rb', line 204

def initialize connection
   @ctx = Lib::OpenByTypeContext.new
   @ctx[:connection] = connection
   @ctx[:device_type] = Lib::LGLCD_DEVICE_BW
   @ctx[:device] = Lib::LGLCD_INVALID_DEVICE
   raise "Open by type failes" unless Lib::LGLCD_RET_OK == Lib.open_by_type(@ctx)

   begin
      yield(self)
   ensure
      puts "Close"
      Lib.close(@ctx[:device])
   end
end

Instance Method Details

#deviceObject



219
220
221
# File 'lib/lg-lcd/lib.rb', line 219

def device
   return @ctx[:device]
end