#if !defined(AFX_SETUPCOMMPAGE_H__9242BAE4_E4B2_43D1_9C75_8C96AAA79720__INCLUDED_)
#define AFX_SETUPCOMMPAGE_H__9242BAE4_E4B2_43D1_9C75_8C96AAA79720__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SetupCommPage.h : header file
//
#ifdef  BUILD_GUIDLL
#define     DLLCLASS    __declspec(dllexport)
#else
#define     DLLCLASS    __declspec(dllimport)
#endif

#include "MyPropertyPage.h"
#include "ShadeButtonST.h"

/////////////////////////////////////////////////////////////////////////////
// CSetupCommPage dialog

class DLLCLASS CSetupCommPage : public CMyPropertyPage
{
DECLARE_DYNCREATE(CSetupCommPage)

// Construction
public:
    CSetupCommPage();
    ~CSetupCommPage();

// Dialog Data
// {{AFX_DATA(CSetupCommPage)
    enum {
        IDD = IDD_SETUP_COMM_PAGE
    };
    CStatic        m_maintMsgBox;
    CShadeButtonST m_connectBtn;
    CShadeButtonST m_sendpacketBtn;
    CShadeButtonST m_disconnectBtn;
    CShadeButtonST m_opencomBtn;
    CShadeButtonST m_sendcomBtn;
    CShadeButtonST m_closecommBtn;
    CComboBox      m_cbComPort;
    CComboBox      m_cbFlowCtrl;
    CComboBox      m_cbStopBits;
    CComboBox      m_cbParity;
    CComboBox      m_cbDataBits;
    CComboBox      m_cbBaudRate;
// }}AFX_DATA

// Overrides
// ClassWizard generate virtual function overrides
// {{AFX_VIRTUAL(CSetupCommPage)
protected:
    virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
    virtual BOOL OnInitDialog();
    virtual BOOL OnKillActive();
// }}AFX_VIRTUAL

    virtual BOOL OnSetActive();

// Implementation
protected:
// Generated message map functions
// {{AFX_MSG(CSetupCommPage)
    afx_msg void OnTimer(UINT nIDEvent);
    afx_msg void OnSendButton();
    afx_msg void OnOpenButton();
    afx_msg void OnCloseButton();
    afx_msg void OnSendPacket();
    afx_msg void OnConnectPort();
    afx_msg void OnDisconnectPort();
// }}AFX_MSG
    DECLARE_MESSAGE_MAP()
private:
    void InitIconsButton();
    void ClearMaintMessage();
    void InitComboBox();

//  get all system com port
    void GetComPort();

//  write com information to runtime.ini file
    void WriteComInfoToFile(LPCTSTR lpcComPort, int &iBaudRate, int &iDataBits,
                            CString &csParity, float &fStopBits, CString &csFlowCtrl);

//  write socket infomation to runtime.ini file
    void WriteSocketInfoToFile(CString csIPAddress, CString csPortNum);
};

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

#endif // !defined(AFX_SETUPCOMMPAGE_H__9242BAE4_E4B2_43D1_9C75_8C96AAA79720__INCLUDED_)
