EnOcean Link  1.14.0.0
Middleware to Connect EnOcean easily to other Projects
eoTeachInModule.h
Go to the documentation of this file.
1 /******************************************************************************
2  DISCLAIMER
3 
4  THIS SOFTWARE PRODUCT ("SOFTWARE") IS PROPRIETARY TO ENOCEAN GMBH, OBERHACHING,
5  GERMANY (THE "OWNER") AND IS PROTECTED BY COPYRIGHT AND INTERNATIONAL TREATIES OR
6  PROTECTED AS TRADE SECRET OR AS OTHER INTELLECTUAL PROPERTY RIGHT. ALL RIGHTS, TITLE AND
7  INTEREST IN AND TO THE SOFTWARE, INCLUDING ANY COPYRIGHT, TRADE SECRET OR ANY OTHER
8  INTELLECTUAL PROPERTY EMBODIED IN THE SOFTWARE, AND ANY RIGHTS TO REPRODUCE,
9  DISTRIBUTE, MODIFY, DISPLAY OR OTHERWISE USE THE SOFTWARE SHALL EXCLUSIVELY VEST IN THE
10  OWNER. ANY UNAUTHORIZED REPRODUCTION, DISTRIBUTION, MODIFICATION, DISPLAY OR OTHER
11  USE OF THE SOFTWARE WITHOUT THE EXPLICIT PERMISSION OF OWNER IS PROHIBITED AND WILL
12  CONSTITUTE AN INFRINGEMENT OF THE OWNER'S RIGHT AND MAY BE SUBJECT TO CIVIL OR
13  CRIMINAL SANCTION.
14 
15  THIS SOFTWARE IS PROVIDED BY THE OWNER "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
16  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
17  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN PARTICULAR, THE OWNER DOES NOT WARRANT
18  THAT THE SOFTWARE SHALL BE ERROR FREE AND WORKS WITHOUT INTERRUPTION.
19 
20  IN NO EVENT SHALL THE OWNER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  ******************************************************************************/
27 
33 #ifndef EO_TEACH_IN_MODULE_H_
34 #define EO_TEACH_IN_MODULE_H_
35 #include "eoHalTypes.h"
36 #include "eoMessage.h"
37 #include "eoDevice.h"
38 #include "eoISerialize.h"
39 #include "eoUTEHelper.h"
40 
41 class eoDeviceManager;
42 class eoSecurity;
43 
44 #include <map>
45 
47 typedef struct
48 {
50  bool teachedIN;
51 } TEACH_STRUCT;
52 
54 typedef enum
55 {
58  NEW_DEVICE,
60  EEP_TEACH_IN,
72 } TEACH_RETURN;
73 
78 typedef enum
79 {
80  RESP_REJECTED_GENERALLY = 0,
81  RESP_TEACHIN,
82  RESP_TEACHOUT,
83  RESP_REJECTED_CHANNELS
85 
87 typedef std::map<uint32_t, bool> teach_id_map;
98 {
99 
100 public:
106  eoTeachInModule(eoDeviceManager *eoDevManager, eoSecurity *sec);
107  virtual ~eoTeachInModule();
108 
114  void SetRPS(uint8_t func, uint8_t type);
120  void Set1BS(uint8_t func, uint8_t type);
126  void Set4BS(uint8_t func, uint8_t type);
149 
163  TEACH_RETURN TeachIN(uint8_t rorg,uint8_t func,uint8_t type,uint32_t device_id);
168  void SetAutoTeachOut(bool enable)
169  {
170  allowAutoTeachOut = enable;
171  };
176  {
177  return allowAutoTeachOut;
178  };
183  void TeachOut(uint32_t id);
189  static bool isTeachIN(eoMessage &telegram);
195  bool isTeachedIN(eoMessage &telegram) ;
201  bool isTeachedIN(eoDevice &dev) ;
207  bool isTeachedIN(uint32_t deviceID,uint8_t u8Rorg = 0xFF);
215  DEPRECATED(eoReturn ParseUTE(eoMessage &msg));
226  DEPRECATED(eoReturn CreateUTEResponse(eoMessage &teachInUTE, eoMessage &responseUTE, UTE_RESPONSE type, UTE_DIRECTION direction));
227 
228 
238  eoReturn CreateGPResponse (eoMessage &msg, uint16_t manId, uint32_t destinationId, GP_RESPONSE_RESULT response, eoProfile *profile);
239 
245  virtual uint8_t Serialize(eoArchive &arch);
251 
252 
253 private:
254  teach_id_map teachInformation;
255  eoSecurity *security;
256  eoDeviceManager * deviceManager;
257  uint8_t rps_func, rps_type, bs1_func, bs1_type, bs4_func, bs4_type;
258  UTE_EEP_TEACH_IN_QUERY uteQuery;
259  bool allowAutoTeachOut;
260 
261  bool IsDuplicatedSimpleTeachInMessage(eoMessage & m);
262  bool LinkProfileToDevice(eoDevice * device, eoProfile * profile);
263 
264  friend class eoTeachMessageHandler;
265 
266 };
267 
268 
272 #endif // !defined(EA_62DB5BA2_ABF0_41c3_9291_81B05C9C37AD__INCLUDED_)
6- GP teach in
Definition: eoTeachInModule.h:69
5- RECEIVED A SECOND TEACH IN
Definition: eoTeachInModule.h:67
Interface for storing.
Definition: eoISerialize.h:48
std::map< uint32_t, bool > teach_id_map
Map type definition for teached devices.
Definition: eoTeachInModule.h:87
TEACH_RETURN TeachIN(eoMessage &m)
handles Teach IN Message
eoTeachInModule(eoDeviceManager *eoDevManager, eoSecurity *sec)
void TeachOut(uint32_t id)
2 - EEP teach in has been set
Definition: eoTeachInModule.h:61
eoReturn CreateGPResponse(eoMessage &msg, uint16_t manId, uint32_t destinationId, GP_RESPONSE_RESULT response, eoProfile *profile)
static bool isTeachIN(eoMessage &telegram)
a class to describe an EnOcean Device
Definition: eoDevice.h:49
Manages the devices.
Definition: eoDeviceManager.h:51
Message Class for communication.
Definition: eoMessage.h:47
1 -Added a new device
Definition: eoTeachInModule.h:59
UTE_EEP_TEACH_IN_QUERY GetUTEQuery()
7 Teach Out Request received
Definition: eoTeachInModule.h:71
UTE_DIRECTION
UTE Direction response codes.
Definition: eoUTEHelper.h:73
UTE_RESPONSE
UTE Response codes.
Definition: eoUTEHelper.h:39
TEACH_RETURN
Teach process return codes.
Definition: eoTeachInModule.h:54
GP_RESPONSE_RESULT
Result after a Teach IN.
Definition: eoTeachInModule.h:78
virtual uint8_t Serialize(eoArchive &arch)
Serialization Function which will be called by the eoStorageManager.
void Set4BS(uint8_t func, uint8_t type)
3- EEP teach in and new Device
Definition: eoTeachInModule.h:63
eoReturn
contains all the return values from different functions
Definition: eoApiDef.h:40
DEPRECATED(eoReturn ParseUTE(eoMessage &msg))
0 -Tried to add an object with the same name, which differ!
Definition: eoTeachInModule.h:57
void SetRPS(uint8_t func, uint8_t type)
bool teachedIN
Teached in.
Definition: eoTeachInModule.h:50
handles EnOcean Security Telegrams
Definition: eoSecurity.h:53
base class for Profile parsing
Definition: eoProfile.h:61
handles TeachIn Messages
Definition: eoTeachInModule.h:97
bool GetAutoTeachOut()
Definition: eoTeachInModule.h:175
eoDevice
bool isTeachedIN(eoMessage &telegram)
void SetAutoTeachOut(bool enable)
Definition: eoTeachInModule.h:168
Teach message structure.
Definition: eoTeachInModule.h:47
void Set1BS(uint8_t func, uint8_t type)
4- SECURITY Teach IN
Definition: eoTeachInModule.h:65
Helper Structure for eep teach in Queries.
Definition: eoUTEHelper.h:82
the base Archive
Definition: eoArchive.h:46