亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? proxyconnection.java

?? 關于 RFID 讀寫器的相關內容
?? JAVA
字號:
/*
 * Copyright (C) 2007 ETH Zurich
 *
 * This file is part of Fosstrak (www.fosstrak.org).
 *
 * Fosstrak is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1, as published by the Free Software Foundation.
 *
 * Fosstrak is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with Fosstrak; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301  USA
 */

package org.fosstrak.reader.rp.proxy.msg;

import java.io.IOException;

import org.fosstrak.reader.rp.proxy.RPProxyException;
import org.fosstrak.reader.rp.proxy.Result;
import org.fosstrak.reader.rprm.core.msg.reply.Reply;
import org.apache.log4j.Logger;

/**
 * This class represents a proxy connection. Each reader device proxy owns such a connection.
 * Over the method executeCommand() commands can be executed over this connection.
 *
 * @author regli
 */
public class ProxyConnection implements Client {

	/** the logger */
	private static final Logger LOG = Logger.getLogger(ProxyConnection.class);

	/** the host of the reader device */
	private final String host;

	/** the port of the reader device */
	private final int port;

	/** stores the message format and the transport protocol */
	private final Handshake handshake;

	/** the result of the command execution */
	private final Result result;

	/** the client connection over which the communication happens */
	private ClientConnection conn;

	/** indicates if the connection is connected or not */
	private boolean connected = false;

	/**
	 * Constructor sets the parameters.
	 *
	 * @param host of the reader device
	 * @param port of the reader device
	 * @param handshake indicates the message format and the transport protocol
	 */
	public ProxyConnection(String host, int port, Handshake handshake) {

		this.host = host;
		this.port = port;
		this.handshake = handshake;
		result = new Result(handshake);

	}

	/**
	 * This method creates a new client connection and connects it to a reader device.
	 *
	 * @return true if the client connection is established
	 * @throws RPProxyException if the connection could not be created
	 */
	public boolean connect() throws RPProxyException {

		if(isConnected()) disconnect();
		if (handshake.getTransportProtocol() == Handshake.HTTP) {
			conn = new HttpClientConnection(this);
		} else if (handshake.getTransportProtocol() == Handshake.TCP) {
			conn = new TcpClientConnection(this);
		} else {
			throw new RPProxyException("Unknown Protocol.");
		}
		conn.setHost(host);
		conn.setPort(port);
		conn.setHandshake(handshake);
		if(conn.connect()) {;
			connected = true;
			return true;
		}
		throw new RPProxyException("Unable to connect");

	}

	/**
	 * This method disconnects the client connection.
	 *
	 * @return true if the client connection is disconnected
	 */
	public boolean disconnect() {

		conn.disconnect();
		connected = false;
		return true;

	}

	/**
	 * This method indicates if the connection is connected to a reader device.
	 *
	 * @return true if the connection is connected and false otherwise
	 */
	public boolean isConnected() {

		return connected;

	}

	/**
	 * This message is invoked if the client connection receives data.
	 *
	 * @param data from the client connection
	 */
	public void printInput(String data) {

		LOG.debug("Read from proxy connection: " + data.replace('\n', ' '));
		try {
			result.addMsgFragment(data);
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	/**
	 * This method executes a command on the reader device over the proxy connection.
	 *
	 * @param object the type of the object on which the command should be executed
	 * @param command the command which should be executed
	 * @param parameterTypes the types of the parameters which belong to the command
	 * @param args the arguments which belong to the command
	 * @param target the name of the object on which the command shoud be executed
	 * @param ignoreNoReply indicates if it should be ignored if there is no reply or not
	 * @return the reply from the reader device
	 * @throws ParameterTypeException if the parameters are illegal
	 * @throws RPProxyException if there is an error while executing the command
	 */
	public Reply executeCommand(String object, String command, Class[] parameterTypes, Object[] args, String target, boolean ignoreNoReply) throws ParameterTypeException, RPProxyException {

		Parameter[] params = new Parameter[parameterTypes.length];
		ParameterType type;
		for (int i = 0; i < parameterTypes.length; i++) {
			type = new ParameterType(parameterTypes[i], parameterTypes[i].getName());
			params[i] = new Parameter(args[i] == null ? null : args[i].toString(), type);
		}
		result.init();
		if (handshake.getMessageFormat() == Handshake.FORMAT_XML) {
			conn.sendMessage(CommandFactory.getXMLCommand(object, command, params, target));
		} else if (handshake.getMessageFormat() == Handshake.FORMAT_TEXT) {
			conn.sendMessage(CommandFactory.getTextCommand(object, command, params, target) + "\r\n\r\n");
		} else {
			throw new RPProxyException("Unkown Format.");
		}
		if (result.getErrorCode() > 0) {
			if (ignoreNoReply) {
				return null;
			} else {
				throw new RPProxyException(result.getErrorName(), result.getErrorDescription());
			}
		}
		return result.get();

	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91污片在线观看| 国产一区二区三区四区五区入口| 久久亚洲捆绑美女| 欧美一区二区女人| 91精品一区二区三区在线观看| 99国产精品国产精品久久| 成人免费视频caoporn| 不卡一二三区首页| 高清av一区二区| 国产精品996| 国产成人综合网| 99在线精品一区二区三区| 99久久精品一区二区| 成人av网在线| 91精彩视频在线观看| 欧洲日韩一区二区三区| 欧美日韩小视频| 日韩女优毛片在线| 国产精品嫩草99a| 亚洲色图在线播放| 亚洲第一在线综合网站| 日韩精品一二三| 精品一区二区久久久| 国产一区二区精品久久| 成人国产在线观看| 欧美日韩一区二区三区四区| 91精品国产麻豆国产自产在线| 日韩三级视频中文字幕| 久久综合五月天婷婷伊人| 中文字幕第一区综合| 亚洲国产精品一区二区尤物区| 日一区二区三区| 国产成人在线网站| 欧美性大战xxxxx久久久| 欧美不卡一二三| 综合亚洲深深色噜噜狠狠网站| 亚洲一区二区美女| 国产精品99久久久久久似苏梦涵 | 亚洲影院免费观看| 免费精品99久久国产综合精品| 精品一区二区三区免费毛片爱| 91原创在线视频| 精品国产123| 一区二区三区四区精品在线视频| 秋霞电影网一区二区| 99国产精品久| xvideos.蜜桃一区二区| 一区二区欧美精品| 国产成人免费视频一区| 日韩一区二区三区av| 樱桃视频在线观看一区| 久久国产精品免费| 欧美在线观看一二区| 日韩你懂的在线播放| 亚洲欧美电影一区二区| 国内精品国产成人国产三级粉色| 91看片淫黄大片一级在线观看| 精品精品国产高清一毛片一天堂| 伊人夜夜躁av伊人久久| 不卡影院免费观看| 久久五月婷婷丁香社区| 日本中文字幕一区二区视频 | 精品国产伦一区二区三区免费| 亚洲乱码中文字幕| 成人黄色在线视频| 国产亚洲精品资源在线26u| 蜜臀av一级做a爰片久久| 欧美性色欧美a在线播放| 亚洲欧美另类在线| 成人国产精品免费观看| 久久九九99视频| 国产麻豆91精品| 精品国产91乱码一区二区三区 | 久久久99精品久久| 九九在线精品视频| 欧美一级视频精品观看| 丝袜亚洲另类丝袜在线| 在线免费观看日韩欧美| 亚洲免费观看高清完整版在线 | 欧美一区二区二区| 亚洲午夜免费电影| 欧美午夜寂寞影院| 性做久久久久久| 欧美电影在哪看比较好| 日本不卡一区二区三区高清视频| 7777精品伊人久久久大香线蕉经典版下载 | 激情图片小说一区| 欧美精品一区二区久久婷婷 | 中文字幕视频一区| k8久久久一区二区三区| 国产精品麻豆99久久久久久| jiyouzz国产精品久久| 国产精品麻豆一区二区| 色婷婷av一区二区三区gif| 亚洲小少妇裸体bbw| 欧美夫妻性生活| 久久精品国产一区二区| 国产欧美精品区一区二区三区 | 久久97超碰色| 26uuu久久天堂性欧美| 国产麻豆精品视频| ㊣最新国产の精品bt伙计久久| 一本久久a久久免费精品不卡| 亚洲成人一区在线| 精品成人在线观看| jvid福利写真一区二区三区| 亚洲乱码精品一二三四区日韩在线| 欧美视频你懂的| 韩日欧美一区二区三区| 国产精品国产三级国产有无不卡| 色婷婷av久久久久久久| 美女视频黄免费的久久| 国产女人18毛片水真多成人如厕| 色哟哟一区二区在线观看| 美国三级日本三级久久99| 国产精品青草久久| 91精品在线免费观看| 成人免费视频视频在线观看免费 | 欧美日韩精品一区二区在线播放| 九色综合国产一区二区三区| 亚洲视频每日更新| 欧美mv日韩mv亚洲| 欧美性淫爽ww久久久久无| 国产一区二区网址| 亚洲成人免费视频| 欧美国产97人人爽人人喊| 欧美日韩高清一区| 成人午夜精品一区二区三区| 午夜视频在线观看一区二区| 久久精品视频在线看| 欧美精品 日韩| 99久久伊人久久99| 久久er99热精品一区二区| 亚洲黄色免费电影| 中文字幕av在线一区二区三区| 制服丝袜成人动漫| 欧美日韩一区二区在线观看视频| 国产成人精品三级麻豆| 日韩av一区二区三区| 亚洲综合免费观看高清在线观看| 国产性做久久久久久| 精品乱人伦小说| 91精品国产aⅴ一区二区| 91国偷自产一区二区三区观看| 高清av一区二区| 国产精品一区二区x88av| 精品一区二区三区欧美| 另类小说一区二区三区| 性感美女久久精品| 天天色天天爱天天射综合| 亚洲一区二区视频在线| 亚洲福利电影网| 亚洲成人精品一区| 亚洲最大成人综合| 亚洲一区免费在线观看| 亚洲欧美综合在线精品| 国产精品人妖ts系列视频| 中文字幕欧美日本乱码一线二线| 亚洲精品在线电影| 久久久不卡网国产精品一区| 久久久综合激的五月天| 欧美成人激情免费网| 日韩免费视频一区| 欧美精品一区二区三区很污很色的| 日韩欧美精品三级| 久久亚洲春色中文字幕久久久| 精品国产精品网麻豆系列| 欧美成人vps| 久久亚洲精精品中文字幕早川悠里 | 久久久亚洲精品石原莉奈| 久久精品亚洲精品国产欧美| 国产日韩欧美亚洲| 久久久久国产精品人| 国产精品久久福利| 亚洲大型综合色站| 国内久久婷婷综合| 99国产欧美久久久精品| 欧美在线小视频| 欧美变态口味重另类| 日本一区二区成人| 亚洲影院久久精品| 精品在线播放免费| 91浏览器打开| 欧美一卡二卡三卡四卡| 国产欧美一区二区三区网站 | 精品噜噜噜噜久久久久久久久试看 | 欧美大胆一级视频| 国产精品污www在线观看| 一区二区三区在线高清| 蓝色福利精品导航| 91丨porny丨国产入口| 日韩色视频在线观看| 中文字幕亚洲一区二区av在线| 午夜日韩在线电影| 粉嫩在线一区二区三区视频| 欧美综合视频在线观看| 久久久久久免费毛片精品| 亚洲精品久久久蜜桃| 国产在线观看免费一区| 欧美视频自拍偷拍|