Old fashion design for PC-104
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.
 
 
 
 
 

109 lines
2.3 KiB

//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright © 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: CMicPTZ.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of CMicPTZ.cpp
//----------------------------------------------------------------------------
#include "stdafx.h"
#include "cmicptz.h"
#ifdef EMBEDDED_CAMERA_MIC
#include "..\lglib\comm\pmic1300.cpp"
#include "..\lglib\device\dmicptz.cpp"
CCameraMic1300PTZ::CCameraMic1300PTZ()
{
m_pComm = NULL;
m_pCamera = NULL;
}
CCameraMic1300PTZ::~CCameraMic1300PTZ()
{
Destroy();
}
BOOL CCameraMic1300PTZ::Create( CCamera *pCamera, CComm485* pComm, CComm485::PORTS nPort, LGS::PCAMERA_PARAMETERS pParameters )
{
// destroy old incarnation :)
Destroy();
m_pCamera = pCamera;
m_pComm = pComm;
if( !m_pComm->Create( nPort, 9600L, 8, CComm485::_ODDPARITY ) )
return FALSE;
if( !m_Protocol.Create( m_pComm ) )
return FALSE;
SetProtocol( &m_Protocol );
SetAddress( 1 );
return CmdInit();
}
void CCameraMic1300PTZ::Destroy()
{
m_Protocol.Destroy();
if( m_pComm )
{
m_pComm->Destroy();
m_pComm = NULL;
}
}
/*
void CCameraMic1300PTZ::Invalidate( DWORD nSlowTimer, WORD nFastTimer, BOOL bFastTimeValid )
{
// update timeout
if( m_lTimeout > 0 && m_dwLastTime != nFastTimer )
{
// DWORD dwDeltaTime = *s_pTimer - m_dwLastTime;
// m_lTimeout -= (LONG)dwDeltaTime * 55;
// m_dwLastTime = *s_pTimer;
m_lTimeout--;
m_dwLastTime = nFastTimer;
}
// write command
if( m_lTimeout <= 0 )
{
if( m_bRead )
ReadProc( &m_Protocol, 0, TRUE );
m_bRead = WriteProc( &m_Protocol, &m_lTimeout );
m_lTimeout <<= 3;
// m_dwLastTime = *s_pTimer;
}
// read reply
if( m_bRead )
{
BOOL bSuccess = ReadProc( &m_Protocol, 0, FALSE );
// if read successeful
if( bSuccess )
m_lTimeout = 0;
m_bRead = !bSuccess;
}
}
*/
BOOL CCameraMic1300PTZ::SetLowBaudrate( BOOL bLowBaudrate )
{
return m_pComm ? m_pComm->SetParameters( bLowBaudrate ? 1200L : 9600L, 8, CComm485::_ODDPARITY ) : FALSE;
}
#endif // EMBEDDED_CAMERA_MIC