public void run() { UpnpService upnpService = new UpnpServiceImpl(); // Add a listener for device registration events upnpService.getRegistry().addListener(createRegistryListener(upnpService)); // Broadcast a search message for all devices upnpService.getControlPoint().search(new STAllHeader()); }
void executeAction(UpnpService upnpService, Service wanip) { ActionInvocation addPortMappingInvocation = new AddPortMappingActionInvocation(wanip); // Executes asynchronous in the background upnpService .getControlPoint() .execute( new ActionCallback(addPortMappingInvocation) { public void success(ActionInvocation actionInvocation) { assert actionInvocation.getOutput().getValues().length == 0; System.out.println("Successfully called action!"); } public void failure(ActionInvocation actionInvocation, UpnpResponse operation) { System.out.println("Failed action"); System.err.println(createDefaultFailureMessage(actionInvocation, operation)); } }); }