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

  #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

  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 +

       (HDLC Decode )
PacketList => packet +

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


------------------------
 qmdl 文件消息格式组成
------------------------
qmdl =>  packet +

------------------------
 dlf 文件消息格式组成
------------------------
 dlf => MSG *
 MSG =>  LEN      KEY    TIMESTAMP   DATA
2 bytes  2byte  8           LEN-12

 KEY =>   0x1FFD   测试软件信息   (自定义消息)
|0x1FFC   Annotation纯字符串消息  (自定义消息)
|0x1FEA   DIAG TX 发送的诊断消息   CMD = ...
|0x1FF0   DIAG RX 接受的诊断消息   CMD = ...
|0x1000 - 0x7XXXX  LOG 消息        CMD=0x10,LOG_CODE=...
|0x1FFB   EVENT                    CMD=0x60,EVENTID = ...