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.
133 lines
3.3 KiB
133 lines
3.3 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 08/10/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: ResetLgsDlg.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of ResetLgsDlg.cpp
|
|
//----------------------------------------------------------------------------
|
|
// ResetLgsDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "chicago.h"
|
|
#include "ResetLgsDlg.h"
|
|
#include "..\Dlib\SensorLGS.h"
|
|
#include "..\..\LgLib\Version.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
CResetLgsDlg::CResetLgsDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CResetLgsDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CResetLgsDlg)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
|
|
m_pSensorArray = NULL;
|
|
|
|
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, _T("CResetLgsDlg::CResetLgsDlg") );
|
|
}
|
|
|
|
|
|
void CResetLgsDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CResetLgsDlg)
|
|
DDX_Control(pDX, IDC_BUTTON_LGS_RESET, m_bnLgsReset);
|
|
DDX_Control(pDX, IDC_COMBO_LGS, m_ComboLgsSensor);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CResetLgsDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CResetLgsDlg)
|
|
ON_BN_CLICKED(IDC_BUTTON_LGS_RESET, OnButtonLgsReset)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CResetLgsDlg message handlers
|
|
|
|
void CResetLgsDlg::SetSensorArray(CSensorArray *pSensorArray)
|
|
{
|
|
m_pSensorArray = pSensorArray;
|
|
}
|
|
|
|
BOOL CResetLgsDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
ASSERT( m_pSensorArray );
|
|
|
|
INT nDeviceCount = 0;
|
|
for( int i = 0; i < m_pSensorArray->GetSensorCount(); i++ )
|
|
{
|
|
CSensor *pSensor = m_pSensorArray->GetSensor(i);
|
|
|
|
ASSERT( pSensor );
|
|
|
|
if( pSensor->GetType() == CSensor::LGS &&
|
|
!((CSensorLGS*)pSensor)->IsSpyMode() )
|
|
{
|
|
int nIndex = m_ComboLgsSensor.AddString( pSensor->GetName() );
|
|
m_ComboLgsSensor.SetItemDataPtr( nIndex, pSensor );
|
|
nDeviceCount++;
|
|
}
|
|
}
|
|
|
|
if( nDeviceCount )
|
|
{
|
|
int nIndex = m_ComboLgsSensor.AddString( _T("- ALL LGS -") );
|
|
m_ComboLgsSensor.SetItemDataPtr( nIndex, NULL );
|
|
m_ComboLgsSensor.SetCurSel( nIndex );
|
|
}
|
|
else
|
|
{
|
|
// disable all controls
|
|
m_ComboLgsSensor.EnableWindow( FALSE );
|
|
m_bnLgsReset.EnableWindow( FALSE );
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CResetLgsDlg::OnButtonLgsReset()
|
|
{
|
|
CSensorLGS *pSensor = (CSensorLGS*)m_ComboLgsSensor.GetItemDataPtr( m_ComboLgsSensor.GetCurSel() );
|
|
|
|
if( pSensor )
|
|
pSensor->CmdReset( FALSE );
|
|
else
|
|
{
|
|
for( int i = 0; i < m_pSensorArray->GetSensorCount(); i++ )
|
|
{
|
|
CSensorLGS *pSensorLgs = (CSensorLGS*)m_pSensorArray->GetSensor(i);
|
|
|
|
ASSERT( pSensorLgs );
|
|
|
|
if( pSensorLgs->GetType() == CSensor::LGS )
|
|
{
|
|
pSensorLgs->CmdReset( FALSE );
|
|
}
|
|
}
|
|
}
|
|
|
|
LPCTSTR pSensorName = pSensor ? (LPCTSTR)pSensor->GetName() : _T("full");
|
|
|
|
CString str;
|
|
str.Format( _T("%s hardware reset"), pSensorName );
|
|
|
|
m_pSensorArray->GetEventQueue()->PostEvent( LGS_EVENT_PROGRAM_RESET, 0, 0, 0, RGB(0xFF,0xFF,0xFF), (LPSTR)(LPCTSTR)str );
|
|
|
|
CDialog::OnOK();
|
|
}
|