www.pudn.com > gps-time.rar > Device.cpp
// Device.cpp: implementation of the CDevice class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "RegionComm.h"
#include "ComPort.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IMPLEMENT_SERIAL(CDevice, CObject, 0)
CDevice::CDevice()
{
TimeOutCount=0;
DeviceType=0;//信号机
DeviceNo=0;
IsConnected=FALSE;
}
CDevice::~CDevice()
{
}
int CDevice::GetState()
{ // 取连接设备工作状态
if (IsConnected) return DEV_LINEON;
else return DEV_LINEOFF;
}
void CDevice::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
ar << DeviceType;
ar << DeviceNo;
ar << TimeOutCount;
ar << IsConnected;
}
else
{
ar >> DeviceType;
ar >> DeviceNo;
ar >> TimeOutCount;
ar >> IsConnected;
}
}