Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture...

43
+ Shoot A Pi! with Eclipse Kura David Woodard @ Eurotech Walt Bowers @ Eurotech

Transcript of Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture...

Page 1: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+

Shoot A Pi!with Eclipse Kura

David Woodard @ EurotechWalt Bowers @ Eurotech

Page 2: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Agenda• Presentation of Kura architecture for Java and OSGi based multi service

gateway platforms. (Walt, 15 mins)Presentation of the Shoot-A-Pi arcade game simulator, game logic explanation, MQTT topics and metrics (David, 10 mins)

• Emulator• Creation of an emply OSGi Bundle (5 min)• Bundle lifecycle management (component.xml) (10 min)• Use of services and the OSGi folder (15 min)• OSGi Metatype definition and programmable properties (10 min) Kura

Cloud Service (15min)• Executors and multi-threading (10 min)• Light-sensor runnable (15 min)• GPIO Actuator (10 min)• Game logic implementation (10 min)• Debug in Emulator (10 min)

• Pause (5 min)• Remote Debug

• Start Kura in debug mode (5 min)• Deploy using mToolkit (5 min)• Remote debugging session (5 min)

• Deploy to Target• Creation of the Deployment Package Project (5 min)• Creation of the Deployment Package (5 min)• Deploy to Target using the Kura WebUI (5 min)• Example of Remote Deployment through EDC (10 min)

• Dashboard Demo (10 min)

25/3

0 m

in11

0 m

in15

min

30 m

in

2

Page 3: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Gateways per IoTTowards Real Time, Actionable Data

Business Application

Business Application

MQTT Broker

3

Page 4: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Encapsulating ComplexityIncrease Productivity

OSGiOSGi

on

Operating  SystemOperating  System

HardwareHardware

Java  VMJava  VM

CodeCode

Code

Kura  helps  customers  focus  on  their  core  business

4

Page 5: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Esperienza di Sviluppo con KuraDesigned from ground up for developers

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 OSGiManagement via MQTT

• Web-based Console

5

Page 6: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+

Java SE 7 / 8 (OpenJDK)

OSGi Application Container (Eclipse Equinox, Concierge)

Device AbstractionDevice Abstraction

javax.comm

Basic Gateway ServicesBasic Gateway ServicesDB Service

Clock Service

Device Profile

Watchdog

Network ConfigurationNetwork ConfigurationNetwork Configuration

Field ProtocolsField ProtocolsConnectivity and DeliveryConnectivity and Delivery

Data Services MQTT Paho

Ad

min

istr

atio

n G

UI

Ad

min

istr

atio

n G

UI

ApplicationsApplications

Your ApplicationYour Application

Rem

ote

Man

agem

ent

Rem

ote

Man

agem

ent

Con

fig

urat

ion

Man

agem

ent

javax.usbw/ udev access

Cloud Services

Your ApplicationYour Application

Firewall, Port Forwarding

Link Monitors

Cellular, Wi-Fi, Ethernet

GPS Position GPIO / SPI / PWM / I2Cjdk.dio

Modbus

CANBus

Custom ProtocolsCustom Protocols

Up

dat

esM

anag

emen

tRe

mot

e A

cces

s

Java HID APIs javax.bluetooth / BLE

...Your ApplicationYour Application

Eclipse Open IoT Stack for Java6

Page 7: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Shoot-A-Pi Arcade Shooter SimulatorArchitecture

Eclipse  Equinox  OSGi

Java  VM

Linux

Hardware

Device/Gateway(data  collection)

MQTTBroker

MQTT WebsocketsREST  APIs

WebDashboards

I2C

GPIO

Laser

7

Page 8: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Shoot-A-Pi Arcade Shooter Simulator

§ [account-id]/[device-id]/[application-defined-topic]§ Shot!§ Timestamp

§ [account-id]/[device-id]/[application-defined-topic]§ Miss!§ Consecutive miss count

§ [account-id]/[device-id]/[application-defined-topic]§ Reset!§ String

§ [account-id]/[device-id]/[application-defined-topic]§ Score!§ Current score

MQTT Topics and Metric

8

Page 9: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+ Shoot-A-Pi Arcade Shooter SimulatorGame Logic

Shoot-­A-­PiShoot-­A-­Pi

HID  WorkerHID  Worker I2C  WorkerI2C  Worker GPIO  ActuatorGPIO  Actuator Game  LogicGame  Logic

start acquiring

score

9

Page 10: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+

Developing the Game in Eclipse IDEStart the Virtual Machine, start Eclipse, and start developing the Shoot-A-Pi

Page 11: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Class Diagram

Shoot-A-Pi

DigitalLighSensorWorkerRunnable

GPIOActuator

GameLogic

RandomizerRunnable

Util

ities

11

Page 12: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

Creating a New OSGi Bundlen New -> Plug-in Development -> Plug-in Project

