EnOcean Link  1.14.0.0
Middleware to Connect EnOcean easily to other Projects
eoGenericProfile Class Reference

The class to handle Generic Profiles. More...

#include <eoGenericProfile.h>

Inheritance diagram for eoGenericProfile:
Collaboration diagram for eoGenericProfile:

Public Member Functions

 eoGenericProfile (uint16_t msgLength)
 
void AllowTeachIN ()
 
bool operator== (const eoGenericProfile &othProfile) const
 
bool operator!= (const eoGenericProfile &othProfile) const
 
eoReturn CreateTeachIN (eoMessage &msg)
 creates Teach In Messsage More...
 
eoReturn Create (eoMessage &m, std::vector< int > channelNumbers)
 creates Selective Data Message More...
 
eoReturn ParseSelData (const eoMessage &msg)
 
eoReturn ParseTeachIN (const eoMessage &msg)
 
eoReturn Parse (const eoMessage &msg)
 
eoReturn GetValue (uint8_t u8ChannelNumber, float &value)
 
eoReturn GetValue (uint8_t u8ChannelNumber, uint8_t &value)
 
eoReturn GetValue (uint8_t u8ChannelNumber, uint32_t &value)
 
eoReturn GetValue (CHANNEL_TYPE type, float &value)
 Gets the Value as Floating Point. More...
 
eoReturn GetValue (CHANNEL_TYPE type, uint8_t &value)
 Sets the Value using a unsigned integer. More...
 
eoReturn GetValue (CHANNEL_TYPE type, uint32_t &value)
 
eoReturn GetValue (CHANNEL_TYPE type, uint8_t &value, uint8_t subFlag)
 Gets the Value as unsigned integer. More...
 
eoReturn GetValue (CHANNEL_TYPE type, uint32_t &value, uint8_t subFlag)
 
eoReturn GetValue (CHANNEL_TYPE type, float &value, uint8_t subFlag)
 Gets the Value as Floating point. More...
 
eoReturn SetValue (uint8_t u8ChannelNumber, float value)
 
eoReturn SetValue (uint8_t u8ChannelNumber, uint8_t value)
 
eoReturn SetValue (uint8_t u8ChannelNumber, uint32_t value)
 
eoReturn SetValue (CHANNEL_TYPE type, uint32_t value)
 
eoReturn SetValue (CHANNEL_TYPE type, float value)
 Sets the Value using a Floating Point. More...
 
eoReturn SetValue (CHANNEL_TYPE type, uint8_t value)
 Sets the Value using a uint8_t. More...
 
eoReturn SetValue (CHANNEL_TYPE type, uint8_t value, uint8_t subFlag)
 Gets the Value as unsigned integer. More...
 
eoReturn SetValue (CHANNEL_TYPE type, uint32_t value, uint8_t subFlag)
 
eoReturn SetValue (CHANNEL_TYPE type, float value, uint8_t subFlag)
 Gets the Value as a float. More...
 
eoReturn SetType (uint8_t type)
 
eoReturn AddChannel (CHANNEL_TYPE type, GP_RESOLUTION resolution, int8_t engMaximum, int8_t engMinimum, GP_SCALING scaleMaximum, GP_SCALING scaleMinimum, VALUE_TYPE valueType)
 
eoReturn AddChannelOut (CHANNEL_TYPE type, GP_RESOLUTION resolution, int8_t engMaximum, int8_t engMinimum, GP_SCALING scaleMaximum, GP_SCALING scaleMinimum, VALUE_TYPE valueType)
 
eoReturn AddChannel (CHANNEL_TYPE type, VALUE_TYPE valueType)
 
eoReturn AddChannelOut (CHANNEL_TYPE type, VALUE_TYPE valueType)
 
eoReturn AddChannel (CHANNEL_TYPE type, GP_RESOLUTION resolution, VALUE_TYPE valueType)
 
eoReturn AddChannelOut (CHANNEL_TYPE type, GP_RESOLUTION resolution, VALUE_TYPE valueType)
 
eoChannelInfoGetChannel (CHANNEL_TYPE type)
 
eoChannelInfoGetChannel (uint8_t channelNumber)
 
eoChannelInfoGetChannelOut (CHANNEL_TYPE type)
 
eoChannelInfoGetChannelOut (uint8_t channelNumber)
 
eoChannelInfoGetChannel (CHANNEL_TYPE type, uint8_t subType)
 
eoChannelInfoGetChannelOut (CHANNEL_TYPE type, uint8_t subType)
 
uint8_t GetChannelCount () const
 
uint8_t GetChannelCountOut () const
 
void ClearChannels ()
 
void ClearChannelsOut ()
 
void ClearValues ()
 
uint8_t Serialize (eoArchive &a)
 Serialization Function which will be called by the eoStorageManager. More...
 
uint32_t GetProductId ()
 
void SetProductId (const uint32_t prodId)
 
virtual eoReturn Create (eoMessage &msg)
 Generates an EEP Message. More...
 
- Public Member Functions inherited from eoProfile
 eoProfile (uint16_t size=0)
 
virtual bool operator== (const eoProfile &othProfile) const
 
virtual bool operator!= (const eoProfile &othProfile) const
 
virtual bool IsSecDData (const eoMessage &message)
 
virtual eoReturn GetValue (CHANNEL_TYPE type, uint64_t &value, uint8_t subFlag)
 
virtual eoReturn SetValue (CHANNEL_TYPE type, uint64_t value, uint8_t subFlag)
 Sets the Value as a 64-bit. More...
 
virtual eoReturn GetSubTypeChannel (CHANNEL_TYPE type, std::vector< eoEEPChannelInfo *> &vector)
 
eoReturn SetManufacturer (uint16_t manufacturerID)
 

Public Attributes

GP_HEADER_PURPOSE purpose
 Teach-In Purpose.
 
GP_DATA_DIRECTION dataDirection
 Data direction.
 
- Public Attributes inherited from eoProfile
uint8_t rorg
 R-ORG.
 
uint8_t func
 Func.
 
uint8_t type
 Type.
 
uint16_t manufacturer
 Manufacturer.
 

Additional Inherited Members

- Static Protected Member Functions inherited from eoProfile
static float ScaleFromRAW (uint32_t rawValue, uint32_t rangeMin, uint32_t rangeMax, double scaleMin, double scaleMax)
 Creates floating Point from Raw Value. More...
 
static uint32_t ScaleToRAW (float value, uint32_t rangeMin, uint32_t rangeMax, double scaleMin, double scaleMax)
 Creates Raw Value from a floating Point. More...
 
static eoReturn GetRawValue (const eoMessage &msg, uint32_t &value, uint16_t offset, uint8_t size)
 Gives raw data Value from a Message. More...
 
static eoReturn SetRawValue (eoMessage &msg, uint32_t value, uint16_t offset, uint8_t size)
 Inserts raw data Value in a message. More...
 
- Protected Attributes inherited from eoProfile
eoMessage msg
 helper function to convert bits
 
- Static Protected Attributes inherited from eoProfile
static const uint8_t maskArray [8]
 Mask array.
 

Detailed Description

The class to handle Generic Profiles.

The eoGenericProfile class allows the user to handle and teachIN genericProfils. Must Functions are the same as in the eoProfile class. For the user application the difference between a generic and an Enocean equipment profile is in most cases transparent.

The eoGenericProfile class adds some functions, to allow the user easy to create an own generic Profile and to manually parse external Teach IN Message.

Examples:
genericProfile_examples.cpp, and tutorial6.cpp.

Constructor & Destructor Documentation

◆ eoGenericProfile()

eoGenericProfile::eoGenericProfile ( uint16_t  msgLength)

Constructor

Parameters
msgLengthLength of the generic profile message.

Member Function Documentation

◆ AddChannel() [1/3]

eoReturn eoGenericProfile::AddChannel ( CHANNEL_TYPE  type,
GP_RESOLUTION  resolution,
int8_t  engMaximum,
int8_t  engMinimum,
GP_SCALING  scaleMaximum,
GP_SCALING  scaleMinimum,
VALUE_TYPE  valueType 
)

Adds an inbound Generic Profile Channel to this Generic Profile with the specified Values.

Parameters
type
resolution
engMaximum
engMinimum
scaleMaximum
scaleMinimum
valueType
Returns
Examples:
genericProfile_examples.cpp.

◆ AddChannel() [2/3]

eoReturn eoGenericProfile::AddChannel ( CHANNEL_TYPE  type,
VALUE_TYPE  valueType 
)

Allows you to add an inbound Flag Type Generic Channel

Parameters
type
valueType
Returns
EO_OK or NOT_SUPPORTED

◆ AddChannel() [3/3]

eoReturn eoGenericProfile::AddChannel ( CHANNEL_TYPE  type,
GP_RESOLUTION  resolution,
VALUE_TYPE  valueType 
)

Allows you to add an inbound ENUM Type Generic Channel

Parameters
typeType of the channel - signal,flag etc.
resolutionof the ENum
valueType
Returns
EO_OK or NOT_SUPPORTED

◆ AddChannelOut() [1/3]

eoReturn eoGenericProfile::AddChannelOut ( CHANNEL_TYPE  type,
GP_RESOLUTION  resolution,
int8_t  engMaximum,
int8_t  engMinimum,
GP_SCALING  scaleMaximum,
GP_SCALING  scaleMinimum,
VALUE_TYPE  valueType 
)

Adds an outband Generic Profile Channel to this Generic Profile with the specified Values.

Parameters
type
resolution
engMaximum
engMinimum
scaleMaximum
scaleMinimum
valueType
Returns
Examples:
genericProfile_examples.cpp, and tutorial6.cpp.

◆ AddChannelOut() [2/3]

eoReturn eoGenericProfile::AddChannelOut ( CHANNEL_TYPE  type,
VALUE_TYPE  valueType 
)

Allows you to add an outbound Flag Type Generic Channel

Parameters
type
valueType
Returns
EO_OK or NOT_SUPPORTED

◆ AddChannelOut() [3/3]

eoReturn eoGenericProfile::AddChannelOut ( CHANNEL_TYPE  type,
GP_RESOLUTION  resolution,
VALUE_TYPE  valueType 
)

Allows you to add an outband ENUM Type Generic Channel

Parameters
typeType of the channel - signal,flag etc.
resolutionof the ENum
valueType
Returns
EO_OK or NOT_SUPPORTED

◆ AllowTeachIN()

void eoGenericProfile::AllowTeachIN ( )

This function will activate the parsing for one Teach IN Telegram! After a parsing of a teachIN message the teachIN function will be deactivated again.

◆ ClearChannels()

void eoGenericProfile::ClearChannels ( )

Delete all channels and resets the genericProfile

◆ ClearChannelsOut()

void eoGenericProfile::ClearChannelsOut ( )

Delete all channels and resets the genericProfile

◆ ClearValues()

void eoGenericProfile::ClearValues ( )
virtual

All raw values of the internal Message will be set to zero.

Reimplemented from eoProfile.

Examples:
genericProfile_examples.cpp.

◆ Create() [1/2]

eoReturn eoGenericProfile::Create ( eoMessage m,
std::vector< int >  channelNumbers 
)

creates Selective Data Message

This function will create a Selective Data message as defined in the GenericProfile spec.

Parameters
msg
channelNumbers
Returns
Examples:
genericProfile_examples.cpp, and tutorial6.cpp.

◆ Create() [2/2]

virtual eoReturn eoGenericProfile::Create ( eoMessage m)
virtual

Generates an EEP Message.

This functions generates a Message for the specified EEP, with the current ChannelInfo values

Parameters
mReference to the Message (will be cleared and generated new)
Returns
eoReturn EO_OK,NOT_SUPPORTED,NOT_IMPLEMENTED

Reimplemented from eoProfile.

◆ CreateTeachIN()

eoReturn eoGenericProfile::CreateTeachIN ( eoMessage msg)
virtual

creates Teach In Messsage

This function will create a teach in message as defined in the GenericProfile spec. The outbound channels will be used as outbound channel. If inbound channels are set, the dataDirection will be set to bidirectional and the inbound channels will be added inside the "teach-in information"

Parameters
msg
Returns

Reimplemented from eoProfile.

Examples:
genericProfile_examples.cpp, and tutorial6.cpp.

◆ GetChannel() [1/3]

eoChannelInfo* eoGenericProfile::GetChannel ( CHANNEL_TYPE  type)
virtual

Returns the inbound channel for the selected type

Parameters
typeCHANNEL_TYPE
Returns
Pointer to ChannelInfo or Null

Reimplemented from eoProfile.

Examples:
genericProfile_examples.cpp.

◆ GetChannel() [2/3]

eoChannelInfo* eoGenericProfile::GetChannel ( uint8_t  channelNumber)
virtual

Returns the inbound channel for the selected channelnumber

Parameters
channelNumberchannelnumber
Returns
Pointer to ChannelInfo or Null

Reimplemented from eoProfile.

◆ GetChannel() [3/3]

eoChannelInfo* eoGenericProfile::GetChannel ( CHANNEL_TYPE  type,
uint8_t  subType 
)
virtual

This function allows you to access different inbound Channels with he same Channel_type. It will return the corresponding Channel or NULL.

For example if you've a GP with 8 S_TEMP and you call GetChannel(S_TEMP,0) it will return the first corresponding Temperature channel. 3 will return the 4 channel and 8 will return NULL;

Parameters
typeCHANNEL_TYPE
subTypesubType specifies which Channel with the same type you want to Select
Returns

Reimplemented from eoProfile.

◆ GetChannelCount()

