Exemplo n.º 1
0
  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());
  }
Exemplo n.º 2
0
  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));
              }
            });
  }