You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
936 B
C
50 lines
936 B
C
|
7 years ago
|
#pragma once
|
||
|
|
|
||
|
|
#include <string>
|
||
|
|
#include <vector>
|
||
|
|
|
||
|
|
#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;
|
||
|
|
};
|
||
|
|
|