EnOcean Link
1.14.0.0
Middleware to Connect EnOcean easily to other Projects
|
EnOcean Gateway class, for handling a gateway Module. More...
#include <eoGateway.h>
Public Member Functions | |
void | LearnModeOn () |
Activates Learn Mode. | |
void | LearnModeOff () |
Deactivates Learn Mode. | |
uint32_t | GetSecWatchResult () const |
Returns the security Result of the eoIWatcher Interface. | |
eoGateway () | |
eoGateway (eoDeviceManager *devManager) | |
eoGateway (eoPacketStream *str) | |
eoGateway (eoPacketStream *str, eoDeviceManager *devManager) | |
eoGateway (eoPacketStream *str, eoDeviceManager *devManager, eoIFilter *normFilter, eoIFilter *lrnFilter) | |
uint16_t | Receive () |
Handles received Telegrams. More... | |
virtual eoReturn | Send (const eoPacket &p) |
virtual eoReturn | Send (const eoMessage &msg) |
virtual eoReturn | Send (const eoReManMessage &reMsg, bool shallBeRepeated=false, uint8_t keyToUse=0) |
virtual eoReturn | Send (const eoMaintenanceMessage &manMsg) |
eoReturn | Open (const char *port) |
void | Close () |
uint8_t | Serialize (eoArchive &arch) |
Serialization Function which will be called by the eoStorageManager. More... | |
Public Attributes | |
eoPacketStream * | stream |
Pointer to the eoPacketStream Handler. | |
eoTeachInModule * | TeachInModule |
Pointer to eoTeachInModule. | |
eoDeviceManager * | deviceManager |
Pointer to the device manager, handling your Devices. | |
eoIFilter * | filter |
eoIFilter * | learnFilter |
eoIWatcher * | secWatcher |
security Watcher to Use | |
bool | LearnMode |
When true, activates LearnMode until set to False. | |
uint8_t | errorCode |
contains the last Error Code from the receive function | |
eoDevice * | device |
Pointer to the device, to which the last received Telegram belongs. More... | |
eoPacket | packet |
received Packet data More... | |
eoPacket | responsePacket |
Response Packet after sending any sort of Packet/Message/Telegram with the Gateway. | |
eoTelegram | telegram |
received Telegram More... | |
eoTelegramERP2 | telegramERP2 |
received Telegram More... | |
eoMessage | message |
received Message More... | |
eoMaintenanceMessage | maintenanceMessage |
received Maintenance Message More... | |
eoReManMessage | reManMessage |
received Remote Management Message More... | |
eoSerialCommand | commands |
Common Commands. | |
bool | advancedMode |
ERP2 mode turned on. | |
eoSecurity | security |
Security handler for the gateway. | |
EnOcean Gateway class, for handling a gateway Module.
The eoGateway class, allows you to easily handle Packages received from an EnOcean Gateway module(USB300,TCM310...). with simple calls you can learn in Devices, add filters, check if you received a Message and send packets.
The eoGateway has two different modes the learnMode and the normalMode. After creating the eoGateway the Gateway is in the normalMode, the following steps explain the functionality of the receive function.
Learn MODE!
Uses the learnFilter (if it is set) to Filter telegrams. Always add the Device to device Manager(flag|=RECV_DEVICE_ADDED), when it is a Security Teach IN, store secure Information. The eoGateway::device is set accordingly.
When an EEP Teach IN telegram is received, it is handled by the eoTeachInModule. If the telegram contains the func,type the right eoProfile will be created. As for rps no Teach IN telegram is specified you've to use eoTeachInModule::SetRPS function.
If you receive a second Teach IN from a learned IN EEP device the RECV_SECTEACHIN will be set.
eoGateway::eoGateway | ( | ) |
Creates your EnOcean gateway class, with the hardware specific PacketStream Handler and a new DeviceManager
eoGateway::eoGateway | ( | eoDeviceManager * | devManager | ) |
Creates your EnOcean gateway class, with the hardware specific PacketStream Handler.
devManager | - creates a Gateway with a specified eoDeviceManager. |
eoGateway::eoGateway | ( | eoPacketStream * | str | ) |
Creates your EnOcean gateway class.
str | - creates a Gateway with a specified eoPacketStream. |
eoGateway::eoGateway | ( | eoPacketStream * | str, |
eoDeviceManager * | devManager | ||
) |
Creates your EnOcean gateway class.
str | - creates a Gateway with a specified eoPacketStream. |
devManager | - creates a Gateway with a specified eoDeviceManager. |
eoGateway::eoGateway | ( | eoPacketStream * | str, |
eoDeviceManager * | devManager, | ||
eoIFilter * | normFilter, | ||
eoIFilter * | lrnFilter | ||
) |
Creates your EnOcean gateway class.
str | - creates a Gateway with a specified eoPacketStream. |
devManager | - creates a Gateway with a specified eoDeviceManager. |
normFilter | - creates a Gateway with a specified filter for data communication. |
lrnFilter | - creates a Gateway with a specified filter for learn process. |
void eoGateway::Close | ( | ) |
Closes the connection.
eoReturn eoGateway::Open | ( | const char * | port | ) |
Tries to open a connection to the specified Port
port | to open; for example "/dev/ttyUSB0" |
uint16_t eoGateway::Receive | ( | ) |
Handles received Telegrams.
The receive function handles all incoming Packets.
Depending if we're in LearnMode or not the handling differs. In normal mode:
When a packet has been received (RECV_PACKET), it automatically tries to decode as much as possible from the Packet.
If the Packet contains a Telegram the Telegram variable will be filled if it is not filtered from the filter, (RECV_TELEGRAM)
If the Packet contains a ERP2 Telegram the Telegram variable will be filled if it is not filtered from the filter, (RECV_ERP2_TELEGRAM)
If the Telegram is a chained Message or a valid standalone telegram, the message will be filled(RECV_MESSAGE)
If the Telegram is secured and the device is learn_in the telegram will be decrypted (RECV_TELEGRAM_SEC)
If the Telegram is from a learned in EEP or GP Device the profile Information will be set (RECV_PROFILE)
In LearnMode data will handled as in normal mode but the learnFilter will be used to Filter telegram & Devices will be learned in as specified in the [EEP] or [GP] document.
When a second 4BS or 1BS Teach IN telegram from the same devices gets received, the RECV_SECTEACHIN flag will be set.
If you're in normal mode, a RECV_TEACHIN flag will be set for 4BS and 1BS Teach IN telegrams, but the device&&profile will not be learned in!
*
sends Packet to the connected device
p | Packet to send |
|
virtual |
sends a Message via the connected device
reMsg | Remote Management Message to send |
set | repeat flag |
encrypt | the reman message using key 1-15 (0 means unsecured) |
|
virtual |
This sends an eoMaintenanceMessage via the Connected Device. The gateway automatically tries to encrypt the Message if the Destination ID is a know Device (in the deviceManager), and it is "decrypted",
manMsg | Maintenance Message to send |
|
virtual |
Serialization Function which will be called by the eoStorageManager.
This function will be called by the eoArchive(inside of the eoStorageManager) and allows the class to be Serialized.
arch | archive where to Load or to Store. |
Implements eoISerialize.
eoDevice* eoGateway::device |
Pointer to the device, to which the last received Telegram belongs.
eoIFilter* eoGateway::filter |
when this Filter points to a Filter implementation, the received telegram will be filtered while not in learn Mode.
eoIFilter* eoGateway::learnFilter |
This filter will bes used in learnMod
eoMaintenanceMessage eoGateway::maintenanceMessage |
received Maintenance Message
eoMessage eoGateway::message |
received Message
eoPacket eoGateway::packet |
received Packet data
eoReManMessage eoGateway::reManMessage |
received Remote Management Message
eoTelegram eoGateway::telegram |
received Telegram
eoTelegramERP2 eoGateway::telegramERP2 |
received Telegram