170 lines
3.8 KiB
C
170 lines
3.8 KiB
C
|
|
|||
|
// stdafx.h : <20><>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>İ<EFBFBD><C4B0><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
|||
|
// <20><><EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>
|
|||
|
// <20>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD>İ<EFBFBD><C4B0><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|||
|
|
|||
|
#pragma once
|
|||
|
|
|||
|
#ifndef VC_EXTRALEAN
|
|||
|
#define VC_EXTRALEAN // <20><> Windows ͷ<><CDB7><EFBFBD>ų<EFBFBD><C5B3><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#endif
|
|||
|
|
|||
|
#include "targetver.h"
|
|||
|
|
|||
|
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // ijЩ CString <20><><EFBFBD>캯<EFBFBD><ECBAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>
|
|||
|
|
|||
|
// <20>ر<EFBFBD> MFC <20><>ijЩ<C4B3><D0A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><C9B7>ĺ<EFBFBD><C4BA>Եľ<D4B5><C4BE><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define _AFX_ALL_WARNINGS
|
|||
|
|
|||
|
#include <afxwin.h> // MFC <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD>
|
|||
|
#include <afxext.h> // MFC <20><>չ
|
|||
|
|
|||
|
|
|||
|
#include <afxdisp.h> // MFC <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#ifndef _AFX_NO_OLE_SUPPORT
|
|||
|
#include <afxdtctl.h> // MFC <20><> Internet Explorer 4 <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>֧<EFBFBD><D6A7>
|
|||
|
#endif
|
|||
|
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
|||
|
#include <afxcmn.h> // MFC <20><> Windows <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>֧<EFBFBD><D6A7>
|
|||
|
#endif // _AFX_NO_AFXCMN_SUPPORT
|
|||
|
|
|||
|
#include<afxsock.h>
|
|||
|
#include "json.h"
|
|||
|
#include <queue>
|
|||
|
|
|||
|
using namespace std;
|
|||
|
|
|||
|
#define WM_NETMESSAGE (WM_USER+9981)
|
|||
|
#define NET_CONNECT_OK 0
|
|||
|
#define NET_DISCONNECT 1
|
|||
|
#define NET_DATA_MSG 2
|
|||
|
#define CAN_DISCONNECT 3
|
|||
|
#define PLC_DISCONNECT 4
|
|||
|
#define APP_DATA_MSG 5
|
|||
|
|
|||
|
|
|||
|
#include <afxcontrolbars.h> // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϳؼ<CDBF><D8BC><EFBFBD><EFBFBD><EFBFBD> MFC ֧<><D6A7>
|
|||
|
#include "../Protocol.h"
|
|||
|
|
|||
|
#ifdef _UNICODE
|
|||
|
#if defined _M_IX86
|
|||
|
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
|||
|
#elif defined _M_X64
|
|||
|
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
|||
|
#else
|
|||
|
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
|||
|
#endif
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
extern CString g_strSavePath;
|
|||
|
extern CString g_strCurTime;
|
|||
|
extern int g_nMsgIdx;
|
|||
|
void LogOutToFile(const char* fmt, ...);
|
|||
|
string _UnicodeToUtf8(CString Unicodestr);
|
|||
|
|
|||
|
|
|||
|
CString UTF8AndMB_Convert(const CString &strSource, UINT nSourceCodePage, UINT nTargetCodePage); // UTF8<46><38><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>(MultiByte)<29><>ת
|
|||
|
CString UTF8ToMB(const CString& utf8Str);
|
|||
|
bool IsTextUTF8(const char* str, ULONGLONG length);
|
|||
|
|
|||
|
|
|||
|
typedef struct ST_THREAD_PARAM
|
|||
|
{
|
|||
|
void * pParent;
|
|||
|
//int nIdx;
|
|||
|
}
|
|||
|
ST_THREAD_PARAM;
|
|||
|
|
|||
|
typedef struct ST_CAN_DEVICE
|
|||
|
{
|
|||
|
int nSendFrameFormat;
|
|||
|
int nSendFrameType;
|
|||
|
int nCanIndex;
|
|||
|
int nDevType;
|
|||
|
}
|
|||
|
ST_CAN_DEVICE;
|
|||
|
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
NET_WR_MSG_RET = 0,
|
|||
|
NET_RD_MSG_RET = 1
|
|||
|
}NET_MSG_TYPE_ENUM;
|
|||
|
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
MANUAL_MODE = 0, //<2F>ֶ<EFBFBD>ģʽ<C4A3><CABD>ң<EFBFBD><D2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>
|
|||
|
AUTO_MODE = 1, //<2F>Զ<EFBFBD>ģʽ<C4A3><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ң<EFBFBD><D2A3><EFBFBD><EFBFBD> PDA<44><41><EFBFBD>ƣ<EFBFBD>PAD<41><44><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF>Ƶ<EFBFBD>բ <20><><EFBFBD><EFBFBD> β<><CEB2>װ<EFBFBD><D7B0>
|
|||
|
DEBUG_MODE = 2, //PDA<44><41><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD>е<EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD>ɿ<EFBFBD><C9BF><EFBFBD>
|
|||
|
|
|||
|
}AGV_RUN_MODE_ENUM;
|
|||
|
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
RE_NORMAL_RUN = 0, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
RE_UNUSUAL_STOP = 1, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>쳣ͣ<ECB3A3><CDA3>
|
|||
|
RE_POINT_STOP = 2, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3>(<28>յ<EFBFBD>)
|
|||
|
RE_A_STOP = 3, //<2F>Զ<EFBFBD>ͣ<EFBFBD><CDA3>
|
|||
|
RE_E_STOP = 4, //<2F><><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3>
|
|||
|
}AGV_RUN_RESTATE_ENUM; //<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
A_STOP = 0, //<2F>Զ<EFBFBD>ͣ<EFBFBD><CDA3>
|
|||
|
FORWARD = 1, //<2F><>ǰ<EFBFBD><C7B0>ʻ
|
|||
|
BACKWARD = 2, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʻ
|
|||
|
E_STOP = 3, //<2F><><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3>
|
|||
|
INVALID_ACTION = 4, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Чָ<D0A7>ά<EEA3AC>ֵ<EFBFBD>ǰͣ<C7B0><CDA3><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>״̬
|
|||
|
}AGV_ACTION_ENUM;
|
|||
|
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
LOG_ERROR = 0,
|
|||
|
LOG_INFO = 1
|
|||
|
}LOG_TYPE_ENUM;
|
|||
|
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
SEND_MSG = 0,
|
|||
|
RECV_MSG = 1
|
|||
|
}CAN_MSG_ENUM;
|
|||
|
|
|||
|
typedef struct NET_PACKET
|
|||
|
{
|
|||
|
char* pData;
|
|||
|
int lLen;
|
|||
|
int nDevId;
|
|||
|
NET_MSG_TYPE_ENUM enType;
|
|||
|
}*pNET_PACKET;
|
|||
|
|
|||
|
|
|||
|
#define DATA_LINE_SIZE (11+13+4+4+11+4+4+4+33) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5>ֽ<EFBFBD><D6BD><EFBFBD>89
|
|||
|
|
|||
|
typedef struct ST_CAN_MESSAGE
|
|||
|
{
|
|||
|
char acSeq[10];
|
|||
|
char acTime[12];
|
|||
|
unsigned char cIndex; // 0<><30>1
|
|||
|
unsigned char acTxRx; // 0:send, 1:recv
|
|||
|
char acID[10];
|
|||
|
unsigned char acFrame;//0:data, 1:remote
|
|||
|
unsigned char acType; //0:standard, 1:extend
|
|||
|
unsigned char cDlc;
|
|||
|
char acData[32];
|
|||
|
|
|||
|
}ST_CAN_MESSAGE;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
typedef struct APP_NET_PACKET
|
|||
|
{
|
|||
|
int lFuncLen;
|
|||
|
int lParamLen;
|
|||
|
char *pFuncData;
|
|||
|
char *pParamData;
|
|||
|
|
|||
|
}*pNET_APP_PACKET;
|