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");
          }
        }
예제 #2
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_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);
          }
        }
      }
예제 #3
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");
        }
      }