// TestDlg.cpp : implementation file
//

#include "stdafx.h"
#include "dashboard.h"
#include "TestDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CTestDlg dialog


CTestDlg::CTestDlg(UINT nID, CWnd* pParent /*=NULL*/, DWORD STATUS_NUM)
	: CDialog(nID, pParent)
{
	//{{AFX_DATA_INIT(CTestDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT

	m_statusNum = STATUS_NUM;
}

void CTestDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTestDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CTestDlg, CDialog)
	//{{AFX_MSG_MAP(CTestDlg)
		ON_WM_CLOSE()
		ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTestDlg message handlers

BOOL CTestDlg::OnInitDialog()
{
	BOOL val = CDialog::OnInitDialog();
	GetWindowText(m_title);
//	requestUpdate();
	initSubClassDlg();

	m_driverStatus.SubclassDlgItem(m_statusNum, this);

	return val;
}

void CTestDlg::setDriverStatus(char *name, int status)
{
	if (m_driverName == name) {
		m_driverStatus.setDeviceStatus(status);
	}
}	

void CTestDlg::OnTimer(UINT nIDEvent)
{
	SetWindowText(m_title);
	CDialog::OnTimer(nIDEvent);
}

void CTestDlg::OnOK()
{
	CDialog::OnOK();
//	m_devd->setPassed(m_driverIndex, True);
//	m_driverStatus.setDeviceStatus(-1);
	stopRequests();
}

void CTestDlg::OnClose() 
{
	CDialog::OnClose();
	stopRequests();
}

void CTestDlg::receiveData()
{
	SetWindowText(m_title+" Received New Data...");
}

void CTestDlg::OnFail() 
{
	CDialog::OnOK();
	stopRequests();	
}