uint8_t eoGenericProfile::GetChannelCount ( ) const
virtual

Returns Number of inbound channels for this profile

Returns
number of channels

Reimplemented from eoProfile.

Examples:
genericProfile_examples.cpp.

◆ GetChannelCountOut()

uint8_t eoGenericProfile::GetChannelCountOut ( ) const

Returns Number of outbound channels for this profile

Returns
number of channels
Examples:
genericProfile_examples.cpp.

◆ GetChannelOut() [1/3]

eoChannelInfo* eoGenericProfile::GetChannelOut ( CHANNEL_TYPE  type)

Returns the outbound channel for the selected type

Parameters
typeCHANNEL_TYPE
Returns
Pointer to ChannelInfo or Null

◆ GetChannelOut() [2/3]

eoChannelInfo* eoGenericProfile::GetChannelOut ( uint8_t  channelNumber)

Returns the pointer to eoChannelInfo for the selected outbound channelNumber or NULL

Parameters
channelNumber
Returns
Pointer to Channel

◆ GetChannelOut() [3/3]

eoChannelInfo* eoGenericProfile::GetChannelOut ( CHANNEL_TYPE  type,
uint8_t  subType 
)

This function allows you to access different outband Channels with he same Channel_type. It will return the corresponding Channel or NULL.

Parameters
typeCHANNEL_TYPE
subTypesubType specifies which Channel with the same type you want to Select
Returns

◆ GetProductId()

uint32_t eoGenericProfile::GetProductId ( )

Returns the product ID for this profile

Returns
product Id

◆ GetValue() [1/4]

eoReturn eoGenericProfile::GetValue ( CHANNEL_TYPE  type,
float &  value 
)
virtual

Gets the Value as Floating Point.

Using the CHANNEL_TYPE type information, this information gets the floating point value accordingly, if the Profile does not support the requested CHANNEL_TYPE NOT_SUPPORTED is returned, if the functions is not implemented for the chosen profile, NOT_IMPLEMENTED is returned

Parameters
typeCHANNEL_TYPE
valueReference to floating point
Returns
eoReturn EO_OK,NOT_SUPPORTED,NOT_IMPLEMENTED

Reimplemented from eoProfile.

◆ GetValue() [2/4]

eoReturn eoGenericProfile::GetValue ( CHANNEL_TYPE  type,
uint8_t &  value 
)
virtual

Sets the Value using a unsigned integer.

Using the CHANNEL_TYPE type information, this information sets the channel raw value, using the floating point value accordingly, if the Profile does not support the requested CHANNEL_TYPE NOT_SUPPORTED is returned, if the functions is not implemented for the chosen profile, NOT_IMPLEMENTED is returned

Parameters
typeCHANNEL_TYPE
valueReference to floating point
valueReference to uint8_t
Returns
eoReturn EO_OK,NOT_SUPPORTED,NOT_IMPLEMENTED

Reimplemented from eoProfile.

◆ GetValue() [3/4]

eoReturn eoGenericProfile::GetValue ( CHANNEL_TYPE  type,
uint8_t &  value,
uint8_t  subFlag 
)
virtual

Gets the Value as unsigned integer.

Using the CHANNEL_TYPE type information, this information gets the unsigned integer value accordingly, if the Profile does not support the requested CHANNEL_TYPE NOT_SUPPORTED is returned, if the functions is not implemented for the chosen profile, NOT_IMPLEMENTED is returned

Parameters
typeCHANNEL_TYPE
valueReference to value
subFlagSub flag
Returns
eoReturn EO_OK,NOT_SUPPORTED,NOT_IMPLEMENTED

Reimplemented from eoProfile.

◆ GetValue() [4/4]

eoReturn eoGenericProfile::GetValue ( CHANNEL_TYPE  type,
float &  value,
uint8_t  subFlag 
)
virtual

Gets the Value as Floating point.

Using the CHANNEL_TYPE type information, this information gets the unsigned integer value accordingly, if the Profile does not support the requested CHANNEL_TYPE NOT_SUPPORTED is returned, if the functions is not implemented for the chosen profile, NOT_IMPLEMENTED is returned

Parameters
typeCHANNEL_TYPE
valueReference to floating point
subFlagSub flag
Returns
eoReturn EO_OK,NOT_SUPPORTED,NOT_IMPLEMENTED

Reimplemented from eoProfile.

◆ operator!=()

bool eoGenericProfile::operator!= ( const eoGenericProfile othProfile) const

Overloading not equal operator.

Parameters
othProfileProfile to be compared with.

◆ operator==()

bool eoGenericProfile::operator== ( const eoGenericProfile othProfile) const

