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.

75 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: PMic1300.h
  9. // AUTHOR: Chizhevskiy Sergey
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of CProtocolMic1300PTZ
  13. //----------------------------------------------------------------------------
  14. #ifndef __PROTOCOL__MIC_1_300__PTZ__H__INCLUDED__
  15. #define __PROTOCOL__MIC_1_300__PTZ__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 CProtocolMic1300PTZ : public CProtocol
  27. {
  28. public:
  29. CProtocolMic1300PTZ();
  30. virtual ~CProtocolMic1300PTZ();
  31. public:
  32. BOOL Create( CConnection *pConnection );
  33. void Destroy();
  34. public:
  35. void SetAddress( BYTE 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. HEADER_POS = 0U, // position of header byte
  43. ADDRESS_POS = 1U, // position of address
  44. LENGTH_POS = 3U, // position of data length
  45. CFLAG_POS = 5U, // position of data length
  46. HEADER_SIZE = 5U, // header + address(2) + length(2)
  47. MIN_COMMAND_SIZE = 8U, // header + address(2) + length(2) + ctrlflag + ctrlcode + checksumm
  48. MAX_DATA_LENGTH = 247U, // maximun data size
  49. MAX_COMMAND_SIZE = (MAX_DATA_LENGTH + MIN_COMMAND_SIZE), // header + address(2) + length(2) + ctrlflag + ctrlcode + data(N) + checksumm
  50. HEADER_TAG = 0x0AU, // header byte
  51. };
  52. private:
  53. CConnection*m_pConnection;
  54. BYTE m_pBuffer[MAX_COMMAND_SIZE];
  55. PBYTE m_pBufferPtr;
  56. INT m_nCount;
  57. private:
  58. BYTE m_pAddress[2];
  59. private:
  60. BOOL m_bReadAnyAddress;
  61. };
  62. #endif