Skip to content

Latest commit

 

History

History
158 lines (108 loc) · 3 KB

File metadata and controls

158 lines (108 loc) · 3 KB

Mifare Card Operation

To check the mifare operation code sample, please refer to the mifare_card branch.

Blow introduce how to transmit datas on the different mifare cards and pos.There are three typr mifare card - Mifare Classic, Mifare Ultralight, Mifare Desfire.

1.Mifare Classic

1).poll on Card

pos.activateMifareCard(int timeout)
//callback
onActivateMifareCardResult(Hashtable<String, String> arg0)

2).Verify Key A/B

pos.authenticateMifareCard(MifareCardType cardType,String keyType,String block,String keyValue,int timeout)
//callback
onAuthenticateMifareCardResult(boolean arg0)

3).Operate Card

  • Add
pos.increaseValue(String block,String data,int timeout)
//callback
onIncreaseValueResult(boolean result)
  • Reduce
pos.decreaseValue(String block,String data,int timeout)
//callback
onDecreaseValueResult(boolean result)
  • Read Value
pos.readMifareValue(String block,int timeout)
//callback
onReadMifareValueResult(int flag)
  • Read Block
pos.readMifareBlock(MifareCardType cardType,String block,int timeout)
//callback
onReadMifareBlockResult(String flag)
  • Write Value
pos.writeMifareValue(String block,int value,int timeout)
//callback
onWriteMifareValueResult(boolean flag)
  • Write Block
pos.writeMifareBlock(MifareCardType cardType,String block,String data,int timeout)
//callback
onWriteMifareBlockResult(boolean arg0)
  • Transfer Block
pos.transferBlock(String block)
//callback
onTransferValueResult(boolean flag)

4).Finish

pos.deactivateMifareCard(int timeout)
//callback
onDeactivateMifareCardResult(boolean arg0)

2.Mifare Ultralight

The Ultralight card most operate is same with the classic card, except some part is different.

  1. It don't need to use key A/B to verify, just verify the data.
  2. It don't have the Add/Reduce/Restore operation,but can read and write data.
  3. It have a special method to read data.
pos.fastReadMifareCardData(String startBlock,String endBlock,int timeout)
//callback
getMifareFastReadData(Hashtable<String, String> flag)
  1. For write and read mifare block, it has different callback:
  • Read Block
pos.readMifareBlock(MifareCardType cardType,String block,int timeout)
//callback
getMifareReadData(Hashtable<String, String> flag)
  • Write Block
pos.readMifareBlock(MifareCardType cardType,String block,int timeout)
//callback
writeMifareULData(String flag)

3.Mifare Desfire

  1. Power on card
pos.powerOnNFC(int isEncrypt, int timeout)
//callback
onReturnPowerOnNFCResult(boolean result, QPOSService.CardsType cardType, String atr, int atrLen)
  1. Send apdu data
pos.sendApduByNFC(String apduString, int timeout)
//callback
onReturnNFCApduResult(boolean result, String apdu, int apduLen) 
  1. Power off card
pos.powerOffNFC(int timeout)
//callback
onReturnPowerOffNFCResult(boolean result)