170 lines
3.8 KiB
C++
170 lines
3.8 KiB
C++
|
||
// stdafx.h : 标准系统包含文件的包含文件,
|
||
// 或是经常使用但不常更改的
|
||
// 特定于项目的包含文件
|
||
|
||
#pragma once
|
||
|
||
#ifndef VC_EXTRALEAN
|
||
#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
|
||
#endif
|
||
|
||
#include "targetver.h"
|
||
|
||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
|
||
|
||
// 关闭 MFC 对某些常见但经常可放心忽略的警告消息的隐藏
|
||
#define _AFX_ALL_WARNINGS
|
||
|
||
#include <afxwin.h> // MFC 核心组件和标准组件
|
||
#include <afxext.h> // MFC 扩展
|
||
|
||
|
||
#include <afxdisp.h> // MFC 自动化类
|
||
|
||
|
||
|
||
#ifndef _AFX_NO_OLE_SUPPORT
|
||
#include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
|
||
#endif
|
||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||
#include <afxcmn.h> // MFC 对 Windows 公共控件的支持
|
||
#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> // 功能区和控件条的 MFC 支持
|
||
#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与多字节(MultiByte)互转
|
||
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, //手动模式(遥控器控制)
|
||
AUTO_MODE = 1, //自动模式,不受遥控器 PDA控制,PAD仅可以控制道闸 充电 尾单装车
|
||
DEBUG_MODE = 2, //PDA控制,所有单元均可控制
|
||
|
||
}AGV_RUN_MODE_ENUM;
|
||
|
||
typedef enum
|
||
{
|
||
RE_NORMAL_RUN = 0, //运行中
|
||
RE_UNUSUAL_STOP = 1, //磁条丢失异常停车
|
||
RE_POINT_STOP = 2, //横向磁条正常停车(终点)
|
||
RE_A_STOP = 3, //自动停车
|
||
RE_E_STOP = 4, //紧急停车
|
||
}AGV_RUN_RESTATE_ENUM; //运行状态反馈
|
||
|
||
typedef enum
|
||
{
|
||
A_STOP = 0, //自动停车
|
||
FORWARD = 1, //向前行驶
|
||
BACKWARD = 2, //向后行驶
|
||
E_STOP = 3, //紧急停车
|
||
INVALID_ACTION = 4, //定义个无效指令,维持当前停车的反馈状态
|
||
}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) //单行数据的字节数89
|
||
|
||
typedef struct ST_CAN_MESSAGE
|
||
{
|
||
char acSeq[10];
|
||
char acTime[12];
|
||
unsigned char cIndex; // 0或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;
|