⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jiso15693.java

📁 rfid读写器及相关dll(java c++源码)
💻 JAVA
字号:
//package cn.sensevision.rf;

public class JISO15693{
	static {
		System.loadLibrary("JISO15693");
	}
	
	/*
	 * 功能:命令已激活的TYPE_A卡进入HALT状态 
	 * 原型:int RFcrc_16( char offset, char *pointer, int length, int crc16_preset)
	 * 获取标签信息
	 * 返回:成功返回1
	 * 
	 */
	//public native static int RFcrc_16( char offset, char *pointer, int length, int crc16_preset);

	
	/*
	 * 功能:获取标签信息
	 * 原型:int _stdcall Inventory(BYTE Sendval[],BYTE REVval[],bool AFI,int AFIval,int Flag,DWORD &nBytestoRead)
	 * 参数:
	 * Sendval 发送命令字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * REVval 应答字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * AFI 发送命令中是否包含AFI
	 * AFIval AFI 值 (当上一参数为true时有效)
	 * Flag 标志位
	 * nBytestoRead 读到的字节数
	 * 
	 * 返回:成功返回1

	 * 
	 */
	public native static int Inventory(byte Sendval[],byte REVval[],boolean AFI,int AFIval,int Flag,long nBytestoRead);
	
		
	/*
	 * 功能:保持静默
	 * 原型:int _stdcall StayQuite(BYTE Sendval[],BYTE retval[],int Flag,BYTE UID[],DWORD &nBytestoRead)
	 * 参数: 
	 * Sendval 发送命令字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * REVval 应答字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * Flag 标志位
	 * UID 标签ID 
	 *	nBytestoRead 读到的字节数
	 * 返回:成功返回1
	 * 
	 */
	public native static int StayQuite(byte Sendval[],byte REVval[],int Flag,String UID,long nBytestoRead);
	
		
	/*
	 * 功能:选择 
	 * 原型:int _stdcall Select(BYTE Sendval[],BYTE retval[],BYTE UID[],int Flag,DWORD &nBytestoRead)
	 * 参数:
	 * Sendval 发送命令字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * REVval 应答字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * UID 标签ID
	 * Flag 标志位 
	 * nBytestoRead 读到的字节数
	 * 返回:成功返回1
	 * 
	 */
	public native static int Select(byte Sendval[],byte REVval[],String UID,int Flag,long nBytestoRead);
	
		
	/*
	 * 功能:复位设备
	 * 原型:int _stdcall ResetToReady(BYTE Sendval[],BYTE retval[],BYTE UID[],int Flag,DWORD &nBytestoRead);
	 * 参数:
	 * Sendval 发送命令字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * REVval 应答字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * UID 标签ID
	 * Flag 标志位 
	 * nBytestoRead 读到的字节数
	 * 返回:成功返回1
	 * 
	 */
	public native static int ResetToReady(byte Sendval[],byte REVval[],String UID,int Flag,long nBytestoRead);
	
	
		
