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

📄 sourceserializerimpl.java

📁 关于 RFID 读写器的相关内容
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * 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.stubs.serializers.xml;

import java.util.Hashtable;
import java.util.Iterator;

import javax.xml.bind.JAXBException;

import org.fosstrak.reader.rprm.core.msg.command.HexStringListType;
import org.fosstrak.reader.rprm.core.msg.command.ReadPointListParamType;
import org.fosstrak.reader.rprm.core.msg.command.SourceCommand;
import org.fosstrak.reader.rprm.core.msg.command.TagFieldValueListParamType;
import org.fosstrak.reader.rprm.core.msg.command.TagSelectorListParamType;
import org.fosstrak.reader.rprm.core.msg.command.TriggerListParamType;
import org.fosstrak.reader.rprm.core.msg.command.SourceCommand.AddReadPoints;
import org.fosstrak.reader.rprm.core.msg.command.SourceCommand.RemoveReadPoints;
import org.fosstrak.reader.rprm.core.msg.util.HexUtil;
import org.fosstrak.reader.rp.proxy.msg.stubs.DataSelector;
import org.fosstrak.reader.rp.proxy.msg.stubs.ReadPoint;
import org.fosstrak.reader.rp.proxy.msg.stubs.TagFieldValue;
import org.fosstrak.reader.rp.proxy.msg.stubs.TagSelector;
import org.fosstrak.reader.rp.proxy.msg.stubs.Trigger;
import org.fosstrak.reader.rp.proxy.msg.stubs.serializers.SourceSerializer;

/**
 * @author Andreas
 * 
 */
