添加项目文件。
This commit is contained in:
87
Plugin/QrGuide/ConfigDLg.cpp
Normal file
87
Plugin/QrGuide/ConfigDLg.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
// ConfigDLg.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "QrGuide.h"
|
||||
#include "ConfigDLg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
|
||||
// CConfigDLg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
IMPLEMENT_DYNAMIC(CConfigDLg, CDialogEx)
|
||||
|
||||
CConfigDLg::CConfigDLg(CWnd* pParent /*=NULL*/)
|
||||
: CDialogEx(IDD_CFG_DLG, pParent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CConfigDLg::~CConfigDLg()
|
||||
{
|
||||
}
|
||||
|
||||
void CConfigDLg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_IPADDRESS1, m_IpAddress);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CConfigDLg, CDialogEx)
|
||||
ON_BN_CLICKED(IDC_BTN_SETTING, &CConfigDLg::OnBnClickedBtnSetting)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CConfigDLg <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
BOOL CConfigDLg::OnInitDialog()
|
||||
{
|
||||
CDialogEx::OnInitDialog();
|
||||
|
||||
CString strPort;
|
||||
strPort.Format("%d", theApp.m_nCameraPort);
|
||||
GetDlgItem(IDC_EDIT_PORT)->SetWindowText(strPort);
|
||||
|
||||
|
||||
CString strIp = theApp.m_strCameraIp;
|
||||
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]);
|
||||
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// <20>쳣: OCX <20><><EFBFBD><EFBFBD>ҳӦ<D2B3><D3A6><EFBFBD><EFBFBD> FALSE
|
||||
}
|
||||
|
||||
|
||||
void CConfigDLg::OnBnClickedBtnSetting()
|
||||
{
|
||||
unsigned char* ip{};
|
||||
DWORD dword;
|
||||
m_IpAddress.GetAddress(dword);
|
||||
ip = (unsigned char*)&dword;
|
||||
theApp.m_strCameraIp.Format("%u.%u.%u.%u", *(ip + 3), *(ip + 2), *(ip + 1), *ip);
|
||||
|
||||
CString strPort;
|
||||
GetDlgItem(IDC_EDIT_PORT)->GetWindowText(strPort);
|
||||
|
||||
|
||||
CString iniPath = theApp.m_strModulePath + "\\config.ini";
|
||||
WritePrivateProfileString("CAMERA", "IP", theApp.m_strCameraIp, iniPath);
|
||||
WritePrivateProfileString("CAMERA", "PORT", strPort, iniPath);
|
||||
|
||||
theApp.m_nCameraPort = atoi(strPort);
|
||||
AfxMessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
OnOK();
|
||||
}
|
||||
27
Plugin/QrGuide/ConfigDLg.h
Normal file
27
Plugin/QrGuide/ConfigDLg.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
// CConfigDLg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
class CConfigDLg : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CConfigDLg)
|
||||
|
||||
public:
|
||||
CConfigDLg(CWnd* pParent = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
virtual ~CConfigDLg();
|
||||
|
||||
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_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();
|
||||
};
|
||||
156
Plugin/QrGuide/QrGuide.cpp
Normal file
156
Plugin/QrGuide/QrGuide.cpp
Normal file
@@ -0,0 +1,156 @@
|
||||
|
||||
// Vcs-Client.cpp : <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "QrGuide.h"
|
||||
#include "QrMainDialog.h"
|
||||
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
CCEXPipeClientBase* g_pstPipeClient = CCEXPipeClientBase::CreateObj();
|
||||
// CVcsClientApp
|
||||
|
||||
BEGIN_MESSAGE_MAP(CQrGuideApp, CWinApp)
|
||||
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CVcsClientApp <20><><EFBFBD><EFBFBD>
|
||||
|
||||
CQrGuideApp::CQrGuideApp()
|
||||
{
|
||||
// ֧<><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Ψһ<CEA8><D2BB>һ<EFBFBD><D2BB> CVcsClientApp <20><><EFBFBD><EFBFBD>
|
||||
|
||||
CQrGuideApp theApp;
|
||||
|
||||
|
||||
BOOL CQrGuideApp::InitInstance()
|
||||
{
|
||||
|
||||
// <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>"));
|
||||
|
||||
char acPath[2048] = { 0 };
|
||||
GetModuleFileName(NULL, acPath, 2048);
|
||||
CString strConf(acPath);
|
||||
m_strModulePath = strConf.Left(strConf.ReverseFind('\\'));
|
||||
|
||||
GetCameraInfo();
|
||||
CQrMainDialog 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 CQrGuideApp::SendMsg2Platform(CString strReceiver, int nMsgType, Json::Value param)
|
||||
{
|
||||
LogOutToFile("FAST::SendMsg2Platform Begin");
|
||||
|
||||
Json::Value root;
|
||||
root["sender"] = "QR-GUIDE"; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,SwingArm
|
||||
root["receiver"] = strReceiver.GetBuffer();
|
||||
|
||||
/******************************************************
|
||||
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;
|
||||
|
||||
Json::FastWriter writer;
|
||||
string strJson = writer.write(root);
|
||||
|
||||
g_pstPipeClient->SendeMsg(WCS_2_WMS_DATA, (char*)strJson.c_str(), strJson.length());
|
||||
|
||||
LogOutToFile("FAST::SendMsg2Platform End");
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
void CQrGuideApp::GetCameraInfo()
|
||||
{
|
||||
char acIp[32] = "";
|
||||
|
||||
CString iniPath = theApp.m_strModulePath + "\\config.ini";
|
||||
|
||||
GetPrivateProfileString("CAMERA", "IP", "", acIp, 32, iniPath);
|
||||
m_strCameraIp = acIp;
|
||||
|
||||
m_nCameraPort = GetPrivateProfileInt("CAMERA", "PORT", 0, iniPath);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
46
Plugin/QrGuide/QrGuide.h
Normal file
46
Plugin/QrGuide/QrGuide.h
Normal file
@@ -0,0 +1,46 @@
|
||||
|
||||
// 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"
|
||||
|
||||
|
||||
// CVcsClientApp:
|
||||
// <20>йش<D0B9><D8B4><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Vcs-Client.cpp
|
||||
//
|
||||
|
||||
class CQrGuideApp : public CWinApp
|
||||
{
|
||||
public:
|
||||
CQrGuideApp();
|
||||
|
||||
public:
|
||||
CString m_strCfgFilePath;
|
||||
CString m_strDataPath;
|
||||
CString m_strModulePath;
|
||||
HWND m_hMainWnd;
|
||||
CString m_strCameraIp;
|
||||
int m_nCameraPort;
|
||||
|
||||
// <20><>д
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
void GetCameraInfo();
|
||||
CString SendMsg2Platform(CString strReceiver, int nMsgType, Json::Value param);
|
||||
|
||||
|
||||
// ʵ<><CAB5>
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
extern CQrGuideApp theApp;
|
||||
extern CCEXPipeClientBase* g_pstPipeClient;
|
||||
BIN
Plugin/QrGuide/QrGuide.rc
Normal file
BIN
Plugin/QrGuide/QrGuide.rc
Normal file
Binary file not shown.
224
Plugin/QrGuide/QrGuide.vcxproj
Normal file
224
Plugin/QrGuide/QrGuide.vcxproj
Normal file
@@ -0,0 +1,224 @@
|
||||
<?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="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>QrGuide</ProjectName>
|
||||
<ProjectGuid>{A98ADD5C-021A-494A-9E04-61E7F3220104}</ProjectGuid>
|
||||
<RootNamespace>GrabImage_Display</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>14.0.23107.0</_ProjectFileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(Configuration)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<EmbedManifest>true</EmbedManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<EmbedManifest>true</EmbedManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(Configuration)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<EmbedManifest>true</EmbedManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<EmbedManifest>true</EmbedManifest>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>MvCameraControl.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(MVCAM_COMMON_RUNENV)\Libraries\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\json\inc;$(SolutionDir)CCEXPipe;$(SolutionDir)3rdparty\opencv\inc;$(SolutionDir)3rdparty\yolo4\inc;$(SolutionDir)3rdparty\hikvision\rgbd_camera\inc;$(SolutionDir)3rdparty\dahua\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>opencv_calib3d454d.lib;opencv_core454d.lib;opencv_dnn454d.lib;opencv_features2d454d.lib;opencv_flann454d.lib;opencv_highgui454d.lib;opencv_imgcodecs454d.lib;opencv_imgproc454d.lib;opencv_ml454d.lib;opencv_video454d.lib;opencv_videoio454d.lib;opencv_face454d.lib;opencv_objdetect454d.lib;opencv_photo454d.lib;yolo_dll_cpud.lib;GdiPlus.lib;Mv3dRgbd.lib;opengl32.lib;glu32.lib;glfw3.lib;dhconfigsdk.lib;dhnetsdk.lib;dhplay.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\3rdparty\opencv\lib;$(SolutionDir)\3rdparty\yolo4\lib;$(SolutionDir)$(Platform)\$(Configuration)\;$(SolutionDir)\3rdparty\hikvision\rgbd_camera\lib\x64;$(SolutionDir)\3rdparty\dahua\lib\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>$(MVCAM_COMMON_RUNENV)\Includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>MvCameraControl.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(MVCAM_COMMON_RUNENV)\Libraries\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\json\inc;$(SolutionDir)CCEXPipe;$(SolutionDir)3rdparty\opencv\inc;$(SolutionDir)3rdparty\yolo4\inc;$(SolutionDir)3rdparty\hikvision\rgbd_camera\inc;$(SolutionDir)3rdparty\dahua\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>opencv_calib3d454.lib;opencv_core454.lib;opencv_dnn454.lib;opencv_features2d454.lib;opencv_flann454.lib;opencv_highgui454.lib;opencv_imgcodecs454.lib;opencv_imgproc454.lib;opencv_ml454.lib;opencv_video454.lib;opencv_videoio454.lib;opencv_face454.lib;opencv_objdetect454.lib;opencv_photo454.lib;yolo_dll_cpu.lib;GdiPlus.lib;Mv3dRgbd.lib;opengl32.lib;glu32.lib;glfw3.lib;dhconfigsdk.lib;dhnetsdk.lib;dhplay.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\3rdparty\yolo4\lib;$(SolutionDir)\3rdparty\opencv\lib;$(SolutionDir)$(Platform)\$(Configuration)\;$(SolutionDir)\3rdparty\hikvision\rgbd_camera\lib\x64;$(SolutionDir)\3rdparty\dahua\lib\win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<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="ConfigDLg.cpp" />
|
||||
<ClCompile Include="QrMainDialog.cpp" />
|
||||
<ClCompile Include="stdafx.cpp" />
|
||||
<ClCompile Include="QrGuide.cpp" />
|
||||
<ClCompile Include="TcpClient.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ConfigDLg.h" />
|
||||
<ClInclude Include="QrMainDialog.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="QrGuide.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="TcpClient.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="QrGuide.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\QrGuide.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties RESOURCE_FILE="QrGuide.rc" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
39
Plugin/QrGuide/QrGuide.vcxproj.filters
Normal file
39
Plugin/QrGuide/QrGuide.vcxproj.filters
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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="QrMainDialog.cpp" />
|
||||
<ClCompile Include="QrGuide.cpp" />
|
||||
<ClCompile Include="TcpClient.cpp" />
|
||||
<ClCompile Include="ConfigDLg.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="QrMainDialog.h" />
|
||||
<ClInclude Include="QrGuide.h" />
|
||||
<ClInclude Include="TcpClient.h" />
|
||||
<ClInclude Include="ConfigDLg.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="QrGuide.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="json">
|
||||
<UniqueIdentifier>{9b459857-43fd-4c3e-9f43-f0d28d5146bb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\QrGuide.ico" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
319
Plugin/QrGuide/QrMainDialog.cpp
Normal file
319
Plugin/QrGuide/QrMainDialog.cpp
Normal file
@@ -0,0 +1,319 @@
|
||||
// WcsMainDialog.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "afxdialogex.h"
|
||||
#include "ConfigDLg.h"
|
||||
#include "QrGuide.h"
|
||||
#include "QrMainDialog.h"
|
||||
|
||||
#define CLEAR_CACHE_TIMER 1
|
||||
|
||||
// CMainDialog <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
IMPLEMENT_DYNAMIC(CQrMainDialog, CDialogEx)
|
||||
|
||||
CQrMainDialog::CQrMainDialog(CWnd* pParent /*=NULL*/)
|
||||
: CDialogEx(IDD_MAIN_DIALOG, pParent)
|
||||
{
|
||||
}
|
||||
|
||||
CQrMainDialog::~CQrMainDialog()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CQrMainDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_EDIT_LOG, m_EditMultiLine);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CQrMainDialog, CDialogEx)
|
||||
|
||||
ON_WM_TIMER()
|
||||
ON_COMMAND(IDR_MENU_CONFIG, &CQrMainDialog::OnMenuConfig)
|
||||
ON_MESSAGE(WM_CAM_NETMESSAGE, &CQrMainDialog::OnTcpNetMsg)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CMainDialog <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
//<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)
|
||||
{
|
||||
CQrMainDialog* pModule = (CQrMainDialog*)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, NULL);
|
||||
}
|
||||
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
|
||||
}
|
||||
else if (CEXPIPE_NEW_DATA == lMsgId)
|
||||
{
|
||||
pModule->ProcessPipeMsg(lMsgId, (char*)wparam, (int)lparam);
|
||||
}
|
||||
else
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void CQrMainDialog::AddLog2Edit(CString strMsg)
|
||||
{
|
||||
CString str;
|
||||
m_EditMultiLine.GetWindowText(str);
|
||||
|
||||
if (str.GetLength() > 2048)
|
||||
{
|
||||
str = ""; //<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
||||
}
|
||||
|
||||
str += strMsg;
|
||||
str += "\r\n";
|
||||
m_EditMultiLine.SetWindowText(str);
|
||||
m_EditMultiLine.LineScroll(m_EditMultiLine.GetLineCount());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CQrMainDialog::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 nMsgType = root["type"].asInt();
|
||||
|
||||
|
||||
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||||
/*if (nMsgType == DEVICE_CONFIG_RET)
|
||||
{
|
||||
|
||||
}
|
||||
else if (nMsgType == SET_TRANS_MODE_REQ && m_bDeviceInit) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵĹ<DFB5><C4B9><EFBFBD>ģʽ
|
||||
{
|
||||
|
||||
}
|
||||
else if (nMsgType == GET_TRANS_STATE_REQ)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
BOOL CQrMainDialog::OnInitDialog()
|
||||
{
|
||||
CDialogEx::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_QR-GUIDE", "", acPipe, 256, iniPath);
|
||||
strPipe = acPipe;
|
||||
}
|
||||
g_pstPipeClient->RegisterCall(g_PipeCallBack, this);
|
||||
g_pstPipeClient->Connect(strPipe.GetBuffer());
|
||||
|
||||
|
||||
m_tcpClient.InitNetInfo(theApp.m_strCameraIp, theApp.m_nCameraPort);
|
||||
m_tcpClient.RegisterHwnd(m_hWnd, this);
|
||||
m_tcpClient.ConnectServer();
|
||||
|
||||
|
||||
SetTimer(CLEAR_CACHE_TIMER, 100, NULL);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// <20>쳣: OCX <20><><EFBFBD><EFBFBD>ҳӦ<D2B3><D3A6><EFBFBD><EFBFBD> FALSE
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BOOL CQrMainDialog::PreTranslateMessage(MSG* pMsg)
|
||||
{
|
||||
if (pMsg->message == WM_KEYDOWN&&pMsg->wParam == VK_RETURN)
|
||||
return TRUE;
|
||||
if (pMsg->message == WM_KEYDOWN&&pMsg->wParam == VK_ESCAPE)
|
||||
return TRUE;
|
||||
|
||||
return CDialog::PreTranslateMessage(pMsg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CQrMainDialog::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 CLEAR_CACHE_TIMER:
|
||||
m_nLastTag = 0;
|
||||
break;
|
||||
}
|
||||
CDialogEx::OnTimer(nIDEvent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CQrMainDialog::OnMenuConfig()
|
||||
{
|
||||
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CConfigDLg dlg;
|
||||
dlg.DoModal();
|
||||
}
|
||||
|
||||
|
||||
LRESULT CQrMainDialog::OnTcpNetMsg(WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
NET_TCP_PACKET* pNetPacket = (NET_TCP_PACKET*)lparam;
|
||||
|
||||
switch (wparam)
|
||||
{
|
||||
case NET_CAM_CONNECT_OK:
|
||||
{
|
||||
GetDlgItem(IDC_CAM_STATUS)->SetWindowText("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
m_bCamConnect = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
case NET_CAM_DISCONNECT:
|
||||
{
|
||||
GetDlgItem(IDC_CAM_STATUS)->SetWindowText("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѶϿ<EFBFBD>");
|
||||
m_bCamConnect = FALSE;
|
||||
break;
|
||||
}
|
||||
case NET_CAM_DATA_MSG:
|
||||
{
|
||||
HandleMessage(pNetPacket->pData, pNetPacket->lLen);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
delete[] pNetPacket->pData;
|
||||
delete pNetPacket;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CQrMainDialog::HandleMessage(char * pMsg, int nMsgLen)
|
||||
{
|
||||
|
||||
/*char recvdata_str1[1024] = "\0";
|
||||
char tmp_str1[10] = "\0";
|
||||
for (int i = 0; i < nMsgLen; i ++)
|
||||
{
|
||||
sprintf_s(tmp_str1, "%02X ", (unsigned char)pMsg[i]);
|
||||
strcat_s(recvdata_str1, tmp_str1);
|
||||
}
|
||||
|
||||
AddLog2Edit(recvdata_str1);*/
|
||||
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>꣬<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int nPositionX;
|
||||
short sPositionY;
|
||||
unsigned short sAngle;
|
||||
uint64_t lTagNum;
|
||||
|
||||
int nBit3, nBit4, nBit5, nBit6;
|
||||
|
||||
|
||||
nPositionX = int(pMsg[2] & 0x07) * 0x80 * 0x4000 + int(pMsg[3]) * 0x4000 + int(pMsg[4]) * 0x80 + int(pMsg[5]);
|
||||
if (nPositionX >> 23 >0)
|
||||
{
|
||||
nPositionX += 0xFF000000;
|
||||
}
|
||||
|
||||
|
||||
sPositionY = (short)pMsg[6] * 0x80 + (short)pMsg[7];
|
||||
//Y<>Ǹ<EFBFBD>ֵ
|
||||
if (sPositionY >> 13 > 0)
|
||||
{
|
||||
sPositionY += 0xC000;
|
||||
}
|
||||
|
||||
sAngle = pMsg[10] * 0x80 + pMsg[11];
|
||||
lTagNum = pMsg[13] * 0x4000 * 0x4000 + pMsg[14] * 0x80 * 0x4000 + pMsg[15] * 0x4000 + pMsg[16] * 0x80 + pMsg[17];
|
||||
|
||||
|
||||
if (m_nLastTag != lTagNum )
|
||||
{
|
||||
Json::Value ret;
|
||||
|
||||
ret["x"] = nPositionX;
|
||||
ret["y"] = sPositionY;
|
||||
ret["angle"] = sAngle;
|
||||
ret["tag"] = (uint)lTagNum;
|
||||
|
||||
m_nLastTag = lTagNum;
|
||||
m_nLastX = nPositionX;
|
||||
m_nLastY = sPositionY;
|
||||
m_nLastAngle = sAngle;
|
||||
|
||||
|
||||
Json::FastWriter writer;
|
||||
string strJson = writer.write(ret);
|
||||
|
||||
AddLog2Edit(strJson.c_str());
|
||||
|
||||
theApp.SendMsg2Platform("DRIVER", GUIDE_QRCODE, ret);
|
||||
}
|
||||
}
|
||||
42
Plugin/QrGuide/QrMainDialog.h
Normal file
42
Plugin/QrGuide/QrMainDialog.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
#include "afxcmn.h"
|
||||
#include "afxwin.h"
|
||||
#include "TcpClient.h"
|
||||
|
||||
|
||||
class CQrMainDialog : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CQrMainDialog)
|
||||
|
||||
public:
|
||||
CQrMainDialog(CWnd* pParent = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
virtual ~CQrMainDialog();
|
||||
|
||||
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_MAIN_DIALOG };
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<><D6A7>
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
virtual BOOL OnInitDialog();
|
||||
CTcpClient m_tcpClient;
|
||||
BOOL m_bCamConnect;
|
||||
CEdit m_EditMultiLine;
|
||||
|
||||
public:
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
afx_msg LRESULT OnTcpNetMsg(WPARAM wparam, LPARAM lparam);
|
||||
void ProcessPipeMsg(int lMsgId, char* pData, int lLen);
|
||||
afx_msg void OnMenuConfig();
|
||||
void HandleMessage(char * pMsg, int nMsgLen);
|
||||
void AddLog2Edit(CString strMsg);
|
||||
|
||||
|
||||
int m_nLastTag, m_nLastX, m_nLastY, m_nLastAngle;
|
||||
};
|
||||
270
Plugin/QrGuide/TcpClient.cpp
Normal file
270
Plugin/QrGuide/TcpClient.cpp
Normal file
@@ -0,0 +1,270 @@
|
||||
#include "StdAfx.h"
|
||||
#include "TcpClient.h"
|
||||
#include "QrGuide.h"
|
||||
#include <process.h>
|
||||
|
||||
|
||||
CTcpClient::CTcpClient()
|
||||
{
|
||||
WSADATA wsaData;
|
||||
WORD wVersionRequested=MAKEWORD(2, 2);
|
||||
if( 0 == WSAStartup (wVersionRequested, &wsaData))
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
m_socket = NULL;
|
||||
//m_hWnd = NULL;
|
||||
m_sPort = 0;
|
||||
memset(m_achSendBuf, 0, 1024);
|
||||
|
||||
m_hReceive = NULL;
|
||||
|
||||
m_bStart = FALSE;
|
||||
|
||||
time(&m_lLastNetTime);
|
||||
m_lLastConnectTime = 0;
|
||||
}
|
||||
|
||||
CTcpClient::~CTcpClient(void)
|
||||
{
|
||||
m_bStart = FALSE;
|
||||
closesocket(m_socket);
|
||||
m_socket = NULL;
|
||||
if (WAIT_TIMEOUT == WaitForSingleObject(m_hReceive, 3000))
|
||||
{
|
||||
//
|
||||
ASSERT(FALSE);
|
||||
TerminateThread(m_hReceive, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CTcpClient::UnInit()
|
||||
{
|
||||
}
|
||||
|
||||
void CTcpClient::RegisterHwnd(HWND hWnd, PVOID pParent)
|
||||
{
|
||||
m_hWnd = hWnd;
|
||||
m_pParent = pParent;
|
||||
}
|
||||
|
||||
|
||||
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD> strConfName Ϊini<6E><69><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>еĶ<D0B5><C4B6><EFBFBD>
|
||||
int CTcpClient::InitNetInfo(CString strConfName)
|
||||
{
|
||||
CString strConf = theApp.m_strModulePath + "\\config.ini";
|
||||
|
||||
|
||||
char acIp[64] = {0};
|
||||
GetPrivateProfileString(strConfName, "IP", "0.0.0.0", acIp, 63, strConf);
|
||||
|
||||
m_strServerIp = acIp;
|
||||
|
||||
m_sPort = (short)GetPrivateProfileInt(strConfName, "PORT", 0, strConf);
|
||||
|
||||
LogOutToFile("[info] <20><><EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD>:[%s][%s:%d]", strConfName.GetBuffer(), acIp, m_sPort);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD> strConfName Ϊini<6E><69><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>еĶ<D0B5><C4B6><EFBFBD>
|
||||
int CTcpClient::InitNetInfo(CString strIp, int nPort)
|
||||
{
|
||||
m_strServerIp = strIp;
|
||||
m_sPort = nPort;
|
||||
LogOutToFile("[info] <20><><EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD>:[%s:%d]", strIp.GetBuffer(), nPort);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BOOL CTcpClient::ConnectServer()
|
||||
{
|
||||
if (NULL != m_socket)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
m_bStart = TRUE;
|
||||
m_hReceive = (HANDLE)_beginthreadex(NULL, 0, recvThread, this, 0, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CTcpClient::StopConnect()
|
||||
{
|
||||
if (NULL == m_socket || NULL == m_hReceive)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
m_bStart = FALSE;
|
||||
closesocket(m_socket);
|
||||
if (WAIT_TIMEOUT == WaitForSingleObject(m_hReceive, 3000))
|
||||
{
|
||||
//
|
||||
ASSERT(FALSE);
|
||||
TerminateThread(m_hReceive, 0);
|
||||
m_socket = NULL;
|
||||
return -1;
|
||||
}
|
||||
m_socket = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CTcpClient::ReConnect()
|
||||
{
|
||||
if (m_bStart == TRUE)
|
||||
{
|
||||
StopConnect();
|
||||
ConnectServer();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CTcpClient::PostMessage2MainWnd(UINT uMsg, WPARAM wParam, CString strMsg)
|
||||
{
|
||||
NET_TCP_PACKET* pNetPacket = new NET_TCP_PACKET;
|
||||
pNetPacket->pData = new char[strMsg.GetLength() + 1];
|
||||
memcpy(pNetPacket->pData, strMsg.GetBuffer(), strMsg.GetLength());
|
||||
strMsg.ReleaseBuffer();
|
||||
pNetPacket->pData[strMsg.GetLength()] = '\0';
|
||||
pNetPacket->lLen = strMsg.GetLength();
|
||||
::PostMessage(this->m_hWnd, uMsg, wParam, (LPARAM)pNetPacket);
|
||||
}
|
||||
|
||||
|
||||
unsigned int __stdcall recvThread(LPVOID param)
|
||||
{
|
||||
CTcpClient* pThis = (CTcpClient*)param;
|
||||
|
||||
if (0 != pThis->m_socket)
|
||||
{
|
||||
LogOutToFile("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
pThis->m_lLastConnectTime = 0;
|
||||
time(&pThis->m_lLastConnectTime);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>60<36><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ̨<C6BD><CCA8><EFBFBD><EFBFBD>
|
||||
while (pThis->m_bStart)
|
||||
{
|
||||
pThis->m_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
|
||||
sockaddr_in remote;
|
||||
remote.sin_family = AF_INET;
|
||||
remote.sin_addr.s_addr = inet_addr(pThis->m_strServerIp.GetBuffer());
|
||||
//remote.sin_addr.s_addr = inet_addr("127.0.0.1");
|
||||
remote.sin_port = htons(pThis->m_sPort);
|
||||
|
||||
time(&pThis->m_lLastNetTime);
|
||||
if (0 == connect(pThis->m_socket, (sockaddr*)&remote, sizeof(remote)))
|
||||
{
|
||||
LogOutToFile("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
|
||||
pThis->PostMessage2MainWnd(WM_CAM_NETMESSAGE, NET_CAM_CONNECT_OK, "ɨ<EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
CString strMsg;
|
||||
strMsg.Format("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD>ͷ%sʧ<73>ܣ<EFBFBD>20<32><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>[%d].", pThis->m_strServerIp.GetBuffer(), GetLastError());
|
||||
LogOutToFile(strMsg);
|
||||
pThis->PostMessage2MainWnd(WM_CAM_NETMESSAGE, NET_CAM_DISCONNECT, strMsg);
|
||||
}
|
||||
closesocket(pThis->m_socket);
|
||||
pThis->m_socket = NULL;
|
||||
for (int i = 0; i < 200 && TRUE == pThis->m_bStart; i++)
|
||||
{
|
||||
Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
pThis->m_lLastConnectTime = 0;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
pThis->HandleNdcCMsg();
|
||||
|
||||
pThis->m_socket = NULL;
|
||||
|
||||
pThis->PostMessage2MainWnd(WM_CAM_NETMESSAGE, NET_CAM_DISCONNECT, "ɨ<EFBFBD><EFBFBD>ͷ<EFBFBD>ѶϿ<EFBFBD>");
|
||||
|
||||
if (FALSE == pThis->m_bStart)
|
||||
{
|
||||
LogOutToFile("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>.");
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
LogOutToFile("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD>Ͽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
|
||||
|
||||
//<2F>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
pThis->ConnectServer();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CTcpClient::SendData(char* pData, int lLen)
|
||||
{
|
||||
|
||||
if (NULL == m_socket)
|
||||
{
|
||||
LogOutToFile("<EFBFBD><EFBFBD><EFBFBD>ݷ<EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>绹δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int lSend = send(m_socket, pData, lLen, 0);
|
||||
return lSend;
|
||||
}
|
||||
|
||||
void CTcpClient::HandleNdcCMsg()
|
||||
{
|
||||
char acBuffer[10240] = "";
|
||||
int nRecvLen = 0;
|
||||
int nStateChange = 0;
|
||||
|
||||
while (m_bStart)
|
||||
{
|
||||
int lRec = recv(m_socket, acBuffer + nRecvLen, 10240 - nRecvLen, 0);
|
||||
|
||||
//TRACE("Recv len: %d\n", lRec);
|
||||
if (lRec > 0)
|
||||
{
|
||||
nRecvLen += lRec;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogOutToFile("Error: recv ret %d. error code %d", lRec, GetLastError());
|
||||
closesocket(m_socket);
|
||||
return ;
|
||||
}
|
||||
|
||||
//<2F><>Ϣ<EFBFBD>峤<EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>
|
||||
if (nRecvLen < 21)continue;
|
||||
int nMsgLen = 21;
|
||||
|
||||
|
||||
while (true)
|
||||
{
|
||||
NET_TCP_PACKET* pNetPacket = new NET_TCP_PACKET;
|
||||
pNetPacket->pData = new char[nMsgLen + 1];
|
||||
memcpy(pNetPacket->pData, acBuffer, nMsgLen);
|
||||
pNetPacket->pData[nMsgLen] = '\0';
|
||||
pNetPacket->lLen = nMsgLen;
|
||||
::PostMessage(this->m_hWnd, WM_CAM_NETMESSAGE, NET_CAM_DATA_MSG, (LPARAM)pNetPacket);
|
||||
|
||||
//<2F>ӻ<EFBFBD><D3BB><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5><EFBFBD>Ѵ<EFBFBD><D1B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
for (int i = nMsgLen; i < nRecvLen; i++)
|
||||
{
|
||||
acBuffer[i - nMsgLen] = acBuffer[i];
|
||||
}
|
||||
nRecvLen -= nMsgLen;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||||
if (nRecvLen < 21)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
75
Plugin/QrGuide/TcpClient.h
Normal file
75
Plugin/QrGuide/TcpClient.h
Normal file
@@ -0,0 +1,75 @@
|
||||
#include <winsock.h>
|
||||
#include <list>
|
||||
using std::list;
|
||||
#pragma once
|
||||
|
||||
|
||||
typedef struct NET_TCP_PACKET2
|
||||
{
|
||||
char* pData;
|
||||
int lLen;
|
||||
//NET_MANAGER_ENUM enType;
|
||||
}*pNET_TCP_PACKET2;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef unsigned int (*MsgCallBack)(PVOID); //<2F>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
||||
|
||||
class CTcpClient
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
friend unsigned int __stdcall recvThread(LPVOID param);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
static void UnInit();
|
||||
|
||||
BOOL ConnectServer();
|
||||
|
||||
int StopConnect();
|
||||
|
||||
int ReConnect();
|
||||
|
||||
BOOL IsConnect(){return NULL!=m_socket;}
|
||||
|
||||
void RegisterHwnd(HWND hWnd, PVOID pParent);
|
||||
|
||||
int SendData(char* pData, int lLen);
|
||||
|
||||
void PostMessage2MainWnd(UINT uMsg, WPARAM wParam, CString strMsg);
|
||||
|
||||
|
||||
int InitNetInfo(CString strConfName);
|
||||
int InitNetInfo(CString strIp, int nPort);
|
||||
void HandleNdcCMsg();
|
||||
char m_achSendBuf[1024];
|
||||
|
||||
~CTcpClient(void);
|
||||
|
||||
time_t m_lLastNetTime;
|
||||
time_t m_lLastConnectTime;
|
||||
|
||||
public:
|
||||
CTcpClient();
|
||||
|
||||
SOCKET m_socket;
|
||||
|
||||
CString m_strServerIp;
|
||||
short m_sPort;
|
||||
|
||||
HANDLE m_hReceive;
|
||||
BOOL m_bStart;
|
||||
|
||||
public:
|
||||
PVOID m_pParent;
|
||||
HWND m_hWnd;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
BIN
Plugin/QrGuide/res/QrGuide.ico
Normal file
BIN
Plugin/QrGuide/res/QrGuide.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
Plugin/QrGuide/res/QrGuide.rc2
Normal file
BIN
Plugin/QrGuide/res/QrGuide.rc2
Normal file
Binary file not shown.
BIN
Plugin/QrGuide/resource.h
Normal file
BIN
Plugin/QrGuide/resource.h
Normal file
Binary file not shown.
108
Plugin/QrGuide/stdafx.cpp
Normal file
108
Plugin/QrGuide/stdafx.cpp
Normal file
@@ -0,0 +1,108 @@
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// <20><>cΪ<63><CEAA>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļн<C4BC>
|
||||
float getAngelOfTwoVector(Point2f &pt1, Point2f &pt2, Point2f &c)
|
||||
{
|
||||
float theta = atan2(pt1.y - c.y, pt1.x - c.x) - atan2(pt2.y - c.y, pt2.x - c.x);
|
||||
if (theta > CV_PI)
|
||||
theta -= 2 * CV_PI;
|
||||
if (theta < -CV_PI)
|
||||
theta += 2 * CV_PI;
|
||||
|
||||
theta = -1*theta * 180.0 / CV_PI;
|
||||
return theta;
|
||||
}
|
||||
|
||||
|
||||
//<2F>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ָ<EFBFBD>
|
||||
void splitString(const string& s, vector<string>& v, const string& c)
|
||||
{
|
||||
string::size_type pos1, pos2;
|
||||
pos2 = s.find(c);
|
||||
pos1 = 0;
|
||||
while (string::npos != pos2)
|
||||
{
|
||||
v.push_back(s.substr(pos1, pos2 - pos1));
|
||||
pos1 = pos2 + c.size();
|
||||
pos2 = s.find(c, pos1);
|
||||
}
|
||||
if (pos1 != s.length())
|
||||
v.push_back(s.substr(pos1));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
82
Plugin/QrGuide/stdafx.h
Normal file
82
Plugin/QrGuide/stdafx.h
Normal file
@@ -0,0 +1,82 @@
|
||||
|
||||
// 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>
|
||||
|
||||
#define WM_CAMERA_SNAP 10999
|
||||
|
||||
|
||||
|
||||
#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 <afxcontrolbars.h> // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϳؼ<CDBF><D8BC><EFBFBD><EFBFBD><EFBFBD> MFC ֧<><D6A7>
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include <opencv2/highgui.hpp>
|
||||
#include "json.h"
|
||||
#include "../Protocol.h"
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
typedef struct ST_THREAD_PARAM
|
||||
{
|
||||
void * pParent;
|
||||
int nIdx;
|
||||
}
|
||||
ST_THREAD_PARAM;
|
||||
|
||||
|
||||
#define COLOR_R Scalar(0, 0, 255)
|
||||
#define COLOR_B Scalar(255, 0, 0)
|
||||
|
||||
|
||||
#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
|
||||
|
||||
#define WM_CAM_NETMESSAGE (WM_USER+9984)
|
||||
#define NET_CAM_CONNECT_OK 0
|
||||
#define NET_CAM_DISCONNECT 1
|
||||
#define NET_CAM_DATA_MSG 2
|
||||
|
||||
typedef struct NET_TCP_PACKET
|
||||
{
|
||||
char* pData;
|
||||
int lLen;
|
||||
//NET_MANAGER_ENUM enType;
|
||||
}*pNET_TCP_PACKET;
|
||||
|
||||
float getAngelOfTwoVector(Point2f &pt1, Point2f &pt2, Point2f &c);
|
||||
void splitString(const string& s, vector<string>& v, const string& c);
|
||||
void LogOutToFile(const char* fmt, ...);
|
||||
|
||||
8
Plugin/QrGuide/targetver.h
Normal file
8
Plugin/QrGuide/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