|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.robokind.api.common.property.PropertyChangeNotifier
org.robokind.api.motion.servos.AbstractServoController<IdType,ServoConf,S,ControllerConf>
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>>
Provides common functionality for ServoControllers.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.robokind.api.motion.servos.ServoController |
---|
ServoController.Id, ServoController.ServoId<ServoIdType> |
Field Summary | |
---|---|
protected org.robokind.api.common.property.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. |
Fields inherited from interface org.robokind.api.motion.servos.ServoController |
---|
PROP_CONNECTION_STATUS, PROP_ENABLED, PROP_ERROR_MESSAGES, PROP_SERVO_ADD, PROP_SERVO_REMOVE, PROP_SERVOS, PROP_VERSION |
Constructor Summary | |
---|---|
AbstractServoController(ControllerConf config)
Creates a new AbstractServoController from the given config. |
Method Summary | |
---|---|
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. |
Methods inherited from class org.robokind.api.common.property.PropertyChangeNotifier |
---|
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, removePropertyChangeListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.robokind.api.motion.servos.ServoController |
---|
connect, disconnect, getEnabled, getErrorMessages, getServoIdClass, moveAllServos, moveServo, moveServos, setEnabled |
Methods inherited from interface org.robokind.api.common.property.PropertyChangeSource |
---|
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener |
Field Detail |
---|
protected 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 org.robokind.api.common.property.PropertyChangeMonitor myChangeMonitor
Constructor Detail |
---|
public AbstractServoController(ControllerConf config)
config
- the Controller's cofigMethod Detail |
---|
public final ServoController.Id getId()
ServoController
getId
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 id
public 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)
ServoController
getServo
in interface ServoController<IdType,ServoConf extends ServoConfig<IdType>,S extends Servo<IdType,ServoConf>,ControllerConf extends ServoControllerConfig<IdType,ServoConf>>
id
- the Servo id
public List<S> getServos()
ServoController
getServos
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)
ServoController
containsIds
in interface ServoController<IdType,ServoConf extends ServoConfig<IdType>,S extends Servo<IdType,ServoConf>,ControllerConf extends ServoControllerConfig<IdType,ServoConf>>
ids
- Set of Servo ids to check
public boolean containsId(ServoController.ServoId<IdType> id)
ServoController
containsId
in interface ServoController<IdType,ServoConf extends ServoConfig<IdType>,S extends Servo<IdType,ServoConf>,ControllerConf extends ServoControllerConfig<IdType,ServoConf>>
id
- Servo id to check
public ConnectionStatus getConnectionStatus()
ServoController
getConnectionStatus
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()
ServoController
getConfig
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 use
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |