Skip to content

Commit ce9056d

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. Add references to other WoT WG specifications.
Signed-off-by: Zoltan Kis <[email protected]>
1 parent c490ff4 commit ce9056d

File tree

2 files changed

+40
-18
lines changed

2 files changed

+40
-18
lines changed

index.html

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
<dt><dfn data-lt="Things">Thing</dfn></dt>
132132
<dd>A physical or virtual entity that represents physicality, such as a device, a group of devices, a room, or a software stack that exposes <a>WoT interface</a>s.</dd>
133133

134-
<dt><dfn data-lt="TD|TDs">Thing Description</dfn></dt>
134+
<dt><dfn data-lt="TD|TDs|Thing Descriptions">Thing Description</dfn></dt>
135135
<dd>An RDF document (currently serialized in <a>JSON-LD</a> by default) that contains semantic and functional descriptions of a Thing: semantic context, interaction resources (such as properties, actions and events), communication (protocol, data serialization, bindings), and security related data (e.g. keys, certificates, policies etc).</dd>
136136

137137
<dt><dfn>WoT Interface</dfn></dt>
@@ -249,15 +249,22 @@
249249
<section id="introduction"> <h2>Introduction</h2>
250250
<p>
251251
As described in the [WoT Current Practices](http://w3c.github.io/wot/current-practices/wot-practices.html#vision), the Web of Things is made of <a>Thing</a>s that can describe their capabilities in a machine-interpretable format, the <a>Thing Description</a> (TD). By <a>consuming a TD</a>, a <a>Thing</a> creates a runtime resource model that allows accessing the <a>Thing</a> by an application.
252+
253+
The overall WoT concepts are described in the [WoT Architecture](https://w3c.github.io/wot-architecture/) document.
252254
</p>
253255
</section>
254256

255257
<section class="informative"> <h3>Use Cases</h3>
256258
<p>
257259
The following scripting use cases are covered in this specification:
258260
<ul>
261+
<li>Discover all <a>Things</a> in the WoT network by sending a broadcast request.</li>
262+
<li>Discover <a>Things</a> running in the local <a>WoT Runtime</a>.</li>
263+
<li>Discover nearby <a>Things</a>, for instance by NFC or Bluetooth.</li>
264+
<li>Discover <a>Things</a> by sending a discovery request to a given registry.</li>
259265
<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>
266+
<li>Discover <a>Thing</a>s by semantic filters.</li>
267+
<li>Stop or suppress an ongoing discovery process.</li>
261268
<li>Fetch and <a>consume a TD</a> of a remote <a>Thing</a>.</li>
262269
<li>On a consumed <a>Thing</a>,
263270
<ul>
@@ -269,18 +276,18 @@
269276
<ul>
270277
<li>Add a listener to an event.</li>
271278
<li>Remove a listener from an event.</li>
279+
<li>Remove all listeners.</li>
272280
</ul>
273281
Default events are the following:
274282
<ul>
275283
<li>A property has changed.</li>
276284
<li>An action has been invoked.</li>
277-
<li>Other Things have added an event listener.</li>
278285
<li><a>Thing Description</a> has changed, i.e. properties, events or actions have been defined, removed, or the definition has changed.</li>
279286
</ul>
280287
</li>
281288
</ul>
282289
</li>
283-
<li>Retrieve a thing that is exposed by the local runtime</li>
290+
<li>Retrieve a thing.</li>
284291
<li>Create and expose a local <a>Thing</a> based on a <a>Thing Description</a>.</li>
285292
<li>Programmatically create and expose a local <a>Thing</a>. This may include the following use cases:
286293
<ul>
@@ -294,29 +301,40 @@
294301
<li>Emit an event, i.e. notify all listeners subscribed to that event.</li>
295302
<li>Register handlers for external requests:
296303
<ul>
297-
<li>to fetch the <a>Thing Description</a>;</li>
304+
<li>to retrieve a property value;</li>
305+
<li>to update a property value;</li>
298306
<li>to run an action: take the parameters from the request, execute the defined action, and return the result;</li>
299307
<li>to add a listener to an event;</li>
300308
<li>to remove an event listener.</li>
309+
<li>to fetch the <a>Thing Description</a>;</li>
301310
</ul>
302311
</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>.
308312
</ul>
309313
</li>
314+
<li>Register the Thing.</li>
315+
<li>Unregister the Thing.</li>
316+
<li>Start the exposed <a>Thing</a> in order to process external requests.</li>
317+
<li>Stop the exposed <a>Thing</a>.</li>
318+
</ul>
319+
</p>
320+
<p>
321+
The following use cases are being considered for next versions:
322+
<ul>
323+
<li>Add, remove and update the definition of a property on a Thing that runs in the same the WoT Runtime.</li>
324+
<li>Add, remove and update the definition of an action on a Thing that runs in the same the WoT Runtime.</li>
325+
<li>Add, remove and update the definition of an event on a Thing that runs in the same the WoT Runtime.</li>
310326
</ul>
311327
</p>
312328
</section>
313329

314330
<section> <h2>WoT Data Representation</h2>
315331
<p>
332+
WoT provides a unified representation for data exchange between <a>Things</a>, standardized in the [Wot Things Description](https://w3c.github.io/wot-thing-description/) specification.
333+
<a>Thing Descriptions</a> are represented as dictionary objects in this API.
316334
</p>
317335
</section>
318336

319-
<section> <h2>The WoT API</h2>
337+
<section> <h2>The WoT Scripting API</h2>
320338
<p>
321339
The API object represents an implementation of the <a>WoT Runtime</a> and provides functionality to obtain <a>Thing</a>s by discovery or creation.
322340
</p>
@@ -342,7 +360,7 @@
342360
};
343361

344362
// TBD: if extensible by applications
345-
enum DiscoveryType { "any", "local", "nearby", "directory", "broadcast" };
363+
enum DiscoveryType { "any", "local", "nearby", "directory", "broadcast", "other" };
346364

347365
dictionary ThingFilter: ThingInit {
348366
DiscoveryType type = "any";
@@ -382,8 +400,6 @@
382400
ExposedThing addEvent(ThingEventInit event);
383401
ExposedThing removeEvent(DOMString name);
384402

385-
ExposedThing addSemanticTranslator(SemanticTranslator handler);
386-
387403
Promise&lt;void&gt; register(optional USVString directory);
388404
Promise&lt;void&gt; unregister();
389405

@@ -393,8 +409,6 @@
393409
Promise&lt;void&gt; emitEvent(DOMString eventName, any payload);
394410

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

399413
ExposedThing onRetrieveProperty(PropertyRequestHandler handler);
400414
ExposedThing onUpdateProperty(PropertyRequestHandler handler);
@@ -409,11 +423,11 @@
409423
callback PropertyRequestHandler = void (PropertyRequest request);
410424
callback ActionRequestHandler = void (ActionRequest request);
411425
callback ObserveRequestHandler = void (ObserveRequest request);
412-
callback SemanticTranslator = any (DOMString propertyName, SemanticType type);
413426

414427
dictionary PropertyRequest {
415428
USVString from;
416429
ThingPropertyInit property;
430+
Dictionary options;
417431
};
418432

419433
dictionary ActionRequest {
@@ -430,7 +444,7 @@
430444

431445
enum ObserveType { "property", "action", "event", "td" };
432446

433-
dictionary SemanticType {
447+
dictionary SemanticType { // TBD what is the use case?
434448
DOMString name;
435449
DOMString context;
436450
};

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)