actinium: a restful runtime container for scriptable internet of things applications · 2018. 11....

19
Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch, Martin Lanter, and Simon Duquennoy [email protected] Friday, 26 Oct 2012 Internet of Things 2012, Wuxi, China

Upload: others

Post on 04-Feb-2021

6 views

Category:

Documents


0 download

TRANSCRIPT

  • Actinium: A RESTful Runtime Container for

    Scriptable Internet of Things Applications

    Matthias Kovatsch, Martin Lanter, and Simon Duquennoy [email protected]

    Friday, 26 Oct 2012 Internet of Things 2012, Wuxi, China

    mailto:[email protected]

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    Wireless Sensor Networks for the IoT

    2

    Environmental Monitoring

    Smart Energy

    Structural Health

    Context-Awareness

    Ambient Assisted Living

    Real-time City

    Information

    Logistics

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    Problem: Application Development

    3

    Class 1 devices ~100kB ROM

    ~10kB RAM

    Embedded OS

    programming? Experts!

    Macro-

    programming? Islands!

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    Web of Things for Class 1 Devices

    4

    6LoWPAN

    End-to-end RESTful interaction

    Web scripting

    /actuators/leds

    /debug/channel

    /debug/neighbors

    /debug/observers

    /debug/routes

    /sensors/battery

    /sensors/button

    /sensors/humidity

    /sensors/light

    /sensors/temperature

    Web server / REST API

    CoAP

    I-D: draft-ietf-core-coap-12

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    Example: Smart Home

    5

    if ( occupied ) { heatRoom( COMFORT_TEMP ); }

    Heating Script

    http://weather.com

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    Actinium RESTful Runtime Container

    6

    Script POST

    2.01 Created

    Config

    POST

    2.01 Created

    /instance/my-instance PUT

    2.04 Changed Sandbox /running/my-instance REST API

    /installed/my-app

    /install

    DELETE

    2.02 Deleted

    Server-side

    JavaScript

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    Actinium Apps Are REST Resources

    7

    // handler for GET requests to "/" app.root.onget = function(request) { // returns CoAP's "2.05 Content" with payload request.respond(2.05, "Hello world"); }; // sub-resource "/config" var sub = new AppResource("config"); sub.onput = function(request) { variable = request.payloadText; request.respond(2.04); // "2.04 Changed" }; app.root.add(sub);

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    Mashups

    8

    Ac App

    Ac App

    Ac App

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    Mashups with Classic Web Services

    9

    // Usual AJAX var xhr = new XMLHttpRequest(); // GET weather conditions from Web service xhr.open("GET", "http://api.wunderground.com/…", false); xhr.send(); // Parse the retrieved JSON data and mash it up var condition = JSON.parse(xhr.responseText);

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    Mashups with Devices and other Apps

    10

    var req = new CoapRequest(); // Request the temperature sensor reading via CoAP req.open("GET", "coap://mote1.example.com/sensors/temp", false /*synchronous*/); // Set Accept header to application/json req.setRequestHeader("Accept", "application/json"); req.send(); // blocking // Use IoT data just like Web data var roomTemperature = JSON.parse(req.responseText);

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    CoapRequest with CoAP-specific Features

    11

    req.open("GET", "coap://app-server.example.com/ running/occ-room1/occupancy”, true /*asynchronous*/); // Register for CoAP Observe push notifications req.setRequestHeader("Observe", "0"); // define the callback for push notifications req.onprogess = function() { switchLights(this.responseText=="true"); }; // define the callback for normal/final response req.onload = function() { handleNonObservable(this); }; req.send(); // non-blocking

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    Implementation: https://github.com/mkovatsc

    12

    Mozilla Rhino

    JavaScript Engine

    Actinium (Ac)

    App-server

    Californium

    CoAP framework

    + =

    https://github.com/mkovatsc

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    Ac Round-Trip Time Overhead

    1000 Requests Minimum Maximum Average Overhead

    Ping 32ms 77ms 46ms

    CoAP (Cf) 34ms 78ms 48ms +2ms

    Actinium 33ms 97ms 49ms +1ms

    13

    Subnet A Subnet B

    SLIP

    802.15.4CH 21

    Mote 1..10Border router

    App server Router

    LLN

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    Ac Performance: Quicksort (Memory-intensive)

    Act

    iniu

    m e

    xecu

    tio

    n t

    ime

    [m

    s]

    0

    200

    400

    600

    800

    1000

    1200

    1400

    Pe

    rfo

    rman

    ce f

    acto

    rs

    Array size

    1

    6

    11

    16

    21

    Java

    node.js

    Actinium

    0 1E+5 2E+5 3E+5 4E+5 5E+5

    14

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    Ac Performance: Newton (Arithmetic-intensive)

    15

    Pe

    rfo

    rma

    nce

    fa

    cto

    rs

    1

    6

    11

    16

    21

    Java

    node.js

    Actinium

    Act

    iniu

    m e

    xecu

    tio

    n t

    ime

    [m

    s]

    0

    200

    400

    600

    800

    1000

    1200

    1400

    0 1E+6 2E+6 3E+6 4E+6 5E+6

    Number of computations

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    Conclusion

    Applications for Class 1 devices can easily be scripted

    Web-like IoT application development

    Seamless Web integration

    Performance governed by low-power networking

    Scripting well-suited for application logic

    Native implementations for memory-intensive tasks

    Security considerations (in the paper)

    Get Actinium from GitHub https://github.com/mkovatsc

    16

    https://github.com/mkovatschttps://github.com/mkovatschttps://github.com/mkovatsc

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    THANK YOU

    Questions?

    17

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    Publicly Available Resources

    Open Source Software under 3-Clause BSD on GitHub:

    https://github.com/mkovatsc

    Maven repository:

    http://maven.thingml.org/

    Copper (Cu) Firefox add-on:

    https://addons.mozilla.org/en-US/firefox/addon/copper-270430/

    CoAP test server:

    http://vs0.inf.ethz.ch/ for detailed information

    18

    https://github.com/mkovatschttps://github.com/mkovatschttps://github.com/mkovatschttp://maven.thingml.org/http://maven.thingml.org/https://addons.mozilla.org/en-US/firefox/addon/copper-270430/https://addons.mozilla.org/en-US/firefox/addon/copper-270430/https://addons.mozilla.org/en-US/firefox/addon/copper-270430/https://addons.mozilla.org/en-US/firefox/addon/copper-270430/https://addons.mozilla.org/en-US/firefox/addon/copper-270430/https://addons.mozilla.org/en-US/firefox/addon/copper-270430/https://addons.mozilla.org/en-US/firefox/addon/copper-270430/http://vs0.inf.ethz.ch/

  • Actinium: A RESTful Runtime Container for Scriptable Internet of Things Applications Matthias Kovatsch

    The CoAP Universe

    IETF working group «Constrained RESTful Environments»

    Constrained Application Protocol (CoAP) RESTful Web services for mote-class devices

    Transparent mapping to HTTP

    Observing Resources in CoAP

    Group Communication for CoAP

    Blockwise Transfers in CoAP

    CoRE Link Format

    CoRE Resource Directory

    19