#pragma once

#include "XnsDeviceInterface.h"

#define STR_LEN_NAME				127	
#define STR_LEN_ID					 63	
#define STR_LEN_PSWD				 41	
#define STR_LEN_PTZ_NAME			 41	
#define STR_LEN_IP					 16	
#define STR_LEN_MAC					 13
#define STR_LEN_DOMAIN				255		
#define STR_LEN_URL					255	
#define STR_LEN_DDNSID				 21	
#define STR_LEN_VERSION				128	
#define STR_LEN_DESCRIPTION			255	
#define STR_LEN_PHONE				 63	
#define STR_LEN_ADDRESS				255	
#define STR_LEN_PATH				512

//#define ERR_NOT_INITIALIZE			-1	// 0xFFFFFFFF

#define ERR_SUCCESS					0x00000000
#define ERR_UNKNOWN					0x00000001

// Initialize
#define ERR_INVALID_CFG_FILE	 	0x00000010
#define ERR_CFG_FILE_READ_ERROR		0x00000011
#define ERR_ALREADY_INITIALIZE		0x00000012
#define ERR_NOT_INITIALIZE			0x00000013

// ADDED BY SSO(2011.06.03):디바이스핸들유무 체크후 삭제하도록 예외처리추가
// ADDED BY HH3.KIM(2011.06.08):디바이스핸들 체크 에러시 0을 리턴하지 않고 아래의 값을 리턴하도록 변경함.
#define ERR_INVALID_DEVICE_HANDLE	0x00000014
#define ERR_ALREADY_EXIST_DEVICEID	0x00000015

// Device Connection
#define ERR_NOT_SUPPORTED_DEVICE	0x00000020
#define ERR_EXCEED_CONNECTION		0x00000021
#define ERR_NOT_CONNECT				0x00000022
#define ERR_MAC_CONFLICT			0x00000023
#define ERR_INVALID_VERSION			0x00000024
#define ERR_INVALID_MODEL			0x00000025
#define ERR_ALREADY_CONNECT			0x00000026

// Login Error
#define ERR_INVALID_USERID			0x00000030
#define ERR_WRONG_PASSWORD			0x00000031
#define ERR_LOGIN					0x00000032
#define ERR_ADMIN_CONFLICT			0x00000033
#define ERR_USER_FULL				0x00000034
// Query Request
#define ERR_XNS_BUSY				0x00000040
#define ERR_BAD_NETWORK				0x00000041
#define ERR_REQUEST_TIME_OUT		0x00000042
#define ERR_INVALID_PARAMETER		0x00000043
#define ERR_NO_PERMISSION			0x00000044
#define ERR_NOT_SUPPORTED_COMMAND	0x00000045
// File Transfer
#define ERR_INVALID_FILE			0x00000050
#define ERR_UPLOAD_FAIL				0x00000051
#define ERR_IMPORT_FAIL				0x00000052
#define ERR_EXPORT_FAIL				0x00000053
#define ERR_FILE_TRANSFERRING		0x00000054
// Media Open
//#define ERR_VIDEO_LOSS				0x0000001a
//#define ERR_COVERT					0x0000001b
#define ERR_MEDIA_ALREADY_OPEND		0x00000060
// PTZ Control
#define ERR_PTZ_CONFLICT			0x00000070
// XnsWindow Error
#define ERR_INVALID_OBJID			0x00000080
#define ERR_ALREADY_RUN				0x00000081
#define ERR_MEDIA_NOT_OPENED		0x00000082
#define ERR_MEDIA_PAUSED			0x00000083
#define ERR_MEDIA_PLAYED			0x00000084
#define ERR_MEDIA_DISCONNECTED		0x00000085
// File Error
#define ERR_FILE_ALREADY_OPEND		0x00000090
#define ERR_FILE_NOT_OPEND			0x00000091
#define ERR_FILE_OPEN				0x00000092
#define ERR_FILE_SEEK				0x00000093
#define ERR_FILE_READ				0x00000094
#define ERR_FILE_WRITE				0x00000095
#define ERR_INVALID_FRAME			0x00000096
#define ERR_WRITE_STOPPED			0x00000097
#define ERR_WRITE_LIMITED			0x00000098
#define ERR_WRITE_EMPTY				0x00000099
#define ERR_DISK_FULL				0x0000009a
#define ERR_READ_END				0x0000009b
#define ERR_ALREADY_RECORDED		0x0000009c
#define ERR_BACKUP_DOING			0x0000009d

