// MsSDKTestDlg.h : header file
//

#if !defined(AFX_MSSDKTESTDLG_H__EC636494_EA4D_416B_B9F9_6E2E3AC9770A__INCLUDED_)
#define AFX_MSSDKTESTDLG_H__EC636494_EA4D_416B_B9F9_6E2E3AC9770A__INCLUDED_

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

/////////////////////////////////////////////////////////////////////////////
// CMsSDKTestDlg dialog
#include "MsIpcSDK.h"

class CMsSDKTestDlg : public CDialog
{
// Construction
public:
	static CMsSDKTestDlg *m_pThis;
public:
	LONG m_nUserID;
	char m_sMacAddr[32];
	BOOL m_bPlay;
	BOOL m_bFullClient;
	CRect m_rcStatic;
	BOOL m_bRecord;
	char m_sModel[32];
public:
	CMsSDKTestDlg(CWnd* pParent = NULL);	// standard constructor
	
// Dialog Data
	//{{AFX_DATA(CMsSDKTestDlg)
	enum { IDD = IDD_MSSDKTEST_DIALOG };
	CButton	m_btnDbgTest;
	CDateTimeCtrl	m_DT_Time;
	CDateTimeCtrl	m_DT_Date;
	CStatic	m_wndLivePlay;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMsSDKTestDlg)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL
private:
	CTime m_DateTime;
	CToolTipCtrl m_tooltip;

// Implementation
private:
	void FillDiskData();
	void UpdateText(char *sParam);
	void Test();
public:
	static void OutputTips(const char* pText, ...);
	static bool UTF8ToMB(char *pmb, const char* pu8, int utf8Len);
	static bool MBToUTF8(char *pu8, const char* pmb, int mLen);
	BOOL encodeURL(const char *sUrl, char *sEncodeUrl, int nEnLen);
	static int Multibyte_2_Widechar(int nCode, LPCSTR szSrc, LPTSTR szDest, int nMaxChars);//失败返回0
	static int Widechar_2_Multibyte(int nCode, LPCTSTR szSrc, LPSTR szDest, int nMaxBytes, BOOL bNeedEscape = TRUE);//失败返回0
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CMsSDKTestDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnBtnLogin();
	afx_msg void OnBtnGetnetwork();
	afx_msg void OnBtnSetnetwork();
	afx_msg void OnBtnGetSystemInfo();
	afx_msg void OnBtnGetDatetime();
	afx_msg void OnBtnSetDatetime();
	afx_msg void OnBtnReboot();
	afx_msg void OnBtnRestore();
	afx_msg void OnBtnPlay();
	afx_msg void OnBtnStop();
	afx_msg void OnDestroy();
	afx_msg void OnBtnSearch();
	afx_msg void OnBtnClearText();
	afx_msg void OnBtnLogout();
	afx_msg void OnBtnPlayback();
	afx_msg void OnBtnCaptureImage();
	afx_msg void OnBtnRecord();
	afx_msg void OnBtnGetRtspUtl();
	afx_msg void OnChkShowGrid();
	afx_msg void OnStaticLive();
	afx_msg void OnBtnSelectFile();
	afx_msg void OnBtnUpdateFirmware();
	afx_msg void OnBtnUserSetting();
	afx_msg void OnBtnPtz();
	afx_msg void OnBtnVideoConfig();
	afx_msg void OnBtnAudioConfig();
	afx_msg void OnBtnSdConfig();
	afx_msg void OnBtnPrivacyMask();
	afx_msg void OnBtnAlarmConfig();
	afx_msg void OnBtnCmosConfig();
	afx_msg void OnBtnClearOutput();
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnBtnSmtp();
	afx_msg void OnBtnFtp();
	afx_msg void OnBtnDdns();
	afx_msg void OnRadioDtManual();
	afx_msg void OnRadioDtSntp();
	afx_msg void OnRadioDtComputer();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnBtnDefaultPara();
	afx_msg void OnBtnSetSystemInfo();
	afx_msg void OnClose();
	afx_msg void OnBtnConnectLimit();
	afx_msg void OnBtnGetport();
	afx_msg void OnBtnSetport();
	afx_msg void OnButtonDbgTest();
	//}}AFX_MSG
	afx_msg BOOL OnToolTipNotify(UINT id,NMHDR *pNMHDR,LRESULT *pResult);
	DECLARE_MESSAGE_MAP()
};

static BOOL IsAmbaIPC(char *sModel) // Model: MS-Cxxxx-FPN(A)
{
	if(!sModel || sModel[0] == '\0')
		return FALSE;
	if(sModel[strlen(sModel)-1] == 'A'/*sModel[4] == '5' || sModel[4] == '6' || sModel[4] == '8'*/)
		return TRUE;
	else
		return FALSE;
}

static BOOL IsHisiIPC(char *sModel) // Model: MS-Cxxxx-FPN(B)
{
	if(!sModel || sModel[0] == '\0')
		return FALSE;
	if(sModel[strlen(sModel)-1] == 'B')
		return TRUE;
	else
		return FALSE;
}

static BOOL IsTiIPC(char *sModel) // Model: MS-Cxxxx-xxx
{
	return !(IsAmbaIPC(sModel) || IsHisiIPC(sModel));
}

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

#endif // !defined(AFX_MSSDKTESTDLG_H__EC636494_EA4D_416B_B9F9_6E2E3AC9770A__INCLUDED_)