n Name it with the fully qualified namespace

n OSGi Framework -> standard

n Give a name (Better equal to ID)

n Do not generate an Activator

n Project Properties -> Java Build Path -> Sourcen Add a main/java folder under src

n Set src/main/java as Java Source Folder

n Remove src from Java Source Folder

n Add class to package in src/main/java folder

12

Page 13: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Bundle Lifecycle Management

n New -> Plug-in Development -> Component Definition

n Place it in OSGI-INF folder

n Name it (better use class name)

n Open source in editor and add: n activate="activate”

n deactivate="deactivate“

n modified="updated“

n enabled="true“

n immediate="true“

Part 1

13

Page 14: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Bundle Lifecycle Management

n Edit class file and add Lifecycle Hooks: n Add method protected void activate(ComponentContext

componentContext, Map<String, Object> properties) n Add method protected void deactivate(ComponentContext

componentContext) n Add method public void updated(Map<String, Object> properties)

n Acquire a static Logger instance to the source and log something on the hooks: n private static final Logger s_logger = LoggerFactory.

getLogger(ClassName. class); n s_logger.info(“Something to log”);

n Fix project dependencies in MANIFEST.MF

n First test run on emulator

Part 2

14

Page 15: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+OSGi Services Overviewn GPIOService

n Service used to access GPIO resources on the Gateway

n This service is emulated in the Kura Emulator, and uses jdk.dio on the Raspberry Pi distribution

n I2CService n Service used to access I2C resources on the Gateway

n This service is emulated in the Kura Emulator, and uses jdk.dio on the Raspberry Pi distribution

n Source code for both APIs and implementation is provided in the work tree for reference

n CloudServicen Service used to publish data to the connected MQTT Broker

15

Page 16: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Use of Services

n Acquire needed Declarative Services from the component definition. (i.e. GPIOService) n Add service reference to GPIO Service in Component Definition

n name="GPIOService”n policy="static”n bind="setGPIOService” n unbind="unsetGPIOService”n cardinality="1..1”n interface="org.eclipse.kura.gpio.GPIOService«

n Add service hooks to main class:n private static GPIOService m_GPIOServicen protected void setGPIOService(GPIOService gpioService)n protected void unsetGPIOService(GPIOService gpioService)

Part 1

16

Page 17: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Use of Services

n Test GPIO Service on emulatorn Activate GPIO logging

n Edit emulator log4j.properties file and add log4j.logger.org.eclipse.kura.emulator.gpio=DEBUG

n Acquire a GPIO Pin in the activation hooks and log activity

n KuraGPIOPin pin = m_GPIOService.getPinByTerminal(18)

n pin.setValue(true)

n Fix MANIFEST.MF file

n Test run on emulator

Part 2

17

Page 18: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+OSGi Metatype

n Create a new metatype definition in the OSGI-INF folder: n New -> XML -> XML Filen Name it using the fully qualified namespace of the classn Add Metatype Definition prototype

n Set OCD id to fully qualified namespacen Set Designate pid to fully qualified namespacen Set Object ocdref to fully qualified namespace

n Add Object Component Definitions details

n Add sample Attribute Definition

n Have the main class implement ConfigurableComponent interface

n Add service pid on Component Definition xml

n Test run on emulator

n Open the WebUI at 127.0.0.1:8080 and check for the Attribute

Part 1

18

Page 19: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+OSGi Metatype

n Change main class to use the new AD as the GPIO Pin to use:n Add a KuraGPIOPin member to the class

n Add a static String to store the AD property ID

n Retrieve the property value before acquiring the GPIO Pin

n Test run on the emulatorn change AD value and test results on OSGi Console

n stop the bundle and test results on OSGi Console and WebUI

n start the bundle and test results on OSGi Console

n Experiment with new ADs and Servicesn Navigate through the Kura API

n Explore cardinality, defaults, validation

Part 2

19

19

Page 20: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Cloud Service

n Add a service reference to CloudServicen Interface: org.eclipse.kura.cloud.CloudServicen setCloudService(CloudService cloudService)n unsetCloudService(CloudService cloudService)

n Add a CloudClient member to the main class

n Have the main class implement CloudClientListener

n Acquire the CloudClient using the CloudService upon bundle activation and set main class as listener: n cloudClient = cloudService.newCloudClient(APP_ID)n cloudClient.addCloudClientListener(this)

n Release CloudClient upon bundle deactivation

Part 1

20

Page 21: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Cloud Service

n Implement all the methods of the CloudClientListener

n Add a doPublish(String metricName, Object value) to the sourcen Build a new KuraPayload

n Set its timestamp

n Add metrics to the payload

n Define a MQTT topic to send data to

n Publish data to the Cloud using the CloudClient

