⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gps loggerdoc.cpp

📁 读取GPS数据
💻 CPP
字号:
// GPS LoggerDoc.cpp : implementation of the CGPSLoggerDoc class
//

#include "stdafx.h"
#include "GPS Logger.h"

#include "GPS LoggerDoc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CGPSLoggerDoc

IMPLEMENT_DYNCREATE(CGPSLoggerDoc, CDocument)

BEGIN_MESSAGE_MAP(CGPSLoggerDoc, CDocument)
	//{{AFX_MSG_MAP(CGPSLoggerDoc)
	ON_COMMAND(ID_FILE_CLOSE, OnFileClose)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGPSLoggerDoc construction/destruction

CGPSLoggerDoc::CGPSLoggerDoc():
m_NMEAParser(_T("data.txt"))
{
	// TODO: add one-time construction code here
}

CGPSLoggerDoc::~CGPSLoggerDoc()
{
}

BOOL CGPSLoggerDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CGPSLoggerDoc serialization

void CGPSLoggerDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CGPSLoggerDoc diagnostics

#ifdef _DEBUG
void CGPSLoggerDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CGPSLoggerDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

void CGPSLoggerDoc::OnCloseDocument() 
{
	// TODO: Add your specialized code here and/or call the base class
	
	CDocument::OnCloseDocument();
}

void CGPSLoggerDoc::OnFileClose() 
{
	// TODO: Add your command handler code here
	OnCloseDocument();	
}

void CGPSLoggerDoc::Start()
{
	ASSERT( !m_running );
	m_COMPortIO.InitComm(4, 4800, NOPARITY, 8, ONESTOPBIT, FALSE);
	m_running = TRUE;
}

void CGPSLoggerDoc::Stop()
{
	ASSERT( m_running );
	m_COMPortIO.Close();
	m_running = FALSE;
}

BOOL CGPSLoggerDoc::IsRunning()
{
	return m_running;
}

void CGPSLoggerDoc::Timer()
{
	static CHAR buf[1024];
	DWORD bytesRead = m_COMPortIO.Read(buf, 1024);
	m_NMEAParser.Parse(buf, bytesRead);
	UpdateAllViews(NULL);
}

GPSInfo& CGPSLoggerDoc::GetActualGPSInfo()
{
	return m_NMEAParser.GetActualGPSInfo();
}

⌨️ 快捷键说明

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