{
  "version": 1,
  "name": "设备通信示例协议 v1.2",
  "frames": [
    {
      "id": "PING",
      "name": "连接检测 · PING",
      "direction": "tx",
      "length": 6,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "01"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": []
    },
    {
      "id": "GET_INFO",
      "name": "读取设备信息",
      "direction": "tx",
      "length": 6,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "02"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": []
    },
    {
      "id": "GET_STATUS",
      "name": "读取系统状态",
      "direction": "tx",
      "length": 6,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "03"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": []
    },
    {
      "id": "GET_IO_STATUS",
      "name": "读取 IO 状态",
      "direction": "tx",
      "length": 6,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "04"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": []
    },
    {
      "id": "SET_OUTPUT",
      "name": "设置负载 / 风扇 / 音频电源 / 灯",
      "direction": "tx",
      "length": 10,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "10"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "load",
          "label": "震动负载（0 关 / 1 开）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "fan",
          "label": "风扇（0 关 / 1 开）",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "audio",
          "label": "音频电源（0 关 / 1 开）",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "led",
          "label": "灯（0 全关 / 1 A / 2 B / 3 双灯）",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "NFC_PROBE",
      "name": "探测 NFC",
      "direction": "tx",
      "length": 6,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "20"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": []
    },
    {
      "id": "NFC_READ",
      "name": "读取 NFC 用户区",
      "direction": "tx",
      "length": 9,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "21"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "address",
          "label": "起始地址（十进制或 0xHEX）",
          "offset": 4,
          "size": 2,
          "type": "uint",
          "default": 16
        },
        {
          "id": "length",
          "label": "读取字节数（1–120）",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 4
        }
      ]
    },
    {
      "id": "NFC_WRITE_VERIFY",
      "name": "写入并校验 NFC 用户区",
      "direction": "tx",
      "length": {
        "min": 10,
        "max": 129
      },
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "22"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "address",
          "label": "起始地址（十进制或 0xHEX）",
          "offset": 4,
          "size": 2,
          "type": "uint",
          "default": 16
        },
        {
          "id": "length",
          "label": "数据字节数（自动）",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "lengthOf": "data"
        },
        {
          "id": "data",
          "label": "写入数据 HEX（1–120 bytes）",
          "offset": 7,
          "size": "remaining",
          "type": "hex",
          "default": "12 34 56 78",
          "end": -2
        }
      ]
    },
    {
      "id": "NFC_SYSTEM_READ",
      "name": "读取 NFC 系统区",
      "direction": "tx",
      "length": 9,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "23"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "address",
          "label": "起始地址（十进制或 0xHEX）",
          "offset": 4,
          "size": 2,
          "type": "uint",
          "default": 16
        },
        {
          "id": "length",
          "label": "读取字节数（1–120）",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 4
        }
      ]
    },
    {
      "id": "MCU_EEPROM_READ",
      "name": "读取 MCU EEPROM",
      "direction": "tx",
      "length": 9,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "30"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "address",
          "label": "起始地址（十进制或 0xHEX）",
          "offset": 4,
          "size": 2,
          "type": "uint",
          "default": 16
        },
        {
          "id": "length",
          "label": "读取字节数（1–120）",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 4
        }
      ]
    },
    {
      "id": "MCU_EEPROM_WRITE",
      "name": "写入 MCU EEPROM",
      "direction": "tx",
      "length": {
        "min": 10,
        "max": 129
      },
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "31"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "address",
          "label": "起始地址（十进制或 0xHEX）",
          "offset": 4,
          "size": 2,
          "type": "uint",
          "default": 16
        },
        {
          "id": "length",
          "label": "数据字节数（自动）",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "lengthOf": "data"
        },
        {
          "id": "data",
          "label": "写入数据 HEX（1–120 bytes）",
          "offset": 7,
          "size": "remaining",
          "type": "hex",
          "default": "12 34 56 78",
          "end": -2
        }
      ]
    },
    {
      "id": "MCU_EEPROM_ERASE",
      "name": "擦除 MCU EEPROM 扇区",
      "direction": "tx",
      "length": 7,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "32"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "sector",
          "label": "扇区号（0–3，每区 512 bytes）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "MCU_EEPROM_VERIFY",
      "name": "校验 MCU EEPROM",
      "direction": "tx",
      "length": {
        "min": 10,
        "max": 129
      },
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "33"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "address",
          "label": "起始地址（十进制或 0xHEX）",
          "offset": 4,
          "size": 2,
          "type": "uint",
          "default": 16
        },
        {
          "id": "length",
          "label": "数据字节数（自动）",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "lengthOf": "data"
        },
        {
          "id": "data",
          "label": "期望数据 HEX（1–120 bytes）",
          "offset": 7,
          "size": "remaining",
          "type": "hex",
          "default": "12 34 56 78",
          "end": -2
        }
      ]
    },
    {
      "id": "PCA_INPUT_READ",
      "name": "读取 PCA 输入",
      "direction": "tx",
      "length": 6,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "40"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": []
    },
    {
      "id": "HALL_SAMPLE_READ",
      "name": "读取霍尔样本",
      "direction": "tx",
      "length": 6,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "41"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": []
    },
    {
      "id": "KEY_EVENT_READ",
      "name": "读取按键事件",
      "direction": "tx",
      "length": 6,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "42"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": []
    },
    {
      "id": "SET_TIME",
      "name": "设置日期时间",
      "direction": "tx",
      "length": 12,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "50"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "year",
          "label": "年份偏移（2000起，0–99）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 26
        },
        {
          "id": "month",
          "label": "月（1–12）",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 10
        },
        {
          "id": "day",
          "label": "日",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 17
        },
        {
          "id": "hour",
          "label": "时（0–23）",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 12
        },
        {
          "id": "minute",
          "label": "分（0–59）",
          "offset": 8,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "second",
          "label": "秒（0–59）",
          "offset": 9,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "GET_TIME",
      "name": "读取日期时间",
      "direction": "tx",
      "length": 6,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "51"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": []
    },
    {
      "id": "SET_ALARM",
      "name": "设置单次闹钟",
      "direction": "tx",
      "length": 14,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "52"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "enable",
          "label": "启用（0 取消 / 1 启用）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 1
        },
        {
          "id": "year",
          "label": "年份偏移（2000起，0–99）",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 26
        },
        {
          "id": "month",
          "label": "月（1–12）",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 10
        },
        {
          "id": "day",
          "label": "日",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 17
        },
        {
          "id": "hour",
          "label": "时（0–23）",
          "offset": 8,
          "size": 1,
          "type": "uint",
          "default": 12
        },
        {
          "id": "minute",
          "label": "分（0–59）",
          "offset": 9,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "second",
          "label": "秒（0–59）",
          "offset": 10,
          "size": 1,
          "type": "uint",
          "default": 20
        },
        {
          "id": "duration",
          "label": "持续时间（1–10）",
          "offset": 11,
          "size": 1,
          "type": "uint",
          "default": 3,
          "unit": "s"
        }
      ]
    },
    {
      "id": "GET_ALARM",
      "name": "读取闹钟",
      "direction": "tx",
      "length": 6,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "53"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": []
    },
    {
      "id": "CLEAR_ALARM",
      "name": "取消 / 停止闹钟",
      "direction": "tx",
      "length": 6,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "54"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": []
    },
    {
      "id": "GET_RTC_DIAG",
      "name": "读取 RTC 诊断页",
      "direction": "tx",
      "length": 7,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "55"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "page",
          "label": "页码（0 状态 / 1 日期 / 2 初值 / 3 实时）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "PONG",
      "name": "连接检测回告",
      "direction": "rx",
      "length": 7,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "81"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "INFO",
      "name": "设备信息",
      "direction": "rx",
      "length": 16,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "82"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "major",
          "label": "协议主版本",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "minor",
          "label": "协议次版本",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "max_payload",
          "label": "最大 DATA 字节数",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "uart_cfg",
          "label": "UART配置（1 = 115200 8N1）",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "capabilities",
          "label": "能力位图",
          "offset": 8,
          "size": 2,
          "type": "uint",
          "default": 0
        },
        {
          "id": "nfc_size",
          "label": "NFC 容量",
          "offset": 10,
          "size": 2,
          "type": "uint",
          "default": 0,
          "unit": "bytes"
        },
        {
          "id": "mcu_size",
          "label": "MCU EEPROM 容量",
          "offset": 12,
          "size": 2,
          "type": "uint",
          "default": 0,
          "unit": "bytes"
        }
      ]
    },
    {
      "id": "STATUS",
      "name": "系统状态",
      "direction": "rx",
      "length": 18,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "83"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "flags",
          "label": "服务状态位图",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "last_error",
          "label": "最近协议错误码",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "rx_overflow",
          "label": "UART 接收溢出",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "frame_count",
          "label": "已接收帧数",
          "offset": 7,
          "size": 2,
          "type": "uint",
          "default": 0
        },
        {
          "id": "output",
          "label": "输出状态位图",
          "offset": 9,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "led",
          "label": "LED 位图（bit0 A / bit1 B）",
          "offset": 10,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "hall_state",
          "label": "霍尔状态位图",
          "offset": 11,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "nfc_ready",
          "label": "NFC 就绪",
          "offset": 12,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "mcu_ready",
          "label": "MCU EEPROM 就绪",
          "offset": 13,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "nfc_error",
          "label": "NFC 错误码",
          "offset": 14,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "mcu_error",
          "label": "MCU EEPROM 错误码",
          "offset": 15,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "IO_STATUS",
      "name": "IO 状态",
      "direction": "rx",
      "length": 16,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "84"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "output",
          "label": "输出位图（bit0 负载 / bit1 风扇 / bit2 音频）",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "led",
          "label": "LED 位图（bit0 A / bit1 B）",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "audio_busy",
          "label": "音频 BUSY 电平",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "hall_state",
          "label": "霍尔状态位图",
          "offset": 8,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "last_key",
          "label": "最近按键 ID",
          "offset": 9,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "last_event",
          "label": "最近事件（1 单击 / 2 双击 / 3 长按）",
          "offset": 10,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "key_overflow",
          "label": "按键队列溢出",
          "offset": 11,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "hall_overflow",
          "label": "霍尔队列溢出",
          "offset": 12,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "pca_input",
          "label": "PCA 输入（bit2 CHRG / bit3 NFC GPO）",
          "offset": 13,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "OUTPUT",
      "name": "输出设置回告",
      "direction": "rx",
      "length": 9,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "90"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "output",
          "label": "输出位图（bit0 负载 / bit1 风扇 / bit2 音频）",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "led",
          "label": "LED 位图",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "NFC_PROBE_RESULT",
      "name": "NFC 探测回告",
      "direction": "rx",
      "length": 9,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "A0"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "ready",
          "label": "NFC 就绪",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "last_error",
          "label": "NFC 错误码",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "NFC_READ_RESULT",
      "name": "读取 NFC 用户区回告",
      "direction": "rx",
      "length": {
        "min": 10,
        "max": 130
      },
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "A1"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "address",
          "label": "起始地址",
          "offset": 5,
          "size": 2,
          "type": "uint",
          "default": 0
        },
        {
          "id": "length",
          "label": "返回数据字节数",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "lengthOf": "data"
        },
        {
          "id": "data",
          "label": "返回数据 HEX",
          "offset": 8,
          "size": "remaining",
          "type": "hex",
          "default": "",
          "end": -2
        }
      ]
    },
    {
      "id": "NFC_SYSTEM_READ_RESULT",
      "name": "读取 NFC 系统区回告",
      "direction": "rx",
      "length": {
        "min": 10,
        "max": 130
      },
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "A3"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "address",
          "label": "起始地址",
          "offset": 5,
          "size": 2,
          "type": "uint",
          "default": 0
        },
        {
          "id": "length",
          "label": "返回数据字节数",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "lengthOf": "data"
        },
        {
          "id": "data",
          "label": "返回数据 HEX",
          "offset": 8,
          "size": "remaining",
          "type": "hex",
          "default": "",
          "end": -2
        }
      ]
    },
    {
      "id": "MCU_EEPROM_READ_RESULT",
      "name": "读取 MCU EEPROM回告",
      "direction": "rx",
      "length": {
        "min": 10,
        "max": 130
      },
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "B0"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "address",
          "label": "起始地址",
          "offset": 5,
          "size": 2,
          "type": "uint",
          "default": 0
        },
        {
          "id": "length",
          "label": "返回数据字节数",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "lengthOf": "data"
        },
        {
          "id": "data",
          "label": "返回数据 HEX",
          "offset": 8,
          "size": "remaining",
          "type": "hex",
          "default": "",
          "end": -2
        }
      ]
    },
    {
      "id": "NFC_WRITE_VERIFY_RESULT",
      "name": "写入并校验 NFC 用户区回告",
      "direction": "rx",
      "length": 10,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "A2"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "address",
          "label": "起始地址",
          "offset": 5,
          "size": 2,
          "type": "uint",
          "default": 0
        },
        {
          "id": "length",
          "label": "完成字节数（失败为 0）",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "MCU_EEPROM_WRITE_RESULT",
      "name": "写入 MCU EEPROM回告",
      "direction": "rx",
      "length": 10,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "B1"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "address",
          "label": "起始地址",
          "offset": 5,
          "size": 2,
          "type": "uint",
          "default": 0
        },
        {
          "id": "length",
          "label": "完成字节数（失败为 0）",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "MCU_EEPROM_VERIFY_RESULT",
      "name": "校验 MCU EEPROM回告",
      "direction": "rx",
      "length": 10,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "B3"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "address",
          "label": "起始地址",
          "offset": 5,
          "size": 2,
          "type": "uint",
          "default": 0
        },
        {
          "id": "length",
          "label": "完成字节数（失败为 0）",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "MCU_EEPROM_ERASE_RESULT",
      "name": "MCU EEPROM 擦除回告",
      "direction": "rx",
      "length": 10,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "B2"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "sector",
          "label": "扇区号",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "sector_base",
          "label": "扇区起始地址",
          "offset": 6,
          "size": 2,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "PCA_INPUT",
      "name": "PCA 输入",
      "direction": "rx",
      "length": 8,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "C0"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "pca_input",
          "label": "PCA 输入（bit2 CHRG / bit3 NFC GPO）",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "HALL_SAMPLE",
      "name": "霍尔样本",
      "direction": "rx",
      "length": 9,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "C1"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "sample",
          "label": "霍尔样本（255 表示队列为空）",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "overflow",
          "label": "霍尔队列溢出",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "KEY_EVENT",
      "name": "按键事件",
      "direction": "rx",
      "length": 11,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "C2"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "has_event",
          "label": "有事件（0 无 / 1 有）",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "key_id",
          "label": "按键 ID",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "event_type",
          "label": "事件（1 单击 / 2 双击 / 3 长按）",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "overflow",
          "label": "按键队列溢出",
          "offset": 8,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "SET_TIME_RESULT",
      "name": "对时回告",
      "direction": "rx",
      "length": 15,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "D0"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "valid",
          "label": "时间有效",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "source",
          "label": "时钟来源（1 RTC / 2 Timer0）",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "year",
          "label": "年份偏移（2000起，0–99）",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "month",
          "label": "月（1–12）",
          "offset": 8,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "day",
          "label": "日",
          "offset": 9,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "hour",
          "label": "时（0–23）",
          "offset": 10,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "minute",
          "label": "分（0–59）",
          "offset": 11,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "second",
          "label": "秒（0–59）",
          "offset": 12,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "TIME",
      "name": "日期时间",
      "direction": "rx",
      "length": 15,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "D1"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "valid",
          "label": "时间有效",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "source",
          "label": "时钟来源（1 RTC / 2 Timer0）",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "year",
          "label": "年份偏移（2000起，0–99）",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "month",
          "label": "月（1–12）",
          "offset": 8,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "day",
          "label": "日",
          "offset": 9,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "hour",
          "label": "时（0–23）",
          "offset": 10,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "minute",
          "label": "分（0–59）",
          "offset": 11,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "second",
          "label": "秒（0–59）",
          "offset": 12,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "SET_ALARM_RESULT",
      "name": "闹钟设置回告",
      "direction": "rx",
      "length": 16,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "D2"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "flags",
          "label": "闹钟状态（bit0 待触发 / bit1 响铃 / bit2 已触发）",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "duration",
          "label": "持续时间",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0,
          "unit": "s"
        },
        {
          "id": "year",
          "label": "年份偏移（2000起，0–99）",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "month",
          "label": "月（1–12）",
          "offset": 8,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "day",
          "label": "日",
          "offset": 9,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "hour",
          "label": "时（0–23）",
          "offset": 10,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "minute",
          "label": "分（0–59）",
          "offset": 11,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "second",
          "label": "秒（0–59）",
          "offset": 12,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "output_error",
          "label": "闹钟输出错误码",
          "offset": 13,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "ALARM",
      "name": "闹钟状态",
      "direction": "rx",
      "length": 16,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "D3"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "flags",
          "label": "闹钟状态（bit0 待触发 / bit1 响铃 / bit2 已触发）",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "duration",
          "label": "持续时间",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0,
          "unit": "s"
        },
        {
          "id": "year",
          "label": "年份偏移（2000起，0–99）",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "month",
          "label": "月（1–12）",
          "offset": 8,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "day",
          "label": "日",
          "offset": 9,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "hour",
          "label": "时（0–23）",
          "offset": 10,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "minute",
          "label": "分（0–59）",
          "offset": 11,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "second",
          "label": "秒（0–59）",
          "offset": 12,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "output_error",
          "label": "闹钟输出错误码",
          "offset": 13,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "CLEAR_ALARM_RESULT",
      "name": "取消闹钟回告",
      "direction": "rx",
      "length": 16,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "D4"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "flags",
          "label": "闹钟状态（bit0 待触发 / bit1 响铃 / bit2 已触发）",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "duration",
          "label": "持续时间",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0,
          "unit": "s"
        },
        {
          "id": "year",
          "label": "年份偏移（2000起，0–99）",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "month",
          "label": "月（1–12）",
          "offset": 8,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "day",
          "label": "日",
          "offset": 9,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "hour",
          "label": "时（0–23）",
          "offset": 10,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "minute",
          "label": "分（0–59）",
          "offset": 11,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "second",
          "label": "秒（0–59）",
          "offset": 12,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "output_error",
          "label": "闹钟输出错误码",
          "offset": 13,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "RTC_DIAG_0",
      "name": "RTC 诊断页 0 · 状态",
      "direction": "rx",
      "length": 20,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "D5"
        },
        {
          "offset": 5,
          "hex": "00"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "format",
          "label": "格式版本",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "origin",
          "label": "来源（1 启动 / 2 SET_TIME）",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "reason",
          "label": "原因码（0 成功，详见配置说明）",
          "offset": 8,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "mismatch",
          "label": "日期差异位图（bit0–5 年月日时分秒）",
          "offset": 9,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "cfg",
          "label": "RTCCFG",
          "offset": 10,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "cr",
          "label": "RTCCR",
          "offset": 11,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "irc",
          "label": "IRC32KCR",
          "offset": 12,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "sw2",
          "label": "P_SW2",
          "offset": 13,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "wait",
          "label": "等待余量",
          "offset": 14,
          "size": 2,
          "type": "uint",
          "default": 0
        },
        {
          "id": "set_count",
          "label": "硬件设时次数",
          "offset": 16,
          "size": 2,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "RTC_DIAG_1",
      "name": "RTC 诊断页 1 · 请求与实际日期",
      "direction": "rx",
      "length": 20,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "D5"
        },
        {
          "offset": 5,
          "hex": "01"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "expected_year",
          "label": "请求 · 年份偏移（2000起，0–99）",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "expected_month",
          "label": "请求 · 月（1–12）",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "expected_day",
          "label": "请求 · 日",
          "offset": 8,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "expected_hour",
          "label": "请求 · 时（0–23）",
          "offset": 9,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "expected_minute",
          "label": "请求 · 分（0–59）",
          "offset": 10,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "expected_second",
          "label": "请求 · 秒（0–59）",
          "offset": 11,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "actual_year",
          "label": "实际 · 年份偏移（2000起，0–99）",
          "offset": 12,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "actual_month",
          "label": "实际 · 月（1–12）",
          "offset": 13,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "actual_day",
          "label": "实际 · 日",
          "offset": 14,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "actual_hour",
          "label": "实际 · 时（0–23）",
          "offset": 15,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "actual_minute",
          "label": "实际 · 分（0–59）",
          "offset": 16,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "actual_second",
          "label": "实际 · 秒（0–59）",
          "offset": 17,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "RTC_DIAG_2",
      "name": "RTC 诊断页 2 · 初值与子秒",
      "direction": "rx",
      "length": 18,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "D5"
        },
        {
          "offset": 5,
          "hex": "02"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "initial_year",
          "label": "初值 · 年份偏移（2000起，0–99）",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "initial_month",
          "label": "初值 · 月（1–12）",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "initial_day",
          "label": "初值 · 日",
          "offset": 8,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "initial_hour",
          "label": "初值 · 时（0–23）",
          "offset": 9,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "initial_minute",
          "label": "初值 · 分（0–59）",
          "offset": 10,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "initial_second",
          "label": "初值 · 秒（0–59）",
          "offset": 11,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "initial_ssec",
          "label": "INISSEC",
          "offset": 12,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "ssec_before",
          "label": "设时前 SSEC",
          "offset": 13,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "ssec_after",
          "label": "设时后 SSEC",
          "offset": 14,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "rtcif",
          "label": "RTCIF",
          "offset": 15,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "RTC_DIAG_3",
      "name": "RTC 诊断页 3 · 实时寄存器",
      "direction": "rx",
      "length": 19,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "D5"
        },
        {
          "offset": 5,
          "hex": "03"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "cfg",
          "label": "RTCCFG",
          "offset": 6,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "cr",
          "label": "RTCCR",
          "offset": 7,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "irc",
          "label": "IRC32KCR",
          "offset": 8,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "rtcif",
          "label": "RTCIF",
          "offset": 9,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "year",
          "label": "年份偏移（2000起，0–99）",
          "offset": 10,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "month",
          "label": "月（1–12）",
          "offset": 11,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "day",
          "label": "日",
          "offset": 12,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "hour",
          "label": "时（0–23）",
          "offset": 13,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "minute",
          "label": "分（0–59）",
          "offset": 14,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "second",
          "label": "秒（0–59）",
          "offset": 15,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "ssec",
          "label": "SSEC",
          "offset": 16,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "RTC_DIAG_ERROR",
      "name": "RTC 诊断页参数错误",
      "direction": "rx",
      "length": 8,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "D5"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "result",
          "label": "结果码（0 成功）",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "page",
          "label": "请求页码",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    },
    {
      "id": "ERROR",
      "name": "协议错误回告",
      "direction": "rx",
      "length": 8,
      "endian": "little",
      "header": "AA 55",
      "match": [
        {
          "offset": 3,
          "hex": "E0"
        }
      ],
      "lengthField": {
        "offset": 2,
        "size": 1,
        "adjust": 5
      },
      "checksum": {
        "algorithm": "crc16-xmodem",
        "offset": -2,
        "start": 2,
        "end": -2,
        "endian": "big"
      },
      "fields": [
        {
          "id": "error",
          "label": "协议错误码",
          "offset": 4,
          "size": 1,
          "type": "uint",
          "default": 0
        },
        {
          "id": "command",
          "label": "出错命令号",
          "offset": 5,
          "size": 1,
          "type": "uint",
          "default": 0
        }
      ]
    }
  ]
}
