PDL_PollSensor

Description

Polls and returns an event for a specific sensor. Before being polled, the sensor must be enabled with PDL_EnableSensor.

For this API, you are required to pass a pointer to an allocated PDL_SensorEvent struct. The sensor event data is then returned in this struct.

If there is no event, the API returns PDL_NOERROR and sets the event struct's type field to PDL_SENSOR_NONE.

Syntax

PDL_ERR PDL_PollSensor(PDL_SensorType sensor, PDL_SensorEvent *event)     

Both fields are required.

Argument Description
sensor Type of sensor to poll - see defines for PDL_SensorType.
event Pointer to PDL_SensorEvent, the union struct used for all sensor events.

Returns

PDL_INVALIDINPUT - The event parameter is NULL.
PDL_ESTATE - The sensor is not enabled.
PDL_NOERROR - Success.

Note: In all cases where an error is returned, your app can call PDL_GetError to get a plain-text error description. This is usually more informative than the returned error code.

See also: