package com.mq.mylibrary.rfid.io.service;

public class ERROR { 

	public final static byte TX_HEAD_NONE = -2;
	public final static byte TX_TAIL_NONE = -3;
	public final static byte TX_CRC_ERROR = -4;
	public final static byte TX_MACNO_ERROR = -5;
	public final static byte TX_COLL_ERROR = -6;
	public final static byte TX_MCU_TIMEOUT = -7;
	public final static byte TX_PARITY_ERROR = -8;
	public final static byte TX_FRAMING_ERROR = -9;
	public final static byte TX_FIFO_VOFL = -10;
	public final static byte TX_READ_EE_ERROR = -11;
	public final static byte TX_EE_ERROR = -12;
	public final static byte TX_ACK_ERROR = -13;
	public final static byte TX_WTX_ERROR = -14;
	
	public static String format(byte code){
			String errorMsg = "";
			switch (code) {
			case TX_HEAD_NONE:
				errorMsg = "数据异常，缺少包头！";
				break;
			case TX_TAIL_NONE:
				errorMsg = "数据异常，缺少句尾！";
				break;
			case TX_CRC_ERROR:
				errorMsg = "CRC校验错误！";
				break;
			case TX_MACNO_ERROR:
				errorMsg = "MAC错误！";
				break;
			case TX_COLL_ERROR:
				errorMsg = "访问错误！";
				break;
			case TX_MCU_TIMEOUT:
				errorMsg = "请求数据超时！";
				break;
			case TX_PARITY_ERROR:
				errorMsg = "执行错误！";
				break;
			case TX_FRAMING_ERROR:
				errorMsg = "Frame错误！";
				break;
			case TX_FIFO_VOFL:
				errorMsg = "FIFO错误";
				break;
			case TX_READ_EE_ERROR:
				errorMsg = "读EEPROM错误！";
				break;
			case TX_EE_ERROR:
				errorMsg = "异常情况，请正确使用！";
				break;
			case TX_ACK_ERROR:
				errorMsg = "应答字错误！";
				break;
			case TX_WTX_ERROR:
				errorMsg = "创建文件错误！";
				break;
			default:
				errorMsg = "未知错误";
				break;
			}
			return errorMsg;
		}
}
