1. Creating a Java Internet of Things Gateway
David Woodard, Eurotech
2. Internet /
TCP/IP
Sometimes IoT Solutions look simple …
Business
Application
Sensors,
Actuators,
Displays, …
Service
Gateway
Single or no special
application on gateway
A single application
to communicate with
Only one type of
Gateway HW & SW
Only one type of
device / sensor
No connectivity
options required
3. Internet /
TCP/IP
Ethernet
WiFi
3G /
LTE
Satellite
WiMAX
Other
... But it gets complex
Business
Application
Sensors,
Actuators,
Displays, …
•Multiple services on the gateway / edge node
•Different connectivity options
•More than one kind of vertical market value proposition
•Customer specific business logic
2G /
2.5G
xDSL
Cable
4. ... More complexity with multiple consumers
@
Business
Applications
Sensors,
Actuators,
Displays, …
?
8. Linux OS
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
Open HW
Industrial
HW
Eclipse
www.eclipse.org/kura
9. Services
Java SE 7 (Oracle Java SE Embedded, OpenJDK)
OSGi Application Container (Eclipse Equinox, Concierge)
Device Abstraction
javax.comm
Basic Gateway Services
DB Service
Clock Service
Device Profile
Watchdog
Network Configuration
Network Configuration
Field Protocols
Connectivity and Delivery
Data Services
MQTT Paho
Administration GUI
Applications
Your Application
Remote Management
Configuration Management
javax.usb / udev
Cloud Services
Your Application
Firewall, Port Forwarding
Link Monitors
Cellular, Wi-Fi, Ethernet
GPS Position
GPIO / SPI / PWM / I2C
Modbus
CANBus
Custom Protocols
Updates
Management
Remote Access (VPN)
10. Developer’s Experience
Emulate on PC
Deploy on Target
Cloud Managed
Start developing your IoT /M2M application in the comfort of your PC.
•Full Eclipse Integration
•Target Platform Definition
•Emulated Services
•Run/Debug from Eclipse
•Support Mac/Linux Hosts
When you are ready, deploy your application on the gateway.
•One-click Deployment
•Eclipse Plugin
•Remote Debugging
Provision and manage your applications in field devices from the Cloud.
•Remote OSGi Management via MQTT
•Web-based Console
11. 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
12. 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>
13. Kura Configurable Component
Applications implementing Configurable Component will be available in Kura UI
Attributes configured in XML appear in form panel
16. 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)
17. 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); } }
21. MQTT Topics and Payloads
javaonedemo
sensors
actuator
•Timestamp
•Metrics:
•value
•warn
•Timestamp
•Metrics:
•value
Kura Payload
Kura Payload
temperature
humidity
lux
light
22. on
Everyware Software Framework (ESF)
Kura & ESF
Linux OS
Java/OSGi
on
Elements outside
the scope of Kura
Linux OS
Java/OSGi
on
on
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
Core Elements of ESF, a proven application framework for embedded devices form the basis for Kura
23. You are important!
•Learn More - come visit us on the Exhibition Floor:
–Eurotech Booth
–Eclipse Booth
•Contribute! www.eclipse.org/kura