正文

windows Mobile中GPS中间驱动层相关文档的翻译(一)2009-03-13 17:35:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/ddtme/41462.html

分享到:

GPS Intermediate Driver Reference

 

Peng Fude 2008-10-21

 

 

The GPS Intermediate Driver is useful to developers writing applications that use GPS (Global Positioning System) devices as well as to GPS hardware manufacturers. It is useful because it provides an intermediate layer that abstracts the actual GPS device from developers and manufacturers. Ideally, this enables application developers to write code that works with any GPS hardware, and GPS device manufacturers to produce hardware that works with any application.

All of the GPS Intermediate Driver documentation should be useful for both application developers and device manufacturers. With that said, the GPS Intermediate Driver Application Development topic (and subtopics) may be of special interest to application developers. These topics provide information about using the GPS Intermediate Driver from an application. Of most interest may be the Accessing Parsed GPS Data and Accessing Raw GPS Data topics, which explain how to write code that uses GPS Intermediate Driver location data.

GPS中间驱动层对GPS应用程序的开发者和GPS硬件制造厂商很有用的。它有用是因为它把真正的GPS硬件设备从开发者和硬件生产厂商之间抽象出来一个中间层,应用开发者就可以适用于任何GPS硬件设备的程序代码,而生产厂商也可以生产适用于任何应用程序的GPS设备。

所以关于GPS中间驱动层的文档对应用开发人员和硬件生产厂商都有用,在这个基础上,GPS中间驱动层应用开发主题(及其子主题)主要是针对GPS应用开发者而言的,它们主要提供一个应用程序使用GPS中间驱动层的方法和信息,而其中的描述的关于怎么使用GPS中间驱动层来编写代码获取位置信息的关键主题是:获取解析的GPS数据和获取原始GPS数据。

In This Section

GPS Intermediate Driver Benefits

Compares how applications and GPS hardware interact, both with and without the GPS Intermediate Driver.

GPS Intermediate Driver Architecture

Describes how the GPS Intermediate Driver is implemented.

GPS Intermediate Driver Application Development

Explains how to write code that uses the GPS Intermediate Driver.

GPS Intermediate Driver Registry Settings

Provides information about the configurable registry settings used by the GPS Intermediate Driver.

GPS Intermediate Driver Security

Provides security best practice information relevant to the GPS Intermediate Driver.

GPS Intermediate Driver Constants

Contains information on the GPS intermediate driver constants.

GPS Intermediate Driver Enumerations

Contains information on the GPS intermediate driver enumerations.

GPS Intermediate Driver Functions

Contains information on the GPS intermediate driver functions.

GPS Intermediate Driver IOCTLs

Contains information on the GPS intermediate driver IOCTLs.

GPS Intermediate Driver Structures

Contains information on the GPS intermediate driver structures.

 

本节主要内容如下:

Ø        GPS中间驱动层的好处

Ø        GPS中间驱动层的结构

Ø        GPS中间驱动层应用开发

Ø        GPS中间驱动层注册表设置

Ø        GPS中间驱动层安全

Ø        GPS中间驱动层常量

Ø        GPS中间驱动层枚举

Ø        GPS中间驱动层函数

Ø        GPS中间驱动层IOCTLs

Ø        GPS中间驱动层结构体


 

1.   GPS Intermediate Driver Benefits GPS中间驱动的好处

The GPS Intermediate Driver provides benefits to applications that use GPS devices as well as to GPS hardware manufacturers. It does this by providing an intermediate layer that abstracts the actual GPS device from application developers. This intermediate layer also abstracts applications from GPS device manufacturers. Ideally, this enables application developers to write code that works with any GPS hardware, and GPS device manufacturers to produce hardware that works with any application.

GPS中间驱动层不但为使用GPS设备的应用程序提供好处,而且也为GPS硬件厂商提供好处。它提供一个抽象于应用和硬件的一个中间层,这使得应用开发者们可以编写使用于任何GPS硬件设备的程序代码,而GPS硬件厂商可以生产适用于任何应用的GPS硬件设备。

GPS Without the GPS Intermediate Driver

没有GPS中间驱动层的GPS

Without the GPS Intermediate Driver, applications generally access GPS hardware directly through a COM port. Depending on the hardware in the target device, this COM port may be an actual serial port, to which GPS hardware is attached using a serial cable. It can also be a virtual serial port that maps to hardware attached to a Compact Flash, SDIO, Bluetooth, or other peripheral interface.

    在没有GPS中间驱动层的情况下,应用程序一般通过COM串口直接访问GPS硬件设备。这个串口有可能是实际上的串口,也有可能是一个虚拟的串口,当GPS设备使用串口线进行连接的话,它就是实际的串口,但是如果GPS硬件是SDIO、蓝牙、集成GPS芯片或者别的外部接口的话,这个串口就是映射出来的虚拟的串口。

