EnOcean Link  1.14.0.0
Middleware to Connect EnOcean easily to other Projects
Tutorial 4

In this Tutorial tutorial4.cpp we Teach IN manual after a Teach IN telegram, and Teach Out if we receive a second one.

#define SER_PORT "/dev/USB300"
#define SAVE_CONFIG "./learned.txt"
#define LEARN_TIME_S 1
#include "./eoLink.h"
#include <stdio.h>
int main(int argc, const char* argv[]) {
eoGateway myGateway;
uint16_t recv=0;
printf("Opening Connection to USB300 \n");
if (myGateway.Open(SER_PORT)!=OK)
{
printf("Failed to open USB300\n");
return 0;
}
myGateway.TeachInModule->SetRPS(0x02,0x01);
myGateway.TeachInModule->Set1BS(0x00,0x01);
while (1)
{
recv = myGateway.Receive();
//Got a Profile
if (recv & RECV_SECTEACHIN)
{
myGateway.TeachInModule->TeachOut(myGateway.message.sourceID);
}
else if (recv & RECV_TEACHIN)
{
myGateway.TeachInModule->TeachIN(myGateway.message);
}
}
return 0;
}