android.nfc.tech
Class MifareClassic

java.lang.Object
  extended by android.nfc.tech.MifareClassic
All Implemented Interfaces:
TagTechnology, Closeable

public final class MifareClassic
extends Object


Field Summary
static int BLOCK_SIZE
           
static byte[] KEY_DEFAULT
           
static byte[] KEY_MIFARE_APPLICATION_DIRECTORY
           
static byte[] KEY_NFC_FORUM
           
static int SIZE_1K
           
static int SIZE_2K
           
static int SIZE_4K
           
static int SIZE_MINI
           
static int TYPE_CLASSIC
           
static int TYPE_PLUS
           
static int TYPE_PRO
           
static int TYPE_UNKNOWN
           
 
Method Summary
 boolean authenticateSectorWithKeyA(int sectorIndex, byte[] key)
           
 boolean authenticateSectorWithKeyB(int sectorIndex, byte[] key)
           
 int blockToSector(int blockIndex)
           
 void close()
           
 void connect()
           
 void decrement(int blockIndex, int value)
           
static MifareClassic get(Tag tag)
           
 int getBlockCount()
           
 int getBlockCountInSector(int sectorIndex)
           
 int getMaxTransceiveLength()
           
 int getSectorCount()
           
 int getSize()
           
 Tag getTag()
           
 int getTimeout()
           
 int getType()
           
 void increment(int blockIndex, int value)
           
 boolean isConnected()
           
 byte[] readBlock(int blockIndex)
           
 void restore(int blockIndex)
           
 int sectorToBlock(int sectorIndex)
           
 void setTimeout(int timeout)
           
 byte[] transceive(byte[] data)
           
 void transfer(int blockIndex)
           
 void writeBlock(int blockIndex, byte[] data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_DEFAULT

public static final byte[] KEY_DEFAULT

KEY_MIFARE_APPLICATION_DIRECTORY

public static final byte[] KEY_MIFARE_APPLICATION_DIRECTORY

KEY_NFC_FORUM

public static final byte[] KEY_NFC_FORUM

TYPE_UNKNOWN

public static final int TYPE_UNKNOWN
See Also:
Constant Field Values

TYPE_CLASSIC

public static final int TYPE_CLASSIC
See Also:
Constant Field Values

TYPE_PLUS

public static final int TYPE_PLUS
See Also:
Constant Field Values

TYPE_PRO

public static final int TYPE_PRO
See Also:
Constant Field Values

SIZE_1K

public static final int SIZE_1K
See Also:
Constant Field Values

SIZE_2K

public static final int SIZE_2K
See Also:
Constant Field Values

SIZE_4K

public static final int SIZE_4K
See Also:
Constant Field Values

SIZE_MINI

public static final int SIZE_MINI
See Also:
Constant Field Values

BLOCK_SIZE

public static final int BLOCK_SIZE
See Also:
Constant Field Values
Method Detail

get

public static MifareClassic get(Tag tag)

getType

public int getType()

getSize

public int getSize()

getSectorCount

public int getSectorCount()

getBlockCount

public int getBlockCount()

getBlockCountInSector

public int getBlockCountInSector(int sectorIndex)

blockToSector

public int blockToSector(int blockIndex)

sectorToBlock

public int sectorToBlock(int sectorIndex)

authenticateSectorWithKeyA

public boolean authenticateSectorWithKeyA(int sectorIndex,
                                          byte[] key)
                                   throws IOException
Throws:
IOException

authenticateSectorWithKeyB

public boolean authenticateSectorWithKeyB(int sectorIndex,
                                          byte[] key)
                                   throws IOException
Throws:
IOException

readBlock

public byte[] readBlock(int blockIndex)
                 throws IOException
Throws:
IOException

writeBlock

public void writeBlock(int blockIndex,
                       byte[] data)
                throws IOException
Throws:
IOException

increment

public void increment(int blockIndex,
                      int value)
               throws IOException
Throws:
IOException

decrement

public void decrement(int blockIndex,
                      int value)
               throws IOException
Throws:
IOException

transfer

public void transfer(int blockIndex)
              throws IOException
Throws:
IOException

restore

public void restore(int blockIndex)
             throws IOException
Throws:
IOException

transceive

public byte[] transceive(byte[] data)
                  throws IOException
Throws:
IOException

getMaxTransceiveLength

public int getMaxTransceiveLength()

setTimeout

public void setTimeout(int timeout)

getTimeout

public int getTimeout()

getTag

public Tag getTag()
Specified by:
getTag in interface TagTechnology

isConnected

public boolean isConnected()
Specified by:
isConnected in interface TagTechnology

connect

public void connect()
             throws IOException
Specified by:
connect in interface TagTechnology
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface TagTechnology
Specified by:
close in interface Closeable
Throws:
IOException


Copyright © 2008-2012. All Rights Reserved.