// // Created by zwsd // #pragma once #include #include "config_index.hpp" #include "errorcode.hpp" #include "packet_interface.hpp" namespace iflytop { using namespace zcr; class ICmdParserACK { public: typedef enum { kAckType_none, kAckType_int32, kAckType_buf, } ICmdParserACKType_t; public: int32_t ecode; ICmdParserACKType_t acktype; uint8_t rawdata[512]; int32_t rawlen; int32_t *getAck(int index) { if (index < 0 || index >= rawlen / (int)sizeof(int32_t)) { return nullptr; } return (int32_t *)rawdata + index; } int32_t getAckInt32Val(int index) { if (index < 0 || index >= rawlen / (int)sizeof(int32_t)) { return 0; } return *((int32_t *)rawdata + index); } int32_t getAckInt32Num() { if (rawlen != sizeof(int32_t)) { return 0; } return *((int32_t *)rawdata); } }; typedef function ICmdFunction_t; class ICmdParser { public: virtual void regCMD(const char *cmdname, const char *helpinfo, int paraNum, ICmdFunction_t cmdimpl) = 0; }; } // namespace iflytop