Web of things introduction

22
Web of Things Roger
  • Upload

    -
  • Category

    Software

  • view

    196
  • download

    2

Transcript of Web of things introduction

Page 1: Web of things introduction

Web of Things

Roger

Page 2: Web of things introduction

既生 IoT 何生 WoT❖ WoT 是 IoT 的 Application

Layer ,使用 Web 技術來打造 application 。

❖ 以 URL 來表示 IoT 裝置,為 IoT 加入 URL 的觀念,就是 Google 提出的 Physical Web 計畫。

❖ 在物聯網之後,各種異質網路之間的通訊與融合成為一種趨勢,從而增加現實世界事物與其網路相應事物之間的協同互動。

Page 3: Web of things introduction

WoT vs IoT

Page 4: Web of things introduction

Future

Page 5: Web of things introduction

WoT Architecture

Page 6: Web of things introduction

Layer 1 - Access❖ Based on REST and

Resource Oriented Architecture

❖ Extend with Pub/Sub

➢ MQTT,

➢ XMPP

➢ CoAP

Page 7: Web of things introduction

Layer 2 - Find❖ How do we enable users to find the

right service for their application?

❖ Enabling Smart Things to be indexed by search engines.

➢ microdata

➢ schema.org

➢ Swagger

➢ JSON-LD

Page 8: Web of things introduction

Layer 3 - Share

❖ How do we share smart things with friends?

❖ Social Access Controller (SAC) as proxy between clients and smart things.

Page 9: Web of things introduction

Layer 4 - Compose❖ How do we enable their easy

composition by non-specialists into new applications?

❖ Physical Mashups

❖ Tools

➢ IFTTT

➢ Node-RED

➢ WoT-a-Mashup

Page 10: Web of things introduction

Web Things integration patterns (1)❖直接連接

➢ 每個裝置都有專屬的 URL ,直接與裝置連結

Page 11: Web of things introduction

Web Things integration patterns (2)❖基於 Gateway 連接

➢ 當裝置無法提供 internet protocol 時,只能先透過其他協定例如 CoAP 與 Router 連結後,再把資料由 Router 回傳給 Client 端。

Page 12: Web of things introduction

Web Things integration patterns (3)❖基於雲端服務連接

➢ 與第 2 種類似,把 Router 替換成雲端服務,再透過雲端 server 與各個 WoT 連結。

Page 13: Web of things introduction

Web Things requirements - Must Should May❖A Web Thing must at least be an HTTP/1.1 server.

❖A Web Thing must have a root resource accessible via an HTTP URL.

❖A Web Thing must support GET, POST, PUT and DELETE HTTP verbs.

❖A Web Thing must implement HTTP status codes 200, 400, 500.➢ 2XX Success. 4XX Client Error. 5XX Server Error.

❖A Web Thing must support JSON as default representation.➢ include error message

❖A Web Thing must support GET on its root URL.

EXAMPLE : Valid root URLs

http://gateway.api.com/devices/TVhttp://kitchen-raspberry.device-lab.co.ukhttps://192.168.10.10:9002https://kitchen:3000/fridge/root

Page 14: Web of things introduction

Web Things requirements - Must Should May

❖A Web Thing should use secure HTTP connections (HTTPS).

❖A Web Thing should implement the WebSocket Protocol.

❖A Web Thing should support the Web Things model.

❖A Web Thing should return a 204 for all write operations.

➢ By default, all PUT, POST, and DELETE requests to a Web Thing should return a 204 NO CONTENT response and no response body.

❖A Web Thing should provide a default human-readable documentation.

Page 15: Web of things introduction

Web Things requirements - Must Should May

❖A Web Thing may support the HTTP OPTIONS verb for each of its resources.

❖A Web Thing may provide additional representation mechanisms (RDF, XML, JSON-LD).

❖A Web Thing may offer a HTML-based user interface.

❖A Web Thing may provide precise information about the intended meaning of individual parts of the model.

Page 16: Web of things introduction

Web Thing Model❖The Web Thing follows the Web Things Requirements.

❖The Web Things model is a contract between clients and Things in the IoT.

URL Description

{wt} The root resource URL

{wt}/model/ The model of a Web Thing

{wt}/properties/ The list of properties

{wt}/properties/{id} A specific property

{wt}/actions/ The list of actions

{wt}/actions/{id} A specific action

{wt}/actions/{id}/{actionId} A specific execution of an action

{wt}/.../ ...

end-points exaples

Page 17: Web of things introduction

Web Thing Model - Common ConstructsEXAMPLE 2: Basic JSON payload

{ "id": "myCar", // required "name": "My great car", // A short human-readable name for the resource. "description": "This is such a great car.", // A human-readable description of the resource. "createdAt": "2012-08-24T17:29:11.683Z", // Timestamp when this resource was created "updatedAt": "2012-08-24T17:29:11.683Z", // Timestamp when this resource was last updated. "tags": [ // An array of tags. "cart", "device", "test" ], "customFields": { // A JSON object with key-value pairs to store custom information about this resource. "size": "20", "color": "blue" }, "links": { // A JSON object that lists the sub-resources that this resource links to. "model": { "link": "model/", "title": "Model this Web Thing." }, "properties": { "link": "properties/", "title": "Properties of this Web Thing." }, "actions": { "link": "actions/", "title": "Actions of this Web Thing." }, ... }}

Page 18: Web of things introduction

Example - Retrieve a Web ThingEXAMPLE 8: Get the Root Resource of a Web Thing--> REQUESTGET {wt} <-- RESPONSE200 OKLink: <model/>; rel="model"Link: <properties/>; rel="properties"Link: <actions/>; rel="actions"Link: <product/>; rel="product"Link: <type/>; rel="type"Link: <help/>; rel="help"Link: <ui/>; rel="ui"Link: <_myCustomLinkRelType/>; rel="_myCustomLinkRelType"

{ "id": "myCar", "name": "My super great car", "description": "This is such a great car.", "createdAd": "2012-08-24T17:29:11.683Z", "updatedAd": "2012-08-24T17:29:11.683Z", "tags":["cart", "device", "test"], "customFields":{ "size": "20", "color":"blue" }}

Page 19: Web of things introduction

Example - Update a Web ThingEXAMPLE 9: Update my super great car--> REQUESTPUT {wt} { "name":"My really super great car"}

<-- RESPONSE204 NO CONTENT

Page 20: Web of things introduction

Example - Retrieve a list of actionsEXAMPLE 15: List of actions--> REQUESTGET {wt}/actions

<-- RESPONSE200 OKLink: <http://webofthings.org/actions/upgradefirmware>; rel="type"

[ { "id":"upgradeFirmware", "name":"Upgrade Device Firmware" }, { "id":"reboot", "name":"Reboot" }]

Page 21: Web of things introduction

Example - Execute an actionEXAMPLE 17: Schedule a reboot--> REQUESTPOST {wt}/actions/reboot

{ "delay":50, "mode":"debug"}

<-- RESPONSE204 NO RESPONSELocation: {wt}/actions/reboot/233

Page 22: Web of things introduction

Q & [email protected]