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.

85 lines
2.2 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:
  7. // SUBSYSTEM:
  8. // FILE: LgNetMessage.h
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of LgNetMessage.h
  13. //----------------------------------------------------------------------------
  14. #ifndef __LG__MESSAGE__H__INCLUDED__
  15. #define __LG__MESSAGE__H__INCLUDED__
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif
  19. #include "..\Device\LgDevice.h"
  20. class CLgNetMessage
  21. {
  22. public:
  23. // default constructor
  24. CLgNetMessage();
  25. // default constructor with IDs initialization
  26. CLgNetMessage( DWORD dwSenderID, DWORD dwDistinationID );
  27. // copy constructor
  28. CLgNetMessage( const CLgNetMessage& );
  29. // virtual destructor
  30. ~CLgNetMessage();
  31. public:
  32. // operator copy
  33. CLgNetMessage& operator = ( const CLgNetMessage& );
  34. public:
  35. // attributes
  36. void SetDistinationID( DWORD dwDistinationID ) { m_dwDistinationID = dwDistinationID; }
  37. void SetSenderID( DWORD dwSenderID ) { m_dwSenderID = dwSenderID; }
  38. DWORD GetDistinationID() const { return m_dwDistinationID; }
  39. DWORD GetSenderID() const { return m_dwSenderID; }
  40. public:
  41. BOOL GetCommand( PBYTE pCommand ) { return (m_pData && m_nData) ? ( *pCommand = *(PBYTE)m_pData, TRUE ) : FALSE; }
  42. protected:
  43. // data
  44. BOOL SetData( PVOID pData, INT nCount, BOOL bCopy = TRUE );
  45. PVOID GetData() { return m_pData; }
  46. INT GetDataCount() { return m_nData; }
  47. BOOL GetData( PVOID pBuffer, INT nSize );
  48. protected:
  49. BOOL Build( BYTE nCommand, PVOID pData = NULL, INT nCount = 0, BOOL bCopy = TRUE );
  50. const INT GetHeaderSize() const { return sizeof(BYTE); }
  51. public:
  52. // command error
  53. BOOL BuildEvtCommandError( INT nCommand, LPCTSTR pFormat, va_list marker );
  54. BOOL GetEvtCommandError( CLgDevice::PDEVICE_CMD_ERROR pError );
  55. protected:
  56. BOOL AllocData( INT nCount );
  57. /*
  58. public:
  59. enum
  60. {
  61. CMD_DEVICE = 0x01,
  62. EVT_COMMAND_ERROR = 0x80,
  63. EVT_DEVICE = 0x81,
  64. };
  65. */
  66. private:
  67. DWORD m_dwDistinationID;
  68. DWORD m_dwSenderID;
  69. PVOID m_pData;
  70. INT m_nData;
  71. };
  72. #endif