de.jaetzold.art.platform.lego
Class RCX

java.lang.Object
  |
  +--de.jaetzold.art.platform.RobotInterfaceAdapter
        |
        +--de.jaetzold.art.platform.lego.RCX
All Implemented Interfaces:
RobotInterface
Direct Known Subclasses:
Mindstorms

public abstract class RCX
extends RobotInterfaceAdapter


Inner Class Summary
 class RCX.AliveValueDefinition
           
protected  class RCX.BooleanConversionValueDefinition
          Definition for the standard booleanconversion of the RCX.
 class RCX.CondenseEventsTask
           
 class RCX.GetSensorValueTask
           
 class RCX.MotorSensorValueDefinition
           
 class RCX.Null
           
 class RCX.PacketEvent
           
 class RCX.PollSensorValueDefinition
           
protected  class RCX.RawValueDefinition
          Definition for the standard raw value of the RCX.
 class RCX.ReadPacketTask
           
static interface RCX.SensorValueDefinition
           
protected  class RCX.StateConversionValueDefinition
          Definition for the standard raw value of the RCX.
 class RCX.WritePacketTask
           
 
Field Summary
protected  boolean alive
           
protected static byte ALIVE
           
protected  boolean connected
           
protected  Queue eventQueue
           
protected  RCXPacketFilterTable filterTable
           
protected  RCXPacketInputStream inStream
           
protected  TaskPerformer notifier
           
protected  Queue notifierQueue
           
protected  RCXPacketOutputStream outStream
           
protected  Hashtable packetToValueDefinitionSet
           
protected static byte POLL
           
protected  Hashtable polledSensorValues
           
protected  TaskPerformer reader
           
protected  Queue readerQueue
           
protected  Hashtable sensorValueListeners
           
protected  Hashtable sensorValues
           
protected static byte[] UNLOCK_FIRMWARE
           
protected  TaskPerformer writer
           
protected  Queue writerQueue
          This Thread talks directly with the interface-hardware.
protected  Queue writerResultQueue
           
 
Constructor Summary
RCX()
           
 
Method Summary
protected  boolean alive()
           
 byte[] call(byte[] packet)
           
 Object call(Task t)
           
protected abstract  ActuatorPeer getActuatorPeer(ActuatorPort p, Sensor s)
           
protected abstract  SensorPeer getSensorPeer(SensorPort p, Sensor s)
           
 Object getSensorValue(RCX.SensorValueDefinition valueDefinition)
           
 boolean isAlive()
          Tells the state of the logical connection to the hardware-interface.
 boolean isConnected()
          Tells the state of the physical connection to the hardware-interface.
 void startPolling(RCX.SensorValueDefinition valueDefinition, SensorPeer recipient)
           
 void stopPolling(RCX.SensorValueDefinition valueDefinition, SensorPeer recipient)
           
 boolean unlockFirmware()
           
 
Methods inherited from class de.jaetzold.art.platform.RobotInterfaceAdapter
getActuatorPorts, getPort, getSensorPorts, getSerialPortNames, getSerialPortNames, getSerialPortNames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.jaetzold.art.RobotInterface
conformsTo, getActuatorPorts, getInterfaceDefinition, getSensorPorts
 

Field Detail

connected

protected boolean connected

alive

protected boolean alive

inStream

protected RCXPacketInputStream inStream

outStream

protected RCXPacketOutputStream outStream

writerQueue

protected Queue writerQueue
This Thread talks directly with the interface-hardware. It tries to read (and write) values as fast as it can and puts any change into a queue for further processing.

writer

protected TaskPerformer writer

writerResultQueue

protected Queue writerResultQueue

readerQueue

protected Queue readerQueue

reader

protected TaskPerformer reader

filterTable

protected RCXPacketFilterTable filterTable

eventQueue

protected Queue eventQueue

notifierQueue

protected Queue notifierQueue

notifier

protected TaskPerformer notifier

sensorValues

protected Hashtable sensorValues

polledSensorValues

protected Hashtable polledSensorValues

sensorValueListeners

protected Hashtable sensorValueListeners

packetToValueDefinitionSet

protected Hashtable packetToValueDefinitionSet

ALIVE

protected static final byte ALIVE

POLL

protected static final byte POLL

UNLOCK_FIRMWARE

protected static byte[] UNLOCK_FIRMWARE
Constructor Detail

RCX

public RCX()
Method Detail

isConnected

public boolean isConnected()
Description copied from interface: RobotInterface
Tells the state of the physical connection to the hardware-interface. It may be the case that this state is not distinguishable from the one defined by isAlive().
Following copied from interface: de.jaetzold.art.RobotInterface
See Also:
RobotInterface.isAlive(), SensorPeer.isConnected(), Sensor.isConnected()

isAlive

public boolean isAlive()
Description copied from interface: RobotInterface
Tells the state of the logical connection to the hardware-interface. If it is true that means the hardware-interface still behaves as expected.
Following copied from interface: de.jaetzold.art.RobotInterface
See Also:
RobotInterface.isConnected()

alive

protected boolean alive()

getSensorValue

public Object getSensorValue(RCX.SensorValueDefinition valueDefinition)

startPolling

public void startPolling(RCX.SensorValueDefinition valueDefinition,
                         SensorPeer recipient)

stopPolling

public void stopPolling(RCX.SensorValueDefinition valueDefinition,
                        SensorPeer recipient)

call

public byte[] call(byte[] packet)
            throws Exception

call

public Object call(Task t)
            throws Exception

unlockFirmware

public boolean unlockFirmware()

getSensorPeer

protected abstract SensorPeer getSensorPeer(SensorPort p,
                                            Sensor s)

getActuatorPeer

protected abstract ActuatorPeer getActuatorPeer(ActuatorPort p,
                                                Sensor s)