|
173 | 173 | <li>Invoke an <a>Action</a>.</li>
|
174 | 174 | <li>Observe <a>Events</a> emitted by the <a>Thing</a>.</li>
|
175 | 175 | <li>Observe changes to the <a>Thing Description</a> of the <a>Thing</a>.</li>
|
| 176 | + <li>Get the <a>Thing Description</a>.</li> |
| 177 | + <li>Get the list of linked resources based on the <a>Thing Description</a>.</li> |
176 | 178 | </ul>
|
177 | 179 | </li>
|
178 | 180 | </ul>
|
@@ -509,6 +511,7 @@ <h2>The <dfn>ConsumedThing</dfn> interface</h2>
|
509 | 511 | readonly attribute DOMString name;
|
510 | 512 | void setName(DOMString name);
|
511 | 513 | ThingDescription getThingDescription();
|
| 514 | + sequence<TDLink> getLinks(); |
512 | 515 | Promise<any> invokeAction(DOMString name, any parameters);
|
513 | 516 | Promise<void> writeProperty(DOMString name, any value);
|
514 | 517 | Promise<any> readProperty(DOMString name);
|
@@ -541,6 +544,41 @@ <h2>The <dfn>ConsumedThing</dfn> interface</h2>
|
541 | 544 | </p>
|
542 | 545 | </section>
|
543 | 546 |
|
| 547 | + <section> <h3>The <dfn>getLinks()</dfn> method</h3> |
| 548 | + <p> |
| 549 | + Returns the list of linked resources in <a>Thing Description</a> of the <a>Thing</a> in the form of a list of <a>TDLink</a> objects. |
| 550 | + </p> |
| 551 | + <section data-dfn-for="TDLink" > |
| 552 | + <h4>The <dfn>TDLink</dfn> dictionary</h4> |
| 553 | + <p> |
| 554 | + Contains a hyperlink reference, a relation type and a media type. |
| 555 | + </p> |
| 556 | + <pre class="idl"> |
| 557 | + dictionary TDLink { |
| 558 | + required USVString href; |
| 559 | + USVString mediaType; |
| 560 | + DOMString rel; |
| 561 | + }; |
| 562 | + </pre> |
| 563 | + <p>The <a>TDLink</a> dictionary contains the following properties: |
| 564 | + <ul> |
| 565 | + <li> |
| 566 | + The <dfn>href</dfn> attribute represents a <a>hyperlink reference</a>. |
| 567 | + </li> |
| 568 | + <li> |
| 569 | + The <dfn>rel</dfn> attribute represents a <a>relation type</a>. |
| 570 | + </li> |
| 571 | + <li> |
| 572 | + The <dfn>mediaType</dfn> attribute represents a <a>IANA media type</a>. |
| 573 | + </li> |
| 574 | + </ul> |
| 575 | + </p> |
| 576 | + </section> <!-- TDLink --> |
| 577 | + </section> |
| 578 | + |
| 579 | + |
| 580 | + |
| 581 | + |
544 | 582 | <section> <h3>The <dfn>invokeAction()</dfn> method</h3>
|
545 | 583 | <p>
|
546 | 584 | Takes the <a>Action</a> name from the <var>name</var> argument and the list of parameters, then requests from the underlying platform and the <a>Protocol Bindings</a> to invoke the <a>Action</a> on the remote <a>Thing</a> and return the result. Returns a <code><a>Promise</a></code> that resolves with the return value or rejects with an <a>Error</a>.
|
@@ -685,7 +723,7 @@ <h4>The <dfn>DataSchema</dfn> type</h4>
|
685 | 723 | The <a>DataSchema</a> type represents a data type <a href="https://w3c.github.io/wot-thing-description/#dataschema">specified</a> in the <a>Thing Description</a> in a serialized form.
|
686 | 724 | </p>
|
687 | 725 | <p class="ednote">
|
688 |
| - <a>DataSchema</a> is under development, currently it can denote any type supported by the <a>Thing Description</a> and the <a>WoT Runtime</a>, such as simple type like <code>"boolean"</code>, <code>"number"</code>, <code>"string"</code>, or <code>"array"</code>, or <code>"object"</code> that may specify value range etc. |
| 726 | + <a>DataSchema</a> is under development, currently it can denote any type supported by the <a>Thing Description</a> and the <a>WoT Runtime</a>. |
689 | 727 | </p>
|
690 | 728 | </section>
|
691 | 729 |
|
@@ -854,13 +892,13 @@ <h2>Examples</h2>
|
854 | 892 | thing.addProperty({
|
855 | 893 | name: "temperature",
|
856 | 894 | value: "0",
|
857 |
| - schema: "number", |
| 895 | + schema: '{ \"type\": \"number\" }', |
858 | 896 | writable: false
|
859 | 897 | // use default values for the rest
|
860 | 898 | });
|
861 | 899 | thing.addEvent({
|
862 | 900 | name: "onchange",
|
863 |
| - schema: "number" |
| 901 | + schema: '{ \"type\": \"number\" }' |
864 | 902 | });
|
865 | 903 | thing.addAction({
|
866 | 904 | name: "reset",
|
@@ -1125,6 +1163,9 @@ <h3>The <dfn data-dfn-for="">Observable</dfn> interface</h3>
|
1125 | 1163 | <dfn>IANA media type</dfn>s (formerly known as MIME types) are defined in
|
1126 | 1164 | <a href="http://tools.ietf.org/html/rfc2046">RFC2046</a>.
|
1127 | 1165 | </p>
|
| 1166 | + <p> |
| 1167 | + The terms <dfn>hyperlink reference</dfn> and <dfn>relation type</dfn> are defined in [[!HTML5]] and <a href="https://tools.ietf.org/html/rfc8288">RFC8288</a>. |
| 1168 | + </p> |
1128 | 1169 | </section>
|
1129 | 1170 |
|
1130 | 1171 | <section id="conformance">
|
|
0 commit comments