/*
*
* This file was generated by LLRP Code Generator
* see http://llrp-toolkit.cvs.sourceforge.net/llrp-toolkit
* for more information
* Generated on: Mon Mar 10 14:26:48 KST 2014;
*
*/
/*
* Copyright 2007 ETH Zurich
*
* Licensed under the Apache License, Version 2.0 (the "License");
*
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
*
*/
package kr.ac.kaist.resl.ltk.generated.parameters;
import org.apache.log4j.Logger;
import org.jdom.Content;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.Namespace;
import org.llrp.ltk.exceptions.InvalidLLRPMessageException;
import org.llrp.ltk.exceptions.MissingParameterException;
import kr.ac.kaist.resl.ltk.generated.LLRPConstants;
import kr.ac.kaist.resl.ltk.generated.enumerations.C1G2DRValue;
import kr.ac.kaist.resl.ltk.generated.enumerations.C1G2ForwardLinkModulation;
import kr.ac.kaist.resl.ltk.generated.enumerations.C1G2MValue;
import kr.ac.kaist.resl.ltk.generated.enumerations.C1G2SpectralMaskIndicator;
import org.llrp.ltk.types.Bit;
import org.llrp.ltk.types.BitList;
import org.llrp.ltk.types.LLRPBitList;
import org.llrp.ltk.types.LLRPMessage;
import org.llrp.ltk.types.SignedShort;
import org.llrp.ltk.types.TLVParameter;
import org.llrp.ltk.types.TVParameter;
import org.llrp.ltk.types.UnsignedInteger;
import org.llrp.ltk.types.UnsignedShort;
import java.util.LinkedList;
import java.util.List;
/**
* This parameter carries the information for each UHFC1G2 RF mode. A mode that has been tested for conformance by the EPCGlobal Hardware Action Group's Testing and Conformance (HAG T and C) group, is indicated using a conformance flag.
See also {@link <a href="http://www.epcglobalinc.org/standards/llrp/llrp_1_0_1-standard-20070813.pdf#page=99&view=fit">LLRP Specification Section 15.2.1.1.2.1</a>}
and {@link <a href="http://www.epcglobalinc.org/standards/llrp/llrp_1_0_1-standard-20070813.pdf#page=153&view=fit">LLRP Specification Section 16.3.1.1.2.1</a>}
*/
/**
* This parameter carries the information for each UHFC1G2 RF mode. A mode that has been tested for conformance by the EPCGlobal Hardware Action Group's Testing and Conformance (HAG T and C) group, is indicated using a conformance flag.
See also {@link <a href="http://www.epcglobalinc.org/standards/llrp/llrp_1_0_1-standard-20070813.pdf#page=99&view=fit">LLRP Specification Section 15.2.1.1.2.1</a>}
and {@link <a href="http://www.epcglobalinc.org/standards/llrp/llrp_1_0_1-standard-20070813.pdf#page=153&view=fit">LLRP Specification Section 16.3.1.1.2.1</a>}
.
*/
public class C1G2UHFRFModeTableEntry extends TLVParameter {
public static final SignedShort TYPENUM = new SignedShort(329);
private static final Logger LOGGER = Logger.getLogger(C1G2UHFRFModeTableEntry.class);
protected UnsignedInteger modeIdentifier;
protected C1G2DRValue dRValue;
protected Bit ePCHAGTCConformance;
protected BitList reserved0 = new BitList(6);
protected C1G2MValue mValue;
protected C1G2ForwardLinkModulation forwardLinkModulation;
protected C1G2SpectralMaskIndicator spectralMaskIndicator;
protected UnsignedInteger bDRValue;
protected UnsignedInteger pIEValue;
protected UnsignedInteger minTariValue;
protected UnsignedInteger maxTariValue;
protected UnsignedInteger stepTariValue;
/**
* empty constructor to create new parameter.
*/
public C1G2UHFRFModeTableEntry() {
}
/**
* Constructor to create parameter from binary encoded parameter
* calls decodeBinary to decode parameter.
* @param list to be decoded
*/
public C1G2UHFRFModeTableEntry(LLRPBitList list) {
decodeBinary(list);
}
/**
* Constructor to create parameter from xml encoded parameter
* calls decodeXML to decode parameter.
* @param element to be decoded
*/
public C1G2UHFRFModeTableEntry(Element element)
throws InvalidLLRPMessageException {
decodeXML(element);
}
/**
* {@inheritDoc}
*/
public LLRPBitList encodeBinarySpecific() {
LLRPBitList resultBits = new LLRPBitList();
if (modeIdentifier == null) {
LOGGER.warn(" modeIdentifier not set");
throw new MissingParameterException(
" modeIdentifier not set for Parameter of Type C1G2UHFRFModeTableEntry");
}
resultBits.append(modeIdentifier.encodeBinary());
if (dRValue == null) {
LOGGER.warn(" dRValue not set");
throw new MissingParameterException(
" dRValue not set for Parameter of Type C1G2UHFRFModeTableEntry");
}
resultBits.append(dRValue.encodeBinary());
if (ePCHAGTCConformance == null) {
LOGGER.warn(" ePCHAGTCConformance not set");
throw new MissingParameterException(
" ePCHAGTCConformance not set for Parameter of Type C1G2UHFRFModeTableEntry");
}
resultBits.append(ePCHAGTCConformance.encodeBinary());
resultBits.append(reserved0.encodeBinary());
if (mValue == null) {
LOGGER.warn(" mValue not set");
throw new MissingParameterException(
" mValue not set for Parameter of Type C1G2UHFRFModeTableEntry");
}
resultBits.append(mValue.encodeBinary());
if (forwardLinkModulation == null) {
LOGGER.warn(" forwardLinkModulation not set");
throw new MissingParameterException(
" forwardLinkModulation not set for Parameter of Type C1G2UHFRFModeTableEntry");
}
resultBits.append(forwardLinkModulation.encodeBinary());
if (spectralMaskIndicator == null) {
LOGGER.warn(" spectralMaskIndicator not set");
throw new MissingParameterException(
" spectralMaskIndicator not set for Parameter of Type C1G2UHFRFModeTableEntry");
}
resultBits.append(spectralMaskIndicator.encodeBinary());
if (bDRValue == null) {
LOGGER.warn(" bDRValue not set");
throw new MissingParameterException(
" bDRValue not set for Parameter of Type C1G2UHFRFModeTableEntry");
}
resultBits.append(bDRValue.encodeBinary());
if (pIEValue == null) {
LOGGER.warn(" pIEValue not set");
throw new MissingParameterException(
" pIEValue not set for Parameter of Type C1G2UHFRFModeTableEntry");
}
resultBits.append(pIEValue.encodeBinary());
if (minTariValue == null) {
LOGGER.warn(" minTariValue not set");
throw new MissingParameterException(
" minTariValue not set for Parameter of Type C1G2UHFRFModeTableEntry");
}
resultBits.append(minTariValue.encodeBinary());
if (maxTariValue == null) {
LOGGER.warn(" maxTariValue not set");
throw new MissingParameterException(
" maxTariValue not set for Parameter of Type C1G2UHFRFModeTableEntry");
}
resultBits.append(maxTariValue.encodeBinary());
if (stepTariValue == null) {
LOGGER.warn(" stepTariValue not set");
throw new MissingParameterException(
" stepTariValue not set for Parameter of Type C1G2UHFRFModeTableEntry");
}
resultBits.append(stepTariValue.encodeBinary());
return resultBits;
}
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
// element in namespace defined by parent element
Element element = new Element(name, ns);
// child element are always in default LLRP namespace
ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);
if (modeIdentifier == null) {
LOGGER.warn(" modeIdentifier not set");
throw new MissingParameterException(" modeIdentifier not set");
} else {
element.addContent(modeIdentifier.encodeXML("ModeIdentifier", ns));
}
if (dRValue == null) {
LOGGER.warn(" dRValue not set");
throw new MissingParameterException(" dRValue not set");
} else {
element.addContent(dRValue.encodeXML("DRValue", ns));
}
if (ePCHAGTCConformance == null) {
LOGGER.warn(" ePCHAGTCConformance not set");
throw new MissingParameterException(" ePCHAGTCConformance not set");
} else {
element.addContent(ePCHAGTCConformance.encodeXML(
"EPCHAGTCConformance", ns));
}
//element.addContent(reserved0.encodeXML("reserved",ns));
if (mValue == null) {
LOGGER.warn(" mValue not set");
throw new MissingParameterException(" mValue not set");
} else {
element.addContent(mValue.encodeXML("MValue", ns));
}
if (forwardLinkModulation == null) {
LOGGER.warn(" forwardLinkModulation not set");
throw new MissingParameterException(
" forwardLinkModulation not set");
} else {
element.addContent(forwardLinkModulation.encodeXML(
"ForwardLinkModulation", ns));
}
if (spectralMaskIndicator == null) {
LOGGER.warn(" spectralMaskIndicator not set");
throw new MissingParameterException(
" spectralMaskIndicator not set");
} else {
element.addContent(spectralMaskIndicator.encodeXML(
"SpectralMaskIndicator", ns));
}
if (bDRValue == null) {
LOGGER.warn(" bDRValue not set");
throw new MissingParameterException(" bDRValue not set");
} else {
element.addContent(bDRValue.encodeXML("BDRValue", ns));
}
if (pIEValue == null) {
LOGGER.warn(" pIEValue not set");
throw new MissingParameterException(" pIEValue not set");
} else {
element.addContent(pIEValue.encodeXML("PIEValue", ns));
}
if (minTariValue == null) {
LOGGER.warn(" minTariValue not set");
throw new MissingParameterException(" minTariValue not set");
} else {
element.addContent(minTariValue.encodeXML("MinTariValue", ns));
}
if (maxTariValue == null) {
LOGGER.warn(" maxTariValue not set");
throw new MissingParameterException(" maxTariValue not set");
} else {
element.addContent(maxTariValue.encodeXML("MaxTariValue", ns));
}
if (stepTariValue == null) {
LOGGER.warn(" stepTariValue not set");
throw new MissingParameterException(" stepTariValue not set");
} else {
element.addContent(stepTariValue.encodeXML("StepTariValue", ns));
}
//parameters
return element;
}
/**
* {@inheritDoc}
*/
protected void decodeBinarySpecific(LLRPBitList binary) {
int position = 0;
int tempByteLength;
int tempLength = 0;
int count;
SignedShort type;
int fieldCount;
Custom custom;
modeIdentifier = new UnsignedInteger(binary.subList(position,
UnsignedInteger.length()));
position += UnsignedInteger.length();
dRValue = new C1G2DRValue(binary.subList(position, C1G2DRValue.length()));
position += C1G2DRValue.length();
ePCHAGTCConformance = new Bit(binary.subList(position, Bit.length()));
position += Bit.length();
position += reserved0.length();
mValue = new C1G2MValue(binary.subList(position, C1G2MValue.length()));
position += C1G2MValue.length();
forwardLinkModulation = new C1G2ForwardLinkModulation(binary.subList(
position, C1G2ForwardLinkModulation.length()));
position += C1G2ForwardLinkModulation.length();
spectralMaskIndicator = new C1G2SpectralMaskIndicator(binary.subList(
position, C1G2SpectralMaskIndicator.length()));
position += C1G2SpectralMaskIndicator.length();
bDRValue = new UnsignedInteger(binary.subList(position,
UnsignedInteger.length()));
position += UnsignedInteger.length();
pIEValue = new UnsignedInteger(binary.subList(position,
UnsignedInteger.length()));
position += UnsignedInteger.length();
minTariValue = new UnsignedInteger(binary.subList(position,
UnsignedInteger.length()));
position += UnsignedInteger.length();
maxTariValue = new UnsignedInteger(binary.subList(position,
UnsignedInteger.length()));
position += UnsignedInteger.length();
stepTariValue = new UnsignedInteger(binary.subList(position,
UnsignedInteger.length()));
position += UnsignedInteger.length();
}
/**
* {@inheritDoc}
*/
public void decodeXML(Element element) throws InvalidLLRPMessageException {
List<Element> tempList = null;
boolean atLeastOnce = false;
Custom custom;
Element temp = null;
// child element are always in default LLRP namespace
Namespace ns = Namespace.getNamespace(LLRPConstants.LLRPNAMESPACE);
temp = element.getChild("ModeIdentifier", ns);
if (temp != null) {
modeIdentifier = new UnsignedInteger(temp);
}
element.removeChild("ModeIdentifier", ns);
temp = element.getChild("DRValue", ns);
if (temp != null) {
dRValue = new C1G2DRValue(temp);
}
element.removeChild("DRValue", ns);
temp = element.getChild("EPCHAGTCConformance", ns);
if (temp != null) {
ePCHAGTCConformance = new Bit(temp);
}
element.removeChild("EPCHAGTCConformance", ns);
temp = element.getChild("MValue", ns);
if (temp != null) {
mValue = new C1G2MValue(temp);
}
element.removeChild("MValue", ns);
temp = element.getChild("ForwardLinkModulation", ns);
if (temp != null) {
forwardLinkModulation = new C1G2ForwardLinkModulation(temp);
}
element.removeChild("ForwardLinkModulation", ns);
temp = element.getChild("SpectralMaskIndicator", ns);
if (temp != null) {
spectralMaskIndicator = new C1G2SpectralMaskIndicator(temp);
}
element.removeChild("SpectralMaskIndicator", ns);
temp = element.getChild("BDRValue", ns);
if (temp != null) {
bDRValue = new UnsignedInteger(temp);
}
element.removeChild("BDRValue", ns);
temp = element.getChild("PIEValue", ns);
if (temp != null) {
pIEValue = new UnsignedInteger(temp);
}
element.removeChild("PIEValue", ns);
temp = element.getChild("MinTariValue", ns);
if (temp != null) {
minTariValue = new UnsignedInteger(temp);
}
element.removeChild("MinTariValue", ns);
temp = element.getChild("MaxTariValue", ns);
if (temp != null) {
maxTariValue = new UnsignedInteger(temp);
}
element.removeChild("MaxTariValue", ns);
temp = element.getChild("StepTariValue", ns);
if (temp != null) {
stepTariValue = new UnsignedInteger(temp);
}
element.removeChild("StepTariValue", ns);
if (element.getChildren().size() > 0) {
String message = "C1G2UHFRFModeTableEntry has unknown element " +
((Element) element.getChildren().get(0)).getName();
throw new InvalidLLRPMessageException(message);
}
}
//setters
/**
* set modeIdentifier of type UnsignedInteger .
* @param modeIdentifier to be set
*/
public void setModeIdentifier(final UnsignedInteger modeIdentifier) {
this.modeIdentifier = modeIdentifier;
}
/**
* set dRValue of type C1G2DRValue .
* @param dRValue to be set
*/
public void setDRValue(final C1G2DRValue dRValue) {
this.dRValue = dRValue;
}
/**
* set ePCHAGTCConformance of type Bit .
* @param ePCHAGTCConformance to be set
*/
public void setEPCHAGTCConformance(final Bit ePCHAGTCConformance) {
this.ePCHAGTCConformance = ePCHAGTCConformance;
}
/**
* set mValue of type C1G2MValue .
* @param mValue to be set
*/
public void setMValue(final C1G2MValue mValue) {
this.mValue = mValue;
}
/**
* set forwardLinkModulation of type C1G2ForwardLinkModulation .
* @param forwardLinkModulation to be set
*/
public void setForwardLinkModulation(
final C1G2ForwardLinkModulation forwardLinkModulation) {
this.forwardLinkModulation = forwardLinkModulation;
}
/**
* set spectralMaskIndicator of type C1G2SpectralMaskIndicator .
* @param spectralMaskIndicator to be set
*/
public void setSpectralMaskIndicator(
final C1G2SpectralMaskIndicator spectralMaskIndicator) {
this.spectralMaskIndicator = spectralMaskIndicator;
}
/**
* set bDRValue of type UnsignedInteger .
* @param bDRValue to be set
*/
public void setBDRValue(final UnsignedInteger bDRValue) {
this.bDRValue = bDRValue;
}
/**
* set pIEValue of type UnsignedInteger .
* @param pIEValue to be set
*/
public void setPIEValue(final UnsignedInteger pIEValue) {
this.pIEValue = pIEValue;
}
/**
* set minTariValue of type UnsignedInteger .
* @param minTariValue to be set
*/
public void setMinTariValue(final UnsignedInteger minTariValue) {
this.minTariValue = minTariValue;
}
/**
* set maxTariValue of type UnsignedInteger .
* @param maxTariValue to be set
*/
public void setMaxTariValue(final UnsignedInteger maxTariValue) {
this.maxTariValue = maxTariValue;
}
/**
* set stepTariValue of type UnsignedInteger .
* @param stepTariValue to be set
*/
public void setStepTariValue(final UnsignedInteger stepTariValue) {
this.stepTariValue = stepTariValue;
}
// end setter
//getters
/**
* get modeIdentifier of type UnsignedInteger.
* @return type UnsignedInteger to be set
*/
public UnsignedInteger getModeIdentifier() {
return this.modeIdentifier;
}
/**
* get dRValue of type C1G2DRValue.
* @return C1G2DRValue
*/
public C1G2DRValue getDRValue() {
return dRValue;
}
/**
* get ePCHAGTCConformance of type Bit.
* @return type Bit to be set
*/
public Bit getEPCHAGTCConformance() {
return this.ePCHAGTCConformance;
}
/**
* get mValue of type C1G2MValue.
* @return C1G2MValue
*/
public C1G2MValue getMValue() {
return mValue;
}
/**
* get forwardLinkModulation of type C1G2ForwardLinkModulation.
* @return C1G2ForwardLinkModulation
*/
public C1G2ForwardLinkModulation getForwardLinkModulation() {
return forwardLinkModulation;
}
/**
* get spectralMaskIndicator of type C1G2SpectralMaskIndicator.
* @return C1G2SpectralMaskIndicator
*/
public C1G2SpectralMaskIndicator getSpectralMaskIndicator() {
return spectralMaskIndicator;
}
/**
* get bDRValue of type UnsignedInteger.
* @return type UnsignedInteger to be set
*/
public UnsignedInteger getBDRValue() {
return this.bDRValue;
}
/**
* get pIEValue of type UnsignedInteger.
* @return type UnsignedInteger to be set
*/
public UnsignedInteger getPIEValue() {
return this.pIEValue;
}
/**
* get minTariValue of type UnsignedInteger.
* @return type UnsignedInteger to be set
*/
public UnsignedInteger getMinTariValue() {
return this.minTariValue;
}
/**
* get maxTariValue of type UnsignedInteger.
* @return type UnsignedInteger to be set
*/
public UnsignedInteger getMaxTariValue() {
return this.maxTariValue;
}
/**
* get stepTariValue of type UnsignedInteger.
* @return type UnsignedInteger to be set
*/
public UnsignedInteger getStepTariValue() {
return this.stepTariValue;
}
// end getters
//add methods
// end add
/**
* For TLV Parameter length can not be determined at compile time. This method therefore always returns 0.
* @return Integer always zero
*/
public static Integer length() {
return 0;
}
/**
* {@inheritDoc}
*/
public SignedShort getTypeNum() {
return TYPENUM;
}
/**
* {@inheritDoc}
*/
public String getName() {
return "C1G2UHFRFModeTableEntry";
}
/**
* return string representation. All field values but no parameters are included
* @return String
*/
public String toString() {
String result = "C1G2UHFRFModeTableEntry: ";
result += ", modeIdentifier: ";
result += modeIdentifier;
result += ", dRValue: ";
result += dRValue;
result += ", ePCHAGTCConformance: ";
result += ePCHAGTCConformance;
result += ", mValue: ";
result += mValue;
result += ", forwardLinkModulation: ";
result += forwardLinkModulation;
result += ", spectralMaskIndicator: ";
result += spectralMaskIndicator;
result += ", bDRValue: ";
result += bDRValue;
result += ", pIEValue: ";
result += pIEValue;
result += ", minTariValue: ";
result += minTariValue;
result += ", maxTariValue: ";
result += maxTariValue;
result += ", stepTariValue: ";
result += stepTariValue;
result = result.replaceFirst(", ", "");
return result;
}
}