device.cpp

来自「gps对时」· C++ 代码 · 共 51 行

CPP
51
字号
// 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;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?