For DOS Protected Mode version of sensor core software
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.

73 lines
1.3 KiB

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