Table of Contents

Tutorial: Getting Started Developing Kura CoAP Bundle (5 Minutes)

What is this about? Step-by-step guide to start with Kura bundle development in 5 Mins, Californium included!

Preparing development environment

FYI: We base on this guide: http://eclipse.github.io/kura/doc/kura-setup.html

Download and install Eclipse

Done!

mToolkit

What is this about? An additional plugin, mToolkit, is needed to allow remote connectivity to an OSGi framework on a Kura-enabled target device.

It sounds similar to the component that deploy app to a real Android device when we develop Android app.

Interesting but skip this for now.

Workspaces

What is this about? We create a place with everything needed to develop Kura bundles.

For automated installation see Oomph installer below. Don't do this! We create the magic, not just watch the show

Importing Kura User Workspace

What is this? Why… This contains some libs needed for the development.. maybe..

To set up your Kura project workspace, you will need to download the Kura User Workspace archive from here: https://www.eclipse.org/kura/downloads.php

The page contains Kura distribution for different platform. We are look for “Developer's Workspace”.

From the Eclipse File menu, select the Import option. In the Import dialog box, expand the General heading, select Existing Projects into Workspace, and then click Next.

Now click the Select archive file option button and browse to the archive file, it is userworkspacearchive_2.1.0.zip.

I optionally add them to a new working set called “USER_WORKSPACE”. Let's see what we have. There are now a bunch of projects, mostly examples. 2 interesting projects are

org.eclipse.kura.emulator - What? this is the Kura emulator, similar to Anroid phone emulator, maybe we can run our bundle with it locally on dev machine.

target-definition - What is this? Google says: The Target Platform refers to the plug-ins which your workspace will be built and run against. It describes the platform that you are developing for. Look at it we will find all bundles provided by Kura. So it our bundle can be built, it should run on Kura!

Add Californium to target-definition

Why? a few of our bundle will depend on Californium bundle. So it make sense to put it to target-definition and of course install the bundle when deploy Kura. How?

Right click project target-definition → New → Folder → name it “iotgw”

Download Californium to that folder (thanks http://stackoverflow.com/a/36405161/707704 for the information). Download link is here: http://mvnrepository.com/artifact/org.eclipse.californium/californium-osgi/1.0.5 (latest)

double-click kura-equinox3.11.1.target to open it → Add… → Installation → Location: ${workspaceloc}/target-definition/iotgw

Tell Eclipse to use the target-definition

Click the arrow next to the target-definition project in the workspace and double-click kura-equinox_3.11.1.target to open it.

In the Target Definition window, click the link Set as Target Platform. Doing so will reset the target platform, rebuild the Kura projects, and clear the errors that were reported. At this point, you are ready to begin developing Kura-based applications for your target platform.

Creating HelloWorld CoAP Server

FYI: We now based on this: http://eclipse.github.io/kura/doc/hello-example.html

Create eclipse plug-in project

Copy this to the project: https://github.com/eclipse/californium/blob/master/demo-apps/cf-helloworld-server/src/main/java/org/eclipse/californium/examples/HelloWorldServer.java

There are errors because our bundle does not know about californium bundles.

Add dependency to californium bundle

Click MANIFEST → dependencies → required plug-ins → add californium

Understanding CoAP, further reading

Kura tutorial

CoAP

Maven Project for Eclipse Plugin Development

Why this? CI Devops can not be automated with eclipse –

> maven-tycho-plugin

TODO..