EnOcean Link  1.14.0.0
Middleware to Connect EnOcean easily to other Projects
tutorial4.cpp
#ifdef WIN32
#define SER_PORT "\\\\.\\COM3" //COM43
#else
#define SER_PORT "/dev/ttyUSB0"
#endif
#define SAVE_CONFIG "./learned.txt"
#define LEARN_TIME_S 1
#include "./eoLink.h"
#include <stdio.h>
int main(int argc, const char* argv[])
{
(void)argc;
(void)argv;
eoGateway myGateway;
uint16_t recv=0;
printf("Opening Connection to USB300 \n");
if (myGateway.Open(SER_PORT)!=EO_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;
}