1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#include "stdafx.h"
 
const TCHAR *PANEL_SIDE[]        = {_T("A_TOP"), _T("B_TOP"), _T("C_TOP"), _T("D_TOP"),_T("A_BOT"), _T("B_BOT"), _T("C_BOT"), _T("D_BOT")};
 
CInspectionBase::CInspectionBase()
{
    m_pBufferSize = NULL;
    m_pBufferCount = NULL;
    m_pMemFrameNo = NULL;
    m_pCameraPort = NULL;
    m_pFrameWidth = NULL;
    m_pFrameHeight = NULL;
    m_nThreadCount = 0;    
    m_eProcessMode = 0;
 
    Reset();
}
CInspectionBase::~CInspectionBase()
{    
    Reset();
}
 
 
BOOL CInspectionBase::ReadInspectConfigFile(CString strFileName,int nCamCount)
{
    CConfig    CF;
 
    if(CF.SetRegiConfig(NULL, NULL, (TCHAR*)(LPCTSTR)strFileName, FileMap_Mode) == FALSE)
        return FALSE;
 
    Reset();
 
    int nValue;
 
    m_nCameraCount = nCamCount;
    CF.GetItemValue(_T("acqmode"), nValue, 0);
    m_AcqMode = (AcqMode)nValue;
    CF.GetItemValue(_T("framedefectpixel"), m_nFrameDefectPixel, 1000);
    CF.GetItemValue(_T("scancount"), m_nScanCount, 2);
    CF.GetItemValue(_T("threadcount"), m_nThreadCount, 2);
 
    if(m_nCameraCount > 0)
    {
        m_pBufferSize = new int[m_nCameraCount];
        ZeroMemory(m_pBufferSize,sizeof(int)*m_nCameraCount);
        m_pBufferCount = new int[m_nCameraCount];
        ZeroMemory(m_pBufferCount,sizeof(int)*m_nCameraCount);    
        m_pMemFrameNo = new int[m_nCameraCount];
        ZeroMemory(m_pMemFrameNo,sizeof(int)*m_nCameraCount);
        m_pCameraPort = new int[m_nCameraCount];
        ZeroMemory(m_pCameraPort,sizeof(int)*m_nCameraCount);
        m_pFrameWidth = new int[m_nCameraCount];
        ZeroMemory(m_pFrameWidth,sizeof(int)*m_nCameraCount);
        m_pFrameHeight = new int[m_nCameraCount];
        ZeroMemory(m_pFrameHeight,sizeof(int)*m_nCameraCount);
        
        int            iCam;
        CString        str,strVal;
        for(iCam=0;iCam<m_nCameraCount;iCam++)
        {
            str.Format(_T("CAM[%d]_camcca"),iCam);
            CF.GetItemValue((TCHAR*)(LPCTSTR)str, strVal);
            m_strCamCCA.Add(strVal);
 
            str.Format(_T("CAM[%d]_camcvi"),iCam);
            CF.GetItemValue((TCHAR*)(LPCTSTR)str, strVal);
            m_strCamCVI.Add(strVal);
 
            str.Format(_T("CAM[%d]_buffersize"),iCam);
            CF.GetItemValue((TCHAR*)(LPCTSTR)str, m_pBufferSize[iCam],0);
 
            str.Format(_T("CAM[%d]_buffercount"),iCam);
            CF.GetItemValue((TCHAR*)(LPCTSTR)str, m_pBufferCount[iCam],0);        
 
            str.Format(_T("CAM[%d]_camport"),iCam);
            CF.GetItemValue((TCHAR*)(LPCTSTR)str, m_pCameraPort[iCam],2);
 
            str.Format(_T("CAM[%d]_framewidth"),iCam);
            CF.GetItemValue((TCHAR*)(LPCTSTR)str, m_pFrameWidth[iCam],8192);
 
            str.Format(_T("CAM[%d]_frameheight"),iCam);
            CF.GetItemValue((TCHAR*)(LPCTSTR)str, m_pFrameHeight[iCam],1024);
            
            m_pMemFrameNo[iCam] = m_pBufferSize[iCam] * m_pBufferCount[iCam];
        }        
    }
 
    return TRUE;
}
 
//0326
void CInspectionBase::SetGlassInfo(CString strHPanelID, CString strRecipeName)
{
    m_strHPanelID = m_strOnlineID = _T("");
    m_strRecipeName = _T("");
 
    m_strHPanelID = m_strOnlineID = strHPanelID;
    m_strRecipeName = strRecipeName;    
}
 
void CInspectionBase::Reset()
{        
    m_AcqMode            = Acq_Simul;    
    m_nCameraCount        = 0;
    m_nScanCount        = 0;
    m_nThreadCount        = 0;
    m_nFrameDefectPixel    = 14000;
    m_nMaxDefect        = 1000;        
    m_eProcessMode        = 0;
    m_nStageNo            = 1;
 
    if(m_pFrameWidth != NULL)
        delete[] m_pFrameWidth, m_pFrameWidth=NULL;
    if(m_pFrameHeight != NULL)
        delete[] m_pFrameHeight, m_pFrameHeight=NULL;
    if(m_pBufferSize != NULL)
        delete[] m_pBufferSize, m_pBufferSize=NULL;
    if(m_pBufferCount != NULL)
        delete[] m_pBufferCount, m_pBufferCount=NULL;
    if(m_pMemFrameNo != NULL)
        delete[] m_pMemFrameNo, m_pMemFrameNo=NULL;    
    if(m_pCameraPort != NULL)
        delete[] m_pCameraPort, m_pCameraPort=NULL;    
 
    m_strCamCCA.RemoveAll();
    m_strCamCVI.RemoveAll();
    
    m_strHPanelID        = _T("");
    m_strRecipeName        = _T("");    
    m_strOnlineID        = _T("");    
    m_strLoadingTime    = _T("");
    m_strProcessID        = _T("");
    m_strStepID            = _T("");
    m_strLoadingDay        = _T("");
}