an introduction to eclipse kura - eclipse day florence 2014
DESCRIPTION
Deploying and configuring one device to act as a node in the Internet of Things is relatively easy. Doing the same for hundreds or thousands of devices is not so easy though. This is where the new Eclipse project Kura comes in. Kura is a Java/OSGi-based container for M2M applications running in service gateways. Kura was contributed to Eclipse by Eurotech who developed the original technology to run on everything from general purpose devices, rugged mobile computers, wearable devices, service gateways and vehicle consoles, all the way down to the Raspberry Pi.TRANSCRIPT
![Page 1: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/1.jpg)
Eclipse Kura: an Introduction
Cristiano De Alti, EUROTECH
Eclipse Day Florence
23 May 2014
![Page 2: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/2.jpg)
Eclipse IoT
Applying open source to end-to-end IoT solutions
![Page 3: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/3.jpg)
Kura Project – Java/OSGi-based container for M2M applications
running in service gateways
– http://projects.eclipse.org/projects/technology.kura
– Kura code available since March 2014
– 12 committers
– Open source version of the Everyware Software
Framework (ESF)
– Most of the ESF codebase contributed to Kura. Some
parts waiting for IP approval
![Page 4: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/4.jpg)
OSGi
on
IoT Gateway Software Stack
Linux
Hardware
Application
Java VM
Application
• Built-in OSGi Services for IoT Apps
• High-level Programming Language
• Software Modularity
• Configuration Management
• Application Management
• Shorter Time-to-Market
• Device Abstraction
• Application Portability
• Investment Protection
• Integrated Device Cloud features
Application
![Page 5: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/5.jpg)
Functional Overview
Java VM
OSGi Application Container
Device Abstraction
Gateway Basic Services
Network Configuration Network Management Field
Protocols
Connectivity and Delivery
Ad
min
istra
tion
GU
I
Op
era
tion
& M
an
ag
em
en
t
Linux
Hardware
Multi-
Service
Gateway
App 1 App 2 App n . . . .
Applications
![Page 6: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/6.jpg)
on
Java VM
OSGi Application Container
Field
Protocols
Connectivity and
Delivery
Ad
min
istra
tion
GU
I
Applications
Op
era
tion
& M
an
ag
em
en
t
Gateway Basic Services
Network
Configuration Network Management
Device Abstraction
Device Abstraction
USB
javax.usb
Other GPIO I2C
Ready to use OSGi bundles
exposing Java APIs for device
access and with the native code
dependencies pre-compiled.
Serial
javax.comm Bluetooth
javax.bluetooth Device Abstraction
![Page 7: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/7.jpg)
Gateway Basic Services
on
Java VM
OSGi Application Container
Field
Protocols
Connectivity and
Delivery
Ad
min
istra
tion
GU
I
Applications
Op
era
tion
& M
an
ag
em
en
t
Network
Configuration Network Management
Device Abstraction
Gateway Basic Services
Gateway Basic Services
Watchdog
Service
Clock
Service
GPS Position
Service
Embedded
Database
Service
Process
Service
Device Profile
Service
Configurable OSGi Services
available to the applications to
interact with the basic gateway
functionality.
Configuration Service
![Page 8: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/8.jpg)
Network Management
Network Management
Link Monitor
Ethernet
on
Java VM
OSGi Application Container
Field
Protocols
Connectivity and
Delivery
Ad
min
istra
tion
GU
I
Applications
Op
era
tion
& M
an
ag
em
en
t
Gateway Basic Services
Device Abstraction
Network
Configuration Network Management
WiFi Cellular
DHCP NAT DNS
Firewall
Configurable OSGi Services to
access the current network
configuration and administer it.
It interacts with the Linux system to
configure network interfaces
including WiFi access points and
PPP connections.
![Page 9: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/9.jpg)
Connectivity and Delivery
on
Java VM
OSGi Application Container
Field
Protocols
Ad
min
istra
tion
GU
I
Applications
Op
era
tion
& M
an
ag
em
en
t Gateway Basic Services
Network
Configuration Network Configuration
Device Abstraction
Connectivity and
Delivery
Connectivity & Delivery
Eclipse Paho (MQTT) Other Client
Data Transport
Data Service
Cloud Service
Configurable OSGi Services which
greatly simplify the development of
telemetry M2M applications
interacting with a remote Cloud
server.
![Page 10: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/10.jpg)
Operation & Management
on
Java VM
OSGi Application Container
Field
Protocols
Connectivity and
Delivery
Ad
min
istra
tion
GU
I
Applications
Gateway Basic Services
Network
Configuration Network Configuration
Device Abstraction
Op
era
tion
& M
an
ag
em
en
t
Remote System Command
Remote Configuration Management
Operation & Management
Remote Software Updates
Remote Log Retrieval
Device Diagnostic Service
Remote VPN Access
![Page 11: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/11.jpg)
Administration UI
![Page 12: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/12.jpg)
Developer’s Experience
![Page 13: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/13.jpg)
Greenhouse Demo Architecture
Mqtt
Broker
Web
Application
MQTT
Mosquitto
HTTP
Light
Modbus
![Page 14: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/14.jpg)
Greenhouse Demo
MQTT Topics and Payloads
greenhouse/
sensors
• Timestamp
• Metrics:
• request ID
• Timestamp
• Metrics:
• temperature
• humidity
• luminosity
• open
Kura Payload Kura Payload
EXEC/window/open
EXEC/window/close
REPLY/<request ID>
• Timestamp
• Metrics:
• Reply code
Kura Payload
![Page 15: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/15.jpg)
Greenhouse Demo
Anatomy of a Kura Cloud Application
public class GreenHouse extends Cloudlet implements
ConfigurableComponent
![Page 16: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/16.jpg)
Greenhouse Demo
Anatomy of a Kura Cloud Application (Metatype)
A ConfigurableComponent has a metatype...
<?xml version="1.0" encoding="UTF-8"?>
<MetaData xmlns="http://www.osgi.org/xmlns/metatype/v1.2.0" localization="en_us">
<OCD id="org.eclipse.kura.demo.greenhouse.v2.GreenHouse"
name="GreenHouse"
description="Greenhouse example application.">
<AD id="modbus.serialMode"
name="modbus.serialMode"
type="String"
cardinality="0"
required="true"
default="RS232"
description="Serial Mode (RS232 or RS485), or TCP for TCP-encapsulated Modbus.">
<Option label="RS-232" value="RS232"/>
<Option label="RS-485" value="RS485"/>
<Option label="TCP" value="ETHERTCP"/>
</AD>
...
...describing its configuration
![Page 17: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/17.jpg)
Greenhouse Demo
Anatomy of a Kura Cloud Application (Configuration)
Metatype is used to display the configuration dinamically
![Page 18: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/18.jpg)
Greenhouse Demo
Anatomy of a Kura Cloud Application (Configuration)
Configuration received in DS activate/updated methods
protected void activate(ComponentContext componentContext,
Map<String, Object> properties)
protected void updated(Map<String, Object> properties)
![Page 19: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/19.jpg)
Greenhouse Demo
Anatomy of a Kura Cloud Application (Publishing)
public void setCloudService(CloudService cloudService) {
m_cloudService = cloudService;
}
protected void activate(ComponentContext componentContext, Map<String, Object> properties) {
...
// Acquire a Cloud Application Client for this Application
m_cloudClient = m_cloudService.newCloudClient("greenhouse");
m_cloudClient.addCloudClientListener(this);
...
}
protected void doPublish() {
...
KuraPayload kuraPayload = new KuraPayload();
kuraPayload.addMetric("temperature", temperature);
kuraPayload.addMetric("luminosity", luminosity);
kuraPayload.addMetric("humidity", humidity);
kuraPayload.addMetric("open", open);
m_cloudClient.publish("sensors", kuraPayload, DFLT_QOS, DFLT_RETAIN,DFLT_PRIORITY);
...
}
![Page 20: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/20.jpg)
Greenhouse Demo
Anatomy of a Kura Cloud Application (Requests) public class GreenHouse extends Cloudlet implements ConfigurableComponent
public GreenHouse()
{
super("greenhouse");
}
@Override
protected void doExec(CloudletTopic reqTopic,
KuraRequestPayload reqPayload,
KuraResponsePayload respPayload) throws KuraException {
String[] resources = reqTopic.getResources();
if (resources == null || resources.length < 2 || !resources[0].equals("window")) {
respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_NOTFOUND);
return;
}
boolean open = false;
if (!((open = resources[1].equals("open")) || resources[1].equals("close"))) {
respPayload.setResponseCode(KuraResponsePayload.RESPONSE_CODE_NOTFOUND);
return;
}
...
}
![Page 21: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/21.jpg)
Where to start?
![Page 22: An Introduction to Eclipse Kura - Eclipse Day Florence 2014](https://reader034.vdocuments.net/reader034/viewer/2022042601/5478ab115906b567048b4595/html5/thumbnails/22.jpg)
www.eurotech.com
Thank You!