//---------------------------------------------------------------------------- // Laser Guard Ltd. // Copyright © 2000-2002. All Rights Reserved. // Version 1.0 01/01/2000 // Last modification: 08/10/2003 // PROJECT: // SUBSYSTEM: // FILE: DeviceRabbit.h // AUTHOR: Sergey Chizhevskiy // OVERVIEW // ~~~~~~~~ // Header file of DeviceRabbit.h //---------------------------------------------------------------------------- // DeviceRabbit.h: interface for the CDeviceRabbit class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_DEVICERABBIT_H__6860E463_7FF2_4A81_B01E_400815D37D99__INCLUDED_) #define AFX_DEVICERABBIT_H__6860E463_7FF2_4A81_B01E_400815D37D99__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "DeviceDI.h" #include "DevicePTZ.h" #include "DeviceDO.h" #include "DeviceMD.h" #include "DeviceVM.h" class CDeviceRabbit: public CDeviceMD, public CDeviceDI, public CDeviceDO, public CDevicePTZ { public: CDeviceRabbit(); virtual ~CDeviceRabbit(); public: enum { DI_INPUT_COUNT = 16, DO_OUTPUT_COUNT = 12, VM_OUTPUT_COUNT = 1, VM_INPUT_COUNT = 2 }; protected: virtual BOOL GetCommand( LPBYTE pBuffer, DWORD &dwCount, BOOL &bNext ); virtual BOOL SetAnswer( LPBYTE pBuffer, DWORD dwCount ); private: struct DATA_MOVE { int nDir; double speed; }m_DataPan, m_DataTilt, m_DataZoom; struct DATA_PTZ { double pan; double tilt; double zoom; }m_DataPtz; struct DATA_VM { int nOutput[2][ VM_OUTPUT_COUNT ]; }m_DataVM; WORD m_wInputBits; WORD m_wOutputBits; BOOL m_bWaitForPTZReady; private: BOOL m_bCmdPtz[ PTZC_COUNT ]; BOOL m_bCmdDI[ DDIC_COUNT ]; BOOL m_bCmdDO[ DDOC_COUNT ]; BOOL m_bCmdVM[ CDeviceVM::DVMC_COUNT ]; private: CDeviceVM m_DeviceVM[2]; public: CDeviceVM *GetDeviceVM( int nIndex ){ return ( nIndex < 2 ) ? &m_DeviceVM[nIndex] : NULL; } private: double ConvertPanToDegree( WORD Pan ) { return 360.0 - ((double)Pan) * 360.0 / 512.0; } WORD ConvertDegreeToPan( double Angle ) { return (WORD)( ( ( 360.0 - Angle ) * 512.0 ) / 360.0 ); } double ConvertTiltToDegree( WORD Tilt ) { return 90.0 - ((double)Tilt) * 360.0 / 512.0; } WORD ConvertDegreeToTilt( double Angle ) { return (WORD)( ( ( 90.0 - Angle ) * 512.0 ) / 360.0 ); } double ConvertZoomToPercent( WORD Zoom ) { return ((double)Zoom) * 100.0 / 511.0; } WORD ConvertPercentToZoom( double Percent ) { return (WORD)( ( Percent * 511) / 100.0); } double ConvertSpeedToPercent( BYTE Speed ) { return ((double)Speed) * 100.0 / 63.0; } BYTE ConvertPercentToSpeed( double Percent ) { return (BYTE)( ( Percent * 63.0 ) / 100.0 ); } }; #endif