EnOcean Link  1.14.0.0
Middleware to Connect EnOcean easily to other Projects
eoGenericProfile.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 
29 
30 #if !defined(EO_GENERIC_PROFILE_H)
31 #define EO_GENERIC_PROFILE_H
32 #include "eoGPChannelInfo.h"
33 #include "eoProfile.h"
34 #include <vector>
36 #define GP_MANUFACTURER_LEN 11
37 #define GP_PURPOSE_LEN 2
39 #define GP_DATA_DIRECTION_LEN 1
41 
43 #define GP_MANUFACTURER_OFF 0
44 #define GP_PURPOSE_OFF 12
46 #define GP_DATA_DIRECTION_OFF 11
48 
52 typedef enum
53 {
54  GP_TEACH_IN = 0, GP_TEACH_OUT, GP_TEACH_IN_OUT, RESP_NA
60 typedef enum
61 {
62  UNIDIRECTIONAL = 0, BIDIRECTIONAL
74 {
75 public:
81  eoGenericProfile(uint16_t msgLength);
82 
87 
88  virtual ~eoGenericProfile();
93  void AllowTeachIN();
97  bool operator==(const eoGenericProfile &othProfile) const;
101  bool operator!=(const eoGenericProfile &othProfile) const;
102 
122  eoReturn Create(eoMessage &m,std::vector<int> channelNumbers);
145  eoReturn Parse(const eoMessage &msg);
146  eoReturn GetValue(uint8_t u8ChannelNumber, float &value);
147  eoReturn GetValue(uint8_t u8ChannelNumber, uint8_t &value);
148  eoReturn GetValue(uint8_t u8ChannelNumber, uint32_t &value);
149  eoReturn GetValue(CHANNEL_TYPE type, float &value);
150  eoReturn GetValue(CHANNEL_TYPE type, uint8_t &value);
151  eoReturn GetValue(CHANNEL_TYPE type, uint32_t &value);
152  eoReturn GetValue(CHANNEL_TYPE type, uint8_t &value, uint8_t subFlag);
153  eoReturn GetValue(CHANNEL_TYPE type, uint32_t &value, uint8_t subFlag);
154  eoReturn GetValue(CHANNEL_TYPE type, float &value, uint8_t subFlag);
155 
156  //Using channelnummber
157 
158  eoReturn SetValue(uint8_t u8ChannelNumber, float value);
159  eoReturn SetValue(uint8_t u8ChannelNumber, uint8_t value);
160  eoReturn SetValue(uint8_t u8ChannelNumber, uint32_t value);
161  eoReturn SetValue(CHANNEL_TYPE type, uint32_t value);
162  eoReturn SetValue(CHANNEL_TYPE type, float value);
163  eoReturn SetValue(CHANNEL_TYPE type, uint8_t value);
164  eoReturn SetValue(CHANNEL_TYPE type, uint8_t value, uint8_t subFlag);
165  eoReturn SetValue(CHANNEL_TYPE type, uint32_t value, uint8_t subFlag);
166  eoReturn SetValue(CHANNEL_TYPE type, float value, uint8_t subFlag);
167 
168  eoReturn SetType(uint8_t type);
169  //eoReturn AddChannel(eoGPChannelInfo myChannel);
181  eoReturn AddChannel(CHANNEL_TYPE type, GP_RESOLUTION resolution, int8_t engMaximum, int8_t engMinimum, GP_SCALING scaleMaximum, GP_SCALING scaleMinimum, VALUE_TYPE valueType);
193  eoReturn AddChannelOut(CHANNEL_TYPE type, GP_RESOLUTION resolution, int8_t engMaximum, int8_t engMinimum, GP_SCALING scaleMaximum, GP_SCALING scaleMinimum, VALUE_TYPE valueType);
235  eoChannelInfo* GetChannel(uint8_t channelNumber);
247  eoChannelInfo* GetChannelOut(uint8_t channelNumber);
258  eoChannelInfo* GetChannel(CHANNEL_TYPE type, uint8_t subType);
266  eoChannelInfo* GetChannelOut(CHANNEL_TYPE type, uint8_t subType);
271  uint8_t GetChannelCount() const;
276  uint8_t GetChannelCountOut() const;
280  void ClearChannels();
284  void ClearChannelsOut();
285  /*
286  * Clears Channel Information and internal buffer
287  */
288  void ClearValues();
289 
290  uint8_t Serialize(eoArchive &a);
295  uint32_t GetProductId();
300  void SetProductId(const uint32_t prodId);
301 
302  virtual eoReturn Create(eoMessage &msg);
303 
304 private:
305  static uint8_t GetGPSignal(CHANNEL_TYPE eoChannel);
306  eoReturn CreateChannels(const eoMessage &msg);
307  std::vector<eoGPChannelInfo> gpChannels;
308  std::vector<eoGPChannelInfo> gpChannelsOut;
309  uint16_t curBitOffset;
310  uint16_t curBitOffsetOut;
311 
312  bool parseTeachIn;
313  uint32_t productId;
314 
315 };
316 #endif // !defined(EA_4EAE7E47_D018_4877_903B_B66D2DDE6E02__INCLUDED_)
eoReturn SetType(uint8_t type)
bool operator!=(const eoGenericProfile &othProfile) const
uint8_t GetChannelCount() const
Enocean GP channel Informations.
GP_HEADER_PURPOSE
Purpose of the Teach IN Message.
Definition: eoGenericProfile.h:52
void ClearChannelsOut()
eoReturn Parse(const eoMessage &msg)
GP_SCALING
Generic Profile Channel Scaling.
Definition: eoGPChannelInfo.h:80
uint8_t type
Type.
Definition: eoProfile.h:69
eoMessage msg
helper function to convert bits
Definition: eoProfile.h:302
Message Class for communication.
Definition: eoMessage.h:47
eoChannelInfo * GetChannelOut(CHANNEL_TYPE type)
GP_HEADER_PURPOSE purpose
Teach-In Purpose.
Definition: eoGenericProfile.h:84
GP_DATA_DIRECTION dataDirection
Data direction.
Definition: eoGenericProfile.h:86
uint8_t Serialize(eoArchive &a)
Serialization Function which will be called by the eoStorageManager.
GP_RESOLUTION
Generic Profile Channel Resolution.
Definition: eoGPChannelInfo.h:59
The class to handle Generic Profiles.
Definition: eoGenericProfile.h:73
Abstract class for channel information. Abstract class for channel information. From this class speci...
Definition: eoChannelInfo.h:77
eoReturn AddChannelOut(CHANNEL_TYPE type, GP_RESOLUTION resolution, int8_t engMaximum, int8_t engMinimum, GP_SCALING scaleMaximum, GP_SCALING scaleMinimum, VALUE_TYPE valueType)
eoReturn ParseSelData(const eoMessage &msg)
VALUE_TYPE
Value types.
Definition: eoChannelEnums.h:577
eoReturn
contains all the return values from different functions
Definition: eoApiDef.h:40
uint32_t GetProductId()
eoChannelInfo * GetChannel(CHANNEL_TYPE type)
void SetProductId(const uint32_t prodId)
eoReturn AddChannel(CHANNEL_TYPE type, GP_RESOLUTION resolution, int8_t engMaximum, int8_t engMinimum, GP_SCALING scaleMaximum, GP_SCALING scaleMinimum, VALUE_TYPE valueType)
CHANNEL_TYPE
Definition: eoChannelEnums.h:169
GP_DATA_DIRECTION
Generic Profile Data Direction Information, informs if the Profile is unidirectional or bidirectional...
Definition: eoGenericProfile.h:60
base class for Profile parsing
Definition: eoProfile.h:61
uint8_t GetChannelCountOut() const
eoReturn CreateTeachIN(eoMessage &msg)
creates Teach In Messsage
bool operator==(const eoGenericProfile &othProfile) const
eoReturn Create(eoMessage &m, std::vector< int > channelNumbers)
creates Selective Data Message
the base Archive
Definition: eoArchive.h:46
eoReturn ParseTeachIN(const eoMessage &msg)