OSDN Git Service

Make MifareClassic methods more consistent.
authorNick Pelly <npelly@google.com>
Sat, 22 Jan 2011 06:11:29 +0000 (22:11 -0800)
committerNick Pelly <npelly@google.com>
Mon, 24 Jan 2011 05:32:57 +0000 (21:32 -0800)
commite45083b11bef915f713379fb4106dd2ebd897d03
tree4035d2404621c0ddc9002eb59233b7c5fa5d0ead
parentdc54a8c742e96d6ea8ef3e18c0f2ee1235899599
Make MifareClassic methods more consistent.

Remove method overloading for combinations of sector+block addressing.
Instead provide methods that more closly match the raw commands, and more
efficient helpers to convert between blocks and sectors.

o fix off-by-one bug in getBlockCountInSector()
o add BLOCK_SIZE
o remove DESFIRE not operating in classic emulation (SAK 0x20)
o hide isEmulated(), there is no use case, and the info is available elsewhere
o getTotalBlockCount() -> getBlockCount()
o getBlockCount(int) -> getBlockCountInSector(int)
o introduce blockToSector() and sectorToBlock()
o remove authenticateBlock()
    make it really clear that authentication is per sector, and reduce function
    explosion. blockToSector() allows you to use authenticateSector...
o explicit authenticateSectorWithKeyA() / authenticateSectorWithKeyB()
    get rid of magic boolean
o remove all (int sector, int block) parameters
    always address by absolute block. this makes the API crystal clear, and
    helps reduce function explosion
o validation of all sector and block indices
o dont & 0xff when converting to byte - its redundant
o Remove TYPE_OTHER. Mifare Classic types are well-known and stable.

Change-Id: I3c9f8254ff307f31b388b3d7592c862d5de6afa5
api/current.xml
core/java/android/nfc/tech/MifareClassic.java