//---------------------------------------------------------------------------- // 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: PMic1300.h // AUTHOR: Chizhevskiy Sergey // OVERVIEW // ~~~~~~~~ // Header file of CProtocolMic1300PTZ //---------------------------------------------------------------------------- #ifndef __PROTOCOL__MIC_1_300__PTZ__H__INCLUDED__ #define __PROTOCOL__MIC_1_300__PTZ__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 CProtocolMic1300PTZ : public CProtocol { public: CProtocolMic1300PTZ(); virtual ~CProtocolMic1300PTZ(); public: BOOL Create( CConnection *pConnection ); void Destroy(); public: void SetAddress( BYTE 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 { HEADER_POS = 0U, // position of header byte ADDRESS_POS = 1U, // position of address LENGTH_POS = 3U, // position of data length CFLAG_POS = 5U, // position of data length HEADER_SIZE = 5U, // header + address(2) + length(2) MIN_COMMAND_SIZE = 8U, // header + address(2) + length(2) + ctrlflag + ctrlcode + checksumm MAX_DATA_LENGTH = 247U, // maximun data size MAX_COMMAND_SIZE = (MAX_DATA_LENGTH + MIN_COMMAND_SIZE), // header + address(2) + length(2) + ctrlflag + ctrlcode + data(N) + checksumm HEADER_TAG = 0x0AU, // header byte }; private: CConnection*m_pConnection; BYTE m_pBuffer[MAX_COMMAND_SIZE]; PBYTE m_pBufferPtr; INT m_nCount; private: BYTE m_pAddress[2]; private: BOOL m_bReadAnyAddress; }; #endif