//---------------------------------------------------------------------------- // Laser Guard Ltd. // Copyright © 2000-2002. All Rights Reserved. // Version 1.0 01/01/2000 // Last modification: 08/10/2003 // PROJECT: // SUBSYSTEM: // FILE: cnesher.cpp // AUTHOR: Sergey Chizhevskiy // OVERVIEW // ~~~~~~~~ // Source file of ctks576.cpp //---------------------------------------------------------------------------- #include "stdafx.h" #include "seraphim.h" #ifdef EMBEDDED_CAMERA_SERAPHIM #include "..\lglib\comm\PTZSrph.cpp" #include "..\lglib\device\DSeraphi.cpp" CCameraSeraphimPTZ::CCameraSeraphimPTZ() { m_pComm = NULL; m_pCamera = NULL; } CCameraSeraphimPTZ::~CCameraSeraphimPTZ() { Destroy(); } BOOL CCameraSeraphimPTZ::Create( CCamera *pCamera, CComm485* pComm, CComm485::PORTS nPort, LGS::PCAMERA_PARAMETERS pParameters, SWITCHER_SETTINGS *pSwitcher ) { // destroy old incarnation :) Destroy(); m_pComm = pComm; m_pCamera = pCamera; if( !m_pComm->Create( nPort, 2400L, 8, CComm485::_NOPARITY ) ) return FALSE; if( !m_Protocol.Create( m_pComm ) ) return FALSE; SetProtocol( &m_Protocol ); SetAddress( 2 ); //printf("Seraphim Create\n"); return CmdInit(); //m_pTable[0] = pSwitcher->pTable[0]; //m_pTable[1] = pSwitcher->pTable[1]; //m_pTable[2] = pSwitcher->pTable[2]; //m_nTimeoutCommand = pSwitcher->nReplyTimeout; //m_nTimeoutAfterCommand = pSwitcher->nCommandTimeout; //m_nTimeoutEnterSwitch = pSwitcher->nAutoEnterTimeout * 1000L; // convert to ms //m_nTimeoutInterSwitch = pSwitcher->nAutoSwitchTimeout * 1000L; // convert to ms //m_nSwitchMode = pSwitcher->nAutoMode; //return TRUE; } void CCameraSeraphimPTZ::OnEvtInit(){ //#ifdef EMULATE_SERAPHIM_ON_REAL_PELCO m_pCamera->OnCameraInit(); //#else //#endif } void CCameraSeraphimPTZ::Destroy() { m_Protocol.Destroy(); if( m_pComm ) { m_pComm->Destroy(); m_pComm = NULL; } } BOOL CCameraSeraphimPTZ::CmdSetPTZ( PTZ_DEGREE dPan, PTZ_DEGREE dTilt, PTZ_PERCENT dZoom ){ //if( dPan > m_pTable[2] ) dPan = (LGS_MIRROR_ANGLE_OF_VIEW * 4 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8); //else if ( dPan > m_pTable[1] ) dPan = (LGS_MIRROR_ANGLE_OF_VIEW * 3 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8); //else if ( dPan > m_pTable[0] ) dPan = (LGS_MIRROR_ANGLE_OF_VIEW * 2 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8); //else dPan = (LGS_MIRROR_ANGLE_OF_VIEW * 1 / 4 - LGS_MIRROR_ANGLE_OF_VIEW / 8); return CLgDevicePTZSeraphim::CmdSetPTZ( dPan, dTilt, dZoom ); } #endif // EMBEDDED_CAMERA_SERAPHIM