Merge branch 'master' into 'main'

VisionController Version1.0:

See merge request qu.shuailong/visioncontroller!1
merge-requests/1/merge
qu.shuailong 4 years ago
commit 39ea2bddcf

@ -0,0 +1,6 @@
{
"address": {
"IP": "127.0.0.1",
"Port": "9900"
}
}

Binary file not shown.

Binary file not shown.

@ -0,0 +1,230 @@
#include "IOController.h"
IOController::IOController()
{
}
IOController::~IOController()
{
}
bool IOController::controllerInitialization(unsigned int serialNum)
{
return controlCom(serialNum, 1);
}
bool IOController::controlCom(unsigned int IONum, unsigned int state)
{
std::string comName;
switch (IONum)
{
case 1:
comName = "Com1";
break;
case 2:
comName = "Com2";
break;
case 3:
comName = "Com3";
break;
case 4:
comName = "Com4";
break;
case 5:
comName = "Com5";
break;
case 6:
comName = "Com6";
break;
case 7:
comName = "Com7";
break;
case 8:
comName = "Com8";
break;
default:
break;
}
m_comName = comName;
m_mpComsState[comName] = false;
void* handle;
int nRet = MV_IO_CreateHandle(&handle);
if (nRet != MV_OK)
{
//throw nRet;
return false;
}
else
{
m_mpComsHandle[comName] = handle;
}
if (state == 1)
{
if (!connectCom(m_mpComsHandle[comName], comName))
{
return false;
}
}
else if (state == 0)
{
if (!closeCom(m_mpComsHandle[comName], comName))
{
return false;
}
}
return true;
}
bool IOController::connectCom(void* handle, std::string comName)
{
MV_IO_SERIAL stSerial;
memset(&stSerial, 0, sizeof(MV_IO_SERIAL));
strcpy(stSerial.strComName, comName.c_str());
//m_mpStIOSerial[comName] = stSerial;
int nRet = MV_IO_Open(m_mpComsHandle[comName], &stSerial);
if (nRet != MV_OK)
{
//throw nRet;
return false;
}
m_mpComsState[comName] = true;
return true;
}
bool IOController::closeCom(void* handle, std::string comName)
{
return true;
}
bool IOController::controlPort(unsigned int portNum, unsigned int state)
{
MV_IO_PORT_NUMBER stPortNumber;
switch(portNum)
{
case 1:
stPortNumber = MV_IO_PORT_1;
break;
case2:
stPortNumber = MV_IO_PORT_2;
break;
case 3:
stPortNumber = MV_IO_PORT_3;
break;
case 4:
stPortNumber = MV_IO_PORT_4;
break;
case 5:
stPortNumber = MV_IO_PORT_5;
break;
case 6:
stPortNumber = MV_IO_PORT_6;
break;
case 7:
stPortNumber = MV_IO_PORT_7;
break;
case 8:
stPortNumber = MV_IO_PORT_8;
break;
default:
break;
}
if (state == 1)
{
if (!openPort(m_comName, stPortNumber))
{
return false;
}
}
else if (state == 0)
{
if (!closePort(m_comName, stPortNumber))
{
return false;
}
}
return true;
}
bool IOController::openPort(std::string comName, MV_IO_PORT_NUMBER portNum)
{
MV_IO_SET_OUTPUT stOutput;
memset(&stOutput, 0, sizeof(MV_IO_SET_OUTPUT));
stOutput.nPort = portNum;
stOutput.nType = MV_IO_PATTERN_SINGLE;
stOutput.nDurationTime = 0;
stOutput.nValidLevel = 1; //¸ßµçƽ
if ((m_mpComsHandle.find(comName) == m_mpComsHandle.end())|| (!m_mpComsState[comName]))
{
return false;
}
int nRet = MV_IO_SetOutput(m_mpComsHandle[comName], &stOutput);
if (nRet != MV_OK)
{
//throw nRet;
return false;
}
return true;
}
bool IOController::closePort(std::string comName, MV_IO_PORT_NUMBER portNum)
{
MV_IO_SET_OUTPUT stOutput;
memset(&stOutput, 0, sizeof(MV_IO_SET_OUTPUT));
stOutput.nPort = portNum;
stOutput.nType = MV_IO_PATTERN_SINGLE;
// stOutput.nDurationTime = 3000;
stOutput.nValidLevel = 0; //µÍµçƽ
if ((m_mpComsHandle.find(comName) == m_mpComsHandle.end()) || (!m_mpComsState[comName]))
{
return false;
}
int nRet = MV_IO_SetOutput(m_mpComsHandle[comName], &stOutput);
if (nRet != MV_OK)
{
//throw nRet;
return false;
}
return true;
}
bool IOController::getPortState(unsigned int portNum, unsigned int& state)
{
MV_IO_PORT_NUMBER stPortNumber;
switch (portNum)
{
case 1:
stPortNumber = MV_IO_PORT_1;
break;
case2:
stPortNumber = MV_IO_PORT_2;
break;
case 3:
stPortNumber = MV_IO_PORT_3;
break;
case 4:
stPortNumber = MV_IO_PORT_4;
break;
case 5:
stPortNumber = MV_IO_PORT_5;
break;
case 6:
stPortNumber = MV_IO_PORT_6;
break;
case 7:
stPortNumber = MV_IO_PORT_7;
break;
case 8:
stPortNumber = MV_IO_PORT_8;
break;
default:
break;
}
if (m_mpComsHandle.find(m_comName) == m_mpComsHandle.end())
{
return false;
}
MV_IO_SET_OUTPUT stSetOutput;
int nRet = MV_IO_GetPortOutputParam(m_mpComsHandle[m_comName], &stSetOutput);
if (nRet != MV_OK)
{
//throw nRet;
return false;
}
state = stSetOutput.nValidLevel;
return true;
}

@ -0,0 +1,51 @@
#ifndef _H_IOController_H_
#define _H_IOController_H_
//#define MAX_DEVICE 6
#include <Windows.h>
#include <QtCore>
#include <QtCore/qglobal.h>
#include <QMap>
#include <string>
#include "MvIOInterfaceBox.h"
#include "MvIOInterfaceBoxDefine.h "
#include "MvErrorDefine.h"
#ifndef BUILD_STATIC
# if defined(IOController_LIB)
# define IOController_EXPORT Q_DECL_EXPORT
# else
# define IOController_EXPORT Q_DECL_IMPORT
# endif
#else
# define IOController_EXPORT
#endif
class IOController_EXPORT IOController
{
public:
IOController();
~IOController();
bool controlCom(unsigned int serialNumber, unsigned int state);
bool controlPort(unsigned int intportNumber, unsigned int state);
bool controllerInitialization(unsigned int serialNum);
bool getPortState(unsigned int portNum, unsigned int& validState);
private:
bool connectCom(void* handle, std::string comName);
bool closeCom(void* handle, std::string comName);
bool openPort(std::string comName, MV_IO_PORT_NUMBER portNum);
bool closePort(std::string comName, MV_IO_PORT_NUMBER portNum);
//void* m_handleList[MAX_DEVICE]; // ·½±ãÁ¬½Ó¶à¸öÉ豸
QMap<std::string, void*> m_mpComsHandle;
//QMap<std::string, MV_IO_SERIAL> m_mpStIOSerial;
QMap<std::string, bool> m_mpComsState;
std::string m_comName;
};
#endif // !_H_IOController_H_

