ISensor::GetData method (sensorsapi.h)

Retrieves the most recent sensor data report.

Syntax

HRESULT GetData(
  [out] ISensorDataReport **ppDataReport
);

Parameters

[out] ppDataReport

Address of an ISensorDataReport pointer that receives the pointer to the most recent sensor data report.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
S_OK
The method succeeded.
E_INVALIDARG
The sensor driver provided badly formed data. For example, the data was of a type that is not supported. For information about data types of platform-defined data fields, see Sensor Categories, Types, and Data Fields.
HRESULT_FROM_WIN32(ERROR_NO_DATA)
The sensor has no data to report. For example, a GPS sensor could be in the process of acquiring a satellite fix.
E_POINTER
NULL was passed in for ppDataReport.

Remarks

For location sensors, you can retrieve data only from sensors for which the user has granted permission.

This method may return data before the driver has set the state to SENSOR_STATE_READY.

Examples

For an example of how to retrieve sensor data, see Retrieving Sensor Data Values.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server None supported
Target Platform Windows
Header sensorsapi.h
Library Sensorsapi.lib
DLL Sensorsapi.dll

See also

ISensor

Managing User Permissions

RequestPermissions

Sensor Categories, Types, and Data Fields