lejos.nxt
Class SensorPort.SensorReader

java.lang.Object
  extended by lejos.nxt.SensorPort.SensorReader
Direct Known Subclasses:
SensorPort.ColorSensorReader, SensorPort.StandardReader
Enclosing class:
SensorPort

protected class SensorPort.SensorReader
extends Object

The SensorReader class provides a way of performing type dependent way to obtain data froma sensor. This base class simply returns no data.


Constructor Summary
protected SensorPort.SensorReader()
           
 
Method Summary
 int readRawValue()
          Read a raw value from the sensor.
 int readRawValues(int[] values)
          Return a variable number of raw sensor values
 int readValue()
          Read a normalised/calibrated value from the sensor.
 int readValues(int[] values)
          Return a variable number of sensor values
 void reset()
          Reset the sensor.
 void setMode(int mode)
          Used to notify the reader that the operating mode of the sensor has changed.
 void setType(int type)
          Used to notify the reader that the type of the sensor has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SensorPort.SensorReader

protected SensorPort.SensorReader()
Method Detail

setType

public void setType(int type)
Used to notify the reader that the type of the sensor has changed.

Parameters:
type -

setMode

public void setMode(int mode)
Used to notify the reader that the operating mode of the sensor has changed.

Parameters:
mode -

readValue

public int readValue()
Read a normalised/calibrated value from the sensor.

Returns:
< 0 error, >= 0 sensor value

readRawValue

public int readRawValue()
Read a raw value from the sensor.

Returns:
< 0 error >= 0 Raw sensor value.

readValues

public int readValues(int[] values)
Return a variable number of sensor values

Parameters:
values - An array in which to return the sensor values.
Returns:
The number of values returned.

readRawValues

public int readRawValues(int[] values)
Return a variable number of raw sensor values

Parameters:
values - An array in which to return the sensor values.
Returns:
The number of values returned.

reset

public void reset()
Reset the sensor.