import struct import logging from datetime import datetime class Command191A: def __init__(self): self.command_19 = 0x19 # 卡鉴权命令 self.command_1a = 0x1A # 卡鉴权响应 def parse_19h(self, data): """解析19H卡鉴权命令""" try: print("\n开始解析19H卡鉴权命令...") print(f"接收数据: {data.hex().upper()}") # 基础验证 if len(data) < 14 or data[0:2] != b'JX' or data[2] != self.command_19: logging.warning("19H命令帧格式不正确") return None # 解析数据 pile_id = data[3:11] # 桩号 encrypt_mode = data[11] # 加密方式 data_len = struct.unpack("