IdType - Id Type use by this ServoController's ServosS - Servo type used by this AbstractServoControllerControllerConf - ServoControllerConfig type usedServoConf - ServoConfig type used by S and Confpublic abstract class AbstractServoController<IdType,ServoConf extends ServoConfig<IdType>,S extends Servo<IdType,ServoConf>,ControllerConf extends ServoControllerConfig<IdType,ServoConf>> extends PropertyChangeNotifier implements ServoController<IdType,ServoConf,S,ControllerConf>
ServoController.Id, ServoController.ServoId<ServoIdType>| Modifier and Type | Field and Description |
|---|---|
protected PropertyChangeMonitor |
myChangeMonitor
The Controllers's PropertyChangeMonitor to listen for changes in Servos
and configs.
|
protected ControllerConf |
myConfig
ServoController's Confgiuration parameters.
|
protected ConnectionStatus |
myConnectionStatus
The Controller's ConnectionStatus.
|
protected Map<ServoController.ServoId<IdType>,S> |
myServoMap
Map of the Controller's Servos and their ids.
|
protected List<S> |
myServos
List of the Coontroller's Servos.
|
PROP_CONNECTION_STATUS, PROP_ENABLED, PROP_ERROR_MESSAGES, PROP_SERVO_ADD, PROP_SERVO_REMOVE, PROP_SERVOS, PROP_VERSION| Constructor and Description |
|---|
AbstractServoController(ControllerConf config)
Creates a new AbstractServoController from the given config.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addingServo(ServoConf config)
Called when a Servo is added to the underlying ServoControllerConfig.
|
void |
addServo(ServoConf config)
Add a Servo the ServoController.
|
protected void |
changeServoId(ServoController.ServoId<IdType> oldId,
ServoController.ServoId<IdType> newId)
Called when the id of a Servo changes in the underlying
ServoControllerConfig.
|
protected abstract S |
connectServo(ServoConf config)
Called when a new Servo is being added.
|
boolean |
containsId(ServoController.ServoId<IdType> id)
Returns true if the controller contains a Servo for the given Servo id.
|
boolean |
containsIds(Set<ServoController.ServoId<IdType>> ids)
Returns true if the controller contains a Servo for each of the given
Servo ids.
|
protected abstract boolean |
disconnectServo(ServoController.ServoId<IdType> id)
Called when a Servo is being removed.
|
ControllerConf |
getConfig()
Returns the ServoController's ServoControllerConfig.
|
ConnectionStatus |
getConnectionStatus()
Return the current ConnectionStatus.
|
ServoController.Id |
getId()
Returns the ServoController.Id identifying this ServoController.
|
S |
getServo(ServoController.ServoId<IdType> id)
Returns the Servo with the given id.
|
List<S> |
getServos()
Returns a List of the controller's Servos.
|
void |
removeServo(S servo)
Remove a Servo from the ServoController.
|
protected void |
removingServo(ServoController.ServoId<IdType> id)
Called when a Servo is removed from the underlying ServoControllerConfig.
|
protected ServoController.ServoId<IdType> |
servoId(IdType id)
Creates a ServoController.ServoId from this ServoController's Id and a
Servo's Id
|
protected void |
setConnectStatus(ConnectionStatus status)
Set the ServoController's ConnectionStatus.
|
addPropertyChangeListener, addPropertyChangeListener, clearAllListeners, clearListeners, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconnect, disconnect, getEnabled, getErrorMessages, getServoIdClass, moveAllServos, moveServo, moveServos, setEnabledaddPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListenerprotected ControllerConf extends ServoControllerConfig<IdType,ServoConf> myConfig
protected List<S extends Servo<IdType,ServoConf>> myServos
protected Map<ServoController.ServoId<IdType>,S extends Servo<IdType,ServoConf>> myServoMap
protected ConnectionStatus myConnectionStatus
protected PropertyChangeMonitor myChangeMonitor
public AbstractServoController(ControllerConf config)
config - the Controller's cofigpublic final ServoController.Id getId()
ServoControllergetId in interface ServoController<IdType,ServoConf extends ServoConfig<IdType>,S extends Servo<IdType,ServoConf>,ControllerConf extends ServoControllerConfig<IdType,ServoConf>>protected abstract S connectServo(ServoConf config)
config - protected abstract boolean disconnectServo(ServoController.ServoId<IdType> id)
id - Servo's idpublic void addServo(ServoConf config)
config - Servo's configuration parameterspublic void removeServo(S servo)
servo - Servo to removeprotected void setConnectStatus(ConnectionStatus status)
status - new ConnectionStatuspublic S getServo(ServoController.ServoId<IdType> id)
ServoControllergetServo in interface ServoController<IdType,ServoConf extends ServoConfig<IdType>,S extends Servo<IdType,ServoConf>,ControllerConf extends ServoControllerConfig<IdType,ServoConf>>id - the Servo idpublic List<S> getServos()
ServoControllergetServos in interface ServoController<IdType,ServoConf extends ServoConfig<IdType>,S extends Servo<IdType,ServoConf>,ControllerConf extends ServoControllerConfig<IdType,ServoConf>>public boolean containsIds(Set<ServoController.ServoId<IdType>> ids)
ServoControllercontainsIds in interface ServoController<IdType,ServoConf extends ServoConfig<IdType>,S extends Servo<IdType,ServoConf>,ControllerConf extends ServoControllerConfig<IdType,ServoConf>>ids - Set of Servo ids to checkpublic boolean containsId(ServoController.ServoId<IdType> id)
ServoControllercontainsId in interface ServoController<IdType,ServoConf extends ServoConfig<IdType>,S extends Servo<IdType,ServoConf>,ControllerConf extends ServoControllerConfig<IdType,ServoConf>>id - Servo id to checkpublic ConnectionStatus getConnectionStatus()
ServoControllergetConnectionStatus in interface ServoController<IdType,ServoConf extends ServoConfig<IdType>,S extends Servo<IdType,ServoConf>,ControllerConf extends ServoControllerConfig<IdType,ServoConf>>protected void addingServo(ServoConf config)
config - the Servo's configuration parametersprotected void removingServo(ServoController.ServoId<IdType> id)
id - id of the Servo being removedprotected void changeServoId(ServoController.ServoId<IdType> oldId, ServoController.ServoId<IdType> newId)
oldId - old idnewId - new idpublic ControllerConf getConfig()
ServoControllergetConfig in interface ServoController<IdType,ServoConf extends ServoConfig<IdType>,S extends Servo<IdType,ServoConf>,ControllerConf extends ServoControllerConfig<IdType,ServoConf>>protected ServoController.ServoId<IdType> servoId(IdType id)
id - Servo Id to useCopyright © 2011-2014. All Rights Reserved.