public class SourceSerializerImpl extends CommandSerializerImpl implements
		SourceSerializer {

	private SourceCommand srcCommand = null;

	/**
	 * @param targetName
	 */
	public SourceSerializerImpl(String targetName) {
		super(targetName);
		init();
	}

	/**
	 * @param id
	 */
	public SourceSerializerImpl(int id) {
		super(id);
		init();
	}

	/**
	 * @param id
	 * @param targetName
	 */
	public SourceSerializerImpl(int id, String targetName) {
		super(id, targetName);
		init();
	}

	private void init() {
		srcCommand = cmdFactory.createSourceCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#create(java.lang.String)
	 */
	public String create(String name) {
		resetCommand();
		SourceCommand.Create c = cmdFactory
				.createSourceCommandCreate();
		c.setName(name);
		srcCommand.setCreate(c);
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#getName()
	 */
	public String getName() {
		resetCommand();
		srcCommand.setGetName(cmdFactory.createNoParamType());
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#isFixed()
	 */
	public String isFixed() {
		resetCommand();
		srcCommand.setIsFixed(cmdFactory.createNoParamType());
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#addReadPoints(org.fosstrak.reader.ReadPoint[])
	 */
	public String addReadPoints(ReadPoint[] readPoints) {
		resetCommand();
		AddReadPoints rps = cmdFactory
				.createSourceCommandAddReadPoints();
		ReadPointListParamType.List list = cmdFactory
				.createReadPointListParamTypeList();
		ReadPointListParamType listType = cmdFactory
				.createReadPointListParamType();
		list.getValue().addAll(toStringList(readPoints));
		listType.setList(list);
		rps.setReadPoints(listType);
		srcCommand.setAddReadPoints(rps);
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#removeReadPoints(org.fosstrak.reader.ReadPoint[])
	 */
	public String removeReadPoints(ReadPoint[] readPoints) {
		resetCommand();
		RemoveReadPoints rps = cmdFactory
				.createSourceCommandRemoveReadPoints();
		ReadPointListParamType.List list = cmdFactory
				.createReadPointListParamTypeList();
		ReadPointListParamType listType = cmdFactory
				.createReadPointListParamType();
		list.getValue().addAll(toStringList(readPoints));
		listType.setList(list);
		rps.setReadPoints(listType);
		srcCommand.setRemoveReadPoints(rps);
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#removeAllReadPoints()
	 */
	public String removeAllReadPoints() {
		resetCommand();
		srcCommand.setRemoveAllReadPoints(cmdFactory.createNoParamType());
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#getReadPoint(java.lang.String)
	 */
	public String getReadPoint(String name) {
		resetCommand();
		SourceCommand.GetReadPoint rp = cmdFactory
				.createSourceCommandGetReadPoint();
		rp.setName(name);
		srcCommand.setGetReadPoint(rp);
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#getAllReadPoints()
	 */
	public String getAllReadPoints() {
		resetCommand();
		srcCommand.setGetAllReadPoints(cmdFactory.createNoParamType());
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#addReadTriggers(org.fosstrak.reader.Trigger[])
	 */
	public String addReadTriggers(Trigger[] triggers) {
		resetCommand();
		SourceCommand.AddReadTriggers rtrg = cmdFactory
				.createSourceCommandAddReadTriggers();
		TriggerListParamType.List list = cmdFactory
				.createTriggerListParamTypeList();
		TriggerListParamType listType = cmdFactory
				.createTriggerListParamType();
		list.getValue().addAll(toStringList(triggers));
		listType.setList(list);
		rtrg.setTriggers(listType);
		srcCommand.setAddReadTriggers(rtrg);
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#removeReadTriggers(org.fosstrak.reader.Trigger[])
	 */
	public String removeReadTriggers(Trigger[] triggers) {
		resetCommand();
		SourceCommand.RemoveReadTriggers rtrgs = cmdFactory
				.createSourceCommandRemoveReadTriggers();
		TriggerListParamType.List list = cmdFactory
				.createTriggerListParamTypeList();
		TriggerListParamType listType = cmdFactory
				.createTriggerListParamType();
		list.getValue().addAll(toStringList(triggers));
		listType.setList(list);
		rtrgs.setTriggers(listType);
		srcCommand.setRemoveReadTriggers(rtrgs);
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#removeAllReadTriggers()
	 */
	public String removeAllReadTriggers() {
		resetCommand();
		srcCommand.setRemoveAllReadTriggers(cmdFactory.createNoParamType());
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#getReadTrigger(java.lang.String)
	 */
	public String getReadTrigger(String name) {
		resetCommand();
		SourceCommand.GetReadTrigger rtrg = cmdFactory
				.createSourceCommandGetReadTrigger();
		rtrg.setName(name);
		srcCommand.setGetReadTrigger(rtrg);
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#getAllReadTriggers()
	 */
	public String getAllReadTriggers() {
		resetCommand();
		srcCommand.setGetAllReadTriggers(cmdFactory.createNoParamType());
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#addTagSelectors(org.fosstrak.reader.TagSelector[])
	 */
	public String addTagSelectors(TagSelector[] selectors) {
		resetCommand();
		SourceCommand.AddTagSelectors tss = cmdFactory
				.createSourceCommandAddTagSelectors();
		TagSelectorListParamType.List list = cmdFactory
				.createTagSelectorListParamTypeList();
		TagSelectorListParamType listType = cmdFactory
				.createTagSelectorListParamType();
		list.getValue().addAll(toStringList(selectors));
		listType.setList(list);
		tss.setSelectors(listType);
		srcCommand.setAddTagSelectors(tss);
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#removeTagSelectors(org.fosstrak.reader.TagSelector[])
	 */
	public String removeTagSelectors(TagSelector[] tagSelectors) {
		resetCommand();
		SourceCommand.RemoveTagSelectors tss = cmdFactory
				.createSourceCommandRemoveTagSelectors();
		TagSelectorListParamType.List list = cmdFactory
				.createTagSelectorListParamTypeList();
		TagSelectorListParamType listType = cmdFactory
				.createTagSelectorListParamType();
		list.getValue().addAll(toStringList(tagSelectors));
		listType.setList(list);
		tss.setSelectors(listType);
		srcCommand.setRemoveTagSelectors(tss);
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#removeAllTagSelectors()
	 */
	public String removeAllTagSelectors() {
		resetCommand();
		srcCommand.setRemoveAllTagSelectors(cmdFactory.createNoParamType());
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#getTagSelector(java.lang.String)
	 */
	public String getTagSelector(String name) {
		resetCommand();
		SourceCommand.GetTagSelector ts = cmdFactory
				.createSourceCommandGetTagSelector();
		ts.setName(name);
		srcCommand.setGetTagSelector(ts);
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#getAllTagSelectors()
	 */
	public String getAllTagSelectors() {
		resetCommand();
		srcCommand.setGetAllTagSelectors(cmdFactory.createNoParamType());
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#getGlimpsedTimeout()
	 */
	public String getGlimpsedTimeout() {
		resetCommand();
		srcCommand.setGetGlimpsedTimeout(cmdFactory.createNoParamType());
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#setGlimpsedTimeout(int)
	 */
	public String setGlimpsedTimeout(int timeout) {
		resetCommand();
		SourceCommand.SetGlimpsedTimeout glmps = cmdFactory
				.createSourceCommandSetGlimpsedTimeout();
		glmps.setTimeout(timeout);
		srcCommand.setSetGlimpsedTimeout(glmps);
		return serializeCommand();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.SourceSerializer#getObservedThreshold()
	 */
	public String getObservedThreshold() {
		resetCommand();
		srcCommand.setGetObservedThreshold(cmdFactory.createNoParamType());

⌨️ 快捷键说明

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