public class RFIDWithISO14443A extends RFIDBase implements IRFIDWithISO14443A
注意:
Attention:
1、使用前请确认您的机器已安装此模块。
1. Make sure this module is installed before using your device.
2、要正常使用模块需要在\libs\armeabi\目录放置libDeviceAPI.so文件
2. Put libDeviceAPI.so file in directory \libs\armeabi\ then module can be used normally.
3、在操作设备前需要调用 RFIDBase.init()
打开设备,使用完后调用 RFIDBase.free()
关闭设备
3. call RFIDBase.init()
to switch on device before operating device, call RFIDBase.free()
to switch off device after using.
Modifier and Type | Class and Description |
---|---|
static class |
RFIDWithISO14443A.DESFireEncryptionTypekEnum
DESFire卡加密类型
DESFire card encyption type |
static class |
RFIDWithISO14443A.DESFireFileTypekEnum
DESFire卡文件类型
DESFire card file typr |
static class |
RFIDWithISO14443A.KeyType
密钥类型,适用于S50和S70标签。
key type, used for S50 and S70 tags. |
static class |
RFIDWithISO14443A.TagType
M1标签类型定义
M1 tag type definition |
Modifier and Type | Method and Description |
---|---|
boolean |
DESFire_AddApp(java.lang.String hexAppId,
int keySetting,
int fileNums)
Desfire卡 创建应用
Desfire card create application |
boolean |
DESFire_AddStdFile(int fileNo,
int commSet,
char[] accessRight,
int fileSize)
Desfire卡 创建标准数据文件
Desfire card create standard data file |
boolean |
DESFire_AddValueFile(int fileNo,
int commSet,
char[] accessRights,
int minValue,
int maxValue,
int initValue)
Desfire卡 创建值文件
Desfire card create values file |
boolean |
DESFire_Auth(int keyNo,
java.lang.String key)
Desfire卡 验证密钥
Desfire card verify key |
boolean |
DESFire_ChangeFileSetting(int fileNo,
int commSet,
char[] accessRights)
Desfire卡 获取文件设置
Desfire card acquire file setup |
boolean |
DESFire_ChangeKey(int keyNo,
java.lang.String newKey)
Desfire卡 更改密钥
Desfire card change key |
boolean |
DESFire_ChangeKeySetting(int keySetting)
Desfire卡 更改密钥设置
Desfire card change key setup |
boolean |
DESFire_CreditValueFile(int fileNo,
int value)
Desfire卡 充值函数
Desfire card recharge formula |
boolean |
DESFire_DebitValueFile(int fileNo,
int value)
Desfire卡 扣费函数
Desfire card deduction formula |
boolean |
DESFire_DelApp(java.lang.String hexAppId)
Desfire卡 删除应用
Desfire card delete application |
boolean |
DESFire_DelFile(int fileNo)
Desfire卡 删除文件
Desfire card delete file |
boolean |
DESFire_FormatCard()
Desfire卡 格式化卡片
Desfire card format card |
java.lang.String[] |
DESFire_GetApps()
Desfire卡 获取所有应用
Desfire card acquire all application |
int[] |
DESFire_GetFileIds()
Desfire卡 获取应用所有文件ID
Desfire card acquire application all file ID |
java.util.List<DESFireFile> |
DESFire_GetFiles()
Desfire卡 获取应用所有文件
Desfire card acquire all files of application |
byte[] |
DESFire_GetFileSetting(int fileNo)
Desfire卡 获取文件设置
Desfire card acquire file setup |
int[] |
DESFire_GetKeySetting()
Desfire卡 获取密钥设置信息
Desfire card acquire key setup infor |
java.lang.String[] |
DESFire_GetPiccInfo()
Desfire卡 获取卡片信息
Desfire card acquire card infor |
boolean |
DESFire_RatsAndPss()
Desfire卡 进入14443A协议的第4层,获取通讯参数
Desfire card enter 4th level of 14443A protocol, acquire communication parameter |
char[] |
DESFire_ReadStdFile(int fileNo,
int offSet,
int dataSize)
Desfire卡 读标准文件数据
Desfire card read standard file data |
int[] |
DESFire_ReadValueFile(int fileNo)
Desfire卡 获取值文件内容
Desfire card acquire values file content |
boolean |
DESFire_SelApp(java.lang.String hexAppId)
Desfire卡 选择应用
Desfire card select application |
void |
DESFire_selCpy(int cpyType)
选择加密类型
select encryption type |
boolean |
DESFire_WriteStdFile(int fileNo,
int offSet,
int dataSize,
char[] dataBuf)
Desfire卡 写标准文件数据
Desfire card write standard file data |
static RFIDWithISO14443A |
getInstance()
获取ISO14443A协议操作实例
Acquire ISO14443A protocol operation Instance |
int |
getIntegerSomeBit(int resource,
int mask)
取整数的某一位
get one place of integer |
boolean |
ISO14443A_decrement(int iBlockValue,
int iBlockResult,
int iValue) |
boolean |
ISO14443A_increment(int iBlockValue,
int iBlockResult,
int iValue)
电子钱包充值
E-wallet charge |
boolean |
ISO14443A_initval(int iBlock,
int iValue)
电子钱包初始化
E-wallet initialize |
int[] |
ISO14443A_readval(int iBlock)
读取电子钱包余额 传入参数
read E-wallet balance |
char[] |
M1_ReadData(int sector,
int block)
读取指定扇区指定block的数据,适用于S50和S70标签。使用此函数的时候,要确保该扇区密钥验证已通过。
Read data in specified block of specified sector, used for S50 and S70 tag. |
boolean |
M1_WriteData(int sector,
int block,
java.lang.String hexData)
向指定的扇区的Block 写入数据,适用于S50和S70标签。使用此函数的时候,要确保该扇区密钥验证已通过。
Write data in specified sector of block, used for S50 and S70 tag. |
SimpleRFIDEntity |
read(int block)
读卡,适用于Urltra light标签
card reading, used for Urltra light tag |
SimpleRFIDEntity |
read(java.lang.String key,
RFIDWithISO14443A.KeyType keyType,
int sector,
int block)
读卡,此函数包含寻卡和验证密钥步骤
Read card, this formula includes card search and key verfication procedure |
SimpleRFIDEntity |
readAllData(java.lang.String key,
RFIDWithISO14443A.TagType tagType)
读卡,读取卡片所有块中的数据
Card reading, read data of all blocks in the card |
SimpleRFIDEntity |
request()
寻卡
Search card |
char[] |
sendBusCMD(char[] time,
char[] uid,
int uidnum,
int flag)
/**
墨西哥公交命令
Mexico bus commande |
byte[] |
unvarnished_transfer(byte[] sendData) |
boolean |
VerifySector(int sector,
java.lang.String key,
RFIDWithISO14443A.KeyType keyType)
验证扇区。S50和S70标签需要使用到此函数。密钥验证通过才可对该扇区进行读写操作。
verificate sector. |
boolean |
write(int block,
java.lang.String hexData)
写卡,适用于Urltra light标签
Card writing, used for Urltra light tag |
boolean |
write(java.lang.String key,
RFIDWithISO14443A.KeyType keyType,
int sector,
int block,
java.lang.String hexData)
写卡,此函数包括寻卡和密钥验证异常
Card writing, this formula includes card searching and key verification err |
free, getVersion, init, init, isPowerOn, rfidUpgrade
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
free, getVersion, init, init, isPowerOn, rfidUpgrade
public static RFIDWithISO14443A getInstance() throws ConfigurationException
ConfigurationException
- 配置错误异常public SimpleRFIDEntity request()
request
in interface IRFIDWithISO14443A
public SimpleRFIDEntity read(java.lang.String key, RFIDWithISO14443A.KeyType keyType, int sector, int block) throws RFIDVerificationException, RFIDReadFailureException
read
in interface IRFIDWithISO14443A
key
- 密钥keyType
- 密钥类型sector
- 扇区block
- 块区RFIDVerificationException
- 密钥验证失败异常RFIDReadFailureException
- 读卡失败异常public SimpleRFIDEntity readAllData(java.lang.String key, RFIDWithISO14443A.TagType tagType) throws RFIDVerificationException, RFIDReadFailureException
readAllData
in interface IRFIDWithISO14443A
key
- 密钥tagType
- 卡片类型RFIDVerificationException
- 密钥验证失败异常RFIDReadFailureException
- 读卡失败异常public SimpleRFIDEntity read(int block) throws RFIDReadFailureException
read
in interface IRFIDWithISO14443A
block
- RFIDReadFailureException
- 读卡失败异常public boolean write(java.lang.String key, RFIDWithISO14443A.KeyType keyType, int sector, int block, java.lang.String hexData) throws RFIDVerificationException, RFIDNotFoundException
write
in interface IRFIDWithISO14443A
key
- 密钥keyType
- 密钥类型sector
- 扇区block
- 块区hexData
- 十六进制数据RFIDVerificationException
- 密钥验证失败异常RFIDNotFoundException
- 寻卡失败异常public boolean write(int block, java.lang.String hexData) throws RFIDNotFoundException
write
in interface IRFIDWithISO14443A
block
- 块区hexData
- 十六进制数据RFIDVerificationException
- 密钥验证失败异常RFIDNotFoundException
- 寻卡失败异常public boolean VerifySector(int sector, java.lang.String key, RFIDWithISO14443A.KeyType keyType)
VerifySector
in interface IRFIDWithISO14443A
sector
- S50标签扇区取值范围:0 ~ 15 ; S70标签扇区取值范围:0 ~ 39key
- 密钥:12个十六进制数keyType
- 密钥类型public char[] M1_ReadData(int sector, int block) throws RFIDReadFailureException
M1_ReadData
in interface IRFIDWithISO14443A
sector
- block
- RFIDReadFailureException
public boolean M1_WriteData(int sector, int block, java.lang.String hexData)
M1_WriteData
in interface IRFIDWithISO14443A
sector
- block
- hexData
- 16进制字符串public boolean DESFire_RatsAndPss()
DESFire_RatsAndPss
in interface IRFIDWithISO14443A
public int[] DESFire_GetKeySetting()
DESFire_GetKeySetting
in interface IRFIDWithISO14443A
public boolean DESFire_ChangeKeySetting(int keySetting)
DESFire_ChangeKeySetting
in interface IRFIDWithISO14443A
keySetting
- 密钥设置信息public int getIntegerSomeBit(int resource, int mask)
getIntegerSomeBit
in interface IRFIDWithISO14443A
resource
- 要取某一位的整数mask
- 要取的位置索引,自右至左为0-7public boolean DESFire_SelApp(java.lang.String hexAppId)
DESFire_SelApp
in interface IRFIDWithISO14443A
hexAppId
- 应用ID,十六进制字符串public boolean DESFire_Auth(int keyNo, java.lang.String key)
DESFire_Auth
in interface IRFIDWithISO14443A
keyNo
- 密钥号key
- 密钥public void DESFire_selCpy(int cpyType)
DESFire_selCpy
in interface IRFIDWithISO14443A
cpyType
- 0x01(AES),0x02(DES)public boolean DESFire_ChangeKey(int keyNo, java.lang.String newKey)
DESFire_ChangeKey
in interface IRFIDWithISO14443A
keyNo
- 密钥号newKey
- 密钥public java.lang.String[] DESFire_GetApps()
DESFire_GetApps
in interface IRFIDWithISO14443A
public boolean DESFire_DelApp(java.lang.String hexAppId)
DESFire_DelApp
in interface IRFIDWithISO14443A
hexAppId
- 应用ID,十六进制字符串public boolean DESFire_FormatCard()
DESFire_FormatCard
in interface IRFIDWithISO14443A
public java.lang.String[] DESFire_GetPiccInfo()
DESFire_GetPiccInfo
in interface IRFIDWithISO14443A
public boolean DESFire_AddApp(java.lang.String hexAppId, int keySetting, int fileNums)
DESFire_AddApp
in interface IRFIDWithISO14443A
hexAppId
- 应用ID,十六进制字符串keySetting
- 密钥设置fileNums
- 所包含的文件数public int[] DESFire_GetFileIds()
DESFire_GetFileIds
in interface IRFIDWithISO14443A
public java.util.List<DESFireFile> DESFire_GetFiles()
DESFire_GetFiles
in interface IRFIDWithISO14443A
public byte[] DESFire_GetFileSetting(int fileNo)
DESFire_GetFileSetting
in interface IRFIDWithISO14443A
fileNo
- 文件号public boolean DESFire_ChangeFileSetting(int fileNo, int commSet, char[] accessRights)
DESFire_ChangeFileSetting
in interface IRFIDWithISO14443A
fileNo
- 文件号commSet
- 通讯设置accessRights
- 存取权限public boolean DESFire_DelFile(int fileNo)
DESFire_DelFile
in interface IRFIDWithISO14443A
fileNo
- 文件号public boolean DESFire_AddStdFile(int fileNo, int commSet, char[] accessRight, int fileSize)
DESFire_AddStdFile
in interface IRFIDWithISO14443A
fileNo
- 文件号commSet
- 通讯设置accessRight
- 存取权限fileSize
- 文件大小public boolean DESFire_WriteStdFile(int fileNo, int offSet, int dataSize, char[] dataBuf)
DESFire_WriteStdFile
in interface IRFIDWithISO14443A
fileNo
- 文件号offSet
- 起始位置偏移量dataSize
- 数据大小dataBuf
- 数据,1~200个字节public char[] DESFire_ReadStdFile(int fileNo, int offSet, int dataSize)
DESFire_ReadStdFile
in interface IRFIDWithISO14443A
fileNo
- 文件号offSet
- 起始位置偏移量dataSize
- 数据大小public boolean DESFire_AddValueFile(int fileNo, int commSet, char[] accessRights, int minValue, int maxValue, int initValue)
DESFire_AddValueFile
in interface IRFIDWithISO14443A
fileNo
- 文件号commSet
- 通讯设置accessRights
- 存取权限minValue
- 最小值maxValue
- 最大值initValue
- 初始值public int[] DESFire_ReadValueFile(int fileNo)
DESFire_ReadValueFile
in interface IRFIDWithISO14443A
fileNo
- 文件号public boolean DESFire_CreditValueFile(int fileNo, int value)
DESFire_CreditValueFile
in interface IRFIDWithISO14443A
fileNo
- 文件号value
- 充入的值public boolean DESFire_DebitValueFile(int fileNo, int value)
DESFire_DebitValueFile
in interface IRFIDWithISO14443A
fileNo
- 文件号value
- 扣除的值public boolean ISO14443A_increment(int iBlockValue, int iBlockResult, int iValue)
ISO14443A_increment
in interface IRFIDWithISO14443A
iBlockValue
- 当前金额所在块iBlockResult
- 充值后剩余金额保存的块iValue
- 金额返回值:0为成功,非0为失败状态码public boolean ISO14443A_decrement(int iBlockValue, int iBlockResult, int iValue)
ISO14443A_decrement
in interface IRFIDWithISO14443A
public boolean ISO14443A_initval(int iBlock, int iValue)
ISO14443A_initval
in interface IRFIDWithISO14443A
iBlock
- 要写入数据的绝对块号 块号范围 0~63iValue
- 初始金额public int[] ISO14443A_readval(int iBlock)
ISO14443A_readval
in interface IRFIDWithISO14443A
iBlock
- iBlock要读取数据的绝对块号 块号范围 0~63public char[] sendBusCMD(char[] time, char[] uid, int uidnum, int flag)
sendBusCMD
in interface IRFIDWithISO14443A
time
- 时分秒,3字节time
- hrs. 3 bytesuid
- 卡号缓存uid
- card number cacheuidnum
- 卡号 数量uidnum
- card number amountflag
- 0:无上下车信息, 1: 上车 ,2 :下车flag
- 0: no data of get on and off, 1: get on, 2: get offpublic byte[] unvarnished_transfer(byte[] sendData)
unvarnished_transfer
in interface IRFIDWithISO14443A