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. |
Create accessory sensor. This constructor is normally not called directly. Instead it is created from AccessorySensorManager or DeviceInfo.
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. |
Register a sensor event listener. It is only possible to have one listener per sensor.
listener | The event listener. |
---|---|
sensorRate | The sensor rate. See: Sensor.SensorRates |
interruptMode | The interrupt mode. See: Sensor.SensorInterruptMode. |
AccessorySensorException |
---|
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.
listener | The event listener. |
---|
AccessorySensorException |
---|
Register a sensor event listener that gets new data at a fixed rate. It is only possible to have one listener per sensor.
listener | The event listener. |
---|---|
sensorRate | Any one of the constants defined in the Sensor.SensorRates interface. |
AccessorySensorException |
---|
Unregister sensor event listener.
Get the sensor id.
The sensor id.
Get the sensor type.
The sensor type.
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.
True if interrupt mode is supported.
Get the sensor name.
The sensor name.
Get the sensor resolution.
The sensor resolution.
Get the minimum delay.
The minimum delay.
Get the maximum range.
The maximum range.
The accessory sensor class is used to interact with a sensor on an accessory.