//---------------------------------------------------------------------------- // Laser Guard Ltd. // Copyright © 2000-2002. All Rights Reserved. // Version 1.0 01/01/2000 // Last modification: 08/10/2003 // PROJECT: Laserguard libraries // SUBSYSTEM: Communication support library // FILE: ProtPTZm.h // AUTHOR: Chizhevskiy Sergey // OVERVIEW // ~~~~~~~~ // Header file of CProtocolMigvanPTZ //---------------------------------------------------------------------------- #ifndef __PROT__PTZ__M__H__INCLUDED__ #define __PROT__PTZ__M__H__INCLUDED__ #if _MSC_VER > 1000 #pragma once #endif #ifdef __BORLANDC__ #include "..\LgLib\Comm\Connect.h" #include "..\LgLib\Comm\Protocol.h" #else #include "Connect.h" #include "Protocol.h" #endif class CProtocolMigvanPTZ : public CProtocol { public: CProtocolMigvanPTZ(); virtual ~CProtocolMigvanPTZ(); public: BOOL Create( CConnection *pConnection ); void Destroy(); public: void SetAddress( BYTE bAddress ) { m_bAddress = bAddress; } void SetReadAnyAddress( BOOL bReadAnyAddress ) { m_bReadAnyAddress = bReadAnyAddress; } public: virtual BOOL Read( PBYTE *ppBuffer, PINT pCount, DWORD dwTimeout, BOOL bHost ); virtual BOOL Write( PBYTE pBuffer, INT nCount, DWORD dwTimeout, BOOL bHost ); public: enum { ADDRESS_POS = 0U, // position of header byte LENGTH_POS = 1U, // position of data length byte TYPE_POS = 2U, // position of command type byte COMMAND_POS = 3U, // position of command byte HEADER_SIZE = 2U, // address byte + length byte MIN_COMMAND_SIZE = 3U, // address byte + length byte + checksumm byte MAX_DATA_LENGTH = 20U, // maximun data size MAX_COMMAND_SIZE = (MAX_DATA_LENGTH + MIN_COMMAND_SIZE), // command,length,data0..dataN,checksum (N < 32) }; private: CConnection*m_pConnection; BYTE m_pBuffer[MAX_COMMAND_SIZE]; PBYTE m_pBufferPtr; INT m_nCount; private: BYTE m_bAddress; private: // covers bug in protocol (command "QUERY DOME ADDRESS") BOOL m_bReadAnyAddress; }; #endif