For DOS Protected Mode version of sensor core software
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.
|
|
//----------------------------------------------------------------------------// Laser Guard Ltd.// Copyright � 2000-2002. All Rights Reserved.// Version 1.0 01/01/2000// Last modification: 08/10/2003// PROJECT: // SUBSYSTEM: // FILE: PTZFlir.cpp// AUTHOR: Sergey Chizhevskiy// OVERVIEW// ~~~~~~~~// Source file of PTZFlir.cpp//----------------------------------------------------------------------------#include "stdafx.h"
#ifdef __BORLANDC__ #include "..\LgLib\Comm\PTZFlir.h"#else #include "PTZFlir.h"#endif
CProtocolPTZFlir::CProtocolPTZFlir(){ m_pConnection = NULL; m_nCount = 0; m_pBufferPtr = m_pBuffer; m_bAddress = 1;}
CProtocolPTZFlir::~CProtocolPTZFlir(){ Destroy();}
BOOL CProtocolPTZFlir::Create( CConnection *pConnection ){ Destroy();
m_pConnection = pConnection; m_pBufferPtr = m_pBuffer; m_nCount = 0;
return TRUE;}
void CProtocolPTZFlir::Destroy(){ m_pConnection = NULL; m_pBufferPtr = m_pBuffer; m_nCount = 0;}
void CProtocolPTZFlir::SetAddress( BYTE bAddress ) { m_bAddress = bAddress;}
BOOL CProtocolPTZFlir::Read( PBYTE *ppBuffer, PINT pCount, DWORD dwTimeout, BOOL bHost ){ bHost;
BOOL bResult = FALSE;
// copy remaining part if( ( m_pBuffer != m_pBufferPtr ) && m_nCount ) memcpy( m_pBuffer, m_pBufferPtr, m_nCount ); // try to read command header if( m_nCount < m_nResponseSize ) { // read new data DWORD nCount = m_nResponseSize - m_nCount; m_nCount += ( m_pConnection->Read( m_pBuffer + m_nCount, nCount, dwTimeout ) ); }
if( m_nCount >= m_nResponseSize ) { // store length (*pCount) = (INT)m_nResponseSize; (*ppBuffer) = m_pBufferPtr;
// shift pointers m_pBufferPtr += m_nResponseSize; m_nCount -= m_nResponseSize;
// at least one command received bResult = TRUE; }
return bResult;}
BOOL CProtocolPTZFlir::Write( PBYTE pBuffer, INT nCount, DWORD dwTimeout, BOOL bHost ){ bHost;
// validate data length if( nCount > MAX_COMMAND_SIZE ) return FALSE;
// clear receiver m_nCount = 0; m_pBufferPtr = m_pBuffer;
// write data DWORD dwDataSize = nCount; return (BOOL)(m_pConnection->Write( pBuffer, dwDataSize, dwTimeout ) == dwDataSize);}
|