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.

66 lines
1.6 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: 30/08/2001
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: RS232.h
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of RS232.h
  13. //----------------------------------------------------------------------------
  14. #ifndef __CONNECTION__RS232__H__INCLUDED__
  15. #define __CONNECTION__RS232__H__INCLUDED__
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif
  19. #include "Connect.h"
  20. class CConnectionRS232 :
  21. public CConnection
  22. {
  23. public:
  24. CConnectionRS232();
  25. virtual ~CConnectionRS232();
  26. public:
  27. BOOL Create( LPCTSTR pPort, INT nBaudRate, INT nBitCount, INT nParity, INT nStopBit, DWORD dwReadBufferSize, DWORD dwWriteBufferSize );
  28. void Destroy();
  29. public:
  30. HANDLE GetCommPortHandle() { return m_hCommPort; }
  31. HANDLE GetOperationStopEvent() { return m_hEventQuit; }
  32. public:
  33. virtual DWORD Read( IN PBYTE pBuffer, IN DWORD dwSize, IN DWORD dwTimeout );
  34. virtual DWORD Write( IN PBYTE pBuffer, IN DWORD dwSize, IN DWORD dwTimeout );
  35. private:
  36. HANDLE m_hCommPort;
  37. DWORD m_dwCommMask;
  38. OVERLAPPED m_ovWrite;
  39. OVERLAPPED m_ovWriteWait;
  40. OVERLAPPED m_ovRead;
  41. OVERLAPPED m_ovReadWait;
  42. HANDLE m_hEventQuit;
  43. struct tagCreateParams
  44. {
  45. TCHAR pPort[MAX_PATH];
  46. INT nBaudRate;
  47. INT nBitCount;
  48. INT nParity;
  49. INT nStopBit;
  50. DWORD dwReadBufferSize;
  51. DWORD dwWriteBufferSize;
  52. }m_CreateParams;
  53. private:
  54. BOOL Create();
  55. };
  56. #endif