	/*
	 * 功能:写AFI
	 * 原型:  int _stdcall WriteAFI(BYTE Sendval[],BYTE retval[],int AFIval,int Flag,BYTE UID[],DWORD &nBytestoRead);
	 * 参数:
	 * Sendval 发送命令字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * REVval 应答字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * AFIval AFI 值 
	 * Flag 标志位
	 * UID 标签ID 
	 * nBytestoRead 读到的字节数
	 * 返回:成功返回1

	 * 
	 */
	public native static int WriteAFI(byte Sendval[],byte REVval[],int AFIval,int Flag,String UID,long nBytestoRead);
	
		
	/*
	 * 功能:锁AFI 
	 * 原型: int _stdcall LockAFI(BYTE Sendval[],BYTE retval[],int Flag,BYTE UID[],DWORD &nBytestoRead);
	 * 参数:
	 * Sendval 发送命令字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * REVval 应答字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * Flag 标志位
	 * UID 标签ID 
	 * nBytestoRead 读到的字节数
	 * 返回:成功返回1

	 * 
	 */
	public native static int LockAFI(byte Sendval[],byte REVval[],int Flag,String UID,long nBytestoRead);
	
		
	/*
	 * 功能:读单个Block块 
	 * 原型:int _stdcall ReadSingleBlock(BYTE Sendval[],BYTE retval[],int nBlock,int Flag,BYTE UID[],DWORD &nBytestoRead);
	 * 参数:
	 * Sendval 发送命令字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * REVval 应答字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * nBlock block位
	 * Flag 标志位
	 * UID 标签ID 
	 * nBytestoRead 读到的字节数 
	 * 返回:成功返回1

	 * 
	 */
	public native static int ReadSingleBlock(byte Sendval[],byte REVval[],int nBlock,int Flag,String UID,long nBytestoRead);
	
		
	/*
	 * 功能:写单个Block块
	 * 原型:int _stdcall WriteSingleBlock(BYTE Sendval[],BYTE retval[],int nBlock,BYTE Bval[],BYTE UID[],int Flag,DWORD &nBytestoRead);
	 * 参数:
	 * Sendval 发送命令字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * REVval 应答字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * nBlock block位
	 * AFIval AFI 值 
	 * Flag 标志位
	 * UID 标签ID 
	 * nBytestoRead 读到的字节数
	 * 返回:成功返回1

	 * 
	 */
	public native static int WriteSingleBlock(byte Sendval[],byte REVval[],int nBlock,String Bval,String UID,int Flag,long nBytestoRead);
	
		
	/*
	 * 功能:锁Block模块
	 * 原型:int _stdcall LockBlock(BYTE Sendval[],BYTE retval[],int flag,int nBlock,BYTE UID[],DWORD &nBytestoRead);
	 * 参数:
	 * Sendval 发送命令字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * REVval 应答字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * flag 标志位
	 * nBlock block位
	 * UID 标签ID 
	 * nBytestoRead 读到的字节数 
	 * 返回:成功返回1
	 * 
	 */
	public native static int LockBlock(byte Sendval[],byte REVval[],int flag,int nBlock,String UID,long nBytestoRead);
	
		
	/*
	 * 功能:读取多个block模块
	 * 原型:int _stdcall ReadMultiBlock(BYTE Sendval[],char retval[],BYTE UID[],int nStartBlock,int nLength,int Flag,DWORD &nBytestoRead);
	 * 参数:
	 * Sendval 发送命令字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * REVval 应答字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * UID 标签ID
	 * nStartBlock 起始block位
	 * nLength 读的Block位数 
	 * flag 标志位
	 * nBlock block位 
	 * 返回:成功返回1
	 * 
	 */
	public native static int ReadMultiBlock(byte Sendval[],byte REVval[],String UID,int nStartBlock,int nLength,int Flag,long nBytestoRead);
	
		
	/*
	 * 功能:写多个block模块
	 * 原型:int _stdcall WriteMultiBlock(BYTE Sendval[],BYTE retval[],BYTE UID[],BYTE Bval[],int nStartBlock,int nLength,int Flag,DWORD &nBytestoRead);
	 * 参数:
	 * Sendval 发送命令字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * REVval 应答字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * UID 标签ID
	 * Bval 要写入的block value
	 * nStartBlock 起始block位
	 * nLength 读的Block位数 
	 * flag 标志位
	 * nBlock block位
	 * 返回:成功返回1
	 * 
	 */
	public native static int WriteMultiBlock(byte Sendval[],byte REVval[],String UID,String Bval,int nStartBlock,int nLength,int Flag,long nBytestoRead);
	
		
	/*
	 * 功能:写DSFID
	 * 原型:int _stdcall WriteDSFID(BYTE Sendval[],BYTE retval[],int flag,int DSFID,BYTE UID[],DWORD &nBytestoRead);
	 * 参数:icdev:[IN] 通讯设备标识符
	 * 参数:
	 * Sendval 发送命令字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * REVval 应答字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * flag 标志位
	 * DSFID DSFID位
	 * UID 标签ID 
	 * nBytestoRead 读到的字节数
	 * 
	 */
	public native static int WriteDSFID(byte Sendval[],byte REVval[],int flag,int DSFID,String UID,long nBytestoRead);
	
		
	/*
	 * 功能:锁定DSFID
	 * 原型:int _stdcall LockDSFID(BYTE Sendval[],BYTE retval[],int flag,BYTE UID[],DWORD &nBytestoRead);
	 * 参数:
	 * Sendval 发送命令字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * REVval 应答字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * flag 标志位
	 * UID 标签ID 
	 * nBytestoRead 读到的字节数
	 * 返回:成功返回1
	 * 
	 */
	public native static int LockDSFID(byte Sendval[],byte REVval[],int flag,String UID,long nBytestoRead);
	
		
	/*
	 * 功能:获得系统信息
	 * 原型:int _stdcall GetSysInfo(BYTE Sendval[],BYTE retval[],int Flag,BYTE UID[],DWORD &nBytestoRead);
	 * 参数:
	 * Sendval 发送命令字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * REVval 应答字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * flag 标志位
	 * UID 标签ID 
	 * nBytestoRead 读到的字节数
	 * 返回:成功返回1

	 * 
	 */
	public native static int GetSysInfo(byte Sendval[],byte REVval[],int Flag,String UID,long nBytestoRead);
	
		
	/*
	 * 功能:获取多个块安全状态
	 * 原型:int _stdcall GetMultiBlockSecirotuStatus(BYTE Sendval[],BYTE retval[],int flag,int nStartBlock,int nLength,BYTE UID[],DWORD &nBytestoRead);
	 * 参数:
	 * Sendval 发送命令字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * REVval 应答字符串(命令执行完毕后,获取命令字符串.\n命令结束符,取命令字符串到\n前为止)
	 * flag 标志位
	 * nStartBlock 起始block位
	 * nLength 读的Block位数 
	 * UID 标签ID 
	 * nBytestoRead 读到的字节数
	 * 返回:成功返回1
	 * 
	 */
	public native static int GetMultiBlockSecirotuStatus(byte Sendval[],byte REVval[],int flag,int nStartBlock,int nLength,String UID,long nBytestoRead);
    