#define ERR_INVALID_XML				0x000000b0
#define ERR_OVERLAPPED				0x000000b1
#define ERR_LIMITED					0x000000b2

#define ERR_BUFFER_FULL				0x000000c0
#define ERR_INVALID_SEQUENCE		0x000000c1
#define ERR_TALK_ALREADY_USE		0x000000c2

// EMAIL INFO 디파인
#define ERR_EMAIL_ALREADY_KEY_EXIST 0x000000d1
#define ERR_EMAIL_KEY_NOT_EXIST		0x000000d2
#define ERR_EMAIL_INVALID_KEY		0x000000d3
#define ERR_EMAIL_SEND_FAIL			0x000000d4
#define ERR_EMAIL_INFO_LIMIT		0x000000d5

//+ jungkoo.kang <2012.11.28> Device Disconnect 에러코드 추가함
#define ERR_DISCONNECT_LOGOUT_BY_ADMIN		0x000000e0
#define ERR_DISCONNECT_TIME_CHANGE			0x000000e1
#define ERR_DISCONNECT_HDD_ERASE			0x000000e2
#define ERR_DISCONNECT_HDD_UNMOUNT			0x000000e3
#define ERR_DISCONNECT_LOAD_FACTORY_DEFAULT	0x000000e4
#define ERR_DISCONNECT_IMPORTED_CONFIG		0x000000e5
#define ERR_DISCONNECT_SYSTEM_SHUTDOWN		0x000000e6
#define ERR_DISCONNECT_REBOOT_MANUALLY		0x000000e7
#define ERR_DISCONNECT_REBOOT_UPGRADE		0x000000e8
#define ERR_DISCONNECT_NETWORK_CHANGE		0x000000e9
//+

//+ jungkoo.kang <2013.04.12> Banamex 관련 Siteminder 접속실패 에러코드 추가
#define ERR_SITEMINDER_CONN_FAILED			0x000000f0
#define ERR_SITEMINDER_AUTH_FAILED			0x000000f1

#define NETADR_IP					1
#define NETADR_URL					2
#define NETADR_DDNS_SAMSUNG			3
#define NETADR_DDNS_S1				4

#define SEC_WRITER					1
#define REC_WRITER					2

#define MEDIA_TYPE_LIVE				1
#define	MEDIA_TYPE_PLAYBACK			2
#define	MEDIA_TYPE_BACKUP			3
//#define MEDIA_TYPE_LIVE_CODEC1	4
//#define MEDIA_TYPE_LIVE_CODEC2	5
//#define MEDIA_TYPE_FILE			6

#define PTZ_MENU_UP					1
#define PTZ_MENU_DOWN				2
#define PTZ_MENU_LEFT				3
#define PTZ_MENU_RIGHT				4
#define PTZ_MENU_ENTER				5
#define PTZ_MENU_ON					6
#define PTZ_MENU_OFF				7
#define PTZ_MENU_CANCEL				8

#define PTZ_UP						1
#define PTZ_DOWN					2
#define PTZ_LEFT					3
#define PTZ_RIGHT					4
#define PTZ_UPLEFT					5
#define PTZ_UPRIGHT					6
#define PTZ_DOWNLEFT				7
#define PTZ_DOWNRIGHT				8
#define PTZ_ZOOMIN					9
#define PTZ_ZOOMOUT					10
#define PTZ_STOP					11
#define PTZ_FOCUS_NEAR				12
#define PTZ_FOCUS_FAR				13
#define PTZ_FOCUS_STOP				14
#define PTZ_IRIS_OPEN				15
#define PTZ_IRIS_CLOSE				16

#define CAM_STATUS_ON				0x00000001
#define CAM_STATUS_SIGNAL			0x00000002
#define CAM_STATUS_COVERT1			0x00000004
#define CAM_STATUS_COVERT2			0x00000008
#define CAM_STATUS_ACTIVATED		0x00000010

#define CAM_STATUS_NONE				0x00000000
#define CAM_STATUS_MASK_ALL			0xffffffff

