Sony Addon SDK
public class

AccessorySensor

This project is no longer being supported and will not get any further updates.
extends java.lang.Object
  1. java.lang.Object
  2. com.sonyericsson.extras.liveware.extension.util.sensor.AccessorySensor

Class Overview

The accessory sensor class is used to interact with a sensor on an accessory.

Summary

Public Constructors
AccessorySensor(Context context, java.lang.String hostAppPackageName, int sensorId, AccessorySensorType type, boolean isInterruptSupported, java.lang.String name, int resolution, int minimumDelay, int maximumRange)

Create accessory sensor.

Public Methods
void registerListener(AccessorySensorEventListener listener, int sensorRate, int interruptMode)

Register a sensor event listener.

void registerInterruptListener(AccessorySensorEventListener listener)

Register a sensor event listener that gets new data when the sensor has new data.

void registerFixedRateListener(AccessorySensorEventListener listener, int sensorRate)

Register a sensor event listener that gets new data at a fixed rate.

void unregisterListener()

Unregister sensor event listener.

int getSensorId()

Get the sensor id.

AccessorySensorType getType()

Get the sensor type.

boolean isInterruptModeSupported()

Is interrupt mode supported.

java.lang.String getName()

Get the sensor name.

int getResolution()

Get the sensor resolution.

int getMinimumDelay()

Get the minimum delay.

int getMaximumRange()

Get the maximum range.

Public Constructors

public AccessorySensor(Context context, java.lang.String hostAppPackageName, int sensorId, AccessorySensorType type, boolean isInterruptSupported, java.lang.String name, int resolution, int minimumDelay, int maximumRange)

Create accessory sensor. This constructor is normally not called directly. Instead it is created from AccessorySensorManager or DeviceInfo.

Parameters
context The context.
hostAppPackageName The host application package name.
sensorId The sensor id.
type The sensor type.
isInterruptSupported True if interrupt mode is supported.
name The name.
resolution The resolution.
minimumDelay The minimum delay.
maximumRange The maximum range.

Public Methods

public void registerListener(AccessorySensorEventListener listener, int sensorRate, int interruptMode)

Register a sensor event listener. It is only possible to have one listener per sensor.

Parameters
listener The event listener.
sensorRate The sensor rate. See: Sensor.SensorRates
interruptMode The interrupt mode. See: Sensor.SensorInterruptMode.
Throws
AccessorySensorException  

public void registerInterruptListener(AccessorySensorEventListener listener)

Register a sensor event listener that gets new data when the sensor has new data. This type of listener is available if sensor support interrupt mode. It is only possible to have one listener per sensor.

Parameters
listener The event listener.
Throws
AccessorySensorException  
See Also

public void registerFixedRateListener(AccessorySensorEventListener listener, int sensorRate)

Register a sensor event listener that gets new data at a fixed rate. It is only possible to have one listener per sensor.

Parameters
listener The event listener.
sensorRate Any one of the constants defined in the Sensor.SensorRates interface.
Throws
AccessorySensorException  

public void unregisterListener()

Unregister sensor event listener.

public int getSensorId()

Get the sensor id.

Returns

The sensor id.

See Also

public AccessorySensorType getType()

Get the sensor type.

Returns

The sensor type.

public boolean isInterruptModeSupported()

Is interrupt mode supported. Sensor in interrupt mode can send data right after they are measured and and won't be required to send them at a fixed rate.

Returns

True if interrupt mode is supported.

See Also

public java.lang.String getName()

Get the sensor name.

Returns

The sensor name.

See Also

public int getResolution()

Get the sensor resolution.

Returns

The sensor resolution.

See Also

public int getMinimumDelay()

Get the minimum delay.

Returns

The minimum delay.

See Also

public int getMaximumRange()

Get the maximum range.

Returns

The maximum range.

See Also