#pragma once #include #include #ifdef BUILD_MCCTRDLL #define MCCTRDLLCLASS __declspec(dllexport) #else #define MCCTRDLLCLASS __declspec(dllimport) #endif #define MC_MESSAGE_SIZE_MAX 512 typedef struct _MC_MSG_GRP { int msgType; int msgSize; char byteMsg[MC_MESSAGE_SIZE_MAX]; } MC_MSG_GRP; typedef struct _MSG_DATA { int msgType; std::string strByteMsg; } MC_DATA; class MCCTRDLLCLASS CMsgDecode { public: CMsgDecode(void); ~CMsgDecode(void); bool getMsg(MC_DATA &msg); void appendPacket(const char *chStream, int size); void appendPacket(const std::string &strStream); void appendByte(char chByte) ; void resetBuf(); std::string createMsg(int nType, const std::string &strMsg); int ReadInt32(const std::string &strBuf); std::string WriteInt32(int nData); private: void discardPacket(size_t Len); std::string m_strBuf; };