// // Created by zwsd // #pragma once #include "sdk/os/zos.hpp" #include "sdk\components\zprotocols\zcancmder\zcancmder_protocol.hpp" namespace iflytop { namespace zcr { typedef enum { kpacketHeader = 0, kpacketData = 1, kpacketTail = 2, } packet_type_t; class CANPacket { public: CAN_RxHeaderTypeDef pHeader; uint8_t aData[8]; /*8byte table*/ }; }; // namespace zcr using namespace zcr; class CanPacketRxBuffer { public: uint16_t id = 0; CANPacket m_canPacket[125] = {0}; // 用于接收can消息 uint8_t m_canPacketNum = 0; uint8_t m_npacket = 0; uint8_t rxdata[1000] = {0}; int rxdataSize = 0; bool dataIsReady = false; bool isOnReceive = false; bool isUsed = false; bool lostpacket = false; public: uint16_t get_packetindex(); uint16_t get_cmdid(); uint8_t get_subcmdid(); uint8_t get_packetType(); uint8_t *get_data(); uint16_t get_datalen(); Cmdheader_t *get_cmdheader(); bool iscmd(CmdID_t id); template T *get_data_as() { return (T *)get_data(); } }; } // namespace iflytop