Пример #1
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;
  }
Пример #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 (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;
  }