@ -0,0 +1,77 @@
/***************************************************************************************************
*
* (c) 2015, ,
*
* MvErrorDefine.h
*
*
* 1.0.0.0
*
* 2015-01-28
*
***************************************************************************************************/
#ifndef _MV_ERROR_DEFINE_H_
#define _MV_ERROR_DEFINE_H_
//正确码定义
#define MV_OK 0x00000000 ///< 成功,无错误
//通用错误码定义:范围0x80000000-0x800000FF
#define MV_E_HANDLE 0x80000000 ///< 错误或无效的句柄
#define MV_E_SUPPORT 0x80000001 ///< 不支持的功能
#define MV_E_BUFOVER 0x80000002 ///< 缓存已满
#define MV_E_CALLORDER 0x80000003 ///< 函数调用顺序错误
#define MV_E_PARAMETER 0x80000004 ///< 错误的参数
#define MV_E_RESOURCE 0x80000006 ///< 资源申请失败
#define MV_E_NODATA 0x80000007 ///< 无数据
#define MV_E_PRECONDITION 0x80000008 ///< 前置条件有误,或运行环境已发生变化
#define MV_E_VERSION 0x80000009 ///< 版本不匹配
#define MV_E_NOENOUGH_BUF 0x8000000A ///< 传入的内存空间不足
#define MV_E_MATCH 0x8000000B ///< 匹配错误(如返回的数据格式错误)
#define MV_E_UPDATING 0x8000000C ///< 处于升级状态
#define MV_E_UNKNOW 0x800000FF ///< 未知的错误
//网络相关错误: 0x80000100-0x800001FF
#define MV_E_CREAT_SOCKET 0x80000100 // 创建Socket失败
#define MV_E_BIND_SOCKET 0x80000101 // 绑定Socket失败
#define MV_E_CONNECT_SOCKET 0x80000102 // 连接Socket失败
#define MV_E_GET_HOSTNAME 0x80000103 // 获取Hostname失败
#define MV_E_NET_WRITE 0x80000104 // 网络写数据失败
#define MV_E_NET_READ 0x80000105 // 网络读数据失败
#define MV_E_NET_SELECT 0x80000106 //网络连接失败
#define MV_E_NET_TIMEOUT 0x80000107 // 网络超时
//GigE_STATUS对应的错误码:范围0x80000200-0x800002FF
#define MV_E_NOT_IMPLEMENTED 0x80000200 ///< 命令不被设备支持
#define MV_E_INVALID_ADDRESS 0x80000201 ///< 访问的目标地址不存在
#define MV_E_WRITE_PROTECT 0x80000202 ///< 目标地址不可写
#define MV_E_ACCESS_DENIED 0x80000203 ///< 访问无权限
#define MV_E_BUSY 0x80000204 ///< 设备忙,或网络断开
#define MV_E_PACKET 0x80000205 ///< 网络包数据错误
#define MV_E_NETER 0x80000206 ///< 网络相关错误
//USB_STATUS对应的错误码:范围0x80000300-0x800003FF
#define MV_E_USB_READ 0x80000300 ///< 读usb出错
#define MV_E_USB_WRITE 0x80000301 ///< 写usb出错
#define MV_E_USB_DEVICE 0x80000302 ///< 设备异常
#define MV_E_USB_GENICAM 0x80000303 ///< GenICam相关错误
#define MV_E_USB_UNKNOW 0x800003FF ///< USB未知的错误
//升级时对应的错误码:范围0x80000400-0x800004FF
#define MV_E_UPG_FILE_MISMATCH 0x80000400 ///< 升级固件不匹配
#define MV_E_UPG_LANGUSGE_MISMATCH 0x80000401 ///< 升级固件语言不匹配
#define MV_E_UPG_CONFLICT 0x80000402 ///< 升级冲突(设备已经在升级了再次请求升级即返回此错误)
#define MV_E_UPG_INNER_ERR 0x80000403 ///< 升级时相机内部出现错误
#define MV_E_UPG_UNKNOW 0x800004FF ///< 升级时未知错误
// YModem协议错误码
#define MV_E_YMODEM_C 0x80000500 ///< 未收到开启传输命令
#define MV_E_YMODEM_ACK 0x80000501 ///< 未收到接收确认回应
#define MV_E_YMODEM_NAK 0x80000502 ///< 未收到结束确认回应
#endif //_MV_ERROR_DEFINE_H_

