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.
98 lines
2.0 KiB
98 lines
2.0 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 08/10/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: LgNetSocketMic1300PTZ.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of LgNetSocketMic1300PTZ.cpp
|
|
//----------------------------------------------------------------------------
|
|
#include "stdafx.h"
|
|
#include "..\Version.h"
|
|
#include "LgNetSocketMic1300PTZ.h"
|
|
#include "LgNetDeviceMic1300PTZ.h"
|
|
|
|
CLgNetSocketMic1300PTZ::CLgNetSocketMic1300PTZ()
|
|
{
|
|
|
|
}
|
|
|
|
CLgNetSocketMic1300PTZ::~CLgNetSocketMic1300PTZ()
|
|
{
|
|
Destroy();
|
|
|
|
// unlink all linked devices
|
|
CLgLinkP<CLgNetSocket,CLgNetSocketDevice>::Unlink();
|
|
}
|
|
|
|
BOOL CLgNetSocketMic1300PTZ::Create( LPCTSTR pCommPort, BOOL bDemo )
|
|
{
|
|
Destroy();
|
|
|
|
if( !bDemo )
|
|
{
|
|
if( !m_Connection.Create( pCommPort, 9600, 8, ODDPARITY, ONESTOPBIT, 1024, 1024 ) )
|
|
return FALSE;
|
|
|
|
if( !m_Protocol.Create( &m_Connection ) )
|
|
return FALSE;
|
|
}
|
|
|
|
if( !CLgNetSocket::Create( &m_Protocol ) )
|
|
return FALSE;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL CLgNetSocketMic1300PTZ::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 );
|
|
}
|
|
|
|
/*
|
|
BOOL CLgNetSocketMic1300PTZ::SetLowBaudrate( BOOL bLowSpeed )
|
|
{
|
|
DCB dcb;
|
|
if( !m_Connection.GetCommState( &dcb ) )
|
|
return FALSE;
|
|
|
|
return SetBaudrate( bLowSpeed ? 1200 : 9600 );
|
|
|
|
if( bLowSpeed )
|
|
{
|
|
if( dcb.BaudRate != 1200 )
|
|
{
|
|
dcb.BaudRate = 1200;
|
|
return m_Connection.SetCommState( &dcb );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if( dcb.BaudRate != 9600 )
|
|
{
|
|
dcb.BaudRate = 9600;
|
|
return m_Connection.SetCommState( &dcb );
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
*/
|
|
|
|
void CLgNetSocketMic1300PTZ::Destroy()
|
|
{
|
|
CLgNetSocket::Destroy();
|
|
m_Protocol.Destroy();
|
|
m_Connection.Destroy();
|
|
}
|