//---------------------------------------------------------------------------- // Laser Guard Ltd. // Copyright © 2000-2002. All Rights Reserved. // Version 1.0 01/01/2000 // Last modification: 08/10/2003 // PROJECT: // SUBSYSTEM: // FILE: LgDevice.cpp // AUTHOR: Sergey Chizhevskiy // OVERVIEW // ~~~~~~~~ // Source file of LgDevice.cpp //---------------------------------------------------------------------------- #ifdef __BORLANDC__ #include "..\LgLib\Device\LgDevice.h" #else #include "LgDevice.h" #endif CLgDevice::CLgDevice() { // clear commands processing m_bReadyForCmd = true; m_nCmd = CMD_NONE; m_bCmdExist = false; } CLgDevice::~CLgDevice() { } bool CLgDevice::DoCmd( int16_t nCommand ) { // check availibility if( !m_bReadyForCmd ) return false; // prevent commands overlapping m_bReadyForCmd = false; // store command id m_nCmd = nCommand; return m_bCmdExist = true; } int16_t CLgDevice::GetCmd() { // if there is no new command if( !m_bCmdExist ) return CMD_NONE; // mark that command taken m_bCmdExist = false; // mark that not ready for new messages m_bReadyForCmd = false; // return commands return m_nCmd; } void CLgDevice::ReleaseCmd() { // ready to process new message m_bReadyForCmd = true; } bool CLgDevice::IsReadyForCmd() { return m_bReadyForCmd; }