@ -0,0 +1,231 @@
/***************************************************************************************************
*
* MvIOInterfaceBox.h
*
*
* 1.2.0
*
***************************************************************************************************/
/***************************************************************************************************
*
* File name: MvIOInterfaceBox.h
* Abstract: Common definition header file of Visual controller
*
* Current Version:1.2.0
* Remarks newly build
***************************************************************************************************/
#ifndef MV_IO_INTERFACEBOX_CONTROL_H__
#define MV_IO_INTERFACEBOX_CONTROL_H__
#include "MvIOInterfaceBoxDefine.h"
/**
* @brief ch: | en:Dynamic library import and export definition
*/
#ifndef MV_IO_CONTROL_API
#ifdef WIN32
#if defined(MVIOINTERFACEBOXCONTROL_EXPORTS)
#define MV_IO_CONTROL_API __declspec(dllexport)
#else
#define MV_IO_CONTROL_API __declspec(dllimport)
#endif
#else
#ifndef __stdcall
#define __stdcall
#endif
#ifndef MV_IO_CONTROL_API
#define MV_IO_CONTROL_API
#endif
#endif
#endif
#ifndef IN
#define IN
#endif
#ifndef OUT
#define OUT
#endif
#ifdef __cplusplus
extern "C" {
#endif
/** @fn MV_IO_CreateHandle
* @brief ch: | en:Create handle
* @param handle [IN][OUT] ch: | en:Device handle
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
* @ ch:32 | en:A maximum of 32 serial port handles can be created
*/
MV_IO_CONTROL_API int __stdcall MV_IO_CreateHandle(OUT void ** handle);
/** @fn MV_IO_DestroyHandle
* @brief ch: | en:Destroy handle
* @param handle [IN] ch: | en:Device handle
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_DestroyHandle(IN void * handle);
/** @fn MV_IO_GetSDKVersion
* @brief ch:SDK | en:Get SDK version
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_GetSDKVersion(OUT MV_IO_VERSION * pstVersion);
/** @fn MV_IO_Open
* @brief ch: | en:Open serial port
* @param handle [IN] ch: | en:
* @param pstSerial [IN] ch:MV_IO_SERIAL | en:Serial paranm, reference MV_IO_SERIAL
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_Open(IN void* handle, IN MV_IO_SERIAL * pstSerial);
/** @fn MV_IO_Close
* @brief ch: | en:Close serial
* @param handle [IN] ch: | en:Device handle
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_Close(IN void* handle);
/** @fn MV_IO_GetFirmwareVersion
* @brief ch: | en:Get firmware version
* @param handle [IN] ch: | en:Device handle
* @param pstVersion [IN] ch:MV_IO_VERSION | en:param,reference MV_IO_VERSION
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_GetFirmwareVersion(IN void* handle, OUT MV_IO_VERSION * pstVersion);
/** @fn MV_IO_LocalUpgrade
* @brief ch: | en:Local upgrade
* @param handle [IN] ch: | en:Device handle
* @param pstLocalUpgrade [IN][OUT] ch:MV_IO_LOCAL_UPGRADE | en:Upgrade param,reference MV_IO_LOCAL_UPGRADE
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_LocalUpgrade(IN void* handle, IN unsigned char* pData, IN unsigned int nLen, IN OUT MV_IO_LOCAL_UPGRADE * pstLocalUpgrade);
/** @fn MV_IO_SetOutput
* @brief ch: | en:Output param setting
* @param handle [IN] ch: | en:Device handle
* @param pstOutput [IN] ch:,MV_IO_SET_OUTPUT | en:Output param , reference MV_IO_SET_OUTPUT
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_SetOutput(IN void* handle, IN MV_IO_SET_OUTPUT * pstOutput);
/** @fn MV_IO_SetOutputEnable
* @brief ch:使 | en:Turn on output enable
* @param handle [IN] ch: | en:Device handle
* @param pstEnable [IN] ch:使MV_IO_OUTPUT_ENABLE | en:Output enabling parameters, reference MV_IO_OUTPUT_ENABLE
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_SetOutputEnable(IN void* handle, IN MV_IO_OUTPUT_ENABLE * pstEnable);
/** @fn MV_IO_SetInput
* @brief ch:
* @param handle [IN] ch: | en:
* @param pstInput [IN] ch:MV_IO_SET_INPUT | en:
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_SetInput(IN void* handle, IN MV_IO_SET_INPUT * pstInput);
/** @fn MV_IO_GetPortInputParam
* @brief ch: | en:Get input parameter settings
* @param handle [IN] ch: | en:Device handle
* @param pstInput [IN] ch:MV_IO_SET_INPUT | en:Input param, reference MV_IO_SET_INPUT
* @return MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_GetPortInputParam(IN void* handle, IN OUT MV_IO_SET_INPUT * pstInput);
/** @fn MV_IO_GetPortOutputParam
* @brief ch: | en:Get output parameter settings
* @param handle [IN] ch: | en:Device handle
* @param pstInput [IN] ch:MV_IO_SET_OUTPUT | en:Input param, reference MV_IO_SET_OUTPUT
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_GetPortOutputParam(IN void* handle, IN OUT MV_IO_SET_OUTPUT * pstInput);
/** @fn MV_IO_GetInputLevel
* @brief ch:,沿使 | en:Get input level information,When edge detection is on, the interface cannot be used to obtain the level
* @param handle [IN] ch: | en:Device handle
* @param pstInputLevel [IN] ch:MV_IO_INPUT_LEVEL | en:Input param, reference MV_IO_INPUT_LEVEL
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_GetInputLevel(IN void* handle, OUT MV_IO_INPUT_LEVEL * pstInputLevel);
/** @fn MV_IO_SetLightParam
* @brief ch:LIGHT() | en:Light source setting
* @param handle [IN] ch: | en:Device handle
* @param pstLightParam [IN] ch:MV_IO_LIGHT_PARAM | en:Light source param, reference MV_IO_LIGHT_PARAM
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_SetLightParam(IN void* handle, IN MV_IO_LIGHT_PARAM * pstLightParam);
/** @fn MV_IO_GetLightParam
* @brief ch:LIGHT() | en:Get light source brightness parameter
* @param handle [IN] ch: | en:Device handle
* @param pstLightParam [IN] ch:MV_IO_LIGHT_PARAM | en:light param, reference MV_IO_LIGHT_PARAM
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_GetLightParam(IN void* handle, IN MV_IO_LIGHT_PARAM * pstLightParam);
/** @fn MV_IO_AssociatedOutPort
* @brief ch: | en:Input associated output port
* ch:沿沿 | en:If you need to open a certain input edge to detect or close the detection function, you need to call it after the interface.
* @param handle [IN] ch: | en:Device handle
* @param pstAssocParam [IN] ch:MV_IO_ASSOCIATE_PARAM | en:Associated port parameters, reference MV_IO_ASSOCIATE_PARAM
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_AssociatedOutPort(IN void* handle, IN MV_IO_ASSOCIATEPORT_PARAM * pstAssocParam);
/***********************************************************************
* @fn MV_IO_RegisterEdgeDetectionCallBack
* @brief ch:沿 | en:edge detection callback
* @param handle [IN] ch: | en:Device handle
* @param cbOutput [IN] ch: | en:Callback function pointer
* @param pInputLevel [IN] ch:沿MV_IO_INPUT_EDGE_TYPE | en:Edge detection parameters, reference MV_IO_INPUT_EDGE_TYPE
* @param pUser [IN] ch: | en: pointer
* @return ch:MV_OK | en:Success,return MV_OK(0);Failed, return error code
***********************************************************************/
MV_IO_CONTROL_API int __stdcall MV_IO_RegisterEdgeDetectionCallBack(IN void* handle, DetectFunType cbOutput,void* pUser);
/** @fn MV_IO_ResetParam
* @brief ch: | en:
* @param handle [IN] ch: | en:Device handle
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_ResetParam(IN void * handle);
/** @fn MV_IO_Reboot
* @brief ch: | en:Reboot device
* @param handle [IN] ch: | en:Device handle
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_Reboot(IN void * handle);
/** @fn MV_IO_SetDebugView
* @brief ch:Dugview | en:Open the dugview tool debugging interface
* @param nFlag [IN] ch:1Debugview, 0 | en:1 means DebugView is on, 0 is off
* @return ch: |en: None
*/
MV_IO_CONTROL_API void __stdcall MV_IO_SetDebugView(IN unsigned int nFlag);
/** @fn MV_IO_SaveParam
* @brief ch: | en:Save device param
* @param handle [IN] ch: | en:Device handle
* @return ch:MV_OK(0); | en:Success,return MV_OK(0);Failed, return error code
*/
MV_IO_CONTROL_API int __stdcall MV_IO_SaveParam(IN void * handle);
#ifdef __cplusplus
}
#endif
#endif

