Old fashion design for PC-104
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.

74 lines
2.1 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT: Laserguard libraries
  7. // SUBSYSTEM: Communication support library
  8. // FILE: ProtPTZm.h
  9. // AUTHOR: Chizhevskiy Sergey
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of CProtocolMigvanPTZ
  13. //----------------------------------------------------------------------------
  14. #ifndef __PROT__PTZ__M__H__INCLUDED__
  15. #define __PROT__PTZ__M__H__INCLUDED__
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif
  19. #ifdef __BORLANDC__
  20. #include "..\LgLib\Comm\Connect.h"
  21. #include "..\LgLib\Comm\Protocol.h"
  22. #else
  23. #include "Connect.h"
  24. #include "Protocol.h"
  25. #endif
  26. class CProtocolMigvanPTZ : public CProtocol
  27. {
  28. public:
  29. CProtocolMigvanPTZ();
  30. virtual ~CProtocolMigvanPTZ();
  31. public:
  32. BOOL Create( CConnection *pConnection );
  33. void Destroy();
  34. public:
  35. void SetAddress( BYTE bAddress ) { m_bAddress = bAddress; }
  36. void SetReadAnyAddress( BOOL bReadAnyAddress ) { m_bReadAnyAddress = bReadAnyAddress; }
  37. public:
  38. virtual BOOL Read( PBYTE *ppBuffer, PINT pCount, DWORD dwTimeout, BOOL bHost );
  39. virtual BOOL Write( PBYTE pBuffer, INT nCount, DWORD dwTimeout, BOOL bHost );
  40. public:
  41. enum {
  42. ADDRESS_POS = 0U, // position of header byte
  43. LENGTH_POS = 1U, // position of data length byte
  44. TYPE_POS = 2U, // position of command type byte
  45. COMMAND_POS = 3U, // position of command byte
  46. HEADER_SIZE = 2U, // address byte + length byte
  47. MIN_COMMAND_SIZE = 3U, // address byte + length byte + checksumm byte
  48. MAX_DATA_LENGTH = 20U, // maximun data size
  49. MAX_COMMAND_SIZE = (MAX_DATA_LENGTH + MIN_COMMAND_SIZE), // command,length,data0..dataN,checksum (N < 32)
  50. };
  51. private:
  52. CConnection*m_pConnection;
  53. BYTE m_pBuffer[MAX_COMMAND_SIZE];
  54. PBYTE m_pBufferPtr;
  55. INT m_nCount;
  56. private:
  57. BYTE m_bAddress;
  58. private:
  59. // covers bug in protocol (command "QUERY DOME ADDRESS")
  60. BOOL m_bReadAnyAddress;
  61. };
  62. #endif