Beispiel #1
0
  /** @param message */
  public ArrayList<Object> decodeMessage(SysexMessage message) {
    byte[] data = message.getData();
    boolean parseMsg = true;

    // Set up the string to print
    @SuppressWarnings("unused")
    String strMessage = null;
    if (message.getStatus() == SysexMessage.SYSTEM_EXCLUSIVE) {
      strMessage = "Sysex message: F0" + getHexString(data);
      byte[] arr = message.getData();
      for (int i = 0; i < arr.length; ++i) {
        _fullSysex.add(arr[i]);
      }

      if ((message.getData()[message.getLength() - 2] & 0xFF) != 0xF7) {
        // System.out.println ("msg continues " +
        // Integer.toHexString(message.getData()[message.getLength() -
        // 2]));
        parseMsg = false;
      }
    } else if (message.getStatus() == SysexMessage.SPECIAL_SYSTEM_EXCLUSIVE) {
      strMessage = "Continued Sysex message: F7" + getHexString(data);
      byte[] arr = message.getData();
      for (int i = 0; i < arr.length; ++i) {
        _fullSysex.add(arr[i]);
      }

      if ((message.getData()[message.getLength() - 2] & 0xFF) != 0xF7) {
        parseMsg = false;
      }
    }

    // System.out.println(strMessage);
    // fileDump.writeBytes(data);

    if (parseMsg) {
      ArrayList<Object> retVal = parseMsg(_fullSysex, data);
      _fullSysex.clear();

      return retVal;
    }

    return null;
  }
Beispiel #2
0
 public String decodeMessage(SysexMessage message) {
   byte[] abData = message.getData();
   String strMessage = null;
   // System.out.println("sysex status: " + message.getStatus());
   if (message.getStatus() == SysexMessage.SYSTEM_EXCLUSIVE) {
     strMessage = "Sysex message: F0" + getHexString(abData);
   } else if (message.getStatus() == SysexMessage.SPECIAL_SYSTEM_EXCLUSIVE) {
     strMessage = "Continued Sysex message F7" + getHexString(abData);
     seByteCount--; // do not count the F7
   }
   seByteCount += abData.length + 1;
   seCount++; // for the status byte
   return strMessage;
 }