EnOcean Link  1.14.0.0
Middleware to Connect EnOcean easily to other Projects
Step by Step

Introduction

Note
EoLink 1.11.0.0 changed to CMAKE as generator, and this Step by Step guide shows the usage of the CMAKE Gui to get started fast.

This Step by Step Guide will help you to get your first project to compile with your favourite IDE. The shown example use Visual Studio.

  • Install Cmake
  • Compile and Start the Hello World

If you want to know more about CMAKE and the Usage please refer to https://cmake.org/. General usage of the cmake tools can be read here https://cmake.org/runningcmake/

Installing CMAKE

Download the latest cmake release from https://cmake.org/download/ or install it using package manager tools. For example

sudo apt-get install gcc g++ cmake

This will download&install cmake, gcc and g++ for compiling eolink on a linux system.

Note
CMAKE works as generator for different IDE/Build systems and you can use e.g. Visual Studio,Eclipse,make files,ninja or other tools.

Running CMake

Execute the cmake gui and select as path where the SourceCode is, the folder containing the EoLink SourceCode and the CMakeLists.txt

cmake1.png

Use configure to select the generator you want to use (in our examples Visual Studio 2017)

cmake2.png

After configuring you can generate the solution file (build files) for EoLink based on your generator.

cmake3.png

Afterwards open the solution file and open the HelloWorld example.

cmake4_vs.png

Now you can open the HelloWorld.cpp, which implements a eoLink Receiver using the USB300, or you can test the application by pressing the run button(green arrow).

Hello World - the Code.

The first few lines set the serial Port to the rigth device.

The eoLink Header is included from the EOLink project, which contains the SourceCode of eoLink.

#define SER_PORT "/dev/USB300"
#include "./eoLink.h"
#include <stdio.h>
Note
for Windows the SER_PORT has a name like "\\\\.\\COM35". Using Dolphin View you can look up the COM PORT you need to use.

In the main function we first define an eoGateway and try to open a connection to our device

//First a Gateway will be defined
eoGateway myGateway;
//This tries to open an connection to the USB300 or fails otherwise
printf("Opening Connection to USB300 \n");
if (myGateway.Open(SER_PORT)!=EO_OK)
{
printf("Failed to open USB300\n");
return 0;
}
printf("Hello to the world of eoLink\n");

Now we can use an eoCommonCommand command to read the version and the application of the connected enoceanGateway Device

if(myGateway.commands.ReadVersion(version)==EO_OK)
printf("%s %i.%i.%i.%i, ID:0x%08lX on %s\n",
version.appDescription,
version.appVersion[0], version.appVersion[1], version.appVersion[2], version.appVersion[3],
version.chipID,
SER_PORT);

We use a variable recv to parse the RECEIVE_FLAGS from eoGateway::Receive(). We put the receive functionallity in an endless loop and if we've received a telegram, we print it out.

uint16_t recv;
while(1)
{
recv = myGateway.Receive();
if (recv & RECV_TELEGRAM)
}

Pressing the green arrow you can run the Target.

Continue Reading

Now you can continue with the Tutorials or you can read up about eoGateway and how to use it.