Skip to content

Commit

Permalink
feat!: use direct as default Discovery method
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Jun 12, 2022
1 parent 32431cc commit cc752d6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion example/coap_discovery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Future<void> main(List<String> args) async {
await for (final thingDescription in wot.discover(
ThingFilter(
url: Uri.parse('coap://plugfest.thingweb.io:5683/testthing'),
method: DiscoveryMethod.direct,
),
)) {
final consumedThing = await wot.consume(thingDescription);
Expand Down
3 changes: 1 addition & 2 deletions example/complex_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ Future<void> main() async {
'/Oracle/oracle-Festo_Shared.td.jsonld',
);

final thingDiscovery =
wot.discover(ThingFilter(url: thingUri, method: DiscoveryMethod.direct));
final thingDiscovery = wot.discover(ThingFilter(url: thingUri));

await for (final thingDescription in thingDiscovery) {
final consumedDiscoveredThing = await wot.consume(thingDescription);
Expand Down
3 changes: 1 addition & 2 deletions example/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ Future<void> main(List<String> args) async {
'/Oracle/oracle-Festo_Shared.td.jsonld',
);

final thingDiscovery =
wot.discover(ThingFilter(url: thingUri, method: DiscoveryMethod.direct));
final thingDiscovery = wot.discover(ThingFilter(url: thingUri));

await for (final thingDescription in thingDiscovery) {
final consumedDiscoveredThing = await wot.consume(thingDescription);
Expand Down
7 changes: 6 additions & 1 deletion lib/src/scripting_api/discovery/thing_filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ import 'discovery_method.dart';
///
/// See [WoT Scripting API Specification, Section 10.3][spec link].
///
/// Note that the default method here is set to [DiscoveryMethod.direct] instead
/// of [DiscoveryMethod.directory], contrary to the Scripting API specification.
/// This might change in future versions, depending on how his part of the
/// specification is going to evolve.
///
/// [spec link]: https://w3c.github.io/wot-scripting-api/#the-thingfilter-dictionary
class ThingFilter {
/// Constructor.
ThingFilter({
required this.url,
this.method = DiscoveryMethod.directory,
this.method = DiscoveryMethod.direct,
this.fragment,
});

Expand Down

0 comments on commit cc752d6

Please sign in to comment.