n Add calls to doPublish(s,o) inside the source when GPIO events occur n doPublish(pinNumber, pinValue)

Part 2

21

Page 22: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Cloud Service

n Launch the emulator and check for bundle statuses (ss)

n Open the WebUI at 127.0.0.1:8080

n Edit MqttDataTransport tab:n broker-url: mqtts://broker-sandbox.everyware-cloud.com:8883n topic.context.account-name: EclipseConn username: EclipseCon_brokern password: EclipseCon#54321

n Edit DataServicen connect.auto-on-startup: true

n Check results on the emulator Console

Part 3

22

Page 23: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Executors and Multi Threading

n Create a Randomizer class implementing Runnable n Add randomDelay and randomizer variables (programmable)

n Add an infinite loop in the run() method

n Wait for a random (programmable) timeout

n Start acquiring the laser and log (complete later)

n Wait for programmable acquiring period

n Stop acquiring the laser and log (complete later)

n Add a static ExecutorService and Future<?> to the main class

n Initialize ExecutorService in the main class constructorn m_impulse_executor = Executors.newSingleThreadExecutor()

n Remove debug code from activation hooks

Part 1

23

Page 24: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Executors and Multi Threading

n Add a new Randomizer member to the main class

n Create the doUpdate() method in main class n Check for Future<?> n Start a new Future using the ExecutorService and assigning the

Randomizer instance

n Invoke doUpdate() both from the Activate and the Updated methods

n Check for Future<?> and ExecutorService in the Deactivate method

n Fix project dependencies

n Test run on the emularor

Part 2

24

Page 25: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Digital Light Sensor Class

n Add KuraI2CService to the main class

n Create a new DigitalLightSensorWorker class and have it implement Runnable

n Pass KuraI2CService in the constructor and store it in a static member

n Add a private static initDevice() methodn Add a KuraI2CDevice static member to the classn Init the KuraI2CDevice as per Grove DLS specifications

n Add a private static closeDevice() method and close the I2C Device

n Add public static void startAcquiringLaser() , public static void stopAcquiringLaser() and public static booleanisAcquiringLaser()

Part 1

25

Page 26: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Digital Light Sensor Class

n Implement the run() method n Check for KuraI2CSensor and init() if needed n Start an infinite loop n Read values from the KuraI2CSensor n Calculate LUX value

n Use a thresholdLux local member to store first Lux read and calculate variations

n Refer to Utilities class n Alert GameLogic if needed and log (complete later)

n Check if value read is above programmed variation n Call GameLogic.laserDetected(luxValue)

n Add a programmable delay for I2C read resolution n Close the KuraI2CDevice in a finally clause

Part 2

26

Page 27: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Digital Light Sensor Class

n Edit the Randomizern Add call to startAcquiringLaser()n Add call to stopAcquiringLaser()

n Add a new ScheduledExecutorService and ScheduledFuture<?> to the main class

n Init the ScheduledExecutorService in main class constructorn m_dls_executor = Executors.newSingleThreadScheduledExecutor()

n Add executor checks to doUpdate() method: n Check if the ScheduledFuture is already running and stop it if needed n Schedule a new DigitalLightSensor worker at fixed delay: n m_dls_handle = m_dls_executor.scheduleWithFixedDelay(new

DigitalLightSensor(m_I2CService), 1, 2, TimeUnit.SECONDS)

n Fix dependencies and test run on the emulator

Part 3

27

Page 28: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+GPIO Actuator Class

n Create a new GPIOActuator class

n Add 2 Runnables to the class. They will be used for LED and Buzzer

n Add 2 static KuraGPIOPin members, for LED and Buzzer

n Create a public static void init() methodn Initialize the GPIO pins and pass the GPIOServicen Initialize the runnables so to blink the LED and make the buzzer sound

n Create a CachedThreadPool executor

n Add a public static blinkLed() methodn Invoke the executor service and pass the led runnable

n Add a public static buzz() methodn Invoke the executor service and pass the buzzer runnable

Part 1

28

Page 29: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+GPIO Actuator Class

n Add a public static methodn Close the pins

n Invoke the method from Deactivate hook on main class

n Initialize the GPIO Actuator class from the main class doUpdate()

n Edit the startAcquiringLaser() inside DigitalLightSensorn Add a call to GPIOActuator.blinkLed()

n Fix project dependencies

n Test run on emulator

Part 2

29

Page 30: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Game Logic Implementation

n Create a new GameLogic class

n Create a public static void trigger() method n Have it blink the LED n Invoke the main class doPublish(S,O) method and publish a

timestamp n Remove blinkLed() call from DigitalLightSensorn Move DigitalLightSensor acrivation logic from the Randomizer.run()

method n Add the «missfire» message publishing logic

n Create a public static void score() methodn Have it sound the buzzern Stop DLS laser acquisitionn Remove stopAcquiringLaser() from DigitalLightSensor.run()n Invoke the main class doPublish(S,O) method and publish a

timestamp

Part 1

30

Page 31: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Game Logic Implementation

The game logic should include the following:

n Increment a miss counter every time the laser doesn’t get detected.

n Increment a score counter for each scored hit, and reset the miss.

n If the miss counter is greater than a threshold (programmable), reset the score.

Data will be published in real time and can be used by a dashboard to visualize the game logic.

Part 2

31

Page 32: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Have fun with the emulator!Experiment with the emulator, adding programmable properties and tweaking the game logic

32

Page 33: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+

Remote DebuggingDeploy and debug your application directly from Eclipse

Page 34: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Start mToolkit and Deployn Create a new mToolkit server and give it the Pi IP address

n Connect mToolkit to the Pi

n Create a jar file for the ShootAPi Bundlen Right clikc on project tree -> Export -> Plug-in Development n Deployable plug-ins and fragmentsn Export the jar file to a folder

n Install ShootAPi into Kura on the Pin Right click on mToolkit tree -> Install new bundlen Choose the previously created jarfile

n Start a remote debugging session n Right click on project tree -> Debug as... -> Debug configurations... -> Remote

Java Application n Select the ShootAPi project n Fill in Host and Port fields n Debug

34

Page 35: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Deploy on Targetn Create a new Deployment Package Definition

n Right click on main project tree -> New... -> OSGi -> Deployment Package Definition

n Fill in the fields n Open the file and navigate to the Bundles tab n Add a new bundle and chose the previously created jar file

n Create a Deployment Packagen Right click on Deployment Package Definition -> Quick build...

n Access the Kura Web UI and deploy the packagen Open 192.168.2.10 (admin / admin)n Navigate to the Packages tabn Install new package -> File n Chose the newly created .dp file n Ok

n Access the Kura log on the Pi n ssh to the Pin tail –f /var/log/kura.log

35

Page 36: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+AppendixQuick reference slides

36

Page 37: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Condividere il WiFi con la PiLinux / Mac users

n Open the Kura Web Console on a browser (192.168.2.10)

n Navigate to the Network panel and set eth0 on DHCP

n Share your WiFi with the Ethernet interface

n Do an ifconfig on the terminal and take note of the IP address assigned to eth0 (defaults to 10.42.0.1 on Ubuntu)

n Scan for the IP of the Pi using nmap nmap 10.42.0.0-255

Windows users

n Share your WiFi with the Ethernet interface

n Set the IP address of the Ethernet interface to 192.168.2.1

n The Raspberry Pi will be available at address 192.168.2.10

37

Page 38: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+ Shoot-A-Pi Arcade Shooter SimulatorHardware Setup

38

SDA1  -­ I2CSDA1  -­ I2CSCL1  -­ I2CSCL1  -­ I2C

GroundGroundGPIO17GPIO17

5v  DC  Power5v  DC  PowerGroundGround

GPIO18GPIO18GroundGround

5v  DC  Power5v  DC  Power3.3v  DC  Power3.3v  DC  Power

Raspberry Pi B+ J8 HeaderI2C GPIO

Page 39: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+ Shoot-A-Pi Arcade Shooter SimulatorWeb Dashboard Architecture

39

MQTTBroker

Shoot  A  PiPAHO  for  JavaScript

Google  Protocol  Buffers

ByteBuffer

JSX  Compressor

Dashboard  Logic

Web Dashboard

Page 40: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Debugging e LoggingAfter accessing the Pi through ssh you will be able to inspect the log files and control Kura using these commands:

40

tail –f /var/log/kura.log

tail –f /var/log/kura-console.log

telnet 127.0.0.1 5002

will show the realtime kura log

will show the System.err log

will open the OSGi telnet terminal

sudo /etc/init.d/kura restartWill restart Kura. Bundles installed with mToolkit will be removed.

Page 41: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+Setting up the Digital Light Sensor

The Rapsberry Pi ships with the I2C disabled.In order to communicate with the Grove Digital Light Sensor we have to enable the Linux modules that will enable I2C communication on the Pi.Enter the following commands in the Pi command line:

Enable I2C on the Raspberry Pi

41

sudo nano /etc/modules

And add these two lines to the file:

i2c-bcm2708i2c-dev

Then save the file and reboot the Pi

Page 42: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+ You are important!Kura helps you … Kura needs you

I was lucky to be involved and get to

contribute to something that was important, which is

empowering people with software. (By Bill

Gates)

Page 43: Shoot A Pi! with Eclipse KuraWalt Bowers @ Eurotech + Agenda • Presentation of Kura architecture for Java and OSGi based multi service gateway platforms. (Walt, 15 mins) Presentation

+

Evaluate  the  Sessions

Sign  in  and  vote  at  eclipsecon.org

-­ 1 + 10