
// EZGemPlusDLL_SampleDlg.h : 헤더 파일
//
#pragma once
#include "afxwin.h"
#include <map>
#include <string>
#include <iostream>

//---------- API HEADER 추가 ----------

#ifdef _UNICODE
	#include "EZGem300API_Unicode.h"
#else
	#include "EZGem300API.H"
#endif

#define RESULT_OK		0
#define MAX_LOADPORT	2
#define MAX_SLOT		25

enum
{
	// SEMI E5 (U1) S16F27
	CJOB_CMD_START = 1,
	CJOB_CMD_PAUSE = 2,
	CJOB_CMD_RESUME = 3,
	CJOB_CMD_CANCEL = 4,
	CJOB_CMD_DESELECT = 5,
	CJOB_CMD_STOP = 6,
	CJOB_CMD_ABORT = 7,
	CJOB_CMD_CJHOQ = 8,
};

//----------------------------------------------------------------
//   이벤트 콜백 함수 지정
void OnEZGemPlusEvent(void *lpHandle, short nEventId, long lParm);
void OnEZGemPlusMsg(void *lpHandle, long lMsgId);
//----------------------------------------------------------------

class CEZGemPlusDLL_SampleDlg : public CDialogEx
{
// 생성입니다.
public:
	CEZGemPlusDLL_SampleDlg(CWnd* pParent = NULL);	// 표준 생성자입니다.

	//-------------------------------------------
	EZGemPlus m_gem;
	void OnMyEvent(short nEventId, long lParm);
	void OnMsgReceived(long lMsgId);
	//-------------------------------------------

// 대화 상자 데이터입니다.
	enum { IDD = IDD_EZGEMPLUSDLL_SAMPLE_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV 지원입니다.
	
// 구현입니다.
protected:
	HICON m_hIcon;

	std::map<int, std::string> 
		m_TransferState, 
		m_ReservationState, 
		m_IDState, 
		m_AccessingState, 
		m_AssocationState;

	void InitGem300Settings();
	void InitGrid();

	void OnHostSentECV(long lMsgId);
	void OnRemoteCommand(long lMsgId);
	void OnTerminalMsg(long lMsgId);

	void UpdatePrJobList();
	void UpdateCtrlJobList();

	void OnGem300Event(short nEventID, long lParam);
	void OnEvent_HostSetLoadPortServiceMode(long lMsgId);// S3F25 LoadPortServiceMode Change
	void OnEvent_HostSetLoadPortAccessMode(long lMsgId);// S3F27 LoadPortAccessMode Change
	void OnEvent_ProceedWithCarrier(long lMsgId);		// S3F17 <'ProceedWithCarrier'>
	void OnEvent_CancelCarrier(long lMsgId, BOOL bCancelCarriarAtPort);	// S3F17 <'CancelCarrier'>
	void OnEvent_Bind(long lMsgId);						// S3F17 <'Bind'>
	void OnEvent_CancelBind(long lMsgId);				// S3F17 <'CancelBind'>
	void OnEvent_ReserveAtPort(long lMsgId);			// S3F17 <'ReserveAtPort'>
	void OnEvent_CarrierReCreate(long lMsgId);			// S3F17 <'CarrierReCreate'>
	void OnEvent_CarrierOut(long lMsgId);				// S3F17 <'CarrierOut'>			(InternalBuffer)
	void OnEvent_CancelCarrierOut(long lMsgId);			// S3F17 <'CancelCarrierOut'>	(InternalBuffer)
	void OnEvent_PrJobCommand(long lMsgId);				// S16F5 PrJobCommandRequest
	void OnEvent_HostSetPrJobCreate(long lMsgId);		// S16F11, S16F15
	void OnEvent_HostSetPrJobDeque();					// S16F17
	void OnEvent_HostSetPrJobParamValue(long lMsgId);	// S16F23
	void OnEvent_HostSetPrJobStartMethod(long lMsgId);	// S16F25
	void OnEvent_CtrlJobCommand(long lMsgId);			// S16F27 CtrlJobCommand
	void OnEvent_HostSetControlJobCreate(long lMsgId);	// S14F9 CreateObjectRequest (ControlJob)
	void OnEvent_HostSetSubstrateCommand(long lMsgId);	

	BOOL m_bCarrierVerifyOK;

	UINT m_nMsgIn, m_nMsgOut;

	// 생성된 메시지 맵 함수
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()
public:
	CListBox m_listLog;
	afx_msg void OnBnClickedButtonStart();
	afx_msg void OnBnClickedButtonStop();
	CStatic m_txtConnection;
	CStatic m_txtControlState;
	afx_msg void OnBnClickedButtonOffline();
	afx_msg void OnBnClickedButtonLocal();
	afx_msg void OnBnClickedButtonRemote();
	afx_msg void OnBnClickedButtonAlarmset();
	afx_msg void OnBnClickedButtonAlarmclear();
	afx_msg void OnBnClickedButtonProcessstart();
	afx_msg void OnBnClickedButtonProcessend();

	CString m_strText;

