RFID读写器函数中java声明中有很多Pointer类型的参数,对于此类参数的调用方法示例如下:
if(NFCReader.YW_SearchCardModeEx(ReaderID, NFCReader.SEARCHMODE_14443A,0)<0)return;
//按照参数的实际大小,声明一个与之对应的大小的Pointer类型
Pointer pCardType = new Pointer(MemoryBlockFactory.createMemoryBlock(2));
if(NFCReader.YW_RequestCard(ReaderID, NFCReader.REQUESTMODE_ALL, pCardType)<0)return;
//CardType 作为short类型,从类型Pointer中取出的办法
CardType = pCardType.getAsShort(0);
Pointer pCardMem = new Pointer(MemoryBlockFactory.createMemoryBlock(1));
Pointer pLengthUID = new Pointer(MemoryBlockFactory.createMemoryBlock(1));
Pointer pUID = new Pointer(MemoryBlockFactory.createMemoryBlock(20));
if(NFCReader.YW_AntiCollideAndSelect(ReaderID,Mode,pCardMem,pLengthUID,pUID)<0)return;
CardMem = pCardMem.getAsByte(0);
LengthUID = pLengthUID.getAsByte(0);
//UID数组从Pointer中取出的办法
UID=pUID.getMemory();
edtS50UID.setText(HexToStr(UID, LengthUID));