// stdafx.h : 标准系统包含文件的包含文件，
// 或是经常使用但不常更改的
// 特定于项目的包含文件

#pragma once

#pragma warning(disable:4996)

#ifndef _SECURE_ATL
#define _SECURE_ATL 1
#endif

#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN		// 从 Windows 头中排除极少使用的资料
#endif

// 如果您必须使用下列所指定的平台之前的平台，则修改下面的定义。
// 有关不同平台的相应值的最新信息，请参考 MSDN。
#ifndef WINVER				// 允许使用特定于 Windows XP 或更高版本的功能。
#define WINVER 0x0501		// 将此值更改为相应的值，以适用于 Windows 的其他版本。
#endif

#ifndef _WIN32_WINNT		// 允许使用特定于 Windows XP 或更高版本的功能。
#define _WIN32_WINNT 0x0501	// 将此值更改为相应的值，以适用于 Windows 的其他版本。
#endif						

#ifndef _WIN32_WINDOWS		// 允许使用特定于 Windows 98 或更高版本的功能。
#define _WIN32_WINDOWS 0x0410 // 将它更改为适合 Windows Me 或更高版本的相应值。
#endif

#ifndef _WIN32_IE			// 允许使用特定于 IE 6.0 或更高版本的功能。
#define _WIN32_IE 0x0600	// 将此值更改为相应的值，以适用于 IE 的其他版本。值。
#endif

#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS	// 某些 CString 构造函数将是显式的

// 关闭 MFC 对某些常见但经常可放心忽略的警告消息的隐藏
#define _AFX_ALL_WARNINGS

#include <afxwin.h>         // MFC 核心组件和标准组件
#include <afxext.h>         // MFC 扩展


#include <afxdisp.h>        // MFC 自动化类



#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h>		// MFC 对 Internet Explorer 4 公共控件的支持
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>			// MFC 对 Windows 公共控件的支持
#endif // _AFX_NO_AFXCMN_SUPPORT

#include "XTrace.h"

#define TPS_Debug 1


#ifndef SAFE_DELETE
#define SAFE_DELETE(p)       { if(p) { delete (p);     (p)=NULL; } }
#endif    
#ifndef SAFE_DELETE_ARRAY
#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p);   (p)=NULL; } }
#endif    
#ifndef SAFE_RELEASE
#define SAFE_RELEASE(p)      { if(p) { (p)->Release(); (p)=NULL; } }
#endif

#ifndef SAFE_FREE
#define SAFE_FREE(p) { if(p) { free(p); (p)=NULL; } }
#endif 

#define OUTPUTLOG(x) {\
	CString str;\
	SYSTEMTIME st; \
	GetLocalTime(&st);\
	str.Format("%d:%d:%d:%d Func:[%s] Failed!!!\n", st.wHour,st.wMinute, st.wSecond,st.wMilliseconds,(x));\
	OutputDebugString(str);\
}

#define CMD_SYSTEM_MANAGE_BASE		1000
#define	CMD_CONFIG_RESTORE			(CMD_SYSTEM_MANAGE_BASE + 2)
#define	 CMD_SET_SYSTEM_TIME		(CMD_SYSTEM_MANAGE_BASE + 5)
#define CMD_SYSTEM_REBOOT			(CMD_SYSTEM_MANAGE_BASE + 7)
#define CMD_GET_SYSTEM_VERSION_INFO (CMD_SYSTEM_MANAGE_BASE + 12)
#define CMD_GET_STORAGE_INFO 		(CMD_SYSTEM_MANAGE_BASE + 14)
#define CMD_STORAGE_DEVICE_FORMAT	(CMD_SYSTEM_MANAGE_BASE + 17)
#define CMD_STORAGE_DEVICE_UNMOUNT  (CMD_SYSTEM_MANAGE_BASE + 18)
#define CMD_GET_SERIALNUMBER		(CMD_SYSTEM_MANAGE_BASE + 19)
#define CMD_GET_SYSTEMCONTROLSTRING	(CMD_SYSTEM_MANAGE_BASE + 20)
#define CMD_GET_RECORD_FILE_LIST	(CMD_SYSTEM_MANAGE_BASE + 21)
#define CMD_DOWNLOAD_FILE			(CMD_SYSTEM_MANAGE_BASE + 23)
#define CMD_GET_LOGFILE_LIST		(CMD_SYSTEM_MANAGE_BASE + 25)
#define CMD_GET_IPC_TYPE			(CMD_SYSTEM_MANAGE_BASE + 30)
#define CMD_GET_USER_DEV_DATA		(CMD_SYSTEM_MANAGE_BASE + 34)
#define CMD_GET_SYSTEM_VERSION_INFO	(CMD_SYSTEM_MANAGE_BASE + 12)
#define CMD_CONFIG_NETWORK		    (CMD_SYSTEM_MANAGE_BASE + 27)

