Вы находитесь на странице: 1из 24

Creating a Java Internet of

Things Gateway
David Woodard, Eurotech

Sometimes IoT Solutions look simple


A single application
to communicate with

No connectivity
options required

Business
Application

Internet /
TCP/IP

Single or no special
application on gateway
Only one type of
Gateway HW & SW
Only one type of
device / sensor

Service
Gateway

Sensors,
Actuators,
Displays,

... But it gets complex

Multiple services on the


gateway / edge node

Different connectivity options

More than one kind of vertical


market value proposition

Customer specific
business logic

Business
Application

Internet /
TCP/IP
xDSL
Cable
Ethernet

2G /
2.5G
WiFi

3G /
LTE

Satellite

WiMAX

Other

Sensors,
Actuators,
Displays,

... More complexity with multiple


consumers
@

Business
Applications

?
Sensors,
Actuators,
Displays,

IoT Architectures
@

M2M/IoT Integration Platform on Cloud

Business
Applications

M2M
Integration
Platform
Application
Framework
+
Multi-Service
Gateway
Sensors,
Actuators,
Displays,

IoT Gateway Stack


Increase productivity and lower time to market
tivity
c
u
d
o
r
per s P
o
l
e
v
e
D

Code

Code

on

Code

OSGi

Java SE Embedded

Linux
Hardware

Birth of

June 16,
2013

December
16, 2013

v0.7.0

August14,
2014

September
25, 2014

Eclipse
www.eclipse.org/kura
Embedded App
Simplify the design, deployment and remote
management of embedded applications.
Modular software components
Manage cloud connectivity
Configure the network, such as Wi-Fi and
cellular bearers, firewalling and routing, etc.
Support different protocols to connect to
different servers or devices (ex. MQTT, Serial,
Modbus, CANBus).
Allow for remote application and device
management and configuration.
Cohesive and integrated ensuring application
portability

Java / OSGi
Linux OS
Open HW

Industrial
HW

Services
Your Application

Your Application

Connectivity and Delivery


Cloud Services

Data Services

Field Protocols
MQTT Paho

Modbus

Network
Configuration
Network Configuration
Cellular, Wi-Fi,
Ethernet

Firewall,
Port Forwarding

CANBus
Link Monitors

Basic Gateway Services


DB Service

Device Profile

Clock Service

Watchdog

Custom Protocols

Administration GUI

Updates
Management
Configuration
Management

Remote Management

Remote Access
(VPN)

Applications

Device Abstraction
javax.comm

javax.usb / udev

GPS Position

GPIO / SPI / PWM / I2C

OSGi Application Container (Eclipse Equinox, Concierge)


Java SE 7 (Oracle Java SE Embedded, OpenJDK)

Developers Experience
Emulate on PC

Deploy on Target

Cloud Managed

Start developing your IoT /


M2M application in the
comfort of your PC.

When you are ready, deploy


your application on the
gateway.

Provision and manage your


applications in field devices
from the Cloud.

One-click Deployment
Eclipse Plugin
Remote Debugging

Remote OSGi
Management via MQTT
Web-based Console

Full Eclipse Integration


Target Platform Definition
Emulated Services
Run/Debug from Eclipse
Support Mac/Linux Hosts

Kura Data Transport Optioins


DataTransportService
Available for standard MQTT messaging. Allows consumers of the
service to connect to brokers, publish messages, and receive
messages on subscribed topics
DataService
Delegates data transport to the DataTransportService
Provides extended features for managing broker connections,
buffering of published messages, and priority based delivery of
messages
CloudService
Further extends the functionality of DataService.
Provides means for more complex flows (i.e. request/response)
Manages single broker connection across multiple applications
Provides payload data model with encoding/decoding serializers
Publishes life cycle manages for devices and applications

Kura Configurable Component


<?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.iot.greenhouse.publisher.GreenhousePublisher"!
name="Greenhouse Publisher" !
description="Settings for the greenhouse application.">!
<AD id="warning.level"!
!name="warning.level"!
!type="Integer"!
!cardinality="0"!
!reguired="true"!
!default="20"!
!description="Triggers alarm if temperature
falls below this limit." />!
</OCD>!
</MeataData>!

Kura Configurable Component

Atributes configured in XML appear in


form panel
Applications implementing
ConfigurableComponent will be available
in Kura UI

Network Services

Greenhouse Demo Architecture


Temperature Sensor

I2C

Humidity Sensor

Light Sensor

GPIO

OSGi Services
CloudClientListener (From Kura)
Provided service for handling messaging events (connection
established, message arrived, message sent, etc.)
CloudService (From Kura)
Consumed service to manage connection to cloud across multiple
applications, publish life cycle messages, serialize/deserialize
compressed data payload, and more.
SensorChangedListener (From Application)
Provided service to send MQTT message once a sensor has
detected a change
GreenhouseSensorService (From Application)
Provided service for getting values from sensors and setting
actuator values (i.e. LED)

Greenhouse Application
public class GreenhousePublisher implements ConfigurableComponent,!
!
!CloudClientListener, SensorChangedListener {!
!
private static final String APP_ID = "greenhouse-demo";!
!
_cloudClient = _cloudService.newCloudClient(APP_ID);!
_cloudClient.addCloudClientListener(this);!
!
@Override!
public void onConnectionEstablished() {!
!_cloudClient.subscribe("#", 0);!
}!
!
@Override!
public void sensorChanged(String sensorName,Object newValue) {!
!KuraPayload payload = new KuraPayload;!
!payload.setTimestamp(new Date());!
!payload.addMetric("value", newValue);!
!int messageId = cloudClient.publish(topic, payload,!
!
!
!
!
!qos, retain, 2);!
}!
}!

GreenhouseSensorService
public class Pi4JGreenhouseSensorService implements !
!GreenhouseSensorService {!
!
_gpioController = GpioFactory.getInstance;!
_i2cbus = I2CFactory.getInstance(I2CBus.BUS_1;!
!
!
!!
_temperatureSensor = _i2cbus.getDevice(0x40);!
!
_lightActuator =_gpioController.provisionDigitalMultipurposePin(!
!
!RaspiPin.GPIO_00, "led, PinMode.DIGITAL_OUTPUT);!

@Override!
public void setActuatorValue(String actuatorName, Object value){!
!_lightActuator.setState("on".equals(value));!
!notifyListeners("light", value);!
}!
}!

Eurotech Everyware Cloud

Business Logic

MQTT Topics and Payloads


javaonedemo

actuator

sensors

temperature

humidity
Kura Payload
Timestamp
Metrics:
value
warn

lux

light
Kura Payload
Timestamp
Metrics:
value

Everyware Software Framework (ESF)


Kura & ESF

on

Core Elements of ESF, a proven


application framework for embedded
devices form the basis for Kura
Elements outside
the scope of Kura

Java/OSGi
Linux OS

ESF now builds on Kura,


with the addition of
commercial support and
extra features:
Everyware Cloud remote
management and logging
Diagnostic
Everyware VPN
Field Protocols
Bundles for specific
vertical applications
Device provisioning

on

on

Java/OSGi
Linux OS

on

You are important!


Learn More - come visit us on the Exhibition Floor:
Eurotech Booth
Eclipse Booth
Contribute!
www.eclipse.org/kura

Thank You!
www.eurotech.com

Вам также может понравиться