#ifndef _DEVCTLPTZ_H_
#define _DEVCTLPTZ_H_

#include "dllexport.h"

class IDevUserLogin;
class IDevPreview;

enum tagEnumDevPresetCmdType 
{
	DEV_SET_PRESET = 8,
	DEV_CLE_PRESET = 9,
	DEV_GOTO_PRESET = 39
};

enum tagEnumDevCruiseCmdType
{
	DEV_FILL_PRE_SEQ  = 30, //将预置点加入巡航序列 
	DEV_SET_SEQ_DWELL = 31, //设置巡航点停顿时间 
	DEV_SET_SEQ_SPEED = 32, //设置巡航速度 
	DEV_CLE_PRE_SEQ   = 33, //将预置点从巡航序列中删除 
	DEV_RUN_SEQ       = 37, //开始巡航 
	DEV_STOP_SEQ      = 38, //停止巡航 
    DEV_SEQ_END       = 39
};

enum tagEnumDevControlCmdType
{
    DEV_CONTROL_CMD_LIGHT_PWRON		= 2,		/* 接通灯光电源 */
    DEV_CONTROL_CMD_WIPER_PWRON		= 3,		/* 接通雨刷开关 */
    DEV_CONTROL_CMD_FAN_PWRON 		= 4,		/* 接通风扇开关 */
    DEV_CONTROL_CMD_HEATER_PWRON 	= 5,		/* 接通加热器开关 */
    DEV_CONTROL_CMD_AUX_PWRON1		= 6,		/* 接通辅助设备开关 */	
    DEV_CONTROL_CMD_AUX_PWRON2 		= 7,		/* 接通辅助设备开关 */
    DEV_CONTROL_CMD_SET_PRESET		= 8,		/* 设置预置点 */
    DEV_CONTROL_CMD_CLE_PRESET 		= 9,		/* 清除预置点 */

    DEV_CONTROL_CMD_ZOOM_IN 		= 11, 		// 焦距变大
    DEV_CONTROL_CMD_ZOOM_OUT		= 12,		// 焦距变小
    DEV_CONTROL_CMD_FOCUS_NEAR		= 13,		// 焦点前调
    DEV_CONTROL_CMD_FOCUS_FAR		= 14,		// 焦点后调
    DEV_CONTROL_CMD_IRIS_OPEN		= 15,		// 光圈扩大 
    DEV_CONTROL_CMD_IRIS_CLOSE		= 16,		// 光圈扩大 

    DEV_CONTROL_CMD_TILT_UP			= 21,		/* 云台以SS的速度上仰 */
    DEV_CONTROL_CMD_TILT_DOWN 		= 22,		/* 云台以SS的速度下俯 */
    DEV_CONTROL_CMD_PAN_LEFT 		= 23,		/* 云台以SS的速度左转 */
    DEV_CONTROL_CMD_PAN_RIGHT 		= 24,		/* 云台以SS的速度右转 */
    DEV_CONTROL_CMD_UP_LEFT 		= 25,		/* 云台以SS的速度上仰和左转 */
    DEV_CONTROL_CMD_UP_RIGHT 		= 26,		/* 云台以SS的速度上仰和右转 */
    DEV_CONTROL_CMD_DOWN_LEFT 		= 27,		/* 云台以SS的速度下俯和左转 */
    DEV_CONTROL_CMD_DOWN_RIGHT 		= 28,		/* 云台以SS的速度下俯和右转 */
    DEV_CONTROL_CMD_PAN_AUTO 		= 29,		/* 云台以SS的速度左右自动扫描 */

	DEV_CONTROL_CMD_FILL_PRE_SEQ	= 30,	    /* 将预置点加入巡航序列 */
	DEV_CONTROL_CMD_SET_SEQ_DWELL	= 31,	    /* 设置巡航点停顿时间 */
	DEV_CONTROL_CMD_SET_SEQ_SPEED	= 32,	    /* 设置巡航速度 */
	DEV_CONTROL_CMD_CLE_PRE_SEQ	    = 33,	    /* 将预置点从巡航序列中删除 */
	DEV_CONTROL_CMD_STA_MEM_CRUISE	= 34,	    /* 开始记录轨迹 */
	DEV_CONTROL_CMD_STO_MEM_CRUISE	= 35,	    /* 停止记录轨迹 */
	DEV_CONTROL_CMD_RUN_CRUISE		= 36,	    /* 开始轨迹 */
	DEV_CONTROL_CMD_RUN_SEQ		    = 37,	    /* 开始巡航 */
	DEV_CONTROL_CMD_STOP_SEQ		= 38,	    /* 停止巡航 */
	DEV_CONTROL_CMD_GOTO_PRESET	    = 39,	    /* 快球转到预置点 */

    DEV_CONTROL_CMD_MAX
};

typedef struct
{
	int	PresetNum;	
	int	Dwell;		
	int	Speed;		
} DEV_CRUISE_POINT;

typedef struct
{
	int nIndex;
	int nPresetNum;
	int Dwell;
	int Speed;
}DEV_CRUISE_POINT2;

typedef struct
{
	DEV_CRUISE_POINT cruisePoint[32];
} PTZCruisePath;

class IDevCtlPtz
{
public:
    virtual int  GetSpeed(void) = 0;
	virtual void  SetSpeed(int iSpeed) = 0;
	virtual BOOL PTZControl(int iPTZType, DWORD dwStop) = 0;
	virtual BOOL PTZCruise(DWORD dwPTZCruiseCmd, BYTE byCruiseRoute, BYTE byCruisePoint, WORD wInput) = 0;
	virtual BOOL PTZPreset(DWORD dwPTZPresetCmd, DWORD dwPresetIndex) = 0;
	virtual BOOL GetPTZCruise(LONG lCruiseRoute, PTZCruisePath *lpCruise, LONG lChn = -1) = 0;
	virtual BOOL PTZTrack(DWORD dwPTZTrackCmd) = 0;
};

class DLLAPI CDevCtlPtzFactory
{
public:
	static IDevCtlPtz *CreateDevCtlPtz(IDevUserLogin *pUser, LONG lChannel, IDevPreview *p);
	static IDevCtlPtz *CreateDevCtlPtz(IDevUserLogin *pUser, IDevPreview *p);
	static void DeleteDevCtlPtz(IDevCtlPtz *pCtlPtz, IDevUserLogin *pUsr);
};

#endif