	/*
	 * 功能:设置串口
	 * 原型:int  _stdcall SetCom(const char *m_sPort, int BaudRate, int Databit, char *parity, char *stopbit);
	 * 参数:
	 * m_sPort Com串口号 如:"COM1"
	 * BaudRate 波特率
	 * Databit 数据位
	 * parity 校验位
	 * stopbit 停止位
	 * 返回:成功返回0
	 * 
	 */
	public native static int SetCom(String m_sPort, int BaudRate, int Databit, String parity, String stopbit);
	
	/*
	 * 功能:关闭串口
	 * 原型: int _stdcall CloseCom();
	 * 参数:
	 * 返回:成功返回0
	 * 
	 */
	public native static  int  CloseCom();
	
	/*
	 * 功能:读串口
	 * 原型: int _stdcall ReadCom( BYTE inbuff[], DWORD &nBytesRead, int ReadTime);
	 * 参数:
	 * inbuff 结果封装字符串,存储返回信息
	 * nBytesRead 读取长度
	 * ReadTime 读取用时
	 * 返回:成功返回0
	 * 
	 */
	public native static  int ReadCom( String inbuff, long nBytesRead, int ReadTime);

	/*
	 * 功能:写串口
	 * 原型: int _stdcall WriteCom( BYTE Outbuff[], int size);
	 * 参数:
	 * Outbuff 写入命令字符串
	 * nBytesRead 长度
	 * 返回:成功返回0
	 * 
	 */
	public native static  int WriteCom( String Outbuff, int size);

	
	public static void main(String args[]) {
		 byte[] Sendval=new byte[200];
		 byte[] REVval=new byte[2000];
		long nBytestoRead=0;
		System.out.println("读卡返回值:" + new JISO15693().SetCom("COM1",115200,8,"None","1"));
		//System.out.println("读卡返回值:" + new JISO15693().SetCom("COM1",115200,8,"None","1"));

		int returnNo=Inventory(Sendval, REVval, false, 0x11, 0x07, nBytestoRead);
		String send=new String(Sendval);
		String rev=new String(REVval);
		if(send.indexOf('\n')!=-1){// \n命令结束符,取命令字符串到\n前为止
			send=send.substring(0,send.indexOf('\n'));
		}else{
			send="";
		}
		if(rev.indexOf('\n')!=-1){// \n命令结束符,取返回命令字符串到\n前为止
			rev=rev.substring(0,rev.indexOf('\n'));	
		}else{
			rev="";
		}
		
		
		System.out.println("读卡返回值:" +returnNo +send+":"+rev);
		System.out.println("读卡返回值:" + new JISO15693().CloseCom());
//		changeStr(Sendval, REVval);
//		System.out.println(Sendval+":"+Sendval);
		//String send ="";long nBytestoRead=0;
		//String get="";
		//System.out.println("读卡返回值:" + new JISO15693().Inventory(send, get, false, 0, 27, nBytestoRead));
	}
	/*
	public static void changeStr(byte Sendval[],byte REVval[]){
		Sendval+="ccc";
		REVval+="ddd";
	}
	*/
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -