ISensorDriver::OnGetProperties method

The ISensorDriver::OnGetProperties method retrieves values for the specified properties from the specified sensor.


HRESULT OnGetProperties(
  IWDFFile                     *pClientFile,
  LPWSTR                       pwszSensorID,
  IPortableDeviceKeyCollection *pProperties,
  IPortableDeviceValues        **ppPropertyValues



Pointer to an IWDFFile interface that represents the file object for the application requesting property values.


LPWSTR that contains the ID for the sensor from which the client application is requesting property values.


Pointer to an IPortableDeviceKeyCollection that contains the list of PROPERTYKEY values that represent the properties being requested.


Address of an IPortableDeviceValues pointer that receives the requested property values.

Return Value

If the operation succeeds, this method returns S_OK. Otherwise, this method returns one of the error codes that are defined in Winerror.h.


Properties describe the sensor device, as opposed to data fields, which contain sensor-generated data. Platform-defined properties are defined in sensors.h.

Applications can access some sensor property information before the user grants permission for the sensor. These items are limited to the following IDs defined in sensors.h:

  • Any PROPERTYKEY that starts with "SENSOR_PROPERTY_".

  • Any category GUID that starts with "SENSOR_CATEGORY_".

Each IPortableDeviceValues object returned in this collection must contain values for the required properties, as described in the Sensor Properties reference section.

The sensor class extension is responsible for freeing any PROPVARIANT structures returned by this method.

Sensor properties must not contain information that can be used to identify the user. For more information about user privacy, see Privacy and Security in the Sensor and Location Platform.

IPortableDeviceKeyCollection and IPortableDeviceValues are documented in Windows Portable Devices.


Target Platform Windows
Header sensorsclassextension.h
Library SensorsClassExtension.lib

See Also