/////////////////////////////////////////////////////////////////////////////
//! \file RClientDlg.h
//! \brief Header file
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_RCLIENTDLG_H__F6973BEC_9415_42F9_9695_CB5E8AC9FA9E__INCLUDED_)
#define AFX_RCLIENTDLG_H__F6973BEC_9415_42F9_9695_CB5E8AC9FA9E__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Xml.h"

/////////////////////////////////////////////////////////////////////////////
//! \brief CRClientDlg dialog
//!
//! Main dialog.
/////////////////////////////////////////////////////////////////////////////
class CRClientDlg : public CDialog
{
public:
	CRClientDlg(CWnd* pParent = NULL);	// Standard constructor
	void PrintText(CString Text, CEdit *pControl = NULL);
	void ClearText(CEdit *pControl = NULL);
	void ConnectX(int Show);
	void DisconnectX();
	void ConnectD(int Show);
	void DisconnectD();
	int  Send(CString Text);
	static DWORD WINAPI ReadProcD(LPVOID pParam);
	static DWORD WINAPI ReadProcX(LPVOID pParam);
	static DWORD WINAPI WatchDirectory(LPVOID pParam);

	DWORD m_iIPAddress;		//!< IP-Adresse der VisionBox
	DWORD m_iPortAddress;	//!< Port-Adresse
	char m_ReadDir[_MAX_DRIVE+_MAX_DIR];
	char m_WriteDir[_MAX_DRIVE+_MAX_DIR];
	char m_BMPDir[_MAX_DRIVE+_MAX_DIR];
	SOCKET m_sSocketX;		//!< XML socket
	SOCKET m_sSocketD;		//!< Data socket
	CEdit*  m_pStatus;
	CEdit*  m_pReceive;
	bool m_bConnectedX;
	bool m_bConnectedD;
	bool m_yEventHandling;	//!< Thread is running
	BOOL m_bAutoCon;
	BOOL m_bXmlWrite;
	CXml *m_pCXml;

// Dialog Data
	//{{AFX_DATA(CRClientDlg)
	enum { IDD = IDD_RCLIENT_DIALOG };
		// NOTE: the ClassWizard will add data members here
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRClientDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

protected:
	HICON m_hIcon;
	char* m_pszKey;
	HANDLE m_hReadThreadD;		//!< Handle Read-data-Thread
	HANDLE m_hReadThreadX;		//!< Handle Read-XML-Thread
	HANDLE m_hDirThread;		//!< Handle Read-Directory-Thread
	HANDLE m_hChange;			//!< Handle change directory
	DWORD  m_dwReadThreadID;	//!< Thread-ID Read-Thread

	// Generated message map functions
	//{{AFX_MSG(CRClientDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnCancel();
	afx_msg void OnConnectD();
	afx_msg void OnConnectX();
	afx_msg void OnDisconnectD();
	afx_msg void OnDisconnectX();
	afx_msg void OnSetup();
	afx_msg void OnReadStatus();
	afx_msg void OnGetImage();
	afx_msg void OnSetExposure();
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()	
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_RCLIENTDLG_H__F6973BEC_9415_42F9_9695_CB5E8AC9FA9E__INCLUDED_)
