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.

69 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: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: DirectOutput.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of DirectOutput.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "DeviceDO.h"
  16. #include "DirectOutput.h"
  17. #include "..\..\LgLib\Version.h"
  18. #ifdef _DEBUG
  19. #undef THIS_FILE
  20. static char THIS_FILE[]=__FILE__;
  21. #define new DEBUG_NEW
  22. #endif
  23. CDirectOutput::CDirectOutput()
  24. {
  25. m_pDeviceDO = NULL;
  26. m_nBit = -1;
  27. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CDirectOutput::CDirectOutput") );
  28. }
  29. CDirectOutput::~CDirectOutput()
  30. {
  31. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CDirectOutput::~CDirectOutput") );
  32. }
  33. void CDirectOutput::CmdOn( BOOL bOn )
  34. {
  35. if( !m_pDeviceDO )
  36. {
  37. LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CDirectOutput::CmdOn"), _T("Link with device is absent") );
  38. return;
  39. }
  40. m_pDeviceDO->PostSetSwitch( bOn, m_nBit );
  41. }
  42. BOOL CDirectOutput::ConnectToDevice( CDeviceDO *pDeviceDO, int nBit, int nSensorBit )
  43. {
  44. if( pDeviceDO->SetDirectOutput( this, nBit ) )
  45. {
  46. m_pDeviceDO = pDeviceDO;
  47. m_nBit = nBit;
  48. m_nSubIndex = nSensorBit;
  49. return TRUE;
  50. }
  51. return FALSE;
  52. }
  53. void CDirectOutput::PostOn(BOOL bOn)
  54. {
  55. DOEVENT event;
  56. event.id = DOC_SET_STATE;
  57. event.bOn = bOn;
  58. m_Queue.Push( event );
  59. }