Packageorg.MARS.robot.control
Classpublic class AbstractElectronicDevice
ImplementsIElectronicDevice
SubclassesAbstractSensor, Battery, BrainOne, DifferentialSteering, LED, LineFollowingBrain, SquidTestBrain

An abstract class defining the basic functionality of the electronic devices, such as getting the states of the IO ports

See also

IOPort
IElectronicDevice
BrainOne


Public Properties
 PropertyDefined by
  numberOfPorts : Number
[read-only] Get the number of IO ports in the device.
AbstractElectronicDevice
Protected Properties
 PropertyDefined by
  _ports : Array
AbstractElectronicDevice
Public Methods
 MethodDefined by
  
AbstractElectronicDevice(numberOfPorts:Number, portDirection:Number)
Creates an electronic device with a certain number of IO ports.
AbstractElectronicDevice
  
getPort(portNumber:Number):IOPort
Get a certain IO port by its number
AbstractElectronicDevice
Property detail
numberOfPortsproperty
numberOfPorts:Number  [read-only]

Get the number of IO ports in the device.

NOTE: the number of ports cannot be modified once the device is created

Implementation
    public function get numberOfPorts():Number
_portsproperty 
protected var _ports:Array
Constructor detail
AbstractElectronicDevice()constructor
public function AbstractElectronicDevice(numberOfPorts:Number, portDirection:Number)

Creates an electronic device with a certain number of IO ports. The directionality of the ports may be changed later.

NOTE: an abstract class cannot be instantialized, used the subclasses

Parameters
numberOfPorts:Number
 
portDirection:Number
Method detail
getPort()method
public function getPort(portNumber:Number):IOPort

Get a certain IO port by its number

Parameters
portNumber:Number

Returns
IOPort — IO port

Throws
— an Error when the port number is out of the range