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 RT: process ● Script execution contexts ● Bindings: separate processes Scripting API (client, server, discovery) ● System APIs / OS Kernel Manager System Runtime Core (process) Special Things Thing Things ● Script Manager Thing ● System Access Things ○ expose API objects plugin iface plugin iface plugin iface plugin iface ○ have TDs ⇒ discoverable System Service Protocol Legacy/HW (introspection) API 1..z Proxy 1..s Binding 1..x API 1..y System APIs System APIs ● Protocol stack/services (CoAP, HTTP, BLE, OCF, ...) ● file system Protocol Protocol Local HW Secure File System Service Service ● secure storage Sensors access Storage TDs, scripts 1 ( OCF ) 2 ( BLE ) ● local sensors ● Local HW API OS/HW
WoT Runtime WoT Runtime Execution context 1 Execution context n TDs Script Script Script Execution Context (SEC) Things Things 1..n 1..m - Single event/main loop - May run multiple scripts - Serialized execution Scripting API (client, server, discovery) - Hosts multiple Thing instances Manager System Runtime Core (process) SEC Definitions Thing Things - For ECMAScript (in browsers): - Multiple SEC - One SEC exec’d at a time plugin iface plugin iface plugin iface plugin iface - For WoT: more like in Node.js System Service Protocol Legacy/HW - SEC may be sandboxed API 1..z Proxy 1..s Binding 1..x API 1..y Runtime Core System APIs - Process hosting all structures - API objects (client, server…) Protocol Protocol - System API objects Local HW Secure File System Service Service - Bindings plugin host Sensors access Storage TDs, scripts 1 ( OCF ) 2 ( BLE ) - special Things - May spawn new SECs OS/HW - Security enforcement point (trusted)
WoT Scripting WoT Runtime Script 1 Things Things Scripts use the Scripting API to TDs interact with ● local and remote Things Script n ● special Things: ○ System APIs, via System Things + bindings) ○ Script Manager Thing (save, delete, run, stop, make persistent…) Scripting API Manager System Scripts can get to the device by: Runtime Core Thing Things ● Manager Thing ● Provisioned (e.g. flashed) ● By consuming a TD plugin iface plugin iface plugin iface plugin iface TDs may contain scripts for System Service Protocol Legacy/HW ● Event handlers API 1..z Proxy 1..s Binding 1..x API 1..y ● Action handlers System API
WoT Runtime Request to run Script 1 Things Things script TDs network→ system/socket→ Script n binding→ runtime→ → manager/action → run script → API→ runtime → [ fetch TD: system APIs→ → bindings→ socket→ → runtime→ API→ TD] → Scripting API → create Thing + bind to RT Manager System → manager/reply Runtime Core Thing Things → bindings→ system/socket → network. Scripts produce runtime bound Thing plugin iface plugin iface plugin iface plugin iface instances [+ TDs], each having: - Properties + getters/setters System Service Protocol Legacy/HW - Event handlers API 1..z Proxy 1..s Binding 1..x API 1..y - Action handlers - Mappings to Bindings System API
Request to access WoT Runtime Things Things a Thing network→ socket→ OS → binding→ TDs runtime→ Thing (process, reply) → API → binding→ OS → socket→ network Thing instances use the Scripting API Scripting API implementation through event and action handler functions registered with the System Runtime Core. Runtime Core Things The Runtime Core maps handlers to Protocol/System/Legacy/Service Bindings. plugin iface plugin iface plugin iface plugin iface System Service Protocol Legacy/HW API 1..z Proxy 1..s Binding 1..x API 1..y System API
Recommend
More recommend