|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ukcrobots.simplecore.Sensor
A delegating wrapper around the InputDevice class. All methods delegate to the associated device. Multiple sensors may be connected to the same device, if required. However, there are drawbacks to this approach and the most sensible configuration would involve sensors of the same type. This class is based on josx.platform.rcx.Sensor.
Constructor Summary | |
Sensor(int id,
int type,
int mode)
Sets the sensor's mode and type. |
Method Summary | |
void |
activate()
Activates the sensor. |
protected ukcrobots.simplecore.InputDevice |
getDevice()
Obtain access to the attached InputDevice in order to provide enhanced functionality via a sub class. |
void |
passivate()
Passivates the sensor. |
int |
readValue()
Reads the canonical value of the sensor. |
int |
readValueAsInt()
Implementation of Listenable. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait |
Constructor Detail |
public Sensor(int id, int type, int mode) throws NoSuchDeviceException
type
- 0 = RAW, 1 = TOUCH, 2 = TEMP, 3 = LIGHT, 4 = ROT.mode
- 0x00 = RAW, 0x20 = BOOL, 0x40 = EDGE, 0x60 = PULSE,
0x80 = PERCENT, 0xA0 = DEGC, 0xC0 = DEGF, 0xE0 = ANGLE.
Also, mode can be OR'd with slope (0..31).SensorConstants
Method Detail |
public int readValue()
public int readValueAsInt()
public void activate()
Note that the sensor must be activatved if a listener is to receive notifications.
public final void passivate()
protected ukcrobots.simplecore.InputDevice getDevice()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |