diff --git a/commdll/Include/MEyeVision.h b/commdll/Include/MEyeVision.h new file mode 100644 index 0000000..90e9dd0 --- /dev/null +++ b/commdll/Include/MEyeVision.h @@ -0,0 +1,399 @@ +// GPVisionHS.h: interface for the CGPVisionHS class. +// +////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "GPVision.h" + +#include +#include +#include +#include + +#include "VisionBase.h" +#include "FileLog.h" +#include "VisionMultiUnitResult.h" +#include "ICameraId.h" + +#include "KeyValue.h" +#include "MeyeVisionProtocol.h" + + +#ifdef BUILD_COMMDLL +#define COMMDLL_DLLCLASS __declspec(dllexport) +#else +#define COMMDLL_DLLCLASS __declspec(dllimport) +#endif + +constexpr auto MAX_UNIT = 2048; + +struct stGPMultiUnitDataResult +{ + std::string strResult; + double dResult1; + double dResult2; + double dResult3; + double dResult4; +}; + +using namespace std; + +class COMMDLL_DLLCLASS CMEyeVision : public VISION_BASE::CVisionBase +{ +public: + // + enum INFO_TYPE + { + INFO_MODELNAME = 1, + INFO_CURRENT_PACKAGENAME, + INFO_PACKAGENAME, + INFO_CURRENT_PACKAGEID, + INFO_5ME, // reply R - OK, F - Directory not found, B - files or parameters errors + }; + + // New Command for Intel Design + enum class CMD_CODE // For %10x + { + MODULE_ENABLE = 1, + SKIP_A_UNIT, + SKIP_INSP_MOD, + OBJ_ID_MOD, + LIVE_MODE, + LIGHT_ADJ, + LIGHT_INTENSITY, + SKIP_COUNT, + OBJ_ID_INC_MODE, + GRR, + SHOW_MODEL, + LOAD_IMAGE, + SAVE_IMAGE, // 13 + // according to 29Apr19 protocol doc + INSPECT_GRR, + COMPUTE_GRR, + RENAME_REJ_IMAGE, + DEL_REJ_IMAGE, + READ_PICKUP_ENCODER, + SAVE_REJ_IMAGE_FOLDER, + RECORD_MEASUREMENT, + FORCE_RESULT, + }; + + enum CMD_CODE_STATUS // For %11x + { + CMD_MODULE_STATUS = 1, + CMD_TEACH_STATUS, + }; + + enum class MODULEID + { + MOD_GENERAL = 0x000000, + MOD_PACKAGELOCATE = 0x000001, + MOD_PIN1INSPECTION = 0x000002, + MOD_MARKINSPECTION = 0x000004, + MOD_PACKAGEINSPECTION = 0x000008, + MOD_2DMATRIXINSPECTION = 0x000010, + MOD_BGA2DINSPECTION = 0x000020, + MOD_CSPPADINSPECTION = 0x000040, + MOD_REFERENCELOCATE = 0x000080, + MOD_PATTERNLOCATE = 0x000100, + MOD_CALIBRATION = 0x000200, + MOD_OCRINSPECTION = 0x000400, + MOD_SURFACEINSPECTION = 0x000800, + MOD_LEADINSPECTION2DTYPE1 = 0x001000, + MOD_LEADINSPECTION3D = 0x020000, + MOD_MEASUREMENT = 0x100000, + MOD_WAFEROCRINSPECTION = 0x200000, + MOD_POSTSEALINSPECTION = 0x400000, + MOD_WAFERSURFACEINSPECTION = 0x1000000, + MOD_ADVSURFACEINSPECTION = 0x2000000, + MOD_QFNINSPECTION = 0x10000000, + MOD_GPI = 0x40000000, + }; + + enum class RESOLUTION + { + X = 1, + Y, + }; + + enum class OCR_PARAM_ID + { + FONT_NAME = 1, + MARK_FORMAT, + }; + + enum class ADV_SURFACE_ID + { + SURFACE_1 = 1, + SURFACE_2, + }; + + enum class PATTERN_LOCATION_TYPE + { + ADJUST_PATTERN = 1, + RETRIEVE_PATTERN, + }; + + enum class SAVE_IMG_TYPE + { + REJ, + FORCE_PASS, + GOOD, + }; + + CMEyeVision(const std::string& strMutexName = _T("vision_mutex"), size_t nMaxStation = MAX_VISION_STATION); + ~CMEyeVision() final; + + bool StartPatternLocationInspection(int nStationNo, PATTERN_LOCATION_TYPE eType); + + bool StartPostSealInspection(int nStationNo); + bool StartOTFInspection(int nStationNo); + bool StartInTapeInspection(int nStationNo); + + __declspec(deprecated("Use StartInspectPosition() instead")) bool StartInspectTapePosition(int nStationNo, int nReferencePt = 1); + // + bool StartInspectPosition(int nStationNo, int nReferencePt = 1); // Generalise Position Inspection + bool StartCalibratePosition(int nStationNo, int nReferencePt = 1); // For Position Calibration (XYTheta) + bool StartOTFCalibratePosition(int nStationNo, int nReferencePt = 1, int nIncrementMode = 1); + bool WaitStartScanLoopAck(int nStationNo, DWORD dwTimeout); + bool RequestOTFGetReady(int nStationNo, int nReferencePt = 1, int nIncrementMode = 1, TWO_TYPE_INSPECTION nTwoTypeInsp = TWO_TYPE_INSPECTION::DISABLED); + bool StartInspect(int nStationNo, int nInspectType = 0, int nEdge = 1, TWO_TYPE_INSPECTION nTwoTypeInsp = TWO_TYPE_INSPECTION::DISABLED) override; + + __declspec(deprecated("Use StartInspect() instead")) bool StartPnpThetaHomeInspection(int nStationNo); + + bool StartTeach(int nStationNo, int nInspectType, int nEdge = 1); + bool StartLightVerification(int nStationNo); + void ReceiveComm(const char* cpcBuffer, int nSize) override; + + int WaitInTeachOrCapture(int nStationNo, DWORD dwTimeout); // Monitor Either InTeach or Capture + bool Get2DMatrixResult(int nStationNo, std::string& str2DMatrixResult); + + bool StartTeachPosition(int nStationNo, int nIndexX, int nIndexY, int nColFOV, int nRowFOV); + bool StartInspectPosition(int nStationNo, int nIndexX, int nIndexY, int nColFOV, int nRowFOV); + bool GetMultiUnitResult(int nStationNo, stGPMultiUnitDataResult& st_MultiUnitResult, int nUnitID); + bool WaitResultReady(int nStationNo, DWORD dwTimeout, bool bMultiUnit = false); + bool SetFOVOffset(int nStationNo, double dOffsetX = 0.0, double dOffsetY = 0.0); + + __declspec(deprecated("Use SetClusterID() instead")) bool SetFOVPosition(int nStationNo, std::string strStripID, int nDeviceCluster = -1); + + bool SetUnitXYPos(int nStationNo, double dX, double dY); + bool SetUnitColRow(int nStationNo, int nCol, int nRow); + bool SetInspectIndex(int nStationNo, int nIndexX, int nIndexY); + bool SetClusterID(int nStationNo, std::string csClusterID); + bool SetUnitID(int nStationNo, int nUnitNo, std::string csID); + + // This function is used to set inspection type for OTF inspection before trigger OTF + bool SetInspectionType(int nStationNo, int nType); + + // Deprecated + __declspec(deprecated("Use SetClusterID() & SetInspectIndex() instead")) bool SendReelNoPocketNo(int nStationNo, int iReel, int iPocket); + + // Stored Image Handling + bool SetRejectImageSavingOn(int nStationNo, bool bOn = true); + bool WaitImageLoadReady(int nStationNo, DWORD dwTimeout); + bool LoadStoredImage(int nStationNo, std::string csStripID, int nInspectedX = 1, int nInspectedY = 1); + bool GetImageLoadResult(int nStationNo, std::string& csImageLoadResult); + + // Buffering Mode Command (Similar to OTF command) + bool RequestStartBufferingGetReady(int nStationNo); + bool WaitStartBufferingLoopAck(int nStationNo, DWORD dwTimeout = 0); + bool RequestEndBufferingGetReady(int nStationNo); + bool WaitEndBufferingLoopAck(int nStationNo, DWORD dwTimeout = 0); + int GetNoOfBufferingCapture(int nStationNo); + + // Get Vision Info + std::string GetInfo(int nPackageID, std::string csParameter, DWORD dwTimeout = 0, bool bWaitAck = false); + bool WaitInfoReady(DWORD dwTimeout = 0); + bool GetInfoResult(std::string& csPackageNameResult); + + std::string GetModelNameInfo(DWORD dwTimeout = 0); + std::string GetPackageNameInfo(int nPackageID, DWORD dwTimeout = 0); + int GetPackageIdInfo(DWORD dwTimeout = 0); + // + + // E30 Recipe Management + bool ReadRecipe(std::string csRecipeName, DWORD dwTimeout = 5000); + bool WriteRecipe(std::string csRecipeName, DWORD dwTimeout = 5000); + + // 5M+E + bool Write5mE(DWORD dwTimeout = 5000); + bool SaveRejectImage(int nStationNo, bool bEnableSave); + bool SaveGoodImage(int nStationNo, bool bEnableSave); + // + void VerifyAndInitVariable(); + void SetDryRunWithoutMaterial(bool bEnable = false); + + bool IsGPVisionMutexFree(); + + bool InitParameterFile(bool bWrite); + + // Ported from C330 + bool EnableVisionStation(const std::vector& vecApp); + bool UpdateStationStatus(const std::vector& vecEnabledList); + + bool SwitchAppWindow(int nStationNo, DWORD dwTimeout = 5000) override; + bool MultipleAppWindow(bool bEnable = true, DWORD dwTimeout = 5000) override; + bool StartStopGrr(int nStationNo, int nUnit, int nCycle, bool bOn); + + bool SetOCRText(int nStationNo, std::string strOCRTextList); + + bool SetOCRParam(int nStationNo, int nParamID, std::string strParamValue); + bool GetOCRParam(int nStationNo, int nParamID, std::string& strParamValue); + + bool SetModuleEnable(int nStationNo, int nInspectionModule, bool bEnable = true); + bool IsModuleEnable(int nStationNo, int nInspectionModule, int nSetNo = 1); + + double GetResolution(int nStationNo, bool bXResolution); + bool IsSemiT10Enable(int nStationNo); + bool IsRefLocateEnable(int nStationNo); + + int GetInspectionSequence(int nStationNo); + bool IsDiagLogDataEnable(int nStationNo); + bool IsDiagResultAlwaysGood(int nStationNo); + + bool RequestSkipInspMod(int nStationNo, int nModuleId, int nSetId, bool bSkip); + + // Revised Base class routine + bool SendMsg(const std::string& strMsg, DWORD dwTimeout, bool bWaitAck = false) override; + bool SendCommand(const std::string& strCommand, bool bWaitAck = false, DWORD dwTimeout = 5000) override; + bool WaitImageTaken(int nStationNo, DWORD dwTimeout = 0) override; + bool Run() override; + bool Stop() override; + bool DataEnd() override; + bool DataStart() override; + bool SetLotNumber(const std::string& strLotNumber) override; + bool SetLotSize(long lLotSize) override; + bool SetPackageID(long lPackageID) override; + bool SetOperatorID(const std::string& strOperatorID) override; + bool SetMachineName(const std::string& strName) override; + bool SetGrossUPH(long lGrossUPH) override; + bool SetNetUPH(long lNetUPH) override; + bool SetShiftID(const std::string& strShiftID) override; + + bool CloseLot(DWORD dwTimeout = 5000) override; + bool OpenLot(int nPackageID, DWORD dwTimeout = 5000) override; + bool OpenLot(const std::string& strPackageName, DWORD dwTimeout = 5000) override; + bool IsTeachingValid(int nStationNo, int nTypeID) override; + + // Data Logging + void SetLogEnable(bool bEnable = true); + void SetLogFilename(const std::string& csFilename); + // + void InitParameters(int nStationNo, int nNoOfUnitsResult, std::vector& pnGx, std::vector& pnLx, std::vector& pnDataSetType, int nNoOfDataSetType = 1); + CVisionUnitResult* GetMultiUnitResult(int nStationNo, int nUnitNo, int nCat); + int GetTotalUnits(int nStationNo); + + // + // Save the current reject image to the dedicated folder. Acknowledge R if OK or F if error. + bool SaveCurrentImage(int nStationNo, SAVE_IMG_TYPE eImgType, std::string strUniqueID = _T("")); + + bool ForcePass(int nStationNo, int nUnitID = 1); + + bool CameraLiveCapture(int nStationNo, bool bOn = true, int nType = 1) override; + + // + void InitLocalLoopback(const std::string& strIpAddress); + void ResetInspectionEvents(int nStationNo); + + // Handler request the last reading of package size from GP + bool QueryPackageSize(int nStationNo, int ParamID); + bool WaitPackageSizeReady(int nStationNo, DWORD dwTimeout); + void GetPackageSize(int nStationNo, CMyPoint& ptResult); + // + bool SetCustomInspectionType(int nStationNo, int nType); + + bool SetInspectionInfo(int nStationNo, std::string strID, CPoint ptXY); + + size_t GetMaxStnInUse() { return m_nMaxStnInUse; } + void SetMaxStnInUse(size_t nMaxStnInUse) { m_nMaxStnInUse = nMaxStnInUse; } + +private: + void InitPviTokenConfig(); + int GetPviParamNo(int nDataSetNum, int nTokenPos); + // + + virtual bool ProcessDollarUnitDataSet(string& strData, CVisionUnitResult* pVisionBuffer, int nDataSetType, bool bAbsPosition = false); // $ protocol + + virtual bool ProcessExclamationUnitDataSet(string& strData, CVisionUnitResult* pVisionBuffer, int nDataSetType); // ! protocol + + virtual bool ProcessAndUnitDataSet(string& strData, CVisionUnitResult* pVisionBuffer, int nDataSetType); // & protocol + + bool DecodeCameraType(const string& strCamera, int& nCameraIndex, int& nDataType); + + bool IsValidStationNo(int nStationNo); + + void ResetReceiveBuffer(); + string TranslateResCode(const string& strCode); + + void SaveLogData(const std::string& strMsg); + + // Attributes + // Option + bool m_bDryRunWithoutMaterial{ false }; + + CMeyeVisionProtocol m_protocol; + + HANDLE m_hInfoReady; + HANDLE m_hNAck1; + HANDLE m_hNAck2; + + std::vector m_hStartScanLoopReady; + std::vector m_hImageLoadReady; + std::vector m_hMultiUnitResultReady; + std::vector m_hStartBufferingReady; + std::vector m_hEndBufferingReady; + std::vector m_hModuleStatusReady; + std::vector m_hResolutionResultReady; + std::vector m_hSemiT10ResultReady; + std::vector m_hGeneralResultReady; + std::vector m_hOcrParamReady; + std::vector m_hPackageSizeReady; + + vector m_vec2DMatrixResult; + vector m_vecImageLoadResult; + string m_strInfoResult; + string m_strOcrParamValue; + + std::vector> m_stMultiUnitResult; + //// + // Ported from TH800UV to handle Semi-T10 format + std::vector m_visionMultiUnitResult; + + std::vector m_nRowFOV; + std::vector m_nColFOV; + std::vector m_nNoOfBufferingCapture; // For tracking of bufferring capture + std::vector m_dResolutionData; + std::vector m_nInspectSeq; + std::vector m_strUniqueId; // For tracking of unique Id issue upon inspection + // + bitset m_bsStartBufferingMode; + bitset m_bsModuleStatusEnable; + bitset m_bsSemiT10Enable; + bitset m_bsTeachingValid; + bitset m_bsDiagResultAlwaysGood; + bitset m_bsDiagLogDataEnable; + + // + std::map> m_mapDataSetConfig; + + size_t m_nMaxStnInUse; + // Logging + CCriticalSection m_criticalSectionFileLog; + CFileLog m_FileLog; + bool m_bLogEnable; + + bool m_bLocalLoopback{ false }; + // E30 + string m_strLoadedPkg; + string m_strLastError; + + // + std::unique_ptr m_camId; + string m_strOneLine; + string m_strDryRunExceptionCode; + + std::vector m_ptPackageSize; + + CKeyValue m_tokenizer; +}; diff --git a/commdll/Include/MeyeVisionProtocol.h b/commdll/Include/MeyeVisionProtocol.h new file mode 100644 index 0000000..dbf424b --- /dev/null +++ b/commdll/Include/MeyeVisionProtocol.h @@ -0,0 +1,130 @@ +#pragma once + +#include +#include + +enum class eLotInfoCode +{ + // Lot info types for comm. + COMM_LOT_NUMBER = 1, + COMM_LOT_SIZE = 2, + COMM_PACKAGE_TYPE = 3, + COMM_OPERATOR_ID = 4, + COMM_MACHINE_NAME = 5, + COMM_GROSS_UPH = 6, + COMM_NET_UPH = 7, + COMM_SHIFT = 8, + COMM_DEVICE_ID = 9 +}; + +enum class eClientCode +{ + // Info requested by handler + APPLICATION_NAME = 51, + CURRENT_PACKAGE_TYPE = 52, + REQUEST_PACKAGE_TYPE = 53, + REQUEST_PACKAGE_ID = 54, + REQUEST_SYSTEM_SETTINGS = 55, + REQUEST_LOT_OPEN_STATUS = 56, + ENABLE_DISABLE_STATION = 57, + + // RTR Info requested by handler + REQUEST_RTR_SYSTEM_INFO = 60, + REQUEST_RTR_RECIPE_MODE = 61, + RECEIVE_RTR_HANDLER_INFO = 62, + + // Special commands from handler + RESET_STATISTIC = 88, + WRITE_RECIPE = 89, + READ_RECIPE = 90, + REMOTE_MODE = 91, + PARAMETER_ACCESS_CONTROL = 92, + SHOW_MULTIPLE_DISPLAY_WND = 93, + WAFER_ID = 94, + SELECT_APPLICATION = 95, + NEW_LOT_PKG_NAME = 96, + REEL_NUMBER = 97, + PRINT_SUMMARY = 98, + NEW_LOT_PKG_ID = 99, + + +}; + +enum class eVisionCode +{ + // Command from Vision to handler + LOT_PARAM_READY = 98, + LOT_PARAM_CHANGED = 99 +}; + +enum class eRequestInfo +{ + CURRENT_POSITION = 1 +}; + +enum class eStatusCmd +{ + MODULE_STATUS = 1, + TEACH_STATUS = 2, + OTF_STATUS = 3 +}; + +class CMeyeVisionProtocol +{ +public: + CMeyeVisionProtocol(); + + int GetAppId(char chApp); + + bool IsTrailer(char chTrailer); + bool IsSyncBlock(const std::string& strSyncBlock); + + char GetAppSOT(int nAppId); + char GetAppSOS(int nAppId); + char GetAppEOS(int nAppId); + + std::string Ack(); + std::string Nack(); + std::string Nack2(); + + std::string RunMode(); + std::string StopMode(); + + std::string Command(const std::string& strApp); + + std::string SOTAck(int nAppId); + std::string SOSAck(int nAppId); + std::string EOSAck(int nAppId); + + std::string PictureTaken(int nAppId, bool bLongProcess); + std::string LotOpenStatus(const std::string& strLotNumber); + + std::string FrameMsg(const std::string& strMsg); + + std::string LotParamReady(const std::string& strFile); + std::string ParamChange(int nParamChangeCount); + + std::string RequestInfo(int nVAppId, eRequestInfo eInfoType); + std::string ReplySpecialInfo(eClientCode eInfoCode, const std::string& strParam); + + std::string OperationDone(int nVAppId, int nState); + + std::string RTRSysInfo(int nInfo, const std::string& strSysInfo); + std::string RTRRecipeMode(int nMode); + + std::string ModuleGrrResult(int nVAppId, int nModuleID, const std::string& strResult); + + std::string LoadRejectImageProgress(int nVAppId, bool bInProgress); + + std::string RequestStatus(int nVAppId, eStatusCmd eCode, int nID1, int nID2, int nStatus); + + [[deprecated("Old Protocol. Use RequestStatus() instead")]] + std::string RequestStatusOld(int nVAppId, int nID1, int nID2, int nStatus); + + std::string RequestParam(int nVAppId, int nModuleID, int nSetID, int nParamID, const std::string& strValue); + + std::string RequestOcrParam(int nVAppId, int nModuleID, int nSetID, int nParamID, const std::string& strValue); + +private: + std::array m_arrSOIList; +}; diff --git a/commdll/Include/TCPIP/VisionNW.h b/commdll/Include/TCPIP/VisionNW.h index 152cf0f..8fd1380 100644 --- a/commdll/Include/TCPIP/VisionNW.h +++ b/commdll/Include/TCPIP/VisionNW.h @@ -34,7 +34,7 @@ public: bool m_bTraceData; protected: - BOOL Send(std::string strMsg); + BOOL Send(const std::string& strMsg); BOOL IsConnectedToServer(void); BOOL IsServerActive(void); BOOL IsClientConnected(void); diff --git a/commdll/Include/VisionBase.h b/commdll/Include/VisionBase.h new file mode 100644 index 0000000..85666d0 --- /dev/null +++ b/commdll/Include/VisionBase.h @@ -0,0 +1,138 @@ +// GPVision.h: interface for the CGPVision class. +// +////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include + +#include "VisionNW.h" +#include "utility.h" + +#ifdef BUILD_COMMDLL +#define COMMDLL_DLLCLASS __declspec(dllexport) +#else +#define COMMDLL_DLLCLASS __declspec(dllimport) +#endif + +namespace VISION_BASE +{ + + constexpr size_t MAX_VISION_STATION = 20; + + enum NEXT_SOT + { + REF_AUTO_CALIBRATION = 2, + RESOLUTION_AUTO_CALIBRATION, + MANUAL_TEACH, + INSPECTION, + }; + + enum TYPE_ID + { + TYPE1 = 1, + TYPE2, + TYPE3, + TYPE4, + TYPE5, + TYPE6, + TYPE7, + }; + + struct stGPDoubleDataResult + { + double dResult1{ 0. }; + double dResult2{ 0. }; + double dResult3{ 0. }; + double dResult4{ 0. }; + }; + + class CScanner; + + class COMMDLL_DLLCLASS CVisionBase : public CVisionNW + { + public: + enum class TWO_TYPE_INSPECTION + { + DISABLED = 0, + INDEPENDENT_INSP, + ONE_TRIGGER_INSP, + }; + + CVisionBase(std::string csMutexName = _T("vision_mutex"), size_t nMaxStation = MAX_VISION_STATION); + virtual ~CVisionBase(); + + // feature to enable/disable multiple app display. Used along with SwitchAppWindow + virtual bool MultipleAppWindow(bool bEnable, DWORD dwTimeout = 5000) = 0; + + virtual bool SwitchAppWindow(int nStationNo, DWORD dwTimeout = 5000) = 0; + bool IsLotOpen() const; + bool WaitInTeach(int nStationNo, DWORD dwTimeout); + bool WaitResultReady(int nStationNo, DWORD dwTimeout); + virtual bool WaitImageTaken(int nStationNo, DWORD dwTimeout = 0); + bool GetResult(int nStationNo, std::string& csResult); + std::string GetReceiveData(); + + bool IsConnectedToServer(); + void Disconnect(); + bool Connect(int nPortNo, std::string csIPAddress, bool bServer = true); + + virtual bool CameraLiveCapture(int nStationNo, bool bOn = true, int nType = 1) = 0; + virtual bool IsTeachingValid(int nStationNo, int nTypeID) = 0; + virtual bool SetShiftID(const std::string& csShiftID) = 0; + virtual bool SetNetUPH(long lNetUPH) = 0; + virtual bool SetGrossUPH(long lGrossUPH) = 0; + virtual bool SetMachineName(const std::string& csName) = 0; + virtual bool SetOperatorID(const std::string& csOperatorID) = 0; + virtual bool SetLotNumber(const std::string& strLotNumber) = 0; + virtual bool SetLotSize(long lLotSize) = 0; + virtual bool IsTeach(int nStationNo) = 0; + virtual bool IsRun() = 0; + virtual bool IsAck() = 0; + virtual bool Stop() = 0; + virtual bool Run() = 0; + virtual bool DataEnd() = 0; + virtual bool DataStart() = 0; + virtual bool SetPackageID(long lPackageID) = 0; + virtual bool GetResult(int nStationNo, stGPDoubleDataResult& st_dResult) = 0; + virtual bool CheckResultReady(int nStationNo) = 0; + virtual bool CloseLot(DWORD dwTimeout = 5000) = 0; + virtual bool OpenLot(int nPackageID, DWORD dwTimeout = 5000) = 0; + virtual bool OpenLot(const std::string& strPackageName, DWORD dwTimeout = 5000) = 0; + virtual bool CheckImageTaken(int nStationNo) = 0; + virtual bool StartInspect(int nStationNo, int nNextSOT = 0, int nEdge = 1, TWO_TYPE_INSPECTION nTypeID = TWO_TYPE_INSPECTION::DISABLED) = 0; + + virtual void ReceiveComm(const char* cpcBuffer, int nSize) = 0; + + HANDLE GetResultReadyHandle(int nStationNo); + HANDLE GetImageTakenHandle(int nStationNo); + + protected: + virtual bool SendCommand(const std::string& strCommand, bool bWaitAck = false, DWORD dwTimeout = 5000); + virtual bool GetStatus() = 0; + virtual bool SendMsg(const std::string& strMsg, DWORD dwTimeout, bool bWaitAck = false); + + CMutex m_VisionMutex; + + size_t m_nMaxStation{ MAX_VISION_STATION }; + HANDLE m_hAck; + HANDLE m_hStatusReady; + + std::vector m_hImageTaken; + std::vector m_hInTeach; + std::vector m_hResultReady; + std::vector m_hTeachValidReady; + + std::vector m_stResult; + std::vector m_vecResult; + + bool m_bRunMode{ false }; + char m_cReceiveData[MAXSOCKBUF]{}; + bool m_bTeachingValid{ false }; + bool m_bLotOpened{ false }; + char m_cRcvData[MAXSOCKBUF]{}; + + static bool m_bInitBefore; + }; +} \ No newline at end of file diff --git a/commdll/lib/commdll.lib b/commdll/lib/commdll.lib index 9701018..553f62c 100644 Binary files a/commdll/lib/commdll.lib and b/commdll/lib/commdll.lib differ diff --git a/commdll/lib/commdllD.lib b/commdll/lib/commdllD.lib index 921b951..efb1f7f 100644 Binary files a/commdll/lib/commdllD.lib and b/commdll/lib/commdllD.lib differ diff --git a/dll/commdll.dll b/dll/commdll.dll index 506f2cd..316262b 100644 Binary files a/dll/commdll.dll and b/dll/commdll.dll differ diff --git a/dll/commdllD.dll b/dll/commdllD.dll index 4c50517..06d8c2c 100644 Binary files a/dll/commdllD.dll and b/dll/commdllD.dll differ diff --git a/dll/iodll.dll b/dll/iodll.dll index 41be7f9..2256137 100644 Binary files a/dll/iodll.dll and b/dll/iodll.dll differ diff --git a/dll/iodllD.dll b/dll/iodllD.dll index 1187bf8..fa97214 100644 Binary files a/dll/iodllD.dll and b/dll/iodllD.dll differ diff --git a/dll/mcctrdll.dll b/dll/mcctrdll.dll index 00f0ad0..2be957f 100644 Binary files a/dll/mcctrdll.dll and b/dll/mcctrdll.dll differ diff --git a/dll/mcctrdllD.dll b/dll/mcctrdllD.dll index 7783337..cb68aa4 100644 Binary files a/dll/mcctrdllD.dll and b/dll/mcctrdllD.dll differ diff --git a/dll/secsgemdll.dll b/dll/secsgemdll.dll index d4bf44a..ab2af7c 100644 Binary files a/dll/secsgemdll.dll and b/dll/secsgemdll.dll differ diff --git a/dll/secsgemdllD.dll b/dll/secsgemdllD.dll index 2bca134..1d9496e 100644 Binary files a/dll/secsgemdllD.dll and b/dll/secsgemdllD.dll differ diff --git a/dll/utility.dll b/dll/utility.dll index 6a96547..ef7430d 100644 Binary files a/dll/utility.dll and b/dll/utility.dll differ diff --git a/dll/utilityD.dll b/dll/utilityD.dll index f4bb416..de63890 100644 Binary files a/dll/utilityD.dll and b/dll/utilityD.dll differ diff --git a/iodll/lib/iodll.lib b/iodll/lib/iodll.lib index 055b03a..cf995c2 100644 Binary files a/iodll/lib/iodll.lib and b/iodll/lib/iodll.lib differ diff --git a/iodll/lib/iodllD.lib b/iodll/lib/iodllD.lib index 5bc7ba4..4e5b357 100644 Binary files a/iodll/lib/iodllD.lib and b/iodll/lib/iodllD.lib differ diff --git a/mcctrdll/Include/MotorSubPositionParser.h b/mcctrdll/Include/MotorSubPositionParser.h index 28b6060..4d3616c 100644 --- a/mcctrdll/Include/MotorSubPositionParser.h +++ b/mcctrdll/Include/MotorSubPositionParser.h @@ -7,56 +7,56 @@ #include "DllDefines.h" -using stSubPosition = struct _stSubPosition{ +constexpr char* PATH_SUBPOSITIONS = "d:/machine/interprocess/runtime/subpositions/"; - std::string SubPositionName; - double PositionValue; - int PositionIndex; +using stSubPosition = struct _stSubPosition +{ - NLOHMANN_DEFINE_TYPE_INTRUSIVE(_stSubPosition, - SubPositionName, - PositionValue, - PositionIndex - ) + std::string SubPositionName; + double PositionValue; + int PositionIndex; + NLOHMANN_DEFINE_TYPE_INTRUSIVE(_stSubPosition, + SubPositionName, + PositionValue, + PositionIndex) }; -using stPosition = struct _stPosition { - - std::string PositionName; - std::vector SubPositions; +using stPosition = struct _stPosition +{ - NLOHMANN_DEFINE_TYPE_INTRUSIVE(_stPosition, - PositionName, - SubPositions - ) + std::string PositionName; + std::vector MotorSubPositions; + NLOHMANN_DEFINE_TYPE_INTRUSIVE(_stPosition, + PositionName, + MotorSubPositions) }; -using stMotor = struct _stMotor { +using stMotor = struct _stMotor +{ - std::string MotorName; - std::vector MotorPositions; + std::string MotorName; + std::vector MotorPositions; - NLOHMANN_DEFINE_TYPE_INTRUSIVE(_stMotor, MotorName, MotorPositions) + NLOHMANN_DEFINE_TYPE_INTRUSIVE(_stMotor, MotorName, MotorPositions) }; -using stRuntimeMotorSubPosition = struct _stRuntimeMotorSubPoistion { - - std::string ModuleName; - std::vector Motors; +using stRuntimeMotorSubPosition = struct _stRuntimeMotorSubPoistion +{ - NLOHMANN_DEFINE_TYPE_INTRUSIVE(_stRuntimeMotorSubPoistion, ModuleName, Motors) + std::string ModuleName; + std::vector Motors; + NLOHMANN_DEFINE_TYPE_INTRUSIVE(_stRuntimeMotorSubPoistion, ModuleName, Motors) }; class MCCTRDLLCLASS CMotorSubPositionParser { public: - bool Deserialize(const std::string& strFileName, stRuntimeMotorSubPosition& myOption); - bool Serialize(const std::string& strFilename, const stRuntimeMotorSubPosition& _myOption); + bool Deserialize(const std::string& strFileName, stRuntimeMotorSubPosition& myOption); + bool Serialize(const std::string& strFilename, const stRuntimeMotorSubPosition& _myOption); - bool Deserialize(const std::string& strFileName, std::vector& myOption); - bool Serialize(const std::string& strFilename, const std::vector& _myOption); + bool Deserialize(const std::string& strFileName, std::vector& myOption); + bool Serialize(const std::string& strFilename, const std::vector& _myOption); }; - diff --git a/mcctrdll/lib/mcctrdll.lib b/mcctrdll/lib/mcctrdll.lib index 2307345..f333383 100644 Binary files a/mcctrdll/lib/mcctrdll.lib and b/mcctrdll/lib/mcctrdll.lib differ diff --git a/mcctrdll/lib/mcctrdllD.lib b/mcctrdll/lib/mcctrdllD.lib index 8959eb4..576908e 100644 Binary files a/mcctrdll/lib/mcctrdllD.lib and b/mcctrdll/lib/mcctrdllD.lib differ diff --git a/secsgemdll/lib/secsgemdll.lib b/secsgemdll/lib/secsgemdll.lib index 9325fc3..05cd784 100644 Binary files a/secsgemdll/lib/secsgemdll.lib and b/secsgemdll/lib/secsgemdll.lib differ diff --git a/secsgemdll/lib/secsgemdllD.lib b/secsgemdll/lib/secsgemdllD.lib index a534756..3eb864d 100644 Binary files a/secsgemdll/lib/secsgemdllD.lib and b/secsgemdll/lib/secsgemdllD.lib differ diff --git a/utility/lib/utility.lib b/utility/lib/utility.lib index 26814ca..1a6a8d0 100644 Binary files a/utility/lib/utility.lib and b/utility/lib/utility.lib differ diff --git a/utility/lib/utilityD.lib b/utility/lib/utilityD.lib index 8d78a25..2b65bac 100644 Binary files a/utility/lib/utilityD.lib and b/utility/lib/utilityD.lib differ