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

📄 rfidreadersettings.java

📁 Java下Comet的实现框架Pushlet例子。 实现实时推送数据到客户端。 服务器每隔30-500MS产生一个随机数
💻 JAVA
字号:
package hfut.wispy.webservice;

public class RFIDReaderSettings {

	public static boolean isDebug = false;

	public enum ReaderModel {
		YWG804_6c_once, YWG804_6c_cycle;
	}

	public String CfgFile;

	public String CfgItem;

	public byte Antenna;

	public byte IsCycleRead;

	public int CycleReadTime;

	public int EPCLength;

	public int ReturnByteArrayLength;

	public byte[] NullTag;

	public int InitialUnReadTimes;

	public int TagLifeInListArray;

	public RFIDReaderSettings() {
		init(ReaderModel.YWG804_6c_once);
	}

	public RFIDReaderSettings(ReaderModel model) {
		init(model);
	}

	private void init(ReaderModel model) {
		switch (model) {
		default:
		case YWG804_6c_once:
			commonInit();
			Antenna = (byte) 0x01;
			IsCycleRead = (byte) 0x00;
			CycleReadTime = 3;

			e("CfgFile : " + CfgFile);
			e("CfgItem : " + CfgItem);
			e("Antenna : " + Antenna);
			e("ReadTimes : " + IsCycleRead);
			e("CycleReadTime : " + CycleReadTime);
			e("EPCLength : " + EPCLength);
			break;

		case YWG804_6c_cycle:
			commonInit();
			Antenna = (byte) 0x01;
			IsCycleRead = (byte) 0x01;
			CycleReadTime = 1;

			e("CfgFile : " + CfgFile);
			e("CfgItem : " + CfgItem);
			e("Antenna : " + Antenna);
			e("ReadTimes : " + IsCycleRead);
			e("CycleReadTime : " + CycleReadTime);
			e("EPCLength : " + EPCLength);
			break;
		}
	}

	private void commonInit() {
		EPCLength = 12;
		ReturnByteArrayLength = 17;
		NullTag = new byte[ReturnByteArrayLength];
		for (int i = 0; i < NullTag.length; i++) {
			NullTag[i] = (byte) (-52);
		}
		CfgFile = "C:\\WINDOWS\\system32\\sysit.cfg";
		CfgItem = "XCRF-804  Reader";
		InitialUnReadTimes = 40;
		TagLifeInListArray = 10 * 1000;// 10second
	}

	public static boolean IsSameByteArray(byte[] b1, byte[] b2) {
		if (b1 == null || b2 == null)
			return false;
		else if (b1.length != b2.length)
			return false;
		else {
			for (int i = 0; i < b1.length; i++) {
				if (b1[i] != b2[i])
					return false;
			}
			return true;
		}
	}

	/**
	 * Util: stderr print method.
	 */
	public static void e(String s) {
		if (isDebug)
			System.out.println("RFIDReaderSettings: " + s);
	}

	/**
	 * Util: stdout print method.
	 */
	public static void p(String s) {
		System.out.println(s);
	}

}

⌨️ 快捷键说明

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