#define CMD_SYSTEM_CONFIG_BASE 200
#define CMD_GET_SYSTEM_PTZ_CONFIG	(CMD_SYSTEM_CONFIG_BASE + 1) //即201
#define CMD_GET_SYSTEM_TIME_CONFIG	(CMD_SYSTEM_CONFIG_BASE + 2)
#define CMD_GET_SYSTEM_USER_CONFIG	(CMD_SYSTEM_CONFIG_BASE + 3)
#define CMD_GET_SYSTEM_LOG_CONFIG	(CMD_SYSTEM_CONFIG_BASE + 4)
#define CMD_GET_SYSTEM_MISC_CONFIG	(CMD_SYSTEM_CONFIG_BASE + 5)
#define CMD_SET_SYSTEM_TIME_CONFIG	(CMD_SYSTEM_CONFIG_BASE + 22)
#define CMD_SET_SYSTEM_USER_CONFIG	(CMD_SYSTEM_CONFIG_BASE + 23)
#define CMD_SET_SYSTEM_LOG_CONFIG	(CMD_SYSTEM_CONFIG_BASE + 24)
#define CMD_SET_SYSTEM_PTZ_COMMON	(CMD_SYSTEM_CONFIG_BASE + 25)
#define CMD_SET_SYSTEM_PTZ_ADVANCE	(CMD_SYSTEM_CONFIG_BASE + 26)
#define CMD_SET_SYSTEM_MISC_CONFIG  (CMD_SYSTEM_CONFIG_BASE + 27)


#define CMD_NETWORK_CONFIG_BASE				300
#define CMD_GET_NETWORK_LAN_CONFIG			(CMD_NETWORK_CONFIG_BASE + 5)
#define CMD_GET_NETWORK_WIFI_CONFIG			(CMD_NETWORK_CONFIG_BASE + 6)
#define CMD_GET_NETWORK_ADSL_CONFIG			(CMD_NETWORK_CONFIG_BASE + 10)
#define CMD_GET_NETWORK_DDNS_CONFIG			(CMD_NETWORK_CONFIG_BASE + 11)
#define CMD_GET_NETWORK_UPNP_CONFIG			(CMD_NETWORK_CONFIG_BASE + 12)
#define CMD_GET_NETWORK_3G_CONFIG			(CMD_NETWORK_CONFIG_BASE + 13)
#define CMD_SET_NETWORK_LAN_CONFIG			(CMD_NETWORK_CONFIG_BASE + 25)
#define CMD_SET_NETWORK_WIFI_CONFIG			(CMD_NETWORK_CONFIG_BASE + 26)
#define CMD_SET_NETWORK_ADSL_CONFIG			(CMD_NETWORK_CONFIG_BASE + 30)
#define CMD_SET_NETWORK_DDNS_CONFIG			(CMD_NETWORK_CONFIG_BASE + 31)
#define CMD_SET_NETWORK_UPNP_CONFIG			(CMD_NETWORK_CONFIG_BASE + 32)
#define CMD_SET_NETWORK_3G_CONFIG			(CMD_NETWORK_CONFIG_BASE + 33)

#define CMD_SERVER_CONFIG_BASE			400
#define CMD_GET_SERVER_FTP_CONFIG		(CMD_SERVER_CONFIG_BASE + 1)
#define CMD_GET_SERVER_SMTP_CONFIG		(CMD_SERVER_CONFIG_BASE + 2)
#define CMD_SET_SERVER_CONFIG			(CMD_SERVER_CONFIG_BASE + 20)
#define CMD_SET_SERVER_FTP_CONFIG		(CMD_SERVER_CONFIG_BASE + 21)
#define CMD_SET_SERVER_SMTP_CONFIG		(CMD_SERVER_CONFIG_BASE + 22)

