Beispiel #1
1
  /** {@inheritDoc} */
  public LLRPBitList encodeBinarySpecific() {
    LLRPBitList resultBits = new LLRPBitList();

    if (vendorIdentifier == null) {
      LOGGER.warn(" vendorIdentifier not set");
      throw new MissingParameterException(
          " vendorIdentifier not set  for Parameter of Type Custom");
    }

    resultBits.append(vendorIdentifier.encodeBinary());

    if (parameterSubtype == null) {
      LOGGER.warn(" parameterSubtype not set");
      throw new MissingParameterException(
          " parameterSubtype not set  for Parameter of Type Custom");
    }

    resultBits.append(parameterSubtype.encodeBinary());

    if (data == null) {
      LOGGER.warn(" data not set");
      throw new MissingParameterException(" data not set  for Parameter of Type Custom");
    }

    resultBits.append(data.encodeBinary());

    return resultBits;
  }
Beispiel #2
0
  /** {@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 (vendorIdentifier == null) {
      LOGGER.warn(" vendorIdentifier not set");
      throw new MissingParameterException(" vendorIdentifier not set");
    } else {
      element.addContent(vendorIdentifier.encodeXML("VendorIdentifier", ns));
    }

    if (parameterSubtype == null) {
      LOGGER.warn(" parameterSubtype not set");
      throw new MissingParameterException(" parameterSubtype not set");
    } else {
      element.addContent(parameterSubtype.encodeXML("ParameterSubtype", ns));
    }

    if (data == null) {
      LOGGER.warn(" data not set");
      throw new MissingParameterException(" data not set");
    } else {
      element.addContent(data.encodeXML("Data", ns));
    }

    // parameters
    return element;
  }
Beispiel #3
0
 /** {@inheritDoc} */
 protected void decodeBinarySpecific(LLRPBitList binary) {
   int position = 0;
   int tempByteLength;
   int tempLength = 0;
   int count;
   SignedShort type;
   int fieldCount;
   Custom custom;
   vendorIdentifier = new UnsignedInteger(binary.subList(position, UnsignedInteger.length()));
   position += UnsignedInteger.length();
   parameterSubtype = new UnsignedInteger(binary.subList(position, UnsignedInteger.length()));
   position += UnsignedInteger.length();
   data = new BytesToEnd_HEX(binary.subList(position, binary.length() - position));
   position += (binary.length() - position);
 }
 /** {@inheritDoc} */
 protected void decodeBinarySpecific(LLRPBitList binary) {
   int position = 0;
   int tempByteLength;
   int tempLength = 0;
   int count;
   SignedShort type;
   int fieldCount;
   Custom custom;
   opSpecID = new UnsignedShort(binary.subList(position, UnsignedShort.length()));
   position += UnsignedShort.length();
   accessPassword = new UnsignedInteger(binary.subList(position, UnsignedInteger.length()));
   position += UnsignedInteger.length();
   mB = new TwoBitField(binary.subList(position, TwoBitField.length()));
   position += TwoBitField.length();
   position += reserved0.length();
   wordPointer = new UnsignedShort(binary.subList(position, UnsignedShort.length()));
   position += UnsignedShort.length();
   wordCount = new UnsignedShort(binary.subList(position, UnsignedShort.length()));
   position += UnsignedShort.length();
 }
  /** {@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 (opSpecID == null) {
      LOGGER.warn(" opSpecID not set");
      throw new MissingParameterException(" opSpecID not set");
    } else {
      element.addContent(opSpecID.encodeXML("OpSpecID", ns));
    }

    if (accessPassword == null) {
      LOGGER.warn(" accessPassword not set");
      throw new MissingParameterException(" accessPassword not set");
    } else {
      element.addContent(accessPassword.encodeXML("AccessPassword", ns));
    }

    if (mB == null) {
      LOGGER.warn(" mB not set");
      throw new MissingParameterException(" mB not set");
    } else {
      element.addContent(mB.encodeXML("MB", ns));
    }

    // element.addContent(reserved0.encodeXML("reserved",ns));
    if (wordPointer == null) {
      LOGGER.warn(" wordPointer not set");
      throw new MissingParameterException(" wordPointer not set");
    } else {
      element.addContent(wordPointer.encodeXML("WordPointer", ns));
    }

    if (wordCount == null) {
      LOGGER.warn(" wordCount not set");
      throw new MissingParameterException(" wordCount not set");
    } else {
      element.addContent(wordCount.encodeXML("WordCount", ns));
    }

    // parameters
    return element;
  }
  /** {@inheritDoc} */
  public LLRPBitList encodeBinarySpecific() {
    LLRPBitList resultBits = new LLRPBitList();

    if (opSpecID == null) {
      LOGGER.warn(" opSpecID not set");
      throw new MissingParameterException(
          " opSpecID not set  for Parameter of Type C1G2BlockErase");
    }

    resultBits.append(opSpecID.encodeBinary());

    if (accessPassword == null) {
      LOGGER.warn(" accessPassword not set");
      throw new MissingParameterException(
          " accessPassword not set  for Parameter of Type C1G2BlockErase");
    }

    resultBits.append(accessPassword.encodeBinary());

    if (mB == null) {
      LOGGER.warn(" mB not set");
      throw new MissingParameterException(" mB not set  for Parameter of Type C1G2BlockErase");
    }

    resultBits.append(mB.encodeBinary());
    resultBits.append(reserved0.encodeBinary());

    if (wordPointer == null) {
      LOGGER.warn(" wordPointer not set");
      throw new MissingParameterException(
          " wordPointer not set  for Parameter of Type C1G2BlockErase");
    }

    resultBits.append(wordPointer.encodeBinary());

    if (wordCount == null) {
      LOGGER.warn(" wordCount not set");
      throw new MissingParameterException(
          " wordCount not set  for Parameter of Type C1G2BlockErase");
    }

    resultBits.append(wordCount.encodeBinary());

    return resultBits;
  }