You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
3.5 KiB
129 lines
3.5 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 2.0 04/04/2000
|
|
// Last modification: 02/06/2001
|
|
// Project Intruder Position Indicator
|
|
// SUBSYSTEM: Camera navigation
|
|
// FILE: Ptz878.h
|
|
// AUTHOR: Chizhevskiy Sergey
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Header file of class CPtz878
|
|
//----------------------------------------------------------------------------
|
|
|
|
#if !defined(__PTZ878__H__INCLUDED__)
|
|
#define __PTZ878__H__INCLUDED__
|
|
|
|
#define RESPONSE_WAIT_TIME 500
|
|
|
|
#define MAX_PACKET_LENGTH 0x20
|
|
|
|
class CApplication;
|
|
class CProfile;
|
|
|
|
class CPtz878
|
|
{
|
|
friend DWORD WINAPI ThreadProcPtz878(LPVOID lpvParam);
|
|
|
|
public:
|
|
CPtz878();
|
|
~CPtz878();
|
|
|
|
public:
|
|
bool IsReady() const;
|
|
|
|
public:
|
|
bool GetReplyData(LPBYTE pPan, LPBYTE pTilt, USHORT *pZoom, LPBYTE pAddress, LPBYTE pSerialNumber);
|
|
bool Create(LPCTSTR pCommPort, CProfile *pProfile);
|
|
bool CameraPanLeft(BYTE address, BYTE speed);
|
|
bool CameraPanRight(BYTE address, BYTE speed);
|
|
bool CameraPanStop(BYTE address);
|
|
bool CameraTiltUp(BYTE address, BYTE speed);
|
|
bool CameraTiltDown(BYTE address, BYTE speed);
|
|
bool CameraTiltStop(BYTE address);
|
|
bool CameraGotoPosition(BYTE address, BYTE pan, BYTE tilt, WORD zoom);
|
|
bool CameraSetAddress(BYTE address, LPBYTE pNumber);
|
|
bool CameraZoomTele(BYTE address);
|
|
bool CameraZoomWide(BYTE address);
|
|
bool CameraZoomStop(BYTE address);
|
|
bool CameraInquarePosition(BYTE address);
|
|
bool CameraSetFocus(BYTE address, bool manual);
|
|
bool CameraSetIris(BYTE address, BYTE iLevel);
|
|
bool CameraWarmBoot();
|
|
bool CameraQueryAddress();
|
|
|
|
public:
|
|
static INT PanToDegree(BYTE Pan, bool fClockwise = FALSE);
|
|
static BYTE DegreeToPan(INT Angle, bool fClockwise = FALSE);
|
|
static __int8 DegreToPan(const double& Angle, bool fClockwise = false); // 12/04/2001
|
|
static WORD ValueToZoom(WORD value);
|
|
static WORD ZoomToValue(WORD zoom);
|
|
|
|
private:
|
|
bool DeinitComm();
|
|
bool InitComm(LPCTSTR pCommPort);
|
|
|
|
DWORD ThreadProc();
|
|
|
|
private:
|
|
bool ProtectCheck();
|
|
|
|
private:
|
|
void ProduceCheckSumAndSize();
|
|
void PanRight(BYTE address, BYTE speed);
|
|
void PanLeft(BYTE address, BYTE speed);
|
|
void PanStop(BYTE address);
|
|
void TiltUp(BYTE address, BYTE speed);
|
|
void TiltDown(BYTE address, BYTE speed);
|
|
void TiltStop(BYTE address);
|
|
void SetPreset(BYTE address, BYTE pan, BYTE tilt, BYTE zoomL, BYTE zoomH);
|
|
void GotoPreset(BYTE address);
|
|
void ZoomTele(BYTE address);
|
|
void ZoomWide(BYTE address);
|
|
void ZoomStop(BYTE address);
|
|
void SetFocus(BYTE address, bool manual);
|
|
void SetIris(BYTE address, BYTE iLevel);
|
|
void InquarePosition(BYTE address);
|
|
void SetAddress(BYTE address, LPBYTE sn);
|
|
void QueryAddress();
|
|
void WarmBoot();
|
|
|
|
private:
|
|
bool InterpretResponse(DWORD dwReaded);
|
|
|
|
private:
|
|
volatile __int8 m_nReadyCount;// 21/05/2001
|
|
volatile bool m_bQuit;
|
|
volatile bool m_bTransfer;
|
|
volatile bool m_bReady;
|
|
|
|
private:
|
|
CProfile* m_pProfile;
|
|
HANDLE m_hThread;
|
|
HANDLE m_hCommPort;
|
|
DWORD m_nResponseSize;
|
|
INT m_ptzCommand;
|
|
INT m_nBufferCount;
|
|
WORD m_ptzZoom;
|
|
BYTE m_pBuffer[MAX_PACKET_LENGTH];
|
|
BYTE m_pResponseBuffer[MAX_PACKET_LENGTH];
|
|
BYTE m_ReplySN[5];
|
|
BYTE m_ptzSN[5];
|
|
BYTE m_ReplyPan;
|
|
BYTE m_ReplyTilt;
|
|
BYTE m_ReplyZoom;
|
|
BYTE m_ReplyAddress;
|
|
BYTE m_ptzPan;
|
|
BYTE m_ptzTilt;
|
|
BYTE m_ptzAddress;
|
|
|
|
};
|
|
|
|
inline
|
|
bool CPtz878::IsReady() const
|
|
{
|
|
return m_bReady;
|
|
}
|
|
|
|
#endif
|