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
69 lines
1.6 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 08/10/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: DirectOutput.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of DirectOutput.cpp
|
|
//----------------------------------------------------------------------------
|
|
|
|
#include "stdafx.h"
|
|
#include "DeviceDO.h"
|
|
#include "DirectOutput.h"
|
|
#include "..\..\LgLib\Version.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
CDirectOutput::CDirectOutput()
|
|
{
|
|
m_pDeviceDO = NULL;
|
|
m_nBit = -1;
|
|
|
|
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CDirectOutput::CDirectOutput") );
|
|
}
|
|
|
|
CDirectOutput::~CDirectOutput()
|
|
{
|
|
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CDirectOutput::~CDirectOutput") );
|
|
}
|
|
|
|
void CDirectOutput::CmdOn( BOOL bOn )
|
|
{
|
|
if( !m_pDeviceDO )
|
|
{
|
|
LGLOG( LOG_LEVEL_LOW, LOG_TYPE_ERROR, this, _T("CDirectOutput::CmdOn"), _T("Link with device is absent") );
|
|
return;
|
|
}
|
|
|
|
m_pDeviceDO->PostSetSwitch( bOn, m_nBit );
|
|
}
|
|
|
|
BOOL CDirectOutput::ConnectToDevice( CDeviceDO *pDeviceDO, int nBit, int nSensorBit )
|
|
{
|
|
if( pDeviceDO->SetDirectOutput( this, nBit ) )
|
|
{
|
|
m_pDeviceDO = pDeviceDO;
|
|
m_nBit = nBit;
|
|
m_nSubIndex = nSensorBit;
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
void CDirectOutput::PostOn(BOOL bOn)
|
|
{
|
|
DOEVENT event;
|
|
event.id = DOC_SET_STATE;
|
|
event.bOn = bOn;
|
|
m_Queue.Push( event );
|
|
}
|
|
|