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

📄 gpscontrol.cpp

📁 Gpsapi 2.0(标准mobile接口)
💻 CPP
字号:
/**************************************************************************/
/*                                                                        */
/* Copyright (c) 2000-2008  YULONG Company                         */
/*                 宇龙计算机通信科技(深圳)有限公司  版权所有 2000-2008 */
/*                                                                        */
/* PROPRIETARY RIGHTS of YULONG Company are involved in the         */
/* subject matter of this material.  All manufacturing, reproduction, use,*/
/* and sales rights pertaining to this subject matter are governed by the */
/* license agreement.  The recipient of this software implicitly accepts  */ 
/* the terms of the license.                                              */
/* 本软件文档资料是宇龙公司的资产,任何人士阅读和使用本资料必须获得        */
/* 相应的书面授权,承担保密责任和接受相应的法律约束.                       */
/*                                                                        */

//////////////////////////////////////////////////////////////////////////
//
// GpsContor.cpp: implementation of the CGpsContor class.
//
//////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "GpsControl.h"



DWORD WINAPI Receive(LPVOID lParam)
{
	if (lParam == NULL)
		return 0;

	CGpsDevice* pgpsDevice = (CGpsDevice*)lParam;
	return pgpsDevice->Receive();
}

CGpsControl::CGpsControl():
	m_hWnd(NULL)
{
	m_bCreate = FALSE;
}

CGpsControl::~CGpsControl()
{
	Destroy();
}

void CGpsControl::SetMessageWnd( HWND hWnd )
{
	m_hWnd = hWnd;
	m_gpsDevice.SetMessageWnd( hWnd );
}

BOOL CGpsControl::Create()
{
	if(m_bCreate)
		return FALSE;
	if(!m_gpsDevice.Connect())
	{
		return FALSE;
	}
	m_bCreate = true;
	m_hThread = CreateThread( NULL , 0, Receive, (LPVOID)&m_gpsDevice, 0, &m_hThreadId); 	
	if( m_hThread == NULL )
	{
		m_gpsDevice.CutConnect();
		return FALSE;
	}
	CloseHandle(m_hThread);
	return TRUE;
	
}

void CGpsControl::Destroy()
{
	m_bCreate = FALSE;
 	m_gpsDevice.m_bPause = TRUE;
 	Sleep(2000);
	m_gpsDevice.CutConnect();
}

BOOL CGpsControl::Config(int nComID,	int nBaudRate, int nByteSize)
{
	return m_gpsDevice.Config(nComID,nBaudRate,nByteSize);
}

GPS_POSITION * CGpsControl::GetAllData()
{
	return m_gpsDevice.GetData();
}

GPSData* CGpsControl::GetUnFiltedData()
{
	return m_gpsDevice.GetUnfiltedData();
}

BOOL CGpsControl::PowerReset()
{
	return m_gpsDevice.GPSPowerReset();
}

void CGpsControl::SetNewHandle(HANDLE hNewHandle)
{
	m_gpsDevice.SetNewHandle(hNewHandle);
}

⌨️ 快捷键说明

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