public class RemoteRobotHost extends Object
| Modifier | Constructor and Description |
|---|---|
|
RemoteRobotHost(Robot robot,
String sourceId,
String destinationId,
org.jflux.api.messaging.rk.MessageSender<RobotResponse> sender,
org.jflux.api.messaging.rk.MessageAsyncReceiver<RobotRequest> receiver,
RobotResponseFactory factory,
org.jflux.api.messaging.rk.MessageAsyncReceiver<MotionFrameEvent> motionFrameReceiver,
org.jflux.api.core.Listener<MotionFrameEvent> moveHandler)
Creates a new RemoteRobotHost to host the given Robot.
|
protected |
RemoteRobotHost(String sourceId,
String destinationId)
Creates an empty RemoteRobotHost.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getDestinationId()
Returns a String identifying a client.
|
protected Joint |
getRequestedJoint(RobotRequest req)
Retrieves the Joint specified in the RobotRequest.
|
org.jflux.api.messaging.rk.MessageSender<RobotResponse> |
getResponseSender() |
Robot |
getRobot() |
Robot.Id |
getRobotId()
Returns the hosted Robot's id.
|
String |
getSourceId()
Returns a String identifying this host.
|
protected void |
handleConnectionStatusRequest(RobotRequest req)
Creates and sends a RobotStatusResponse with the Robot's connection
status
|
protected void |
handleConnectRequest(RobotRequest req)
Calls
connect() on the hosted Robot. |
protected void |
handleCurrentPositionRequest(RobotRequest req)
Sends a RobotPositionResponse with the Robot's current positions.
|
protected void |
handleDefaultPositionRequest(RobotRequest req)
Sends a RobotPositionResponse with the Robot's default positions.
|
protected void |
handleDefinitionRequest(RobotRequest req)
Creates and sends a RobotDefinitionResponse.
|
protected void |
handleDisableRequest(RobotRequest req)
Calls
setEnabled(false) on the hosted Robot. |
protected void |
handleDisableRequestForJoint(RobotRequest req)
Calls
setEnabled(true) on the hosted Robot's Joint. |
protected void |
handleDisconnectRequest(RobotRequest req)
Calls
disconnect() on the hosted Robot. |
protected void |
handleEnabledStatusRequest(RobotRequest req)
Creates and sends a RobotStatusResponse with the Robot's enabled status
|
protected void |
handleEnabledStatusRequestForJoint(RobotRequest req)
Creates and sends a RobotStatusResponse with the Joint's connection
status
|
protected void |
handleEnableRequest(RobotRequest req)
Calls
setEnabled(true) on the hosted Robot. |
protected void |
handleEnableRequestForJoint(RobotRequest req)
Calls
setEnabled(true) on the hosted Robot's Joint. |
protected void |
handleGoalPositionRequest(RobotRequest req)
Sends a RobotPositionResponse with the Robot's goal positions.
|
void |
setMotionFrameReceiver(org.jflux.api.messaging.rk.MessageAsyncReceiver<MotionFrameEvent> receiver)
Sets the MessageReceiver to receive MotionFrames
|
void |
setMoveHandler(org.jflux.api.core.Listener<MotionFrameEvent> moveHandler)
Sets the Listener to handle MotionFrames from clients.
|
void |
setRequestReceiver(org.jflux.api.messaging.rk.MessageAsyncReceiver<RobotRequest> receiver)
Sets the MessageReceiver to receive RobotRequests.
|
void |
setResponseFactory(RobotResponseFactory factory)
Sets the factory to use for creating new RobotResponse Messages.
|
void |
setResponseSender(org.jflux.api.messaging.rk.MessageSender<RobotResponse> sender)
Sets the MessageSender to send RobotResponses.
|
void |
setRobot(Robot robot)
Sets the Robot to host.
|
public RemoteRobotHost(Robot robot, String sourceId, String destinationId, org.jflux.api.messaging.rk.MessageSender<RobotResponse> sender, org.jflux.api.messaging.rk.MessageAsyncReceiver<RobotRequest> receiver, RobotResponseFactory factory, org.jflux.api.messaging.rk.MessageAsyncReceiver<MotionFrameEvent> motionFrameReceiver, org.jflux.api.core.Listener<MotionFrameEvent> moveHandler)
robot - Robot to hostsourceId - arbitrary String identifying this hostdestinationId - arbitrary String identifying a clientsender - MessageSender to send RobotResponsesreceiver - MessageReceiver to receive RobotRequests from a clientfactory - factory for creating new RobotResponse MessagesmotionFrameReceiver - MessageReceiver to receive MotionFrameEventsmoveHandler - Listener to handle MotionFrameEvents from clientspublic void setRobot(Robot robot)
robot - Robot to hostpublic void setResponseSender(org.jflux.api.messaging.rk.MessageSender<RobotResponse> sender)
sender - MEssageSender to usepublic org.jflux.api.messaging.rk.MessageSender<RobotResponse> getResponseSender()
public void setRequestReceiver(org.jflux.api.messaging.rk.MessageAsyncReceiver<RobotRequest> receiver)
receiver - MessageReceiver to usepublic void setResponseFactory(RobotResponseFactory factory)
factory - factory to use for creating new RobotResponse Messagespublic void setMotionFrameReceiver(org.jflux.api.messaging.rk.MessageAsyncReceiver<MotionFrameEvent> receiver)
receiver - MessageReceiver to usepublic void setMoveHandler(org.jflux.api.core.Listener<MotionFrameEvent> moveHandler)
moveHandler - Listener to handle MotionFrames from clientspublic Robot.Id getRobotId()
public String getSourceId()
public String getDestinationId()
public Robot getRobot()
protected void handleDefinitionRequest(RobotRequest req)
req - RobotRequest the host is responding toprotected void handleConnectRequest(RobotRequest req)
connect() on the hosted Robot. The return value from
that call is returned in a RobotStatusResponse.req - RobotRequest the host is responding toprotected void handleDisconnectRequest(RobotRequest req)
disconnect() on the hosted Robot. The return value
from that call is returned in a RobotStatusResponse.req - RobotRequest the host is responding toprotected void handleConnectionStatusRequest(RobotRequest req)
req - RobotRequest the host is responding toprotected void handleEnableRequest(RobotRequest req)
setEnabled(true) on the hosted Robot. Sends a
successful RobotStatusResponse.req - RobotRequest the host is responding toprotected void handleDisableRequest(RobotRequest req)
setEnabled(false) on the hosted Robot. Sends a
successful RobotStatusResponse.req - RobotRequest the host is responding toprotected void handleEnabledStatusRequest(RobotRequest req)
req - RobotRequest the host is responding toprotected void handleEnableRequestForJoint(RobotRequest req)
setEnabled(true) on the hosted Robot's Joint. Sends a
successful RobotStatusResponse.req - RobotRequest the host is responding toprotected void handleDisableRequestForJoint(RobotRequest req)
setEnabled(true) on the hosted Robot's Joint. Sends a
successful RobotStatusResponse.req - RobotRequest the host is responding toprotected void handleEnabledStatusRequestForJoint(RobotRequest req)
req - RobotRequest the host is responding toprotected Joint getRequestedJoint(RobotRequest req)
req - RobotRequest specifying a Jointprotected void handleDefaultPositionRequest(RobotRequest req)
req - RobotRequest the host is responding toprotected void handleGoalPositionRequest(RobotRequest req)
req - RobotRequest the host is responding toprotected void handleCurrentPositionRequest(RobotRequest req)
req - RobotRequest the host is responding toCopyright © 2011-2014. All Rights Reserved.