WoT Runtime, Scripting, Bindings Zoltan Kis, Intel W3C Web of - - PowerPoint PPT Presentation

wot runtime scripting bindings
SMART_READER_LITE
LIVE PREVIEW

WoT Runtime, Scripting, Bindings Zoltan Kis, Intel W3C Web of - - PowerPoint PPT Presentation

WoT Runtime, Scripting, Bindings Zoltan Kis, Intel W3C Web of Things WG meeting in Osaka, Japan 17 May 2017 WoT Stack WoT Runtime Execution context 1 Execution context n TDs Script Script Process view Things Things 1..n 1..m WoT


slide-1
SLIDE 1

WoT Runtime, Scripting, Bindings

Zoltan Kis, Intel W3C Web of Things WG meeting in Osaka, Japan 17 May 2017

slide-2
SLIDE 2

Things Things TDs Scripting API (client, server, discovery) WoT Runtime

Manager Thing

System APIs plugin iface Protocol Binding 1..x plugin iface Legacy/HW API 1..y plugin iface System API 1..z plugin iface Service Proxy 1..s

System Things

Local Sensors HW access Secure Storage File System TDs, scripts Protocol Service 1 (OCF) Protocol Service 2 (BLE)

OS/HW

Process view

  • WoT RT: process
  • Script execution contexts
  • Bindings: separate processes
  • System APIs / OS Kernel

Special Things

  • Script Manager Thing
  • System Access Things

○ expose API objects ○ have TDs ⇒ discoverable (introspection) System APIs

  • Protocol stack/services

(CoAP, HTTP, BLE, OCF, ...)

  • file system
  • secure storage
  • local sensors
  • Local HW API

WoT Stack

Execution context 1 Execution context n Script 1..n Script 1..m Runtime Core (process)

slide-3
SLIDE 3

Things Things TDs Scripting API (client, server, discovery) WoT Runtime

Manager Thing

System APIs plugin iface Protocol Binding 1..x plugin iface Legacy/HW API 1..y plugin iface System API 1..z plugin iface Service Proxy 1..s

System Things

Local Sensors HW access Secure Storage File System TDs, scripts Protocol Service 1 (OCF) Protocol Service 2 (BLE)

OS/HW

WoT Runtime

Execution context 1 Execution context n Script 1..n Script 1..m Runtime Core (process) Script Execution Context (SEC)

  • Single event/main loop
  • May run multiple scripts
  • Serialized execution
  • Hosts multiple Thing instances

SEC Definitions

  • For ECMAScript (in browsers):
  • Multiple SEC
  • One SEC exec’d at a time
  • For WoT: more like in Node.js
  • SEC may be sandboxed

Runtime Core

  • Process hosting all structures
  • API objects (client, server…)
  • System API objects
  • Bindings plugin host
  • special Things
  • May spawn new SECs
  • Security enforcement point

(trusted)

slide-4
SLIDE 4

Scripts use the Scripting API to interact with

  • local and remote Things
  • special Things:

○ System APIs, via System Things + bindings) ○ Script Manager Thing (save, delete, run, stop, make persistent…) Scripts can get to the device by:

  • Manager Thing
  • Provisioned (e.g. flashed)
  • By consuming a TD

TDs may contain scripts for

  • Event handlers
  • Action handlers

WoT Scripting

Script 1 Script n Things Things TDs Scripting API WoT Runtime Runtime Core Manager Thing System Things System API plugin iface Protocol Binding 1..x plugin iface Legacy/HW API 1..y plugin iface System API 1..z plugin iface Service Proxy 1..s

slide-5
SLIDE 5

network→ system/socket→ binding→ runtime→ → manager/action → run script → API→ runtime → [fetch TD: system APIs→ → bindings→ socket→ → runtime→ API→ TD] → → create Thing + bind to RT → manager/reply → bindings→ system/socket → network. Scripts produce runtime bound Thing instances [+ TDs], each having:

  • Properties + getters/setters
  • Event handlers
  • Action handlers
  • Mappings to Bindings

Request to run script

Script 1 Script n Things Things TDs Scripting API WoT Runtime Runtime Core Manager Thing System Things System API plugin iface Protocol Binding 1..x plugin iface Legacy/HW API 1..y plugin iface System API 1..z plugin iface Service Proxy 1..s

slide-6
SLIDE 6

network→ socket→ OS → binding→ runtime→ Thing (process, reply) → API → binding→ OS → socket→ network Thing instances use the Scripting API implementation through event and action handler functions registered with the Runtime Core. The Runtime Core maps handlers to Protocol/System/Legacy/Service Bindings.

Request to access a Thing

Things Things Scripting API WoT Runtime Runtime Core System Things System API plugin iface Protocol Binding 1..x plugin iface Legacy/HW API 1..y plugin iface System API 1..z plugin iface Service Proxy 1..s TDs