📄 wgps.h
字号:
/*++
Copyright (c) Wangsoft Corporation. All rights reserved.
File: wgps.h
Abstract:
Contents:
GPS related defines
Code that uses the GPS Intermediate Driver parsed API often has a common overall structure,
with the following steps:
1. Create a mechanism for receiving notifications by creating one or two Windows CE events,
by calling CreateEvent. These events are signaled when the GPS hardware delivers new data
or when the state of the GPS hardware changes. This step is common, but optional; you only
need to create events if you want to receive notifications of new data or device state changes.
2. Create a connection to the GPS hardware, via the GPS Intermediate Driver, by calling
GPSOpenDevice. This function returns a handle you use to call other parsed API functions.
If you created events for notification in step 1, pass these events when you call GPSOpenDevice.
3. Wait until the GPS hardware has location data to provide or until it changes state,
by calling WaitForMultipleObjects (if you have two events) or WaitForSingleObject
(if you have only one event).
When one of these events is signaled, retrieve location or device information.
To retrieve location information, call GPSGetPosition. This function fills the passed
GPS_POSITION structure with location information, including latitude and longitude.
This call does not block if the GPS Intermediate Driver does not have valid data.
If there is no valid data, the dwValidFields field of the GPS_POSITION structure contains zero,
which indicates that no fields contain valid data.
Alternatively, retrieve information about the device, by calling GPSGetDeviceState.
4. Repeat step 3 until you don't need additional GPS information.
5. Close the connection to the GPS Intermediate Driver, by calling GPSCloseDevice.
Warning: GPS hardware consumes relatively large amounts of power. Therefore, it is very important
that you call GPSCloseDevice as soon as possible when you no longer need information from the
GPS hardware. For more information about the implications of not closing the connection,
see GPS Intermediate Driver Power Management.
--*/
#ifndef __WGPS_H__
#define __WGPS_H__
#ifdef __cplusplus
extern "C" {
#endif
// Values of limits for internal GPS Intermediate Driver data. (Can not be changed.)
#define GPS_VERSION_1 1 // Version 1 by Wnavi
#define GPS_MAX_SATELLITES 12 //
#define GPS_MAX_PREFIX_NAME 16 //
#define GPS_MAX_FRIENDLY_NAME 64 //
// Values of GPS_POSITION dwFlags.
#define GPS_DATA_FLAGS_HARDWARE_ON 0x00000000 // GPSGetPosition dwFlags:on // Added by Wangxu.
#define GPS_DATA_FLAGS_HARDWARE_OFF 0x00000001 // GPSGetPosition dwFlags:off
// Values of GPS_POSITION dwValidFields.
#define GPS_VALID_UTC_TIME 0x00000001 // If set, the stUTCTime field is valid.
#define GPS_VALID_LATITUDE 0x00000002 // If set, the dblLatitude field is valid.
#define GPS_VALID_LONGITUDE 0x00000004 // If set, the dblLongitude field is valid.
#define GPS_VALID_SPEED 0x00000008 // If set, the flSpeed field is valid.
#define GPS_VALID_HEADING 0x00000010 // If set, the flHeading field is valid.
#define GPS_VALID_MAGNETIC_VARIATION 0x00000020 // If set, the dblMagneticVariation field is valid.
#define GPS_VALID_ALTITUDE_WRT_SEA_LEVEL 0x00000040 // If set, the flAltitudeWRTSeaLevel field is valid.
#define GPS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080 // If set, the flAltitudeWRTEllipsoid field is valid.
#define GPS_VALID_POSITION_DILUTION_OF_PRECISION 0x00000100 // If set, the flPositionDilutionOfPrecision field is valid.
#define GPS_VALID_HORIZONTAL_DILUTION_OF_PRECISION 0x00000200 // If set, the flHorizontalDilutionOfPrecision field is valid.
#define GPS_VALID_VERTICAL_DILUTION_OF_PRECISION 0x00000400 // If set, the flVerticalDilutionOfPrecision field is valid.
#define GPS_VALID_SATELLITE_COUNT 0x00000800 // If set, the dwSatelliteCount field is valid.
#define GPS_VALID_SATELLITES_USED_PRNS 0x00001000 // If set, the rgdwSatellitesUsedPRNs field is valid.
#define GPS_VALID_SATELLITES_IN_VIEW 0x00002000 // If set, the dwSatellitesInView field is valid.
#define GPS_VALID_SATELLITES_IN_VIEW_PRNS 0x00004000 // If set, the rgdwSatellitesInViewPRNs field is valid.
#define GPS_VALID_SATELLITES_IN_VIEW_ELEVATION 0x00008000 // If set, the rgdwSatellitesInViewElevation field is valid.
#define GPS_VALID_SATELLITES_IN_VIEW_AZIMUTH 0x00010000 // If set, the rgdwSatellitesInViewAzimuth field is valid.
#define GPS_VALID_SATELLITES_IN_VIEW_SIGNAL_TO_NOISE_RATIO 0x00020000 // If set, the rgdwSatellitesInViewSignalToNoiseRatio field is valid.
#define GPS_DEVICE_STATE_ON 0x00000000 // GPS_DEVICE dwDeviceState:on // Added by Wangxu.
#define GPS_DEVICE_STATE_OFF 0x00000001 // GPS_DEVICE dwDeviceState:off // Added by Wangxu.
// Values that specify the quality of the GPS fix.
typedef enum {
GPS_FIX_QUALITY_UNKNOWN = 0,
GPS_FIX_QUALITY_GPS,
GPS_FIX_QUALITY_DGPS
} GPS_FIX_QUALITY;
// Values that specify the type of GPS fix.
typedef enum {
GPS_FIX_UNKNOWN = 0,
GPS_FIX_2D,
GPS_FIX_3D
} GPS_FIX_TYPE;
// Values that specify whether the GPS fix was selected manually or automatically.
typedef enum {
GPS_FIX_SELECTION_UNKNOWN = 0,
GPS_FIX_SELECTION_AUTO,
GPS_FIX_SELECTION_MANUAL
} GPS_FIX_SELECTION;
// Contains location information, including latitude and longitude, as well as other related
// information like heading, speed, the satellites used to retrieve the location information, and so on.
//
// Members:
// dwVersion
// Version of the GPS Intermediate Driver expected by the application. Must be set before the structure
// is passed to GPSGetPosition. Must be GPS_VERSION_1.
// dwSize
// Size of the structure, in bytes. Must be set before the structure is passed to GPSGetPosition.
// dwValidFields
// Valid fields in this instance of the structure. This field is a combination of some number of
// GPS_VALID_ flags, or is 0 if no fields are valid. Valid fields depend on the GPS hardware,
// how old the location data can be (controlled by the dwMaximumAge parameter of the GPSGetPosition call),
// and the current satellite signals, among other things.
// dwFlags
// Information about the state of the data retrieved in a call to GPSGetPosition. This field is a
// combination of GPS_DATA_FLAGS_ flags.
// stUTCTime
// Universal time (UTC) according to information provided by GPS satellites.
// dblLatitude
// Latitude, in degrees. Positive numbers indicate north latitude.
// dblLongitude
// Longitude, in degrees. Positive numbers indicate east longitude.
// flSpeed
// Speed, in knots (nautical miles).
// flHeading
// Heading, in degrees. A heading of zero is true north.
// dblMagneticVariation
// Magnetic variation, which is the difference between the bearing to true north and the bearing shown
// on a magnetic compass. Positive numbers indicate east.
// flAltitudeWRTSeaLevel
// Altitude, in meters, with respect to sea level.
// flAltitudeWRTEllipsoid
// Altitude, in meters, with respect to the WGS84 ellipsoid. For more information about the use of
// the WGS84 ellipsoid with GPS, see this NMEA Web site.
// FixQuality
// Quality of the GPS fix, which is one of invalid, normal GPS, or differential GPS (DGPS).
// This field contains one of the values in the GPS_FIX_QUALITY enumeration.
// FixType
// Type of GPS fix, either 2-D (only latitude and longitude, from three satellites),
// or 3-D (latitude, longitude, and altitude, from four or more satellites).
// This field contains one of the values in the GPS_FIX_TYPE enumeration.
// SelectionType
// Whether 2-D or 3-D mode is selected automatically or manually. This field contains one of
// the values in the GPS_FIX_SELECTION enumeration.
// flPositionDilutionOfPrecision
// Degree to which the overall position is affected by positional dilution of position (PDOP).
// PDOP is caused by the location of the satellites providing the GPS fix. Lower numbers indicate
// a more accurate position. A value of 1.0 indicates the least dilution (highest accuracy);
// a value of 50.0 indicates the most dilution (lowest accuracy).
// flHorizontalDilutionOfPrecision
// Degree to which the horizontal position (latitude and longitude) is affected by horizontal
// dilution of position (HDOP). HDOP is caused by the location of the satellites providing the GPS fix.
// Lower numbers indicate a more accurate position. A value of 1.0 indicates the least dilution
// (highest accuracy); a value of 50.0 indicates the most dilution (lowest accuracy).
// flVerticalDilutionOfPrecision
// Degree to which the vertical position (altitude) is affected by vertical dilution of position (VDOP).
// VDOP is caused by the location of the satellites providing the GPS fix. Lower numbers indicate
// a more accurate position. A value of 1.0 indicates the least dilution (highest accuracy);
// a value of 50.0 indicates the most dilution (lowest accuracy).
// dwSatelliteCount
// Number of satellites used to obtain the position.
// rgdwSatellitesUsedPRNs
// PRN (pseudo-random noise) numbers of the satellites used to obtain the position.
// dwSatellitesInView
// Number of satellites in view of the GPS hardware. This value ranges from 0 to GPS_MAX_SATELLITES.
// rgdwSatellitesInViewPRNs
// PRN (pseudo-random noise) numbers of the satellites in view of the GPS hardware.
// rgdwSatellitesInViewElevation
// Elevation, in degrees, of the satellites in view of the GPS hardware.
// rgdwSatellitesInViewAzimuth
// Azimuth, in degrees, of the satellites in view of the GPS hardware.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -