EnOcean Link  1.14.0.0
Middleware to Connect EnOcean easily to other Projects
eoProfile.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 __EOPROFILE_INCLUDED_
34 #define __EOPROFILE_INCLUDED_
35 
36 #include "eoApiDef.h"
37 #include "eoChannelInfo.h"
38 #include "eoHalTypes.h"
39 #include "eoMessage.h"
40 #include "eoISerialize.h"
41 #include "eoArchive.h"
42 #include "eoGPChannelInfo.h"
43 #include <vector>
44 
61 class eoProfile: public eoISerialize
62 {
63 public:
65  uint8_t rorg;
67  uint8_t func;
69  uint8_t type;
71  uint16_t manufacturer;
72 
76  eoProfile(uint16_t size = 0);
77  virtual ~eoProfile();
78 
84  virtual bool operator==(const eoProfile &othProfile) const;
85 
91  virtual bool operator!=(const eoProfile &othProfile) const;
92 
98  virtual bool IsSecDData(const eoMessage &message);
102  virtual void ClearValues();
103  //virtual int LearnIn(uint8_t rorg, uint8_t func, uint8_t type);
104  //virtual void LearnIn(Message m, Device d);
111  virtual eoReturn Create(eoMessage &m);
118  virtual eoReturn CreateTeachIN(eoMessage &m);
125  virtual eoReturn Parse(const eoMessage &msg);
136  //virtual uint8_t GetValue(uint8_t chanNumb,uint16_t &type, float &value);//?
137  virtual eoReturn GetValue(CHANNEL_TYPE type, float &value);
138 
150  virtual eoReturn GetValue(CHANNEL_TYPE type, float &value, uint8_t subFlag);
162  virtual eoReturn GetValue(CHANNEL_TYPE type, uint8_t &value, uint8_t subFlag);
163  virtual eoReturn GetValue(CHANNEL_TYPE type, uint32_t& value, uint8_t subFlag);
164  virtual eoReturn GetValue(CHANNEL_TYPE type, uint64_t& value, uint8_t subFlag);
176  virtual eoReturn SetValue(CHANNEL_TYPE type, float value, uint8_t subFlag);
177 
189  virtual eoReturn SetValue(CHANNEL_TYPE type, uint64_t value, uint8_t subFlag);
201  virtual eoReturn GetValue(CHANNEL_TYPE type, uint8_t &value);
202 
203  virtual eoReturn GetValue(CHANNEL_TYPE type, uint32_t& value);
204  //virtual eoReturn GetValue(CHANNEL_TYPE type, uint64_t& value);
216  virtual eoReturn SetValue(CHANNEL_TYPE type, uint8_t value, uint8_t subFlag);
217 
218  virtual eoReturn SetValue(CHANNEL_TYPE type, uint32_t value, uint8_t subFlag);
219 
231  virtual eoReturn SetValue(CHANNEL_TYPE type, float value);
242  virtual eoReturn SetValue(CHANNEL_TYPE type, uint8_t value);
243  //Set value
244  virtual eoReturn SetValue(CHANNEL_TYPE type, uint32_t value);
245  //virtual eoReturn SetValue(CHANNEL_TYPE type, uint64_t value);
252  virtual eoChannelInfo* GetChannel(CHANNEL_TYPE type, uint8_t subType);
253 
259  virtual eoChannelInfo* GetChannel(CHANNEL_TYPE type);
260 
266  virtual eoChannelInfo* GetChannel(uint8_t channelNumber);
267 
274  virtual eoReturn GetSubTypeChannel(CHANNEL_TYPE type, std::vector<eoEEPChannelInfo*>& vector);
275 
282  virtual eoReturn SetType(uint8_t type);
283 
284  virtual uint8_t Serialize(eoArchive &a);
289  virtual uint8_t GetChannelCount() const;
290 
295  eoReturn SetManufacturer (uint16_t manufacturerID);
296 
297 private:
298 
299  static uint16_t BitIdxToByte(const uint16_t &bitIdx);
300 protected:
301  //char profileString[10];
315  static float ScaleFromRAW(uint32_t rawValue, uint32_t rangeMin, uint32_t rangeMax, double scaleMin, double scaleMax);
328  static uint32_t ScaleToRAW(float value, uint32_t rangeMin, uint32_t rangeMax, double scaleMin, double scaleMax);
329 
331  const static uint8_t maskArray[8];
341  static eoReturn GetRawValue(const eoMessage &msg, uint32_t &value, uint16_t offset, uint8_t size);
342 
353  static eoReturn SetRawValue(eoMessage &msg, uint32_t value, uint16_t offset, uint8_t size);
354 
355 };
356 //static eoProfile emptyProfile = eoProfile(0);
360 #endif // __EOPROFILE_INCLUDED_
contains base for Archives
virtual void ClearValues()
contains Dolphin API Definitions
virtual uint8_t Serialize(eoArchive &a)
Serialization Function which will be called by the eoStorageManager.
Enocean GP channel Informations.
virtual bool IsSecDData(const eoMessage &message)
Interface for storing.
Definition: eoISerialize.h:48
uint8_t type
Type.
Definition: eoProfile.h:69
eoMessage msg
helper function to convert bits
Definition: eoProfile.h:302
uint16_t manufacturer
Manufacturer.
Definition: eoProfile.h:71
uint8_t func
Func.
Definition: eoProfile.h:67
Message Class for communication.
Definition: eoMessage.h:47
virtual bool operator!=(const eoProfile &othProfile) const
static uint32_t ScaleToRAW(float value, uint32_t rangeMin, uint32_t rangeMax, double scaleMin, double scaleMax)
Creates Raw Value from a floating Point.
virtual eoReturn SetValue(CHANNEL_TYPE type, float value, uint8_t subFlag)
Gets the Value as a float.
virtual eoChannelInfo * GetChannel(CHANNEL_TYPE type, uint8_t subType)
virtual eoReturn GetSubTypeChannel(CHANNEL_TYPE type, std::vector< eoEEPChannelInfo *> &vector)
static const uint8_t maskArray[8]
Mask array.
Definition: eoProfile.h:331
virtual eoReturn CreateTeachIN(eoMessage &m)
Generates an EEP Telegram(only not chained supported!!1)
Abstract class for channel information. Abstract class for channel information. From this class speci...
Definition: eoChannelInfo.h:77
virtual bool operator==(const eoProfile &othProfile) const
eoReturn SetManufacturer(uint16_t manufacturerID)
eoReturn
contains all the return values from different functions
Definition: eoApiDef.h:40
virtual eoReturn GetValue(CHANNEL_TYPE type, float &value)
Gets the Value as Floating Point.
static eoReturn GetRawValue(const eoMessage &msg, uint32_t &value, uint16_t offset, uint8_t size)
Gives raw data Value from a Message.
eoProfile(uint16_t size=0)
static eoReturn SetRawValue(eoMessage &msg, uint32_t value, uint16_t offset, uint8_t size)
Inserts raw data Value in a message.
CHANNEL_TYPE
Definition: eoChannelEnums.h:169
base class for Profile parsing
Definition: eoProfile.h:61
virtual uint8_t GetChannelCount() const
static float ScaleFromRAW(uint32_t rawValue, uint32_t rangeMin, uint32_t rangeMax, double scaleMin, double scaleMax)
Creates floating Point from Raw Value.
virtual eoReturn SetType(uint8_t type)
uint8_t rorg
R-ORG.
Definition: eoProfile.h:65
contains the eoChannelInfo Class
virtual eoReturn Parse(const eoMessage &msg)
Parses a msg using learned in Profile from Device.
the base Archive
Definition: eoArchive.h:46
virtual eoReturn Create(eoMessage &m)
Generates an EEP Message.