The following code defines the Qualcomm QMDL diagnostic log format. For reference, please read http://blog.sina.com.cn/s/blog_ab2f0b5d0102v2w3.html

Constant definition:

  #define MSG_MASKS_TYPE 1
  #define LOG_MASKS_TYPE 2
  #define EVENT_MASKS_TYPE 4
  #define PKT_TYPE 8
  #define DEINIT_TYPE 16
  #define USER_SPACE_LOG_TYPE 32
  #define DCI_DATA_TYPE 64

QMDL payload definition (in BNF format):

  RAW DIAG STREAM =>  payload *
  payload => payloadType(4 bytes) payloadData
  payloadType => MSG_MASKS_TYPE | LOG_MASKS_TYPE | EVENT_MASKS_TYPE
    |  PKT_TYPE |DEINIT_TYPE  USER_SPACE_LOG_TYPE  | DCI_DATA_TYPE

  payloadData[USER_SPACE_LOG_TYPE|DCI_DATA_TYPE] => payloadPartCount(bytes) payloadPartList
  payloadPartList => payloadPart +
  payloadPart     => payloadPartLength(4bytes) + payloadPartBody

  PacketList => payloadPartBody +

QMDL packet and packet list definition (in BNF):

  PacketList => packet +

  packet => innerPacket CRC16(2bytes) 0x7E(1byte)


QMDL log (BNF):

  qmdl =>  packet +

DLF message format:

  dlf => MSG *
  MSG =>  LEN      KEY    TIMESTAMP   DATA
  2 bytes  2byte  8           LEN-12