public void decode(ByteBuffer bytes, int pos) {

          if (bytes.array() == null) {
            return;
          }
          if (bytes.order() != ByteOrder.LITTLE_ENDIAN) {
            bytes.order(ByteOrder.LITTLE_ENDIAN);
          }

          try {
            short m_PresenceVectorTemp = 0;
            m_PresenceVectorTemp = (short) (bytes.get(pos) & 0xff);
            pos += JausUtils.getNumBytes("byte");
            m_PresenceVector = JausUtils.setPV(m_PresenceVectorTemp);
          } catch (Exception e) {
            logger.log(Level.SEVERE, null, e);
          }
          m_SensorID = bytes.getShort(pos) & 0xffff;
          pos += JausUtils.getNumBytes("short");
          if (checkPresenceVector(0)) {
            m_FrameSize = (short) (bytes.get(pos) & 0xff);
            pos += JausUtils.getNumBytes("byte");
          }
          if (checkPresenceVector(1)) {
            m_StillImageFormat = (short) (bytes.get(pos) & 0xff);
            pos += JausUtils.getNumBytes("byte");
          }
        }
        public void encode(ByteBuffer bytes, int pos) {

          if (bytes.array() == null) {
            return;
          }

          if (bytes.order() != ByteOrder.LITTLE_ENDIAN) {
            bytes.order(ByteOrder.LITTLE_ENDIAN);
          }

          try {
            short m_PresenceVectorTemp = (short) JausUtils.getPVInt(m_PresenceVector);
            bytes.put(pos, (byte) m_PresenceVectorTemp);
            pos += JausUtils.getNumBytes("byte");
          } catch (Exception e) {
            logger.log(Level.SEVERE, null, e);
          }
          bytes.putShort(pos, (short) m_SensorID);
          pos += JausUtils.getNumBytes("short");
          if (checkPresenceVector(0)) {
            bytes.put(pos, (byte) m_FrameSize);
            pos += JausUtils.getNumBytes("byte");
          }
          if (checkPresenceVector(1)) {
            bytes.put(pos, (byte) m_StillImageFormat);
            pos += JausUtils.getNumBytes("byte");
          }
        }
      /**
       * Returns the number of bytes the used data members of the class occupies in the buffer. This
       * is not the number of bytes the data type occupies in Java, but the bytes expected on the
       * wire.
       *
       * @return
       */
      public long getSize() {
        long size = 0;

        size += JausUtils.getNumBytes("byte");
        size += JausUtils.getNumBytes("int");
        if (checkPresenceVector(0)) {
          size += JausUtils.getNumBytes("int");
        }

        return size;
      }
      /**
       * Returns the number of bytes the used data members of the class occupies in the buffer. This
       * is not the number of bytes the data type occupies in Java, but the bytes expected on the
       * wire.
       *
       * @return
       */
      public long getSize() {
        long size = 0;

        size += JausUtils.getNumBytes("short");

        return size;
      }
      public void decode(ByteBuffer bytes, int pos) {

        if (bytes.array() == null) {
          return;
        }
        if (bytes.order() != ByteOrder.LITTLE_ENDIAN) {
          bytes.order(ByteOrder.LITTLE_ENDIAN);
        }

        try {
          short m_PresenceVectorTemp = 0;
          m_PresenceVectorTemp = (short) (bytes.get(pos) & 0xff);
          pos += JausUtils.getNumBytes("byte");
          m_PresenceVector = JausUtils.setPV(m_PresenceVectorTemp);
        } catch (Exception e) {
          logger.log(Level.SEVERE, null, e);
        }
        m_RequestID = (short) (bytes.get(pos) & 0xff);
        pos += JausUtils.getNumBytes("byte");
        if (checkPresenceVector(0)) {
          m_ResponseCode = (short) (bytes.get(pos) & 0xff);
          pos += JausUtils.getNumBytes("byte");
        }
        if (checkPresenceVector(1)) {
          char[] m_ErrorMessageTemp = new char[(int) 80];

          int i;
          byte by;
          int tmp = pos;
          for (i = 0; i < 80; i++) {
            by = bytes.get(tmp);
            if (by == 0) {
              break;
            }
            m_ErrorMessageTemp[i] = (char) (by & 0xff);
            tmp++;
          }
          pos += 80;

          m_ErrorMessage = new String(m_ErrorMessageTemp);
          if (i < 80) {
            m_ErrorMessage = m_ErrorMessage.substring(0, i);
          }
        }
      }
      /**
       * Returns the number of bytes the used data members of the class occupies in the buffer. This
       * is not the number of bytes the data type occupies in Java, but the bytes expected on the
       * wire.
       *
       * @return
       */
      public long getSize() {
        long size = 0;

        size += JausUtils.getNumBytes("short");
        for (int i = 0; i < m_StillImageSensorConfigurationRec.size(); i++) {
          size += m_StillImageSensorConfigurationRec.get(i).getSize();
        }

        return size;
      }
      public void decode(ByteBuffer bytes, int pos) {

        if (bytes.array() == null) {
          return;
        }
        if (bytes.order() != ByteOrder.LITTLE_ENDIAN) {
          bytes.order(ByteOrder.LITTLE_ENDIAN);
        }

        m_MessageID = bytes.getShort(pos) & 0xffff;
        pos += JausUtils.getNumBytes("short");
      }
      public void encode(ByteBuffer bytes, int pos) {

        if (bytes.array() == null) {
          return;
        }

        if (bytes.order() != ByteOrder.LITTLE_ENDIAN) {
          bytes.order(ByteOrder.LITTLE_ENDIAN);
        }

        bytes.putShort(pos, (short) m_MessageID);
        pos += JausUtils.getNumBytes("short");
      }
      public void encode(ByteBuffer bytes, int pos) {

        if (bytes.array() == null) {
          return;
        }

        if (bytes.order() != ByteOrder.LITTLE_ENDIAN) {
          bytes.order(ByteOrder.LITTLE_ENDIAN);
        }

        try {
          short m_PresenceVectorTemp = (short) JausUtils.getPVInt(m_PresenceVector);
          bytes.put(pos, (byte) m_PresenceVectorTemp);
          pos += JausUtils.getNumBytes("byte");
        } catch (Exception e) {
          logger.log(Level.SEVERE, null, e);
        }
        bytes.put(pos, (byte) m_RequestID);
        pos += JausUtils.getNumBytes("byte");
        if (checkPresenceVector(0)) {
          bytes.put(pos, (byte) m_ResponseCode);
          pos += JausUtils.getNumBytes("byte");
        }
        if (checkPresenceVector(1)) {
          char[] m_ErrorMessageTemp = new char[80];
          m_ErrorMessageTemp = m_ErrorMessage.toCharArray();

          for (int i = 0; i < m_ErrorMessageTemp.length; i++) {
            bytes.put(pos, (byte) m_ErrorMessageTemp[i]);
            pos++;
          }

          for (int i = m_ErrorMessageTemp.length; i < 80; i++) {
            bytes.put(pos, (byte) 0);
            pos++;
          }
        }
      }
示例#10
0
      public void encode(ByteBuffer bytes, int pos) {

        if (bytes.array() == null) {
          return;
        }

        if (bytes.order() != ByteOrder.LITTLE_ENDIAN) {
          bytes.order(ByteOrder.LITTLE_ENDIAN);
        }

        try {
          short m_PresenceVectorTemp = (short) JausUtils.getPVInt(m_PresenceVector);
          bytes.put(pos, (byte) m_PresenceVectorTemp);
          pos += JausUtils.getNumBytes("byte");
        } catch (Exception e) {
          logger.log(Level.SEVERE, null, e);
        }
        bytes.putInt(pos, m_Command);
        pos += JausUtils.getNumBytes("int");
        if (checkPresenceVector(0)) {
          bytes.putFloat(pos, m_Value);
          pos += JausUtils.getNumBytes("int");
        }
      }
示例#11
0
      public void decode(ByteBuffer bytes, int pos) {

        if (bytes.array() == null) {
          return;
        }
        if (bytes.order() != ByteOrder.LITTLE_ENDIAN) {
          bytes.order(ByteOrder.LITTLE_ENDIAN);
        }

        try {
          short m_PresenceVectorTemp = 0;
          m_PresenceVectorTemp = (short) (bytes.get(pos) & 0xff);
          pos += JausUtils.getNumBytes("byte");
          m_PresenceVector = JausUtils.setPV(m_PresenceVectorTemp);
        } catch (Exception e) {
          logger.log(Level.SEVERE, null, e);
        }
        m_Command = bytes.getInt(pos);
        pos += JausUtils.getNumBytes("int");
        if (checkPresenceVector(0)) {
          m_Value = bytes.getFloat(pos);
          pos += JausUtils.getNumBytes("int");
        }
      }
      public void encode(ByteBuffer bytes, int pos) {

        if (bytes.array() == null) {
          return;
        }

        if (bytes.order() != ByteOrder.LITTLE_ENDIAN) {
          bytes.order(ByteOrder.LITTLE_ENDIAN);
        }

        int size = (int) m_StillImageSensorConfigurationRec.size();
        bytes.putShort(pos, (short) size);
        pos += JausUtils.getNumBytes("short");
        for (int i = 0; i < m_StillImageSensorConfigurationRec.size(); i++) {
          m_StillImageSensorConfigurationRec.get(i).encode(bytes, pos);
          pos += m_StillImageSensorConfigurationRec.get(i).getSize();
        }
      }
      public void decode(ByteBuffer bytes, int pos) {

        if (bytes.array() == null) {
          return;
        }
        if (bytes.order() != ByteOrder.LITTLE_ENDIAN) {
          bytes.order(ByteOrder.LITTLE_ENDIAN);
        }

        int size;
        size = bytes.getShort(pos) & 0xffff;
        pos += JausUtils.getNumBytes("short");
        m_StillImageSensorConfigurationRec = new ArrayList<StillImageSensorConfigurationRec>();
        for (int i = 0; i < size; i++) {
          StillImageSensorConfigurationRec item = new StillImageSensorConfigurationRec();
          item.decode(bytes, pos);
          m_StillImageSensorConfigurationRec.add(item);
          pos += item.getSize();
        }
      }
示例#14
0
      protected void setPresenceVector(int index) {

        m_PresenceVector.set(index);
        m_PresenceVectorTemp = (short) JausUtils.getPVInt(m_PresenceVector);
      }