Package: android.frameworks.sensorservice@1.0

ISensorManager

interface ISensorManager

ISensorManager is an interface to manage sensors

This file provides a set of functions that uses ISensorManager to access and list hardware sensors.

Methods

getSensorList

getSensorList ()
generates (vec<SensorInfo> list, Result result)

Get the list of available sensors.

Details
Generates
list
the list of available sensors, or empty on failure
result
OK on success or UNKNOWN_ERROR on failure

getDefaultSensor

getDefaultSensor (SensorType type)
generates (SensorInfo sensor, Result result)

Get the default sensor of the specified type.

Details
Parameters
type
Generates
sensor
the default sensor for the given type, or undetermined value on failure.
result
OK on success or NOT_EXIST if no sensor of that type exists.

createAshmemDirectChannel

createAshmemDirectChannel (memory mem, uint64_t size)
generates (IDirectReportChannel chan, Result result)

Create direct channel based on shared memory

Create a direct channel of DIRECT_CHANNEL_ASHMEM type to be used for configuring sensor direct report.

The memory layout looks as follows.These offsets can be found in android.hardware.sensors@1.0::SensorsEventFormatOffset.offset type name ----------------------------------- 0x0000 int32_t size(SensorsEventFormatOffset::TOTAL_LENGTH)0x0004 int32_t sensor report token 0x0008 int32_t type(see android.hardware.sensors@1.0::SensorType)0x000C uint32_t atomic counter 0x0010 int64_t timestamp(see android.hardware.sensors@1.0::Event)0x0018 float[16]/ data int64_t[8]0x0058 int32_t[4]reserved(set to zero)

Details
Parameters
mem
the shared memory to use, must be ashmem.
size
the intended size to be used.The following must be true:SensorsEventFormatOffset::TOTAL_LENGTH <= size <= mem.size
Generates
chan
The created channel, or NULL if failure.
result
OK if successful;BAD_VALUE if size>mem.size();BAD_VALUE if size<TOTAL_LENGTH;NO_MEMORY, NO_INIT, BAD_VALUE for underlying errors;UNKNOWN_ERROR if the underlying error is not recognized;UNKNOWN_ERROR if the underlying call returns channelId = 0

createGrallocDirectChannel

createGrallocDirectChannel (handle buffer, uint64_t size)
generates (IDirectReportChannel chan, Result result)

Create direct channel based on hardware buffer

Create a direct channel of DIRECT_CHANNEL_GRALLOC type to be used for configuring sensor direct report.

Details
Parameters
buffer
file descriptor describing the gralloc buffer.
size
the intended size to be used, must be less than or equal to the size of the buffer.
Generates
chan
The created channel, or NULL if failure.
result
OK if successful;NO_MEMORY, NO_INIT, BAD_VALUE for underlying errors;UNKNOWN_ERROR if the underlying error is not recognized;UNKNOWN_ERROR if the underlying call returns channelId = 0

createEventQueue

createEventQueue (IEventQueueCallback callback)
generates (IEventQueue queue, Result result)

Create a sensor event queue.

Create a sensor event queue with an IEventQueueCallback object.Subsequently, one can enable sensors on the event queue so that sensor events are passed via the specified callback.

Details
Parameters
callback
the callback to call on events.Must not be null.
Generates
queue
the event queue created.null on failure.
result
OK if successful, BAD_VALUE if callback is null, or other Result values for any underlying errors.