-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#13: Rework UPnPDiscoverer to implement HueBridgeDiscoverer
- Loading branch information
1 parent
c42d2f1
commit 54f7575
Showing
2 changed files
with
66 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions
16
src/test/java/io/github/zeroone3010/yahueapi/discovery/UPnPDiscovererTestRun.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
package io.github.zeroone3010.yahueapi.discovery; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
import io.github.zeroone3010.yahueapi.HueBridge; | ||
|
||
import java.util.List; | ||
import java.util.concurrent.CompletableFuture; | ||
import java.util.concurrent.ExecutionException; | ||
|
||
class UPnPDiscovererTestRun { | ||
/** | ||
* Runs the UPnPDiscoverer and prints the discovered bridges. | ||
* | ||
* @param args Not used. | ||
*/ | ||
public static void main(final String... args) throws InterruptedException { | ||
public static void main(final String... args) throws InterruptedException, ExecutionException { | ||
final UPnPDiscoverer discoverer = new UPnPDiscoverer(bridge -> System.out.println("Found a bridge: " + bridge)); | ||
final Thread discovererThread = new Thread(discoverer); | ||
System.out.println("Starting discoverer"); | ||
discovererThread.start(); | ||
CompletableFuture<List<HueBridge>> bridges = discoverer.discoverBridges(); | ||
System.out.println("Discoverer started"); | ||
TimeUnit.SECONDS.sleep(5L); | ||
System.out.println("Stopping discoverer"); | ||
discoverer.stop(); | ||
System.out.println("Result: " + discoverer.getIps()); | ||
System.out.println("Result: " + bridges.get()); | ||
System.out.println("Done."); | ||
} | ||
} |