Пример #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;
  }
Пример #2
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;
   i =
       new C1G2TagInventoryStateAwareI(
           binary.subList(position, C1G2TagInventoryStateAwareI.length()));
   position += C1G2TagInventoryStateAwareI.length();
   s =
       new C1G2TagInventoryStateAwareS(
           binary.subList(position, C1G2TagInventoryStateAwareS.length()));
   position += C1G2TagInventoryStateAwareS.length();
   position += reserved0.length();
 }
Пример #4
0
 /** {@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} */
  protected LLRPBitList encodeBinarySpecific() throws InvalidLLRPMessageException {
    LLRPBitList resultBits = new LLRPBitList();

    if (lLRPStatus == null) {
      // single parameter, may not be null
      LOGGER.warn(" lLRPStatus not set");
      throw new InvalidLLRPMessageException(" lLRPStatus not set");
    } else {
      resultBits.append(lLRPStatus.encodeBinary());
    }

    if (accessSpecList == null) {
      // just warn - it is optional
      LOGGER.info(" accessSpecList not set");
    } else {
      for (AccessSpec field : accessSpecList) {
        resultBits.append(field.encodeBinary());
      }
    }

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

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

    resultBits.append(i.encodeBinary());

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

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

    return resultBits;
  }
Пример #7
0
  /** {@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;
  }
Пример #8
0
  /** {@inheritDoc} */
  protected void decodeBinarySpecific(LLRPBitList binary) throws InvalidLLRPMessageException {
    int position = 0;
    int tempByteLength;
    int tempLength = 0;
    int count;
    SignedShort type;
    int fieldCount;
    Custom custom;
    resetToFactoryDefault = new Bit(binary.subList(position, Bit.length()));
    position += Bit.length();
    position += reserved0.length();

    // look ahead to see type
    // may be optional or exactly once
    type = null;
    tempByteLength = 0;
    tempLength = 0;

    try {
      // if first bit is one it is a TV Parameter
      if (binary.get(position)) {
        // do not take the first bit as it is always 1
        type = new SignedShort(binary.subList(position + 1, 7));
      } else {
        type = new SignedShort(binary.subList(position + RESERVEDLENGTH, TYPENUMBERLENGTH));
        tempByteLength =
            new UnsignedShort(
                    binary.subList(
                        position + RESERVEDLENGTH + TYPENUMBERLENGTH, UnsignedShort.length()))
                .toShort();
        tempLength = 8 * tempByteLength;
      }
    } catch (IllegalArgumentException le) {
      // if an IllegalArgumentException is thrown, list was not long enough so the parameter is
      // missing
      LOGGER.info(
          "SET_READER_CONFIG misses optional parameter of type ReaderEventNotificationSpec");
    }

    if (binary.get(position)) {
      // length can statically be determined for TV Parameters
      tempLength = readerEventNotificationSpec.length();
    }

    if ((type != null) && type.equals(ReaderEventNotificationSpec.TYPENUM)) {
      readerEventNotificationSpec =
          new ReaderEventNotificationSpec(binary.subList(position, tempLength));
      position += tempLength;
      LOGGER.debug(
          " readerEventNotificationSpec is instantiated with ReaderEventNotificationSpec with length"
              + tempLength);
    } else {
      LOGGER.info(
          "SET_READER_CONFIG misses optional parameter of type ReaderEventNotificationSpec");
    }

    // list of parameters
    antennaPropertiesList = new LinkedList<AntennaProperties>();
    LOGGER.debug("decoding parameter antennaPropertiesList ");

    while (position < binary.length()) {
      // store if one parameter matched
      boolean atLeastOnce = false;

      // look ahead to see type
      // if first bit is one it is a TV Parameter
      if (binary.get(position)) {
        // do not take the first bit as it is always 1
        type = new SignedShort(binary.subList(position + 1, 7));
      } else {
        type = new SignedShort(binary.subList(position + RESERVEDLENGTH, TYPENUMBERLENGTH));
        tempByteLength =
            new UnsignedShort(
                    binary.subList(
                        position + RESERVEDLENGTH + TYPENUMBERLENGTH, UnsignedShort.length()))
                .toShort();
        tempLength = 8 * tempByteLength;
      }

      // add parameter to list if type number matches
      if ((type != null) && type.equals(AntennaProperties.TYPENUM)) {
        // if first bit is 1 it is a TV Parameter
        if (binary.get(position)) {
          // length can statically be determined for TV Parameters
          tempLength = AntennaProperties.length();
        }

        antennaPropertiesList.add(new AntennaProperties(binary.subList(position, tempLength)));
        LOGGER.debug("adding AntennaProperties to antennaPropertiesList ");
        atLeastOnce = true;
        position += tempLength;
      }

      if (!atLeastOnce) {
        // no parameter matched therefore we jump out of the loop
        break;
      }
    }

    // if list is still empty no parameter matched
    if (antennaPropertiesList.isEmpty()) {
      LOGGER.info("encoded message does not contain parameter for optional antennaPropertiesList");
    }

    // list of parameters
    antennaConfigurationList = new LinkedList<AntennaConfiguration>();
    LOGGER.debug("decoding parameter antennaConfigurationList ");

    while (position < binary.length()) {
      // store if one parameter matched
      boolean atLeastOnce = false;

      // look ahead to see type
      // if first bit is one it is a TV Parameter
      if (binary.get(position)) {
        // do not take the first bit as it is always 1
        type = new SignedShort(binary.subList(position + 1, 7));
      } else {
        type = new SignedShort(binary.subList(position + RESERVEDLENGTH, TYPENUMBERLENGTH));
        tempByteLength =
            new UnsignedShort(
                    binary.subList(
                        position + RESERVEDLENGTH + TYPENUMBERLENGTH, UnsignedShort.length()))
                .toShort();
        tempLength = 8 * tempByteLength;
      }

      // add parameter to list if type number matches
      if ((type != null) && type.equals(AntennaConfiguration.TYPENUM)) {
        // if first bit is 1 it is a TV Parameter
        if (binary.get(position)) {
          // length can statically be determined for TV Parameters
          tempLength = AntennaConfiguration.length();
        }

        antennaConfigurationList.add(
            new AntennaConfiguration(binary.subList(position, tempLength)));
        LOGGER.debug("adding AntennaConfiguration to antennaConfigurationList ");
        atLeastOnce = true;
        position += tempLength;
      }

      if (!atLeastOnce) {
        // no parameter matched therefore we jump out of the loop
        break;
      }
    }

    // if list is still empty no parameter matched
    if (antennaConfigurationList.isEmpty()) {
      LOGGER.info(
          "encoded message does not contain parameter for optional antennaConfigurationList");
    }

    // look ahead to see type
    // may be optional or exactly once
    type = null;
    tempByteLength = 0;
    tempLength = 0;

    try {
      // if first bit is one it is a TV Parameter
      if (binary.get(position)) {
        // do not take the first bit as it is always 1
        type = new SignedShort(binary.subList(position + 1, 7));
      } else {
        type = new SignedShort(binary.subList(position + RESERVEDLENGTH, TYPENUMBERLENGTH));
        tempByteLength =
            new UnsignedShort(
                    binary.subList(
                        position + RESERVEDLENGTH + TYPENUMBERLENGTH, UnsignedShort.length()))
                .toShort();
        tempLength = 8 * tempByteLength;
      }
    } catch (IllegalArgumentException le) {
      // if an IllegalArgumentException is thrown, list was not long enough so the parameter is
      // missing
      LOGGER.info("SET_READER_CONFIG misses optional parameter of type ROReportSpec");
    }

    if (binary.get(position)) {
      // length can statically be determined for TV Parameters
      tempLength = rOReportSpec.length();
    }

    if ((type != null) && type.equals(ROReportSpec.TYPENUM)) {
      rOReportSpec = new ROReportSpec(binary.subList(position, tempLength));
      position += tempLength;
      LOGGER.debug(" rOReportSpec is instantiated with ROReportSpec with length" + tempLength);
    } else {
      LOGGER.info("SET_READER_CONFIG misses optional parameter of type ROReportSpec");
    }

    // look ahead to see type
    // may be optional or exactly once
    type = null;
    tempByteLength = 0;
    tempLength = 0;

    try {
      // if first bit is one it is a TV Parameter
      if (binary.get(position)) {
        // do not take the first bit as it is always 1
        type = new SignedShort(binary.subList(position + 1, 7));
      } else {
        type = new SignedShort(binary.subList(position + RESERVEDLENGTH, TYPENUMBERLENGTH));
        tempByteLength =
            new UnsignedShort(
                    binary.subList(
                        position + RESERVEDLENGTH + TYPENUMBERLENGTH, UnsignedShort.length()))
                .toShort();
        tempLength = 8 * tempByteLength;
      }
    } catch (IllegalArgumentException le) {
      // if an IllegalArgumentException is thrown, list was not long enough so the parameter is
      // missing
      LOGGER.info("SET_READER_CONFIG misses optional parameter of type AccessReportSpec");
    }

    if (binary.get(position)) {
      // length can statically be determined for TV Parameters
      tempLength = accessReportSpec.length();
    }

    if ((type != null) && type.equals(AccessReportSpec.TYPENUM)) {
      accessReportSpec = new AccessReportSpec(binary.subList(position, tempLength));
      position += tempLength;
      LOGGER.debug(
          " accessReportSpec is instantiated with AccessReportSpec with length" + tempLength);
    } else {
      LOGGER.info("SET_READER_CONFIG misses optional parameter of type AccessReportSpec");
    }

    // look ahead to see type
    // may be optional or exactly once
    type = null;
    tempByteLength = 0;
    tempLength = 0;

    try {
      // if first bit is one it is a TV Parameter
      if (binary.get(position)) {
        // do not take the first bit as it is always 1
        type = new SignedShort(binary.subList(position + 1, 7));
      } else {
        type = new SignedShort(binary.subList(position + RESERVEDLENGTH, TYPENUMBERLENGTH));
        tempByteLength =
            new UnsignedShort(
                    binary.subList(
                        position + RESERVEDLENGTH + TYPENUMBERLENGTH, UnsignedShort.length()))
                .toShort();
        tempLength = 8 * tempByteLength;
      }
    } catch (IllegalArgumentException le) {
      // if an IllegalArgumentException is thrown, list was not long enough so the parameter is
      // missing
      LOGGER.info("SET_READER_CONFIG misses optional parameter of type KeepaliveSpec");
    }

    if (binary.get(position)) {
      // length can statically be determined for TV Parameters
      tempLength = keepaliveSpec.length();
    }

    if ((type != null) && type.equals(KeepaliveSpec.TYPENUM)) {
      keepaliveSpec = new KeepaliveSpec(binary.subList(position, tempLength));
      position += tempLength;
      LOGGER.debug(" keepaliveSpec is instantiated with KeepaliveSpec with length" + tempLength);
    } else {
      LOGGER.info("SET_READER_CONFIG misses optional parameter of type KeepaliveSpec");
    }

    // list of parameters
    gPOWriteDataList = new LinkedList<GPOWriteData>();
    LOGGER.debug("decoding parameter gPOWriteDataList ");

    while (position < binary.length()) {
      // store if one parameter matched
      boolean atLeastOnce = false;

      // look ahead to see type
      // if first bit is one it is a TV Parameter
      if (binary.get(position)) {
        // do not take the first bit as it is always 1
        type = new SignedShort(binary.subList(position + 1, 7));
      } else {
        type = new SignedShort(binary.subList(position + RESERVEDLENGTH, TYPENUMBERLENGTH));
        tempByteLength =
            new UnsignedShort(
                    binary.subList(
                        position + RESERVEDLENGTH + TYPENUMBERLENGTH, UnsignedShort.length()))
                .toShort();
        tempLength = 8 * tempByteLength;
      }

      // add parameter to list if type number matches
      if ((type != null) && type.equals(GPOWriteData.TYPENUM)) {
        // if first bit is 1 it is a TV Parameter
        if (binary.get(position)) {
          // length can statically be determined for TV Parameters
          tempLength = GPOWriteData.length();
        }

        gPOWriteDataList.add(new GPOWriteData(binary.subList(position, tempLength)));
        LOGGER.debug("adding GPOWriteData to gPOWriteDataList ");
        atLeastOnce = true;
        position += tempLength;
      }

      if (!atLeastOnce) {
        // no parameter matched therefore we jump out of the loop
        break;
      }
    }

    // if list is still empty no parameter matched
    if (gPOWriteDataList.isEmpty()) {
      LOGGER.info("encoded message does not contain parameter for optional gPOWriteDataList");
    }

    // list of parameters
    gPIPortCurrentStateList = new LinkedList<GPIPortCurrentState>();
    LOGGER.debug("decoding parameter gPIPortCurrentStateList ");

    while (position < binary.length()) {
      // store if one parameter matched
      boolean atLeastOnce = false;

      // look ahead to see type
      // if first bit is one it is a TV Parameter
      if (binary.get(position)) {
        // do not take the first bit as it is always 1
        type = new SignedShort(binary.subList(position + 1, 7));
      } else {
        type = new SignedShort(binary.subList(position + RESERVEDLENGTH, TYPENUMBERLENGTH));
        tempByteLength =
            new UnsignedShort(
                    binary.subList(
                        position + RESERVEDLENGTH + TYPENUMBERLENGTH, UnsignedShort.length()))
                .toShort();
        tempLength = 8 * tempByteLength;
      }

      // add parameter to list if type number matches
      if ((type != null) && type.equals(GPIPortCurrentState.TYPENUM)) {
        // if first bit is 1 it is a TV Parameter
        if (binary.get(position)) {
          // length can statically be determined for TV Parameters
          tempLength = GPIPortCurrentState.length();
        }

        gPIPortCurrentStateList.add(new GPIPortCurrentState(binary.subList(position, tempLength)));
        LOGGER.debug("adding GPIPortCurrentState to gPIPortCurrentStateList ");
        atLeastOnce = true;
        position += tempLength;
      }

      if (!atLeastOnce) {
        // no parameter matched therefore we jump out of the loop
        break;
      }
    }

    // if list is still empty no parameter matched
    if (gPIPortCurrentStateList.isEmpty()) {
      LOGGER.info(
          "encoded message does not contain parameter for optional gPIPortCurrentStateList");
    }

    // look ahead to see type
    // may be optional or exactly once
    type = null;
    tempByteLength = 0;
    tempLength = 0;

    try {
      // if first bit is one it is a TV Parameter
      if (binary.get(position)) {
        // do not take the first bit as it is always 1
        type = new SignedShort(binary.subList(position + 1, 7));
      } else {
        type = new SignedShort(binary.subList(position + RESERVEDLENGTH, TYPENUMBERLENGTH));
        tempByteLength =
            new UnsignedShort(
                    binary.subList(
                        position + RESERVEDLENGTH + TYPENUMBERLENGTH, UnsignedShort.length()))
                .toShort();
        tempLength = 8 * tempByteLength;
      }
    } catch (IllegalArgumentException le) {
      // if an IllegalArgumentException is thrown, list was not long enough so the parameter is
      // missing
      LOGGER.info("SET_READER_CONFIG misses optional parameter of type EventsAndReports");
    }

    if (binary.get(position)) {
      // length can statically be determined for TV Parameters
      tempLength = eventsAndReports.length();
    }

    if ((type != null) && type.equals(EventsAndReports.TYPENUM)) {
      eventsAndReports = new EventsAndReports(binary.subList(position, tempLength));
      position += tempLength;
      LOGGER.debug(
          " eventsAndReports is instantiated with EventsAndReports with length" + tempLength);
    } else {
      LOGGER.info("SET_READER_CONFIG misses optional parameter of type EventsAndReports");
    }

    // list of parameters
    customList = new LinkedList<Custom>();
    LOGGER.debug("decoding parameter customList ");

    while (position < binary.length()) {
      // store if one parameter matched
      boolean atLeastOnce = false;

      // look ahead to see type
      // if first bit is one it is a TV Parameter
      if (binary.get(position)) {
        // do not take the first bit as it is always 1
        type = new SignedShort(binary.subList(position + 1, 7));
      } else {
        type = new SignedShort(binary.subList(position + RESERVEDLENGTH, TYPENUMBERLENGTH));
        tempByteLength =
            new UnsignedShort(
                    binary.subList(
                        position + RESERVEDLENGTH + TYPENUMBERLENGTH, UnsignedShort.length()))
                .toShort();
        tempLength = 8 * tempByteLength;
      }

      // custom
      if ((type != null) && type.equals(Custom.TYPENUM)) {
        Custom cus = new Custom(binary.subList(position, tempLength));
        // allowed custom parameters for this parameter
        // end allowed parameters
        // if none matched continue wasn't called and we add just cus as we found no specific vendor
        // implementation
        customList.add(cus);
        position += tempLength;
        atLeastOnce = true;
      }

      if (!atLeastOnce) {
        // no parameter matched therefore we jump out of the loop
        break;
      }
    }

    // if list is still empty no parameter matched
    if (customList.isEmpty()) {
      LOGGER.info("encoded message does not contain parameter for optional customList");
    }
  }
