Table of contents

Initializing the geolocation object

Last Updated: 1/24/2017

The object source file, geolocation.cpp, contains an Initialize method that initializes the settable property keys and data-field keys for the simulated geolocation-sensor. This method is invoked by the sensor manager at startup.

A property key (PROPERTYKEY) is a data structure consisting of a GUID and a DWORD that provide a unique identifier for the sensor property. In the case of the simulated geolocation-sensor, there are three settable property keys that correspond to: the device's change sensitivity, its current report interval, and the desired accuracy. These keys are defined in the file geolocation.cpp.

const PROPERTYKEY g_SettableGeolocationProperties[] =

For more information about change sensitivity and the report interval, refer to the Filtering data topic.

A data-field key is a PROPERTYKEY that the driver uses to identify each unique data field that it supports. In the case of the pseudo geolocation-sensor there are eight supported data fields that include data such as the timestamp of the reading, current latitude (in degrees), current longitude (in degrees), and so on. These keys are also defined in the file geolocation.cpp.

const PROPERTYKEY g_SupportedGeolocationDataFields[] =
    SENSOR_DATA_TYPE_SPEED_KNOTS,               //[VT_R8]

The CSensorManager::Start method invokes CGeolocation::Initialize immediately after it creates the sensor Device Driver Interface (DDI). This work occurs in the module sensormanager.cpp.

The Initialize method, in turn, invokes an InitializeGeolocation method. This latter method invokes CGeolocation::AddGeolocationSettablePropertyKeys to initialize the property keys for the writeable properties supported by the pseudo-sensor. After adding the property keys, the InitializeGeolocation method invokes CGeolocation::AddGeolocationDataFieldKeys to initialize the data field keys for the supported data fields.

Defining the geolocation object
Filtering data

Send comments about this topic to Microsoft

© 2017 Microsoft