Class: Smartware::Interface::CardReader
- Defined in:
- lib/smartware/interfaces/card_reader.rb
Defined Under Namespace
Classes: CardReaderError
Constant Summary collapse
- COMMUNICATION_ERROR =
1
- HARDWARE_ERROR =
2
- CARD_JAM_ERROR =
3
- CARD_ERROR =
4
- MAG_READ_ERROR =
5
- ICC_ERROR =
6
Instance Attribute Summary
Attributes inherited from Interface
Instance Method Summary collapse
- #card_inserted ⇒ Object
- #close ⇒ Object
-
#initialize(config, service) ⇒ CardReader
constructor
A new instance of CardReader.
- #open ⇒ Object
Methods inherited from Interface
#error, #model, #repush_events, #shutdown, #status, #version
Constructor Details
#initialize(config, service) ⇒ CardReader
Returns a new instance of CardReader.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/smartware/interfaces/card_reader.rb', line 21 def initialize(config, service) super update_status :model, @device.model update_status :version, @device.version update_status :card_inserted, false, nil, nil, nil @state = :inactive @open = false @mutex = Mutex.new @cvar = ConditionVariable.new schedule_status end |
Instance Method Details
#card_inserted ⇒ Object
50 51 52 |
# File 'lib/smartware/interfaces/card_reader.rb', line 50 def card_inserted @status[:card_inserted] end |
#close ⇒ Object
43 44 45 46 47 48 |
# File 'lib/smartware/interfaces/card_reader.rb', line 43 def close @mutex.synchronize do @open = false @cvar.wait(@mutex) end end |
#open ⇒ Object
36 37 38 39 40 41 |
# File 'lib/smartware/interfaces/card_reader.rb', line 36 def open @mutex.synchronize do @open = true @cvar.wait(@mutex) end end |