public static UrpPkg decodeFromDetector(byte data[], int datalength,
			String ip, int port) {
		UrpPkg urpPkg = new UrpPkg();
		UrpCmd cmd = new UrpCmd();
		StringBuilder message = new StringBuilder("");
		if (data.length > 7) {
			urpPkg.setSeqID(Util.getInt(data, 0));
			urpPkg.setCmdFlag(Util.getInt(data, 4));
			message.append("seq:").append(urpPkg.getSeqID()).append(",flag:")
					.append(urpPkg.getCmdFlag() == 1 ? "ACK" : "COMMAND");
			if (data.length > 11) {
				cmd.setCmdID(Util.getInt(data, 8));
				message.append(",command:" + cmd.getCmdID());
			} else {
				logger.debug("the length of data  is less than " + 12
						+ ",not set the command id.");
			}

			int dLen = 0;
			if (data.length > 15) {
				dLen = Util.getInt(data, 12);
				cmd.setdLen(dLen);
				message.append(",length:" + cmd.getdLen());
			} else {
				logger.debug("the length of data  is less than " + 16
						+ ",not set the command data length.");
			}

			if (data.length > (15 + dLen)) {
				if (cmd != null) {
					cmd.setData(Arrays.copyOfRange(data, 16, 16 + dLen));
					message.append(",data:" + cmd.getData());
				}
			} else {
				logger.debug("the length of data is less than " + (16 + dLen)
						+ ",not set the command data.");
			}
		} else {
			logger.debug("the length of data is less than " + 8
					+ ",not set the any data. data length:" + data.length);
		}
		urpPkg.setCmd(cmd);
		logger.info("[UDP " + (urpPkg.getCmdFlag() == 1 ? "ACK" : "Command")
				+ "]<--:" + message.toString() + " from " + ip + "/" + port
				+ ",size:" + datalength);
		return urpPkg;
	}