#pragma once #include "protocol_struct.h" #include #include #include namespace ProtocolCodec { // 获取当前北京时间,返回 6 字节 vector {year, month, day, hour, minute, second} std::vector get_current_time_bytes(); // 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); std::vector make_ack_response(const FullPacket &request, bool result); } // namespace ProtocolCodec