ch.aplu.nxt
Class RFIDSensor

java.lang.Object
  extended by ch.aplu.nxt.Part
      extended by ch.aplu.nxt.Sensor
          extended by ch.aplu.nxt.RFIDSensor
All Implemented Interfaces:
SharedConstants

public class RFIDSensor
extends Sensor
implements SharedConstants

Class that represents a RFID sensor from CODATEX (www.codatex.com).


Field Summary
 
Fields inherited from interface ch.aplu.nxt.SharedConstants
ABOUT, ACCELEROMETERPOLLDELAY, ANGLE, ANGLESTEPSMODE, AXELENGTH, BOOLEANMODE, BOOT, BRAKE, BRAKEDELAY, CELSIUSMODE, CLOSE, COLORPOLLDELAY, COMPASSPOLLDELAY, CRAWLERROTATIONFACTOR, CRAWLERROTATIONSPEED, CRAWLERSPEED, CRAWLERSTEPFACTOR, CUSTOM, DEBUG_LEVEL_HIGH, DEBUG_LEVEL_LOW, DEBUG_LEVEL_MEDIUM, DEBUG_LEVEL_OFF, DEBUGLEVEL, DELETE, DELETE_USER_FLASH, DIRECT_COMMAND_NOREPLY, DIRECT_COMMAND_REPLY, FAHRENHEITMODE, FIND_FIRST, FIND_NEXT, GEARSPEED, GET_BATTERY_LEVEL, GET_CURRENT_PROGRAM_NAME, GET_DEVICE_INFO, GET_FIRMWARE_VERSION, GET_INPUT_VALUES, GET_OUTPUT_STATE, GYROPOLLDELAY, HIGH_SPEED_BUFFER, INFRAREDSEEKERPOLLDELAY, KEEP_ALIVE, LIGHT_ACTIVE, LIGHT_INACTIVE, LIGHTPOLLDELAY, LOWSPEED, LOWSPEED_9V, LS_GET_STATUS, LS_READ, LS_WRITE, MESSAGE_READ, MESSAGE_WRITE, MODEMASK, MOTIONDETECTORPOLLDELAY, MOTOR_RUN_STATE_IDLE, MOTOR_RUN_STATE_RAMPDOWN, MOTOR_RUN_STATE_RAMPUP, MOTOR_RUN_STATE_RUNNING, MOTORON, MOTORSPEED, MOTORSPEEDFACTOR, MOTORSPEEDMULTIPLIER, NO_OF_SENSOR_TYPES, NO_SENSOR, OPEN_APPEND_DATA, OPEN_READ, OPEN_READ_LINEAR, OPEN_WRITE, OPEN_WRITE_DATA, OPEN_WRITE_LINEAR, PCTFULLSCALEMODE, PERIODCOUNTERMODE, PLAY_SOUND_FILE, PLAY_TONE, POLL, POLL_BUFFER, POLL_LENGTH, PROTOTYPEPOLLDELAY, RAWMODE, READ, REFLECTION, REGULATED, REGULATION_MODE_IDLE, REGULATION_MODE_MOTOR_SPEED, REGULATION_MODE_MOTOR_SYNC, REPLY_COMMAND, RESET_MOTOR_POSITION, RESET_SCALED_INPUT_VALUE, RFIDPOLLDELAY, SENSOREVENTDELAY, SET_BRICK_NAME, SET_INPUT_MODE, SET_OUTPUT_STATE, SLOPEMASK, SOUND_DB, SOUND_DBA, SOUNDPOLLDELAY, START_PROGRAM, STOP_PROGRAM, STOP_SOUND_PLAYBACK, SWITCH, SYSTEM_COMMAND_NOREPLY, SYSTEM_COMMAND_REPLY, TEMPERATURE, TITLE, TITLEMP, TOUCHPOLLDELAY, TRANSITIONCNTMODE, TURTLEROTATIONFACTOR, TURTLEROTATIONSPEED, TURTLESPEED, TURTLESTEPFACTOR, ULTRASONICPOLLDELAY, VERSION, WRITE
 
Constructor Summary
RFIDSensor()
          Creates a sensor instance connected to port S1.
RFIDSensor(SensorPort port)
          Creates a sensor instance connected to the given port.
 
Method Summary
 void addRFIDListener(RFIDListener rfidListener)
          Registers the given rfid listener.
 lejos.nxt.SensorPort getLejosPort()
          Returns the reference of the the underlying lejos.nxt.SensorPort.
 lejos.nxt.addon.RFIDSensor getLejosSensor()
          Returns the reference of the the underlying lejos.nxt.RFIDSensor.
 java.lang.String getProductID()
          Returns the product identifier (if available).
 byte[] getSerialNo()
          Returns the serial number of the RFID sensor.
 long getTransponderId()
          Polls the sensor.
 java.lang.String getVersion()
          Returns the sensor version number (if available).
 void setContMode(boolean continuous)
          Selects between Single Read and Continous Read mode.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RFIDSensor

public RFIDSensor(SensorPort port)
Creates a sensor instance connected to the given port. The sensor may be in two modes: Single Read or Continuous Read (default: Single Read). In Single Read mode the sensor is somewhat slower because it returns into a sleep state after 2 seconds of inactivity for power saving reasons. It is woke up automatically at the next call of getTransponderId(). To change the mode, use setContMode().

Parameters:
port - the port where the sensor is plugged-in

RFIDSensor

public RFIDSensor()
Creates a sensor instance connected to port S1.

Method Detail

addRFIDListener

public void addRFIDListener(RFIDListener rfidListener)
Registers the given rfid listener. If the rfid thread is not yet started, start it now.

Parameters:
rfidListener - the RFIDListener to become registered.

getLejosSensor

public lejos.nxt.addon.RFIDSensor getLejosSensor()
Returns the reference of the the underlying lejos.nxt.RFIDSensor.

Returns:
the reference of the TouchSensor

getLejosPort

public lejos.nxt.SensorPort getLejosPort()
Returns the reference of the the underlying lejos.nxt.SensorPort.

Returns:
the reference of the SensorPort

getProductID

public java.lang.String getProductID()
Returns the product identifier (if available).

Returns:
the product identifier (PID)

getVersion

public java.lang.String getVersion()
Returns the sensor version number (if available).

Returns:
the sensor version number

getSerialNo

public byte[] getSerialNo()
Returns the serial number of the RFID sensor.

Returns:
the 12 byte serial number or null, if sensor not available.

setContMode

public void setContMode(boolean continuous)
Selects between Single Read and Continous Read mode.

Parameters:
continuous - if true, the sensor is put in Continous Read mode; otherwise it is put in Single Read mode.

getTransponderId

public long getTransponderId()
Polls the sensor. If the sensor is in Single Read mode and in sleep state, it is automatically woke up.

Returns:
the current transponder id (0: no transponder detected)