diff --git a/config/tcpServer.json b/config/tcpServer.json new file mode 100644 index 0000000..ccc2e27 --- /dev/null +++ b/config/tcpServer.json @@ -0,0 +1,6 @@ +{ + "address": { + "IP": "127.0.0.1", + "Port": "9900" + } +} diff --git a/runner17/MvIOInterfaceBox.dll b/runner17/MvIOInterfaceBox.dll new file mode 100644 index 0000000..63d1e93 Binary files /dev/null and b/runner17/MvIOInterfaceBox.dll differ diff --git a/runner17/MvSerial.dll b/runner17/MvSerial.dll new file mode 100644 index 0000000..678152d Binary files /dev/null and b/runner17/MvSerial.dll differ diff --git a/src/IOController/IOController.cpp b/src/IOController/IOController.cpp new file mode 100644 index 0000000..a744cc4 --- /dev/null +++ b/src/IOController/IOController.cpp @@ -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; +} \ No newline at end of file diff --git a/src/IOController/IOController.h b/src/IOController/IOController.h new file mode 100644 index 0000000..9281c34 --- /dev/null +++ b/src/IOController/IOController.h @@ -0,0 +1,51 @@ +#ifndef _H_IOController_H_ +#define _H_IOController_H_ + +//#define MAX_DEVICE 6 + +#include + +#include +#include +#include +#include + +#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 m_mpComsHandle; + //QMap m_mpStIOSerial; + QMap m_mpComsState; + std::string m_comName; +}; + +#endif // !_H_IOController_H_ + diff --git a/src/IOController/NewSdkInc/MvErrorDefine.h b/src/IOController/NewSdkInc/MvErrorDefine.h new file mode 100644 index 0000000..e5bb832 --- /dev/null +++ b/src/IOController/NewSdkInc/MvErrorDefine.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_ diff --git a/src/IOController/NewSdkInc/MvIOInterfaceBox.h b/src/IOController/NewSdkInc/MvIOInterfaceBox.h new file mode 100644 index 0000000..e60d6f0 --- /dev/null +++ b/src/IOController/NewSdkInc/MvIOInterfaceBox.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:ÈçÐ迪Æôijһ·ÊäÈëÑØ¼ì²â»òÕ߹رÕÑØ¼ì²â¹¦ÄÜ£¬ÐèÒªÔڸýӿÚÖ®ºóµ÷Óà | 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:1±íʾ¿ªÆôDebugview, 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 diff --git a/src/IOController/NewSdkInc/MvIOInterfaceBoxDefine.h b/src/IOController/NewSdkInc/MvIOInterfaceBoxDefine.h new file mode 100644 index 0000000..63f4354 --- /dev/null +++ b/src/IOController/NewSdkInc/MvIOInterfaceBoxDefine.h @@ -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:ÊäÈëºÍÊä³öµÄ7¸öPort¿Ú¾ùÓÃÕâ7¸öºê¶¨Òå±íʾ | 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:´¥·¢ºó³£ÁÁ»¹Êdz£Ãð | 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 + diff --git a/src/TcpServer/TcpServer.cpp b/src/TcpServer/TcpServer.cpp new file mode 100644 index 0000000..51959ca --- /dev/null +++ b/src/TcpServer/TcpServer.cpp @@ -0,0 +1,98 @@ +#include "Tcpserver.h" +#include +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); +// } +//} \ No newline at end of file diff --git a/src/TcpServer/TcpServer.h b/src/TcpServer/TcpServer.h new file mode 100644 index 0000000..1a1adea --- /dev/null +++ b/src/TcpServer/TcpServer.h @@ -0,0 +1,72 @@ +#ifndef _H_TCPSERVER_H_ +#define _H_TCPSERVER_H_ + +#include +#include + +#include +#include +#include + +//#include "tcpsocket.h" + +#include + +#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_ diff --git a/src/VisionController/VisionController.cpp b/src/VisionController/VisionController.cpp new file mode 100644 index 0000000..fe12660 --- /dev/null +++ b/src/VisionController/VisionController.cpp @@ -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); +} \ No newline at end of file diff --git a/src/VisionController/VisionController.h b/src/VisionController/VisionController.h new file mode 100644 index 0000000..5cc5860 --- /dev/null +++ b/src/VisionController/VisionController.h @@ -0,0 +1,37 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#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 }; +}; diff --git a/src/VisionController/main.cpp b/src/VisionController/main.cpp new file mode 100644 index 0000000..f0926b2 --- /dev/null +++ b/src/VisionController/main.cpp @@ -0,0 +1,10 @@ +#include "VisionController.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + VisionController w; + w.show(); + return a.exec(); +} diff --git a/tpvs17/IOController/IOController.vcxproj b/tpvs17/IOController/IOController.vcxproj new file mode 100644 index 0000000..ee9512e --- /dev/null +++ b/tpvs17/IOController/IOController.vcxproj @@ -0,0 +1,115 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {FB680084-3EA6-4ECA-BC68-2644C45CC825} + Qt4VSv1.0 + 10.0.17763.0 + + + + DynamicLibrary + v141 + + + DynamicLibrary + v141 + + + + $(MSBuildProjectDirectory)\QtMsBuild + + + $(SolutionDir)$(Platform)\$(Configuration)\ + + + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + + + + + + + + + + + + + + + + true + UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;IOCONTROLLER_LIB;%(PreprocessorDefinitions) + .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;%(AdditionalIncludeDirectories) + Disabled + ProgramDatabase + MultiThreadedDebugDLL + true + + + Windows + $(OutDir)\$(ProjectName).dll + $(QTDIR)\lib;%(AdditionalLibraryDirectories) + true + qtmaind.lib;Qt5Cored.lib;%(AdditionalDependencies) + + + UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;IOCONTROLLER_LIB;%(PreprocessorDefinitions) + .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;%(AdditionalIncludeDirectories) + + + + + true + UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;IOCONTROLLER_LIB;%(PreprocessorDefinitions) + .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(SolutionDir)..\src\IOController\NewSdkInc;%(AdditionalIncludeDirectories) + + MultiThreadedDLL + true + + + Windows + $(SolutionDir)..\runner17\$(ProjectName).dll + $(QTDIR)\lib;$(QTDIR);$(OutDir);%(AdditionalLibraryDirectories) + false + qtmain.lib;Qt5Core.lib;MvIOInterfaceBox.lib;%(AdditionalDependencies) + + + UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;IOCONTROLLER_LIB;%(PreprocessorDefinitions) + .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(SolutionDir)..\src\IOController\NewSdkInc;%(AdditionalIncludeDirectories) + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tpvs17/IOController/IOController.vcxproj.filters b/tpvs17/IOController/IOController.vcxproj.filters new file mode 100644 index 0000000..0280666 --- /dev/null +++ b/tpvs17/IOController/IOController.vcxproj.filters @@ -0,0 +1,50 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} + qrc;* + false + + + {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} + qrc;* + false + + + {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} + moc;h;cpp + False + + + {549a6910-6555-4b27-a3de-dec5b66aca6a} + + + + + Header Files\NewSdkInc + + + Header Files\NewSdkInc + + + Header Files\NewSdkInc + + + Header Files + + + + + Source Files + + + \ No newline at end of file diff --git a/tpvs17/IOController/IOController.vcxproj.user b/tpvs17/IOController/IOController.vcxproj.user new file mode 100644 index 0000000..4195e6b --- /dev/null +++ b/tpvs17/IOController/IOController.vcxproj.user @@ -0,0 +1,12 @@ + + + + + D:\Qt\Qt5.9.4\5.9.4\msvc2017_64 + PATH=$(QTDIR)\bin%3b$(PATH) + + + D:\Qt\Qt5.9.4\5.9.4\msvc2017_64 + PATH=$(QTDIR)\bin%3b$(PATH) + + \ No newline at end of file diff --git a/tpvs17/TcpServer/TcpServer.vcxproj b/tpvs17/TcpServer/TcpServer.vcxproj new file mode 100644 index 0000000..d817062 --- /dev/null +++ b/tpvs17/TcpServer/TcpServer.vcxproj @@ -0,0 +1,117 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {58DB7028-F0B5-4D49-AE6C-F29CE2942198} + Qt4VSv1.0 + 10.0.17763.0 + + + + DynamicLibrary + v141 + + + DynamicLibrary + v141 + + + + $(MSBuildProjectDirectory)\QtMsBuild + + + $(SolutionDir)$(Platform)\$(Configuration)\ + + + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + + + + + + + + + + + + + + + + true + UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;QT_NETWORK_LIB;TCPSERVER_LIB;%(PreprocessorDefinitions) + .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtNetwork;%(AdditionalIncludeDirectories) + Disabled + ProgramDatabase + MultiThreadedDebugDLL + true + + + Windows + $(OutDir)\$(ProjectName).dll + $(QTDIR)\lib;%(AdditionalLibraryDirectories) + true + qtmaind.lib;Qt5Cored.lib;Qt5Networkd.lib;%(AdditionalDependencies) + + + UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;QT_NETWORK_LIB;TCPSERVER_LIB;%(PreprocessorDefinitions) + .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtNetwork + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + Moc'ing %(Identity)... + + + + + true + UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_NETWORK_LIB;TCPSERVER_LIB;%(PreprocessorDefinitions) + .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtNetwork;%(AdditionalIncludeDirectories) + None + MultiThreadedDLL + true + MaxSpeed + + + Windows + $(SolutionDir)..\runner17\$(ProjectName).dll + $(QTDIR)\lib;%(AdditionalLibraryDirectories) + false + qtmain.lib;Qt5Core.lib;Qt5Network.lib;%(AdditionalDependencies) + + + UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_NETWORK_LIB;TCPSERVER_LIB;%(PreprocessorDefinitions) + .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtNetwork + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + Moc'ing %(Identity)... + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tpvs17/TcpServer/TcpServer.vcxproj.filters b/tpvs17/TcpServer/TcpServer.vcxproj.filters new file mode 100644 index 0000000..3021139 --- /dev/null +++ b/tpvs17/TcpServer/TcpServer.vcxproj.filters @@ -0,0 +1,38 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} + qrc;* + false + + + {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} + qrc;* + false + + + {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} + moc;h;cpp + False + + + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff --git a/tpvs17/TcpServer/TcpServer.vcxproj.user b/tpvs17/TcpServer/TcpServer.vcxproj.user new file mode 100644 index 0000000..4195e6b --- /dev/null +++ b/tpvs17/TcpServer/TcpServer.vcxproj.user @@ -0,0 +1,12 @@ + + + + + D:\Qt\Qt5.9.4\5.9.4\msvc2017_64 + PATH=$(QTDIR)\bin%3b$(PATH) + + + D:\Qt\Qt5.9.4\5.9.4\msvc2017_64 + PATH=$(QTDIR)\bin%3b$(PATH) + + \ No newline at end of file diff --git a/tpvs17/VisionController.sln b/tpvs17/VisionController.sln new file mode 100644 index 0000000..f22d4ee --- /dev/null +++ b/tpvs17/VisionController.sln @@ -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 diff --git a/tpvs17/VisionController/VisionController.qrc b/tpvs17/VisionController/VisionController.qrc new file mode 100644 index 0000000..771800c --- /dev/null +++ b/tpvs17/VisionController/VisionController.qrc @@ -0,0 +1,4 @@ + + + + diff --git a/tpvs17/VisionController/VisionController.ui b/tpvs17/VisionController/VisionController.ui new file mode 100644 index 0000000..9bed01d --- /dev/null +++ b/tpvs17/VisionController/VisionController.ui @@ -0,0 +1,214 @@ + + + VisionControllerClass + + + + 0 + 0 + 631 + 495 + + + + VisionController + + + + + + 10 + 0 + 611 + 441 + + + + Pannel + + + + + 10 + 20 + 271 + 131 + + + + Server Setting + + + + + 20 + 30 + 231 + 31 + + + + + + + IP: + + + + + + + + + + Port: + + + + + + + + + + + + 40 + 80 + 191 + 31 + + + + + + + Start + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Stop + + + + + + + + + + 320 + 30 + 281 + 191 + + + + Text Log + + + + + 20 + 20 + 251 + 131 + + + + + + + 20 + 160 + 75 + 23 + + + + Clear + + + + + + + 10 + 180 + 281 + 251 + + + + Client List + + + + + 10 + 20 + 261 + 221 + + + + + Num + + + + + IP + + + + + Port + + + + + + + + + + 0 + 0 + 631 + 23 + + + + + + TopToolBarArea + + + false + + + + + + + + + + diff --git a/tpvs17/VisionController/VisionController.vcxproj b/tpvs17/VisionController/VisionController.vcxproj new file mode 100644 index 0000000..6b3cbe3 --- /dev/null +++ b/tpvs17/VisionController/VisionController.vcxproj @@ -0,0 +1,140 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {B12702AD-ABFB-343A-A199-8E24837244A3} + Qt4VSv1.0 + 10.0.17763.0 + + + + Application + v141 + + + Application + v141 + + + + $(MSBuildProjectDirectory)\QtMsBuild + + + $(SolutionDir)$(Platform)\$(Configuration)\ + + + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + + + + + + + + + + + + + + + + true + UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions) + .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories) + Disabled + ProgramDatabase + MultiThreadedDebugDLL + true + + + Windows + $(OutDir)\$(ProjectName).exe + $(QTDIR)\lib;%(AdditionalLibraryDirectories) + true + qtmaind.lib;Qt5Cored.lib;Qt5Guid.lib;Qt5Networkd.lib;Qt5Widgetsd.lib;%(AdditionalDependencies) + + + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + Moc'ing %(Identity)... + .\GeneratedFiles;.;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtANGLE;$(QTDIR)\include\QtNetwork;$(QTDIR)\include\QtWidgets;%(AdditionalIncludeDirectories) + UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_CORE_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions) + + + Uic'ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h + + + Rcc'ing %(Identity)... + .\GeneratedFiles\qrc_%(Filename).cpp + + + + + true + UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions) + .\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) + None + MultiThreadedDLL + true + MaxSpeed + + + Windows + $(SolutionDir)..\runner17\$(ProjectName).exe + $(QTDIR)\lib;$(OutDir);%(AdditionalLibraryDirectories) + false + qtmain.lib;Qt5Core.lib;Qt5Gui.lib;Qt5Network.lib;Qt5Widgets.lib;IOController.lib;TcpServer.lib;%(AdditionalDependencies) + + + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + Moc'ing %(Identity)... + .\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) + UNICODE;_UNICODE;WIN32;WIN64;QT_DLL;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;QT_NETWORK_LIB;QT_WIDGETS_LIB;%(PreprocessorDefinitions) + + + Uic'ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h + + + Rcc'ing %(Identity)... + .\GeneratedFiles\qrc_%(Filename).cpp + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tpvs17/VisionController/VisionController.vcxproj.filters b/tpvs17/VisionController/VisionController.vcxproj.filters new file mode 100644 index 0000000..31b1a61 --- /dev/null +++ b/tpvs17/VisionController/VisionController.vcxproj.filters @@ -0,0 +1,55 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} + qrc;* + false + + + {99349809-55BA-4b9d-BF79-8FDBB0286EB3} + ui + + + {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E} + qrc;* + false + + + {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11} + moc;h;cpp + False + + + + + Form Files + + + + + Resource Files + + + + + Source Files + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff --git a/tpvs17/VisionController/VisionController.vcxproj.user b/tpvs17/VisionController/VisionController.vcxproj.user new file mode 100644 index 0000000..2ad395e --- /dev/null +++ b/tpvs17/VisionController/VisionController.vcxproj.user @@ -0,0 +1,14 @@ + + + + + D:\Qt\Qt5.9.4\5.9.4\msvc2017_64 + PATH=$(QTDIR)\bin%3b$(PATH) + + + D:\Qt\Qt5.9.4\5.9.4\msvc2017_64 + $(SolutionDir)..\runner17\$(ProjectName).exe + WindowsLocalDebugger + PATH=$(QTDIR)\bin%3b$(PATH) + + \ No newline at end of file diff --git a/tpvs17/x64/Release/MvIOInterfaceBox.lib b/tpvs17/x64/Release/MvIOInterfaceBox.lib new file mode 100644 index 0000000..55387e0 Binary files /dev/null and b/tpvs17/x64/Release/MvIOInterfaceBox.lib differ