About Sensor Constants

The Windows Sensor and Location platform uses constants in many ways. The platform defines different constants that you can use in your sensor driver code. Sensor manufacturers can define custom constants. You can find the definitions of platform-defined constants in the Sensors.h file. For detailed information about platform-defined sensor constants, see Constants.

Sensor and Data Organization

The platform organizes sensors and data in the following ways.

  • Categories represent broad classes of sensor devices. Categories let you group sensors that are likely to provide similar kinds of information, or are otherwise related in some way. Each category is represented by a GUID constant. For example, sensors that report latitude and longitude coordinates belong to the location sensor category. This is representented by the SENSOR_CATEGORY_LOCATION constant.
  • Sensor types represent specific kinds of sensors. Each sensor type fits into a particular category. Two sensors of different types can belong to the same category or different categories. Each sensor type is represented by a GUID constant. For example, a global positioning system sensor would be identified by the SENSOR_TYPE_LOCATION_GPS constant. However, a sensor that provides the current location by using an IP address would be identified by the SENSOR_TYPE_LOCATION_LOOKUP constant. However, both sensors would belong to the location sensor category.
  • Data types represent specific kinds of information that the sensor can provide. Sensor data types can contain the actual measurement value, such as altitude; information about the units used to express the data, such as meters; and reference points for the data, such as sea level. Each data type is represented by a PROPERTYKEY constant. For example, the data type that represents altitude above sea level, in meters, would be identified by the SENSOR_DATA_TYPE_ALTITUDE_SEALEVEL_METERS constant.
  • When reporting data, a value is said to be contained in a data field, and a collection of related data fields make up a data report. Data reports are packaged together by using the IPortableDeviceValues interface. Each data report must contain at least one valid data field and a time stamp that identifies when the data report was created. Time stamps are represented by the SENSOR_DATA_TYPE_TIMESTAMP constant.

Other Constants

Your program must use other constants, also. These constants include the following:

  • Sensor properties, such as SENSOR_PROPERTY_DESCRIPTION. Usually, these constants are used to describe a sensor. Some sensor properties must be provided by the sensor, some properties can be set by client applications, and some must always return the same value from the sensor. The Sensor Properties reference section provides this information for each property.
  • Event constants, such as SENSOR_EVENT_STATE_CHANGED. Event constants include GUIDs, which represent types of events, and PROPERTYKEYs, which represent event parameter types. You will use these constants for method calls, such as ISensor::SetEventInterest and ISensor::GetEventInterest.

Custom Constants

Sensor manufacturers can define custom constants. For example, a sensor can belong in a category not defined by the platform. Before you can use a sensor that defines custom constants, the sensor manufacturer must publish the values, for example by publishing a header file. For more information, see the documentation that is provided with the sensor.