@ -0,0 +1,288 @@
/***************************************************************************************************
*
* (c) 2018
*
* MvInterfaceBoxDefine.h
*
*
*
*
***************************************************************************************************/
/***************************************************************************************************
*
* Copyright: Copyright: Copyright (c) 2018 all rights reserved
*
* File name: MvInterfaceBoxDefine.h
* Abstract: Common definition header file of Visual controller
*
* Remarks: None
*
***************************************************************************************************/
#ifndef MV_IO_INTERFACE_BOX_DEFINE_H__
#define MV_IO_INTERFACE_BOX_DEFINE_H__
#ifndef IN
#define IN
#endif
#ifndef OUT
#define OUT
#endif
#define MV_SERIAL_BUF_LEN 1024 //ch:串口buffer长度 | en : Serial buffer length
#define MV_SERIAL_RECVBUF_MAXLEN (1024*1024) //ch:一次性接收串口数据的最大值 | en:Max value of received data at one time
// 用于区分命令类型
typedef enum MVCL_CTRL_TYPE__
{
CTRL_INPUT_LEVEL = 0x00, // ch:获取输入口高低电平信息 |en: Get high and low level information of input port
CTRL_RESET_PARAM = 0x01, // ch:恢复默认参数值 |en: Restore default parameter values
CTRL_VERSION_INFO = 0x02, // ch:获取版本信息 |en: Get vision information
CTRL_PATTERN_SET_INFO = 0x03, // ch:获取模式信息 |en: Get mode information
CTRL_INPUT_SET_INFO = 0x04, // ch:获取IO输入口设置信息 |en: Get IO input port setting information
CTRL_OUTPUT_SET_INFO = 0x05, // ch:获取IO输出口设置信息 |en: Get IO output port setting information
CTRL_LIGHT_SET_INFO = 0x06, // ch:获取光源设置信息 |en: Get lighting settings information
CTRL_FILTER_SET_INFO = 0x07, // ch:获取滤波设置信息 |en: Get filter setting information
}MVCL_CTRL_TYPE;
/*************************************************************************
*ch: en| Common macro definitions
*************************************************************************/
const static unsigned int MV_IO_MAX_COM_NAME_LENGTH = 64; // ch:最大的串口名称长度 | en:Max serial port name length
const static unsigned int MV_IO_MAX_PROC_STATE_LEN = 64; // ch:最大的升级进度状态长度 | en:Max upgrade state length
/*************************************************************************
* | en: Enumeration definition
*************************************************************************/
// ch:关闭串口默认超时时间 en: Default timeout for closing serial port
#define CLOSE_SERIAL_DEFAULT_TIMEOUT 3000
/** @enum MV_IO_PATTERN_OUT
* @brief ch: | en: Output mode selection
*/
typedef enum MV_IO_PATTERN_OUT__
{
MV_IO_PATTERN_PWM = 0x05, // PWM
MV_IO_PATTERN_SINGLE = 0x06, // SINGLE
} MV_IO_PATTERN_OUT;
/** @enum MV_IO_PORT_NUMBER
* @brief ch:Port | en: port definition
* ch:7Port7 | en:The eight port ports of input and output are represented by these seven macro definitions
* ch:Port: MV_IO_PORT_1 | MV_IO_PORT_2
* en: To enable the output of two port ports at the same time, the or operation can be performed(ex: MV_IO_PORT_1 | MV_IO_PORT_2)
*/
typedef enum MV_IO_PORT_NUMBER__
{
MV_IO_PORT_1 = 0x1, // ch:端口1 | en: port1
MV_IO_PORT_2 = 0x2, // ch:端口2 | en: port2
MV_IO_PORT_3 = 0x4, // ch:端口3 | en: port3
MV_IO_PORT_4 = 0x8, // ch:端口4 | en: port4
MV_IO_PORT_5 = 0x10, // ch:端口5 | en: port5
MV_IO_PORT_6 = 0x20, // ch:端口6 | en: port6
MV_IO_PORT_7 = 0x40, // ch:端口7 | en: port7
MV_IO_PORT_8 = 0x80, // ch:端口8 | en: port8
} MV_IO_PORT_NUMBER;
/** @enum MV_IO_EDGE_TYPE
* @brief ch:沿, | en:Edge definition
*/
typedef enum MV_IO_EDGE_TYPE__
{
MV_IO_EDGE_UNKNOW = 0x00, // ch:未知 | en: Unknow
MV_IO_EDGE_RISING = 0x01, // ch:上升沿 | en: Rising edge
MV_IO_EDGE_FALLING = 0x02, // ch:下降沿 | en: Falling edge
} MV_IO_EDGE_TYPE;
/** @enum MV_IO_ENABLE_TYPE
* @brief ch:使 | en: Enable type definition, used to control the trigger in serial mode
*/
typedef enum MV_IO_ENABLE_TYPE__
{
MV_IO_ENABLE_START = 0x00, // ch:使能开始 | en: Enable
MV_IO_ENABLE_END = 0x01, // ch:使能结束 | en: Disable
} MV_IO_ENABLE_TYPE;
/** @enum MV_IO_LIGHTSTATE
* @brief ch: | en: Light states
*/
typedef enum MV_IO_LIGHTSTATE__
{
MV_IO_LIGHTSTATE_ON = 0x0001, // ch:触发后常亮 | en:Light on after triggering
MV_IO_LIGHTSTATE_OFF = 0x0002, // ch:触发后常灭 | en:Light off after triggering
} MV_IO_LIGHTSTATE;
// 消息类型
typedef enum MVCL_MSG_TYPE__
{
MSG_TYPE_UNKNOW = 0x00, // ch:未知 | en:Unknow
MSG_TYPE_NORMAL = 0x02, // ch:可识别正常消息类型 | en:Normal
}MVCL_MSG_TYPE;
/*************************************************************************
* ch: | en:Struct definition
*************************************************************************/
/** @struct MV_IO_SERIAL
* @brief ch: | en:Serial param
*/
typedef struct MV_IO_SERIAL__
{
char strComName[MV_IO_MAX_COM_NAME_LENGTH]; // ch:串口名称 | en:Serial port name
unsigned int nReserved[8]; // ch:保留字段 | en:Reserve
} MV_IO_SERIAL;
/** @struct MV_IO_LIGHT_PARAM
* @brief ch: | en:Parameter setting of light source module
*/
typedef struct MV_IO_LIGHT_PARAM__
{
unsigned char nPortNumber; // ch:亮度端口 | en:Light port
unsigned short nLightValue; // ch:光源亮度值(0-100之间) | en:Light value(0-100)
unsigned short nLightState; // ch:触发后常亮还是常灭 | en:Light on or off after triggering
unsigned short nLightEdge; // ch:上升沿触发还是下降沿触发 | en:Rising or falling edge trigger
unsigned int nDurationTime; // ch:持续时间 | en:Duration Time
unsigned int nReserved[3]; // ch:保留字段 | en:Reserved
} MV_IO_LIGHT_PARAM;
/** @struct MV_IO_ASSOCIATE_PARAM
* @brief ch: | en:Input associated output port parameter setting
*/
typedef struct MV_IO_ASSOCIATEPORT_PARAM__
{
unsigned short nInPortNum; // ch:被关联的输入端口 | en:Associated input port
unsigned short nOutPortNum; // ch:关联的输出端口,(PORT_1)代表关联1号口(PORT_1 | PORT_2)代表关联1号和2号口(以此类推)
// en:Associated output port, (Port_ 1)For the associated port 1, (Port_ 1 | PORT_ 2) Represents the connection between port 1 and port 2, and so on
unsigned int nReserved[4]; // ch:保留字段 | en:Reserved
} MV_IO_ASSOCIATEPORT_PARAM;
/** @struct MV_IO_OUTPUT_ENABLE
* @brief ch:使 | en:Set output enable
*/
typedef struct MV_IO_OUTPUT_ENABLE__
{
unsigned char nPortNumber; // 使能端口,若多个端口同时使能可以执行或运算 | en:Enable port, if more than one port is enabled at the same time, it can perform or operation
unsigned char nType; // MV_IO_ENABLE_START 表示使能开始MV_IO_ENABLE_END表示使能结束 | en:en:MV_IO_ENABLE_START:start of enabling,MV_IO_ENABLE_END:end of enabling
unsigned int nReserved[4]; // 保留字段 | en:Reserved
} MV_IO_OUTPUT_ENABLE;
/** @struct MV_IO_INPUT_LEVEL
* @brief ch: en: Input level
*/
typedef struct MV_IO_INPUT_LEVEL__
{
unsigned char nPortNumber; // ch:端口号,参考MV_IO_PORT_NUMBER | en: Port number.reference MV_IO_PORT_NUMBER
unsigned char nLevel0; // ch:1号口电平信息 |en:Level information of port1
unsigned char nLevel1; // ch:2号口电平信息 |en:Level information of port2
unsigned char nLevel2; // ch:3号口电平信息 |en:Level information of port3
unsigned char nLevel3; // ch:4号口电平信息 |en:Level information of port4
unsigned char nLevel4; // ch:5号口电平信息 |en:Level information of port5
unsigned char nLevel5; // ch:6号口电平信息 |en:Level information of port6
unsigned char nLevel6; // ch:7号口电平信息 |en:Level information of port7
unsigned char nLevel7; // ch:8号口电平信息 |en:Level information of port8
unsigned int nReserved[8]; // ch:保留字节 | en:Reserved
}MV_IO_INPUT_LEVEL;
/** @struct MV_IO_INPUT_EDGE
* @brief ch:沿 | en:Detects the structure of the input along the information type
*/
typedef struct MV_IO_INPUT_EDGE_TYPE__
{
unsigned char nPortNumber; // ch:端口号 | en:Port number
unsigned short nTriggerTimes; // ch:对应端口触发次数 | en:Trigger times of corresponding port
enum MV_IO_EDGE_TYPE enEdgeType; // ch:沿类型 | en:Trigger edge type
unsigned int nReserved[8]; // ch:保留字节 | en:Reserved
}MV_IO_INPUT_EDGE_TYPE;
/** @struct MV_IO_VERSION
* @brief ch:SDK | en:SDK vision
*/
typedef struct MV_IO_VERSION__
{
unsigned int nMainVersion; // ch:主版本号 | en:Major version
unsigned int nSubVersion; // ch:次版本号 | en:Minor version
unsigned int nModifyVersion; // ch:修订版本号 | en:Revision
unsigned int nYear; // ch:年 | en:Year
unsigned int nMonth; // ch:月 | en:month
unsigned int nDay; // ch:日 | en:date
unsigned int nReserved[8]; // ch:保留字节 | en:Reserved
}MV_IO_VERSION;
/** @struct MV_IO_SET_INPUT
* @brief ch: | en:Input port setting
*/
typedef struct MV_IO_SET_INPUT__
{
unsigned int nPort; // ch:输入端口 | Input port
unsigned int nEnable; // ch:使能状态1表示开启0表示关闭 | en:Enable state, 1 is on, 0 is off
unsigned int nEdge; // ch:触发沿 | en:Trigger edge
unsigned int nDelayTime; // ch:触发延迟 | en:Trigger delay
unsigned int nGlitch; // ch:去抖时间 | en:Debounce time
unsigned int nReserved[8]; // ch:保留字节 | en:Reserved
}MV_IO_SET_INPUT;
/** @struct MV_IO_SET_OUTPUT
* @brief ch: | en:Output port setting
*/
typedef struct MV_IO_SET_OUTPUT__
{
unsigned int nPort; // 输出端口 | en:Output port
unsigned int nType; // 输出模式(包含单脉冲模式和PWM模式) | en:Output mode(Single pulse and PWM mode )
unsigned int nPulseWidth; // 脉冲宽度 | en:Pulse width
unsigned int nPulsePeriod; // 脉冲周期 | en:Pulse period
unsigned int nDurationTime; // 脉冲持续时间 | en:Pulse duration
unsigned int nValidLevel; // 有效电平1表示高电平0表示低电平 | en:Effective level, 1 is high level, 0 is low level
unsigned int nReserved[8]; // 保留字节 | en:Reserved
}MV_IO_SET_OUTPUT;
/** @struct MV_IO_LOCAL_UPGRADE
* @brief ch: | en:Firmware upgrade status
*/
typedef struct MV_IO_LOCAL_UPGRADE__
{
unsigned int nProcPercent; // ch:升级进度 | en:Upgrade progress
char chProcState[MV_IO_MAX_PROC_STATE_LEN]; // ch:升级状态 | en:Upgrade status
unsigned int nReserved[8]; // ch:保留字节 | en:Reserved
}MV_IO_LOCAL_UPGRADE;
// ch:检测电平回调函数 | en:Detection level callback function
typedef void (__stdcall* DetectFunType)(void *, MV_IO_INPUT_EDGE_TYPE*, void*);
/** @struct MV_SERIAL_DEVICE
* @brief ch: en: serial device
*/
typedef struct MV_SERIAL_DEVICE_
{
void* pMvSerial; // 串口句柄
DetectFunType pCallbackFun; // 沿检测函数
void* hCallBackThreadHandle; // 回调句柄
unsigned int bCallbackRunning; // 判断回调线程是否正在执行
void* hSerialRecvThreadHandle; // 串口接收数据线程句柄
unsigned int bSerialRecvRunning; // 判断串口是否正在接收数据
char nReserved[32]; // 保留字节
}MV_SERIAL_DEVICE;
/** @struct MV_SERIAL_DATA
* @brief ch: | en: serial Data
*/
typedef struct MV_SERIAL_DATA_
{
unsigned int bUsed; // ch:标志位,数据是否使用 | en:Flag bit, whether the data is used or not
MVCL_MSG_TYPE nType; // ch:数据类型 | en: Data type
unsigned int nRecvLen; // ch:接收数据长度 | en:Received data length
double fRecvTime; // ch:接收数据时间 | en:Received data time
char* pSerialRecvBuf; // ch:接收的数据 | en:Data received
char* pInitRecvBuf; // ch:初始数据 | en:Initial data
}MV_SERIAL_DATA;
#endif

@ -0,0 +1,98 @@
#include "Tcpserver.h"
#include <QDebug>
TcpServer::TcpServer(QObject *parent) :
QTcpServer(parent)
{
m_tcpServerPtr = nullptr;
m_tcpSocketPtr = nullptr;
m_tcpServerPtr = new QTcpServer(this);
}
TcpServer::~TcpServer()
{
if (m_tcpServerPtr)
delete m_tcpServerPtr;
}
bool TcpServer::startConnect(QString address, quint16 port)
{
if (m_tcpServerPtr == nullptr)
return false;
if (!m_tcpServerPtr->listen(QHostAddress(address), port))
{
return false;
}
connect(m_tcpServerPtr, &QTcpServer::newConnection, this, &TcpServer::onNewConnection);
return true;
}
bool TcpServer::startConnect()
{
if (m_tcpServerPtr == nullptr)
return false;
if (!m_tcpServerPtr->listen(QHostAddress(m_serverIP), m_serverPort))
{
return false;
}
connect(m_tcpServerPtr, &QTcpServer::newConnection, this, &TcpServer::onNewConnection);
return true;
}
void TcpServer::onCloseConnect()
{
if (m_tcpServerPtr != nullptr)
{
if (m_tcpSocketPtr != nullptr)
{
m_tcpSocketPtr->disconnectFromHost();
m_tcpSocketPtr->close();
m_tcpSocketPtr = nullptr;
}
m_tcpServerPtr->disconnect();
m_tcpServerPtr->close();
}
}
void TcpServer::onNewConnection()
{
//取出建立好连接的套接字
m_tcpSocketPtr = m_tcpServerPtr->nextPendingConnection();
m_clientIp = m_tcpSocketPtr->peerAddress().toString();
m_clientPort = m_tcpSocketPtr->peerPort();
emit sgConnected(m_clientIp, m_clientPort);
connect(m_tcpSocketPtr, &QTcpSocket::readyRead, this, &TcpServer::onReceiveMsg);
//connect(m_tcpSocketPtr, &QTcpSocket::stateChanged, this, &TcpServer::onStateChanged);
//connect(m_tcpSocketPtr, SIGNAL(error(QAbstractSocket::SocketError)), this, &TcpServer::onSocketError);
}
void TcpServer::onReceiveMsg()
{
QByteArray dataByte = m_tcpSocketPtr->readAll();
if (!dataByte.isEmpty())
{
emit sgReceived(m_clientIp, m_clientPort, dataByte);
}
}
//void TcpServer::onDisconnected()
//{
// emit sgDisconnected(m_clientIp, m_clientPort);
//}
//void TcpServer::onStateChanged(QAbstractSocket::SocketState socketState)
//{
// if (socketState == QAbstractSocket::UnconnectedState)
// {
// emit sgDisconnected(m_clientIp, m_clientPort);
// m_tcpSocketPtr->deleteLater();
// }
//}
//
//void TcpServer::onSocketError(QAbstractSocket::SocketError socketError)
//{
// int error = m_tcpSocketPtr->error();
// if (error == QAbstractSocket::RemoteHostClosedError)
// {
// emit sgDisconnected(m_clientIp, m_clientPort);
// }
//}

@ -0,0 +1,72 @@
#ifndef _H_TCPSERVER_H_
#define _H_TCPSERVER_H_
#include <vector>
#include <iostream>
#include <QHash>
#include <QTcpServer>
#include <QTcpSocket>
//#include "tcpsocket.h"
#include <QtCore/qglobal.h>
#ifndef BUILD_STATIC
# if defined(TCPSERVER_LIB)
# define TCPSERVER_EXPORT Q_DECL_EXPORT
# else
# define TCPSERVER_EXPORT Q_DECL_IMPORT
# endif
#else
# define TCPSERVER_EXPORT
#endif
class TCPSERVER_EXPORT TcpServer : public QTcpServer
{
Q_OBJECT
public:
explicit TcpServer(QObject *parent = 0);
~TcpServer();
bool startConnect();
bool startConnect(QString address, quint16 port);
void onCloseConnect();
void setServerIpPort(QString ip, quint16 port)
{
m_serverIP = ip;
m_serverPort = port;
}
signals:
void sgConnected(QString ip, quint16 port);
void sgReceived(QString ip, quint16 port, const QByteArray &msg);
void sgDisconnected(QString ip, quint16 port);
protected:
void SendHeartHitBack();
private:
QTcpServer *m_tcpServerPtr; //¼àÌýÌ×½Ó×Ö
QTcpSocket *m_tcpSocketPtr; //ͨÐÅÌ×½Ó×Ö
bool m_bGetHeader{ false };
int m_goalSize{ 0 };
int m_nowSize{ 0 };
QString m_clientIp;
quint16 m_clientPort;
QString m_serverIP;
quint16 m_serverPort;
QByteArray m_receiveData;
private slots:
void onNewConnection();
void onReceiveMsg();
//void onDisconnected();
//void onStateChanged(QAbstractSocket::SocketState socketState);
//void onSocketError(QAbstractSocket::SocketError socketError);
};
#endif // !_H_TCPSERVER_H_

