CON5260 Creating a Java Internet of Things Gateway

  • Upload
    suchai

  • View
    218

  • Download
    0

Embed Size (px)

Citation preview

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    1/24

    Creating a Java Internet of

    Things Gateway 

    David Woodard, Eurotech

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    2/24

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    3/24

    Internet /TCP/IP

    EthernetWiFi

    3G /LTE Satellite

    WiMAXOther

    ... 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

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    4/24

    ... More complexity with multiple

    consumers

    @Business

    Applications

    Sensors,

    Actuators,

    Displays,!

     

    ?

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    5/24

    IoT Architectures

    BusinessApplications

    Sensors,

    Actuators,

    Displays,! 

    @

    Application

    Framework

    +

    Multi-Service

    Gateway

    M2M/IoT Integration Platform on Cloud

    M2M

    IntegrationPlatform

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    6/24

    IoT Gateway StackIncrease productivity and lower time to market

    OSGi

    on 

    Linux

    Hardware

    Java SE Embedded

    CodeCode

    Code

     D e v e l o p e r ’ s  P

     r o d uc t i v i t y 

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    7/24

    Birth of

    •  June 16,2013

    •  December16, 2013

    v0.7.0•  August14,

    2014

    •  September25, 2014

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    8/24

      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 HWIndustrial

    HW

    Eclipsewww.eclipse.org/kura

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    9/24

      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 ProtocolsConnectivity and Delivery

    Data Services MQTT Paho

       A   d  m   i  n   i  s   t  r  a   t   i  o  n   G

       U   I

    Applications

    Your Application

       R  e  m  o   t  e   M  a  n  a  g  e  m

      e  n   t

       C  o  n   f   i  g  u  r  a   t   i  o  n

       M  a  n  a  g  e  m  e  n   t

     javax.usb / udev

    Cloud Services

    Your Application

    Firewall,Port Forwarding

    Link MonitorsCellular, Wi-Fi,

    Ethernet

    GPS Position GPIO / SPI / PWM / I2C

    Modbus

    CANBus

    Custom Protocols

       U  p   d  a   t  e  s

       M  a  n  a  g  e  m  e  n   t

       R  e  m  o   t  e   A  c  c  e  s  s

       (   V   P   N   )

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    10/24

      Developer’s Experience

    Emulate on PC Deploy on Target Cloud Managed

    Start developing your IoT /

    M2M application in thecomfort 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 thegateway.

    •  One-click Deployment

    •  Eclipse Plugin

    •  Remote Debugging

    Provision and manage your

    applications in field devicesfrom the Cloud.

    •  Remote OSGi

    Management via MQTT

    •  Web-based Console

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    11/24

    Kura Data Transport Optioins

    • 

    DataTransportService

     – 

     Available for standard MQTT messaging. Allows consumers of theservice 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

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    12/24

    Kura Configurable Component

     

     

     

     

     

     

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    13/24

    Kura Configurable Component

    Applications implementing

    ConfigurableComponent will be available

    in Kura UI

    Atributes configured in XML appear in

    form panel

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    14/24

    Network Services

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    15/24

    Greenhouse Demo Architecture

    Temperature Sensor

    Humidity Sensor

    Light Sensor

    I  2  C 

     

    GPIO

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    16/24

    OSGi Services

    • 

    CloudClientListener (From Kura)

     – 

    Provided service for handling messaging events (connectionestablished, 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)

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    17/24

    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); 

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    18/24

    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); 

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    19/24

    Eurotech Everyware Cloud

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    20/24

    Business Logic

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    21/24

    MQTT Topics and Payloads 

     javaonedemo

     

    sensors actuator

    • 

    Timestamp•

     

    Metrics:

    • value

    • warn

    • 

    Timestamp• Metrics:

    • value

    Kura Payload Kura Payload

    temperature humidity lux light

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    22/24

    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 provenapplication framework for embedded

    devices form the basis for Kura

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    23/24

     You are important!

    • 

    Learn More - come visit us on the Exhibition Floor: –

     

    Eurotech Booth

     – 

    Eclipse Booth

    • 

    Contribute!www.eclipse.org/kura

  • 8/18/2019 CON5260 Creating a Java Internet of Things Gateway

    24/24

    www.eurotech.com

    Thank You!