#define CAP_NONE					0x00000000
#define CAP_MASK_ALL				0xffffffff

#define DEVICE_CAP_NONE				0x00000000
#define DEVICE_CAP_SW_UPLOAD		0x00000001
#define DEVICE_CAP_CFG_IMPORT		0x00000002
#define DEVICE_CAP_CFG_EXPORT		0x00000004
#define DEVICE_CAP_CONN_FORCED		0x00000008
#define DEVICE_CAP_MEDIA_AUTHORITY	0x00000010
#define DEVICE_CAP_FSPEED1			0x00020000
#define DEVICE_CAP_FSPEED2			0x00040000
#define DEVICE_CAP_FSPEED4			0x00060000
#define DEVICE_CAP_FSPEED8			0x00080000
#define DEVICE_CAP_FSPEED16			0x000a0000
#define DEVICE_CAP_FSPEED32			0x000c0000
#define DEVICE_CAP_FSPEED64			0x000e0000
#define DEVICE_CAP_BSPEED1			0x00100000
#define DEVICE_CAP_BSPEED2			0x00200000
#define DEVICE_CAP_BSPEED4			0x00300000
#define DEVICE_CAP_BSPEED8			0x00400000
#define DEVICE_CAP_BSPEED16			0x00500000
#define DEVICE_CAP_BSPEED32			0x00600000
#define DEVICE_CAP_BSPEED64			0x00700000
#define DEVICE_CAP_FSSPEED1			0x00800000
#define DEVICE_CAP_FSSPEED2			0x01000000
#define DEVICE_CAP_FSSPEED4			0x01800000
#define DEVICE_CAP_FSSPEED8			0x02000000
#define DEVICE_CAP_FSSPEED16		0x02800000
#define DEVICE_CAP_FSSPEED32		0x03000000
#define DEVICE_CAP_FSSPEED64		0x03800000
#define DEVICE_CAP_BSSPEED1			0x04000000
#define DEVICE_CAP_BSSPEED2			0x08000000
#define DEVICE_CAP_BSSPEED4			0x0c000000
#define DEVICE_CAP_BSSPEED8			0x10000000
#define DEVICE_CAP_BSSPEED16		0x14000000
#define DEVICE_CAP_BSSPEED32		0x18000000
#define DEVICE_CAP_BSSPEED64		0x1c000000
#define DEVICE_CAP_SEEK				0x20000000
#define DEVICE_CAP_FSTEP			0x40000000
#define DEVICE_CAP_BSTEP			0x80000000

#define DEVICE_CAP_MASK_OFFLINE		0xfffe001f
#define DEVICE_CAP_MASK_ONLINE		0x0001ffe0

#define CHANNEL_CAP_LIVE			0x00000001
#define CHANNEL_CAP_SEARCH			0x00000002
#define CHANNEL_CAP_BACKUP			0x00000004
#define CHANNEL_CAP_LISTEN			0x00000008
#define CHANNEL_CAP_TALK			0x00000010
#define CHANNEL_CAP_MENU			0x00000020
#define CHANNEL_CAP_PTZ_PAN			0x00000040
#define CHANNEL_CAP_PTZ_TILT		0x00000080
#define CHANNEL_CAP_PTZ_ZOOM		0x00000100
#define CHANNEL_CAP_PTZ_SPEED		0x00000200
#define CHANNEL_CAP_PTZ_PRESET		0x00000400
#define CHANNEL_CAP_PTZ_FUNCTION	0x00000800
#define CHANNEL_CAP_PTZ_POWER		0x00001000
#define CHANNEL_CAP_IRIS			0x00002000
#define CHANNEL_CAP_FOCUS			0x00004000
#define CHANNEL_CAP_BRIGHTNESS		0x00008000
#define CHANNEL_CAP_CONTRAST		0x00010000
#define CHANNEL_CAP_PTZ_FREE_MOVE	0x00020000
#define CHANNEL_CAP_PTZ_SPEED_ZOOM	0x00040000

#define VIDEO_CAP_LIVE				0x00000001

#define ALARMOUT_CAP_ONOFF			0x00000001

