Sha256: 0794f7ddbf29713d2be28dd9fdec43e0d54962e5bb7592776627dfb44bcd35f1

Contents?: true

Size: 894 Bytes

Versions: 1

Compression:

Stored size: 894 Bytes

Contents

class NFC
  class ISO14443A
    ###
    # Get the unique ID for this tag
    def uid
      abtUid.unpack 'C*'
    end

    ###
    # Get the ATS for this tag
    def ats
      abtAts.unpack 'C*'
    end

    ###
    # Get the atqa
    def atqa
      abtAtqa.unpack 'C*'
    end

    ###
    # Get the UID as a hex string
    def to_s join_string = ''
      sprintf((['%02x'] * uiUidLen).join(join_string), * uid).upcase
    end

    ###
    # Inspect this tag
    def inspect
      string_ary =
        [ "(NFC) ISO14443A Tag",
          " ATQA (SENS_RES): #{sprintf("%02x  %02x", *atqa)}",
          "    UID (NFCID1): #{to_s '  '}",
          "   SAK (SEL_RES): #{sprintf("%02x", btSak)}"
        ]
      if uiAtsLen > 0
        ats = sprintf((['%02x'] * uiAtsLen).join('  '), *self.ats)
        string_ary << "       ATS (ATR): #{ats}"
      end
      string_ary.join "\n"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nfc-2.0.1 lib/nfc/iso14443a.rb