import Foundation /// BLE 协议帧结构 /// 格式: [head:1][type:1][subpageTotal:2][curPage:2][dataLen:2][data:N][checksum:1] public struct ProtocolFrame: Sendable { /// 传输方向标识 (0xC7 = APP→Device, 0xB0 = Device→APP) public let head: UInt8 /// 命令类型,对应 CommandType public let type: UInt8 /// 总分包数 (0 = 单帧不分包) public let subpageTotal: UInt16 /// 当前包序号 (从 total-1 倒数到 0) public let curPage: UInt16 /// 数据段字节长度 public let dataLen: UInt16 /// 数据段内容 public let data: Data /// 校验字节 public let checksum: UInt8 }