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

📄 readerdeviceserializerimpl.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.Date;

import org.fosstrak.reader.rp.proxy.msg.stubs.DataSelector;
import org.fosstrak.reader.rp.proxy.msg.stubs.NotificationChannel;
import org.fosstrak.reader.rp.proxy.msg.stubs.Source;
import org.fosstrak.reader.rp.proxy.msg.stubs.TagField;
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.ReaderDeviceSerializer;
import org.fosstrak.reader.rprm.core.msg.command.DataSelectorListParamType;
import org.fosstrak.reader.rprm.core.msg.command.NotificationChannelListParamType;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand;
import org.fosstrak.reader.rprm.core.msg.command.SourceListParamType;
import org.fosstrak.reader.rprm.core.msg.command.TagFieldListParamType;
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.ReaderDeviceCommand.GetDataSelector;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.GetNotificationChannel;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.GetReadPoint;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.GetSource;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.GetTagField;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.GetTagSelector;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.GetTrigger;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.RemoveDataSelectors;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.RemoveNotificationChannels;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.RemoveSources;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.RemoveTagFields;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.RemoveTagSelectors;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.RemoveTriggers;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.SetCurrentDataSelector;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.SetCurrentSource;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.SetHandle;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.SetName;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.SetRole;
import org.fosstrak.reader.rprm.core.msg.command.ReaderDeviceCommand.SetTimeUTC;

import com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl;

/**
 * @author Andreas
 * 
 */
public class ReaderDeviceSerializerImpl extends CommandSerializerImpl implements
ReaderDeviceSerializer {
	
	private ReaderDeviceCommand rdCommand = null;
	
	/**
	 * @param targetName
	 */
	public ReaderDeviceSerializerImpl(String targetName) {
		super(targetName);
		init();
	}
	
	/**
	 * @param id
	 */
	public ReaderDeviceSerializerImpl(int id) {
		super(id);
		init();
	}
	
	/**
	 * @param id
	 * @param targetName
	 */
	public ReaderDeviceSerializerImpl(int id, String targetName) {
		super(id, targetName);
		init();
	}
	
	private void init() {
		rdCommand = cmdFactory.createReaderDeviceCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#getEPC()
	 */
	public String getEPC() {
		resetCommand();
		rdCommand.setGetEPC(cmdFactory.createNoParamType());
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#getManufacturer()
	 */
	public String getManufacturer() {
		resetCommand();
		rdCommand.setGetManufacturer(cmdFactory.createNoParamType());
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#getModel()
	 */
	public String getModel() {
		resetCommand();
		rdCommand.setGetModel(cmdFactory.createNoParamType());
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#getHandle()
	 */
	public String getHandle() {
		resetCommand();
		rdCommand.setGetHandle(cmdFactory.createNoParamType());
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#setHandle(int)
	 */
	public String setHandle(int pHandle) {
		resetCommand();
		SetHandle handle = cmdFactory
		.createReaderDeviceCommandSetHandle();
		handle.setHandle(pHandle);
		rdCommand.setSetHandle(handle);
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#getName()
	 */
	public String getName() {
		resetCommand();
		rdCommand.setGetName(cmdFactory.createNoParamType());
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#setName(java.lang.String)
	 */
	public String setName(String pName) {
		resetCommand();
		SetName name = cmdFactory
		.createReaderDeviceCommandSetName();
		name.setName(pName);
		rdCommand.setSetName(name);
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#getRole()
	 */
	public String getRole() {
		resetCommand();
		rdCommand.setGetRole(cmdFactory.createNoParamType());
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#setRole(java.lang.String)
	 */
	public String setRole(String pRole) {
		resetCommand();
		SetRole role = cmdFactory
		.createReaderDeviceCommandSetRole();
		role.setRole(pRole);
		rdCommand.setSetRole(role);
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#getTimeTicks()
	 */
	public String getTimeTicks() {
		resetCommand();
		rdCommand.setGetTimeTicks(cmdFactory.createNoParamType());
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#getTimeUTC()
	 */
	public String getTimeUTC() {
		resetCommand();
		rdCommand.setGetTimeUTC(cmdFactory.createNoParamType());
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#setTimeUTC(java.util.Date)
	 */
	public String setTimeUTC(Date utc) {
		resetCommand();
		SetTimeUTC time = cmdFactory
		.createReaderDeviceCommandSetTimeUTC();
		time.setUtc(new XMLGregorianCalendarImpl()); 
		rdCommand.setSetTimeUTC(time);
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#getManufacturerDescription()
	 */
	public String getManufacturerDescription() {
		resetCommand();
		rdCommand.setGetManufacturerDescription(cmdFactory.createNoParamType());
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#getCurrentSource()
	 */
	public String getCurrentSource() {
		resetCommand();
		rdCommand.setGetCurrentSource(cmdFactory.createNoParamType());
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#setCurrentSource(org.fosstrak.reader.Source)
	 */
	public String setCurrentSource(Source currentSource) {
		resetCommand();
		SetCurrentSource source = cmdFactory
		.createReaderDeviceCommandSetCurrentSource();
		source.setCurrentSource(currentSource.getName());
		rdCommand.setSetCurrentSource(source);
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#getCurrentDataSelector()
	 */
	public String getCurrentDataSelector() {
		resetCommand();
		rdCommand.setGetCurrentDataSelector(cmdFactory.createNoParamType());
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#setCurrentDataSelector(org.fosstrak.reader.testclient.command.DataSelectorSerializer)
	 */
	public String setCurrentDataSelector(DataSelector currentDataSelector) {
		resetCommand();
		SetCurrentDataSelector ds = cmdFactory
		.createReaderDeviceCommandSetCurrentDataSelector();
		ds.setCurrentDataSelector(currentDataSelector.getName());
		rdCommand.setSetCurrentDataSelector(ds);
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#removeSources(org.fosstrak.reader.Source[])
	 */
	public String removeSources(Source[] pSources) {
		resetCommand();
		RemoveSources sources = cmdFactory
		.createReaderDeviceCommandRemoveSources();
		SourceListParamType.List list = cmdFactory
		.createSourceListParamTypeList();
		SourceListParamType listType = cmdFactory
		.createSourceListParamType();
		list.getValue().addAll(toStringList(pSources));
		listType.setList(list);
		sources.setSources(listType);
		rdCommand.setRemoveSources(sources);
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#removeAllSources()
	 */
	public String removeAllSources() {
		resetCommand();
		rdCommand.setRemoveAllSources(cmdFactory.createNoParamType());
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#getSource(java.lang.String)
	 */
	public String getSource(String name) {
		resetCommand();
		GetSource source = cmdFactory
		.createReaderDeviceCommandGetSource();
		source.setName(name);
		rdCommand.setGetSource(source);
		return serializeCommand();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see org.fosstrak.reader.testclient.command.ReaderDeviceSerializer#getAllSources()
	 */

⌨️ 快捷键说明

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