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.
112 lines
2.7 KiB
112 lines
2.7 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 19/05/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: LgNetSocketPTZ.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of LgNetSocketPTZ.cpp
|
|
//----------------------------------------------------------------------------
|
|
#include "stdafx.h"
|
|
#include "LgNetSocketPTZ.h"
|
|
|
|
CLgNetSocketPTZ::CLgNetSocketPTZ()
|
|
{
|
|
m_eType = NET_SOCKET_PTZ_NONE;
|
|
}
|
|
|
|
CLgNetSocketPTZ::~CLgNetSocketPTZ()
|
|
{
|
|
Destroy();
|
|
}
|
|
|
|
BOOL CLgNetSocketPTZ::Create( E_NET_SOCKET_PTZ_TYPE eType, LPCTSTR pCommPort, BOOL bDemo )
|
|
{
|
|
Destroy();
|
|
|
|
if( !bDemo )
|
|
{
|
|
switch( eType )
|
|
{
|
|
case NET_SOCKET_PTZ_TKS576:
|
|
if( !m_Connection.Create( pCommPort, 9600, 8, EVENPARITY, ONESTOPBIT, 1024, 1024 ) )
|
|
return FALSE;
|
|
if( !m_ProtocolTKS576.Create( &m_Connection ) )
|
|
return FALSE;
|
|
break;
|
|
case NET_SOCKET_PTZ_PG3AD:
|
|
if( !m_Connection.Create( pCommPort, 9600, 8, NOPARITY, ONESTOPBIT, 1024, 1024 ) )
|
|
return FALSE;
|
|
if( !m_ProtocolPG3AD.Create( &m_Connection ) )
|
|
return FALSE;
|
|
break;
|
|
case NET_SOCKET_PTZ_MIGVAN:
|
|
if( !m_Connection.Create( pCommPort, 4800, 8, NOPARITY, ONESTOPBIT, 1024, 1024 ) )
|
|
return FALSE;
|
|
if( !m_ProtocolMigvan.Create( &m_Connection ) )
|
|
return FALSE;
|
|
break;
|
|
case NET_SOCKET_PTZ_MIC1300:
|
|
if( !m_Connection.Create( pCommPort, 9600, 8, ODDPARITY, ONESTOPBIT, 1024, 1024 ) )
|
|
return FALSE;
|
|
if( !m_ProtocolMic1300.Create( &m_Connection ) )
|
|
return FALSE;
|
|
break;
|
|
default:
|
|
return FALSE;
|
|
}
|
|
}
|
|
|
|
switch( eType )
|
|
{
|
|
case NET_SOCKET_PTZ_TKS576:
|
|
if( !CLgNetSocket::Create( &m_ProtocolTKS576 ) )
|
|
return FALSE;
|
|
break;
|
|
case NET_SOCKET_PTZ_PG3AD:
|
|
if( !CLgNetSocket::Create( &m_ProtocolPG3AD ) )
|
|
return FALSE;
|
|
break;
|
|
case NET_SOCKET_PTZ_MIGVAN:
|
|
if( !CLgNetSocket::Create( &m_ProtocolMigvan ) )
|
|
return FALSE;
|
|
break;
|
|
case NET_SOCKET_PTZ_MIC1300:
|
|
if( !CLgNetSocket::Create( &m_ProtocolMic1300 ) )
|
|
return FALSE;
|
|
break;
|
|
default:
|
|
return FALSE;
|
|
}
|
|
|
|
m_eType = eType;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CLgNetSocketPTZ::Destroy()
|
|
{
|
|
CLgNetSocket::Destroy();
|
|
m_ProtocolTKS576.Destroy();
|
|
m_ProtocolPG3AD.Destroy();
|
|
m_ProtocolMigvan.Destroy();
|
|
m_ProtocolMic1300.Destroy();
|
|
m_Connection.Destroy();
|
|
}
|
|
|
|
BOOL CLgNetSocketPTZ::SetBaudrate( DWORD nBaudrate )
|
|
{
|
|
DCB dcb;
|
|
if( !m_Connection.GetCommState( &dcb ) )
|
|
return FALSE;
|
|
|
|
if( dcb.BaudRate == nBaudrate )
|
|
return TRUE;
|
|
|
|
dcb.BaudRate = nBaudrate;
|
|
return m_Connection.SetCommState( &dcb );
|
|
}
|