Klasse ActionCallback

java.lang.Object
org.jupnp.controlpoint.ActionCallback
Alle implementierten Schnittstellen:
Runnable
Bekannte direkte Unterklassen:
ActionCallback.Default

public abstract class ActionCallback extends Object implements Runnable
Execute actions on any service.

Usage example for asynchronous execution in a background thread:

 Service service = device.findService(new UDAServiceId("SwitchPower"));
 Action getStatusAction = service.getAction("GetStatus");
 ActionInvocation getStatusInvocation = new ActionInvocation(getStatusAction);

 ActionCallback getStatusCallback = new ActionCallback(getStatusInvocation) {

      public void success(ActionInvocation invocation) {
          ActionArgumentValue status  = invocation.getOutput("ResultStatus");
          assertEquals((Boolean) status.getValue(), Boolean.valueOf(false));
      }

      public void failure(ActionInvocation invocation, UpnpResponse res) {
          System.err.println(
              createDefaultFailureMessage(invocation, res)
          );
      }
 };

 upnpService.getControlPoint().execute(getStatusCallback)
 

You can also execute the action synchronously in the same thread using the ActionCallback.Default implementation:

 myActionInvocation.setInput("foo", bar);
 new ActionCallback.Default(myActionInvocation, upnpService.getControlPoint()).run();
 myActionInvocation.getOutput("baz");
 
Autor:
Christian Bauer