javax.microedition.sensor
Class SensorManager

java.lang.Object
  extended by javax.microedition.sensor.SensorManager

public class SensorManager
extends Object

JSR256 SensorManager implementation for leJOS NXJ I2C sensors

Author:
Lawrie Griffiths

Constructor Summary
SensorManager()
           
 
Method Summary
static void addSensorListener(SensorListener listener, SensorInfo info)
          Register a listener to monitor the change of availability of a specific sensor
static void addSensorListener(SensorListener listener, String quantity)
          Register a listener to monitor the change of availability of a sensor for a specific quantity
static NXTSensorInfo[] findQuantity(String quantity)
           
static SensorInfo[] findSensors(String url)
          Find all available sensors that match a specific URL.
static SensorInfo[] findSensors(String quantity, String contextType)
          Find all available sensors that match a specific quantity and/or context.
static void removeSensorListener(SensorListener listener)
          Remove the specified sensor listener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SensorManager

public SensorManager()
Method Detail

addSensorListener

public static void addSensorListener(SensorListener listener,
                                     SensorInfo info)
Register a listener to monitor the change of availability of a specific sensor

Parameters:
listener - the sensor listener
info - a SensorListener object returned from findSensors or SensorConnection.getSensorInfo

addSensorListener

public static void addSensorListener(SensorListener listener,
                                     String quantity)
Register a listener to monitor the change of availability of a sensor for a specific quantity

Parameters:
listener - the sensor listener
quantity - the required quantity

findSensors

public static SensorInfo[] findSensors(String url)
Find all available sensors that match a specific URL. Note that this only finds I2C sensors.

Parameters:
url - the specified URL
Returns:
an array of SensorInfo objects

findSensors

public static SensorInfo[] findSensors(String quantity,
                                       String contextType)
Find all available sensors that match a specific quantity and/or context. Note that this only finds I2C sensors.

Parameters:
quantity - the required quantity or null for any
contextType - the required context type or null for any
Returns:
an array of SensorInfo objects

removeSensorListener

public static void removeSensorListener(SensorListener listener)
Remove the specified sensor listener

Parameters:
listener - the sensor listener

findQuantity

public static NXTSensorInfo[] findQuantity(String quantity)