Sha256: 858493993f345b17ec66e073683430d78fe3ed16f967626e02f530900d79ed97
Contents?: true
Size: 992 Bytes
Versions: 1
Compression:
Stored size: 992 Bytes
Contents
require 'mfrc522' require 'tamashii/agent/device/card_reader/base' module Tamashii module Agent module Device module CardReader class Mfrc522Spi < Base def initialize(*args) super @reader = MFRC522.new end def poll_uid # check antenna return nil unless @reader.picc_request(MFRC522::PICC_REQA) # read uid uid = nil begin uid, sak = @reader.picc_select rescue CommunicationError, UnexpectedDataError => e logger.error "Error when selecting card: #{e.message}" uid = :error rescue => e uid = :error logger.error "GemError when selecting card: #{e.message}" ensure @reader.picc_halt end uid end def shutdown @reader.shutdown end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tamashii-agent-0.3.1 | lib/tamashii/agent/device/card_reader/mfrc522_spi.rb |