About Sensor API Events

The Sensor API can provide event notifications.

When you register to receive events, through either ISensor::SetEventSink or ISensorManager::SetEventSink, you must provide a pointer to a callback interface. You must implement the methods of the callback interface in your code. The Sensor API defines the following callback interfaces:

  • ISensorEvents. Implement this interface to receive events from sensors. Sensors can notify your application about new data, changes in sensor state, sensor disconnection, and custom events defined by the sensor manufacturer.
  • ISensorManagerEvents. Implement this interface to receive events from the sensor manager. The sensor manager can notify your application when a sensor connects, and therefore may be available for use.

You can cancel event notifications by calling SetEventSink again, this time passing a NULL value through the parameter.

Using Sensor API Events