Skip to content

Commit

Permalink
feat: use reworked discovery API in example
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Feb 10, 2022
1 parent 70a4377 commit bfd81e7
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions example/dart_wot_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,18 @@ Future<void> main() async {

await consumedThing.readProperty("test");

Future<void> handleThingInteraction(ThingDescription thingDescription) async {
final consumedThing = await wot.consume(thingDescription);
print("The title of the fetched TD is ${consumedThing.title}.");
print("Done!");
final thingDiscovery = wot.discover(ThingFilter(
"https://raw.githubusercontent.com/w3c/wot-testing"
"/b07fa6124bca7796e6ca752a3640fac264d3bcbc/events/2021.03.Online/TDs"
"/Oracle/oracle-Festo_Shared.td.jsonld",
DiscoveryMethod.direct));

exit(0);
}
final discoveredThingDescription = await thingDiscovery.next();
thingDiscovery.stop();
final consumedDiscoveredThing = await wot.consume(discoveredThingDescription);

print("The title of the fetched TD is ${consumedDiscoveredThing.title}.");
print("Done!");

wot.discover(
handleThingInteraction,
ThingFilter(
"https://raw.githubusercontent.com/w3c/wot-testing"
"/b07fa6124bca7796e6ca752a3640fac264d3bcbc/events/2021.03.Online/TDs"
"/Oracle/oracle-Festo_Shared.td.jsonld",
DiscoveryMethod.direct));
exit(0);
}

0 comments on commit bfd81e7

Please sign in to comment.