@ -0,0 +1,231 @@
#pragma execution_character_set("utf-8")
#include "VisionController.h"
VisionController::VisionController(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
m_tcpServerPtr = nullptr;
m_tcpServerPtr = new TcpServer(this);
QString path = QApplication::applicationDirPath();
QString serverIP = "127.0.0.1";
quint16 serverPort = 9900;
readServerConfig(path, serverIP, serverPort);
ui.LineEdit_IP->setText(serverIP);
ui.LineEdit_Port->setText(tr("%1").arg(serverPort));
ui.LineEdit_IP->setEnabled(false);
if (m_tcpServerPtr->startConnect(serverIP, serverPort))
{
//QString msg = QString("服务器1%: 2% 启动成功").arg(serverIp).arg(port);
QString showMsg = QString("【服务器:%1: %2 启动成功】").arg(serverIP).arg(serverPort);
ui.textLog->appendPlainText(showMsg);
ui.ButtonStart->setEnabled(false);
ui.ButtonStop->setEnabled(true);
}
else
{
QString showMsg = QString("【服务器:%1: %2 启动失败】").arg(serverIP).arg(serverPort);
ui.textLog->appendPlainText(showMsg);
}
connect(ui.ButtonStart, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
connect(ui.ButtonStop, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
connect(ui.ButtonClear, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
connect(m_tcpServerPtr, &TcpServer::sgConnected, this, &VisionController::newConnected);
connect(m_tcpServerPtr, &TcpServer::sgReceived, this, &VisionController::receivedData);
connect(m_tcpServerPtr, &TcpServer::sgDisconnected, this, &VisionController::onDisconnected);
m_ioControllerPtr = new IOController();
unsigned int serialNum = 2;
if (!m_ioControllerPtr->controllerInitialization(serialNum))
{
QString showMsg = QString("串口Com%1初始化失败").arg(serialNum);
ui.textLog->appendPlainText(showMsg);
}
else
{
QString showMsg = QString("串口Com%1初始化成功").arg(serialNum);
ui.textLog->appendPlainText(showMsg);
}
}
bool VisionController::readServerConfig(QString path, QString& serverIP, quint16& port)
{
QString filePath = path + "\\..\\config\\tcpServer.json";
QFile jsonFile(filePath);
if (!jsonFile.exists())
{
qDebug() << "文件: " << filePath << "不存在!";
return false;
}
if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug() << "文件:" << filePath << "打开失败!";
return false;
}
QByteArray dataArray = jsonFile.readAll();
jsonFile.close();
QJsonParseError jsonError;
QJsonDocument jsonDocument = QJsonDocument::fromJson(dataArray, &jsonError);
if (jsonError.error != QJsonParseError::NoError)
{
qDebug() << "文件:" << filePath << "格式错误!";
return false;
}
QJsonObject jsonObject = jsonDocument.object();
QJsonObject addressObj = jsonObject.value("address").toObject();
serverIP = addressObj.value("IP").toString();
port = addressObj.value("Port").toString().toUInt();
return true;
}
bool VisionController::writeServerConfig(QString path, QString serverIP, quint16 serverPort)
{
QString filePath = path + "\\..\\config\\tcpServer.json";
QFile jsonFile(filePath);
if (!jsonFile.open(QIODevice::WriteOnly))
{
qDebug() << "创建文件:" << filePath << "失败!";
return false;
}
QJsonObject addressObj;
QJsonObject subObj;
subObj.insert("IP", serverIP);
subObj.insert("Port", tr("%1").arg(serverPort));
addressObj.insert("address", QJsonObject(subObj));
QJsonDocument jsonDoc(addressObj);
QByteArray jsonData = jsonDoc.toJson();
jsonFile.write(jsonData);
jsonFile.close();
return true;
}
VisionController::~VisionController()
{
if (m_ioControllerPtr)
{
delete m_ioControllerPtr;
//m_ioControllerPtr = nullptr;
}
if (m_tcpServerPtr)
{
delete m_tcpServerPtr;
}
}
Q_SLOT void VisionController::onButtonClicked()
{
QString strObj = sender()->objectName();
if (strObj == "ButtonStart")
{
QString serverIp = ui.LineEdit_IP->text();
quint16 port = ui.LineEdit_Port->text().toUInt();
QString path = QApplication::applicationDirPath();
writeServerConfig(path, serverIp, port);
if (m_tcpServerPtr->startConnect(serverIp, port))
{
//QString msg = QString("服务器1%: 2% 启动成功").arg(serverIp).arg(port);
QString showMsg = QString("【服务器:%1: %2 启动成功】").arg(serverIp).arg(port);
ui.textLog->appendPlainText(showMsg);
ui.ButtonStart->setEnabled(false);
ui.ButtonStop->setEnabled(true);
}
else
{
QString showMsg = QString("【服务器:%1: %2 启动失败】").arg(serverIp).arg(port);
ui.textLog->appendPlainText(showMsg);
}
}
else if (strObj == "ButtonStop")
{
if (m_tcpServerPtr != nullptr)
{
m_tcpServerPtr->onCloseConnect();
ui.ButtonStart->setEnabled(true);
ui.ButtonStop->setEnabled(false);
//delete m_tcpServerPtr;
}
}
else if (strObj == "ButtonClear")
{
ui.textLog->clear();
}
}
Q_SLOT void VisionController::newConnected(QString ip, quint16 port)
{
QString showMsg = QString("【客户端上线:%1: %2】").arg(ip).arg(port);
ui.textLog->appendPlainText(showMsg);
}
Q_SLOT void VisionController::receivedData(QString ip, quint16 port, const QByteArray& dataByte)
{
QString showMsg = QString("【客户端:%1: %2】").arg(ip).arg(port);
showMsg.append(dataByte);
ui.textLog->appendPlainText(showMsg);
QString msg = QString(dataByte);
if (msg.startsWith("<") && msg.endsWith(">"))
{
msg.chop(1);
msg.remove(0, 1);
QStringList splitList = msg.split(",");
unsigned int port = splitList[0].toInt();
unsigned int state = splitList[1].toInt();
QString mode = splitList[2];
if (mode == "post")
{
if (!m_ioControllerPtr->controlPort(port, state))
{
if (state == 0)
{
QString errorMsg = QString("【端口Port%1 关闭失败!】").arg(port);
ui.textLog->appendPlainText(errorMsg);
}
else if (state == 1)
{
QString errorMsg = QString("【端口Port%1 打开失败!】").arg(port);
ui.textLog->appendPlainText(errorMsg);
}
}
else
{
if (state == 0)
{
QString successMsg = QString("【端口port%1 关闭成功!】").arg(port);
ui.textLog->appendPlainText(successMsg);
}
else if (state == 1)
{
QString successMsg = QString("【端口port%1 打开成功!】").arg(port);
ui.textLog->appendPlainText(successMsg);
}
}
}
else if (mode == "get")
{
unsigned int portState;
if (m_ioControllerPtr->getPortState(port, portState))
{
QString successMsg = QString("【端口port%1的状态为%2】").arg(port).arg(portState);
ui.textLog->appendPlainText(successMsg);
}
else
{
QString errorMsg = QString("【端口port%1状态获取失败").arg(port);
ui.textLog->appendPlainText(errorMsg);
}
}
}
}
Q_SLOT void VisionController::onDisconnected(QString ip, quint16 port)
{
QString msg = QString("【客户端:%1%2断开连接").arg(ip).arg(port);
ui.textLog->appendPlainText(msg);
}
void VisionController::closeEvent(QCloseEvent *event)
{
QString serverIp = ui.LineEdit_IP->text();
quint16 port = ui.LineEdit_Port->text().toUInt();
QString path = QApplication::applicationDirPath();
writeServerConfig(path, serverIp, port);
}

@ -0,0 +1,37 @@
#pragma once
#include <QtWidgets/QMainWindow>
#include <QFile>
#include <QDir>
#include <QApplication>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonDocument>
#include "ui_VisionController.h"
#include "TcpServer.h"
#include "IOController.h"
class VisionController : public QMainWindow
{
Q_OBJECT
public:
VisionController(QWidget *parent = Q_NULLPTR);
~VisionController();
protected:
virtual void closeEvent(QCloseEvent *event);
private:
Ui::VisionControllerClass ui;
Q_SLOT void onButtonClicked();
Q_SLOT void newConnected(QString ip, quint16 port);
Q_SLOT void receivedData(QString ip, quint16 port, const QByteArray &dataByte);
Q_SLOT void onDisconnected(QString ip, quint16 port);
bool readServerConfig(QString path, QString& serverIP, quint16& port);
bool writeServerConfig(QString path, QString serverIP, quint16 port);
TcpServer* m_tcpServerPtr;
IOController* m_ioControllerPtr{nullptr};
//IOInterface* m_ioInterfacePtr{ nullptr };
};

@ -0,0 +1,10 @@
#include "VisionController.h"
#include <QtWidgets/QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
VisionController w;
w.show();
return a.exec();
}

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<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>{FB680084-3EA6-4ECA-BC68-2644C45CC825}</ProjectGuid>
<Keyword>Qt4VSv1.0</Keyword>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup Condition="'$(QtMsBuild)'=='' or !Exists('$(QtMsBuild)\qt.targets')">
<QtMsBuild>$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
</Target>
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')">
<Import Project="$(QtMsBuild)\qt.props" />
</ImportGroup>
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="Shared" />
<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" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;IOCONTROLLER_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).dll</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>qtmaind.lib;Qt5Cored.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<QtMoc>
<Define>UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;IOCONTROLLER_LIB;%(PreprocessorDefinitions)</Define>
<IncludePath>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;%(AdditionalIncludeDirectories)</IncludePath>
</QtMoc>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;IOCONTROLLER_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(SolutionDir)..\src\IOController\NewSdkInc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat />
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<OutputFile>$(SolutionDir)..\runner17\$(ProjectName).dll</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;$(QTDIR);$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>qtmain.lib;Qt5Core.lib;MvIOInterfaceBox.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<QtMoc>
<Define>UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;IOCONTROLLER_LIB;%(PreprocessorDefinitions)</Define>
<IncludePath>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(SolutionDir)..\src\IOController\NewSdkInc;%(AdditionalIncludeDirectories)</IncludePath>
</QtMoc>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\IOController\IOController.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\IOController\IOController.h" />
<ClInclude Include="..\..\src\IOController\NewSdkInc\MvErrorDefine.h" />
<ClInclude Include="..\..\src\IOController\NewSdkInc\MvIOInterfaceBox.h" />
<ClInclude Include="..\..\src\IOController\NewSdkInc\MvIOInterfaceBoxDefine.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
</ImportGroup>
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties MocDir=".\GeneratedFiles\$(ConfigurationName)" UicDir=".\GeneratedFiles" RccDir=".\GeneratedFiles" lupdateOptions="" lupdateOnBuild="0" lreleaseOptions="" Qt5Version_x0020_x64="5.9.4_msvc2017_64" MocOptions="" />
</VisualStudio>
</ProjectExtensions>
</Project>

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
<Extensions>moc;h;cpp</Extensions>
<SourceControlFiles>False</SourceControlFiles>
</Filter>
<Filter Include="Header Files\NewSdkInc">
<UniqueIdentifier>{549a6910-6555-4b27-a3de-dec5b66aca6a}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\IOController\NewSdkInc\MvErrorDefine.h">
<Filter>Header Files\NewSdkInc</Filter>
</ClInclude>
<ClInclude Include="..\..\src\IOController\NewSdkInc\MvIOInterfaceBox.h">
<Filter>Header Files\NewSdkInc</Filter>
</ClInclude>
<ClInclude Include="..\..\src\IOController\NewSdkInc\MvIOInterfaceBoxDefine.h">
<Filter>Header Files\NewSdkInc</Filter>
</ClInclude>
<ClInclude Include="..\..\src\IOController\IOController.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\IOController\IOController.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QTDIR>D:\Qt\Qt5.9.4\5.9.4\msvc2017_64</QTDIR>
<LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QTDIR>D:\Qt\Qt5.9.4\5.9.4\msvc2017_64</QTDIR>
<LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>
</PropertyGroup>
</Project>

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<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>{58DB7028-F0B5-4D49-AE6C-F29CE2942198}</ProjectGuid>
<Keyword>Qt4VSv1.0</Keyword>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup Condition="'$(QtMsBuild)'=='' or !Exists('$(QtMsBuild)\qt.targets')">
<QtMsBuild>$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
</Target>
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')">
<Import Project="$(QtMsBuild)\qt.props" />
</ImportGroup>
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="Shared" />
<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" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;QT_NETWORK_LIB;TCPSERVER_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtNetwork;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).dll</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>qtmaind.lib;Qt5Cored.lib;Qt5Networkd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<QtMoc>
<Define>UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;QT_NETWORK_LIB;TCPSERVER_LIB;%(PreprocessorDefinitions)</Define>
<IncludePath>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtNetwork</IncludePath>
<OutputFile>.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</OutputFile>
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
</QtMoc>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_NETWORK_LIB;TCPSERVER_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtNetwork;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>None</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<Optimization>MaxSpeed</Optimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<OutputFile>$(SolutionDir)..\runner17\$(ProjectName).dll</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>qtmain.lib;Qt5Core.lib;Qt5Network.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<QtMoc>
<Define>UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_NETWORK_LIB;TCPSERVER_LIB;%(PreprocessorDefinitions)</Define>
<IncludePath>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtNetwork</IncludePath>
<OutputFile>.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</OutputFile>
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
</QtMoc>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\TcpServer\TcpServer.cpp" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="..\..\src\TcpServer\TcpServer.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
</ImportGroup>
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties MocDir=".\GeneratedFiles\$(ConfigurationName)" UicDir=".\GeneratedFiles" RccDir=".\GeneratedFiles" lupdateOptions="" lupdateOnBuild="0" lreleaseOptions="" Qt5Version_x0020_x64="5.9.4_msvc2017_64" MocOptions="" />
</VisualStudio>
</ProjectExtensions>
</Project>

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
<Extensions>moc;h;cpp</Extensions>
<SourceControlFiles>False</SourceControlFiles>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\TcpServer\TcpServer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="..\..\src\TcpServer\TcpServer.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
</Project>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QTDIR>D:\Qt\Qt5.9.4\5.9.4\msvc2017_64</QTDIR>
<LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QTDIR>D:\Qt\Qt5.9.4\5.9.4\msvc2017_64</QTDIR>
<LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>
</PropertyGroup>
</Project>

@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.852
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VisionController", "VisionController\VisionController.vcxproj", "{B12702AD-ABFB-343A-A199-8E24837244A3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IOController", "IOController\IOController.vcxproj", "{FB680084-3EA6-4ECA-BC68-2644C45CC825}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TcpServer", "TcpServer\TcpServer.vcxproj", "{58DB7028-F0B5-4D49-AE6C-F29CE2942198}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x64.ActiveCfg = Debug|x64
{B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x64.Build.0 = Debug|x64
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.ActiveCfg = Release|x64
{B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.Build.0 = Release|x64
{FB680084-3EA6-4ECA-BC68-2644C45CC825}.Debug|x64.ActiveCfg = Debug|x64
{FB680084-3EA6-4ECA-BC68-2644C45CC825}.Debug|x64.Build.0 = Debug|x64
{FB680084-3EA6-4ECA-BC68-2644C45CC825}.Release|x64.ActiveCfg = Release|x64
{FB680084-3EA6-4ECA-BC68-2644C45CC825}.Release|x64.Build.0 = Release|x64
{58DB7028-F0B5-4D49-AE6C-F29CE2942198}.Debug|x64.ActiveCfg = Debug|x64
{58DB7028-F0B5-4D49-AE6C-F29CE2942198}.Debug|x64.Build.0 = Debug|x64
{58DB7028-F0B5-4D49-AE6C-F29CE2942198}.Release|x64.ActiveCfg = Release|x64
{58DB7028-F0B5-4D49-AE6C-F29CE2942198}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {62AB1429-5087-41C5-9263-67FBA9A870BB}
EndGlobalSection
EndGlobal

@ -0,0 +1,4 @@
<RCC>
<qresource prefix="VisionController">
</qresource>
</RCC>

@ -0,0 +1,214 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VisionControllerClass</class>
<widget class="QMainWindow" name="VisionControllerClass">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>631</width>
<height>495</height>
</rect>
</property>
<property name="windowTitle">
<string>VisionController</string>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>611</width>
<height>441</height>
</rect>
</property>
<property name="title">
<string>Pannel</string>
</property>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>271</width>
<height>131</height>
</rect>
</property>
<property name="title">
<string>Server Setting</string>
</property>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>231</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>IP:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="LineEdit_IP"/>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Port:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="LineEdit_Port"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget_2">
<property name="geometry">
<rect>
<x>40</x>
<y>80</y>
<width>191</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="ButtonStart">
<property name="text">
<string>Start</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="ButtonStop">
<property name="text">
<string>Stop</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_3">
<property name="geometry">
<rect>
<x>320</x>
<y>30</y>
<width>281</width>
<height>191</height>
</rect>
</property>
<property name="title">
<string>Text Log</string>
</property>
<widget class="QPlainTextEdit" name="textLog">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>251</width>
<height>131</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="ButtonClear">
<property name="geometry">
<rect>
<x>20</x>
<y>160</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Clear</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_4">
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<width>281</width>
<height>251</height>
</rect>
</property>
<property name="title">
<string>Client List</string>
</property>
<widget class="QTableWidget" name="tableWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>261</width>
<height>221</height>
</rect>
</property>
<column>
<property name="text">
<string>Num</string>
</property>
</column>
<column>
<property name="text">
<string>IP</string>
</property>
</column>
<column>
<property name="text">
<string>Port</string>
</property>
</column>
</widget>
</widget>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>631</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="VisionController.qrc"/>
</resources>
<connections/>
</ui>

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<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>{B12702AD-ABFB-343A-A199-8E24837244A3}</ProjectGuid>
<Keyword>Qt4VSv1.0</Keyword>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup Condition="'$(QtMsBuild)'=='' or !Exists('$(QtMsBuild)\qt.targets')">
<QtMsBuild>$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
</Target>
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.props')">
<Import Project="$(QtMsBuild)\qt.props" />
</ImportGroup>
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="Shared" />
<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" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<Optimization>Disabled</Optimization>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>qtmaind.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5Networkd.lib;Qt5Widgetsd.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<QtMoc>
<OutputFile>.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</OutputFile>
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
<IncludePath>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories)</IncludePath>
<Define>UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions)</Define>
</QtMoc>
<QtUic>
<ExecutionDescription>Uic'ing %(Identity)...</ExecutionDescription>
<OutputFile>.\GeneratedFiles\ui_%(Filename).h</OutputFile>
</QtUic>
<QtRcc>
<ExecutionDescription>Rcc'ing %(Identity)...</ExecutionDescription>
<OutputFile>.\GeneratedFiles\qrc_%(Filename).cpp</OutputFile>
</QtRcc>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWidgets;$(SolutionDir)..\src\TcpServer;$(SolutionDir)..\src\IOController;$(SolutionDir)..\src\IOController\NewSdkInc;$(SolutionDir)..\src\VisionController;$(OutDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>None</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<Optimization>MaxSpeed</Optimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<OutputFile>$(SolutionDir)..\runner17\$(ProjectName).exe</OutputFile>
<AdditionalLibraryDirectories>$(QTDIR)\lib;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalDependencies>qtmain.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Network.lib;Qt5Widgets.lib;IOController.lib;TcpServer.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<QtMoc>
<OutputFile>.\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp</OutputFile>
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
<IncludePath>.\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWidgets;$(SolutionDir)..\src\TcpServer;$(SolutionDir)..\src\IOController;$(SolutionDir)..\src\IOController\NewSdkInc;$(SolutionDir)..\src\VisionController;%(AdditionalIncludeDirectories)</IncludePath>
<Define>UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions)</Define>
</QtMoc>
<QtUic>
<ExecutionDescription>Uic'ing %(Identity)...</ExecutionDescription>
<OutputFile>.\GeneratedFiles\ui_%(Filename).h</OutputFile>
</QtUic>
<QtRcc>
<ExecutionDescription>Rcc'ing %(Identity)...</ExecutionDescription>
<OutputFile>.\GeneratedFiles\qrc_%(Filename).cpp</OutputFile>
</QtRcc>
</ItemDefinitionGroup>
<ItemGroup>
<QtUic Include="VisionController.ui" />
</ItemGroup>
<ItemGroup>
<QtRcc Include="VisionController.qrc" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\VisionController\main.cpp" />
<ClCompile Include="..\..\src\VisionController\VisionController.cpp" />
</ItemGroup>
<ItemGroup>
<QtMoc Include="..\..\src\VisionController\VisionController.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
</ImportGroup>
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties MocDir=".\GeneratedFiles\$(ConfigurationName)" UicDir=".\GeneratedFiles" RccDir=".\GeneratedFiles" lupdateOptions="" lupdateOnBuild="0" lreleaseOptions="" Qt5Version_x0020_x64="5.9.4_msvc2017_64" MocOptions="" />
</VisualStudio>
</ProjectExtensions>
</Project>

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Form Files">
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
<Extensions>ui</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}</UniqueIdentifier>
<Extensions>qrc;*</Extensions>
<ParseFiles>false</ParseFiles>
</Filter>
<Filter Include="Generated Files">
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
<Extensions>moc;h;cpp</Extensions>
<SourceControlFiles>False</SourceControlFiles>
</Filter>
</ItemGroup>
<ItemGroup>
<QtUic Include="VisionController.ui">
<Filter>Form Files</Filter>
</QtUic>
</ItemGroup>
<ItemGroup>
<QtRcc Include="VisionController.qrc">
<Filter>Resource Files</Filter>
</QtRcc>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\VisionController\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\VisionController\VisionController.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="..\..\src\VisionController\VisionController.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup>
</Project>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QTDIR>D:\Qt\Qt5.9.4\5.9.4\msvc2017_64</QTDIR>
<LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QTDIR>D:\Qt\Qt5.9.4\5.9.4\msvc2017_64</QTDIR>
<LocalDebuggerCommand>$(SolutionDir)..\runner17\$(ProjectName).exe</LocalDebuggerCommand>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>
</PropertyGroup>
</Project>
Loading…
Cancel
Save