	CString m_strMsgInCount;
	CString m_strMsgOutCount;
	afx_msg void OnBnClickedButtonLoadrequest();
	afx_msg void OnBnClickedButtonLoadcomplete();
	afx_msg void OnBnClickedButtonUnloadrequest();
	afx_msg void OnBnClickedButtonUnloadcomplete();
	CListBox m_listGem300Log;
	CComboBox m_comboTransferState;
	CButton m_checkPortAccessMode;
	CButton m_checkCarrierIDVerification;
	CButton m_checkSlotMapVerification;
	CButton m_radioLoadPort1;
	CButton m_radioLoadPort2;
	afx_msg void OnBnClickedButtonSettransferstate();
	CString m_strCarrierID;
	afx_msg void OnBnClickedButtonCarrieridRead();
	afx_msg void OnBnClickedCheckAccessmode();
	CString m_strSlotMap;
	afx_msg void OnBnClickedButtonDocked();
	afx_msg void OnBnClickedButtonDooropen();
	afx_msg void OnBnClickedButtonClosed();
	afx_msg void OnBnClickedButtonCarrieridSlotmapread();
	afx_msg void OnBnClickedButtonUndocked();
	afx_msg void OnBnClickedButtonClamped();
	afx_msg void OnBnClickedButtonUnclamped();
	afx_msg void OnBnClickedButtonTransferblocked();
	afx_msg void OnBnClickedButtonCarrierok();
	afx_msg void OnBnClickedButtonCarrierng();
	afx_msg void OnBnClickedButtonSlotmapok();
	afx_msg void OnBnClickedButtonSlotmapng();
	CListBox m_listPrJob;
	CString m_strPrJobCount;
	afx_msg void OnBnClickedButtonUpdateprjob();
	CString m_strPrJobPPID;
	CString m_strPrJobCarrierCount;
	CComboBox m_comboCarrier;
	afx_msg void OnLbnSelchangeListPrJob();
	CString m_strPrJobParams;
	afx_msg void OnBnClickedButtonReadPrjobParams();
	CString m_strPrJobState;
	afx_msg void OnBnClickedButtonSetPrjobstate();
	afx_msg void OnBnClickedButtonUpdatecjob();
	CListBox m_listCtrlJob;
	CString m_strCtrlJobCount;
	afx_msg void OnLbnSelchangeListCtrljob();
	CListBox m_listPrJobInCtrlJob;
	afx_msg void OnLbnSelchangeListPrjobinctrljob();
	afx_msg void OnBnClickedButtonDelPrjob();
	afx_msg void OnBnClickedButtonDelAllprjob();
	afx_msg void OnBnClickedButtonDelCtrljob();
	afx_msg void OnBnClickedButtonDelAllctrljob();
	afx_msg void OnBnClickedButtonSetCjobstate();
	afx_msg void OnBnClickedButtonCreateprjob();
	afx_msg void OnBnClickedButtonCreatectrljob();
	CListBox m_listSubstrate;
	CListBox m_listSubstLoc;
	CComboBox m_comboSubstrate;
	CListBox m_listBatchLoc_1;
	CListBox m_listBatchLoc_2;
	CListBox m_listBatchLocation;
	CComboBox m_comboSubstLoc;
	CComboBox m_comboSubstStateMode;
	CComboBox m_comboSubstIDReadResult;
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	afx_msg void OnButtonCreateSubst();
	afx_msg void OnButtonDelSubst();
	afx_msg void OnBnClickedButtonDelAllsubst();
	afx_msg void OnBnClickedButtonBatchmove1();
	afx_msg void OnBnClickedButtonBatchmove2();
	CComboBox m_comboTransState;
	afx_msg void OnBnClickedButtonSubstmove();
	CComboBox m_comboStateValue;
	CString m_strSubstIDRead;
	afx_msg void OnCbnSelchangeComboStatemode();
	afx_msg void OnBnClickedButtonSetstate();
	afx_msg void OnBnClickedButtonSubstidreading();
	CString m_strCarrierID_Delete;
	afx_msg void OnBnClickedButtonDelcarrier();
	afx_msg void OnBnClickedButtonDelallcarrier();
//	CComboBox comboAttrName;
	CComboBox m_comboObjID;
	CComboBox m_comboAttrName;
	CComboBox m_comboObjType;
	afx_msg void OnBnClickedButtonAttrname();
	afx_msg void OnBnClickedButtonAttrdata();
	afx_msg void OnCbnSelchangeComboObjtype();
	afx_msg void OnBnClickedButtonAllattrdata();
	afx_msg void OnBnClickedButtonAddPjparam();
	CListCtrl m_gridLoadPort;
	CListCtrl m_gridCarrierInfo;
	CComboBox m_comboCarrierAccessStatus;
	afx_msg void OnBnClickedButtonCarrieraccessstatus();
	afx_msg void OnItemchangedListCarrierinfo(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnBnClickedButtonSubstrateReturn();
	afx_msg void OnBnClickedButtonOccupied();
	afx_msg void OnBnClickedButtonUnoccupied();
	afx_msg void OnBnClickedButtonSetnewattrval();
	CString m_strNewAttrVal;
	CComboBox m_comboCarrierID;
	afx_msg void OnBnClickedButtonCarriermove();
	CComboBox m_comboCarrierLocation;
	afx_msg void OnDropdownComboCarrierID();
	afx_msg void OnDropdownComboCarrierLocation();
};
