/** {@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"); } }
/** {@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"); } }