public class Ssc32UsbServoController extends Service implements PortConnector, ServoController
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
log |
cfgDir, dnaPool, MESSAGE_RECORDING_FORMAT_BINARY, MESSAGE_RECORDING_FORMAT_XML
Constructor and Description |
---|
Ssc32UsbServoController(java.lang.String n) |
Modifier and Type | Method and Description |
---|---|
void |
attach(Attachable service)
Routing attach - routes ServiceInterface.attach(service) to appropriate
methods for this class
|
void |
attach(ServoControl servo,
int pin)
attach with parameters which will set all necessary attributes on ServoControl
before calling the single parameter typed attach
|
void |
attachServoControl(ServoControl servo)
Single parameter attach{type}({type}) - this is where the "real" attach
logic is for this service.
|
void |
connect(java.lang.String port)
connect - default connection speed is 9600
Press and hold the button.
|
void |
connect(java.lang.String port,
int rate) |
void |
connect(java.lang.String port,
int rate,
int databits,
int stopbits,
int parity) |
void |
detach(Attachable service)
Routing detach - routes ServiceInterface.detach(service) to appropriate
methods for this class
|
void |
detachServoControl(ServoControl servo)
This is a typed detach for the one interface it knows how to attach to
|
void |
disablePin(java.lang.Integer i) |
void |
disconnect()
disconnect serial
|
void |
enablePin(java.lang.Integer sensorPin,
java.lang.Integer i) |
java.util.Set<java.lang.String> |
getAttached()
returns all currently attached services
|
static ServiceType |
getMetaData()
This static method returns all the details of the class without it having
to be constructed.
|
SerialDevice |
getSerial() |
boolean |
isAttached(java.lang.String name)
returns if the Attachable has been set or not - name interface
|
boolean |
isConnected() |
static void |
main(java.lang.String[] args) |
void |
servoAttachPin(ServoControl servo,
int pin) |
void |
servoDetachPin(ServoControl servo) |
void |
servoMoveTo(ServoControl servo) |
void |
servoSetAcceleration(ServoControl servo) |
void |
servoSetVelocity(ServoControl servo) |
void |
servoSweepStart(ServoControl servo) |
void |
servoSweepStop(ServoControl servo) |
void |
servoWriteMicroseconds(ServoControl servo,
int uS) |
void |
startService() |
static double |
toDegrees(double us) |
static double |
toUs(double degrees) |
void |
write(java.lang.String cmd,
java.lang.Object... params) |
addListener, addListener, addTask, addTask, addTask, addTaskOneShot, allowDisplay, allowDisplay, attach, broadcastState, buildDna, buildDna, buildDnaKeys, buildDnaNames, clearLastError, close, containsTask, copyShallowFrom, createPeer, createPeer, createRootReserved, detach, detach, echoHeartbeat, error, error, error, getCfgDir, getComm, getDeclaredMethodNames, getDeclaredMethods, getDescription, getDna, getDnaString, getHostName, getInbox, getInstanceId, getIntanceName, getInterfaceSet, getLastError, getMessageSet, getMetaData, getMethodMap, getMethodNames, getMethods, getMethodToolTip, getMsg, getName, getNotifyList, getNotifyListKeySet, getOutbox, getPeerKey, getPeerName, getServiceResourceFile, getSimpleName, getTasks, getThisThread, getType, hasError, hasPeers, help, help, in, info, info, invoke, invoke, invoke, invokeOn, isAttached, isLocal, isReady, isRunning, isRuntime, isVirtual, load, load, logTimeEnable, mergeDna, mergeDna, mergePeerDna, movePeerDna, out, out, preProcessHook, preRoutingHook, publishError, publishQueueStats, publishState, publishStats, publishStatus, purgeTask, purgeTasks, releasePeers, releaseService, removeAllListeners, removeListener, requiresSecurity, reserve, reserve, reserveRoot, reserveRoot, reserveRootAs, run, save, save, save, send, send, send, send, sendBlocking, sendBlocking, sendBlocking, sendBlocking, sendPeer, setInstanceId, setName, setPeer, setSecurityProvider, setState, setThisThread, setVirtual, sleep, stackToString, startHeartbeat, startPeer, startPeer, startRecording, stopHeartbeat, stopMsgRecording, stopService, subscribe, subscribe, subscribe, toString, unsubscribe, unsubscribe, unsubscribe, updateStats, warn, warn
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
attach, detach, detach, isAttached, isLocal
getName
public static double toUs(double degrees)
public static double toDegrees(double us)
public void connect(java.lang.String port) throws java.io.IOException
connect
in interface PortConnector
java.io.IOException
public void disconnect()
disconnect
in interface PortConnector
public void startService()
startService
in interface ServiceInterface
startService
in class Service
public SerialDevice getSerial()
public boolean isConnected()
isConnected
in interface PortConnector
public static ServiceType getMetaData()
public void connect(java.lang.String port, int rate, int databits, int stopbits, int parity) throws java.io.IOException
connect
in interface PortConnector
java.io.IOException
public void servoAttachPin(ServoControl servo, int pin)
servoAttachPin
in interface ServoController
public void write(java.lang.String cmd, java.lang.Object... params)
public void servoSweepStart(ServoControl servo)
servoSweepStart
in interface ServoController
public void servoSweepStop(ServoControl servo)
servoSweepStop
in interface ServoController
public void servoMoveTo(ServoControl servo)
servoMoveTo
in interface ServoController
public void servoWriteMicroseconds(ServoControl servo, int uS)
servoWriteMicroseconds
in interface ServoController
public void servoDetachPin(ServoControl servo)
servoDetachPin
in interface ServoController
public void servoSetVelocity(ServoControl servo)
servoSetVelocity
in interface ServoController
public void servoSetAcceleration(ServoControl servo)
servoSetAcceleration
in interface ServoController
public void attach(ServoControl servo, int pin) throws java.lang.Exception
attach
in interface ServoController
servo
- the servopin
- the pin numberjava.lang.Exception
- epublic java.util.Set<java.lang.String> getAttached()
getAttached
in interface Attachable
getAttached
in class Service
public void attach(Attachable service) throws java.lang.Exception
attach
in interface Attachable
attach
in class Service
service
- - the service to attach from this servicejava.lang.Exception
- - throws on error and cannot attachpublic void attachServoControl(ServoControl servo) throws java.lang.Exception
attachServoControl
in interface ServoController
servo
- the servojava.lang.Exception
- epublic void detach(Attachable service)
detach
in interface Attachable
detach
in class Service
service
- - the service to detach from this servicepublic void detachServoControl(ServoControl servo)
servo
- - servo control servicepublic boolean isAttached(java.lang.String name)
Attachable
isAttached
in interface Attachable
isAttached
in class Service
name
- - name of servicepublic static void main(java.lang.String[] args)
public void connect(java.lang.String port, int rate) throws java.lang.Exception
connect
in interface PortConnector
java.lang.Exception
public void enablePin(java.lang.Integer sensorPin, java.lang.Integer i)
enablePin
in interface ServoController
public void disablePin(java.lang.Integer i)
disablePin
in interface ServoController