|
131 | 131 | <dt><dfn data-lt="Things">Thing</dfn></dt>
|
132 | 132 | <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>
|
133 | 133 |
|
134 |
| - <dt><dfn data-lt="TD|TDs">Thing Description</dfn></dt> |
| 134 | + <dt><dfn data-lt="TD|TDs|Thing Descriptions">Thing Description</dfn></dt> |
135 | 135 | <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>
|
136 | 136 |
|
137 | 137 | <dt><dfn>WoT Interface</dfn></dt>
|
|
249 | 249 | <section id="introduction"> <h2>Introduction</h2>
|
250 | 250 | <p>
|
251 | 251 | 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. |
252 | 254 | </p>
|
253 | 255 | </section>
|
254 | 256 |
|
255 | 257 | <section class="informative"> <h3>Use Cases</h3>
|
256 | 258 | <p>
|
257 | 259 | The following scripting use cases are covered in this specification:
|
258 | 260 | <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> |
259 | 265 | <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> |
261 | 268 | <li>Fetch and <a>consume a TD</a> of a remote <a>Thing</a>.</li>
|
262 | 269 | <li>On a consumed <a>Thing</a>,
|
263 | 270 | <ul>
|
|
269 | 276 | <ul>
|
270 | 277 | <li>Add a listener to an event.</li>
|
271 | 278 | <li>Remove a listener from an event.</li>
|
| 279 | + <li>Remove all listeners.</li> |
272 | 280 | </ul>
|
273 | 281 | Default events are the following:
|
274 | 282 | <ul>
|
275 | 283 | <li>A property has changed.</li>
|
276 | 284 | <li>An action has been invoked.</li>
|
277 |
| - <li>Other Things have added an event listener.</li> |
278 | 285 | <li><a>Thing Description</a> has changed, i.e. properties, events or actions have been defined, removed, or the definition has changed.</li>
|
279 | 286 | </ul>
|
280 | 287 | </li>
|
281 | 288 | </ul>
|
282 | 289 | </li>
|
283 |
| - <li>Retrieve a thing that is exposed by the local runtime</li> |
| 290 | + <li>Retrieve a thing.</li> |
284 | 291 | <li>Create and expose a local <a>Thing</a> based on a <a>Thing Description</a>.</li>
|
285 | 292 | <li>Programmatically create and expose a local <a>Thing</a>. This may include the following use cases:
|
286 | 293 | <ul>
|
|
294 | 301 | <li>Emit an event, i.e. notify all listeners subscribed to that event.</li>
|
295 | 302 | <li>Register handlers for external requests:
|
296 | 303 | <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> |
298 | 306 | <li>to run an action: take the parameters from the request, execute the defined action, and return the result;</li>
|
299 | 307 | <li>to add a listener to an event;</li>
|
300 | 308 | <li>to remove an event listener.</li>
|
| 309 | + <li>to fetch the <a>Thing Description</a>;</li> |
301 | 310 | </ul>
|
302 | 311 | </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>. |
308 | 312 | </ul>
|
309 | 313 | </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> |
310 | 326 | </ul>
|
311 | 327 | </p>
|
312 | 328 | </section>
|
313 | 329 |
|
314 | 330 | <section> <h2>WoT Data Representation</h2>
|
315 | 331 | <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. |
316 | 334 | </p>
|
317 | 335 | </section>
|
318 | 336 |
|
319 |
| - <section> <h2>The WoT API</h2> |
| 337 | + <section> <h2>The WoT Scripting API</h2> |
320 | 338 | <p>
|
321 | 339 | 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.
|
322 | 340 | </p>
|
|
342 | 360 | };
|
343 | 361 |
|
344 | 362 | // TBD: if extensible by applications
|
345 |
| - enum DiscoveryType { "any", "local", "nearby", "directory", "broadcast" }; |
| 363 | + enum DiscoveryType { "any", "local", "nearby", "directory", "broadcast", "other" }; |
346 | 364 |
|
347 | 365 | dictionary ThingFilter: ThingInit {
|
348 | 366 | DiscoveryType type = "any";
|
|
382 | 400 | ExposedThing addEvent(ThingEventInit event);
|
383 | 401 | ExposedThing removeEvent(DOMString name);
|
384 | 402 |
|
385 |
| - ExposedThing addSemanticTranslator(SemanticTranslator handler); |
386 |
| - |
387 | 403 | Promise<void> register(optional USVString directory);
|
388 | 404 | Promise<void> unregister();
|
389 | 405 |
|
|
393 | 409 | Promise<void> emitEvent(DOMString eventName, any payload);
|
394 | 410 |
|
395 | 411 | // define request handlers (one per request type, so no events here)
|
396 |
| - // TBD: ExposedThing onAddProperty(PropertyRequestHandler handler); |
397 |
| - // TBD: ExposedThing onRemoveProperty(PropertyRequestHandler handler); |
398 | 412 |
|
399 | 413 | ExposedThing onRetrieveProperty(PropertyRequestHandler handler);
|
400 | 414 | ExposedThing onUpdateProperty(PropertyRequestHandler handler);
|
|
409 | 423 | callback PropertyRequestHandler = void (PropertyRequest request);
|
410 | 424 | callback ActionRequestHandler = void (ActionRequest request);
|
411 | 425 | callback ObserveRequestHandler = void (ObserveRequest request);
|
412 |
| - callback SemanticTranslator = any (DOMString propertyName, SemanticType type); |
413 | 426 |
|
414 | 427 | dictionary PropertyRequest {
|
415 | 428 | USVString from;
|
416 | 429 | ThingPropertyInit property;
|
| 430 | + Dictionary options; |
417 | 431 | };
|
418 | 432 |
|
419 | 433 | dictionary ActionRequest {
|
|
430 | 444 |
|
431 | 445 | enum ObserveType { "property", "action", "event", "td" };
|
432 | 446 |
|
433 |
| - dictionary SemanticType { |
| 447 | + dictionary SemanticType { // TBD what is the use case? |
434 | 448 | DOMString name;
|
435 | 449 | DOMString context;
|
436 | 450 | };
|
|
0 commit comments