Developing ESF Applications

ESF (Everyware Software Framework) is a Java OSGi software framework for M2M multiservice gateways, smart devices and IoT applications. ESF is a superset of Kura. i.e., it has more feature than Kura. With Reactive Blocks, you can development OSGi bundles for ESF as described in this article.

Updates

If you have used Reactive Blocks for ESF feature before, you simply need to update. Do the following steps: (Error markings during the update prosess are OK)

  • Choose Help → Check for Updates from the Eclipse menu.
  • Continue with the update as shown in Eclipse.
  • Delete the target-definition-esf project in your workspace
  • Download the zip file containing Reactive Blocks library bundles.
  • Import the projects in the zip file into your Eclipse workspace (make sure you choose Existing Projects into Workspace in the Import Wizard).
  • In the target-definition-esf project, open the file rb-esf-equinox_3.8.1.target.
  • Select the link Set as Target Platform on the top right of the target editor.

If you have developed OSGi applications with Reactive Blocks before, you may need to rebuild them.

Install Reactive Blocks for ESF

To install the Reactive Blocks for ESF feature, do the following steps:

  • Choose Help → Eclipse Marketplace from the Eclipse menu.
  • Search for reactive blocks.
  • Choose button Install.
  • Select Reactive Blocks for ESF feature and follow further instruction.

Install mToolkit

mToolkit is an Eclipse plugin that enables creation of deployment package and connection to a remote target device.

This plugin can be install from its update site:

  • Choose Help → Install New Software… from the Eclipse menu.
  • Fill in the update site http://mtoolkit-neon.s3-website-us-east-1.amazonaws.com.
  • Uncheck the option Group items by category.
  • Choose mToolkit and follow further instruction.

Development Environment Setup

In order to create a bundle for the ESF framework, you need to change the target platform in your Eclipse workspace to include bundles for ESF and Reactive Blocks libraries. It is advisable to first switch to a new workspace.

  • Download ESF developer’s workspace zip file from here (registration required, choose version 3.3.1 and then the Developer Environment tab).
  • Also download the zip file containing Reactive Blocks library bundles
  • Import the projects in those two zip files into your Eclipse workspace (make sure you choose Existing Projects into Workspace in the Import Wizard).
  • In the target-definition-esf project, open the file rb-esf-equinox_3.8.1.target.
  • Select the link Set as Target Platform on the top right.

Create a ESF Application Block

Before making an OSGi bundle for ESF, we first create a Reactive Blocks plug-in project.

Then, create an OSGi application by invoking the new building block wizard. You can choose between two types of block depending whether the application is a configurable application.

  • Application Block
  • ESF Application with Configuration

If you choose application block with configuration option, you will get, in addition, a ‘metatype’ file for describing the configuration properties for your bundle. This file contains examples that you can modify.

Specify your application as usual, by connecting blocks and activity nodes. Import building blocks that you need from our collection. We provide also blocks to utilize ESF/Kura services.

To make the application receive configuration updates from the ESF/Kura platform, use the Config Update block. For more information, checkout this blogpost and tutorial.

Verify your specification with the analysis and animation tools.

Note that a Plug-in project must contain maximal one application block.

Depending on your application, you might need to import packages from other bundles, like californium for CoAP. Read About Dependency section to see how to add a bundle as project dependency.

Build an ESF Application

  • Right click on the application block and select Build → Re-Build for Java OSGi Bundle for ESF

You can also choose Select Build Target Platfrom… and then Java OSGi Bundle for ESF in the Platform selection dialog to change build parameters.

When the build process is completed, you should see a new source folder gen containing generated code from your application and also the corresponding component definition component.xml in the folder OSGI-INF

Depending on your application, the generated code may also need dependency to other packages or bundles. Read About Dependency section to see how to add a bundle as project dependency.

Run an ESF Application

ESF provides an emulator so that you can start ESF and your application in Eclipse. This emulator runs locally on your computer and currently supports OS X and Linux only.

You can also run your application on a remote target device, like Raspberry Pi.

Local Emulation Mode

A launch configuration to run ESF with Reactive Blocks libraries from within Eclipse is already provided.

  • In the target-definition-esf project, find a suitable launch configuration inside the launch folder.
  • Right-click and select Run As → 1 ESF_with_RB_Emulator_xxx.

You should see that ESF is running from the Console view. Your application is automatically run on the emulator.

On a Remote Target Device

You can run your application on a remote target device, like the ReliaGATE 10-20.

There are many ways to deploy a bundle on ESF. Here, we will use deployment packages and ESF’s web console.

Make a deployment package from your application as follows:

  • Find a .dpp file in your application project.
  • Do a right-click and choose Quick Build.
  • You should find a .dp file in the same project.

To deploy the package on ESF, follow these steps:

  • Open ESF’s web console using the IP address of your device. The default username and pasword is admin/admin.
  • From the menu on the left hand-side, choose Packages.
  • Remove other package you made with Reactive Blocks.
  • Choose the + Install/Upgrade button.
  • Navigate to the .dp file containing your application bundle.
  • You might need to use the Refresh button in order to see the package you installed.

Missing Dependency at Runtime

See here.