⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ptzimpl.h

📁 PTZ云台控制code,实用与所有的云台控制
💻 H
字号:
/*-------------------------- [ Comment ] --------------------------------*\
	File name	: ptzimpl.h
	Project		: NVP3100
	Description : 
				  
	Copyright(c) 1997-2007, NEXTCHIP CO., LTD. All rights reserved.
  -----------------------------------------------------------------------
	C0000 - Created by application_team@nextchip.com		2006-01-05
	C0001 - 
\*-----------------------------------------------------------------------*/

#ifndef __PTZIMPL_H__
#define __PTZIMPL_H__

//#include <base.h>

#define IPC_DEBUG 2 //debug info 
 
  #if IPC_DEBUG > 2
 #define printf3(args...)  printf( " " args)
 #else
 #define printf3(args...)  do { } while(0)
 #endif
 
 #if IPC_DEBUG > 1
 #define printf2(args...)  printf( " " args)
 #else
 #define printf2(args...)  do { } while(0)
 #endif
 
 #if IPC_DEBUG > 0
 #define printf1(args...)  printf( " " args)
 #else
 #define printf1(args...)  do { } while(0)
 #endif

typedef unsigned char BYTE;
 #define  FALSE 0
#define TRUE 1

 typedef struct tagPORTPARAMS
{	int		nBaudRate;      // BAUDRATE_ENUM	int		nCharSize;      // CHARSIZE_ENUM	int		nParityBit;     // PARITYBIT_ENUM	int		nStopBit;       // STOPBIT_ENUM	int		fCRTSCTS;       // Hardware Flow Control(1/0)	int		fXONXOFF;       // Sofwware Flow Control(1/0)} NC_PORTPARAMS, *PNC_PORTPARAMS;

 #define	SERIAL_FLUSH_IN_BUFFER		0x1
#define	SERIAL_FLUSH_OUT_BUFFER		0x2#define	SERIAL_FLUSH_ALL_BUFFER		(SERIAL_FLUSH_IN_BUFFER | SERIAL_FLUSH_OUT_BUFFER)enum PARITYBIT_ENUM{	PAR_NONE,	PAR_EVEN,	PAR_ODD};enum BAUDRATE_ENUM{	BAUD0,	BAUD50,	BAUD75,	BAUD110,	BAUD134,	BAUD150,	BAUD200,	BAUD300,	BAUD600,	BAUD1200,	BAUD1800,	BAUD2400,	BAUD4800,	BAUD9600,	BAUD19200,	BAUD38400,	BAUD57600,	BAUD115200,	BAUD230400};
enum CHARSIZE_ENUM{	CHARSIZE5,	CHARSIZE6,	CHARSIZE7,	CHARSIZE8,};enum STOPBIT_ENUM{	STOPBIT1,	STOPBIT2,};
////////////////////////////////////////////////////////////////////////////////

enum _PTZ_COMMAND_
{
	PANTILT_NONE,					// None
	PANTILT_PAN_LEFT,				// PanLeft
	PANTILT_PAN_RIGHT,				// PanRight
	PANTILT_TILT_UP,				// TiltUp
	PANTILT_TILT_DOWN,				// TiltDown
	PANTILT_RESET,					// Reset
	PANTILT_ZOOM_IN,				// ZoomIn
	PANTILT_ZOOM_OUT,				// ZoomOut
	PANTILT_FOCUS_NEAR,				// FocusNear
	PANTILT_FOCUS_FAR,				// FocusFar
	PANTILT_IRIS_OPEN,				// IrisOpen
	PANTILT_IRIS_CLOSE,				// IrisClose
	PANTILT_COUNT					// PanTilt Count
};

enum _PTZ_DEVICE_ID_
{
	PANTILTDEVICE_PELCO_P,			// PELCO-P
	PANTILTDEVICE_PELCO_D,			// PELCO-D
#ifdef SUPPORT_PTZ_LILIN	
	PANTILTDEVICE_MERITLILIN,		// MERIT LILIN
#endif	

	PANTILTDEVICE_MAXID
};

////////////////////////////////////////////////////////////////////////////////

typedef struct tagCOMMPELCOP
{
	BYTE		Stx;				// Stx
	BYTE		Addr;				// Address
	BYTE		Data1;				// Data1
	BYTE		Data2;				// Data2
	BYTE		Data3;				// Data3
	BYTE		Data4;				// Data4
	BYTE		Etx;				// Etx
	BYTE		CheckSum;			// CheckSum
} COMMPELCOP, *PCOMMPELCOP;

typedef struct tagCOMMPELCOD
{
	BYTE		Synch;				// Stx
	BYTE		Addr;				// Address
	BYTE		Cmd1;				// Command 1
	BYTE		Cmd2;				// Command 2
	BYTE		Data1;				// Data 1
	BYTE		Data2;				// Data 2
	BYTE		CheckSum;			// CheckSum
} COMMPELCOD, *PCOMMPELCOD;

////////////////////////////////////////////////////////////////////////////////

int  GetFD485(void);
int  Init485(void);
int  InitPTZPort(int fd, const NC_PORTPARAMS *param);
int  Open485(void);
void Deinit485(void);
int  GetRS485BaudRate(int nPTZDevID);
int WriteTo485(void *pdata, int nsize);

int  DeviceControl(int nControl);
int  ControlPELCO_D(int nPort, int nAddr, int nControl);
int ControlPELCO_P(int nPort, int nAddr, int nControl);

#endif//	__PTZIMPL_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -