ISensorDriver::OnGetDataFields method (sensorsclassextension.h)

The ISensorDriver::OnGetDataFields method retrieves current sensor data.

Syntax

HRESULT OnGetDataFields(
  IWDFFile                     *pClientFile,
  LPWSTR                       pwszSensorID,
  IPortableDeviceKeyCollection *pDataFields,
  IPortableDeviceValues        **ppDataValues
);

Parameters

pClientFile

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

pwszSensorID

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

pDataFields

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

ppDataValues

Address of an IPortableDeviceValues pointer that receives the requested data.

Return value

This method returns an HRESULT. Possible values include, but are not limited to, one of the following values.

Return code Description
S_OK The method succeeded.
HRESULT_FROM_WIN32(ERROR_NO_DATA) The sensor has no data to report. Each of the data fields returned in the ppDataValues parameter is VT_EMPTY.

Remarks

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

Each IPortableDeviceValues object returned by this method must contain a time stamp, as described in SENSOR_CATEGORY_ALL.

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

The sensor class extension calls this method only for sensors for which the user has granted permission through Control Panel.

IPortableDeviceKeyCollection and IPortableDeviceValues are documented in Windows Portable Devices.

Requirements

Requirement Value
Target Platform Windows
Header sensorsclassextension.h
Library SensorsClassExtension.lib

See also

ISensorDriver