You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
240 lines
11 KiB
C++
240 lines
11 KiB
C++
#if !defined SGMANAGER_H
|
|
#define SGMANAGER_H
|
|
|
|
#include "stdafx.h"
|
|
#include "SocketSecsGem.h"
|
|
|
|
#ifdef SECSGEM_EXPORTS
|
|
#define SECSGEM_DLL __declspec(dllexport)
|
|
#else
|
|
#define SECSGEM_DLL __declspec(dllimport)
|
|
#endif
|
|
|
|
#define MAXSOCKBUF 4096
|
|
#define SG_END_TERMINATOR '\n'
|
|
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
// SGManager.h : header file
|
|
//
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CSGManager document
|
|
|
|
class CSocketSecsGem;
|
|
|
|
/*************************************************************************************/
|
|
class SECSGEM_DLL CSGManager
|
|
{
|
|
public:
|
|
CSGManager();
|
|
virtual ~CSGManager();
|
|
|
|
CMutex RemoteCmdMutex;
|
|
CEvent m_RmtEvent;
|
|
CSingleLock *rmtlock;
|
|
|
|
protected: //public:
|
|
/******************************* To Hanlder Info ***********************/
|
|
int m_iEnableForAllMode;//phyu 01Aug2011
|
|
CString m_sControlState;
|
|
CString m_sLinkState;
|
|
CString m_sSpoolState;
|
|
CString m_sWaferMapDownloaded;
|
|
CString m_sStripMapDownloaded;
|
|
CString m_sWaferMapUploaded;
|
|
CString m_sRecipeDownloaded;
|
|
CString m_sRecipeUploaded;
|
|
CString m_sRecipeDeleted;
|
|
CString m_sAddedRecipe;
|
|
CString m_sDatasetUploaded;
|
|
CString m_sDatasetDownloaded;
|
|
CString m_sRemoteCmdReceived;
|
|
CString m_sNumberOfRecipe;
|
|
CString m_sNthRecipe;
|
|
CString m_sE10State;
|
|
CString m_sGeneralCmdReceived;
|
|
|
|
unsigned int iRecipeNumber;
|
|
|
|
CString m_sPendingReadMsg;
|
|
|
|
HWND gHwnd;
|
|
|
|
CString m_sSecsGemDataFile;
|
|
|
|
public:
|
|
void WriteToLogFile(CString sMsg);
|
|
|
|
public:
|
|
void EnableEventForAllMode();//phyu 11Aug2011
|
|
void DisableEventForAllMode();//phyu 11Aug2011 //Note: Event Enable in PRODUCTION Mode
|
|
CString GetControlState();//phyu 01Aug2011
|
|
CString GetLinkState();//phyu 01Aug2011
|
|
bool IsOnlineRemote();//phyu 11Aug2011
|
|
bool IsEnableCommunicating();//phyu 11Aug2011
|
|
bool IsOnlineLocal();//phyu 11Aug2011
|
|
bool IsSpoolActive();//phyu 11Aug2011
|
|
/*********** Newly added for receiving message on 21/04/2008 **********/
|
|
bool IsConnectWithSecsGem(); //check for connection between handler and Ti secs gem
|
|
/*********** Newly added for receiving message on 1/11/2007 **********/
|
|
bool m_bDataComplete;
|
|
char m_cReceiveData[MAXSOCKBUF];
|
|
char m_RcvBuff[MAXSOCKBUF];
|
|
long m_nBufferPtr;
|
|
void ReceiveComm( const char *cpcBuffer, int nSize);
|
|
void OnReceive( int nErrorCode );
|
|
void ResetReceiveBuffer();
|
|
/**********************************************************************/
|
|
// LPTSTR psMsg;
|
|
protected:
|
|
/******************************* To Hanlder info ***********************/
|
|
CString m_strSecsGemConnection;
|
|
CString m_sSGMainMode;
|
|
CString m_sSGLoginUser;
|
|
CString m_sMachineState;
|
|
bool m_bIsSecsGemEnabled;
|
|
|
|
PROCESS_INFORMATION g_pi;
|
|
/**********************************************************************/
|
|
/********************************* SecsGem Socket **********************/
|
|
int m_nSGPort;
|
|
char m_szSGIpAddress[128];
|
|
int SendMsgToSecsGem( CString pStr );
|
|
bool static SkipToNextData( char **ppStr);
|
|
CString GetNextData(char **ppStr);
|
|
CSocketSecsGem* m_pSocketSecsGem;
|
|
/**********************************************************************/
|
|
int m_NumberOfDay;//phyu 4Jan2010
|
|
bool m_bLogEnable;//Phyu 4Jan2010
|
|
/**********************************************************************/
|
|
public:
|
|
/************** Handler Calling Functions *****************************/
|
|
int SendToSecsGem(const void* lpBuf, int nBufLen, int nFlags) ;
|
|
|
|
bool ConnectSocketSecsGem(); // To make connection with Independent Secs/Gem
|
|
bool DisconnectSocketSecsGem(); // To disconnect Secs/Gem application
|
|
|
|
//Secsgem Application Function
|
|
void SetEnableLogFile( bool bEnable = true);//Phyu 04Jan2011
|
|
void SetNumberOfDaysKeepInMemoryForLogFile( int nDays = 30);//Phyu 04Jan2011
|
|
bool SetSecsGemIpAddressAndPort( HWND Hwnd, int iPort, char strIpAddress[128], bool bConnect = false );
|
|
bool StartAndConnectSecsGemApplication( HWND Hwnd); // To Start Secs/Gem application and connect
|
|
bool CloseSecsGemApplication(); // To close secsgem application
|
|
bool StartSecsGemApplication(); // To start Secsgem application
|
|
void DeleteOldSGLogFile( CString m_pLogFilePathOnly);//phyu 4Jan2010
|
|
|
|
//SecsGem Status Function
|
|
bool GoOnLine(); // To switch to SecsGem Online mode
|
|
bool GoOffline(); // To switch to SecsGem Offline mode
|
|
bool GoRemote(); // To switch to Online/Remote control state
|
|
bool GoLocal(); // To switch to Online/Local control state
|
|
bool SecsGemDisableLink(); // To disable SecsGem Link
|
|
bool SecsGemEnableLink(); // To enable Secsgem Link
|
|
bool SetMainMode( CString sMode ); // To set Main Mode
|
|
bool SetUserLevel( CString sUserLevel ); //To set User level
|
|
bool SetProcessState(CString sProcessState ); //To set process state
|
|
bool UpdateCurrentParameters(); // To send current mainmode, user and process state to secsgem appln
|
|
|
|
//Send Event Function
|
|
bool SendEvent( unsigned int iEventID);// To send Event,iEventReply:0= No need to Watit Event Reply
|
|
|
|
//Update Variable Function
|
|
bool SetVariableValue( UINT iVariableID, UINT iFormat, int iValue ); //To set Integer Variable value
|
|
bool SetVariableValue( UINT iVariableID, UINT iFormat, long iValue ); //To set Long variable value
|
|
bool SetVariableValue( UINT iVariableID, UINT iFormat, CString iValue );// To set string variable value
|
|
bool SetVariableValue( UINT iVariableID, UINT iFormat, double iValue ); // To set floating point variable value
|
|
|
|
//Alarm Function
|
|
bool SendAlarmOn( UINT iAlarmID, CString sAlarmText); // To send Alarm On
|
|
bool SendAlarmOff( UINT iAlarmID, CString sAlarmText); // To send Alarm Off
|
|
bool ClearAllAlarms(); // To clear all alarms
|
|
|
|
//Data Set Function
|
|
bool UploadData( CString strName ); // To Upload Data
|
|
bool DownloadData( CString strName ); // To download data
|
|
bool ResetData(); // To reset data
|
|
|
|
// Wafer map Function
|
|
bool DownloadWaferMap( CString sWMapID, int nType = 2, int nFormat=1, int nFNLoc=0, int nRotAngle=0, int nOrgLoc=0, CString strBinCodeEq="", CString strNullBinCodeEq="" );
|
|
bool UploadWaferMap( CString strName ); // To Upload Wafer Map
|
|
bool DownloadStripMap( CString strName ); // To download strip Map
|
|
|
|
bool DisplayTerminalMsgDialog(); // To display terminal message
|
|
void UnlockRemoteCommand(); // To unlock remote command
|
|
bool AcknowledgeRemoteCommand( CString sRmtCmd, int iReturnVal ); // To acknowledge remote command
|
|
|
|
|
|
//Process Program Management(Recipe)
|
|
bool DownloadRecipe( CString strName ); // To download recipe
|
|
bool UploadRecipe( CString strName ); // To Upload recipe
|
|
// bool AddRecipe( CString strName ); // To Add Recipe //Phyu 30Oct2009
|
|
bool UpdateRecipeList(); // To update recipe list
|
|
|
|
//***************************************************************
|
|
// Verify recipe after download recipe, then send S7F27 for PASS or FAIL
|
|
//strResultData = "PASS": successful load recipe
|
|
//strResultData = "FAIL": Fail to load recipe
|
|
//Note:Do not use this function unless customer request
|
|
//***************************************************************
|
|
bool SendRecipeVerification( CString strResultData );// reply to host
|
|
|
|
//***************************************************************
|
|
// To Add Recipe
|
|
// bRefreshRecipe = true :Not Send GemPPChangeEvent to host
|
|
// bRefreshRecipe = false :Send GemPPChangeEvent with PPCHANGESTATUS(Created) to host
|
|
//***************************************************************
|
|
bool AddRecipe( CString strName,bool bRefreshRecipe = false ); //Phyu 30Oct2009
|
|
|
|
//***************************************************************
|
|
// After delete Recipe file at C:\\PPDER and D:\\PPDER,
|
|
// then send GemPPChangeEvent with PPCHANGESTATUS(Deleted) to host.
|
|
//****************************************************************
|
|
bool DeleteRecipe( CString strName ); // To delete Recipe
|
|
|
|
//Phyu 30Oct2009
|
|
//***************************************************************
|
|
// bRefreshRecipe = true :Delete all recipe at C:\\PPDIR only
|
|
// bRefreshRecipe = false :Delete all recipe at C:\\PPDIR and D:\\PPDIR
|
|
//***************************************************************
|
|
bool DeleteAllRecipe(bool bRefreshRecipe = false);//Phyu 30 Oct 2009
|
|
|
|
//***************************************************************
|
|
// Send GemPPChangeEvent with PPCHANGESTATUS(Changed) to host.
|
|
// After edit recipe, need to call this function to inform to host.
|
|
//****************************************************************
|
|
bool EditRecipe(CString strName); //Phyu 30 Oct 2009
|
|
|
|
//***************************************************************
|
|
// Send EPT Module Data to host.//04Jan2009
|
|
//****************************************************************
|
|
bool SendEPTData(int nModuleID,CString strTaskName,int nTaskType, int nEPTState, int nBlockedReson, CString strBlockedReasonText);
|
|
public:
|
|
void OnReceivedControlState ( CString m_sControlState ); // This function is called when Control State change is received
|
|
void OnReceivedLinkState ( CString m_sLinkState ); // This function is called when Link State change is received
|
|
void OnReceivedSpoolState ( CString m_sSpoolState ); // This function is called when Spool State change is received
|
|
void OnWaferMapDownloaded( CString m_sWaferMapDownloaded ); // This function is called when Wafer Map downloaded
|
|
void OnStripMapDownloaded( CString m_sStripMapDownloaded ); // This function is called when Strip Map downloaded
|
|
void OnWaferMapUploaded( CString m_sWaferMapUploaded ); // This function is called when Wafer Map Uploaded
|
|
void OnRecipeDownloaded( CString m_sRecipeDownloaded ); // This function is called when Recipe is downloaded from Host
|
|
void OnRecipeUploaded( CString m_sRecipeUploaded ); // This function is called when Recipe is uploaded.
|
|
void OnRecipeDeleted( CString m_sRecipeDeleted ); // This function is called when Recipe is deleted.
|
|
void OnRecipeAdded( CString m_sAddedRecipe ); // This function is called when Recipe is added
|
|
void OnDatasetUploaded( CString m_sDatasetUploaded ); // This function is called when Data Set uploaded
|
|
void OnDatasetDownloaded( CString m_sDatasetDownloaded ); // This function is called when Dataset downloaded from Host
|
|
// void OnRemoteCommandReceived( CString m_sRemoteCmdReceived);// This function is called when a Remote command is received
|
|
void OnRemoteCommandReceived( CString m_sRemoteCmdReceived, int nReply = 0);// This function is called when a Remote command is received
|
|
void OnRecipeUpdateNumberOfRecipe( CString m_sNumberOfRecipe ); // This function is called when Number recipe received
|
|
void OnRecipeUpdateNthRecipe( unsigned int iRecipeNumber, CString m_sNthRecipe ); // This function is called to updated Nth Recipe
|
|
void OnRecipeUpdatedList(); // This function is called when updated Recipe List.
|
|
void OnReceivedPendingMessage( CString m_sPendingReadMsg ); // This function is called whenever message received
|
|
void OnReceivedE10State( CString m_sE10State ); // This function is called when E10 State change is received
|
|
|
|
void SetSecsGemDataFileFolder(CString m_sSGDataFileFolder); //Write secs gem data to this file
|
|
void OnAllRecipeDeleted( CString m_sRecipeDeleted );
|
|
void OnRecipeEdited(CString m_sRecipeEdited);
|
|
void OnECChanged( CString sECID, CString sECData ); //Thi function is call when host change ECID value.
|
|
};
|
|
#endif // !defined(AFX_SGMANAGER_H__3247996A_39A5_48E2_B94A_27CC7247F08C__INCLUDED_)
|