public class RFIDWithISO14443A
extends java.lang.Object
注意:
1、使用前请确认您的机器已安装此模块。
2、要正常使用模块需要在\libs\armeabi\目录放置libDeviceAPI.so文件
3、在操作设备前需要调用 init()
打开设备,使用完后调用 free()
关闭设备
RFID module ISO1443A protocol class
Note:
1, Please confirm that your machine has installed this module before use.
2, For the normal use of the module need to place the libDeviceAPI.so file under below path :\ libs \ armeabi \ directory.
3, in the operation of the device before the need to call b> open the device, use the call b> /> to close the device.
限定符和类型 | 类和说明 |
---|---|
static class |
RFIDWithISO14443A.DESFireEncryptionTypekEnum
DESFire卡加密类型
DESFire card Encryption type |
static class |
RFIDWithISO14443A.DESFireFileTypekEnum
DESFire卡文件类型
DESFire card file type |
static class |
RFIDWithISO14443A.KeyType
密钥类型,适用于S50和S70标签
Key type, used for S50 and S70 tag. |
static class |
RFIDWithISO14443A.TagType
M1标签类型定义
M1 tag type defination |
限定符和类型 | 方法和说明 |
---|---|
boolean |
DESFire_AddApp(java.lang.String hexAppId,
int keySetting,
int fileNums)
Desfire卡 创建应用
Desfire card, add app. |
boolean |
DESFire_AddStdFile(int fileNo,
int commSet,
char[] accessRight,
int fileSize)
Desfire卡 创建标准数据文件
Desfire card. add standard data file |
boolean |
DESFire_AddValueFile(int fileNo,
int commSet,
char[] accessRights,
int minValue,
int maxValue,
int initValue)
Desfire卡 创建值文件
Desfire card, add value file |
boolean |
DESFire_Auth(int keyNo,
java.lang.String key)
Desfire卡 验证密钥
Desfire card key verification |
boolean |
DESFire_ChangeFileSetting(int fileNo,
int commSet,
char[] accessRights)
Desfire卡 获取文件设置
Desfire card, get file settings |
boolean |
DESFire_ChangeKey(int keyNo,
java.lang.String newKey)
Desfire卡 更改密钥
Desfire card , change key |
boolean |
DESFire_ChangeKeySetting(int keySetting)
Desfire卡 更改密钥设置
Desfire card, change key settings |
boolean |
DESFire_CreditValueFile(int fileNo,
int value)
Desfire卡 充值函数
Desfire card Credit value index |
boolean |
DESFire_DebitValueFile(int fileNo,
int value)
Desfire卡 扣费函数
Desfure card, Debit index |
boolean |
DESFire_DelApp(java.lang.String hexAppId)
Desfire卡 删除应用
Desfire card , delete apps |
boolean |
DESFire_DelFile(int fileNo)
Desfire卡 删除文件
Desfire card. delete files |
boolean |
DESFire_FormatCard()
Desfire卡 格式化卡片
Desfire card, format card |
java.lang.String[] |
DESFire_GetApps()
Desfire卡 获取所有应用
Desfire card, get apps |
int[] |
DESFire_GetFileIds()
Desfire卡 获取应用所有文件ID
Desfire card, get all file IDs |
java.util.List<DESFireFile> |
DESFire_GetFiles()
Desfire卡 获取应用所有文件
Desfire card, get all app files. |
byte[] |
DESFire_GetFileSetting(int fileNo)
Desfire卡 获取文件设置
Desfire card , get file settings |
int[] |
DESFire_GetKeySetting()
Desfire卡 获取密钥设置信息
Desfire card, get key setting information |
java.lang.String[] |
DESFire_GetPiccInfo()
Desfire卡 获取卡片信息
Desfire card, get card info. |
boolean |
DESFire_RatsAndPss()
Desfire卡 进入14443A协议的第4层,获取通讯参数
Desfire card, Level 4 for ISO1443A,get 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, read value file content |
boolean |
DESFire_SelApp(java.lang.String hexAppId)
Desfire卡 选择应用
Applcation selection |
void |
DESFire_selCpy(int cpyType)
选择加密类型
Encrytion type selection. |
boolean |
DESFire_WriteStdFile(int fileNo,
int offSet,
int dataSize,
char[] dataBuf)
Desfire卡 写标准文件数据
Desfire card, write standard file data |
boolean |
free()
释放rfid模块
Release the RFID module |
static RFIDWithISO14443A |
getInstance()
获取ISO14443A协议操作实例
Get ISO1443A protocol instance. |
int |
getIntegerSomeBit(int resource,
int mask)
取整数的某一位
Take a bit of an integer |
java.lang.String |
getVersion()
已过时。
|
boolean |
init()
初始化rfid模块
Initialize RFID module |
boolean |
ISO14443A_decrement(int iBlockValue,
int iBlockResult,
int iValue) |
boolean |
ISO14443A_increment(int iBlockValue,
int iBlockResult,
int iValue)
电子钱包充值
Increment |
boolean |
ISO14443A_initval(int iBlock,
int iValue)
电子钱包初始化
Initialize the E-wallet. |
int[] |
ISO14443A_readval(int iBlock)
读取电子钱包余额
Read the value of E-wallet. |
boolean |
isPowerOn()
判断设备是否上电
Detect whether device is powered on or not. |
char[] |
M1_ReadData(int sector,
int block)
读取指定扇区指定block的数据,适用于S50和S70标签。
|
SimpleRFIDEntity |
read(int block)
读卡,适用于Urltra light标签
Read cadr, used for Urltra light tags |
SimpleRFIDEntity |
read(java.lang.String key,
RFIDWithISO14443A.KeyType keyType,
int sector,
int block)
读卡,此函数包含寻卡和验证密钥步骤
Read card,includes find card and key verification steps. |
SimpleRFIDEntity |
readAllData(java.lang.String key,
RFIDWithISO14443A.TagType tagType)
读卡,读取卡片所有块中的数据
Read card. read all blocks data |
SimpleRFIDEntity |
request()
寻卡
Find card |
boolean |
rfidUpgrade(int packageCount,
int index,
int currSize,
byte[] data)
固件升级
RFID firmware upgrade |
char[] |
sendBusCMD(char[] time,
char[] uid,
int uidnum,
int flag)
墨西哥公交命令
Commands for Mexcico Bus. |
boolean |
VerifySector(int sector,
java.lang.String key,
RFIDWithISO14443A.KeyType keyType)
验证扇区。
|
boolean |
write(int block,
java.lang.String hexData)
写卡,适用于Urltra light标签
Write card, used for Urltra light tag |
boolean |
write(java.lang.String key,
RFIDWithISO14443A.KeyType keyType,
int sector,
int block,
java.lang.String hexData)
写卡,此函数包括寻卡和密钥验证异常
Write card, includes find card and key verification failure exception |
public static RFIDWithISO14443A getInstance() throws ConfigurationException
ConfigurationException
- 配置错误异常public SimpleRFIDEntity request()
public SimpleRFIDEntity read(java.lang.String key, RFIDWithISO14443A.KeyType keyType, int sector, int block) throws RFIDVerificationException, RFIDReadFailureException
key
- 密钥 keyType
- 密钥类型 sector
- 扇区 block
- 块区 RFIDVerificationException
- 密钥验证失败异常RFIDReadFailureException
- 读卡失败异常public SimpleRFIDEntity readAllData(java.lang.String key, RFIDWithISO14443A.TagType tagType) throws RFIDVerificationException, RFIDReadFailureException
key
- 密钥 tagType
- 卡片类型 RFIDVerificationException
- 密钥验证失败异常RFIDReadFailureException
- 读卡失败异常public SimpleRFIDEntity read(int block) throws RFIDReadFailureException
block
- RFIDReadFailureException
- 读卡失败异常public boolean write(java.lang.String key, RFIDWithISO14443A.KeyType keyType, int sector, int block, java.lang.String hexData) throws RFIDVerificationException, RFIDNotFoundException
key
- 密钥 keyType
- 密钥类型 sector
- 扇区 block
- 块区 hexData
- 十六进制数据 RFIDVerificationException
- 密钥验证失败异常RFIDNotFoundException
- 寻卡失败异常public boolean write(int block, java.lang.String hexData) throws RFIDNotFoundException
block
- 块区 hexData
- 十六进制数据 RFIDVerificationException
- 密钥验证失败异常RFIDNotFoundException
- 寻卡失败异常public boolean VerifySector(int sector, java.lang.String key, RFIDWithISO14443A.KeyType keyType)
sector
- S50标签扇区取值范围:0 ~ 15 ; S70标签扇区取值范围:0 ~ 39 key
- 密钥:12个十六进制数keyType
- 密钥类型 public char[] M1_ReadData(int sector, int block) throws RFIDReadFailureException
sector
- 扇区 block
- 数据块 RFIDReadFailureException
public boolean DESFire_RatsAndPss()
public int[] DESFire_GetKeySetting()
public boolean DESFire_ChangeKeySetting(int keySetting)
keySetting
- 密钥设置信息 public int getIntegerSomeBit(int resource, int mask)
resource
- 要取某一位的整数 mask
- 要取的位置索引,自右至左为0-7 public boolean DESFire_SelApp(java.lang.String hexAppId)
appId
- 应用ID,十六进制字符串 public boolean DESFire_Auth(int keyNo, java.lang.String key)
keyNo
- 密钥号 key
- 密钥 public void DESFire_selCpy(int cpyType)
cpyType
- 0x01(AES),0x02(DES)public boolean DESFire_ChangeKey(int keyNo, java.lang.String newKey)
keyNo
- 密钥号 key
- 密钥 public java.lang.String[] DESFire_GetApps()
public boolean DESFire_DelApp(java.lang.String hexAppId)
appId
- 应用ID,十六进制字符串 public boolean DESFire_FormatCard()
public java.lang.String[] DESFire_GetPiccInfo()
public boolean DESFire_AddApp(java.lang.String hexAppId, int keySetting, int fileNums)
hexAppId
- 应用ID,十六进制字符串 keySetting
- 密钥设置 fileNums
- 所包含的文件数
File numbers.public int[] DESFire_GetFileIds()
public java.util.List<DESFireFile> DESFire_GetFiles()
public byte[] DESFire_GetFileSetting(int fileNo)
fileNo
- 文件号 public boolean DESFire_ChangeFileSetting(int fileNo, int commSet, char[] accessRights)
fileNo
- 文件号 commSet
- 通讯设置 accessRights
- 存取权限 public boolean DESFire_DelFile(int fileNo)
fileNo
- 文件号 public boolean DESFire_AddStdFile(int fileNo, int commSet, char[] accessRight, int fileSize)
fileNo
- 文件号 commSet
- 通讯设置 accessRight
- 存取权限 fileSize
- 文件大小 public boolean DESFire_WriteStdFile(int fileNo, int offSet, int dataSize, char[] dataBuf)
fileNo
- 文件号 offSet
- 起始位置偏移量 dataSize
- 数据大小 dataBuf
- 数据,1~200个字节 public char[] DESFire_ReadStdFile(int fileNo, int offSet, int dataSize)
fileNo
- 文件号 offSet
- 起始位置偏移量 dataSize
- 数据大小
Data sizepublic boolean DESFire_AddValueFile(int fileNo, int commSet, char[] accessRights, int minValue, int maxValue, int initValue)
fileNo
- 文件号 commSet
- 通讯设置 accessRights
- 存取权限 minValue
- 最小值 maxValue
- 最大值 initValue
- 初始值 public int[] DESFire_ReadValueFile(int fileNo)
fileNo
- 文件号 public boolean DESFire_CreditValueFile(int fileNo, int value)
fileNo
- 文件号 value
- 充入的值 public boolean DESFire_DebitValueFile(int fileNo, int value)
fileNo
- 文件号 value
- 扣除的值 public boolean ISO14443A_increment(int iBlockValue, int iBlockResult, int iValue)
iBlockValue
- 当前金额所在块 iBlockResult
- 充值后剩余金额保存的块 iValue
- 金额 public boolean ISO14443A_decrement(int iBlockValue, int iBlockResult, int iValue)
public boolean ISO14443A_initval(int iBlock, int iValue)
iBlock
- 要写入数据的绝对块号 块号范围 0~632)iValue
- 初始金额 public int[] ISO14443A_readval(int iBlock)
iBlock
- 要读取数据的绝对块号 块号范围 0~63 public char[] sendBusCMD(char[] time, char[] uid, int uidnum, int flag)
time
- 时分秒,3字节 uid
- 卡号缓存 uidnum
- 卡号 数量 flag
- 0:无上下车信息, 1: 上车 ,2 :下车 public boolean init()
public boolean free()
@Deprecated public java.lang.String getVersion()
public boolean rfidUpgrade(int packageCount, int index, int currSize, byte[] data)
packageCount
- 包的数量 index
- 当前为第几个包 currSize
- 当前包大小 data
- 包数据 public boolean isPowerOn()