Method: CTAPI::Cardterminal#request_icc

Defined in:
lib/ctapi.rb

#request_iccObject

Sends a byte sequence to the card to get the answer to reset Response object. This method is called by the Cardterminal#reset method.



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/ctapi.rb', line 283

def request_icc
    get_atr = [ CTBCS_CLA, CTBCS_INS_REQUEST, CTBCS_P1_INTERFACE1,
           CTBCS_P2_REQUEST_GET_ATR, 0 ]
  @card_old = @card if @card
  @card, atr = nil, nil
  begin
    if card_inserted?
      atr = data(CT, HOST, get_atr)
      if atr
        if atr.not_changed?
          @card = @card_old
          return @card.atr
        end
        @card = Card.new(atr)
      end
    end
  rescue CTAPIError => e
    STDERR.puts "Caught: #{e}."
  end
  @card.atr
end