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.

79 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:
  7. // SUBSYSTEM:
  8. // FILE: SocketMD.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of SocketMD.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "SensorLGS.h"
  16. #include "SocketMD.h"
  17. #include "SensorArray.h"
  18. #include "DeviceLGSm.h"
  19. #include "..\..\LgLib\Version.h"
  20. #ifdef _DEBUG
  21. #undef THIS_FILE
  22. static char THIS_FILE[]=__FILE__;
  23. #define new DEBUG_NEW
  24. #endif
  25. CSocketMD::CSocketMD()
  26. {
  27. m_nType = SOCKET_MD;
  28. m_bRunning = FALSE;
  29. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CSocketMD::CSocketMD") );
  30. }
  31. CSocketMD::~CSocketMD()
  32. {
  33. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CSocketMD::~CSocketMD") );
  34. }
  35. BOOL CSocketMD::Create( CSensorArray* pSensorArray, LPCTSTR pPort, INT nBaudRate, BOOL bSpyMode )
  36. {
  37. m_pSensorArray = pSensorArray;
  38. if( !CLgNetSocketMD::Create( pPort, nBaudRate, bSpyMode, m_pSensorArray->IsDemo() ) )
  39. {
  40. TCHAR pText[MAX_PATH];
  41. _snprintf( pText, MAX_PATH, _T("Can't create %s'LGS multi-point' line <%s>"), bSpyMode ? "spy " : "", pPort );
  42. m_pSensorArray->GetEventQueue()->PostEvent( LGS_EVENT_SOCKET_COMMUNICATION, FALSE, m_nType, m_nNumber, RGB( 0xFF, 0, 0 ), pText );
  43. return m_bInitiated = FALSE;
  44. }
  45. else
  46. {
  47. TCHAR pText[MAX_PATH];
  48. _snprintf( pText, MAX_PATH, _T("%s'LGS multi-point' line <%s> created"), bSpyMode ? "Spy " : "", pPort );
  49. m_pSensorArray->GetEventQueue()->PostEvent( LGS_EVENT_SOCKET_COMMUNICATION, TRUE, m_nType, m_nNumber, RGB( 0, 0xFF, 0 ), pText );
  50. }
  51. return m_bInitiated = TRUE;
  52. }
  53. void CSocketMD::CommandLoopStart()
  54. {
  55. m_bRunning = TRUE;
  56. CLgNetSocketMD::Pause( FALSE );
  57. }
  58. void CSocketMD::CommandLoopStop()
  59. {
  60. m_bRunning = FALSE;
  61. CLgNetSocketMD::Pause( TRUE );
  62. }
  63. void CSocketMD::Resume()
  64. {
  65. if( m_bRunning )
  66. CLgNetSocketMD::Pause( FALSE );
  67. }