SDK Tutorial Overview

Last modified by David Nestle on 2017/08/02 15:43

Tutorials

How to write an OGEMA application

Make sure you have downloaded the SDK before starting the tutorial. Then follow these steps to get acquainted with OGEMA, and learn how to program applications. It guides you through the creation of your first OGEMA applications, and introduces you to a couple of useful system apps and best practices along the way.

How to write a hardware driver for OGEMA

OGEMA drivers connect the OGEMA database with outside data sources and sinks. A typical driver e.g. reads a value from a sensor and writes it into an OGEMA resource or reads from an OGEMA resource and sends a setpoint to an actor/device. But also external data from cloud servers, from the file system or from other local computers (PC, mobile device, ...) can be integrated into OGEMA via a driver.

Although the structure of a typical driver differs a bit from an app drivers are also OGEMA apps from a technical point of view. So we recommend to go through the initial tutorial first before starting into the drivers examples.

More details on the drivers available and the development of new drivers is provided on How to write a hardware driver for OGEMA

HowTo pages

Reference pages

The OGEMA Wiki (https://ogema-source.net/wiki/display/OGEMA/OGEMA+Home) contains many more pages dedicated to specific concepts, such as:

Example Apps and Drivers

A set of example apps is available via Github: https://github.com/ogema/tutorial. In decending order of complexity:

  • hello-ogema: illustrates the basic setup of an OGEMA application, using a timer.
  • sensor-app: illustrates the use of listeners, and access to the OGEMA database by means of pattern declarations.
  • window-heat-control: a sample app that interacts with different types of devices, including window sensors, thermostats and a battery. Whenever a window is opened in a room, it reduces the thermostat temperature setpoints for this room. Furthermore, it provides a simple user interface for configuring the target temperature, individually for the managed rooms. This example comes closer to a production-ready app, already. 

Besides the apps, there are two examples of drivers available in the tutorial repository:

  • schedule-csv-driver: reads timeseries from csv files and stores them in a schedule, the OGEMA format for persistent timeseries
  • sample-androiddriver: illustrates the interaction between an Android app and the OGEMA gateway, via the OGEMA REST interface.

Get tutorial apps from Github

In Eclipse go to Window->Show Perspective->Other->Git. Then click on the second icon above the left column names "Git" ("Clone a Git Repository..."). Then enter the following access data:

Github_cloneDialog.png

Github_cloneDialog.png

Now you can checkout tutorial projects:

In Eclipse go to "Window" -> Perspective -> Open Perspective -> Other, then choose "Git"

OpenPerspective.png

Afterwards you can always get back directly to this perspective using the button at the top right. Open ogema-Github repository, open "Working Tree"->src. You can now import OGEMA Apps as Maven projects: Select the projects to import, right-click and select "Import Maven Projects...", then click Finish. You should then see the project in your Eclipse Package Explorer of the Java perspective.

Tags:
Created by Jan Lapp on 2017/01/20 08:50