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

📄 gpsdll.h

📁 通过windwos mobile 5.0提供的GPS中间驱动层对GPS进行操作
💻 H
字号:
// GpsDll.h : GpsDll DLL 的主头文件
//

#pragma once

#ifndef __AFXWIN_H__
	#error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件"
#endif

#include "resourceppc.h"
#include "gpsapi.h"
#include "service.h"

// CGpsDllApp
// 有关此类实现的信息,请参阅 GpsDll.cpp
//

typedef void (CALLBACK* ONSaveGpsPositionAndState)(CWnd* owner,GPS_POSITION* gpsPosition,int gpsState);
typedef void (*FSaveGpsPositionAndState)(CWnd* owner,GPS_POSITION* gpsPosition,int gpsState);

typedef HANDLE (*FGPSOpenDevice)(HANDLE hNewLocationData,HANDLE hDeviceStateChange,const WCHAR *szDeviceName,DWORD dwFlags);
typedef DWORD (*FGpsGetDeviceState)(GPS_DEVICE *pGPSDevice);
typedef DWORD (*FGPSGetPosition)(HANDLE hGPSDevice,GPS_POSITION *pGPSPosition,DWORD dwMaximumAge,DWORD dwFlags);
typedef DWORD (*FGPSCloseDevice)(HANDLE hGPSDevice);

class CGpsDllApp : public CWinApp
{
public:
	CGpsDllApp();

// 重写
public:
	virtual BOOL InitInstance();
	void GpsConnect2(CWnd* owner);//打开连接
	void GpsDisConnect2();//关闭连接
	GPS_DEVICE* GpsGetDeviceState2();//获取GPS状态
	void SetSaveGpsPositionAndState2(FSaveGpsPositionAndState saveGpsPositionAndStateFun);//设置回调函数
	static DWORD ReadThreadFun(LPVOID lparam);//线程函数,监控两个事件:GPS状态改变事件和新的GPS数据事件

	DECLARE_MESSAGE_MAP()

public:
	// handle to the gps device
	HANDLE m_gpsHandle;

    // handle to the native event that is signalled when the GPS
    // devices gets a new location
    HANDLE m_newLocationHandle;

    // handle to the native event that is signalled when the GPS
    // device state changes
    HANDLE m_deviceStateChangedHandle;

	HINSTANCE m_hgpsapi;//GPSAPI句柄

	HANDLE m_hReadThread;//线程句柄,监控两个事件:GPS状态改变事件和新的GPS数据事件
	DWORD m_dwReadThreadID;//线程ID

	BOOL m_threadIsOn;//线程是否打开

	int m_gpsState;//GPS状态,“0”表示断开连接,“1”表示连接,未定位,“2”表示连接,定位

	CWnd* m_owner;//调用本动态连接库的窗体对象

	ONSaveGpsPositionAndState m_saveGpsPositionAndState;//回调变量
};

void GpsConnect(CWnd* owner);
void GpsDisConnect();
GPS_DEVICE* GpsGetDeviceState();
void SetSaveGpsPositionAndState(FSaveGpsPositionAndState saveGpsPositionAndStateFun);


⌨️ 快捷键说明

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