Overloading equal operator.

Parameters
othProfileProfile to be compared with.

◆ Parse()

eoReturn eoGenericProfile::Parse ( const eoMessage msg)
virtual

Parses the Messages and will react if it is a Generic Profile Message. When you receive selective of a Full data Message, the internal data will be changed accordingly.

If AllowTeachIN() is activated, a TeachIN Message will be parsed accordingly to the GP SPEC(meaning teachIN or teachOUT are allowed) , and a response will be prepared for you. You can access it via Create(eoMessage &m).

Note
Then you parse another Message after the TeachIN Message, the Teach IN response will be overwritten!
Parameters
msg
Returns

Reimplemented from eoProfile.

◆ ParseSelData()

eoReturn eoGenericProfile::ParseSelData ( const eoMessage msg)

Helper function to GP Selected DataChannel

Parameters
msgGP to parse
Returns

◆ ParseTeachIN()

eoReturn eoGenericProfile::ParseTeachIN ( const eoMessage msg)

Helper Function to parse TI Message, only works after calling AllowTeachIN()!

Parameters
msg
Returns
eoReturn EO_OK, NOT_SUPPORTED

◆ Serialize()

uint8_t eoGenericProfile::Serialize ( eoArchive arch)
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.

Parameters
archarchive where to Load or to Store.

Reimplemented from eoProfile.

◆ SetProductId()

void eoGenericProfile::SetProductId ( const uint32_t  prodId)

Sets the product ID for this profile

Parameters
prodIdproduct Id

◆ SetType()

eoReturn eoGenericProfile::SetType ( uint8_t  type)
virtual

Sets and checks if the specified [EEP] type is supported

Parameters
type
Returns
eoReturn EO_OK or NOT_SUPPORTED

Reimplemented from eoProfile.

◆ SetValue() [1/4]

eoReturn eoGenericProfile::SetValue ( CHANNEL_TYPE  type,
float  value 
)
virtual

Sets the Value using a Floating Point.

Using the CHANNEL_TYPE type information, this information sets the channel raw value, using the floating point value accordingly, if the Profile does not support the requested CHANNEL_TYPE NOT_SUPPORTED is returned, if the functions is not implemented for the chosen profile, NOT_IMPLEMENTED is returned

Parameters
typeCHANNEL_TYPE
valueReference to floating point
Returns
eoReturn EO_OK,NOT_SUPPORTED,NOT_IMPLEMENTED

Reimplemented from eoProfile.

◆ SetValue() [2/4]

eoReturn eoGenericProfile::SetValue ( CHANNEL_TYPE  type,
uint8_t  value 
)
virtual

Sets the Value using a uint8_t.

Using the CHANNEL_TYPE type information, this information sets the channel raw value, using the uint8_t value accordingly, if the Profile does not support the requested CHANNEL_TYPE NOT_SUPPORTED is returned, if the functions is not implemented for the chosen profile, NOT_IMPLEMENTED is returned

Parameters
typeCHANNEL_TYPE
valueReference to floating point
Returns
eoReturn EO_OK,NOT_SUPPORTED,NOT_IMPLEMENTED

Reimplemented from eoProfile.

◆ SetValue() [3/4]

eoReturn eoGenericProfile::SetValue ( CHANNEL_TYPE  type,
uint8_t  value,
uint8_t  subFlag 
)
virtual

Gets the Value as unsigned integer.

Using the CHANNEL_TYPE type information, this information gets the unsigned integer value accordingly, if the Profile does not support the requested CHANNEL_TYPE NOT_SUPPORTED is returned, if the functions is not implemented for the chosen profile, NOT_IMPLEMENTED is returned

Parameters
typeCHANNEL_TYPE
valueReference to uint8_t
subFlagSub flag
Returns
eoReturn EO_OK,NOT_SUPPORTED,NOT_IMPLEMENTED

Reimplemented from eoProfile.

◆ SetValue() [4/4]

eoReturn eoGenericProfile::SetValue ( CHANNEL_TYPE  type,
float  value,
uint8_t  subFlag 
)
virtual

Gets the Value as a float.

Using the CHANNEL_TYPE type information, this information gets the unsigned integer value accordingly, if the Profile does not support the requested CHANNEL_TYPE NOT_SUPPORTED is returned, if the functions is not implemented for the chosen profile, NOT_IMPLEMENTED is returned

Parameters
typeCHANNEL_TYPE
valueReference to floating point
subFlagSub flag
Returns
eoReturn EO_OK,NOT_SUPPORTED,NOT_IMPLEMENTED

Reimplemented from eoProfile.