de.jaetzold.art
Interface RobotInterface

All Known Implementing Classes:
RobotInterfaceAdapter

public interface RobotInterface

Basic Java-interface for classes which represent a hardware-interface in ART. Instances of RobotInterface can be retrieved from a RobotInterfaceFactory

See Also:
RobotInterfaceFactory

Method Summary
 boolean conformsTo(RobotInterfaceDefinition definition)
          Tells whether the given RobotInterfaceDefinition identifies this RobotInterface.
 ActuatorPort[] getActuatorPorts()
          Returns a description of all ActuatorPorts this Interface provides.
 ActuatorPort getActuatorPorts(int index)
          Returns the SensorPort with the specified index.
 RobotInterfaceDefinition getInterfaceDefinition()
          Returns a RobotInterfaceDefinition describing this instance of a RobotInterface.
 Port getPort(Object identifier)
          Returns a Port which is identified by the given Object.
 SensorPort[] getSensorPorts()
          Returns a description of all SensorPorts this Interface provides.
 SensorPort getSensorPorts(int index)
          Returns the SensorPort with the specified index.
 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.
 

Method Detail

getInterfaceDefinition

public RobotInterfaceDefinition getInterfaceDefinition()
Returns a RobotInterfaceDefinition describing this instance of a RobotInterface. It describes the RobotInterface in the sense that a call to conformsTo(RobotInterfaceDefinition) with it as a parameter will yield true as a result. There should be no other instances of RobotInterface at a time which conform to this definition. However there may other definitions possible to which more than one RobotInterface conforms to, but they shouldn't be returned by this method. The current implementations use a RobotInterfaceStringDefinition.
See Also:
RobotInterfaceStringDefinition, conformsTo(RobotInterfaceDefinition), RobotInterfaceFactory.getInterface(RobotInterfaceDefinition)

conformsTo

public boolean conformsTo(RobotInterfaceDefinition definition)
Tells whether the given RobotInterfaceDefinition identifies this RobotInterface. The provided implementations for Fischertechnik and Mindstorms use Strings.
See Also:
RobotInterfaceStringDefinition, getInterfaceDefinition(), RobotInterfaceFactory.getInterface(RobotInterfaceDefinition)

isConnected

public boolean isConnected()
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().
See Also:
isAlive(), SensorPeer.isConnected(), Sensor.isConnected()

isAlive

public boolean isAlive()
Tells the state of the logical connection to the hardware-interface. If it is true that means the hardware-interface still behaves as expected.
See Also:
isConnected()

getActuatorPorts

public ActuatorPort[] getActuatorPorts()
Returns a description of all ActuatorPorts this Interface provides. The Ports in the returned Array can then be used to connect some Actuator- or Sensor-Objects with a Peer that represents some specific type of hardware connected to the hardware-interface.
See Also:
getSensorPorts(), ActuatorPort.connectWith(Actuator)

getActuatorPorts

public ActuatorPort getActuatorPorts(int index)
Returns the SensorPort with the specified index. This method is only for convenience when using a RobotInterface as a JavaBean.
Throws:
ArrayIndexOutOfBoundsException - if the specified index is not a legal index into the array of SensorPorts.
See Also:
getActuatorPorts()

getSensorPorts

public SensorPort[] getSensorPorts()
Returns a description of all SensorPorts this Interface provides. The Ports in the returned Array can then be used to connect some Sensor-Objects with a Peer that represents some specific type of hardware connected to the hardware-interface.
See Also:
getActuatorPorts(), SensorPort.connectWith(Sensor)

getSensorPorts

public SensorPort getSensorPorts(int index)
Returns the SensorPort with the specified index. This method is only for convenience when using a RobotInterface as a JavaBean.
Throws:
ArrayIndexOutOfBoundsException - if the specified index is not a legal index into the array of SensorPorts.
See Also:
getActuatorPorts()

getPort

public Port getPort(Object identifier)
Returns a Port which is identified by the given Object. Which identifiers are legal and their meaning is defined by the actual implementation of RobotInterface. The implementations provided for Fischertechnik and Mindstorms use Strings which are equal to the names printed on the hardware-interface.
See Also:
getSensorPorts(), getActuatorPorts(), Port.getPortID(), Port.conformsTo(Object)