Exemplo n.º 1
0
  private void doSearch(final CoronataFullObserver observer) {
    observer.coronataStarted();

    final WiiUseApiManager wiiUseApiManager;

    try {
      wiiUseApiManager = new WiiUseApiManager();
      observer.libraryLoaded();

      observer.searchStarted();
      Wiimote[] wiimotesFound = wiiUseApiManager.getWiimotes(config.getWiiRemotesExpected());
      if (wiimotesFound.length > 0) observer.wiiRemoteIdentified();
      for (Wiimote w : wiimotesFound) {
        observer.wiiRemoteConnected(new WiiuseJWiiRemoteAdapter(w, config.getWiiRemoteListener()));
      }
      observer.searchFinished();

    } catch (WiiusejNativeLibraryLoadingException e) {
      observer.errorOccurred(exceptionFactory.errorLoadingNativeLibraries(e));
    }
  }
Exemplo n.º 2
0
  @Override
  public void run() {
    Runnable task =
        new Runnable() {
          @Override
          public void run() {
            doSearch(config.getCoronataObserver());
          }
        };

    if (config.isSynchronous()) task.run();
    else new Thread(task).start();
  }