Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ThingML@EclipeCon 2014

ThingML@EclipeCon 2014

Co-Development of Heterogeneous and Distributed Services with ThingML (see http://thingml.org)


Brice Morin

March 19, 2014

More Decks by Brice Morin

Other Decks in Technology


  1. http://heads-project.eu EclipseCon 2014 Co-Development of Heterogeneous and Distributed Services with

    ThingML Brice Morin, Franck Fleurey SINTEF ICT Oslo, Norway 1
  2. http://heads-project.eu EclipseCon 2014 HD-services Heterogeneous and Distributed services "characterize the

    class of services whose logic and value emerges from a set of communicating software components distributed on a heterogeneous computing continuum from clouds to mobile devices, sensors and/or smart‐objects." 2
  3. http://heads-project.eu EclipseCon 2014 Use case: A personal security system •

    Provided by TellU • Continuous monitoring of patrolling guards  Body sensors (heart‐rate, activity, etc)  Geo‐location  GSM‐WiFi connectivity • In case of aggression  Alert to a central and/or nearby guards  Act on devices in the building (alarms, lights, etc) • Centralized approach in the Cloud is not suitable  Loss of connectivity  No alert can be sent  Sensors generates a lot of data (up to 500Hz)  Sending raw data to the cloud, will drain the battery (radio chips are power‐ thirsty) 3
  4. http://heads-project.eu EclipseCon 2014 So, let's engineer a HD-service • Easy

      Some Java, Node.js, Go and/or Scala in the Cloud o Not to mention a plethora of frameworks to choose among and interoperate with  Some headless Java in gateways, or maybe C/C++?  Some Java/Android in smartphones, what about iOS?  Some JavaScript in the browsers  Some C in sensors, interacting with good‐old legacy APIs o Bare metal, or maybe with a lightweight OS?  Some scripts in a proprietary language to program sensors  Some VHDL in FPGAs  Some "glue" (a.k.a magic) to connect everything o "Just" need to bridge IP, ZigBee, Z‐Wave, Bluetooth/BLE, custom RF, NFC, RFID, etc (not to mention the tricky encoding of the packets across protocols and languages) • …or not!  I would never hire an engineer pretending to master all these technologies… He might be a genius… or most likely a crook!  How to test, deploy, operate and maintain this mess?! 4
  5. http://heads-project.eu EclipseCon 2014 ThingML (http://thingml.org) • (Internet of) Things Modeling

    Language • Open‐source, on GitHub • Abstract syntax based on EMF • Textual syntax based on EMFText • Standalone (JNLP) and Eclipse editor • Set of compilers in Scala, targeting (currently)  C/C++ for Linux, Arduino (2KB RAM!)  Scala (JVM‐based) for larger nodes • Provides (de)serialization: ThingML message byte[]  Common concepts between C, Java and most language  What transit through wires or over‐the‐air 5
  6. http://heads-project.eu EclipseCon 2014 ThingML integration • Based on Maven •

    Built with Jenkins • Tests to check consistency between compilers • Tycho to generate Eclipse plugins 6
  7. http://heads-project.eu EclipseCon 2014 ThingML methodology 1. Define the interfaces of

    your system 1. Messages and ports 2. What is platform‐specific/independent 2. Mock‐up your system (Fake it*) 3. Implement (Make it*), step by step 1. Using ThingML State Machines and action language for the platform‐independent logic 2. By wrapping existing APIs using the ThingML template language to link to platform‐specific APIs (calls and callbacks) 7 *using the Atlassian kick‐ass method
  8. http://heads-project.eu EclipseCon 2014 Example • ThingML samples • JArduino 

    Java API that wraps Arduino lib  Control your Arduino from PC, Android via serial, bluetooth  Generated from ThingML • ArduPi project on GitHub  Weather station (different versions) o on Arduino (in C) and Raspberry Pi (in C) o on Arduino (in C) and PC (in Java) o Possibly pushing data into a MongoDB (on the RaspberryPi)  Generated from ThingML 8
  9. http://heads-project.eu EclipseCon 2014 Some code  9 Component implementing several

    interfaces Definition of ports Behavior: ‐ State machine à la UM ‐ Functions ‐ Action language Extend platform‐independent timer To implement a C Timer, based on the existing system API
  10. http://heads-project.eu EclipseCon 2014 Conclusion and Future Work • ThingML, a

    modeling language for IoT/M2M  Rely on Eclipse technologies  Compile to C/C++ (down to 2KB RAM!), JVM, etc  Open‐source  Enables the co‐development of HD‐services • Future Work  Dynamic management of HD‐Services, by wrapping ThingML component into Kevoree  Provide higher‐level concepts in ThingML e.g. CEP  Target lighter JVMs (Java8 SE/ME instead of Scala)  To be done within the HEADS project 10
  11. http://heads-project.eu EclipseCon 2014 Questions/Feedback? Main ThingML developers: Franck.Fleurey@sintef.no, Brice.Morin@sintef.no 11

  12. http://heads-project.eu EclipseCon 2014 Evaluate This Session Sign‐in: www.eclipsecon.org Select session

    from schedule Evaluate: 1 2 3 Slides on SpeakerDeck: https://speakerdeck.com/bmorin