添加项目文件。
This commit is contained in:
97
Plugin/KcCtrl/KcConfigDlg.cpp
Normal file
97
Plugin/KcCtrl/KcConfigDlg.cpp
Normal file
@@ -0,0 +1,97 @@
|
||||
// KcConfigDlg.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "KcCtrl.h"
|
||||
#include "resource.h"
|
||||
#include "KcConfigDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
|
||||
// CKcConfigDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
IMPLEMENT_DYNAMIC(CKcConfigDlg, CDialogEx)
|
||||
|
||||
CKcConfigDlg::CKcConfigDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialogEx(IDD_CK_CFG_DLG, pParent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CKcConfigDlg::~CKcConfigDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CKcConfigDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_IPADDRESS1, m_IpAddress);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CKcConfigDlg, CDialogEx)
|
||||
ON_BN_CLICKED(IDC_BTN_SETTING, &CKcConfigDlg::OnBnClickedBtnSetting)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CKcConfigDlg <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
BOOL CKcConfigDlg::OnInitDialog()
|
||||
{
|
||||
CDialogEx::OnInitDialog();
|
||||
|
||||
CString strPort;
|
||||
strPort.Format("%d", theApp.m_nControllerPort);
|
||||
GetDlgItem(IDC_EDIT_PORT)->SetWindowText(strPort);
|
||||
|
||||
|
||||
CString strIp = theApp.m_strControllerIp;
|
||||
int ip_arry[4] = {}; //<2F><><EFBFBD><EFBFBD>ip<69><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int j;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (i != 3)
|
||||
j = strIp.Find('.');//<2F>ҵ<EFBFBD><D2B5>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>ŵ<EFBFBD>λ<EFBFBD><CEBB>
|
||||
else
|
||||
j = 4;
|
||||
ip_arry[i] = atoi(strIp.Left(j));//ת<><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>β<EFBFBD><CEB2><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
strIp.Delete(0, j + 1);
|
||||
}
|
||||
//<2F><><EFBFBD><EFBFBD>ip<69><70>ַ
|
||||
m_IpAddress.SetAddress(ip_arry[0], ip_arry[1], ip_arry[2], ip_arry[3]);
|
||||
|
||||
|
||||
CString iniPath = theApp.m_strModulePath + "\\config.ini";
|
||||
|
||||
char acAuth[48];
|
||||
GetPrivateProfileString("SERVER", "AUTH", "", acAuth, 48, iniPath);
|
||||
GetDlgItem(IDC_EDIT_AUTH)->SetWindowText(acAuth);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// <20>쳣: OCX <20><><EFBFBD><EFBFBD>ҳӦ<D2B3><D3A6><EFBFBD><EFBFBD> FALSE
|
||||
}
|
||||
|
||||
|
||||
void CKcConfigDlg::OnBnClickedBtnSetting()
|
||||
{
|
||||
unsigned char* ip{};
|
||||
DWORD dword;
|
||||
m_IpAddress.GetAddress(dword);
|
||||
ip = (unsigned char*)&dword;
|
||||
theApp.m_strControllerIp.Format("%u.%u.%u.%u", *(ip + 3), *(ip + 2), *(ip + 1), *ip);
|
||||
|
||||
CString strPort;
|
||||
GetDlgItem(IDC_EDIT_PORT)->GetWindowText(strPort);
|
||||
CString strAuth;
|
||||
GetDlgItem(IDC_EDIT_AUTH)->GetWindowText(strAuth);
|
||||
|
||||
CString iniPath = theApp.m_strModulePath + "\\config.ini";
|
||||
WritePrivateProfileString("SERVER", "IP", theApp.m_strControllerIp, iniPath);
|
||||
WritePrivateProfileString("SERVER", "PORT", strPort, iniPath);
|
||||
WritePrivateProfileString("SERVER", "AUTH", strAuth, iniPath);
|
||||
|
||||
theApp.m_nControllerPort = atoi(strPort);
|
||||
AfxMessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
OnOK();
|
||||
}
|
||||
28
Plugin/KcCtrl/KcConfigDlg.h
Normal file
28
Plugin/KcCtrl/KcConfigDlg.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
#include "afxcmn.h"
|
||||
|
||||
|
||||
// CKcConfigDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
class CKcConfigDlg : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CKcConfigDlg)
|
||||
|
||||
public:
|
||||
CKcConfigDlg(CWnd* pParent = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
virtual ~CKcConfigDlg();
|
||||
|
||||
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_CK_CFG_DLG };
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<><D6A7>
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
CIPAddressCtrl m_IpAddress;
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnBnClickedBtnSetting();
|
||||
};
|
||||
215
Plugin/KcCtrl/KcCtrl.cpp
Normal file
215
Plugin/KcCtrl/KcCtrl.cpp
Normal file
@@ -0,0 +1,215 @@
|
||||
|
||||
// Vcs-Client.cpp : <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "KcCtrl.h"
|
||||
#include "KcMainDlg.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
CCEXPipeClientBase* g_pstPipeClient = CCEXPipeClientBase::CreateObj();
|
||||
// CVcsClientApp
|
||||
|
||||
BEGIN_MESSAGE_MAP(CKcCtrlApp, CWinApp)
|
||||
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CVcsClientApp <20><><EFBFBD><EFBFBD>
|
||||
|
||||
CKcCtrlApp::CKcCtrlApp()
|
||||
{
|
||||
// ֧<><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
|
||||
|
||||
m_nReqPointId = -1;
|
||||
m_nReqPointType = -1;
|
||||
}
|
||||
|
||||
|
||||
// Ψһ<CEA8><D2BB>һ<EFBFBD><D2BB> CVcsClientApp <20><><EFBFBD><EFBFBD>
|
||||
|
||||
CKcCtrlApp theApp;
|
||||
HANDLE hmutex;
|
||||
|
||||
// CVcsClientApp <20><>ʼ<EFBFBD><CABC>
|
||||
|
||||
|
||||
BOOL CKcCtrlApp::InitInstance()
|
||||
{
|
||||
|
||||
hmutex = CreateMutexA(nullptr, FALSE, "agv-plugin-kc-ctrl");
|
||||
int err = GetLastError();
|
||||
if (err == ERROR_ALREADY_EXISTS) {
|
||||
CloseHandle(hmutex);
|
||||
hmutex = nullptr;
|
||||
//AfxMessageBox("<22><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CHAR dir[1000] = { 0 };
|
||||
int filelen = GetModuleFileName(NULL, dir, 1000);
|
||||
//WriteLog(dir);
|
||||
int i = filelen;
|
||||
while (dir[i] != '\\')i--;
|
||||
dir[i] = '\0';
|
||||
m_strModulePath = dir;
|
||||
|
||||
GetCtrlServerInfo();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Windows XP <20>ϵ<EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD>嵥ָ<E5B5A5><D6B8>Ҫ
|
||||
// ʹ<><CAB9> ComCtl32.dll <20>汾 6 <20><><EFBFBD><EFBFBD><EFBFBD>߰汾<DFB0><E6B1BE><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>ӻ<EFBFBD><D3BB><EFBFBD>ʽ<EFBFBD><CABD>
|
||||
//<2F><><EFBFBD><EFBFBD>Ҫ InitCommonControlsEx()<29><> <20><><EFBFBD><EFBFBD><F2A3ACBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڡ<EFBFBD>
|
||||
INITCOMMONCONTROLSEX InitCtrls;
|
||||
InitCtrls.dwSize = sizeof(InitCtrls);
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC>ࡣ
|
||||
InitCtrls.dwICC = ICC_WIN95_CLASSES;
|
||||
InitCommonControlsEx(&InitCtrls);
|
||||
|
||||
CWinApp::InitInstance();
|
||||
|
||||
|
||||
AfxEnableControlContainer();
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> shell <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><D4B7>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20>κ<EFBFBD> shell <20><><EFBFBD><EFBFBD>ͼ<EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD> shell <20>б<EFBFBD><D0B1><EFBFBD>ͼ<EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>
|
||||
CShellManager *pShellManager = new CShellManager;
|
||||
|
||||
// <20><><EFBFBD>Windows Native<76><65><EFBFBD>Ӿ<EFBFBD><D3BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD> MFC <20>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
|
||||
|
||||
// <20><><EFBFBD><D7BC>ʼ<EFBFBD><CABC>
|
||||
// <20><><EFBFBD><EFBFBD>δʹ<CEB4><CAB9><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD>ܲ<EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD>С
|
||||
// <20><><EFBFBD>տ<EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>ļ<EFBFBD><C4BC>Ĵ<EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>Ӧ<EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>ض<EFBFBD><D8B6><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ洢<DAB4><E6B4A2><EFBFBD>õ<EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// TODO: Ӧ<>ʵ<EFBFBD><CAB5>ĸ<DEB8><C4B8>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>֯<EFBFBD><D6AF>
|
||||
SetRegistryKey(_T("Ӧ<EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵı<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD>"));
|
||||
|
||||
|
||||
CKcMainDlg dlg;
|
||||
m_pMainWnd = &dlg;
|
||||
INT_PTR nResponse = dlg.DoModal();
|
||||
if (nResponse == IDOK)
|
||||
{
|
||||
// TODO: <20>ڴ˷<DAB4><CBB7>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
// <20><>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رնԻ<D5B6><D4BB><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
||||
}
|
||||
else if (nResponse == IDCANCEL)
|
||||
{
|
||||
// TODO: <20>ڴ˷<DAB4><CBB7>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رնԻ<D5B6><D4BB><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
||||
}
|
||||
else if (nResponse == -1)
|
||||
{
|
||||
TRACE(traceAppMsg, 0, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20>Ի<EFBFBD><D4BB><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9>\n");
|
||||
TRACE(traceAppMsg, 0, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶԻ<DAB6><D4BB><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> MFC <20>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS<47><53>\n");
|
||||
}
|
||||
|
||||
// ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD>洴<EFBFBD><E6B4B4><EFBFBD><EFBFBD> shell <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (pShellManager != NULL)
|
||||
{
|
||||
delete pShellManager;
|
||||
}
|
||||
|
||||
#ifndef _AFXDLL
|
||||
ControlBarCleanUp();
|
||||
#endif
|
||||
|
||||
// <20><><EFBFBD>ڶԻ<DAB6><D4BB><EFBFBD><EFBFBD>ѹرգ<D8B1><D5A3><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD> FALSE <20>Ա<EFBFBD><D4B1>˳<EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>á<EFBFBD>
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
CString CKcCtrlApp::SendMsg2Platform(CString strReceiver, int nMsgType, Json::Value param)
|
||||
{
|
||||
//LogOutToFile("DRIVER::SendMsg2Platform Begin");
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1>ǰʱ<C7B0><CAB1>
|
||||
CTime currentTime = CTime::GetCurrentTime();
|
||||
|
||||
// <20><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CString strTime;
|
||||
strTime.Format(_T("%d-%02d-%02d %02d:%02d:%02d"),currentTime.GetYear(),currentTime.GetMonth(),currentTime.GetDay(),currentTime.GetHour(),currentTime.GetMinute(),currentTime.GetSecond());
|
||||
|
||||
static UINT32 nSerialNum = 0;
|
||||
|
||||
Json::Value root;
|
||||
root["sender"] = "KC-CTRL"; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,SwingArm
|
||||
root["receiver"] = strReceiver.GetBuffer();
|
||||
root["serial_num"] = ++nSerialNum;
|
||||
root["time"] = strTime.GetBuffer();
|
||||
root["vehicle_name"] = "50";
|
||||
|
||||
|
||||
/******************************************************
|
||||
nMsgTypeʹ<65><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CREATE_TASK_RET = 2, //WCS->WMS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
EXECUTE_TASK_RET = 4, //WCS->WMS ִ<><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
DEVICE_STATE_REPORT = 5, //WCS->WMS <20>豸״̬<D7B4>ϱ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
DEVICE_CONFIG_REQ = 6, //WCS->WMS <20><><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
*******************************************************/
|
||||
|
||||
root["type"] = nMsgType;
|
||||
root["params"] = param;
|
||||
|
||||
//root["name"] = "vehicles-01";
|
||||
strTime.ReleaseBuffer();
|
||||
|
||||
Json::FastWriter writer;
|
||||
string strJson = writer.write(root);
|
||||
|
||||
BOOL bRet = g_pstPipeClient->SendeMsg(WCS_2_WMS_DATA, (char*)strJson.c_str(), strJson.length());
|
||||
|
||||
//LogOutToFile("DRIVER::SendMsg2Platform End");
|
||||
TRACE("ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ̨<EFBFBD><EFBFBD>%d\n", bRet);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
void CKcCtrlApp::GetCtrlServerInfo()
|
||||
{
|
||||
char acIp[32] = "";
|
||||
|
||||
CString iniPath = theApp.m_strModulePath + "\\config.ini";
|
||||
|
||||
GetPrivateProfileString("SERVER", "IP", "", acIp, 32, iniPath);
|
||||
m_strControllerIp = acIp;
|
||||
|
||||
m_nControllerPort = GetPrivateProfileInt("SERVER", "PORT", 0, iniPath);
|
||||
|
||||
//<2F><>ȡЭ<C8A1><D0AD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
|
||||
char acAuth[48] = "";
|
||||
GetPrivateProfileString("SERVER", "AUTH", "", acAuth, 48, iniPath);
|
||||
sscanf(acAuth, "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
|
||||
&m_acAuthCoce[0], &m_acAuthCoce[1], &m_acAuthCoce[2], &m_acAuthCoce[3], &m_acAuthCoce[4], &m_acAuthCoce[5],
|
||||
&m_acAuthCoce[6], &m_acAuthCoce[7], &m_acAuthCoce[8], &m_acAuthCoce[9], &m_acAuthCoce[10], &m_acAuthCoce[11],
|
||||
&m_acAuthCoce[12], &m_acAuthCoce[13], &m_acAuthCoce[14], &m_acAuthCoce[15]);
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
void CKcCtrlApp::ChangeGuideType(int nType)
|
||||
{
|
||||
if (nType == QRCODE_TYPE)
|
||||
{
|
||||
Json::Value param;
|
||||
param["request_point_id"] = theApp.m_nReqPointId;
|
||||
param["request_point_type"] = theApp.m_nReqPointType;
|
||||
SendMsg2Platform("DRIVER", CHANGE_GUIDE_TYPE, param);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
58
Plugin/KcCtrl/KcCtrl.h
Normal file
58
Plugin/KcCtrl/KcCtrl.h
Normal file
@@ -0,0 +1,58 @@
|
||||
|
||||
// Vcs-Client.h : PROJECT_NAME Ӧ<>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error "<22>ڰ<EFBFBD><DAB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>stdafx.h<><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> PCH <20>ļ<EFBFBD>"
|
||||
#endif
|
||||
|
||||
#include "resource.h" // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#include "CCEXPipeLib.h"
|
||||
|
||||
#define WM_MSG_ROBOT_TO_MAIN WM_USER+2000
|
||||
|
||||
|
||||
// CKcCtrlApp:
|
||||
// <20>йش<D0B9><D8B4><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Vcs-Client.cpp
|
||||
//
|
||||
|
||||
class CKcCtrlApp : public CWinApp
|
||||
{
|
||||
public:
|
||||
CKcCtrlApp();
|
||||
|
||||
// <20><>д
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
|
||||
public:
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<49><50>ַ<EFBFBD><D6B7><EFBFBD>˿ڣ<CBBF>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
|
||||
void GetCtrlServerInfo();
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
|
||||
void BuildMessageHeader();
|
||||
|
||||
public:
|
||||
CString m_strModulePath; //ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
||||
CString m_strControllerIp; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<49><50>ַ
|
||||
int m_nControllerPort; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿ں<CBBF>
|
||||
unsigned char m_acAuthCoce[16]; //Э<><D0AD><EFBFBD><EFBFBD>Ȩ<EFBFBD>룬16<31><36><EFBFBD>ֽ<EFBFBD>
|
||||
|
||||
int m_nReqPointId; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD>ID
|
||||
int m_nReqPointType; //<2F><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD> 1:ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int m_nCargoStatus; //<2F>ػ<EFBFBD>״̬
|
||||
|
||||
|
||||
|
||||
|
||||
// ʵ<><CAB5>
|
||||
CString SendMsg2Platform(CString strReceiver, int nMsgType, Json::Value param = NULL);
|
||||
void ChangeGuideType(int nType);
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
extern CKcCtrlApp theApp;
|
||||
extern CCEXPipeClientBase* g_pstPipeClient;
|
||||
BIN
Plugin/KcCtrl/KcCtrl.rc
Normal file
BIN
Plugin/KcCtrl/KcCtrl.rc
Normal file
Binary file not shown.
246
Plugin/KcCtrl/KcCtrl.vcxproj
Normal file
246
Plugin/KcCtrl/KcCtrl.vcxproj
Normal file
@@ -0,0 +1,246 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{77089A10-F10B-4E0E-B045-86271BFD1A07}</ProjectGuid>
|
||||
<RootNamespace>VcsClient</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<Keyword>MFCProj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>E:\work\tank_svn\shiyu\project\fan\warehouse\code\cpp\vcs-client\Inc\json\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0804</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\json\inc;$(SolutionDir)CCEXPipe;$(SolutionDir)3rdparty\curl\inc;..\modbus;$(SolutionDir)3rdparty\can\inc;$(SolutionDir)3rdparty\sqlite;$(SolutionDir)3rdparty\whttp-server-core;$(SolutionDir)3rdparty\openssl\inc;$(SolutionDir)3rdparty\pthread\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<StructMemberAlignment>4Bytes</StructMemberAlignment>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<AdditionalDependencies>libcurl.lib;ControlCAN.lib;libcrypto.lib;libssl.lib;pthreadVC2.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)3rdparty\curl\lib\x64;$(SolutionDir)$(Platform)\$(Configuration)\;$(SolutionDir)3rdparty\modbus\lib;$(SolutionDir)3rdparty\can\lib;$(SolutionDir)3rdparty\pthread\lib\x64;$(SolutionDir)3rdparty\openssl\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0804</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0804</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\json\inc;$(SolutionDir)CCEXPipe;$(SolutionDir)3rdparty\curl\inc;..\modbus;$(SolutionDir)3rdparty\can\inc;$(SolutionDir)3rdparty\sqlite;$(SolutionDir)3rdparty\whttp-server-core;$(SolutionDir)3rdparty\pthread\inc;$(SolutionDir)3rdparty\openssl\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<StructMemberAlignment>4Bytes</StructMemberAlignment>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)3rdparty\curl\lib\x64;$(SolutionDir)$(Platform)\$(Configuration)\;$(SolutionDir)3rdparty\modbus\lib;$(SolutionDir)3rdparty\can\lib;$(SolutionDir)3rdparty\pthread\lib\x64;$(SolutionDir)3rdparty\openssl\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libcurl.lib;ControlCAN.lib;libcrypto.lib;libssl.lib;pthreadVC2.lib</AdditionalDependencies>
|
||||
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0804</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\3rdparty\whttp-server-core\unistd.h" />
|
||||
<ClInclude Include="KcConfigDlg.h" />
|
||||
<ClInclude Include="KcCtrl.h" />
|
||||
<ClInclude Include="KcMainDlg.h" />
|
||||
<ClInclude Include="KcOperDlg.h" />
|
||||
<ClInclude Include="KcProtocol.h" />
|
||||
<ClInclude Include="KcStruct.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="UdpSocket.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_reader.cpp" />
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_value.cpp" />
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_writer.cpp" />
|
||||
<ClCompile Include="KcConfigDlg.cpp" />
|
||||
<ClCompile Include="KcCtrl.cpp" />
|
||||
<ClCompile Include="KcMainDlg.cpp" />
|
||||
<ClCompile Include="KcOperDlg.cpp" />
|
||||
<ClCompile Include="KcProtocol.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UdpSocket.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="KcCtrl.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\KcCtrl.rc2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\KcCtrl.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties RESOURCE_FILE="" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
51
Plugin/KcCtrl/KcCtrl.vcxproj.filters
Normal file
51
Plugin/KcCtrl/KcCtrl.vcxproj.filters
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp" />
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_reader.cpp">
|
||||
<Filter>json</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_value.cpp">
|
||||
<Filter>json</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\3rdparty\json\src\json_writer.cpp">
|
||||
<Filter>json</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="KcCtrl.cpp" />
|
||||
<ClCompile Include="KcMainDlg.cpp" />
|
||||
<ClCompile Include="KcConfigDlg.cpp" />
|
||||
<ClCompile Include="KcOperDlg.cpp" />
|
||||
<ClCompile Include="KcProtocol.cpp" />
|
||||
<ClCompile Include="UdpSocket.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="..\..\3rdparty\whttp-server-core\unistd.h" />
|
||||
<ClInclude Include="KcCtrl.h" />
|
||||
<ClInclude Include="KcMainDlg.h" />
|
||||
<ClInclude Include="KcStruct.h" />
|
||||
<ClInclude Include="KcConfigDlg.h" />
|
||||
<ClInclude Include="KcOperDlg.h" />
|
||||
<ClInclude Include="KcProtocol.h" />
|
||||
<ClInclude Include="UdpSocket.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="KcCtrl.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\KcCtrl.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\KcCtrl.rc2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="json">
|
||||
<UniqueIdentifier>{263f81d2-2eb0-4ed0-aef7-dc7f1cd0dad3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
354
Plugin/KcCtrl/KcMainDlg.cpp
Normal file
354
Plugin/KcCtrl/KcMainDlg.cpp
Normal file
@@ -0,0 +1,354 @@
|
||||
// CanDeviceDlg.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "KcMainDlg.h"
|
||||
#include "resource.h"
|
||||
#include "afxdialogex.h"
|
||||
#include "KcCtrl.h"
|
||||
#include "KcStruct.h"
|
||||
#include "KcOperDlg.h"
|
||||
#include "KcConfigDlg.h"
|
||||
#include "KcProtocol.h"
|
||||
|
||||
|
||||
int StopFlag = 0;
|
||||
unsigned long nextrow;
|
||||
#define TIMER_QUERY_AGV_STATE 1
|
||||
|
||||
// CCanDeviceDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
//<2F>ؼ<EFBFBD>IDֻ<44><D6BB>Ҫ<EFBFBD>ڵ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ψһ<CEA8><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>дһ<D0B4><D2BB><EFBFBD>ͺ<EFBFBD>
|
||||
#define ID_VIRTUAL_LIST_CTRL (20000)
|
||||
#define TIMER_ID_ADD_TEST_DATA (2024)
|
||||
IMPLEMENT_DYNAMIC(CKcMainDlg, CDialogEx)
|
||||
|
||||
CKcMainDlg::CKcMainDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialogEx(IDD_CK_CTRL_DLG, pParent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CKcMainDlg::~CKcMainDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CKcMainDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CKcMainDlg, CDialogEx)
|
||||
|
||||
ON_COMMAND(IDR_MENU_DEV_OPT, &CKcMainDlg::OnMenuDevOpt)
|
||||
ON_COMMAND(IDR_MENU_SETTING, &CKcMainDlg::OnMenuSetting)
|
||||
ON_WM_TIMER()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
|
||||
|
||||
//<2F><>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨѶ<CDA8>Ĺܵ<C4B9><DCB5>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void g_PipeCallBack(void* pObj, int lMsgId, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
CKcMainDlg* pModule = (CKcMainDlg*)pObj;
|
||||
if (CEXPIPE_CONNECT_OK == lMsgId)
|
||||
{
|
||||
//<2F><><EFBFBD>ӳɹ<D3B3>
|
||||
//if (FALSE == pModule->PostMessage(WM_PLATFORM_CONNECT_OK, NULL, NULL)) { LogOutToFile("g_PipeCallBack PostMessage error[%d]", lMsgId); }
|
||||
LogOutToFile("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̹ܵ<EFBFBD>");
|
||||
|
||||
//<2F><>WMS<4D><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
//theApp.SendMsg2Platform("WMS", DEVICE_CONFIG_REQ);
|
||||
}
|
||||
else if (CEXPIPE_DIS_CLIENT == lMsgId)
|
||||
{
|
||||
//<2F>ܵ<EFBFBD><DCB5>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifndef _DEBUG
|
||||
LogOutToFile("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹܵ<EFBFBD><EFBFBD>Ͽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD>˳<EFBFBD>");
|
||||
//if (FALSE == pModule->PostMessage(WM_CLOSE, NULL, NULL)) { LogOutToFile("g_PipeCallBack PostMessage error[%d]", lMsgId); }
|
||||
pModule->PostMessage(WM_COMMAND, MAKEWPARAM(ID_TRAY_EXIT, 0), 0);
|
||||
#endif
|
||||
exit(0);
|
||||
}
|
||||
else if (CEXPIPE_NEW_DATA == lMsgId)
|
||||
{
|
||||
pModule->ProcessPipeMsg(lMsgId, (char*)wparam, (int)lparam);
|
||||
}
|
||||
else
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CKcMainDlg::ProcessPipeMsg(int lMsgId, char* pData, int lLen)
|
||||
{
|
||||
if (lLen == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PIPE_DATA_STRUCT* pstData = (PIPE_DATA_STRUCT*)pData;
|
||||
|
||||
//ƽ̨ת<CCA8><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
if (pstData->lMsgId == MAIN_2_MODULE_WMS && pstData->lDataLen > 0)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value root;
|
||||
if (reader.parse((char*)pstData->acData, root))
|
||||
{
|
||||
CString strReceiver = root["receiver"].asString().c_str();
|
||||
CString strSender = root["sender"].asString().c_str();
|
||||
int nType = root["type"].asInt();
|
||||
UINT32 nSerialNum = root["serial_num"].asUInt(); //ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>
|
||||
CString strTime = root["time"].asString().c_str(); //ʱ<><CAB1><EFBFBD><EFBFBD>
|
||||
|
||||
if (AGV_GUIDE == nType)
|
||||
{
|
||||
Build0xAEMessage(root["data"]);
|
||||
}
|
||||
else if (AGV_ACTION == nType)
|
||||
{
|
||||
Build0xB2Message(root["data"]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (pstData->lMsgId == MAIN_2_MODULE_SHOWWINDOW)
|
||||
{
|
||||
//PostMessage(WM_COMMAND, MAKEWPARAM(ID_TRAY_SHOW, 0), 0);
|
||||
AfxGetApp()->m_pMainWnd->ShowWindow(SW_SHOWNORMAL);
|
||||
SetForegroundWindow();
|
||||
}
|
||||
|
||||
LogOutToFile("HttpServiceListener::OnRecvRequest End");
|
||||
}
|
||||
|
||||
|
||||
// CCanDeviceDlg <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
BOOL CKcMainDlg::OnInitDialog()
|
||||
{
|
||||
|
||||
CString strPipe;
|
||||
for (int i = 0; i < __argc; i++)
|
||||
{
|
||||
if (0 == strcmp(__argv[i], "-pipe") && i + 1 < __argc)
|
||||
{
|
||||
strPipe = __argv[i + 1];
|
||||
}
|
||||
}
|
||||
|
||||
if (strPipe.IsEmpty())
|
||||
{
|
||||
char acPipe[256] = "";
|
||||
|
||||
CString iniPath = theApp.m_strModulePath.Left(theApp.m_strModulePath.ReverseFind('\\') + 1);
|
||||
//m_strModulePath = theApp.m_strModulePath.ReverseFind("\\");
|
||||
iniPath = iniPath + "pipe.ini";
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>
|
||||
GetPrivateProfileString("AGV-MODULE", "PIPE_KC-CTRL", "", acPipe, 256, iniPath);
|
||||
strPipe = acPipe;
|
||||
}
|
||||
g_pstPipeClient->RegisterCall(g_PipeCallBack, this);
|
||||
g_pstPipeClient->Connect(strPipe.GetBuffer());
|
||||
|
||||
|
||||
SetTimer(TIMER_QUERY_AGV_STATE, 500, NULL);
|
||||
|
||||
CDialogEx::OnInitDialog();
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CKcMainDlg::OnMenuDevOpt()
|
||||
{
|
||||
CKcOperDlg dlg;
|
||||
dlg.DoModal();
|
||||
}
|
||||
|
||||
|
||||
void CKcMainDlg::OnMenuSetting()
|
||||
{
|
||||
CKcConfigDlg dlg;
|
||||
dlg.DoModal();
|
||||
}
|
||||
|
||||
|
||||
void CKcMainDlg::OnTimer(UINT_PTR nIDEvent)
|
||||
{
|
||||
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
|
||||
switch (nIDEvent)
|
||||
{
|
||||
case TIMER_QUERY_AGV_STATE: //<2F><>ʱ<EFBFBD><CAB1>ѯAGV״̬
|
||||
Build0xAFMessage();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
CDialogEx::OnTimer(nIDEvent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CKcMainDlg::Build0xAEMessage(Json::Value param)
|
||||
{
|
||||
|
||||
unsigned char acMsgContent[1024] = { 0 };
|
||||
int nMsgLength = 0;
|
||||
CKcProtocol protocol;
|
||||
|
||||
protocol.BuildRequestMessage(0xAE, acMsgContent, nMsgLength, param);
|
||||
|
||||
if (!m_udpClent.Connect(theApp.m_strControllerIp.GetBuffer(), theApp.m_nControllerPort))
|
||||
{
|
||||
std::cout << "Connect error." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int lRto = 3000;//<2F>ش<EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
int lRtoCnt = 3;//<2F><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char acRecv[1024] = { 0 };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
int lRecvbufSize = sizeof(acRecv);//<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||
|
||||
int recvSize = m_udpClent.SendAndRecv((const char *)acMsgContent, nMsgLength, (char *)acRecv, lRecvbufSize, lRto, lRtoCnt);
|
||||
if (recvSize == 28)
|
||||
{
|
||||
//std::cout << "Received: " << acRecv << std::endl;
|
||||
Json::Value ret;
|
||||
ret["state"] = 1;
|
||||
theApp.SendMsg2Platform("OPENTCS", AGV_GUIDE, ret); //<2F>·<EFBFBD><C2B7>ɹ<EFBFBD>
|
||||
}
|
||||
else
|
||||
{
|
||||
Json::Value ret;
|
||||
ret["state"] = 0;
|
||||
theApp.SendMsg2Platform("OPENTCS", AGV_GUIDE, ret); //<2F>·<EFBFBD>ʧ<EFBFBD><CAA7>
|
||||
}
|
||||
}
|
||||
|
||||
void CKcMainDlg::Build0xB2Message(Json::Value param)
|
||||
{
|
||||
|
||||
unsigned char acMsgContent[1024] = { 0 };
|
||||
int nMsgLength = 0;
|
||||
CKcProtocol protocol;
|
||||
|
||||
protocol.BuildRequestMessage(0xB2, acMsgContent, nMsgLength, param);
|
||||
|
||||
if (!m_udpClent.Connect(theApp.m_strControllerIp.GetBuffer(), theApp.m_nControllerPort))
|
||||
{
|
||||
std::cout << "Connect error." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int lRto = 3000;//<2F>ش<EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
int lRtoCnt = 3;//<2F><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char acRecv[1024] = { 0 };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
int lRecvbufSize = sizeof(acRecv);//<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||
|
||||
int recvSize = m_udpClent.SendAndRecv((const char *)acMsgContent, nMsgLength, (char *)acRecv, lRecvbufSize, lRto, lRtoCnt);
|
||||
if (recvSize == 28)
|
||||
{
|
||||
//std::cout << "Received: " << acRecv << std::endl;
|
||||
Json::Value ret;
|
||||
ret["state"] = 1;
|
||||
theApp.SendMsg2Platform("OPENTCS", AGV_ACTION, ret); //<2F>·<EFBFBD><C2B7>ɹ<EFBFBD>
|
||||
}
|
||||
else
|
||||
{
|
||||
Json::Value ret;
|
||||
ret["state"] = 0;
|
||||
theApp.SendMsg2Platform("OPENTCS", AGV_ACTION, ret); //<2F>·<EFBFBD>ʧ<EFBFBD><CAA7>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CKcMainDlg::Build0xAFMessage()
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CKcProtocol protocol;
|
||||
unsigned char acMsgContent[1024];
|
||||
int nMsgLength;
|
||||
protocol.BuildRequestMessage(0xAF, acMsgContent, nMsgLength);
|
||||
|
||||
if (!m_udpClent.Connect(theApp.m_strControllerIp.GetBuffer(), theApp.m_nControllerPort))
|
||||
{
|
||||
std::cout << "Connect error." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int lRto = 3000;//<2F>ش<EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
int lRtoCnt = 3;//<2F><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char acRecv[1024] = { 0 };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
int lRecvbufSize = sizeof(acRecv);//<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||
|
||||
int recvSize = m_udpClent.SendAndRecv((const char *)acMsgContent, nMsgLength, (char *)acRecv, lRecvbufSize, lRto, lRtoCnt);
|
||||
if (recvSize > 0)
|
||||
{
|
||||
//std::cout << "Received: " << acRecv << std::endl;
|
||||
Json::Value ret = protocol.Analysis0xAFMessage(acRecv, recvSize);
|
||||
theApp.SendMsg2Platform("OPENTCS", AGV_STATUS_RPT, ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
//std::cout << "Received: failed." << recvSize << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*int nMsgType = root["type"].asInt();
|
||||
|
||||
CKcOperDlg dlg;
|
||||
//<2F><><EFBFBD>ƴϿ<C6B4><CFBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0xAF<41><46>Ϣ
|
||||
if (nMsgType == 0xAF)
|
||||
{
|
||||
dlg.OnBnClickedBtn0xaf();
|
||||
}
|
||||
else if (nMsgType == 0xB0)
|
||||
{
|
||||
dlg.OnBnClickedBtn0xb0();
|
||||
}
|
||||
else if (nMsgType == 0x17)
|
||||
{
|
||||
dlg.OnBnClickedBtn0x17();
|
||||
}
|
||||
else if (nMsgType == 0x1F )
|
||||
{
|
||||
dlg.OnBnClickedBtn0x1f();
|
||||
}
|
||||
else if (nMsgType == 0xAE)
|
||||
{
|
||||
dlg.Build0xAEMessage(root["data"]);
|
||||
|
||||
}
|
||||
else if (nMsgType == 0x14)
|
||||
{
|
||||
dlg.Build0x14Message(root["data"]);
|
||||
|
||||
}
|
||||
else if (nMsgType == 0x03)
|
||||
{
|
||||
dlg.Build0x03Message(root["data"]);
|
||||
|
||||
}
|
||||
else if (nMsgType == 0x02)
|
||||
{
|
||||
dlg.Build0x02Message(root["data"]);
|
||||
|
||||
}
|
||||
else if (nMsgType == 0xb2)
|
||||
{
|
||||
dlg.Build0xB2Message(root["data"]);
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
41
Plugin/KcCtrl/KcMainDlg.h
Normal file
41
Plugin/KcCtrl/KcMainDlg.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include "UdpSocket.h"
|
||||
|
||||
class CKcMainDlg : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CKcMainDlg)
|
||||
|
||||
public:
|
||||
CKcMainDlg(CWnd* pParent = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
virtual ~CKcMainDlg();
|
||||
|
||||
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_CK_CTRL_DLG};
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<><D6A7>
|
||||
virtual BOOL OnInitDialog();
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
void ProcessPipeMsg(int lMsgId, char* pData, int lLen);
|
||||
|
||||
afx_msg void OnMenuDevOpt();
|
||||
afx_msg void OnMenuSetting();
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
|
||||
public:
|
||||
|
||||
void Build0xAEMessage(Json::Value param);
|
||||
void Build0xB2Message(Json::Value param);
|
||||
void Build0xAFMessage();
|
||||
|
||||
|
||||
public:
|
||||
UDPClient m_udpClent;
|
||||
|
||||
|
||||
};
|
||||
549
Plugin/KcCtrl/KcOperDlg.cpp
Normal file
549
Plugin/KcCtrl/KcOperDlg.cpp
Normal file
@@ -0,0 +1,549 @@
|
||||
// DevOptDlg.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "KcCtrl.h"
|
||||
#include "KcOperDlg.h"
|
||||
#include "KcProtocol.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
|
||||
// CDevOptDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
IMPLEMENT_DYNAMIC(CKcOperDlg, CDialogEx)
|
||||
|
||||
CKcOperDlg::CKcOperDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialogEx(IDD_CK_OPT_DLG, pParent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CKcOperDlg::~CKcOperDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CKcOperDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CKcOperDlg, CDialogEx)
|
||||
ON_BN_CLICKED(IDC_BTN_0xAF, &CKcOperDlg::OnBnClickedBtn0xaf)
|
||||
ON_BN_CLICKED(IDC_BTN_0xB0, &CKcOperDlg::OnBnClickedBtn0xb0)
|
||||
ON_BN_CLICKED(IDC_BTN_0xB1, &CKcOperDlg::OnBnClickedBtn0xb1)
|
||||
ON_BN_CLICKED(IDC_BTN_0x02, &CKcOperDlg::OnBnClickedBtn0x02)
|
||||
ON_BN_CLICKED(IDC_BTN_0x03, &CKcOperDlg::OnBnClickedBtn0x03)
|
||||
ON_BN_CLICKED(IDC_BTN_0x14, &CKcOperDlg::OnBnClickedBtn0x14)
|
||||
ON_BN_CLICKED(IDC_BTN_0x17, &CKcOperDlg::OnBnClickedBtn0x17)
|
||||
ON_BN_CLICKED(IDC_BTN_0xB2, &CKcOperDlg::OnBnClickedBtn0xb2)
|
||||
ON_BN_CLICKED(IDC_BTN_0xAE, &CKcOperDlg::OnBnClickedBtn0xae)
|
||||
ON_BN_CLICKED(IDC_BTN_0x1F, &CKcOperDlg::OnBnClickedBtn0x1f)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CDevOptDlg <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void CKcOperDlg::OnBnClickedBtn0xaf()
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CKcProtocol protocol;
|
||||
unsigned char acMsgContent[1024];
|
||||
int nMsgLength;
|
||||
protocol.BuildRequestMessage(0xAF, acMsgContent, nMsgLength);
|
||||
|
||||
if (!m_udpClent.Connect(theApp.m_strControllerIp.GetBuffer(),theApp.m_nControllerPort))
|
||||
{
|
||||
std::cout << "Connect error." << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
int lRto = 3000;//<2F>ش<EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
int lRtoCnt = 3;//<2F><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char acRecv[1024] = { 0 };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
int lRecvbufSize = sizeof(acRecv);//<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||
|
||||
int recvSize = m_udpClent.SendAndRecv((const char *)acMsgContent, nMsgLength, (char *)acRecv, lRecvbufSize, lRto, lRtoCnt);
|
||||
if (recvSize > 0)
|
||||
{
|
||||
//std::cout << "Received: " << acRecv << std::endl;
|
||||
Json::Value ret = protocol.Analysis0xAFMessage(acRecv, recvSize);
|
||||
theApp.SendMsg2Platform("OPENTCS", AGV_STATUS_RPT, ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
//std::cout << "Received: failed." << recvSize << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CKcOperDlg::OnBnClickedBtn0xb0()
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CKcProtocol protocol;
|
||||
unsigned char acMsgContent[1024];
|
||||
int nMsgLength;
|
||||
protocol.BuildRequestMessage(0xB0, acMsgContent, nMsgLength);
|
||||
|
||||
if (!m_udpClent.Connect(theApp.m_strControllerIp.GetBuffer(), theApp.m_nControllerPort))
|
||||
{
|
||||
std::cout << "Connect error." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int lRto = 3000;//<2F>ش<EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
int lRtoCnt = 3;//<2F><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char acRecv[1024] = { 0 };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
int lRecvbufSize = sizeof(acRecv);//<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||
|
||||
int recvSize = m_udpClent.SendAndRecv((const char *)acMsgContent, nMsgLength, (char *)acRecv, lRecvbufSize, lRto, lRtoCnt);
|
||||
if (recvSize > 0)
|
||||
{
|
||||
//std::cout << "Received: " << acRecv << std::endl;
|
||||
Json::Value ret = protocol.Analysis0xB0Message(acRecv, recvSize);
|
||||
theApp.SendMsg2Platform("OPENTCS", 0xB0, ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
//std::cout << "Received: failed." << recvSize << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void CKcOperDlg::OnBnClickedBtn0x17()
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CKcProtocol protocol;
|
||||
unsigned char acMsgContent[1024];
|
||||
int nMsgLength;
|
||||
protocol.BuildRequestMessage(0x17, acMsgContent, nMsgLength);
|
||||
|
||||
if (!m_udpClent.Connect(theApp.m_strControllerIp.GetBuffer(), theApp.m_nControllerPort))
|
||||
{
|
||||
std::cout << "Connect error." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int lRto = 3000;//<2F>ش<EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
int lRtoCnt = 3;//<2F><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char acRecv[1024] = { 0 };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
int lRecvbufSize = sizeof(acRecv);//<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||
|
||||
int recvSize = m_udpClent.SendAndRecv((const char *)acMsgContent, nMsgLength, (char *)acRecv, lRecvbufSize, lRto, lRtoCnt);
|
||||
if (recvSize > 0)
|
||||
{
|
||||
//std::cout << "Received: " << acRecv << std::endl;
|
||||
Json::Value ret = protocol.Analysis0x17Message(acRecv, recvSize);
|
||||
theApp.SendMsg2Platform("OPENTCS", 0x17, ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
//std::cout << "Received: failed." << recvSize << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CKcOperDlg::OnBnClickedBtn0xb1()
|
||||
{
|
||||
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
|
||||
|
||||
void CKcOperDlg::OnBnClickedBtn0x02()
|
||||
{
|
||||
Json::Value param;
|
||||
|
||||
param["varCount"] = 1;
|
||||
|
||||
Json::Value value;
|
||||
Json::Value value_item;
|
||||
|
||||
value_item["name"] = "NaviControl";
|
||||
value_item["count"] = 1;
|
||||
|
||||
Json::Value member;
|
||||
Json::Value member_item;
|
||||
member_item["offset"] = 0;
|
||||
member_item["length"] = 1;
|
||||
member.append(member_item);
|
||||
|
||||
value_item["member"] = member;
|
||||
value.append(value_item);
|
||||
param["var"] = value;
|
||||
|
||||
|
||||
Build0x02Message(param);
|
||||
}
|
||||
|
||||
|
||||
void CKcOperDlg::OnBnClickedBtn0x03()
|
||||
{
|
||||
Json::Value param;
|
||||
|
||||
param["var_count"] = 1;
|
||||
|
||||
Json::Value value;
|
||||
Json::Value value_item;
|
||||
|
||||
value_item["name"] = "NaviControl";
|
||||
value_item["count"] = 1;
|
||||
|
||||
Json::Value member;
|
||||
Json::Value member_item;
|
||||
member_item["offset"] = 0;
|
||||
member_item["length"] = 1;
|
||||
member_item["value"] = 1;
|
||||
member.append(member_item);
|
||||
|
||||
value_item["member"] = member;
|
||||
value.append(value_item);
|
||||
param["var"] = value;
|
||||
|
||||
|
||||
//Json::FastWriter writer;
|
||||
//string strJson = writer.write(param);
|
||||
//AfxMessageBox(strJson.c_str());
|
||||
|
||||
|
||||
Build0x03Message(param);
|
||||
}
|
||||
|
||||
|
||||
void CKcOperDlg::OnBnClickedBtn0x14()
|
||||
{
|
||||
Json::Value param;
|
||||
|
||||
param["angle"] = 1.0;
|
||||
param["x"] = 3.0;
|
||||
param["y"] = 2.0;
|
||||
|
||||
Build0x14Message(param);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CKcOperDlg::OnBnClickedBtn0xb2()
|
||||
{
|
||||
Json::Value param;
|
||||
|
||||
int nType = 3;
|
||||
if (1 == nType)
|
||||
{
|
||||
param["paramSize"] = 4;
|
||||
param["actionParallelManner"] = 2;
|
||||
param["actionType"] = 1;
|
||||
|
||||
Json::Value paramData;
|
||||
Json::Value dataItem;
|
||||
dataItem["isStopImmediately"] = 1;
|
||||
paramData.append(dataItem);
|
||||
param["paramData"] = paramData;
|
||||
}
|
||||
else if(2 == nType)
|
||||
{
|
||||
param["paramSize"] = 8;
|
||||
param["actionParallelManner"] = 2;
|
||||
param["actionType"] = 2;
|
||||
|
||||
Json::Value paramData;
|
||||
Json::Value dataItem;
|
||||
dataItem["orderId"] = 1;
|
||||
dataItem["taskKey"] = 1;
|
||||
paramData.append(dataItem);
|
||||
param["paramData"] = paramData;
|
||||
}
|
||||
else if (3 == nType)
|
||||
{
|
||||
param["paramSize"] = 8;
|
||||
param["actionParallelManner"] = 2;
|
||||
param["actionType"] = 3;
|
||||
|
||||
Json::Value paramData;
|
||||
Json::Value dataItem;
|
||||
dataItem["orderId"] = 1;
|
||||
dataItem["isStopImmediately"] = 1;
|
||||
paramData.append(dataItem);
|
||||
param["paramData"] = paramData;
|
||||
}
|
||||
|
||||
|
||||
Build0xB2Message(param);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CKcOperDlg::Build0xAEMessage(Json::Value param)
|
||||
{
|
||||
|
||||
unsigned char acMsgContent[1024] = { 0 };
|
||||
int nMsgLength = 0;
|
||||
CKcProtocol protocol;
|
||||
|
||||
protocol.BuildRequestMessage(0xAE, acMsgContent, nMsgLength, param);
|
||||
|
||||
if (!m_udpClent.Connect(theApp.m_strControllerIp.GetBuffer(), theApp.m_nControllerPort))
|
||||
{
|
||||
std::cout << "Connect error." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int lRto = 3000;//<2F>ش<EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
int lRtoCnt = 3;//<2F><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char acRecv[1024] = { 0 };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
int lRecvbufSize = sizeof(acRecv);//<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||
|
||||
int recvSize = m_udpClent.SendAndRecv((const char *)acMsgContent, nMsgLength, (char *)acRecv, lRecvbufSize, lRto, lRtoCnt);
|
||||
if (recvSize == 28)
|
||||
{
|
||||
//std::cout << "Received: " << acRecv << std::endl;
|
||||
Json::Value ret ;
|
||||
ret["state"] = 1;
|
||||
theApp.SendMsg2Platform("OPENTCS", 0xAE, ret); //<2F>·<EFBFBD><C2B7>ɹ<EFBFBD>
|
||||
}
|
||||
else
|
||||
{
|
||||
Json::Value ret;
|
||||
ret["state"] = 0;
|
||||
theApp.SendMsg2Platform("OPENTCS", 0xAE, ret); //<2F>·<EFBFBD>ʧ<EFBFBD><CAA7>
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CKcOperDlg::Build0xB2Message(Json::Value param)
|
||||
{
|
||||
|
||||
unsigned char acMsgContent[1024] = { 0 };
|
||||
int nMsgLength = 0;
|
||||
CKcProtocol protocol;
|
||||
|
||||
protocol.BuildRequestMessage(0xB2, acMsgContent, nMsgLength, param);
|
||||
|
||||
if (!m_udpClent.Connect(theApp.m_strControllerIp.GetBuffer(), theApp.m_nControllerPort))
|
||||
{
|
||||
std::cout << "Connect error." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int lRto = 3000;//<2F>ش<EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
int lRtoCnt = 3;//<2F><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char acRecv[1024] = { 0 };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
int lRecvbufSize = sizeof(acRecv);//<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||
|
||||
int recvSize = m_udpClent.SendAndRecv((const char *)acMsgContent, nMsgLength, (char *)acRecv, lRecvbufSize, lRto, lRtoCnt);
|
||||
if (recvSize == 28)
|
||||
{
|
||||
//std::cout << "Received: " << acRecv << std::endl;
|
||||
Json::Value ret;
|
||||
ret["state"] = 1;
|
||||
theApp.SendMsg2Platform("OPENTCS", 0xB2, ret); //<2F>·<EFBFBD><C2B7>ɹ<EFBFBD>
|
||||
}
|
||||
else
|
||||
{
|
||||
Json::Value ret;
|
||||
ret["state"] = 0;
|
||||
theApp.SendMsg2Platform("OPENTCS", 0xB2, ret); //<2F>·<EFBFBD>ʧ<EFBFBD><CAA7>
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CKcOperDlg::Build0x02Message(Json::Value param)
|
||||
{
|
||||
|
||||
unsigned char acMsgContent[1024] = { 0 };
|
||||
int nMsgLength = 0;
|
||||
CKcProtocol protocol;
|
||||
|
||||
protocol.BuildRequestMessage(0x02, acMsgContent, nMsgLength, param);
|
||||
|
||||
if (!m_udpClent.Connect(theApp.m_strControllerIp.GetBuffer(), theApp.m_nControllerPort))
|
||||
{
|
||||
std::cout << "Connect error." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int lRto = 3000;//<2F>ش<EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
int lRtoCnt = 3;//<2F><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char acRecv[1024] = { 0 };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
int lRecvbufSize = sizeof(acRecv);//<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||
|
||||
int recvSize = m_udpClent.SendAndRecv((const char *)acMsgContent, nMsgLength, (char *)acRecv, lRecvbufSize, lRto, lRtoCnt);
|
||||
if (recvSize >= 28)
|
||||
{
|
||||
Json::Value ret = protocol.Analysis0x02Message(acRecv, recvSize);
|
||||
theApp.SendMsg2Platform("OPENTCS", 0x02, ret);
|
||||
//Json::Value ret;
|
||||
//ret["state"] = 1;
|
||||
//theApp.SendMsg2Platform("OPENTCS", 0x02, ret); //<2F>·<EFBFBD><C2B7>ɹ<EFBFBD>
|
||||
}
|
||||
else
|
||||
{
|
||||
Json::Value ret;
|
||||
ret["state"] = 0;
|
||||
theApp.SendMsg2Platform("OPENTCS", 0x02, ret); //<2F>·<EFBFBD>ʧ<EFBFBD><CAA7>
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CKcOperDlg::Build0x14Message(Json::Value param)
|
||||
{
|
||||
|
||||
unsigned char acMsgContent[1024] = { 0 };
|
||||
int nMsgLength = 0;
|
||||
CKcProtocol protocol;
|
||||
|
||||
protocol.BuildRequestMessage(0x14, acMsgContent, nMsgLength, param);
|
||||
|
||||
if (!m_udpClent.Connect(theApp.m_strControllerIp.GetBuffer(), theApp.m_nControllerPort))
|
||||
{
|
||||
std::cout << "Connect error." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int lRto = 3000;//<2F>ش<EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
int lRtoCnt = 3;//<2F><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char acRecv[1024] = { 0 };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
int lRecvbufSize = sizeof(acRecv);//<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||
|
||||
int recvSize = m_udpClent.SendAndRecv((const char *)acMsgContent, nMsgLength, (char *)acRecv, lRecvbufSize, lRto, lRtoCnt);
|
||||
if (recvSize >= 28)
|
||||
{
|
||||
//std::cout << "Received: " << acRecv << std::endl;
|
||||
Json::Value ret;
|
||||
ret["state"] = 1;
|
||||
theApp.SendMsg2Platform("OPENTCS", 0x14, ret); //<2F>·<EFBFBD><C2B7>ɹ<EFBFBD>
|
||||
}
|
||||
else
|
||||
{
|
||||
Json::Value ret;
|
||||
ret["state"] = 0;
|
||||
theApp.SendMsg2Platform("OPENTCS", 0x14, ret); //<2F>·<EFBFBD>ʧ<EFBFBD><CAA7>
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CKcOperDlg::Build0x03Message(Json::Value param)
|
||||
{
|
||||
|
||||
unsigned char acMsgContent[1024] = { 0 };
|
||||
int nMsgLength = 0;
|
||||
CKcProtocol protocol;
|
||||
|
||||
protocol.BuildRequestMessage(0x03, acMsgContent, nMsgLength, param);
|
||||
|
||||
if (!m_udpClent.Connect(theApp.m_strControllerIp.GetBuffer(), theApp.m_nControllerPort))
|
||||
{
|
||||
std::cout << "Connect error." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int lRto = 3000;//<2F>ش<EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
int lRtoCnt = 3;//<2F><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char acRecv[1024] = { 0 };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
int lRecvbufSize = sizeof(acRecv);//<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||
|
||||
int recvSize = m_udpClent.SendAndRecv((const char *)acMsgContent, nMsgLength, (char *)acRecv, lRecvbufSize, lRto, lRtoCnt);
|
||||
if (recvSize == 28)
|
||||
{
|
||||
//std::cout << "Received: " << acRecv << std::endl;
|
||||
Json::Value ret;
|
||||
ret["state"] = 1;
|
||||
theApp.SendMsg2Platform("OPENTCS", 0x03, ret); //<2F>·<EFBFBD><C2B7>ɹ<EFBFBD>
|
||||
}
|
||||
else
|
||||
{
|
||||
Json::Value ret;
|
||||
ret["state"] = 0;
|
||||
theApp.SendMsg2Platform("OPENTCS", 0x03, ret); //<2F>·<EFBFBD>ʧ<EFBFBD><CAA7>
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CKcOperDlg::OnBnClickedBtn0xae()
|
||||
{
|
||||
//ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><DDB1><EFBFBD>
|
||||
Json::Value param;
|
||||
|
||||
param["orderId"] = 1;
|
||||
param["taskKey"] = 1;
|
||||
param["pointSize"] = 2;
|
||||
param["pathSize"] = 1;
|
||||
|
||||
Json::Value pointInfo;
|
||||
Json::Value pointItem;
|
||||
pointItem["pointSerialNumber"] = 0;
|
||||
pointItem["pointId"] = 1;
|
||||
pointItem["frontAngle"] = 0;
|
||||
pointItem["isFrontAngle"] = 0;
|
||||
pointInfo.append(pointItem);
|
||||
pointItem["pointSerialNumber"] = 2;
|
||||
pointItem["pointId"] = 2;
|
||||
pointItem["frontAngle"] = 0;
|
||||
pointItem["isFrontAngle"] = 0;
|
||||
pointInfo.append(pointItem);
|
||||
|
||||
param["point"] = pointInfo;
|
||||
|
||||
|
||||
Json::Value pathInfo;
|
||||
Json::Value pathItem;
|
||||
pathItem["pathSerialNumber"] = 1;
|
||||
pathItem["pathId"] = 12;
|
||||
pathItem["pathActionSize"] = 0;
|
||||
pathItem["pathActionSize"] = 0;
|
||||
pathItem["maximumSpeed"] = 1.0;
|
||||
pathItem["maximumAngularVelocity"] = 1.0;
|
||||
pathItem["isFixedAngle"] = 0;
|
||||
pathItem["fixedAngle"] = 0;
|
||||
pathItem["drivePosture"] = 0;
|
||||
pathInfo.append(pathItem);
|
||||
param["path"] = pathInfo;
|
||||
|
||||
Build0xAEMessage(param);
|
||||
}
|
||||
|
||||
|
||||
void CKcOperDlg::OnBnClickedBtn0x1f()
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CKcProtocol protocol;
|
||||
unsigned char acMsgContent[1024];
|
||||
int nMsgLength;
|
||||
protocol.BuildRequestMessage(0x1F, acMsgContent, nMsgLength);
|
||||
|
||||
if (!m_udpClent.Connect(theApp.m_strControllerIp.GetBuffer(), theApp.m_nControllerPort))
|
||||
{
|
||||
std::cout << "Connect error." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int lRto = 3000;//<2F>ش<EFBFBD>ʱ<EFBFBD>䣬<EFBFBD><E4A3AC>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
int lRtoCnt = 3;//<2F><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char acRecv[1024] = { 0 };//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
int lRecvbufSize = sizeof(acRecv);//<2F><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||
|
||||
int recvSize = m_udpClent.SendAndRecv((const char *)acMsgContent, nMsgLength, (char *)acRecv, lRecvbufSize, lRto, lRtoCnt);
|
||||
if (recvSize > 0)
|
||||
{
|
||||
//std::cout << "Received: " << acRecv << std::endl;
|
||||
//Json::Value ret = protocol.Analysis0xAFMessage(acRecv, recvSize);
|
||||
|
||||
Json::Value ret;
|
||||
ret["state"] = 1;
|
||||
theApp.SendMsg2Platform("OPENTCS", 0x1F, ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
//std::cout << "Received: failed." << recvSize << std::endl;
|
||||
}
|
||||
}
|
||||
45
Plugin/KcCtrl/KcOperDlg.h
Normal file
45
Plugin/KcCtrl/KcOperDlg.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
#include "UdpSocket.h"
|
||||
|
||||
// CDevOptDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
class CKcOperDlg : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CKcOperDlg)
|
||||
|
||||
public:
|
||||
CKcOperDlg(CWnd* pParent = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
virtual ~CKcOperDlg();
|
||||
|
||||
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_CK_OPT_DLG };
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<><D6A7>
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
afx_msg void OnBnClickedBtn0xaf();
|
||||
afx_msg void OnBnClickedBtn0xb0();
|
||||
afx_msg void OnBnClickedBtn0xb1();
|
||||
afx_msg void OnBnClickedBtn0x02();
|
||||
afx_msg void OnBnClickedBtn0x03();
|
||||
afx_msg void OnBnClickedBtn0x14();
|
||||
afx_msg void OnBnClickedBtn0x17();
|
||||
afx_msg void OnBnClickedBtn0xb2();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
UDPClient m_udpClent;
|
||||
void Build0xAEMessage(Json::Value param);
|
||||
void Build0x03Message(Json::Value param);
|
||||
void Build0x14Message(Json::Value param);
|
||||
void Build0xB2Message(Json::Value param);
|
||||
void Build0x02Message(Json::Value param);
|
||||
|
||||
afx_msg void OnBnClickedBtn0xae();
|
||||
afx_msg void OnBnClickedBtn0x1f();
|
||||
};
|
||||
786
Plugin/KcCtrl/KcProtocol.cpp
Normal file
786
Plugin/KcCtrl/KcProtocol.cpp
Normal file
@@ -0,0 +1,786 @@
|
||||
// KcConfigDlg.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "KcProtocol.h"
|
||||
#include "KcStruct.h"
|
||||
#include "KcCtrl.h"
|
||||
#include "json.h"
|
||||
|
||||
|
||||
|
||||
CKcProtocol::CKcProtocol()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CKcProtocol::~CKcProtocol()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CKcProtocol::BuildRequestMessage(unsigned char cCommand, unsigned char acContent[], int &nContentLength, Json::Value param)
|
||||
{
|
||||
|
||||
int nMessageLen = 0;
|
||||
static unsigned short nSerial = 1;
|
||||
|
||||
|
||||
//ƴ<><C6B4>Э<EFBFBD><D0AD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
|
||||
memcpy(acContent + nMessageLen, theApp.m_acAuthCoce, 16);
|
||||
nMessageLen += 16;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
|
||||
ST_KC_MESSAGE_HEADER stMessageHeader = {0};
|
||||
stMessageHeader.version = 0x01;
|
||||
stMessageHeader.type = 0x00;
|
||||
stMessageHeader.serial_number = nSerial++;
|
||||
stMessageHeader.server_code = 0x10;
|
||||
stMessageHeader.command_code = cCommand;
|
||||
stMessageHeader.run_code = 0x00;
|
||||
stMessageHeader.reserve1 = 0x00;
|
||||
stMessageHeader.reserve2[0] = 0x00;
|
||||
stMessageHeader.reserve2[1] = 0x00;
|
||||
|
||||
switch (cCommand)
|
||||
{
|
||||
//<2F><><EFBFBD>Ϳձ<CDBF><D5B1><EFBFBD>
|
||||
case 0xAF:
|
||||
case 0x1F:
|
||||
case 0x17:
|
||||
case 0xB0:
|
||||
stMessageHeader.content_length = 0;
|
||||
memcpy(acContent + nMessageLen, &stMessageHeader, sizeof(ST_KC_MESSAGE_HEADER));
|
||||
nMessageLen += sizeof(ST_KC_MESSAGE_HEADER);
|
||||
nContentLength = nMessageLen;
|
||||
break;
|
||||
case 0xAE:
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD>AE<41><45>Ϣ<EFBFBD><CFA2>
|
||||
unsigned char acMsgBody[1024] = { 0 };
|
||||
int nMsgBodyLength = 0;
|
||||
Build0xAEMessage(param, acMsgBody, nMsgBodyLength);
|
||||
stMessageHeader.content_length = nMsgBodyLength; //<2F><>Ϣͷ<CFA2><CDB7>д<EFBFBD><D0B4><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>
|
||||
|
||||
//ƴ<><C6B4><EFBFBD><EFBFBD>Ϣͷ
|
||||
memcpy(acContent + nMessageLen, &stMessageHeader, sizeof(ST_KC_MESSAGE_HEADER));
|
||||
nMessageLen += sizeof(ST_KC_MESSAGE_HEADER);
|
||||
nContentLength = nMessageLen;
|
||||
|
||||
//ƴ<><C6B4><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>
|
||||
memcpy(acContent + nMessageLen, acMsgBody, nMsgBodyLength);
|
||||
nMessageLen += nMsgBodyLength;
|
||||
nContentLength = nMessageLen;
|
||||
|
||||
break;
|
||||
}
|
||||
case 0x02:
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD>AE<41><45>Ϣ<EFBFBD><CFA2>
|
||||
unsigned char acMsgBody[1024] = { 0 };
|
||||
int nMsgBodyLength = 0;
|
||||
Build0x02Message(param, acMsgBody, nMsgBodyLength);
|
||||
stMessageHeader.content_length = nMsgBodyLength; //<2F><>Ϣͷ<CFA2><CDB7>д<EFBFBD><D0B4><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>
|
||||
|
||||
memcpy(acContent + nMessageLen, &stMessageHeader, sizeof(ST_KC_MESSAGE_HEADER));//ƴ<><C6B4><EFBFBD><EFBFBD>Ϣͷ
|
||||
nMessageLen += sizeof(ST_KC_MESSAGE_HEADER);
|
||||
nContentLength = nMessageLen;
|
||||
|
||||
//ƴ<><C6B4><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>
|
||||
memcpy(acContent + nMessageLen, acMsgBody, nMsgBodyLength);
|
||||
nMessageLen += nMsgBodyLength;
|
||||
nContentLength = nMessageLen;
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x14:
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD>AE<41><45>Ϣ<EFBFBD><CFA2>
|
||||
unsigned char acMsgBody[1024] = { 0 };
|
||||
int nMsgBodyLength = 0;
|
||||
Build0x14Message(param, acMsgBody, nMsgBodyLength);
|
||||
stMessageHeader.content_length = nMsgBodyLength; //<2F><>Ϣͷ<CFA2><CDB7>д<EFBFBD><D0B4><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>
|
||||
|
||||
memcpy(acContent + nMessageLen, &stMessageHeader, sizeof(ST_KC_MESSAGE_HEADER));//ƴ<><C6B4><EFBFBD><EFBFBD>Ϣͷ
|
||||
nMessageLen += sizeof(ST_KC_MESSAGE_HEADER);
|
||||
nContentLength = nMessageLen;
|
||||
|
||||
//ƴ<><C6B4><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>
|
||||
memcpy(acContent + nMessageLen, acMsgBody, nMsgBodyLength);
|
||||
nMessageLen += nMsgBodyLength;
|
||||
nContentLength = nMessageLen;
|
||||
break;
|
||||
}
|
||||
case 0xB2:
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD>AE<41><45>Ϣ<EFBFBD><CFA2>
|
||||
unsigned char acMsgBody[1024] = { 0 };
|
||||
int nMsgBodyLength = 0;
|
||||
Build0xB2Message(param, acMsgBody, nMsgBodyLength);
|
||||
stMessageHeader.content_length = nMsgBodyLength; //<2F><>Ϣͷ<CFA2><CDB7>д<EFBFBD><D0B4><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>
|
||||
|
||||
memcpy(acContent + nMessageLen, &stMessageHeader, sizeof(ST_KC_MESSAGE_HEADER));//ƴ<><C6B4><EFBFBD><EFBFBD>Ϣͷ
|
||||
nMessageLen += sizeof(ST_KC_MESSAGE_HEADER);
|
||||
nContentLength = nMessageLen;
|
||||
|
||||
//ƴ<><C6B4><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>
|
||||
memcpy(acContent + nMessageLen, acMsgBody, nMsgBodyLength);
|
||||
nMessageLen += nMsgBodyLength;
|
||||
nContentLength = nMessageLen;
|
||||
break;
|
||||
}
|
||||
case 0x03:
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD>AE<41><45>Ϣ<EFBFBD><CFA2>
|
||||
unsigned char acMsgBody[1024] = { 0 };
|
||||
int nMsgBodyLength = 0;
|
||||
Build0x03Message(param, acMsgBody, nMsgBodyLength);
|
||||
stMessageHeader.content_length = nMsgBodyLength; //<2F><>Ϣͷ<CFA2><CDB7>д<EFBFBD><D0B4><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>
|
||||
|
||||
memcpy(acContent + nMessageLen, &stMessageHeader, sizeof(ST_KC_MESSAGE_HEADER));//ƴ<><C6B4><EFBFBD><EFBFBD>Ϣͷ
|
||||
nMessageLen += sizeof(ST_KC_MESSAGE_HEADER);
|
||||
nContentLength = nMessageLen;
|
||||
|
||||
//ƴ<><C6B4><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>
|
||||
memcpy(acContent + nMessageLen, acMsgBody, nMsgBodyLength);
|
||||
nMessageLen += nMsgBodyLength;
|
||||
nContentLength = nMessageLen;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CKcProtocol::Build0xAEMessage(Json::Value param, unsigned char acMsgBody[], int &nMsgLength)
|
||||
{
|
||||
static UINT32 pointSerialNumber = 0;
|
||||
static UINT32 pathSerialNumber = 0;
|
||||
|
||||
ST_PATH_JOINT stPathJoint = { 0 };
|
||||
stPathJoint.order_id = param["order_id"].asInt();
|
||||
stPathJoint.task_key = param["task_key"].asInt();
|
||||
stPathJoint.point_size = (uint8_t)(param["point_info"].size());
|
||||
stPathJoint.path_size = (uint8_t)(param["path_info"].size());
|
||||
stPathJoint.guide_type = 0;// Ĭ<>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>ʽΪ·<CEAA><C2B7>ƴ<EFBFBD>ӣ<EFBFBD><D3A3><EFBFBD><EFBFBD><EFBFBD> opentcs <20>滮<EFBFBD><E6BBAE>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>
|
||||
|
||||
|
||||
int nOffset = 0;
|
||||
int nMsgLen = sizeof(ST_PATH_JOINT) - sizeof(ST_GUIDE_POINT*) - sizeof(ST_PATH*);
|
||||
memcpy(acMsgBody, &stPathJoint, nMsgLen);
|
||||
nOffset += nMsgLen;
|
||||
|
||||
theApp.m_nReqPointId = -1;
|
||||
theApp.m_nReqPointType = -1;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
for (int i = 0; i < stPathJoint.point_size; i++)
|
||||
{
|
||||
ST_GUIDE_0_POINT stPointInfo = { 0 };
|
||||
stPointInfo.serial_number = ++pointSerialNumber;
|
||||
//stPointInfo.serial_number = param["point_info"][i]["pointSerialNumber"].asUInt();
|
||||
stPointInfo.point_id = param["point_info"][i]["point_id"].asUInt();
|
||||
|
||||
//ȫ<>ּ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
int actionType = param["point_info"][i]["point_action"].asUInt();
|
||||
if (actionType > 0)
|
||||
{
|
||||
theApp.m_nReqPointType = actionType;
|
||||
theApp.m_nReqPointId = param["point_info"][i]["point_id"].asUInt();
|
||||
}
|
||||
|
||||
float fAngle = (float)(param["point_info"][i]["point_angle"].asDouble());
|
||||
|
||||
if (fAngle > 300) //<2F><>ָ<EFBFBD><D6B8><EFBFBD>Ƕ<EFBFBD>
|
||||
{
|
||||
stPointInfo.angle = 0;
|
||||
stPointInfo.is_assign_angle = 0;
|
||||
}
|
||||
else //ָ<><D6B8><EFBFBD>Ƕ<EFBFBD>
|
||||
{
|
||||
stPointInfo.angle = fAngle;
|
||||
stPointInfo.is_assign_angle = 1;
|
||||
}
|
||||
stPointInfo.action_size = 0;
|
||||
|
||||
nMsgLen = sizeof(ST_GUIDE_0_POINT) - sizeof(ST_ACTION*);
|
||||
memcpy(acMsgBody + nOffset, &stPointInfo, nMsgLen);
|
||||
nOffset += nMsgLen;
|
||||
|
||||
for (int j = 0; j < stPointInfo.action_size; j++)
|
||||
{
|
||||
ST_ACTION stActionInfo = { 0 };
|
||||
stActionInfo.action_type = 0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
stActionInfo.action_run_type = 0;//ִ<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD>ʽ
|
||||
stActionInfo.action_id = 0;//<2F><><EFBFBD><EFBFBD>ID
|
||||
stActionInfo.param_size = 0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
nMsgLen = sizeof(ST_ACTION) - sizeof(unsigned char *);
|
||||
memcpy(acMsgBody + nOffset, &stActionInfo, nMsgLen);
|
||||
nOffset += nMsgLen;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>action<6F><6E><EFBFBD><EFBFBD>
|
||||
//memcpy(acMsgBody + nOffset, , stActionInfo.param_size); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
nOffset += stActionInfo.param_size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
for (int i = 0; i < stPathJoint.path_size; i++)
|
||||
{
|
||||
ST_PATH stPathInfo = { 0 };
|
||||
//stPathInfo.serial_number = param["path_info"][i]["pathSerialNumber"].asUInt();
|
||||
stPathInfo.serial_number = ++pathSerialNumber;
|
||||
stPathInfo.segment_id = param["path_info"][i]["path_id"].asUInt();
|
||||
|
||||
float fFixedAngle = (float)(param["path_info"][i]["fixed_angle"].asDouble());
|
||||
if (fFixedAngle > 300) //<2F><>ָ<EFBFBD><D6B8><EFBFBD>Ƕ<EFBFBD>
|
||||
{
|
||||
stPathInfo.fixed_angle = 0;
|
||||
stPathInfo.is_fixed_angle = 0;
|
||||
}
|
||||
else //ָ<><D6B8><EFBFBD>Ƕ<EFBFBD>
|
||||
{
|
||||
stPathInfo.fixed_angle = fFixedAngle;
|
||||
stPathInfo.is_fixed_angle = 1;
|
||||
}
|
||||
|
||||
|
||||
stPathInfo.driver_pose = (uint8_t)(param["path_info"][i]["driver_pose"].asUInt());
|
||||
stPathInfo.max_speed = (float)(param["path_info"][i]["max_speed"].asDouble());
|
||||
stPathInfo.max_angular_speed = (float)(param["path_info"][i]["max_angle_speed"].asDouble());
|
||||
|
||||
stPathInfo.action_size = 0;
|
||||
|
||||
nMsgLen = sizeof(ST_PATH) - sizeof(ST_ACTION*);
|
||||
memcpy(acMsgBody + nOffset, &stPathInfo, nMsgLen);
|
||||
nOffset += nMsgLen;
|
||||
|
||||
for (int j = 0; j < stPathInfo.action_size; j++)
|
||||
{
|
||||
ST_ACTION stActionInfo = { 0 };
|
||||
stActionInfo.action_type = 0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
stActionInfo.action_run_type = 0;//ִ<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD>ʽ
|
||||
stActionInfo.action_id = 0;//<2F><><EFBFBD><EFBFBD>ID
|
||||
stActionInfo.param_size = 0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
nMsgLen = sizeof(ST_ACTION) - sizeof(unsigned char *);
|
||||
memcpy(acMsgBody + nOffset, &stActionInfo, nMsgLen);
|
||||
nOffset += nMsgLen;
|
||||
//memcpy(acMsgBody + nOffset, , stActionInfo.param_size); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
nOffset += stActionInfo.param_size;
|
||||
}
|
||||
}
|
||||
nMsgLength = nOffset;
|
||||
}
|
||||
|
||||
|
||||
void CKcProtocol::Build0x02Message(Json::Value param, unsigned char acMsgBody[], int &nMsgLength)
|
||||
{
|
||||
int nVarCount = param["varCount"].asInt();
|
||||
static uint32_t nSerialId = 0;
|
||||
|
||||
READ_MULTIVARIABLE_REQ stReadMutiVariable = { 0 };
|
||||
stReadMutiVariable.variable_count = (uint8_t)nVarCount;
|
||||
stReadMutiVariable.value_id = ++nSerialId;
|
||||
|
||||
int nOffset = 0;
|
||||
int nMsgLen = sizeof(READ_MULTIVARIABLE_REQ) - sizeof(ST_READ_STR_VALUE *);
|
||||
memcpy(acMsgBody, &stReadMutiVariable, nMsgLen);
|
||||
nOffset += nMsgLen;
|
||||
|
||||
for (int i = 0; i < nVarCount; i++)
|
||||
{
|
||||
ST_WRITE_STR_VALUE stWriteValue = { 0 };
|
||||
memset(stWriteValue.name, 0, 16);
|
||||
memcpy(stWriteValue.name, param["var"][i]["name"].asString().c_str(), param["var"][i]["name"].asString().length());
|
||||
stWriteValue.count = param["var"][i]["count"].asInt();
|
||||
|
||||
nMsgLen = sizeof(WRITE_STR_VALUE) - sizeof(WRITE_VALUE_MEMBER *);
|
||||
memcpy(acMsgBody + nOffset, &stWriteValue, nMsgLen);
|
||||
nOffset += nMsgLen;
|
||||
|
||||
Json::Value member = param["var"][i]["member"];
|
||||
|
||||
|
||||
for (int j = 0; j < stWriteValue.count; j++)
|
||||
{
|
||||
READ_VALUE_MEMBER stReadMember = { 0 };
|
||||
//stWriteMember.value = member[j]["value"].asUInt();
|
||||
stReadMember.length = (uint16_t)(member[j]["length"].asUInt());
|
||||
stReadMember.offset = (uint16_t)(member[j]["offset"].asUInt());
|
||||
|
||||
nMsgLen = sizeof(READ_VALUE_MEMBER);
|
||||
memcpy(acMsgBody + nOffset, &stReadMember, nMsgLen);
|
||||
nOffset += nMsgLen;
|
||||
}
|
||||
}
|
||||
nMsgLength = nOffset;
|
||||
}
|
||||
|
||||
void CKcProtocol::Build0x03Message(Json::Value param, unsigned char acMsgBody[], int &nMsgLength)
|
||||
{
|
||||
int nVarCount = param["var_count"].asInt();
|
||||
int nValueId = param["value_id"].asInt();
|
||||
|
||||
ST_WRITE_MULTIVARIABLE_REQ stWriteMutiVariable = {0};
|
||||
stWriteMutiVariable.variable_count = (uint8_t)nVarCount;
|
||||
|
||||
int nOffset = 0;
|
||||
int nMsgLen = sizeof(ST_WRITE_MULTIVARIABLE_REQ) - sizeof(ST_WRITE_STR_VALUE *) ;
|
||||
memcpy(acMsgBody, &stWriteMutiVariable, nMsgLen);
|
||||
nOffset += nMsgLen;
|
||||
|
||||
for (int i = 0; i < nVarCount; i++)
|
||||
{
|
||||
ST_WRITE_STR_VALUE stWriteValue = {0};
|
||||
memset(stWriteValue.name, 0, 16);
|
||||
memcpy(stWriteValue.name, param["var"][i]["name"].asString().c_str(), param["var"][i]["name"].asString().length());
|
||||
stWriteValue.count = param["var"][i]["count"].asInt();
|
||||
|
||||
nMsgLen = sizeof(WRITE_STR_VALUE) - sizeof(WRITE_VALUE_MEMBER *);
|
||||
memcpy(acMsgBody + nOffset, &stWriteValue, nMsgLen);
|
||||
nOffset += nMsgLen;
|
||||
|
||||
Json::Value member = param["var"][i]["member"];
|
||||
|
||||
|
||||
for (int j = 0; j < stWriteValue.count; j++)
|
||||
{
|
||||
ST_WRITE_VALUE_MEMBER stWriteMember = {0};
|
||||
stWriteMember.value = member[j]["value"].asUInt();
|
||||
stWriteMember.length = (uint16_t)(member[j]["length"].asUInt());
|
||||
stWriteMember.offset = (uint16_t)(member[j]["offset"].asUInt());
|
||||
|
||||
nMsgLen = sizeof(ST_WRITE_VALUE_MEMBER);
|
||||
memcpy(acMsgBody + nOffset, &stWriteMember, nMsgLen);
|
||||
nOffset += nMsgLen;
|
||||
}
|
||||
}
|
||||
nMsgLength = nOffset;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CKcProtocol::Build0x14Message(Json::Value param, unsigned char acMsgBody[], int &nMsgLength)
|
||||
{
|
||||
|
||||
ST_MANUAL_LOCATION stLocation;
|
||||
stLocation.angular = param["angle"].asDouble();
|
||||
stLocation.x = param["x"].asDouble();
|
||||
stLocation.y = param["y"].asDouble();
|
||||
|
||||
|
||||
nMsgLength = sizeof(ST_MANUAL_LOCATION) ;
|
||||
memcpy(acMsgBody, &stLocation, nMsgLength);
|
||||
|
||||
}
|
||||
|
||||
void CKcProtocol::Build0xB2Message(Json::Value param, unsigned char acMsgBody[], int &nMsgLength)
|
||||
{
|
||||
static uint32_t nActionId = 0;
|
||||
ST_IMMEDIATE_ACTION stAction = {0};
|
||||
stAction.action_type = (uint16_t)(param["actionType"].asUInt()); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>1=<3D><>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2=<3D><><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3=<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
stAction.action_parallel = (uint8_t)(param["actionParallelManner"].asUInt()); //ִ<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD>ʽ
|
||||
stAction.action_id = ++nActionId;
|
||||
|
||||
|
||||
|
||||
int nOffset = 0;
|
||||
int nMsgLen = sizeof(ST_IMMEDIATE_ACTION) - sizeof(uint8_t *);
|
||||
memcpy(acMsgBody, &stAction, nMsgLen);
|
||||
nOffset += nMsgLen;
|
||||
|
||||
//<2F><>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>
|
||||
if (1 == stAction.action_type)
|
||||
{
|
||||
int nMsgLen = 0;
|
||||
for (int i = 0; i < param["paramData"].size(); i++)
|
||||
{
|
||||
CONTENT_TYPE1 data = {0};
|
||||
data.isStopImmediately = param["paramData"][i]["isStopImmediately"].asUInt();//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ƶ<EFBFBD>
|
||||
memcpy(acMsgBody + nOffset, &data, sizeof(CONTENT_TYPE1));
|
||||
nOffset += sizeof(CONTENT_TYPE1);
|
||||
}
|
||||
stAction.param_size = 4;
|
||||
}
|
||||
//<2F><><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
else if (2 == stAction.action_type)
|
||||
{
|
||||
for (int i = 0; i < param["paramData"].size(); i++)
|
||||
{
|
||||
CONTENT_TYPE2 data = { 0 };
|
||||
data.orderId = param["paramData"][i]["orderId"].asUInt(); //<2F><><EFBFBD><EFBFBD> ID
|
||||
data.taskKey = param["paramData"][i]["taskKey"].asUInt(); //<2F><><EFBFBD><EFBFBD> key
|
||||
memcpy(acMsgBody + nOffset, &data, sizeof(CONTENT_TYPE2));
|
||||
nOffset += sizeof(CONTENT_TYPE2);
|
||||
}
|
||||
stAction.param_size = 8;
|
||||
}
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
else if (3 == stAction.action_type)
|
||||
{
|
||||
for (int i = 0; i < param["paramData"].size(); i++)
|
||||
{
|
||||
CONTENT_TYPE3 data = { 0 };
|
||||
data.orderId = param["paramData"][i]["orderId"].asUInt(); //<2F><><EFBFBD><EFBFBD> ID
|
||||
data.isStopImmediately = param["paramData"][i]["isStopImmediately"].asUInt(); //<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3>ƶ<EFBFBD>
|
||||
memcpy(acMsgBody + nOffset, &data, sizeof(CONTENT_TYPE3));
|
||||
nOffset += sizeof(CONTENT_TYPE3);
|
||||
}
|
||||
stAction.param_size = 8;
|
||||
}
|
||||
|
||||
nMsgLength = nOffset;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Json::Value CKcProtocol::Analysis0xAFMessage(unsigned char *pMsg, int nLen)
|
||||
{
|
||||
ST_AGV_STATUS *pstAgvStatus;
|
||||
|
||||
pstAgvStatus = (ST_AGV_STATUS *)(pMsg+28);
|
||||
|
||||
int nOffset = 0;
|
||||
Json::Value root;
|
||||
|
||||
Json::Value location_status_info;
|
||||
location_status_info["x"] = pstAgvStatus->stLocationStatusInfo.x;
|
||||
location_status_info["y"] = pstAgvStatus->stLocationStatusInfo.y;
|
||||
location_status_info["angle"] = pstAgvStatus->stLocationStatusInfo.angle;
|
||||
location_status_info["point_id"] = pstAgvStatus->stLocationStatusInfo.point_id;
|
||||
location_status_info["segment_id"] = pstAgvStatus->stLocationStatusInfo.segment_id;
|
||||
location_status_info["point_seq"] = pstAgvStatus->stLocationStatusInfo.point_seq;
|
||||
location_status_info["confidence"] = pstAgvStatus->stLocationStatusInfo.confidence;
|
||||
root["LOCATION_STATUS_INFO"] = location_status_info;
|
||||
nOffset += sizeof(ST_AGV_STATUS);
|
||||
|
||||
|
||||
|
||||
|
||||
Json::Value running_status_info;
|
||||
running_status_info["line_speed"] = pstAgvStatus->stRunningStatusInfo.line_speed;
|
||||
running_status_info["acceleration"] = pstAgvStatus->stRunningStatusInfo.acceleration;
|
||||
running_status_info["angular_speed"] = pstAgvStatus->stRunningStatusInfo.angular_speed;
|
||||
running_status_info["mode"] = pstAgvStatus->stRunningStatusInfo.mode;
|
||||
running_status_info["status"] = pstAgvStatus->stRunningStatusInfo.status;
|
||||
running_status_info["capability"] = pstAgvStatus->stRunningStatusInfo.capability;
|
||||
root["RUNNING_STATUS_INFO"] = running_status_info;
|
||||
nOffset += sizeof(ST_RUNNING_STATUS_INFO);
|
||||
|
||||
char *pPoint1 =(char *) &(pstAgvStatus->stRunningStatusInfo);
|
||||
|
||||
|
||||
Json::Value task_status_info;
|
||||
task_status_info["order_id"] = pstAgvStatus->stTaskStatusInfo.order_id;
|
||||
task_status_info["task_key"] = pstAgvStatus->stTaskStatusInfo.task_key;
|
||||
|
||||
int nTaskStatusInfoLen = sizeof(TASK_STATUS_INFO) - 2 * sizeof(ST_POINT_STATE_SEQUENCE *)
|
||||
+ pstAgvStatus->stTaskStatusInfo.point_size * sizeof(ST_POINT_STATE_SEQUENCE)
|
||||
+ pstAgvStatus->stTaskStatusInfo.path_size * sizeof(ST_PATH_STATE_SEQUENCE);
|
||||
|
||||
Json::Value point_array = Json::arrayValue;;
|
||||
ST_POINT_STATE_SEQUENCE * pPointStateSequence = (ST_POINT_STATE_SEQUENCE *)((unsigned char *) &(pstAgvStatus->stRunningStatusInfo) + sizeof(TASK_STATUS_INFO)
|
||||
- sizeof(ST_POINT_STATE_SEQUENCE *) - sizeof(ST_PATH_STATE_SEQUENCE *));
|
||||
for (int i = 0; i < pstAgvStatus->stTaskStatusInfo.point_size; i++)
|
||||
{
|
||||
Json::Value point_item;
|
||||
point_item["sequence"] = (pPointStateSequence+i)->sequence;
|
||||
point_item["point_id"] = (pPointStateSequence+i)->point_id;
|
||||
point_array.append(point_item);
|
||||
}
|
||||
|
||||
Json::Value path_array = Json::arrayValue;
|
||||
ST_PATH_STATE_SEQUENCE * pPathStateSequence = (ST_PATH_STATE_SEQUENCE *)((unsigned char *) pPointStateSequence + pstAgvStatus->stTaskStatusInfo.point_size * sizeof(ST_POINT_STATE_SEQUENCE));
|
||||
|
||||
for (int i = 0; i < pstAgvStatus->stTaskStatusInfo.path_size; i++)
|
||||
{
|
||||
Json::Value abnormal_item;
|
||||
abnormal_item["sequence"] = (pPathStateSequence + i)->sequence;
|
||||
abnormal_item["path_id"] = (pPathStateSequence + i)->path_id;
|
||||
path_array.append(abnormal_item);
|
||||
}
|
||||
task_status_info["POINT_STATE_SEQUENCE"] = point_array;
|
||||
task_status_info["PATH_STATE_SEQUENCE"] = path_array;
|
||||
root["TASK_STATUS_INFO"] = task_status_info;
|
||||
|
||||
|
||||
char *pPoint2 = (char *) &(pstAgvStatus->stTaskStatusInfo);
|
||||
|
||||
|
||||
ST_BATTERY_STATUS_INFO *pBatteryStatusInfo;
|
||||
Json::Value battery_status_info;
|
||||
pBatteryStatusInfo = (ST_BATTERY_STATUS_INFO *)((unsigned char*) &(pstAgvStatus->stTaskStatusInfo) + nTaskStatusInfoLen);
|
||||
battery_status_info["power"] = pBatteryStatusInfo->power;
|
||||
battery_status_info["voltage"] = pBatteryStatusInfo->voltage;
|
||||
battery_status_info["current"] = pBatteryStatusInfo->current;
|
||||
battery_status_info["status"] = pBatteryStatusInfo->status;
|
||||
root["BATTERY_STATUS_INFO"] = battery_status_info;
|
||||
|
||||
|
||||
|
||||
ABNORMAL_EVENT_STATUS_INFO *pAbnormalEventStatusInfo;
|
||||
pAbnormalEventStatusInfo = (ABNORMAL_EVENT_STATUS_INFO *)((unsigned char *)pBatteryStatusInfo + sizeof(ST_BATTERY_STATUS_INFO));
|
||||
Json::Value abnormal_array;
|
||||
for (int i = 0; i < pstAgvStatus->abnormal_size; i++)
|
||||
{
|
||||
Json::Value abnormal_item;
|
||||
abnormal_item["event_code"] = (pAbnormalEventStatusInfo + i)->event_code;
|
||||
abnormal_item["event_level"] = (pAbnormalEventStatusInfo + i)->event_level;
|
||||
abnormal_array.append(abnormal_item);
|
||||
}
|
||||
root["ABNORMAL_EVENT_STATUS_INFO"] = abnormal_array;
|
||||
|
||||
|
||||
ST_ACTION_STATUS_INFO *pActionStatusInfo;
|
||||
pActionStatusInfo = (ST_ACTION_STATUS_INFO *)((unsigned char *)pAbnormalEventStatusInfo + pstAgvStatus->abnormal_size*sizeof(ABNORMAL_EVENT_STATUS_INFO));
|
||||
Json::Value action_array = Json::arrayValue;
|
||||
for (int i = 0; i < pstAgvStatus->action_size; i++)
|
||||
{
|
||||
Json::Value action_item;
|
||||
action_item["action_id"] = (pActionStatusInfo + i)->action_id;
|
||||
action_item["action_status"] = (pActionStatusInfo + i)->action_status;
|
||||
action_array.append(action_item);
|
||||
}
|
||||
root["ACTION_STATUS_INFO"] = action_array;
|
||||
|
||||
|
||||
REPORT_INFO *pReportInfo;
|
||||
pReportInfo = (REPORT_INFO *)((unsigned char *)pActionStatusInfo + pstAgvStatus->action_size * sizeof(ST_ACTION_STATUS_INFO));
|
||||
Json::Value info_array = Json::arrayValue;;
|
||||
for (int i = 0; i < pstAgvStatus->info_size; i++)
|
||||
{
|
||||
Json::Value info_item;
|
||||
info_item["info_type"] = (pReportInfo + i)->info_type;
|
||||
info_item["info_size"] = (pReportInfo + i)->info_size;
|
||||
info_array.append(info_item);
|
||||
}
|
||||
root["REPORT_INFO"] = info_array;
|
||||
|
||||
return root;
|
||||
|
||||
}
|
||||
*/
|
||||
Json::Value CKcProtocol::Analysis0xAFMessage(unsigned char *pMsg, int nLen)
|
||||
{
|
||||
ST_AGV_STATUS *pstAgvStatus;
|
||||
|
||||
pstAgvStatus = (ST_AGV_STATUS *)(pMsg + 28);
|
||||
|
||||
int nOffset = 0;
|
||||
Json::Value root;
|
||||
|
||||
root["x"] = pstAgvStatus->stLocationStatusInfo.x; //X
|
||||
root["y"] = pstAgvStatus->stLocationStatusInfo.y; //Y
|
||||
root["angle"] = pstAgvStatus->stLocationStatusInfo.angle; //<2F>Ƕ<EFBFBD>
|
||||
root["point"] = pstAgvStatus->stLocationStatusInfo.point_id; //<2F><><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD><EFBFBD>
|
||||
nOffset += sizeof(ST_AGV_STATUS);
|
||||
|
||||
|
||||
ChangeGuideType(pstAgvStatus->stLocationStatusInfo.point_id);
|
||||
|
||||
|
||||
root["agv_model"] = pstAgvStatus->stRunningStatusInfo.mode;
|
||||
root["agv_status"] = pstAgvStatus->stRunningStatusInfo.status;
|
||||
nOffset += sizeof(ST_RUNNING_STATUS_INFO);
|
||||
|
||||
char *pPoint1 = (char *) &(pstAgvStatus->stRunningStatusInfo);
|
||||
|
||||
|
||||
Json::Value task_status_info;
|
||||
task_status_info["order_id"] = pstAgvStatus->stTaskStatusInfo.order_id;
|
||||
task_status_info["task_key"] = pstAgvStatus->stTaskStatusInfo.task_key;
|
||||
|
||||
int nTaskStatusInfoLen = sizeof(TASK_STATUS_INFO) - 2 * sizeof(ST_POINT_STATE_SEQUENCE *)
|
||||
+ pstAgvStatus->stTaskStatusInfo.point_size * sizeof(ST_POINT_STATE_SEQUENCE)
|
||||
+ pstAgvStatus->stTaskStatusInfo.path_size * sizeof(ST_PATH_STATE_SEQUENCE);
|
||||
|
||||
//Json::Value point_array = Json::arrayValue;;
|
||||
ST_POINT_STATE_SEQUENCE * pPointStateSequence = (ST_POINT_STATE_SEQUENCE *)((unsigned char *) &(pstAgvStatus->stRunningStatusInfo) + sizeof(TASK_STATUS_INFO)
|
||||
- sizeof(ST_POINT_STATE_SEQUENCE *) - sizeof(ST_PATH_STATE_SEQUENCE *));
|
||||
/*for (int i = 0; i < pstAgvStatus->stTaskStatusInfo.point_size; i++)
|
||||
{
|
||||
Json::Value point_item;
|
||||
point_item["sequence"] = (pPointStateSequence + i)->sequence;
|
||||
point_item["point_id"] = (pPointStateSequence + i)->point_id;
|
||||
point_array.append(point_item);
|
||||
}
|
||||
|
||||
Json::Value path_array = Json::arrayValue;*/
|
||||
ST_PATH_STATE_SEQUENCE * pPathStateSequence = (ST_PATH_STATE_SEQUENCE *)((unsigned char *)pPointStateSequence + pstAgvStatus->stTaskStatusInfo.point_size * sizeof(ST_POINT_STATE_SEQUENCE));
|
||||
|
||||
/*for (int i = 0; i < pstAgvStatus->stTaskStatusInfo.path_size; i++)
|
||||
{
|
||||
Json::Value path_item;
|
||||
path_item["sequence"] = (pPathStateSequence + i)->sequence;
|
||||
path_item["path_id"] = (pPathStateSequence + i)->path_id;
|
||||
path_array.append(path_item);
|
||||
}
|
||||
task_status_info["POINT_STATE_SEQUENCE"] = point_array;
|
||||
task_status_info["PATH_STATE_SEQUENCE"] = path_array;
|
||||
root["TASK_STATUS_INFO"] = task_status_info;*/
|
||||
|
||||
|
||||
char *pPoint2 = (char *) &(pstAgvStatus->stTaskStatusInfo);
|
||||
|
||||
|
||||
ST_BATTERY_STATUS_INFO *pBatteryStatusInfo;
|
||||
pBatteryStatusInfo = (ST_BATTERY_STATUS_INFO *)((unsigned char*) &(pstAgvStatus->stTaskStatusInfo) + nTaskStatusInfoLen);
|
||||
root["power"] = pBatteryStatusInfo->power; //<2F><><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>
|
||||
root["charge_status"] = pBatteryStatusInfo->status; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD> = 0<><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = 1, <20><><EFBFBD><EFBFBD> = 2
|
||||
|
||||
root["cargo_status"] = 1; //Ĭ<><C4AC><EFBFBD>ػ<EFBFBD>
|
||||
|
||||
//<2F>쳣<EFBFBD><ECB3A3>Ϣ
|
||||
ABNORMAL_EVENT_STATUS_INFO *pAbnormalEventStatusInfo;
|
||||
pAbnormalEventStatusInfo = (ABNORMAL_EVENT_STATUS_INFO *)((unsigned char *)pBatteryStatusInfo + sizeof(ST_BATTERY_STATUS_INFO));
|
||||
Json::Value abnormal_array;
|
||||
for (int i = 0; i < pstAgvStatus->abnormal_size; i++)
|
||||
{
|
||||
Json::Value abnormal_item;
|
||||
abnormal_item["event_code"] = (pAbnormalEventStatusInfo + i)->event_code;
|
||||
abnormal_item["event_level"] = (pAbnormalEventStatusInfo + i)->event_level;
|
||||
abnormal_array.append(abnormal_item);
|
||||
}
|
||||
//root["error"] = abnormal_array;
|
||||
root["error"] = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ";
|
||||
|
||||
/*
|
||||
ST_ACTION_STATUS_INFO *pActionStatusInfo;
|
||||
pActionStatusInfo = (ST_ACTION_STATUS_INFO *)((unsigned char *)pAbnormalEventStatusInfo + pstAgvStatus->abnormal_size * sizeof(ABNORMAL_EVENT_STATUS_INFO));
|
||||
Json::Value action_array = Json::arrayValue;
|
||||
for (int i = 0; i < pstAgvStatus->action_size; i++)
|
||||
{
|
||||
Json::Value action_item;
|
||||
action_item["action_id"] = (pActionStatusInfo + i)->action_id;
|
||||
action_item["action_status"] = (pActionStatusInfo + i)->action_status;
|
||||
action_array.append(action_item);
|
||||
}
|
||||
root["ACTION_STATUS_INFO"] = action_array;
|
||||
|
||||
|
||||
REPORT_INFO *pReportInfo;
|
||||
pReportInfo = (REPORT_INFO *)((unsigned char *)pActionStatusInfo + pstAgvStatus->action_size * sizeof(ST_ACTION_STATUS_INFO));
|
||||
Json::Value info_array = Json::arrayValue;;
|
||||
for (int i = 0; i < pstAgvStatus->info_size; i++)
|
||||
{
|
||||
Json::Value info_item;
|
||||
info_item["info_type"] = (pReportInfo + i)->info_type;
|
||||
info_item["info_size"] = (pReportInfo + i)->info_size;
|
||||
info_array.append(info_item);
|
||||
}
|
||||
root["REPORT_INFO"] = info_array;
|
||||
*/
|
||||
return root;
|
||||
|
||||
}
|
||||
|
||||
Json::Value CKcProtocol::Analysis0x17Message(unsigned char *pMsg, int nLen)
|
||||
{
|
||||
AGV_RUN_STATUS *pstAgvRunStatus;
|
||||
|
||||
pstAgvRunStatus = (AGV_RUN_STATUS *)(pMsg + 28);
|
||||
|
||||
|
||||
Json::Value root;
|
||||
root["temperature"] = pstAgvRunStatus->temperature;
|
||||
root["x"] = pstAgvRunStatus->x;
|
||||
root["y"] = pstAgvRunStatus->y;
|
||||
|
||||
root["angular"] = pstAgvRunStatus->angular;
|
||||
root["power"] = pstAgvRunStatus->power;
|
||||
root["is_block"] = pstAgvRunStatus->is_block;
|
||||
root["is_charge"] = pstAgvRunStatus->is_charge;
|
||||
root["mode"] = pstAgvRunStatus->mode;
|
||||
root["map_statue"] = pstAgvRunStatus->map_statue;
|
||||
|
||||
root["point_id"] = pstAgvRunStatus->point_id;
|
||||
root["travel_speed"] = pstAgvRunStatus->travel_speed;
|
||||
root["turning_speed"] = pstAgvRunStatus->turning_speed;
|
||||
root["voltage"] = pstAgvRunStatus->voltage;
|
||||
root["current"] = pstAgvRunStatus->current;
|
||||
|
||||
root["task_status"] = pstAgvRunStatus->task_status;
|
||||
root["location_type"] = pstAgvRunStatus->location_type;
|
||||
root["map_version"] = pstAgvRunStatus->map_version;
|
||||
root["total_mileage"] = pstAgvRunStatus->total_mileage;
|
||||
root["this_runtime"] = pstAgvRunStatus->this_runtime;
|
||||
root["total_runtime"] = pstAgvRunStatus->total_runtime;
|
||||
root["location_status"] = pstAgvRunStatus->location_status;
|
||||
|
||||
root["is_traffic_control"] = pstAgvRunStatus->is_traffic_control;
|
||||
root["map_count"] = pstAgvRunStatus->map_count;
|
||||
root["map_name"] = pstAgvRunStatus->map_name;
|
||||
root["confidence"] = pstAgvRunStatus->confidence;
|
||||
|
||||
return root;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Json::Value CKcProtocol::Analysis0x02Message(unsigned char *pMsg, int nLen)
|
||||
{
|
||||
Json::Value root;
|
||||
|
||||
|
||||
ST_READ_MULTIVARIABLE_RESP *pstReadVariableResp;
|
||||
|
||||
|
||||
pstReadVariableResp = (ST_READ_MULTIVARIABLE_RESP *)(pMsg + 28);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
Json::Value CKcProtocol::Analysis0xB0Message(unsigned char *pMsg, int nLen)
|
||||
{
|
||||
Json::Value root;
|
||||
|
||||
unsigned char *pData = (unsigned char *)(pMsg + 28);
|
||||
|
||||
root["load_size"] = (uint32_t)(*pData);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CKcProtocol::ChangeGuideType(int nPositionId)
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (theApp.m_nReqPointId == nPositionId)
|
||||
{
|
||||
//ȡ<><C8A1><EFBFBD><EFBFBD>
|
||||
if (theApp.m_nReqPointType == 1)
|
||||
{
|
||||
//<2F><EFBFBD><DEBB><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD>뵼<EFBFBD><EBB5BC>
|
||||
if (theApp.m_nCargoStatus == 0)
|
||||
{
|
||||
theApp.ChangeGuideType(QRCODE_TYPE);
|
||||
}
|
||||
else
|
||||
{
|
||||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><E2B5BC>
|
||||
theApp.ChangeGuideType(SLAM_TYPE);
|
||||
}
|
||||
}
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
else if (theApp.m_nReqPointType == 2 && theApp.m_nCargoStatus == 1)
|
||||
{
|
||||
//<2F><EFBFBD><DEBB><EFBFBD><EFBFBD>ѷ<EFBFBD><D1B7>꣩<EFBFBD><EAA3A9><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2B5BC>
|
||||
if (theApp.m_nCargoStatus == 0)
|
||||
{
|
||||
theApp.ChangeGuideType(SLAM_TYPE);
|
||||
}
|
||||
else
|
||||
{
|
||||
//<2F>л<EFBFBD><D0BB><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD>뵼<EFBFBD><EBB5BC>
|
||||
theApp.ChangeGuideType(QRCODE_TYPE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
Plugin/KcCtrl/KcProtocol.h
Normal file
28
Plugin/KcCtrl/KcProtocol.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
class CKcProtocol
|
||||
{
|
||||
public:
|
||||
CKcProtocol();
|
||||
~CKcProtocol();
|
||||
|
||||
public:
|
||||
void BuildRequestMessage(unsigned char cCommand, unsigned char acContent[], int &nContentLength, Json::Value param=NULL);
|
||||
|
||||
//void Build0xAEMessage(unsigned char acContent[], int &nContentLength);
|
||||
void Build0xAEMessage(Json::Value param, unsigned char acMsgBody[], int &nMsgLength);
|
||||
void Build0x03Message(Json::Value param, unsigned char acContent[], int &nContentLength);
|
||||
void Build0x02Message(Json::Value param, unsigned char acContent[], int &nContentLength);
|
||||
void Build0xB2Message(Json::Value param, unsigned char acMsgBody[], int &nMsgLength);
|
||||
void Build0x02Message(unsigned char acContent[], int &nContentLength);
|
||||
void Build0x14Message(Json::Value param, unsigned char acMsgBody[], int &nMsgLength);
|
||||
|
||||
|
||||
Json::Value Analysis0xAFMessage(unsigned char *pMsg, int nLen);
|
||||
Json::Value Analysis0x17Message(unsigned char *pMsg, int nLen);
|
||||
Json::Value Analysis0x02Message(unsigned char *pMsg, int nLen);
|
||||
Json::Value Analysis0xB0Message(unsigned char *pMsg, int nLen);
|
||||
|
||||
void ChangeGuideType(int nPositionId);
|
||||
|
||||
};
|
||||
496
Plugin/KcCtrl/KcStruct.h
Normal file
496
Plugin/KcCtrl/KcStruct.h
Normal file
@@ -0,0 +1,496 @@
|
||||
#pragma
|
||||
|
||||
|
||||
//<2F>ƴϿ<C6B4><CFBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD>Ϣ
|
||||
typedef struct KC_MESSAGE_HEADER
|
||||
{
|
||||
unsigned char version; //Э<><D0AD><EFBFBD>汾<EFBFBD><E6B1BE>,<2C>̶<EFBFBD>Ϊ0x01
|
||||
unsigned char type; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD>0x00,Ӧ<><D3A6>0x01
|
||||
unsigned short serial_number; //ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD>кţ<D0BA><C5A3><EFBFBD><EFBFBD><EFBFBD>ʱ+1
|
||||
unsigned char server_code; //<2F><><EFBFBD><EFBFBD><EFBFBD>룬<EFBFBD>̶<EFBFBD>0x10
|
||||
unsigned char command_code; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char run_code; //ִ<><D6B4><EFBFBD>룬Ӧ<EBA3AC><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д
|
||||
unsigned char reserve1; //Ԥ<><D4A4><EFBFBD>ֶ<EFBFBD>1<EFBFBD><31><EFBFBD>̶<EFBFBD>Ϊ0
|
||||
unsigned short content_length; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char reserve2[2]; //Ԥ<><D4A4><EFBFBD>ֶ<EFBFBD>2
|
||||
|
||||
}ST_KC_MESSAGE_HEADER;
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------(0xAF) AGV_STATUS BEGIN--------------------------------------------------//
|
||||
|
||||
//λ<><CEBB>״̬<D7B4><CCAC>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
typedef struct LOCATION_STATUS_INFO
|
||||
{
|
||||
float x; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>λ<EFBFBD><CEBB> x <20><><EFBFBD><EFBFBD>
|
||||
float y; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>λ<EFBFBD><CEBB> y <20><><EFBFBD><EFBFBD>
|
||||
float angle; //<2F><><EFBFBD><EFBFBD><EFBFBD>˾<EFBFBD><CBBE>Գ<EFBFBD><D4B3>巽<EFBFBD><E5B7BD><EFBFBD><EFBFBD>
|
||||
unsigned int point_id; //AGV <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ͨ<EFBFBD><CDA8><EFBFBD>ĵ<EFBFBD> ID
|
||||
unsigned int segment_id; //AGV <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ͨ<EFBFBD><CDA8><EFBFBD>Ķ<EFBFBD> ID
|
||||
unsigned int point_seq; //<2F><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD>к<EFBFBD>
|
||||
unsigned char confidence; //<2F><><EFBFBD>Ŷ<EFBFBD>0-100
|
||||
unsigned char reserve[7]; //Ԥ<><D4A4><EFBFBD>ֶ<EFBFBD>
|
||||
|
||||
}ST_LOCATION_STATUS_INFO;
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
typedef struct RUNNING_STATUS_INFO
|
||||
{
|
||||
float line_speed; //AGVʵʱ<CAB5><CAB1><EFBFBD>ٶ<EFBFBD>
|
||||
float acceleration; //AGVʵʱ<CAB5><CAB1><EFBFBD>ٶ<EFBFBD>
|
||||
float angular_speed; //AGVʵʱ<CAB5><CAB1><EFBFBD>ٶ<EFBFBD>
|
||||
unsigned char mode; //AGV<47><56><EFBFBD><EFBFBD>ģʽ
|
||||
unsigned char status; //AGV״̬
|
||||
unsigned char capability; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC>0δ<30><CEB4><EFBFBD>ã<EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char reserve[5]; //Ԥ<><D4A4><EFBFBD>ֶ<EFBFBD>
|
||||
|
||||
}ST_RUNNING_STATUS_INFO;
|
||||
|
||||
|
||||
//<2F><>״̬<D7B4><CCAC><EFBFBD><EFBFBD>
|
||||
typedef struct POINT_STATE_SEQUENCE
|
||||
{
|
||||
unsigned int sequence; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned int point_id; //<2F><>ID
|
||||
|
||||
}ST_POINT_STATE_SEQUENCE;
|
||||
|
||||
|
||||
//<2F><>״̬<D7B4><CCAC><EFBFBD><EFBFBD>
|
||||
typedef struct PATH_STATE_SEQUENCE
|
||||
{
|
||||
unsigned int sequence; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned int path_id; //<2F><>ID
|
||||
|
||||
}ST_PATH_STATE_SEQUENCE;
|
||||
|
||||
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
typedef struct TASK_STATUS_INFO
|
||||
{
|
||||
unsigned int order_id; //<2F><><EFBFBD><EFBFBD>ID
|
||||
unsigned int task_key; //<2F><><EFBFBD><EFBFBD>KEY
|
||||
unsigned char point_size; //<2F><>״̬<D7B4><CCAC><EFBFBD>г<EFBFBD><D0B3><EFBFBD>
|
||||
unsigned char path_size; //<2F><>״̬<D7B4><CCAC><EFBFBD>г<EFBFBD><D0B3><EFBFBD>
|
||||
unsigned char reserve[2]; //Ԥ<><D4A4><EFBFBD>ֶ<EFBFBD>
|
||||
ST_POINT_STATE_SEQUENCE *pPointStateSequence; //<2F><><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>δִ<CEB4>еĵ<D0B5><C4B5><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>point_sizeȷ<65><C8B7>
|
||||
ST_PATH_STATE_SEQUENCE *pPathStateSequence; //<2F><><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>δִ<CEB4>еĶ<D0B5><C4B6><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>path_sizeȷ<65><C8B7>
|
||||
|
||||
|
||||
}ST_TASK_STATUS_INFO;
|
||||
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
typedef struct BATTERY_STATUS_INFO
|
||||
{
|
||||
float power; //<2F><><EFBFBD><EFBFBD><EFBFBD>ٷֱ<D9B7>
|
||||
float voltage; //<2F><>ѹ
|
||||
float current; //<2F><><EFBFBD><EFBFBD>
|
||||
unsigned char status; //<2F><><EFBFBD><EFBFBD>״̬ 02<30><32><EFBFBD><EFBFBD>01<30><31><EFBFBD>磬00<30>ŵ<EFBFBD>
|
||||
unsigned char reserve[7]; //Ԥ<><D4A4><EFBFBD>ֶ<EFBFBD>
|
||||
|
||||
}ST_BATTERY_STATUS_INFO;
|
||||
|
||||
|
||||
//<2F>쳣<EFBFBD>¼<EFBFBD>״̬<D7B4><CCAC>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
typedef struct ABNORMAL_EVENT_STATUS_INFO
|
||||
{
|
||||
unsigned short event_code; //<2F>¼<EFBFBD><C2BC><EFBFBD>
|
||||
unsigned short event_level; //<2F>¼<EFBFBD><C2BC>ȼ<EFBFBD> <20><>Ϣ00, <20><><EFBFBD><EFBFBD>01<30><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>02
|
||||
unsigned char reserve[8]; //Ԥ<><D4A4><EFBFBD>ֶ<EFBFBD>
|
||||
|
||||
}ST_ABNORMAL_EVENT_STATUS_INFO;
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
typedef struct ACTION_STATUS_INFO
|
||||
{
|
||||
unsigned int action_id; //<2F><><EFBFBD><EFBFBD>id<69><64> 0Ϊ<30><CEAA>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>
|
||||
unsigned char action_status; //<2F><><EFBFBD><EFBFBD>״̬ 00<30>ȴ<EFBFBD><C8B4><EFBFBD>01<30><31>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>02ִ<32><D6B4><EFBFBD>У<EFBFBD>03<30><33><EFBFBD>ɣ<EFBFBD>04ʧ<34>ܣ<EFBFBD>05ȡ<35><C8A1><EFBFBD><EFBFBD>06<30><36>ͣ
|
||||
unsigned char reserve[7]; //Ԥ<><D4A4><EFBFBD>ֶ<EFBFBD>
|
||||
|
||||
}ST_ACTION_STATUS_INFO;
|
||||
|
||||
//AGV<47>ϱ<EFBFBD><CFB1><EFBFBD>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
typedef struct REPORT_INFO
|
||||
{
|
||||
unsigned short info_size; //<2F><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||||
unsigned short info_type; //<2F><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||||
unsigned char *pInfoContent; //<2F><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD> 4<>ֽڶ<D6BD><DAB6>룬 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>info_sizeȷ<65><C8B7>
|
||||
}ST_REPORT_INFO;
|
||||
|
||||
|
||||
|
||||
typedef struct AGV_STATUS
|
||||
{
|
||||
unsigned char abnormal_size; //<2F>쳣<EFBFBD>¼<EFBFBD>״̬<D7B4><CCAC>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||||
unsigned char action_size; //<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD>
|
||||
unsigned char info_size; //<2F><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||||
unsigned char reserve1; //Ԥ<><D4A4><EFBFBD>ֶ<EFBFBD>
|
||||
ST_LOCATION_STATUS_INFO stLocationStatusInfo; //λ<><CEBB>״̬<D7B4><CCAC>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
ST_RUNNING_STATUS_INFO stRunningStatusInfo; //<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
ST_TASK_STATUS_INFO stTaskStatusInfo; //<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
ST_BATTERY_STATUS_INFO stBatteryStatusInfo; //<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
ST_ABNORMAL_EVENT_STATUS_INFO *pstAbnormalEventStatusInfo; //<2F>쳣<EFBFBD>¼<EFBFBD>״̬<D7B4><CCAC>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>abnormal_sizeȷ<65><C8B7>
|
||||
ST_ACTION_STATUS_INFO *pstActionStatusInfo; //<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC>Ϣ<EFBFBD>ṹ<EFBFBD>壬<EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>action_sizeȷ<65><C8B7>
|
||||
ST_REPORT_INFO *pstReportInfo; //<2F>ϱ<EFBFBD><CFB1><EFBFBD>Ϣ<EFBFBD>ṹ<EFBFBD>壬<EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>info_sizeȷ<65><C8B7>
|
||||
|
||||
}ST_AGV_STATUS;
|
||||
|
||||
//---------------------------------------------------AGV_STATUS END---------------------------------------------//
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------(0xBO) AGV_CARGO_STATUS BEGIN-----------------------------//
|
||||
typedef struct LOAD_STATUS_INFO
|
||||
{
|
||||
unsigned char cargo_id[64]; //<2F><>ҪRFIDʱ<44><CAB1><EFBFBD><EFBFBD>
|
||||
unsigned char cargo_status; //00<30><EFBFBD><DEBB><EFBFBD>01<30>л<EFBFBD>
|
||||
unsigned short cargo_type; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char cargo_direction; //<2F><><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
unsigned char reserve[4]; //Ԥ<><D4A4>
|
||||
|
||||
}ST_LOAD_STATUS_INFO;
|
||||
|
||||
|
||||
//AGV<47>ػ<EFBFBD>״̬<D7B4><CCAC>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
typedef struct AGV_CARGO_STATUS
|
||||
{
|
||||
unsigned char load_size; //<2F>ػ<EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char reserve[3]; //<2F><><EFBFBD><EFBFBD>
|
||||
ST_LOAD_STATUS_INFO *pstLoadStatusInfo; //<2F>ػ<EFBFBD>״̬<D7B4>ṹ<EFBFBD>壬<EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>load_sizeȷ<65><C8B7>
|
||||
|
||||
}ST_AGV_CARGO_STATUS;
|
||||
//---------------------------------------------------AGV_CARGO_STATUS END---------------------------------------------//
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------(0xB1) SUBSCRIPTION_COMMAND BEGIN-------------------------------//
|
||||
//<2F><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
typedef struct SUBSCRIPTION_INFO
|
||||
{
|
||||
unsigned short command_code; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0<><30><EFBFBD>ɶ<EFBFBD><C9B6><EFBFBD>
|
||||
unsigned short interval_time; //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
unsigned int duration_time; //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
unsigned char reserve[8]; //Ԥ<><D4A4>
|
||||
|
||||
}ST_SUBSCRIPTION_INFO;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
typedef struct SUBSCRIPTION_REQ
|
||||
{
|
||||
ST_SUBSCRIPTION_INFO info[8]; //<2F><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
unsigned char uuid[64]; //uuid
|
||||
|
||||
}ST_SUBSCRIPTION_REQ;
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
typedef struct SUBSCRIPTION_RESP
|
||||
{
|
||||
unsigned char uuid[64]; //uuid
|
||||
unsigned char errcode; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0<>ɹ<EFBFBD><C9B9><EFBFBD>1ʧ<31><CAA7>
|
||||
|
||||
}ST_SUBSCRIPTION_RESP;
|
||||
//---------------------------------------------------SUBSCRIPTION_COMMAND END---------------------------------------------//
|
||||
|
||||
|
||||
//---------------------------------------------------(0xB2) IMMEDIATE_ACTION_COMMAND BEGIN-------------------------------//
|
||||
|
||||
typedef struct CONTENT_TYPE1
|
||||
{
|
||||
unsigned int isStopImmediately;
|
||||
};
|
||||
|
||||
typedef struct CONTENT_TYPE2
|
||||
{
|
||||
unsigned int orderId;
|
||||
unsigned int taskKey;
|
||||
};
|
||||
|
||||
typedef struct CONTENT_TYPE3
|
||||
{
|
||||
unsigned int orderId;
|
||||
unsigned int isStopImmediately;
|
||||
};
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
typedef struct IMMEDIATE_ACTION
|
||||
{
|
||||
unsigned short action_type; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char action_parallel; //0x00<30><30>Ϊ<EFBFBD>ƶ<EFBFBD><C6B6>Ͷ<EFBFBD><CDB6><EFBFBD><EFBFBD>䶼<EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD>,0x01<30><31>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>0x02 ֻ<><D6BB>ִ<EFBFBD>е<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
||||
unsigned char reserve1; //Ԥ<><D4A4>
|
||||
unsigned int action_id; //<2F><><EFBFBD><EFBFBD>id
|
||||
unsigned char param_size; //<2F><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
unsigned char reserve2[3]; //Ԥ<><D4A4>
|
||||
unsigned char *pContent; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>param_sizeȷ<65><C8B7>
|
||||
|
||||
}ST_IMMEDIATE_ACTION;
|
||||
//---------------------------------------------------IMMEDIATE_ACTION_COMMAND END---------------------------------------------//
|
||||
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------(0x02) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵָ<D6B5><D6B8> BEGIN-------------------------------//
|
||||
|
||||
typedef struct READ_VALUE_MEMBER
|
||||
{
|
||||
unsigned short offset;
|
||||
unsigned short length;
|
||||
|
||||
}ST_READ_VALUE_MEMBER;
|
||||
|
||||
typedef struct READ_STR_VALUE
|
||||
{
|
||||
unsigned char name[16];
|
||||
unsigned int count;
|
||||
READ_VALUE_MEMBER *pReadValueMember; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>countȷ<74><C8B7>
|
||||
}ST_READ_STR_VALUE;
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
||||
typedef struct READ_MULTIVARIABLE_REQ
|
||||
|
||||
{
|
||||
unsigned char variable_count; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char reserve1[3]; //Ԥ<><D4A4>
|
||||
unsigned int value_id; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>
|
||||
ST_READ_STR_VALUE *pReadStrValue; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>variable_countȷ<74><C8B7>
|
||||
}ST_READ_MULTIVARIABLE_REQ;
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵӦ<D6B5><D3A6>
|
||||
typedef struct READ_MULTIVARIABLE_RESP
|
||||
|
||||
{
|
||||
unsigned int value_id; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>
|
||||
unsigned short length; //Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>
|
||||
unsigned char reserve1[2]; //Ԥ<><D4A4>
|
||||
unsigned char *pRespData; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4 <20>ֽڶ<D6BD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>
|
||||
}ST_READ_MULTIVARIABLE_RESP;
|
||||
|
||||
//---------------------------------------------------<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵָ<D6B5><D6B8> END---------------------------------------------//
|
||||
|
||||
|
||||
//---------------------------------------------------(0x03) д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵָ<D6B5><D6B8> BEGIN-------------------------------//
|
||||
typedef struct WRITE_VALUE_MEMBER
|
||||
{
|
||||
unsigned short offset;
|
||||
unsigned short length;
|
||||
unsigned int value;
|
||||
|
||||
}ST_WRITE_VALUE_MEMBER;
|
||||
|
||||
typedef struct WRITE_STR_VALUE
|
||||
{
|
||||
unsigned char name[16];
|
||||
unsigned int count;
|
||||
WRITE_VALUE_MEMBER *pWriteValueMember; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>countȷ<74><C8B7>
|
||||
}ST_WRITE_STR_VALUE;
|
||||
|
||||
//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
||||
typedef struct WRITE_MULTIVARIABLE_REQ
|
||||
|
||||
{
|
||||
unsigned char variable_count; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char reserve1[3]; //Ԥ<><D4A4>
|
||||
ST_WRITE_STR_VALUE *pWriteStrValue; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>variable_countȷ<74><C8B7>
|
||||
}ST_WRITE_MULTIVARIABLE_REQ;
|
||||
//---------------------------------------------------д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵָ<D6B5><D6B8> END---------------------------------------------//
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------(0x14) <20>ֶ<EFBFBD><D6B6><EFBFBD>λָ<CEBB><D6B8> BEGIN-------------------------------//
|
||||
typedef struct MANUAL_LOCATION
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double angular;
|
||||
|
||||
}ST_MANUAL_LOCATION;
|
||||
|
||||
//---------------------------------------------------<2D>ֶ<EFBFBD><D6B6><EFBFBD>λָ<CEBB><D6B8> END---------------------------------------------//
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------(0x17) <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ BEGIN-------------------------------//
|
||||
typedef struct AGV_RUN_STATUS
|
||||
{
|
||||
double temperature; //<2F>¶<EFBFBD>
|
||||
double x; //x<><78><EFBFBD><EFBFBD>
|
||||
double y; //y<><79><EFBFBD><EFBFBD>
|
||||
double angular; //<2F>Ƕ<EFBFBD>
|
||||
double power; //<2F><><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>
|
||||
unsigned char is_block; //<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>赲 0δ<30>赲<EFBFBD><E8B5B2>1<EFBFBD><31><EFBFBD>赲
|
||||
unsigned char is_charge; //<2F>Ƿ<EFBFBD><C7B7>ڳ<EFBFBD><DAB3><EFBFBD> 0δ<30><CEB4><EFBFBD>磬1<E7A3AC>ڳ<EFBFBD><DAB3><EFBFBD>
|
||||
unsigned char mode; //<2F><><EFBFBD><EFBFBD>ģʽ 0<>ֶ<EFBFBD><D6B6><EFBFBD>1<EFBFBD>Զ<EFBFBD>
|
||||
unsigned char map_statue; //<2F><>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>״̬ 0<><30><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>2δ<32><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>3<EFBFBD><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ
|
||||
unsigned int point_id; //<2F><>ǰ<EFBFBD><C7B0>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>ID
|
||||
double travel_speed; //ǰ<><C7B0><EFBFBD>ٶ<EFBFBD>
|
||||
double turning_speed; //ת<><D7AA><EFBFBD>ٶ<EFBFBD>
|
||||
double voltage; //<2F><>ѹ,<2C><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
double current; //<2F><><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
unsigned char task_status; //<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>״̬ (0<><EFBFBD><DEB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㣬3<E3A3AC><33>ͣ<EFBFBD><CDA3>4<EFBFBD><34><EFBFBD>ɣ<EFBFBD>5ʧ<35>ܣ<EFBFBD>6<EFBFBD>˳<EFBFBD><CBB3><EFBFBD>7<EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
unsigned char location_type; //<2F><>ǰ<EFBFBD><C7B0>λ<EFBFBD><CEBB>ʽ(1<><31>ά<EFBFBD>붨λ<EBB6A8><CEBB>2<EFBFBD>Ŷ<EFBFBD>λ<EFBFBD><CEBB>3<EFBFBD><33><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DEB7><EFBFBD>λ<EFBFBD><CEBB>4 <20><><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><D0B7><EFBFBD>λ<EFBFBD><CEBB>5<EFBFBD>߷<EFBFBD><DFB7>붨λ<EBB6A8><CEBB>6 gps<70><73>λ)
|
||||
unsigned short map_version; //<2F><>ͼ<EFBFBD>汾<EFBFBD><E6B1BE>
|
||||
unsigned char reserve1[4]; //<2F><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
|
||||
double total_mileage; //<2F>ۼ<EFBFBD><DBBC><EFBFBD>ʻ<EFBFBD><CABB><EFBFBD><EFBFBD> <20><>λm
|
||||
double this_runtime; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
double total_runtime; //<2F>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
unsigned char location_status; //<2F><>λ״̬ 0ʧ<30>ܣ<EFBFBD>1<EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>2<EFBFBD><32>λ<EFBFBD>У<EFBFBD>3<EFBFBD><33>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
unsigned char is_traffic_control; //<2F><>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD> 0δ<30><CEB4>ͨ<EFBFBD><CDA8><EFBFBD>ƣ<EFBFBD>1<EFBFBD><31>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>
|
||||
unsigned char reserve2[2]; //<2F><><EFBFBD><EFBFBD>
|
||||
unsigned int map_count; //<2F><>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>
|
||||
unsigned char map_name[64]; //<2F><>ǰ<EFBFBD><C7B0>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>
|
||||
float confidence; //<2F><><EFBFBD>Ŷ<EFBFBD>
|
||||
|
||||
}ST_AGV_RUN_STATUS;
|
||||
|
||||
//---------------------------------------------------<2D><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ END---------------------------------------------//
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------(0xAE) <20>·<EFBFBD>ָ<EFBFBD><D6B8> BEGIN------------------------------------------//
|
||||
|
||||
typedef struct ACTION
|
||||
{
|
||||
unsigned short action_type; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char action_run_type; //ִ<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD>ʽ
|
||||
unsigned char reserve1; //Ԥ<><D4A4>
|
||||
unsigned int action_id; //<2F><><EFBFBD><EFBFBD>ID
|
||||
unsigned char param_size; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char reserve2[3]; //Ԥ<><D4A4>
|
||||
unsigned char *pParamContent; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}ST_ACTION;
|
||||
|
||||
|
||||
typedef struct POINT_INFO
|
||||
{
|
||||
unsigned int point_id; //<2F><>ͼ·<CDBC><C2B7><EFBFBD><EFBFBD> ID
|
||||
unsigned char reserve[4]; //Ԥ<><D4A4>
|
||||
}ST_POINT_INFO;
|
||||
|
||||
typedef struct TPOINT
|
||||
{
|
||||
float x; //x<><78><EFBFBD><EFBFBD>
|
||||
float y; //y<><79><EFBFBD><EFBFBD>
|
||||
}ST_TPOINT;
|
||||
|
||||
typedef union DYNMIC_POINT
|
||||
{
|
||||
POINT_INFO point_info; //<2F><>ͼ·<CDBC><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
TPOINT tpoint; //<2F><>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
}ST_DYNMIC_POINT;
|
||||
|
||||
|
||||
|
||||
typedef struct GUIDE_0_POINT //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽΪ0ʱ<30><CAB1><EFBFBD>ṹ
|
||||
{
|
||||
unsigned int serial_number; //<2F><><EFBFBD>к<EFBFBD>
|
||||
unsigned int point_id; //<2F><>id
|
||||
float angle; //ָ<><D6B8><EFBFBD>Ƕ<EFBFBD>ʱ·<CAB1><C2B7><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ͷ<EFBFBD>Ƕ<EFBFBD>
|
||||
unsigned char is_assign_angle; //<2F>Ƿ<EFBFBD>ָ<EFBFBD><D6B8>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD>,1 ָ<><D6B8> 0 <20><>ָ<EFBFBD><D6B8>
|
||||
unsigned char action_size; //<2F><><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char reserve[6]; //Ԥ<><D4A4>
|
||||
ST_ACTION *pAction; //<2F><><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
}ST_GUIDE_0_POINT;
|
||||
|
||||
typedef struct GUIDE_1_POINT //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽΪ1ʱ<31><CAB1><EFBFBD>ṹ
|
||||
{
|
||||
unsigned int serial_number; //<2F><><EFBFBD>к<EFBFBD>
|
||||
float angle; //ָ<><D6B8><EFBFBD>Ƕ<EFBFBD>ʱ·<CAB1><C2B7><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ͷ<EFBFBD>Ƕ<EFBFBD>
|
||||
unsigned char is_assign_angle; //<2F>Ƿ<EFBFBD>ָ<EFBFBD><D6B8>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD>,1 ָ<><D6B8> 0 <20><>ָ<EFBFBD><D6B8>
|
||||
unsigned char action_size; //<2F><><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char dynmic_point_type; //0:<3A><>ͼ·<CDBC><C2B7><EFBFBD><EFBFBD>ID<49><44>1<EFBFBD><31>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char reserve; //Ԥ<><D4A4>
|
||||
ST_DYNMIC_POINT dymic_point; //<2F><>̬<EFBFBD><CCAC><EFBFBD>ݽṹ
|
||||
ST_ACTION *pAction; //<2F><><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
}ST_GUIDE_1_POINT;
|
||||
|
||||
|
||||
typedef union GUIDE_POINT
|
||||
{
|
||||
ST_GUIDE_0_POINT point_guide_0; //<2F><>ͼ·<CDBC><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
ST_GUIDE_1_POINT point_guide_1; //<2F><>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
}ST_GUIDE_POINT;
|
||||
|
||||
|
||||
typedef struct PATH
|
||||
{
|
||||
unsigned int serial_number; //<2F><><EFBFBD>к<EFBFBD>
|
||||
unsigned int segment_id; //<2F><>ID
|
||||
float fixed_angle; //<2F>̶<EFBFBD><CCB6><EFBFBD>
|
||||
unsigned char is_fixed_angle; //<2F>Ƿ<EFBFBD><C7B7>̶<EFBFBD><CCB6>Ƕ<EFBFBD>
|
||||
unsigned char driver_pose; //<2F><>ʻ<EFBFBD><CABB>̬
|
||||
unsigned char action_size; //<2F><><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char reserve1; //Ԥ<><D4A4>
|
||||
float max_speed; //<2F><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
|
||||
float max_angular_speed; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
|
||||
unsigned char reserve2[4]; //Ԥ<><D4A4>
|
||||
ST_ACTION *pAction; //<2F><><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9>
|
||||
}ST_PATH;
|
||||
|
||||
|
||||
|
||||
typedef struct PATH_JOINT
|
||||
{
|
||||
unsigned int order_id; //<2F><><EFBFBD><EFBFBD>ID
|
||||
unsigned int task_key; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
|
||||
unsigned char point_size; //<2F><><EFBFBD><EFBFBD>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>нṹ<D0BD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char path_size; //<2F><><EFBFBD><EFBFBD>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>нṹ<D0BD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char guide_type; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ0<CABD><30>·<EFBFBD><C2B7>ƴ<EFBFBD><C6B4> 1<><31><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD> 2<><32>Ŀ<EFBFBD><C4BF><EFBFBD>㵼<EFBFBD><E3B5BC>
|
||||
unsigned char reserve; //Ԥ<><D4A4>
|
||||
GUIDE_0_POINT *pstPoint;
|
||||
ST_PATH *pstPath;
|
||||
}ST_PATH_JOINT;
|
||||
|
||||
|
||||
//------------------------------------------------------(0xAE) <20>·<EFBFBD>ָ<EFBFBD><D6B8> END------------------------------------------//
|
||||
|
||||
|
||||
|
||||
/*
|
||||
//------------------------------------------------------(0x02) <20>·<EFBFBD>ָ<EFBFBD><D6B8> BEGIN------------------------------------------//
|
||||
|
||||
typedef struct READ_VALUE_MEMBER
|
||||
{
|
||||
uint16_t var_offset;
|
||||
uint16_t var_length;
|
||||
|
||||
}ST_READ_VALUE_MEMBER;
|
||||
|
||||
typedef struct READ_STR_VALUE
|
||||
{
|
||||
uint8_t var_name[16]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint32_t var_member_number; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>
|
||||
ST_READ_VALUE_MEMBER *pReadMember; //<2F><>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>
|
||||
|
||||
}ST_READ_STR_VALUE;
|
||||
|
||||
|
||||
|
||||
typedef struct READ_MUTI_VARIABLE_REQ
|
||||
{
|
||||
uint8_t var_number; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint8_t reserve[3]; //Ԥ<><D4A4>
|
||||
uint32_t var_servial; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>
|
||||
ST_READ_STR_VALUE *pReadValue;
|
||||
}ST_READ_MUTI_VARIABLE_REQ;
|
||||
|
||||
|
||||
typedef struct READ_MUTI_VARIABLE_RES
|
||||
{
|
||||
uint32_t var_servial; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>
|
||||
uint16_t data_length; //Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
uint32_t reserve[2]; //Ԥ<><D4A4>
|
||||
uint8_t *pData;
|
||||
}ST_READ_MUTI_VARIABLE_RES;
|
||||
|
||||
//------------------------------------------------------(0x02) <20>·<EFBFBD>ָ<EFBFBD><D6B8> END------------------------------------------//
|
||||
*/
|
||||
67
Plugin/KcCtrl/ReadMe.txt
Normal file
67
Plugin/KcCtrl/ReadMe.txt
Normal file
@@ -0,0 +1,67 @@
|
||||
================================================================================
|
||||
MICROSOFT 基础类库 : Vcs-Client 项目概述
|
||||
===============================================================================
|
||||
|
||||
应用程序向导已为您创建了此 Vcs-Client 应用程序。此应用程序不仅演示 Microsoft 基础类的基本使用方法,还可作为您编写应用程序的起点。
|
||||
|
||||
本文件概要介绍组成 Vcs-Client 应用程序的每个文件的内容。
|
||||
|
||||
Vcs-Client.vcxproj
|
||||
这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
|
||||
|
||||
Vcs-Client.vcxproj.filters
|
||||
这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
|
||||
|
||||
Vcs-Client.h
|
||||
这是应用程序的主头文件。
|
||||
其中包括其他项目特定的标头(包括 Resource.h),并声明 CVcsClientApp 应用程序类。
|
||||
|
||||
Vcs-Client.cpp
|
||||
这是包含应用程序类 CVcsClientApp 的主应用程序源文件。
|
||||
|
||||
Vcs-Client.rc
|
||||
这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。项目资源包含在 2052 中。
|
||||
|
||||
res\Vcs-Client.ico
|
||||
这是用作应用程序图标的图标文件。此图标包括在主资源文件 Vcs-Client.rc 中。
|
||||
|
||||
res\VcsClient.rc2
|
||||
此文件包含不在 Microsoft Visual C++ 中进行编辑的资源。您应该将不可由资源编辑器编辑的所有资源放在此文件中。
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
应用程序向导创建一个对话框类:
|
||||
|
||||
Vcs-ClientDlg.h、Vcs-ClientDlg.cpp - 对话框
|
||||
这些文件包含 CVcsClientDlg 类。此类定义应用程序的主对话框的行为。对话框模板包含在 Vcs-Client.rc 中,该文件可以在 Microsoft Visual C++ 中编辑。
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
其他功能:
|
||||
|
||||
ActiveX 控件
|
||||
该应用程序包含对使用 ActiveX 控件的支持。
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
其他标准文件:
|
||||
|
||||
StdAfx.h, StdAfx.cpp
|
||||
这些文件用于生成名为 Vcs-Client.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
|
||||
|
||||
Resource.h
|
||||
这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。
|
||||
|
||||
Vcs-Client.manifest
|
||||
Windows XP 使用应用程序清单文件来描述特定版本的并行程序集的应用程序依赖项。加载程序使用这些信息来从程序集缓存中加载相应的程序集,并保护其不被应用程序访问。应用程序清单可能会包含在内,以作为与应用程序可执行文件安装在同一文件夹中的外部 .manifest 文件进行重新分发,它还可能以资源的形式包含在可执行文件中。
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
其他注释:
|
||||
|
||||
应用程序向导使用“TODO:”来指示应添加或自定义的源代码部分。
|
||||
|
||||
如果应用程序使用共享 DLL 中的 MFC,您将需要重新分发 MFC DLL。如果应用程序所使用的语言与操作系统的区域设置不同,则还需要重新分发相应的本地化资源 mfc110XXX.DLL。
|
||||
有关上述话题的更多信息,请参见 MSDN 文档中有关重新分发 Visual C++ 应用程序的部分。
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
197
Plugin/KcCtrl/UdpSocket.cpp
Normal file
197
Plugin/KcCtrl/UdpSocket.cpp
Normal file
@@ -0,0 +1,197 @@
|
||||
#include "UdpSocket.h"
|
||||
|
||||
void UDPServer::cleanup() {
|
||||
#ifdef _WIN32
|
||||
if (serverSocket != INVALID_SOCKET) {
|
||||
closesocket(serverSocket);
|
||||
WSACleanup();
|
||||
}
|
||||
#else
|
||||
if (serverSocket != INVALID_SOCKET) {
|
||||
close(serverSocket);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
UDPServer::UDPServer() : serverSocket(INVALID_SOCKET), initialized(false) {
|
||||
#ifdef _WIN32
|
||||
WSADATA wsaData;
|
||||
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
|
||||
std::cerr << "WSAStartup failed\n";
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
UDPServer::~UDPServer() {
|
||||
cleanup();
|
||||
}
|
||||
|
||||
bool UDPServer::Start(int port) {
|
||||
if (!initialized) return false;
|
||||
|
||||
serverSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (serverSocket == INVALID_SOCKET) {
|
||||
std::cerr << "Create socket failed\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
serverAddr.sin_family = AF_INET;
|
||||
serverAddr.sin_port = htons(port);
|
||||
serverAddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
|
||||
if (bind(serverSocket, (sockaddr*)&serverAddr, sizeof(serverAddr)) == SOCKET_ERROR) {
|
||||
std::cerr << "Bind failed\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// <20>ĺ<DEB8><C4BA>Ľ<EFBFBD><C4BD>շ<EFBFBD><D5B7><EFBFBD><EFBFBD><EFBFBD>UDPServer<65>ࣩ
|
||||
int UDPServer::Receive(char* buffer, int bufferSize, std::string& clientIP, int& clientPort) {
|
||||
sockaddr_in clientAddr;
|
||||
socklen_t clientAddrLen = sizeof(clientAddr);
|
||||
|
||||
int recvSize = recvfrom(serverSocket, buffer, bufferSize, 0,
|
||||
(sockaddr*)&clientAddr, &clientAddrLen);
|
||||
if (recvSize == SOCKET_ERROR) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ʹ<>ÿ<EFBFBD>ƽ̨<C6BD>ĵ<EFBFBD>ַת<D6B7><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
char ipBuffer[INET_ADDRSTRLEN] = { 0 };
|
||||
#ifdef _WIN32
|
||||
InetNtopA(AF_INET, &clientAddr.sin_addr, ipBuffer, INET_ADDRSTRLEN);
|
||||
#else
|
||||
inet_ntop(AF_INET, &clientAddr.sin_addr, ipBuffer, INET_ADDRSTRLEN);
|
||||
#endif
|
||||
|
||||
clientIP = ipBuffer;
|
||||
clientPort = ntohs(clientAddr.sin_port);
|
||||
return recvSize;
|
||||
}
|
||||
|
||||
bool UDPServer::Send(const char* buffer, int bufferSize, const std::string& clientIP, int clientPort) {
|
||||
sockaddr_in clientAddr;
|
||||
clientAddr.sin_family = AF_INET;
|
||||
clientAddr.sin_port = htons(clientPort);
|
||||
inet_pton(AF_INET, clientIP.c_str(), &clientAddr.sin_addr);
|
||||
|
||||
int sentSize = sendto(serverSocket, buffer, bufferSize, 0,
|
||||
(sockaddr*)&clientAddr, sizeof(clientAddr));
|
||||
return sentSize == bufferSize;
|
||||
}
|
||||
|
||||
void UDPServer::Close() {
|
||||
cleanup();
|
||||
serverSocket = INVALID_SOCKET;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// UDPClient
|
||||
/// </summary>
|
||||
void UDPClient::cleanup() {
|
||||
#ifdef _WIN32
|
||||
if (clientSocket != INVALID_SOCKET) {
|
||||
closesocket(clientSocket);
|
||||
WSACleanup();
|
||||
}
|
||||
#else
|
||||
if (clientSocket != INVALID_SOCKET) {
|
||||
close(clientSocket);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
UDPClient::UDPClient() : clientSocket(INVALID_SOCKET), initialized(false) {
|
||||
#ifdef _WIN32
|
||||
WSADATA wsaData;
|
||||
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
|
||||
std::cerr << "WSAStartup failed\n";
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
UDPClient::~UDPClient() {
|
||||
cleanup();
|
||||
}
|
||||
|
||||
bool UDPClient::Connect(const std::string& serverIP, int serverPort) {
|
||||
if (!initialized) return false;
|
||||
|
||||
clientSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (clientSocket == INVALID_SOCKET) {
|
||||
std::cerr << "Create socket failed\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
serverAddr.sin_family = AF_INET;
|
||||
serverAddr.sin_port = htons(serverPort);
|
||||
inet_pton(AF_INET, serverIP.c_str(), &serverAddr.sin_addr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UDPClient::Send(const char* buffer, int bufferSize) {
|
||||
int sentSize = sendto(clientSocket, buffer, bufferSize, 0,
|
||||
(sockaddr*)&serverAddr, sizeof(serverAddr));
|
||||
return sentSize == bufferSize;
|
||||
}
|
||||
|
||||
//lTimeoutMs <20><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
int UDPClient::Receive(char* buffer, int bufferSize, int lTimeoutMs)
|
||||
{
|
||||
sockaddr_in fromAddr;
|
||||
socklen_t fromLen = sizeof(fromAddr);
|
||||
|
||||
#ifdef _WIN32
|
||||
int timeout = lTimeoutMs; // ת<><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
|
||||
setsockopt(clientSocket, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeout, sizeof(timeout));
|
||||
#else
|
||||
struct timeval tv;
|
||||
tv.tv_sec = lTimeoutMs / 1000;
|
||||
tv.tv_usec = (lTimeoutMs % 1000) * 1000;
|
||||
setsockopt(clientSocket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
|
||||
#endif
|
||||
|
||||
int recvSize = recvfrom(clientSocket, buffer, bufferSize, 0,
|
||||
(sockaddr*)&fromAddr, &fromLen);
|
||||
return recvSize;
|
||||
}
|
||||
|
||||
// sbuffer <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// sbufferSize <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
// rbuffer <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
// rbufferSize <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
// lRto <20>ش<EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
// lRtoCnt <20>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD>ֵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>,С<>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC>ش<EFBFBD><D8B4><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD>
|
||||
int UDPClient::SendAndRecv(const char* sbuffer, int sbufferSize, char* rbuffer, int rbufferSize, int lRto, int lRtoCnt)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (!Send(sbuffer, sbufferSize))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int lRecvLen = Receive(rbuffer, rbufferSize, lRto);
|
||||
if (lRecvLen > 0)
|
||||
{
|
||||
return lRecvLen;
|
||||
}
|
||||
|
||||
} while (lRtoCnt-- > 0);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void UDPClient::Close() {
|
||||
cleanup();
|
||||
clientSocket = INVALID_SOCKET;
|
||||
}
|
||||
74
Plugin/KcCtrl/UdpSocket.h
Normal file
74
Plugin/KcCtrl/UdpSocket.h
Normal file
@@ -0,0 +1,74 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#pragma comment(lib, "Ws2_32.lib")
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#include <netinet/in.h>
|
||||
#define SOCKET int
|
||||
#define INVALID_SOCKET (SOCKET)(~0)
|
||||
#define SOCKET_ERROR (-1)
|
||||
#endif
|
||||
|
||||
class UDPServer {
|
||||
private:
|
||||
SOCKET serverSocket;
|
||||
sockaddr_in serverAddr;
|
||||
bool initialized;
|
||||
|
||||
void cleanup();
|
||||
|
||||
public:
|
||||
UDPServer();
|
||||
|
||||
~UDPServer();
|
||||
|
||||
bool Start(int port);
|
||||
|
||||
// <20>ĺ<DEB8><C4BA>Ľ<EFBFBD><C4BD>շ<EFBFBD><D5B7><EFBFBD><EFBFBD><EFBFBD>UDPServer<65>ࣩ
|
||||
int Receive(char* buffer, int bufferSize, std::string& clientIP, int& clientPort);
|
||||
|
||||
bool Send(const char* buffer, int bufferSize, const std::string& clientIP, int clientPort);
|
||||
|
||||
void Close();
|
||||
};
|
||||
|
||||
class UDPClient {
|
||||
private:
|
||||
SOCKET clientSocket;
|
||||
sockaddr_in serverAddr;
|
||||
bool initialized;
|
||||
|
||||
void cleanup();
|
||||
|
||||
public:
|
||||
UDPClient();
|
||||
|
||||
~UDPClient();
|
||||
|
||||
bool Connect(const std::string& serverIP, int serverPort);
|
||||
|
||||
bool Send(const char* buffer, int bufferSize);
|
||||
|
||||
//lTimeoutMs <20><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>
|
||||
int Receive(char* buffer, int bufferSize, int lTimeoutMs);
|
||||
|
||||
// sbuffer <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// sbufferSize <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
// rbuffer <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD><EFBFBD><EFBFBD>
|
||||
// rbufferSize <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
// lRto <20>ش<EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
// lRtoCnt <20>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD>ֵ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>,С<>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC>ش<EFBFBD><D8B4><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD>
|
||||
int SendAndRecv(const char* sbuffer, int sbufferSize, char* rbuffer, int rbufferSize, int lRto, int lRtoCnt);
|
||||
|
||||
void Close();
|
||||
};
|
||||
BIN
Plugin/KcCtrl/res/KcCtrl.ico
Normal file
BIN
Plugin/KcCtrl/res/KcCtrl.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
Plugin/KcCtrl/res/KcCtrl.rc2
Normal file
BIN
Plugin/KcCtrl/res/KcCtrl.rc2
Normal file
Binary file not shown.
BIN
Plugin/KcCtrl/resource.h
Normal file
BIN
Plugin/KcCtrl/resource.h
Normal file
Binary file not shown.
188
Plugin/KcCtrl/stdafx.cpp
Normal file
188
Plugin/KcCtrl/stdafx.cpp
Normal file
@@ -0,0 +1,188 @@
|
||||
|
||||
// stdafx.cpp : ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Դ<EFBFBD>ļ<EFBFBD>
|
||||
// Vcs-Client.pch <20><><EFBFBD><EFBFBD>ΪԤ<CEAA><D4A4><EFBFBD><EFBFBD>ͷ
|
||||
// stdafx.obj <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
|
||||
#define MIN_XYZ_VALUE (-999999)
|
||||
float* g_xys = new float[3000 * 3000 * 2];
|
||||
int g_xyz_flag = 0;
|
||||
|
||||
|
||||
#define Q_R 1500
|
||||
#define X0 1500
|
||||
#define Y0 1500
|
||||
|
||||
inline float abs_m(float lf)
|
||||
{
|
||||
if (lf < 0) lf *= -1;
|
||||
return lf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
CString g_strSavePath = "";
|
||||
CString g_strCurTime = "";
|
||||
|
||||
void LogOutToFile(const char* fmt, ...)
|
||||
{
|
||||
static CRITICAL_SECTION stCritical;
|
||||
static BOOL bInit = FALSE;
|
||||
static CString strLogPath;
|
||||
if (FALSE == bInit)
|
||||
{
|
||||
bInit = TRUE;
|
||||
GetModuleFileName(NULL, strLogPath.GetBuffer(2048), 2047);
|
||||
strLogPath.ReleaseBuffer();
|
||||
strLogPath = strLogPath.Left(strLogPath.ReverseFind('\\'));
|
||||
strLogPath += "\\log\\runtime.log";
|
||||
|
||||
InitializeCriticalSection(&stCritical);
|
||||
}
|
||||
|
||||
EnterCriticalSection(&stCritical);
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
char pBuffer[800] = "";
|
||||
if (vsnprintf_s(pBuffer, 796, _TRUNCATE, fmt, ap) > 0)
|
||||
{
|
||||
|
||||
if (strlen(pBuffer) == 0 || pBuffer[strlen(pBuffer) - 1] != '\n')
|
||||
{
|
||||
pBuffer[strlen(pBuffer) + 1] = '\0';//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7B7>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊԭ<CEAA><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>з<EFBFBD>
|
||||
pBuffer[strlen(pBuffer)] = '\n';
|
||||
}
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
TRACE("%s\n", pBuffer);
|
||||
|
||||
FILE* pFile = NULL;
|
||||
fopen_s(&pFile, strLogPath.GetBuffer(), "ab+");
|
||||
if (NULL != pFile)
|
||||
{
|
||||
char acTime[32] = { 0 };
|
||||
SYSTEMTIME stTime;
|
||||
GetLocalTime(&stTime);
|
||||
sprintf_s(acTime, 32, "[%02d-%02d %02d:%02d:%02d.%03d] ", stTime.wMonth, stTime.wDay, stTime.wHour, stTime.wMinute, stTime.wSecond, stTime.wMilliseconds);
|
||||
|
||||
fwrite(acTime, 1, strlen(acTime), pFile);
|
||||
fwrite(pBuffer, 1, strlen(pBuffer), pFile);
|
||||
fwrite("\r\n", 1, strlen("\r\n"), pFile);
|
||||
fclose(pFile);
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&stCritical);
|
||||
}
|
||||
|
||||
int g_nMsgIdx = 998;
|
||||
|
||||
string _UnicodeToUtf8(CString Unicodestr)
|
||||
{
|
||||
wchar_t* unicode = Unicodestr.AllocSysString();
|
||||
int len;
|
||||
len = WideCharToMultiByte(CP_UTF8, 0, unicode, -1, NULL, 0, NULL, NULL);
|
||||
char *szUtf8 = (char*)malloc(len + 1);
|
||||
memset(szUtf8, 0, len + 1);
|
||||
WideCharToMultiByte(CP_UTF8, 0, unicode, -1, szUtf8, len, NULL, NULL);
|
||||
string result = szUtf8;
|
||||
free(szUtf8);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// UTF8<46><38><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>(MultiByte)<29><>ת
|
||||
CString UTF8AndMB_Convert(const CString &strSource, UINT nSourceCodePage, UINT nTargetCodePage)
|
||||
{
|
||||
int nSourceLen = strSource.GetLength();
|
||||
int nWideBufLen = MultiByteToWideChar(nSourceCodePage, 0, strSource, -1, NULL, 0);
|
||||
|
||||
wchar_t* pWideBuf = new wchar_t[nWideBufLen + 1];
|
||||
memset(pWideBuf, 0, (nWideBufLen + 1) * sizeof(wchar_t));
|
||||
|
||||
MultiByteToWideChar(nSourceCodePage, 0, strSource, -1, (LPWSTR)pWideBuf, nWideBufLen);
|
||||
|
||||
char* pMultiBuf = NULL;
|
||||
int nMiltiBufLen = WideCharToMultiByte(nTargetCodePage, 0, (LPWSTR)pWideBuf, -1, (char *)pMultiBuf, 0, NULL, NULL);
|
||||
|
||||
pMultiBuf = new char[nMiltiBufLen + 1];
|
||||
memset(pMultiBuf, 0, nMiltiBufLen + 1);
|
||||
|
||||
WideCharToMultiByte(nTargetCodePage, 0, (LPWSTR)pWideBuf, -1, (char *)pMultiBuf, nMiltiBufLen, NULL, NULL);
|
||||
|
||||
CStringA strTarget(pMultiBuf);
|
||||
|
||||
delete[] pWideBuf;
|
||||
delete[] pMultiBuf;
|
||||
|
||||
return strTarget;
|
||||
}
|
||||
|
||||
CStringA UTF8ToMB(const CStringA& utf8Str)
|
||||
{
|
||||
if (IsTextUTF8(utf8Str, utf8Str.GetLength()))
|
||||
{
|
||||
return UTF8AndMB_Convert(utf8Str, CP_UTF8, CP_ACP);
|
||||
}
|
||||
return utf8Str;
|
||||
}
|
||||
|
||||
|
||||
bool IsTextUTF8(const char* str, ULONGLONG length)
|
||||
{
|
||||
DWORD nBytes = 0;//UFT8<54><38><EFBFBD><EFBFBD>1-6<><36><EFBFBD>ֽڱ<D6BD><DAB1><EFBFBD>,ASCII<49><49>һ<EFBFBD><D2BB><EFBFBD>ֽ<EFBFBD>
|
||||
UCHAR chr;
|
||||
bool bAllAscii = true; //<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ASCII, ˵<><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>UTF-8
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
chr = *(str + i);
|
||||
if ((chr & 0x80) != 0) // <20>ж<EFBFBD><D0B6>Ƿ<EFBFBD>ASCII<49><49><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,˵<><CBB5><EFBFBD>п<EFBFBD><D0BF><EFBFBD><EFBFBD><EFBFBD>UTF-8,ASCII<49><49>7λ<37><CEBB><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ֽڴ<D6BD>,<2C><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ0,o0xxxxxxx
|
||||
bAllAscii = false;
|
||||
if (nBytes == 0) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ASCII<49><49>,Ӧ<><D3A6><EFBFBD>Ƕ<EFBFBD><C7B6>ֽڷ<D6BD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>
|
||||
{
|
||||
if (chr >= 0x80)
|
||||
{
|
||||
if (chr >= 0xFC && chr <= 0xFD)
|
||||
nBytes = 6;
|
||||
else if (chr >= 0xF8)
|
||||
nBytes = 5;
|
||||
else if (chr >= 0xF0)
|
||||
nBytes = 4;
|
||||
else if (chr >= 0xE0)
|
||||
nBytes = 3;
|
||||
else if (chr >= 0xC0)
|
||||
nBytes = 2;
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
nBytes--;
|
||||
}
|
||||
}
|
||||
else //<2F><><EFBFBD>ֽڷ<D6BD><DAB7>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD>ֽ<EFBFBD>,ӦΪ 10xxxxxx
|
||||
{
|
||||
if ((chr & 0xC0) != 0x80)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
nBytes--;
|
||||
}
|
||||
}
|
||||
|
||||
if (nBytes > 0) //Υ<><CEA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bAllAscii) //<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ASCII, ˵<><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>UTF-8
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
175
Plugin/KcCtrl/stdafx.h
Normal file
175
Plugin/KcCtrl/stdafx.h
Normal file
@@ -0,0 +1,175 @@
|
||||
|
||||
// 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
|
||||
{
|
||||
SLAM_TYPE = 1,
|
||||
QRCODE_TYPE = 2
|
||||
}GUIDE_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;
|
||||
8
Plugin/KcCtrl/targetver.h
Normal file
8
Plugin/KcCtrl/targetver.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> SDKDDKVer.h <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>߰汾<DFB0><E6B1BE> Windows ƽ̨<C6BD><CCA8>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ҪΪ<D2AA><CEAA>ǰ<EFBFBD><C7B0> Windows ƽ̨<C6BD><CCA8><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WinSDKVer.h<><68><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><> _WIN32_WINNT <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪҪ֧<D2AA>ֵ<EFBFBD>ƽ̨<C6BD><CCA8>Ȼ<EFBFBD><C8BB><EFBFBD>ٰ<EFBFBD><D9B0><EFBFBD> SDKDDKVer.h<><68>
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
Reference in New Issue
Block a user