kaos.brahms.blik.example
Class BLIKObserverCmd

java.lang.Object
  extended by kaos.brahms.blik.example.BLIKObserverCmd
All Implemented Interfaces:
FeedbackReceiver, KAoSObserver

public class BLIKObserverCmd
extends java.lang.Object
implements FeedbackReceiver, KAoSObserver

This class implements FeedbackReceiver and KAoSObserver. It also shows how to search for robots in the KAoS Directory Service, and then send to the robots various commands (actions) via BLIK and receive feedback about the execution of the sent commands. It registers to/deregister from the found robots as KAoSObserver for the Movement event.


Field Summary
protected  BLIK _blik
           
 
Constructor Summary
BLIKObserverCmd(BLIK blik, java.lang.String myName, java.lang.String id)
           
 
Method Summary
 java.lang.String getID()
          Return the unique identifier of this observer.
static void main(java.lang.String[] args)
           
 void onAborted(java.util.Calendar time, java.lang.Object reason, java.lang.String actionID, java.lang.String robotID)
          This method is invoked when the requested action is aborted.
 void onAccepted(java.util.Calendar time, java.lang.Object acceptInfo, java.lang.String actionID, java.lang.String robotID)
          This method is invoked when the requested action is accepted by the robot.
 void onCompleted(java.util.Calendar time, java.lang.Object result, java.lang.String actionID, java.lang.String robotID)
          This method is invoked upon completion of the requested command by the robot.
 void onRefused(java.util.Calendar time, java.lang.Object reason, java.lang.String actionID, java.lang.String robotID)
          This method is invoked when the requested action is refused by the robot.
 void onStarted(java.util.Calendar time, java.lang.Object startedInfo, java.lang.String actionID, java.lang.String robotID)
          This method is invoked when the robot starts the requested action/command.
 void receiveKAoSStatus(java.lang.String statusMsg, java.lang.String actionID, java.lang.String robotID)
          Receive a status message describing the execution of the requested action.
 void test()
           
 void testDeregister(java.lang.String robotGUID, java.lang.String updateType)
           
 void testRegister(java.lang.String robotGUID, java.lang.String updateType)
           
 void update(java.lang.String observableID, java.lang.String updateType, java.lang.Object updateCondition, java.lang.Object update)
          Receive an update from the KAoSObservable when the KAoSObservable has a change or event to report.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_blik

protected BLIK _blik
Constructor Detail

BLIKObserverCmd

public BLIKObserverCmd(BLIK blik,
                       java.lang.String myName,
                       java.lang.String id)
                throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

onAccepted

public void onAccepted(java.util.Calendar time,
                       java.lang.Object acceptInfo,
                       java.lang.String actionID,
                       java.lang.String robotID)
This method is invoked when the requested action is accepted by the robot.

Specified by:
onAccepted in interface FeedbackReceiver
Parameters:
time - Calendar time of acceptance.
acceptInfo - Object containing additional (optional) info about the acceptance.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

onRefused

public void onRefused(java.util.Calendar time,
                      java.lang.Object reason,
                      java.lang.String actionID,
                      java.lang.String robotID)
This method is invoked when the requested action is refused by the robot.

Specified by:
onRefused in interface FeedbackReceiver
Parameters:
time - Calendar time of refusal.
reason - Object containing the reason for refusing the request.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

onCompleted

public void onCompleted(java.util.Calendar time,
                        java.lang.Object result,
                        java.lang.String actionID,
                        java.lang.String robotID)
This method is invoked upon completion of the requested command by the robot.

Specified by:
onCompleted in interface FeedbackReceiver
Parameters:
time - Calendar time of information/action completion.
result - Object containing the result of the requested action.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

onStarted

public void onStarted(java.util.Calendar time,
                      java.lang.Object startedInfo,
                      java.lang.String actionID,
                      java.lang.String robotID)
This method is invoked when the robot starts the requested action/command.

Specified by:
onStarted in interface FeedbackReceiver
Parameters:
time - Calendar time of starting an action.
startedInfo - Object containing additional (optional) info about the start of the action.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

onAborted

public void onAborted(java.util.Calendar time,
                      java.lang.Object reason,
                      java.lang.String actionID,
                      java.lang.String robotID)
This method is invoked when the requested action is aborted.

Specified by:
onAborted in interface FeedbackReceiver
Parameters:
time - Calendar time of aborting an action.
reason - Object containing the reason for aborting an action.
actionID - String containing the id of the requested action.
robotID - String containing the name of the robot performing the action.

receiveKAoSStatus

public void receiveKAoSStatus(java.lang.String statusMsg,
                              java.lang.String actionID,
                              java.lang.String robotID)
Receive a status message describing the execution of the requested action. There maybe several status messages sent during action execution.

Specified by:
receiveKAoSStatus in interface FeedbackReceiver
Parameters:
statusMsg - Object containing the result of the requested action/information.
actionID - String containing the id of the requested action/information.
robotID - String containing the name of the robot performing the action.

update

public void update(java.lang.String observableID,
                   java.lang.String updateType,
                   java.lang.Object updateCondition,
                   java.lang.Object update)
Receive an update from the KAoSObservable when the KAoSObservable has a change or event to report.

Specified by:
update in interface KAoSObserver
Parameters:
observableID - String identifying the KAoSObservable sending the update.
updateType - String indicating type of update.
updateCondition - String containing the condition for the update.
update - Object containing the update.

getID

public java.lang.String getID()
Return the unique identifier of this observer.

Specified by:
getID in interface KAoSObserver
Returns:
String containing the unique ID of this observer.

test

public void test()

testRegister

public void testRegister(java.lang.String robotGUID,
                         java.lang.String updateType)

testDeregister

public void testDeregister(java.lang.String robotGUID,
                           java.lang.String updateType)

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception