Skip to content

Commit c13f4ac

Browse files
committed
Add detailed discovery use cases. Add future use cases for TD changes in local runtimes. Remove semantic translators. Remove handlers for adding and removing property. Add options to property requests. Add discovery type for 'other' extensions.
Signed-off-by: Zoltan Kis <[email protected]>
1 parent c490ff4 commit c13f4ac

File tree

2 files changed

+34
-16
lines changed

2 files changed

+34
-16
lines changed

index.html

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,13 @@
256256
<p>
257257
The following scripting use cases are covered in this specification:
258258
<ul>
259+
<li>Discover all <a>Things</a> in the WoT network by sending a broadcast request.</li>
260+
<li>Discover <a>Things</a> running in the local <a>WoT Runtime</a>.</li>
261+
<li>Discover nearby <a>Things</a>, for instance by NFC or Bluetooth.</li>
262+
<li>Discover <a>Things</a> by sending a discovery request to a given registry.</li>
259263
<li>Discover <a>Thing</a>s by filters defined on <a>Thing Description</a>s</li>
260-
<li>Discover <a>Thing</a>s by semantic filters</li>
264+
<li>Discover <a>Thing</a>s by semantic filters.</li>
265+
<li>Stop or suppress an ongoing discovery process.</li>
261266
<li>Fetch and <a>consume a TD</a> of a remote <a>Thing</a>.</li>
262267
<li>On a consumed <a>Thing</a>,
263268
<ul>
@@ -269,18 +274,18 @@
269274
<ul>
270275
<li>Add a listener to an event.</li>
271276
<li>Remove a listener from an event.</li>
277+
<li>Remove all listeners.</li>
272278
</ul>
273279
Default events are the following:
274280
<ul>
275281
<li>A property has changed.</li>
276282
<li>An action has been invoked.</li>
277-
<li>Other Things have added an event listener.</li>
278283
<li><a>Thing Description</a> has changed, i.e. properties, events or actions have been defined, removed, or the definition has changed.</li>
279284
</ul>
280285
</li>
281286
</ul>
282287
</li>
283-
<li>Retrieve a thing that is exposed by the local runtime</li>
288+
<li>Retrieve a thing.</li>
284289
<li>Create and expose a local <a>Thing</a> based on a <a>Thing Description</a>.</li>
285290
<li>Programmatically create and expose a local <a>Thing</a>. This may include the following use cases:
286291
<ul>
@@ -294,19 +299,28 @@
294299
<li>Emit an event, i.e. notify all listeners subscribed to that event.</li>
295300
<li>Register handlers for external requests:
296301
<ul>
297-
<li>to fetch the <a>Thing Description</a>;</li>
302+
<li>to retrieve a property value;</li>
303+
<li>to update a property value;</li>
298304
<li>to run an action: take the parameters from the request, execute the defined action, and return the result;</li>
299305
<li>to add a listener to an event;</li>
300306
<li>to remove an event listener.</li>
307+
<li>to fetch the <a>Thing Description</a>;</li>
301308
</ul>
302309
</li>
303-
<li>Register handler for semantic translation of property values.</li>
304-
<li>Register the Thing.</li>
305-
<li>Unregister the Thing.</li>
306-
<li>Start the exposed <a>Thing</a> in order to process external requests.</li>
307-
<li>Stop the exposed <a>Thing</a>.
308310
</ul>
309311
</li>
312+
<li>Register the Thing.</li>
313+
<li>Unregister the Thing.</li>
314+
<li>Start the exposed <a>Thing</a> in order to process external requests.</li>
315+
<li>Stop the exposed <a>Thing</a>.</li>
316+
</ul>
317+
</p>
318+
<p>
319+
The following use cases are being considered for next versions:
320+
<ul>
321+
<li>Add, remove and update the definition of a property on a Thing that runs in the same the WoT Runtime.</li>
322+
<li>Add, remove and update the definition of an action on a Thing that runs in the same the WoT Runtime.</li>
323+
<li>Add, remove and update the definition of an event on a Thing that runs in the same the WoT Runtime.</li>
310324
</ul>
311325
</p>
312326
</section>
@@ -342,7 +356,7 @@
342356
};
343357

344358
// TBD: if extensible by applications
345-
enum DiscoveryType { "any", "local", "nearby", "directory", "broadcast" };
359+
enum DiscoveryType { "any", "local", "nearby", "directory", "broadcast", "other" };
346360

347361
dictionary ThingFilter: ThingInit {
348362
DiscoveryType type = "any";
@@ -382,8 +396,6 @@
382396
ExposedThing addEvent(ThingEventInit event);
383397
ExposedThing removeEvent(DOMString name);
384398

385-
ExposedThing addSemanticTranslator(SemanticTranslator handler);
386-
387399
Promise&lt;void&gt; register(optional USVString directory);
388400
Promise&lt;void&gt; unregister();
389401

@@ -393,8 +405,6 @@
393405
Promise&lt;void&gt; emitEvent(DOMString eventName, any payload);
394406

395407
// define request handlers (one per request type, so no events here)
396-
// TBD: ExposedThing onAddProperty(PropertyRequestHandler handler);
397-
// TBD: ExposedThing onRemoveProperty(PropertyRequestHandler handler);
398408

399409
ExposedThing onRetrieveProperty(PropertyRequestHandler handler);
400410
ExposedThing onUpdateProperty(PropertyRequestHandler handler);
@@ -409,11 +419,11 @@
409419
callback PropertyRequestHandler = void (PropertyRequest request);
410420
callback ActionRequestHandler = void (ActionRequest request);
411421
callback ObserveRequestHandler = void (ObserveRequest request);
412-
callback SemanticTranslator = any (DOMString propertyName, SemanticType type);
413422

414423
dictionary PropertyRequest {
415424
USVString from;
416425
ThingPropertyInit property;
426+
Dictionary options;
417427
};
418428

419429
dictionary ActionRequest {
@@ -430,7 +440,7 @@
430440

431441
enum ObserveType { "property", "action", "event", "td" };
432442

433-
dictionary SemanticType {
443+
dictionary SemanticType { // TBD what is the use case?
434444
DOMString name;
435445
DOMString context;
436446
};

rationale.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,11 @@ Based on [issue 16](https://github.com/w3c/wot-scripting-api/issues/16) there is
2828
Resolutions:
2929
- Use [Observables](https://github.com/tc39/proposal-observable) for controlling the discovery process (subscribe, unsubscribe).
3030
- Use a single filter definition that also contains a property for discovery type, defaulting to `"any"`. It is simpler and more intuitive to use than having a separate parameter for discovery type. Some of the discovery types, such as registry/directory based discovery also require another parameter for the address of the directory. This can be provided as a required property in the discovery filter, described in the discovery algorithm.
31+
32+
## Server API (`ExposedThing`)
33+
Scripts that define Exposed Things should ensure the following:
34+
1. define properties, actions and events according to the Thing Description.
35+
2. define request handler functions to implement the serving end for the Client API.
36+
37+
## Client API (`ConsumedThing`)
38+
Scripts that use the Client API are basically sending requests to servers in order to retrieve or update properties, invoke actions, and observe properties, actions and events. When the `ConsumedThing` is fetched, its Thing Description is also fetched, then client scripts can track changes by subscribing to events that signal TD changes.

0 commit comments

Comments
 (0)