#ifndef CAN_MESSAGE_HPP #define CAN_MESSAGE_HPP #include #include // CAN 消息结构体 struct CanMessage { uint32_t id; // 帧 ID uint8_t data[8] = {0}; // 数据 uint8_t length; // 长度 CanMessage() : id(0), length(0) { std::memset(data, 0, sizeof(data)); } void clone(const CanMessage* other) { if (other) { this->id = other->id; this->length = other->length; std::memcpy(this->data, other->data, sizeof(this->data)); } } void cloneTo(CanMessage* other) const { if (other) { other->id = this->id; other->length = this->length; std::memcpy(other->data, this->data, sizeof(other->data)); } } }; #endif