Top Banner
LwM2M Workshop 2015 Julien Vermillard - Sierra Wireless
53

OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Jul 16, 2015

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

LwM2M Workshop 2015

Julien Vermillard - Sierra Wireless

Page 2: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Julien Vermillard / @vrmvrm

Software Engineer at Sierra Wirelesshttp://airvantage.net M2M Cloud

Apache foundation memberEclipse committer on Californium, WakaamaEclipse Leshan project lead

Page 3: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Eclipse Foundation & Eclipse IoTOpen Standards and Open Source for the Internet of Things

5-Nov-2014

Page 4: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Eclipse History

• Launched by IBM in 2001– Initial release of the Eclipse technology platform (Platform,

JDT,PDT)– Founding consortium board comprised Borland, IBM, Red

Hat, …

• Eclipse Foundation formed in 2004– Independent not-for-profit organization formed in 2004– Definition of bylaws, membership model, initial IP process

• Eclipse Foundation today, 2014– Members include IBM, Oracle, SAP, CA, Google, Bosch, etc.– 204 members, (10 strategic members), ~1000 committers– ~270 Open Source Projects

2Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0

Page 5: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Eclipse at a Glance

• Organization – 501(c)6 not-for-profit, USA (Delaware) incorporated,

headquarters in Ottawa, Canada– 18 employees

• License– Eclipse Public License is the default – Other licenses possible by approval of the Board

• Focus areas– Most project implementations are in Java, but starting to

move into web (JavaScript) and C/C++– “Eclipse plug-in model” – Development tools, modeling tools, runtimes, web

development, IoT, Cloud

3Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0

Page 6: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Eclipse: a sustainable ecosystem

“Eclipse is a vendor-neutral consortium of major software vendors, solution providers, corporations, educational and research institutions and individuals working together to create a sustainable eco-system that enhances,promotes and cultivates the Eclipse open platformwith complementary products, services and capabilities.”

4Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0

Page 7: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Governance

IP Mgt& Licensing

Projects & Process

Ecosystem Development

Infrastructure

What do you need for open collaboration?

5Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0

Page 8: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Governance

IP Mgt& Licensing

Projects & Process

Ecossytem Developmen

t

Infra-structure

Eclipse Working Groups

• Eclipse is the industry’s best model for vendor-neutral collaboration

• Eclipse Working Groups:– Licensing model for sharing co-developed innovation

– IP management to maximize commercialization opportunities

– Project model for coordinating investments and activities

– Governance model to ensure a level playing field for all participants

Eclipse gives you these “out of the box”

6Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0

Page 9: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

7Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0

Page 10: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

IoT Architectures

Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 8

New and existing devices

IoT Gateways Backend systemsNetwork carriers

Page 11: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Open Source, Open Standards and Community for IoT

IoT Architectures

Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 9

New and existing devices

IoT Gateways Backend systemsNetwork carriers

Page 12: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Protocols

• MQTT– OASIS standard– Client and server implementations in Paho,

Mosquitto and Moquette– Wide commercial adoption: IBM MessageSight,

Facebook Messenger, Eurotech ESF, Sierra Wireless AirVantage, …

• CoAP– IETF standard– Java implementation in Californium– Lots of traction in the WSN space (Thingsquare,

Everythng, …)– Foundation for LWM2M – supported by

Sierra Wireless, Bosch SI, Zebra Technologies

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 10

Page 13: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Frameworks

• Application framework for IoT: Kura– Built on top of Java and OSGi

– Foundation for Eurotech’s Everyware Software Framework

• ETSI SmartM2M and oneM2M implementation: OM2M

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 11

Page 14: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Solutions

• Home Automation: Eclipse SmartHome– Based on Java and OSGi

– Very active community with ~100 home automation driver implementations

– Foundation for Deutsche Telekom’s QIVICON

• IoT network management: Krikkit– Rules engine for IoT devices

– Powering Cisco’s Data in Motion.

• Industrial control: EclipseSCADA

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 12

Page 15: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Tools

• Eclipse Vorto– Information model for « things » + code generators

– Bosch SI leading

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 13

Page 16: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Eclipse IoT Members

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 14

Page 17: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Eclipse IoT in Numbers

• 17 projects

• 90+ committers & contributors

• 1.7 Million lines of code

• 700K+ combined unique visitors

• 3 developer sandboxes (MQTT, CoAP, LWM2M)

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 15

Page 18: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

iot.eclipse.org

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 16

Page 19: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Thanks! Questions?

5 June 2014 Copyright (c) 2014, Eclipse Foundation, Inc. Made available under the Eclipse Public License 1.0 17

Page 20: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

LeshanOpen-source Lightweight M2M for Java

Page 21: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Directly as a library?

Copy/pasted some code? Like TLV parser?

Testing?

Leshan: Who is using it? ?

Page 22: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Leshan

A Java library for implementing LwM2M servers (and clients)

Friendly for any Java developer (no framework, few dependencies)

But also a Web UI for discovering and testing the protocol

Page 23: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

History

Started 22 Jul. 2013 @ Sierra Wireless

First external contribution 10 March 2014

Public sandbox Jul. 2014

Proposed as an Eclipse project Sep. 2014

Client contributed Oct. 2014

Created at Eclipse Dec. 2014

Page 24: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Details

Who?

Move under Eclipse rules

New sandbox: http://leshan.eclipse.org

Page 25: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Committers

Simon Bernard - Sierra Wireless

Kai Hudalla - Bosch Software Innovations

J.F. Schloman - Zebra Technologies, Zatar

Manuel Sangoï - Sierra Wireless

Julien Vermillard - Sierra Wireless

Page 26: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Features

Client initiated bootstrap

Registration/Deregistration

Read, Write, Create objects

TLV encoding/decoding

OSGi friendly

Page 27: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Features

DTLS Pre shared key

DTLS Raw public key

Standalone web-UI for testing

Page 28: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Modules

leshan-core commons elements

leshan-server-core server lwm2m logic

leshan-server-cf californium server

leshan-client client

leshan-all everything above in 1 jar

leshan-client-example

leshan-standalone application with web UI

leshan-bs-server standalone bootstrap

leshan-integration-tests

Page 29: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Server

Simple Java library

Build using “mvn install”

Based on Californium and Scandium

Under refactoring for accepting other CoAP lib