#define REC_TYPE_NONE				0x00
#define REC_TYPE_MOTION				0x01
#define REC_TYPE_ALARM				0x02
#define REC_TYPE_VLOSS				0x04
#define REC_TYPE_MANUAL				0x08
#define REC_TYPE_CONTINUOS			0x10
#define REC_TYPE_ALL				0xff

#define HPTZ_TYPE_PRESET			1
#define HPTZ_TYPE_AUTOPAN			2
#define HPTZ_TYPE_SCAN				3
#define HPTZ_TYPE_PATTERN			4

#define FILE_TRANS_SW_UP			1
#define FILE_TRANS_CFG_IMPORT		2
#define FILE_TRANS_CFG_EXPORT		3

#define MEDIA_VIDEO					1
#define MEDIA_AUDIO					2

#define VCODEC_UNKNOWN				0x00000000
#define VCODEC_JPEG					0x00000001
#define VCODEC_MJPEG				0x00000002
#define VCODEC_MP4V					0x00000004
#define VCODEC_MP4V_ASP				0x00000008
#define VCODEC_PENTA				0x00000010
#define VCODEC_SOLO					0x00000020
#define VCODEC_H264					0x00000040
#define ACODEC_G711					0x00010000	
#define ACODEC_G711_IPCAM			0x00010001
#define ACODEC_G726					0x00020000
#define ACODEC_PCM					0x00040000
#define ACODEC_G726_504X			0x00080000
#define ACODEC_IMA_ADPCM			0x00100000
#define ACODEC_G723					0x00200000 

#define FRAME_UNKNOWN				0
#define FRAME_IVOP					1
#define FRAME_PVOP					2
#define FRAME_BVOP					3
#define FRAME_END					4

#define OBJ_ALL						0xFFFFFFFF
#define XOBJ_ALL					0x000000FF
#define XOBJ_DEVICE					0x00000001
#define XOBJ_CHANNEL				0x00000002
#define XOBJ_VIDEO					0x00000004
#define XOBJ_ALARMIN				0x00000008
#define XOBJ_ALARMOUT				0x00000010

#define PLAY_TYPE_NONE				0
#define PLAY_TYPE_LIVE				1
#define PLAY_TYPE_PLAYBACK			2

#define MEDIA_STATUS_NONE			0

#define LIVE_STATUS_ON				1
#define LIVE_STATUS_VLOSS			2
#define LIVE_STATUS_COVERT			3
#define LIVE_STATUS_DISALBE			4
#define LIVE_STATUS_DISCONNECT		5

#define PLAYBACK_STATUS_PLAY		1
#define PLAYBACK_STATUS_PAUSE		2
#define PLAYBACK_STATUS_NODATA		3
#define PLAYBACK_STATUS_COVERT		4
#define PLAYBACK_STATUS_DISCONNECT	5

// OSD TYPE
#define OSD_ALL						0x0000FFFF
#define OSD_TIME1					0x00000001
#define OSD_TIME2					0x00000002
#define OSD_IPS						0x00000004
#define OSD_LOCAL_NAME				0x00000008
#define OSD_REMOTE_NAME				0x00000010
#define OSD_SPEED					0x00000020
#define OSD_PTZ						0x00000040
#define OSD_LISTEN					0x00000080
#define OSD_TALK					0x00000100
#define OSD_SENSOR					0x00000200
#define OSD_MOTION					0x00000400
#define OSD_DVR_RECORDING			0x00000800
#define OSD_LOCAL_RECORDING			0x00001000


#define EVENT_ALL					0x000000ff
#define EVENT_ALARM					0x00000001
#define EVENT_MOTION				0x00000002
#define EVENT_VIDEOLOSS				0x00000004

#define EXTRACT_TYPE( nObjectID ) ( (nObjectID&(0xff<<24))>>24 )
#define EXTRACT_SESSIONID( nObjectID ) ( (nObjectID&(0xfff<<12))>>12 )
#define EXTRACT_CHANNELNUM( nObjectID ) ( (nObjectID&(0xff<<4))>>4 )
#define EXTRACT_VIDEONUM( nObjectID ) (nObjectID&0xf )
#define EXTRACT_ALARMINNUM( nObjectID ) ( (nObjectID&(0xff<<4))>>4 )
#define EXTRACT_ALARMOUTNUM( nObjectID ) ( (nObjectID&(0xff<<4))>>4 )