Пример #9
0
  /** {@inheritDoc} */
  protected LLRPBitList encodeBinarySpecific() throws InvalidLLRPMessageException {
    LLRPBitList resultBits = new LLRPBitList();

    if (resetToFactoryDefault == null) {
      LOGGER.warn(" resetToFactoryDefault not set");
      throw new InvalidLLRPMessageException(
          " resetToFactoryDefault not set  for Parameter of Type SET_READER_CONFIG");
    }

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

    if (readerEventNotificationSpec == null) {
      // optional parameter, may be null
      LOGGER.info(" readerEventNotificationSpec not set");
    } else {
      resultBits.append(readerEventNotificationSpec.encodeBinary());
    }

    if (antennaPropertiesList == null) {
      // just warn - it is optional
      LOGGER.info(" antennaPropertiesList not set");
    } else {
      for (AntennaProperties field : antennaPropertiesList) {
        resultBits.append(field.encodeBinary());
      }
    }

    if (antennaConfigurationList == null) {
      // just warn - it is optional
      LOGGER.info(" antennaConfigurationList not set");
    } else {
      for (AntennaConfiguration field : antennaConfigurationList) {
        resultBits.append(field.encodeBinary());
      }
    }

    if (rOReportSpec == null) {
      // optional parameter, may be null
      LOGGER.info(" rOReportSpec not set");
    } else {
      resultBits.append(rOReportSpec.encodeBinary());
    }

    if (accessReportSpec == null) {
      // optional parameter, may be null
      LOGGER.info(" accessReportSpec not set");
    } else {
      resultBits.append(accessReportSpec.encodeBinary());
    }

    if (keepaliveSpec == null) {
      // optional parameter, may be null
      LOGGER.info(" keepaliveSpec not set");
    } else {
      resultBits.append(keepaliveSpec.encodeBinary());
    }

    if (gPOWriteDataList == null) {
      // just warn - it is optional
      LOGGER.info(" gPOWriteDataList not set");
    } else {
      for (GPOWriteData field : gPOWriteDataList) {
        resultBits.append(field.encodeBinary());
      }
    }

    if (gPIPortCurrentStateList == null) {
      // just warn - it is optional
      LOGGER.info(" gPIPortCurrentStateList not set");
    } else {
      for (GPIPortCurrentState field : gPIPortCurrentStateList) {
        resultBits.append(field.encodeBinary());
      }
    }

    if (eventsAndReports == null) {
      // optional parameter, may be null
      LOGGER.info(" eventsAndReports not set");
    } else {
      resultBits.append(eventsAndReports.encodeBinary());
    }

    if (customList == null) {
      // just warn - it is optional
      LOGGER.info(" customList not set");
    } else {
      for (Custom field : customList) {
        resultBits.append(field.encodeBinary());
      }
    }

    return resultBits;
  }
Пример #10
0
 /**
  * Constructor to create message from binary encoded message calls decodeBinary to decode message.
  *
  * @param list to be decoded
  */
 public SET_READER_CONFIG(final LLRPBitList list) throws InvalidLLRPMessageException {
   decodeBinary(list.toByteArray());
 }
 /**
  * Constructor to create message from binary encoded message calls decodeBinary to decode message.
  *
  * @param list to be decoded
  */
 public GET_ACCESSSPECS_RESPONSE(final LLRPBitList list) throws InvalidLLRPMessageException {
   decodeBinary(list.toByteArray());
 }
  /** {@inheritDoc} */
  protected void decodeBinarySpecific(LLRPBitList binary) throws InvalidLLRPMessageException {
    int position = 0;
    int tempByteLength;
    int tempLength = 0;
    int count;
    SignedShort type;
    int fieldCount;
    Custom custom;

    // look ahead to see type
    // may be optional or exactly once
    type = null;
    tempByteLength = 0;
    tempLength = 0;

    try {
      // if first bit is one it is a TV Parameter
      if (binary.get(position)) {
        // do not take the first bit as it is always 1
        type = new SignedShort(binary.subList(position + 1, 7));
      } else {
        type = new SignedShort(binary.subList(position + RESERVEDLENGTH, TYPENUMBERLENGTH));
        tempByteLength =
            new UnsignedShort(
                    binary.subList(
                        position + RESERVEDLENGTH + TYPENUMBERLENGTH, UnsignedShort.length()))
                .toShort();
        tempLength = 8 * tempByteLength;
      }
    } catch (IllegalArgumentException le) {
      // if an IllegalArgumentException is thrown, list was not long enough so the parameter is
      // missing
      LOGGER.warn("GET_ACCESSSPECS_RESPONSE misses non optional parameter of type LLRPStatus");
      throw new InvalidLLRPMessageException(
          "GET_ACCESSSPECS_RESPONSE misses non optional parameter of type LLRPStatus");
    }

    if (binary.get(position)) {
      // length can statically be determined for TV Parameters
      tempLength = lLRPStatus.length();
    }

    if ((type != null) && type.equals(LLRPStatus.TYPENUM)) {
      lLRPStatus = new LLRPStatus(binary.subList(position, tempLength));
      position += tempLength;
      LOGGER.debug(" lLRPStatus is instantiated with LLRPStatus with length" + tempLength);
    } else {
      LOGGER.warn("GET_ACCESSSPECS_RESPONSE misses non optional parameter of type LLRPStatus");
      throw new InvalidLLRPMessageException(
          "GET_ACCESSSPECS_RESPONSE misses non optional parameter of type LLRPStatus");
    }

    // list of parameters
    accessSpecList = new LinkedList<AccessSpec>();
    LOGGER.debug("decoding parameter accessSpecList ");

    while (position < binary.length()) {
      // store if one parameter matched
      boolean atLeastOnce = false;

      // look ahead to see type
      // if first bit is one it is a TV Parameter
      if (binary.get(position)) {
        // do not take the first bit as it is always 1
        type = new SignedShort(binary.subList(position + 1, 7));
      } else {
        type = new SignedShort(binary.subList(position + RESERVEDLENGTH, TYPENUMBERLENGTH));
        tempByteLength =
            new UnsignedShort(
                    binary.subList(
                        position + RESERVEDLENGTH + TYPENUMBERLENGTH, UnsignedShort.length()))
                .toShort();
        tempLength = 8 * tempByteLength;
      }

      // add parameter to list if type number matches
      if ((type != null) && type.equals(AccessSpec.TYPENUM)) {
        // if first bit is 1 it is a TV Parameter
        if (binary.get(position)) {
          // length can statically be determined for TV Parameters
          tempLength = AccessSpec.length();
        }

        accessSpecList.add(new AccessSpec(binary.subList(position, tempLength)));
        LOGGER.debug("adding AccessSpec to accessSpecList ");
        atLeastOnce = true;
        position += tempLength;
      }

      if (!atLeastOnce) {
        // no parameter matched therefore we jump out of the loop
        break;
      }
    }

    // if list is still empty no parameter matched
    if (accessSpecList.isEmpty()) {
      LOGGER.info("encoded message does not contain parameter for optional accessSpecList");
    }
  }