kunlang_tbox/include/protocol/protocol_struct.h

27 lines
852 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <string>
#include <vector>
#include <cstdint>
#include <optional>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
// 通用数据包结构(协议层)
struct FullPacket
{
uint8_t start_flag1 = 0x23; // 起始符 '#'
uint8_t start_flag2 = 0x23; // 起始符 '#'
uint8_t command_id; // 命令标识(如 0x81、0xD3 等)
uint8_t response_flag; // 应答标志0xFE 表示命令包)
std::string vin; // 17 字节 VIN 编码ASCII
uint8_t encryption_method; // 加密方式0x01 无加密)
uint16_t data_length; // 数据单元长度
std::vector<uint8_t> data_unit; // 数据单元(二进制)
uint8_t checksum; // BCC 校验值
};