Sha256: 03607fa65615af2aedf6c6eba4284262d8e8ea2aa02ed2fac4c301fda51cb961

Contents?: true

Size: 735 Bytes

Versions: 5

Compression:

Stored size: 735 Bytes

Contents

module NFC
  class Felica

    def uid
      abtId.unpack 'C*'
    end

    def pad
      abtPad.unpack 'C*'
    end

    def sys_code
      abtSysCode.unpack 'C*'
    end

    def to_s join_string = ''
      sprintf((['%02x'] * 8 ).join(join_string), * uid).upcase
    end

    def inspect
# 78     printf("The following (NFC) Felica tag was found:\n\n");
# 79     printf("%18s","ID (NFCID2): "); print_hex(ti.tif.abtId,8);
# 80     printf("%18s","Parameter (PAD): "); print_hex(ti.tif.abtPad,8);
      pad = sprintf( (['%02x'] * 8 ).join('  '), *self.pad) 
      string_ary = [
        "(NFC) Felica Tag",
        "ID    (NFCID2): #{to_s '  '}",
        "Parameter(PAD): #{pad}"
      ]
      string_ary.join "\n"
    end

  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
nfc-3.1.2 lib/nfc/felica.rb
tamashii-nfc-3.1.2 lib/nfc/felica.rb
nfc-3.1.1 lib/nfc/felica.rb
nfc-3.1.0 lib/nfc/felica.rb
nfc-3.0.0 lib/nfc/felica.rb