MEyeVision
parent
d3deeb48cd
commit
eb0bcab757
@ -0,0 +1,399 @@
|
||||
// GPVisionHS.h: interface for the CGPVisionHS class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GPVision.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <bitset>
|
||||
|
||||
#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<bool>& vecApp);
|
||||
bool UpdateStationStatus(const std::vector<int>& 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<int>& pnGx, std::vector<int>& pnLx, std::vector<int>& 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<CR> if OK or F<CR> 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<HANDLE> m_hStartScanLoopReady;
|
||||
std::vector<HANDLE> m_hImageLoadReady;
|
||||
std::vector<HANDLE> m_hMultiUnitResultReady;
|
||||
std::vector<HANDLE> m_hStartBufferingReady;
|
||||
std::vector<HANDLE> m_hEndBufferingReady;
|
||||
std::vector<HANDLE> m_hModuleStatusReady;
|
||||
std::vector<HANDLE> m_hResolutionResultReady;
|
||||
std::vector<HANDLE> m_hSemiT10ResultReady;
|
||||
std::vector<HANDLE> m_hGeneralResultReady;
|
||||
std::vector<HANDLE> m_hOcrParamReady;
|
||||
std::vector<HANDLE> m_hPackageSizeReady;
|
||||
|
||||
vector<string> m_vec2DMatrixResult;
|
||||
vector<string> m_vecImageLoadResult;
|
||||
string m_strInfoResult;
|
||||
string m_strOcrParamValue;
|
||||
|
||||
std::vector<std::vector<stGPMultiUnitDataResult>> m_stMultiUnitResult;
|
||||
////
|
||||
// Ported from TH800UV to handle Semi-T10 format
|
||||
std::vector<CVisionMultiUnitResult> m_visionMultiUnitResult;
|
||||
|
||||
std::vector<int> m_nRowFOV;
|
||||
std::vector<int> m_nColFOV;
|
||||
std::vector<int> m_nNoOfBufferingCapture; // For tracking of bufferring capture
|
||||
std::vector<double> m_dResolutionData;
|
||||
std::vector<int> m_nInspectSeq;
|
||||
std::vector<string> m_strUniqueId; // For tracking of unique Id issue upon inspection
|
||||
//
|
||||
bitset<MAX_VISION_STATION> m_bsStartBufferingMode;
|
||||
bitset<MAX_VISION_STATION> m_bsModuleStatusEnable;
|
||||
bitset<MAX_VISION_STATION> m_bsSemiT10Enable;
|
||||
bitset<MAX_VISION_STATION> m_bsTeachingValid;
|
||||
bitset<MAX_VISION_STATION> m_bsDiagResultAlwaysGood;
|
||||
bitset<MAX_VISION_STATION> m_bsDiagLogDataEnable;
|
||||
|
||||
//
|
||||
std::map<int, std::map<int, CVisionResult::XYT_PVI_PARAM>> 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<CICameraId> m_camId;
|
||||
string m_strOneLine;
|
||||
string m_strDryRunExceptionCode;
|
||||
|
||||
std::vector<CMyPoint> m_ptPackageSize;
|
||||
|
||||
CKeyValue m_tokenizer;
|
||||
};
|
||||
@ -0,0 +1,130 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
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<std::string, 3> m_arrSOIList;
|
||||
};
|
||||
@ -0,0 +1,138 @@
|
||||
// GPVision.h: interface for the CGPVision class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#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<HANDLE> m_hImageTaken;
|
||||
std::vector<HANDLE> m_hInTeach;
|
||||
std::vector<HANDLE> m_hResultReady;
|
||||
std::vector<HANDLE> m_hTeachValidReady;
|
||||
|
||||
std::vector<stGPDoubleDataResult> m_stResult;
|
||||
std::vector<std::string> 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;
|
||||
};
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue