// GobiTestAppDlg.h : header file
//

#pragma once
#include "afxwin.h"
#include "afxcmn.h"
#include "ApiHelper.h"
#include "FuncAvailCtrl.h"
#include "FuncParamCtrl.h"
#include "SwiListCtrl.h"

// CGobiTestAppDlg dialog
class CGobiTestAppDlg : public CDialog
{
// Construction
public:
	CGobiTestAppDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_GOBITESTAPP_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support


// Implementation
protected:
	HICON m_hIcon;

	// GUI controls
	CButton m_btnExecute;				// GUI control to execute commands
	CListCtrl m_ctrStatus;				// GUI control which displays status messages
	CTreeCtrl m_ctrCmdsAvail;			// GUI control which displays list of available commands
	CSwiListCtrl m_ctrFuncParams;		// GUI control which displays list of function parameters

	// GUI control helpers
	CFuncAvailCtrl m_UiCmdsAvailCtrl;	// Object which manages Available Commands GUI control
	CFuncParamCtrl m_UiFuncParamsCtrl;	// Object which manages Parameters GUI control

	CFuncList m_lstAvailFuncs;			// Object which manges list of all available functions
	CFuncList m_lstSelectedFuncs;		// Object which manages list of selected functions
	CApiHelper* m_pApiHelper;			// Object which manages the modem API	

	// GUI states
	typedef enum 
	{
		GUISTATE_Uninitialized,
		GUISTATE_Ready,
		GUISTATE_FunctionSelected,
		GUISTATE_Executing,
	} TYPE_GUI_STATE;

	UINT m_nFindModemCounter;	// Number of attempts to find a modem
	BOOL m_bSelectAllFuncs;		// TRUE if all functions have been selected, FALSE otherwise

	void SetGuiState(TYPE_GUI_STATE eState);

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnDestroy();
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	afx_msg void OnBnClickedBtnExecute();
	afx_msg LRESULT OnExecutionComplete(WPARAM, LPARAM);
	afx_msg LRESULT OnNotifyDeviceRemoval(WPARAM, LPARAM);
	afx_msg LRESULT OnStatusUpdate(WPARAM, LPARAM);
	afx_msg void OnNMClickLstFuncParams(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnLvnEndLabelEditLstFuncParams(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnTvnSelchangedTreCmdavail(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnNMClickTreCmdavail(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnTvnKeydownTreCmdavail(NMHDR *pNMHDR, LRESULT *pResult);
	CButton m_btnCancel;
	afx_msg void OnBnClickedBtnCancel();
};
