#pragma once #include #include #include #include "protocol_struct.hpp" #include "mqtt_config.hpp" namespace ProtocolCodec { // BCC 校验 uint8_t calculate_bcc(const std::vector &data); // 编码 FullPacket 为字节流(使用大端) std::vector encode_full_packet(const FullPacket &packet); // 解码字节流为 FullPacket(成功返回 packet,否则 std::nullopt) std::optional decode_full_packet(const std::vector &buffer); // 构造心跳包 FullPacket create_heartbeat_packet(const std::string &vin); std::optional parse_mqtt_param_setting(const std::vector &data); std::vector make_ack_response(const FullPacket &request, bool result); } // namespace ProtocolCodec