射频IC卡读卡器,RFID读写器,读写模块产品研发定制和销售,软件定制服务。我们的目标:一流的产品,五星级服务!对客户的需求做出快速响应。
企业使用员工卡登录计算机配置
Windows智能卡登录系统
WEB与发卡器
WEB浏览器与UHF超高频读卡器
WEB读卡器 IC卡(NFC)发卡器
PLC读卡器 IC卡模块
安卓读卡器 UHF读卡器
PCSC读卡器 智能卡登录
新闻搜索
 
最新新闻
1  如何配置刷卡登录电脑
2  插卡登录拔卡锁屏
3  在web页面实现智能
4  关于IC卡密钥理解和
5  BS架构下NFC读写
6  关于IC卡密钥理解和
7  如何配置NFC读卡器
8  企业使用员工卡登录计
9  Java JNI调用
10  Windows智能卡
热门新闻 点击
 友我科技推出新一代农 182014
 友我科技RFID读写 178505
 友我科技发布PC/S 178410
 友我科技RFID产品 115160
 射频IC卡和IC卡读 77857
 射频卡读写模块选购指 61039
 友我科技PCSC双界 51422
 ISO14443 I 26474
 射频卡读写器发卡器介 23808
 接触式IC卡接口原理 18976
产品推荐
暂 无 最 新 图 文
     新 闻 中 心
Java JNI调用IC卡读卡器
双击自动滚屏 发布者:YOWO 发布时间: 阅读:2303

Java调用IC卡读卡器的DLL一般有以下2种方式:

1.使用JNative第三方库调用IC卡读卡器dll的接口.

2.使用JNI调用IC卡读卡器dll的接口.


JNative调用IC卡读卡器dll很方便,只要知道接口名称和参数类型即可调用, 缺点是仅支持32位的程序, 不支持64位。


JNI调用IC卡读卡器的DLL,既支持64位程序也支持32位程序, 调用也非常方便,下面将介绍JNI调用IC卡读卡器DLL的方式。

对于经常使用的普通IC卡为例, 首先声明相关的api接口:

public native int YW_USBHIDInitial();

public native int YW_USBHIDFree();

public native int YW_Buzzer(int ReaderID,int Time_ON, int Time_OFF, int Cycle);

public native int YW_Led(int ReaderID,int LEDIndex, int Time_ON, int Time_OFF, int Cycle, int LedIndexOn);

public native int YW_AntennaStatus(int ReaderID,boolean Status);

public native int YW_SearchCardMode(int ReaderID,int Mode);

public native int YW_RequestCard(int ReaderID,int RequestMode, short CardType[]);

public native int YW_AntiCollide(int ReaderID, byte LenSNO[], byte SNO[]);

public native int YW_CardSelect(int ReaderID,byte LenSNO, byte SNO[]);

public native int YW_DownLoadKey(int ReaderID,int KeyIndex, byte Key[]);

public native int YW_KeyDown_Authorization(int ReaderID,int KeyMode, int BlockAddr, byte KeyIndex);

public native int YW_KeyAuthorization(int ReaderID,int KeyMode, int BlockAddr, byte[]Key);

public native int YW_ReadaBlock(int ReaderID,int BlockAddr, int LenData, byte pData[]);

public native int YW_WriteaBlock(int ReaderID,int BlockAddr, int LenData, byte pData[]);

public native int YW_Purse_Initial(int ReaderID,int BlockAddr, int IniMoney);

public native int YW_Purse_Read(int ReaderID,int BlockAddr,  int Money[]); 

public native int YW_Purse_Decrease(int ReaderID,int BlockAddr, int Decrement);

public native int YW_Purse_Charge(int ReaderID,int BlockAddr, int Charge);

public native int YW_CardHalt(int ReaderID);

public native int YW_Restore(int ReaderID,int BlockAddr);

public native int YW_Transfer(int ReaderID,int BlockAddr);

public native int YW_AntiCollideAndSelect(int ReaderID,byte ReturnMode,  byte CardMem[],  byte SNLen[], byte SN[]);


然后静态装载dll,64位程序装载64位的dll,32位装载32位的dll。

static {

System.loadLibrary("YW60X-32");

}


经过以上声明后,就可以直接调用接口了,如:

YOWORFID rfidreader = new YOWORFID();

rfidreader.YW_USBHIDInitial();

int rt =0;

rt =rfidreader.YW_RequestCard(ReaderID,Requestmode,Cardtype);

rt = rfidreader.YW_AntiCollide(ReaderID,LenSn,CardNo);

HexToStr(CardNo,LenSn[0]);

rt =rfidreader.YW_CardSelect(ReaderID,LenSn[0],CardNo);

rt =rfidreader.YW_KeyAuthorization(ReaderID,96,4,Key);

System.out.printf("KeyAuthorization=%d",rt);System.out.println();

rt =rfidreader.YW_ReadaBlock(ReaderID,4,16,BlockData);

System.out.printf("YW_ReadaBlock=%d",rt);System.out.println();

if(rt>0){HexToStr(BlockData,16);}

rfidreader.YW_Led(ReaderID,1,1,1,3,0);

rfidreader.YW_USBHIDFree();

以下java代码例子包含了读卡和写卡的,可以使用32位或者64的dll,Java JNI调用IC卡读卡器例程



相关产品

最新RFID读写器产品手册
RFID读写器SDK开发包
USB射频卡RFID读写器YW-605-USB
串口射频卡RFID读写器YW-605-RS232
NFC读写器YW-607

打印本页 || 关闭窗口
企业简介||付款方式||网站地图||友情连接||联系我们

RFID读写器,IC卡读卡器, 智能卡读卡器,RFID读卡器, 电子标签,CPU卡读写器,读卡模块
北京友我科技有限公司 版权所有 (C)2008-2020
客户服务中心信箱:coodor#126.com(将#改为@)
热线直拨: 010-57049038 18910685939 QQ:2718497571,1403463073, 896163157
京ICP备14016005号
微信扫一扫联系我们

微信扫一扫联系我们

友我科技


1
RFID读写器产品手册下载
2
读写器开发SDK下载
3
点击联系友我科技
4
点击联系友我科技
5
WEB读卡器开发指南
6
Windows读卡器开发指南
7
Android读卡器开发指南
8
Wince读卡器开发指南
9
PLC读卡器开发指南
10
Linux读卡器开发指南
11
单片机读卡器开发指南
12
PCSC读卡器开发指南