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.

74 lines
1.4 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: LgDevice.cpp
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file of LgDevice.cpp
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #ifdef __BORLANDC__
  16. #include "..\LgLib\Device\LgDevice.h"
  17. #else
  18. #include "LgDevice.h"
  19. #endif
  20. CLgDevice::CLgDevice()
  21. {
  22. // clear commands processing
  23. m_bReadyForCmd = TRUE;
  24. m_nCmd = CMD_NONE;
  25. m_bCmdExist = FALSE;
  26. }
  27. CLgDevice::~CLgDevice()
  28. {
  29. }
  30. BOOL CLgDevice::DoCmd( INT nCommand )
  31. {
  32. // check availibility
  33. if( !m_bReadyForCmd )
  34. return FALSE;
  35. // prevent commands overlapping
  36. m_bReadyForCmd = FALSE;
  37. // store command id
  38. m_nCmd = nCommand;
  39. return m_bCmdExist = TRUE;
  40. }
  41. INT CLgDevice::GetCmd()
  42. {
  43. // if there is no new command
  44. if( !m_bCmdExist )
  45. return CMD_NONE;
  46. // mark that command taken
  47. m_bCmdExist = FALSE;
  48. // mark that not ready for new messages
  49. m_bReadyForCmd = FALSE;
  50. // return commands
  51. return m_nCmd;
  52. }
  53. void CLgDevice::ReleaseCmd()
  54. {
  55. // ready to process new message
  56. m_bReadyForCmd = TRUE;
  57. }
  58. BOOL CLgDevice::IsReadyForCmd()
  59. {
  60. return m_bReadyForCmd;
  61. }