Page 30: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Server API examplepublic void start() { // Build LWM2M server LeshanServerBuilder builder = new LeshanServerBuilder(); lwServer = builder.build(); lwServer.getClientRegistry().addListener(new ClientRegistryListener() {

@Override public void registered(Client client) { System.out.println("New registered client with endpoint: " + client.getEndpoint()); }

@Override public void updated(Client clientUpdated) { System.out.println("Registration updated”); }

@Override public void unregistered(Client client) { System.out.println("Registration deleted”); }

});

// start lwServer.start(); System.out.println("Demo server started"); }

Page 31: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Server API example// prepare the new valueLwM2mResource currentTimeResource = new LwM2mResource(13, Value.newDateValue(new Date()));

// send a write request to a client

WriteRequest writeCurrentTime = new WriteRequest(client, 3, 0, 13, currentTimeResource, ContentFormat.TEXT, true);

ClientResponse response = lwServer.send(writeCurrentTime);

System.out.println("Response to write request from client " + client.getEndpoint() + ": " + response.getCode());

Page 32: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Implements your own store

ClientRegistry: Store currently registered clients

SecurityRegistry: Store security informations

Default implementations are “in-memory”for demo only!

Page 33: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Client

Under construction! API will probably change

Create objects, answer to server requests

DTLS supported in master

Checkout: leshan-client-example

Page 34: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Next steps

Eclipse.org migration

DTLS X.509

CoAP shim, CoAP TCP

Stable API for June

To be done:

Json

SMS

Server initiated bootstrap

Page 35: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

How to help?

Use it! Report bugs, issue, missing features

Write documentation

Talk about it (in your company, IoT meetup,...)

Contribute code

Questions?

https://dev.eclipse.org/mailman/listinfo/leshan-dev

Page 36: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Eclipse Wakaama

Lightweight M2M implementation in CPhoto credits: https://www.flickr.com/photos/30126248@N00/2890986348

Page 37: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Wakaama: Who is using it?

Directly as a library?

Copy/pasted some code?

Testing?

?

Page 38: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Wakaama

A C client and server implementation of LwM2M

Not a shared library (.so/.dll)

Embedded friendly but using malloc/free

Plug your own IP stack and DTLS implementation

Page 39: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

History

Started as liblwm2m by Intel on May 2013https://github.com/01org/liblwm2m

Proposed as Eclipse project Dec. 2013

Code imported at Eclipse July 2014

Page 40: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Who?

David Navarro - IntelJulien Vermillard - Sierra Wireless

Page 41: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Features

Register, registration update, deregister

Read, write resources

Read, write, create, delete object instances

TLV or plain text

Observe

Page 42: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Structure

core :internals.h liblwm2m.c liblwm2m.hlist.c management.c objects.c observe.cpacket.c registration.c tlv.c transaction.curi.c utils.c

core/er-coap-13 :er-coap-13.c er-coap-13.h

Page 43: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Structure

tests/client:lwm2mclient.c object_device.c object_firmware.c object_location.c object_security.c object_server.c test_object.c

tests/server: lwm2mserver.c

Page 44: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

lwm2m_object_t * get_object_device(){ lwm2m_object_t * deviceObj; deviceObj = (lwm2m_object_t *)lwm2m_malloc(sizeof(lwm2m_object_t));

if (NULL != deviceObj) { memset(deviceObj, 0, sizeof(lwm2m_object_t)); deviceObj->objID = 3;

deviceObj->readFunc = prv_device_read; deviceObj->writeFunc = prv_device_write; deviceObj->executeFunc = prv_device_execute; deviceObj->userData = lwm2m_malloc(sizeof(device_data_t));

if (NULL != deviceObj->userData) { ((device_data_t*)deviceObj->userData)->time = 1367491215; strcpy(((device_data_t*)deviceObj->userData)->time_offset, "+01:00"); } else { lwm2m_free(deviceObj); deviceObj = NULL; } }

return deviceObj;}

Create objects!

Page 45: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

objArray[0] = get_object_device();if (NULL == objArray[0]){ fprintf(stderr, "Failed to create Device object\r\n"); return -1;}objArray[1] = get_object_firmware();if (NULL == objArray[1]){ fprintf(stderr, "Failed to create Firmware object\r\n"); return -1;}objArray[2] = get_test_object();if (NULL == objArray[2]){ fprintf(stderr, "Failed to create test object\r\n"); return -1;}

lwm2mH = lwm2m_init(prv_connect_server, prv_buffer_send, &data);if (NULL == lwm2mH){ fprintf(stderr, "lwm2m_init() failed\r\n"); return -1;}result = lwm2m_configure(lwm2mH, "testlwm2mclient", BINDING_U, NULL, OBJ_COUNT, objArray);...

result = lwm2m_start(lwm2mH);

ConfigureWakaama

Page 46: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

while (0 == g_quit){ struct timeval tv; tv.tv_sec = 60; tv.tv_usec = 0;

/* * This function does two things: * - first it does the work needed by liblwm2m (eg. (re)sending some packets). * - Secondly it adjust the timeout value (default 60s) depending on the state of the transaction * (eg. retransmission) and the time between the next operation */ result = lwm2m_step(lwm2mH, &tv); if (result != 0) { fprintf(stderr, "lwm2m_step() failed: 0x%X\r\n", result); return -1; }

Active loop

Page 47: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Next?

Device initiated bootstrap

More example: https://github.

com/jvermillard/Wakaama-mbed

Server?

Block transfer?

Page 48: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Hack it into real devices!

Courtesy of Bosch Software Innovations!

Page 49: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Spark Core

Cortex-M3 STM32, RAM/ROM 20/128k, 72MHzWiFi

wakaama (old: 09.2014 version)+TinydTLS-0.5:

ROM/RAM: 75,6kB/13,1kB

Page 50: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

U-blox MBed.org

Cortex-M3 (NXP LPC1768), RAM/ROM 20/128k, 96MHzGPRS

Current BOSCH wakaama-snapshot:

Function: observe, attribute:

Objects: server, security, device, conn_m, firmware, location,

ROM/RAM: 84kB/22kB

Page 51: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Arduino

AVR, ATmega2560, RAM/ROM 8/256k, 16MHzEthernet

Current BOSCH wakaama-snapshot:

Function: observe, attribute:

Objects: server, security, device, conn_m, firmware, location,

ROM/RAM: 67kB/5kB

Page 52: OMA LwM2M Workshop - Julien Vermillard, OMA LwM2M Projects in Eclipse Foundation

Lua binding

https://github.com/sbernard31/lualwm2m

With DTLS support using:https://github.com/sbernard31/luadtlsbinding on http://tinydtls.sf.net