Skip to content

Commit 3b340c2

Browse files
committed
To #6, update Web IDL to conform to the use cases
Signed-off-by: Zoltan Kis <[email protected]>
1 parent 1e2d777 commit 3b340c2

File tree

1 file changed

+31
-17
lines changed

1 file changed

+31
-17
lines changed

index.html

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,13 @@
251251
<p>
252252
The following scripting use cases are covered in this specification:
253253
<ul>
254-
<li>Discover <a>Thing</a>s by filters defined on <a>Thing Description</a>s for client-side access</li>
255-
<li>Discover <a>Thing</a>s by semantic filters for client-side access</li>
256-
<li><a>Consume a TD</a> of a remote <a>Thing</a>.</li>
254+
<li>Discover <a>Thing</a>s by filters defined on <a>Thing Description</a>s</li>
255+
<li>Discover <a>Thing</a>s by semantic filters</li>
256+
<li><a>Fetch and consume a TD</a> of a remote <a>Thing</a>.</li>
257257
<li>On a consumed <a>Thing</a>,
258258
<ul>
259-
<li>Get a property value.</li>
260-
<li>Set a property value.</li>
259+
<li>Get the value of a property or set of properties.</li>
260+
<li>Set the value of a property or a set of properties.</li>
261261
<li>Invoke an action.</li>
262262
<li>
263263
Observe events.
@@ -277,7 +277,7 @@
277277
</li>
278278
<li>Retrieve a thing that is exposed by the local runtime</li>
279279
<li>Create and expose a local <a>Thing</a> based on a <a>Thing Description</a>.</li>
280-
<li>Programmatically create and expose a local <a>Thing</a>. This may include the following operations:
280+
<li>Programmatically create and expose a local <a>Thing</a>. This may include the following use cases:
281281
<ul>
282282
<li>Register the Thing.</li>
283283
<li>Unregister the Thing.</li>
@@ -289,10 +289,14 @@
289289
<li>Attach semantic information to an action</li>
290290
<li>Attach semantic information to a property</li>
291291
<li>Attach semantic information to an event</li>
292-
<li>Register a handler for external requests to retrieve the <a>Thing Description</a>.</li>
293-
<li>Register a handler for external requests to add a listener to an event.</li>
294-
<li>Handle an external request to remove an event listener.</li>
295-
<li>Handle an external request to run an action: take the parameters from the request, execute the defined action, and return the result.</li>
292+
<li>Register handlers for external requests:
293+
<ul>
294+
<li>to fetch the <a>Thing Description</a>;</li>
295+
<li>to run an action: take the parameters from the request, execute the defined action, and return the result;</li>
296+
<li>to add a listener to an event;</li>
297+
<li>to remove an event listener.</li>
298+
</ul>
299+
</li>
296300
<li>Emit an event, i.e. notify all listeners subscribed to that event.</li>
297301
</ul>
298302
</li>
@@ -420,20 +424,31 @@
420424
ExposedThing addAction(ThingAction action);
421425
ExposedThing addEvent(ThingEvent event);
422426

423-
ExposedThing onInvokeAction(DOMString actionName, ThingActionHandler callback);
424-
ExposedThing onUpdateProperty(DOMString propertyName, ThingPropertyChangeListener callback);
425-
426427
Promise&lt;void&gt; register();
427428
Promise&lt;void&gt; unregister();
428429

429430
Promise&lt;void&gt; start();
430431
Promise&lt;void&gt; stop();
431432

432433
Promise&lt;void&gt; emitEvent(DOMString eventName, any payload);
434+
435+
// define request handlers
436+
ExposedThing onPropertyRetrieve(PropertyRetrieveHandler handler);
437+
ExposedThing onPropertyUpdate(PropertyHandler handler);
438+
439+
ExposedThing onActionInvocation(ActionHandler handler);
440+
441+
ExposedThing onObserve(DOMString event, ObserveHandler handler);
442+
ExposedThing onUnobserve(DOMString event, UnobserveHandler handler);
433443
};
434444

435445
ExposedThing implements ConsumedThing;
436446

447+
callback PropertyRetrieveHandler = void (ThingProperty property, USVString url);
448+
callback PropertyUpdateHandler = void (ThingProperty property, USVString url);
449+
callback ActionHandler = void (ThingAction action, USVString url);
450+
callback ObserveHandler = void (DOMString eventName, USVString url);
451+
437452
dictionary SemanticType {
438453
DOMString name;
439454
DOMString context;
@@ -444,6 +459,9 @@
444459
object inputType;
445460
object outputType;
446461
SemanticType[] semanticTypes;
462+
Function action;
463+
sequence&lt;any&gt; parameters;
464+
any returnValue;
447465
};
448466

449467
dictionary ThingProperty {
@@ -458,10 +476,6 @@
458476
object payloadType;
459477
SemanticType[] semanticTypes;
460478
};
461-
462-
callback ThingActionHandler = void (ThingAction action);
463-
464-
callback ThingPropertyChangeListener = void(ThingProperty property);
465479
</pre>
466480
</section>
467481

0 commit comments

Comments
 (0)