cork.device
Interface Motor

All Superinterfaces:
Device
All Known Implementing Classes:
ContinuousRotationServo, PolynomicDrive

public interface Motor
extends Device

Represents a generic motor. Devices that implement this interface are free to define the meaning of the abstract concepts of speed, direction, start and stop as long as they make sense within the devices context.

Version:
0.1.0
Author:
Brill Pappin

Field Summary
static int DIRECTION_FORWARD
          Direction identifier for "forward".
static int DIRECTION_REVERSE
          Direction identifier for "reverse".
 
Method Summary
 int getDirection()
          Returns the direction attribute.
 int getSpeed()
          Gets the speed attribute of the Motor object.
 void setDirection(int direction)
          Sets the direction attribute of the motor.
 void setSpeed(int speed)
          Sets the speed attribute of the Motor object.
 void start()
          Starts the motor.
 void stop()
          Stops the motor.
 
Methods inherited from interface cork.device.Device
getDeviceDestription, getDeviceName
 

Field Detail

DIRECTION_FORWARD

public static final int DIRECTION_FORWARD
Direction identifier for "forward".

The direction "forward" is an abstract concept and the implementing device is free to choose what forward means in it's particular context.

Since:
0.1.0

DIRECTION_REVERSE

public static final int DIRECTION_REVERSE
Direction identifier for "reverse".

The direction "reverse" is an abstract concept and the implementing device is free to choose what reverse means in it's particular context.

Since:
 
Method Detail

start

public void start()
Starts the motor.
Since:
0.1.0

stop

public void stop()
Stops the motor.
Since:
0.1.0

setDirection

public void setDirection(int direction)
Sets the direction attribute of the motor. This method is implementation specific and the implementing device if free to define the meaning of "direction" within it's own context.
Parameters:
direction - int the direction id from this interface.
Since:
0.1.0

getDirection

public int getDirection()
Returns the direction attribute.
Returns:
int the direction ID from this interface.
Since:
0.1.0

setSpeed

public void setSpeed(int speed)
Sets the speed attribute of the Motor object. How a device defines the concept of "speed" is implementation specific.
Parameters:
speed - int The new speed value
Since:
0.1.0

getSpeed

public int getSpeed()
Gets the speed attribute of the Motor object. How a device defines the concept of "speed" is implementation specific.
Returns:
int The speed value
Since:
0.1.0