EnOcean Link
1.14.0.0
Middleware to Connect EnOcean easily to other Projects
|
The Source Code of this Tutorial can be found here: tutorial1.cpp
This Tutorial will help you to understand the base concept of an eoGateway,eoStorageManager and the concept of Filter eoIDFilter,eodBmFilter.
After starting up the example, it will a be definied Time in learnMode for near field Devices. These learned in Devices and their configuration will be stored using the eoStorageManager. To start developing an eoLink application you've either to include the SourceCode or a preCompiled library to your linker, and include the "eoLink.h" file.
In our example we use some defines, to change the LearnTime,the config FileName and the device to use.
To receive Telegrams we need an eoGateway and connect it via eoGateway::Open to an EnOcean Gateway Device like the USB300.
If the connection is stable, we could now start to receive Telegrams, but we want only to receive Telegrams which are in the near Field range. To archieve this we add to our Gateway Class an eodBmFilter.
As we want to see in the Normal Mode only Telegrams from learned IN devices, we've to add an eoIDFilter.
Now we're nearly ready to receive and handle the Packets but to do so we need an uint16_t variable to handle the ReturnFlags of the eoGateway::Receive Function.
And as we want to stay only a short time, after the startup, in learnMode we've to add some variables which check the passed Time.We're gonna use Time::getTickCount(), which increases every 10ms the Tick amount.
In this case we say we want to TeachIN devices which either send a 4BS TeachIN telegram, or if we get a RPS telegram, that we TeachIN a 4Button Rocker.
As the RPS Profiles don't have a TeachIN message we've to set the profile manually.
Now we only have to change from the normal gateway mode to the learnMode.
To store an Object, which has the ISerialize interface implemented, you use the eoStorageManager and add Objects to handle to the Manager.
Now you've a text file, containing all the learned-in devices, which you can use for other applications.
This example application now just shows the incoming data of TeachIN devices, and if the profile is Supported, the Values are printed in clear Text.