#define CMD_MEDIA_CONFIG_BASE			500
#define CMD_GET_MEDIA_VIDEO_CONFIG		(CMD_MEDIA_CONFIG_BASE + 1)
#define CMD_GET_MEDIA_AUDIO_CONFIG		(CMD_MEDIA_CONFIG_BASE + 2)
#define CMD_SET_MEDIA_CONFIG			(CMD_MEDIA_CONFIG_BASE + 20)
#define CMD_SET_MEDIA_VIDEO_CONFIG		(CMD_MEDIA_CONFIG_BASE + 21)
#define CMD_SET_MEDIA_AUDIO_CONFIG		(CMD_MEDIA_CONFIG_BASE + 22)
#define CMD_SET_MEDIA_VIDEO_ENCODE		(CMD_MEDIA_CONFIG_BASE + 23)
#define CMD_SET_MEDIA_VIDEO_CAPTURE		(CMD_MEDIA_CONFIG_BASE + 24)
#define CMD_SET_MEDIA_VIDEO_OSD			(CMD_MEDIA_CONFIG_BASE + 25)
#define CMD_SET_PRIVACY_CONFIG          (CMD_MEDIA_CONFIG_BASE + 29)


#define CMD_MEDIASTREAM_CONFIG_BASE			600
#define CMD_SET_MEDIASTREAM_CONFIG			(CMD_MEDIASTREAM_CONFIG_BASE + 20)


#define CMD_RECORD_CONFIG_BASE				700
#define CMD_SET_RECORD_CONFIG				(CMD_RECORD_CONFIG_BASE + 20)

#define CMD_ALARM_CONFIG_BASE					800
#define CMD_GET_ALARM_INPUT_CONFIG				(CMD_ALARM_CONFIG_BASE + 1)
#define CMD_GET_ALARM_MOTIONDETECT_CONFIG		(CMD_ALARM_CONFIG_BASE + 2)
#define CMD_GET_ALARM_VIDEOCOVER_CONFIG			(CMD_ALARM_CONFIG_BASE + 3)
#define CMD_GET_ALARM_VIDEOLOST_CONFIG			(CMD_ALARM_CONFIG_BASE + 4)
#define CMD_GET_ALARM_SF_CONFIG					(CMD_ALARM_CONFIG_BASE + 5)
#define CMD_SET_ALARM_CONFIG				(CMD_ALARM_CONFIG_BASE + 20)
#define CMD_SET_ALARM_INPUT_CONFIG			(CMD_ALARM_CONFIG_BASE + 21)
#define CMD_SET_ALARM_MOTIONDETECT_CONFIG		(CMD_ALARM_CONFIG_BASE + 22)
#define CMD_SET_ALARM_VIDEOCOVER_CONFIG		(CMD_ALARM_CONFIG_BASE + 23)
#define CMD_SET_ALARM_VIDEOLOST_CONFIG		(CMD_ALARM_CONFIG_BASE + 24)
#define CMD_SET_ALARM_SF_CONFIG				(CMD_ALARM_CONFIG_BASE + 25)

#define WM_IPMODIFY WM_USER+1
#define WM_StatusEvent WM_USER+100
#define WM_TIMEID WM_USER+101
#define WM_UPDATE_PRESETLIST WM_USER+102
#define WM_FILE_DOWNLOAD WM_USER+103
#define WM_TIMER_RECORD WM_USER+104
#define WM_DOWNLOAD_STATUS WM_USER+105
#define WM_DOWNLOAD_POS WM_USER+106
#define WM_TIMER_UPGRADE WM_USER+107
#define WM_LOCAL_LOG WM_USER+108
#define WM_EVENT_LOG WM_USER+109
#define WM_DEV_AUX WM_USER+1001
#define WM_DEV_STATUS WM_USER+110
#define WM_SLEEP WM_USER+111
#define WM_UPGRADE_STATUS WM_USER+112
#define WM_DOWNLOAD_START WM_USER+113
#define WM_IP_MODIFY WM_USER+114
#define WM_UPLOADSUCCESS WM_USER+115
#define USER_STATUS_EVENT WM_USER+116
#define WM_USER_PALY_BACK WM_USER+117
#define TIMER_PLAY_BACK WM_USER+118
#define WM_TIMER_GETVERSION WM_USER+109
#define UPGRADE_USER_MSG WM_USER+8000


extern HANDLE g_EVENT_STOP_MEDIA;
extern HANDLE g_EVENT_LOGIN_STATUS;

#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif
