Edit

Share via


ISensorEvents::OnEvent method (sensorsapi.h)

Important

Use the UWP Sensor API instead.

The COM-based Sensor API is deprecated and should not be used in new applications. No additional features or enhancements are planned, and support will be limited.

Provides custom event notifications.

Syntax

HRESULT OnEvent(
  [in] ISensor               *pSensor,
  [in] REFGUID               eventID,
  [in] IPortableDeviceValues *pEventData
);

Parameters

[in] pSensor

Pointer to the ISensor interface that represents the sensor that raised the event.

[in] eventID

REFGUID that identifies the event.

[in] pEventData

Pointer to the IPortableDeviceValues interface that contains the event data.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

This callback method receives custom event notifications. Custom events are defined by sensor providers. Platform-defined event IDs are defined in Sensors.h.

To receive new data from a sensor, use the OnDataUpdated Method.

Examples

For an example of how to receive sensor events, see Using Sensor API Events.

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

ISensorEvents