Class: ISO7816::Card::Card

Inherits:
Object
  • Object
show all
Defined in:
lib/7816/card.rb

Overview

Dummy implementation of ‘Card` to describe the provided interface

Direct Known Subclasses

LoggingCard, PCSCCard, TCPCard

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#atrObject (readonly)

Returns the value of attribute atr.



7
8
9
# File 'lib/7816/card.rb', line 7

def atr
  @atr
end

Instance Method Details

#connectObject

Set up a connection to this card and return the ATR String. May be called with a block which will be passed ‘self`. Card will call `disconnect` at the end of the block



11
12
13
# File 'lib/7816/card.rb', line 11

def connect
  raise "not implemented, use a subclass of `Card`!"
end

#disconnectObject

disconnect from the card and free all resources.



16
17
18
# File 'lib/7816/card.rb', line 16

def disconnect
  raise "not implemented, use a subclass of `Card`!"
end

#receive(le = 1024) ⇒ Object

receive a response from the card, optionally pass in the number of expected bytes in the response, this value will be 1024 by default, which should be enough to hold most responses sent by a card.



34
35
36
# File 'lib/7816/card.rb', line 34

def receive le=1024
  raise "not implemented, use a subclass of `Card`!"
end

#reconnectObject



25
26
27
28
# File 'lib/7816/card.rb', line 25

def reconnect
  disconnect
  connect
end

#send(bytes = "") ⇒ Object

Send bytes to the card.



21
22
23
# File 'lib/7816/card.rb', line 21

def send bytes=""
  raise "not implemented, use a subclass of `Card`!"
end

#t0?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/7816/card.rb', line 38

def t0?
  raise "not implemented, use a subclass of `Card`!"
end