Applications interact directly with the GPS hardware by calling CreateFile World Wide Web linkto obtain a handle to the device. With most GPS devices, this connection is exclusive, so only one application at a time can interact with the GPS hardware.

    应用可以通过调用CreateFile接口获取设备的一个句柄来和GPS设备直接进行交互,对于大多数GPS设备来说,这个连接是独占的,所以,一次只能一个应用程序在访问GPS设备。

Applications then call ReadFile World Wide Web linkrepeatedly to retrieve GPS location data encoded using the National Marine Electronics Association (NMEA) standard. The NMEA standard is a common interchange format used throughout the GPS industry. Each application then parses the NMEA strings into meaningful data, like the current latitude and longitude of the GPS hardware. For more information about the NMEA standard, see this NMEA Web site.

    然后,应用程序通过重复调用ReadFile来读取NMEANational Marine Electronics Association国家航海电子协会)标准编码的GPS位置数据,应用通过解析NMEA字符串得到有用的位置信息,比如说GPS设备的经度、纬度。NMEA标准是一个国际统一的标准,是一个GPS行业内交换数据的一个统一格式。关于NMEA标准的更多信息,请访问NMEA的网站(this NMEA Web site)。

Benefits of the GPS Intermediate Driver

GPS中间驱动层的好处

With the GPS Intermediate Driver, applications use the GPS Intermediate Driver instead of interacting with the GPS hardware directly. The GPS Intermediate Driver is the only code that interacts directly with GPS hardware.

    有了GPS中间驱动层,应用程序通过调用GPS中间驱动层直接和GPS设备进行交互,而GPS中间驱动层则是唯一和GPS硬件设备之间进行交互的代码。

The GPS Intermediate Driver provides two main advantages:

  • Enable multiple applications to use GPS hardware at the same time. The GPS Intermediate Driver makes it appear that each application has its own dedicated GPS hardware.
  • Remove the need for applications to parse NMEA strings to obtain meaningful data. The GPS Intermediate Driver internally parses the NMEA strings obtained from the GPS hardware and makes the parsed information available through a friendly API that contains structures like GPS_POSITION and calls like GPSGetLocation. Applications can also use a backward-compatible stream/ReadFile interface. This ability provides an easy way for existing applications to use the GPS Intermediate Driver without requiring modification.

GPS中间驱动层有两个主要的优点:

1、使得多个应用程序能够在同一时间内使用GPS设备,看起来好像每个应用程序有他们自己的专用GPS设备

2、去除掉应用程序自己解析NMEA字符串来获取有用GPS数据的需要,因为中间驱动层把从GPS设备获取到的NMEA字符串解析好,并且把解析后通过一个API接口提供给所有的应用,应用程序可以通过调用GPSGetLocation函数获取一个GPS_POSITION的结构体,来获得解析后的GPS数据。当然,应用程序也可以使用向后兼容的流式接口(ReadFile)来获取GPS数据,这为一些已经存在的程序提供了使用GPS中间驱动层而不需要重新修改的方便。

The GPS Intermediate Driver is built with backward-compatibility in mind. This means that, for most applications and GPS hardware, the GPS Intermediate Driver can be injected transparently. From the perspective of the application, it is still communicating with actual GPS hardware, through CreateFile, ReadFile, and CloseHandle World Wide Web linkcalls. Similarly, the GPS hardware still has a single client, but this client is now the GPS Intermediate Driver, instead of a single application that directly uses GPS data.

    GPS中间驱动层是基于向后兼容思想下创建的,这样的话,对于大多数的应用程序和GPS设备,GPS中间驱动层是透明的,对于应用程序来说,它依然是通过调用CreateFileReadFileCloseHandle等函数来和GPS设备进行交互,同样的,对于GPS设备来说,GPS设备依然只有一个终端用户,不过这个终端用户现在变成了GPS中间驱动层,替代了单个直接访问GPS设备数据的引用程序。

2.   GPS Intermediate Driver Architecture GPS中间驱动层结构

The GPS Intermediate Driver works by injecting itself between applications and GPS hardware. To an application, the GPS Intermediate Driver appears like GPS hardware. To GPS hardware, the GPS Intermediate Driver appears like a single client - it requests GPS information. This abstraction layer provides multiple benefits to developers. For more information about these benefits, as well as a brief comparison between the model used by the GPS Intermediate Driver and a model where an application interacts directly with GPS hardware, see GPS Intermediate Driver Benefits.

    GPS中间驱动层工作在应用程序和GPS硬件设备之间,对于一个应用程序,GPS中间驱动层就像是一个GPS设备,对于GPS硬件设备,GPS中间驱动层就像是一个唯一需要获取GPS信息的客户程序。这个抽象出来的层给开发者们提供了很多的好处,关于这些好处的描述,以及有无GPS中间驱动层的两种模式的比较,可以参考GPS中间驱动的好处一章。

The GPS Intermediate Driver is implemented as a normal Windows CE device driver. It is loaded into the device.exe process like all device drivers, even though it doesn't interact with device hardware directly. Instead, it uses another device driver - the one provided with or used by the GPS hardware - which then interacts with the actual hardware.

    GPS中间驱动层是作为一个普通的Windows CE的设备驱动程序来实现的,虽然它不是直接和硬件设备打交道,但是它就像其他的设备驱动程序一样,被device.exe进程装载运行的。相反,它需要调用另外一个驱动程序——一个有GPS硬件设备提供的或者使用的,直接和真正的GPS硬件设备交互的驱动程序。

For example, suppose that, without the GPS Intermediate Driver, an application interacts with GPS hardware by calling CreateFile World Wide Web linkand passing "COM1:" as the first parameter. With the GPS Intermediate Driver, the application no longer connects directly to the GPS hardware. For the application to retrieve data using the GPS Intermediate Driver, it must first configure the GPS Intermediate Driver to connect to the GPS hardware using COM1. You can do this using the GPS Intermediate Driver Control Panel application (if present on your target device), or by manipulating the registry. For detailed information about configuring the GPS Intermediate Driver, see Configuring the GPS Intermediate Driver.

例如:假如没有GPS中间驱动层,应用程序通过调用CreateFile并且传递" COM1:"作为第一个参数直接和GPS硬件设备进行交互,在有GPS中间驱动层的情况下,应用程序不用直接访问GPS硬件设备。如果一个应用程序需要使用GPS中间驱动层获取GPS数据,那么必须先配置好GPS中间驱动层,使得它能够使用“COM1:”直接访问GPS设备。你可以通过使用GPS中间驱动程序控制面板程序(如果在你的设备上有的话)来实现配置,也可以直接修改注册表来实现。关于配置GPS中间驱动层的详细信息,可以参考配置GPS中间驱动层章节。

Once the GPS Intermediate Driver knows where to find the actual GPS hardware, applications can use the GPS hardware through either of two interfaces:

  • Parsed mode, using the GPS Intermediate Driver API. This interface enables developers to retrieve GPS data without calling CreateFile and ReadFile World Wide Web link. Instead, they call GPSOpenDevice, GPSGetLocation, and GPSCloseDevice. For more information about this interface, see Accessing Parsed GPS Data.
  • Raw mode, using the Windows CE stream device driver interface (CreateFile/ReadFile/CloseHandle World Wide Web link). The information provided by each ReadFile call is the data as it was retrieved from the GPS hardware. Applications are responsible for parsing the NMEA strings themselves. This interface provides backward compatibility by supporting applications that expect to interact with GPS hardware directly through a stream interface. For more information about this interface, see Accessing Raw GPS Data.

一旦GPS中间驱动层知道了访问GPS硬件设备的接口,应用程序就可以通过以下两种模式来使用GPS设备:

1、解析模式:使用GPS中间驱动层的API接口。开发者们可以不需要调用CreateFile ReadFile来获取GPS数据,而直接调用调用GPSOpenDeviceGPSGetLocationGPSCloseDevice等来获取数据,详细描述请参考章节Accessing Parsed GPS Data

2、原始模式:使用Windows CE的流式设备驱动接口(CreateFileReadFileCloseHandle)。通过ReadFile函数读取到的GPS数据和直接访问GPS设备获取到的数据是一样的。这种模式下,用户需要自己编写代码来解析NMEA字符串。这种模式能为那些之前使用流式接口访问GPS设备的应用程序提供向下兼容的接口。关于原始模式的详细信息参考章节Accessing Raw GPS Data

Internally, the GPS Intermediate Driver reads location data from the GPS hardware and provides it to application developers that call either GPSGetLocation or ReadFile. It tracks which data has been provided to each client, so that the act of one client obtaining location information does not mean that another client cannot obtain the same data. The fact that the GPS Intermediate Driver may be handling multiple connections is completely transparent to the applications using the GPS Intermediate Driver.

     在内部,GPS中间驱动层从GPS硬件设备读取定位数据,并且把这些数据提供给那些通过GPSGetLocation 或者 ReadFile函数调用获取位置信息的应用程序。它可以分发数据给每一个获取终端用户,所以这样看来,一个终端用户获取到位置信息并不代表别的终端用户无法获取到相同的数据。GPS中间驱动层可以处理多个连接对于应用程序使用GPS中间驱动层是完全透明的。

阅读(4468) | 评论(3)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

loading...
您需要登录后才能评论,请 登录 或者 注册