// PalmToolDlg.h : header file
//

#if !defined(AFX_PALMTOOLDLG_H__DC744E87_9920_11D4_A856_0010B503CEA7__INCLUDED_)
#define AFX_PALMTOOLDLG_H__DC744E87_9920_11D4_A856_0010B503CEA7__INCLUDED_

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

#include "ProgDlg.h"
#include "Commport.h"
#include "UdpAudioThread.h"
#include "UdpDebugThread.h"
#include "Rs232Thread.h"
#include "Rj45Thread.h"

/////////////////////////////////////////////////////////////////////////////
// CPalmToolDlg dialog

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

// Dialog Data
	//{{AFX_DATA(CPalmToolDlg)
	enum { IDD = IDD_PALMTOOL_DIALOG };
	CComboBox	m_ctlAudioType;
	CIPAddressCtrl	m_ctlPeerIP;
	int		m_iRs232Port;
	BOOL	m_bAudioSaveFile;
	BOOL	m_bAudioRealtime;
	BOOL	m_bAudioNoAcm;
	BOOL	m_bAudioRealtimeOut;
	int		m_iPFlashPage;
	int		m_iPFlashType;
	int		m_iSaveSdramLength;
	int		m_iCommType;
	BOOL	m_bUseHighRate;
	BOOL	m_bUseVAD;
	BOOL	m_bDebugIPOnly;
	//}}AFX_DATA

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

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CPalmToolDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnUdpAudio();
	virtual void OnCancel();
	afx_msg void OnLoadSdram();
	afx_msg void OnSaveSdram();
	afx_msg void OnPhoneSettings();
	afx_msg void OnUpdatePflash();
	afx_msg void OnStartDebug();
	afx_msg void OnSelChangeAudioType();
	afx_msg void OnAudioNoAcm();
	afx_msg void OnCommunication1();
	afx_msg void OnCommunication2();
	afx_msg void OnTestButton();
	afx_msg void OnConvertFile();
	afx_msg void OnUpdateProgram();
	afx_msg void OnUpdateRing();
	afx_msg void OnUpdateMap();
	afx_msg void OnUpdateAlternate();
	afx_msg void OnGenerateHttpfile();
	afx_msg void OnListPhones();
	afx_msg void OnSaveSettings();
	afx_msg void OnLoadSettings();
	afx_msg void OnSaveAddress();
	afx_msg void OnLoadAddress();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

protected:
	CCommPort		m_comm;
	CProgressDlg	m_progress;
	CUdpAudioThread	* m_pUdpAudioThread;
	CUdpDebugThread	* m_pUdpDebugThread;
	CRs232Thread * m_pRs232Thread;
	CRj45Thread * m_pRj45Thread;

	CString m_strRs232Port;
	ULONG m_uPeerIP;
	int	m_iAudioType;

protected:
	BOOL BeginRs232();
	void EndRs232();

	BOOL BeginRj45(BOOL bNormal);
	void EndRj45();

	BOOL BeginUdpAudio();
	void EndUdpAudio();

	BOOL BeginUdpDebug();
	void EndUdpDebug();

	void SaveSettings();

	BOOL CheckUpdateFileName(CString strUpdateName);
	BOOL CheckUpdateOptions();
	void TcpipUpdate(char * p, int iLength);

	BOOL TcpipLoadSdram(char * p, int iLength, int iPFlashPage);
	BOOL Rs232LoadSdram(char * p, int iLength, BOOL bUpgrade);
	BOOL TcpipSaveSdram(char * p, BOOL bSettings);
	BOOL Rs232SaveSdram(char * p);

	void GetEraseRange(int & iStart, int & iStop);
	void EnableDebug(BOOL bEnable);
};

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

#endif // !defined(AFX_PALMTOOLDLG_H__DC744E87_9920_11D4_A856_0010B503CEA7__INCLUDED_)
