HAN-FUN API  1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
HF::Units::AbstractUnit Class Reference

This is the parent class for all HAN-FUN units. More...

#include <units.h>

+ Inheritance diagram for HF::Units::AbstractUnit:
+ Collaboration diagram for HF::Units::AbstractUnit:

Public Member Functions

IDevicedevice () const
 Reference to the device this unit belongs to. More...
 
void send (const Protocol::Address &addr, Protocol::Message &message, Transport::Link *link)
 Create and send a new packet with the given message to the given address. More...
 
std::vector< Common::Interfaceinterfaces () const
 Return a vector containing a list of extra interfaces, other than the interfaces specified by the profile the unit implements) More...
 
void periodic (uint32_t time)
 Handle periodic processing. More...
 
- Public Member Functions inherited from HF::Units::IUnit
virtual uint8_t id () const =0
 Get the id number of this unit on the device. More...
 
virtual Common::Result handle (Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset)=0
 Handle incoming messages from the network. More...
 
- Public Member Functions inherited from HF::Profiles::IProfile
virtual uint16_t uid () const =0
 Return this profile HAN-FUN UID. More...
 
virtual HF::Attributes::List attributes (Common::Interface itf, uint8_t pack_id, const HF::Attributes::UIDS &uids) const =0
 Return a list of all the attributes for a given interface, pack id and list of attributes UID's. More...
 

Protected Member Functions

 AbstractUnit (IDevice &device)
 Constructor. More...
 
void notify (const HF::Attributes::IAttribute &old_value, const HF::Attributes::IAttribute &new_value) const
 Notify the attribute reporting service that the given attribute has changed value. More...
 

Protected Attributes

uint8_t _id
 Unit ID used to identify a given unit in a given HAN-FUN device.
 

Detailed Description

This is the parent class for all HAN-FUN units.

Definition at line 95 of file units.h.

Constructor & Destructor Documentation

◆ AbstractUnit()

HF::Units::AbstractUnit::AbstractUnit ( IDevice device)
inlineprotected

Constructor.

Parameters
[in]devicereference to the device that holds this unit.

Definition at line 135 of file units.h.

References HF::IDevice::add(), and device().

135  : _device(device)
136  {
137  device.add(this);
138  }
virtual void add(Units::IUnit *unit)=0
Add unit to devices unit lists.
IDevice & device() const
Reference to the device this unit belongs to.
Definition: units.h:107
+ Here is the call graph for this function:

Member Function Documentation

◆ device()

IDevice& HF::Units::AbstractUnit::device ( ) const
inlinevirtual

Reference to the device this unit belongs to.

Returns
reference to the device this unit belongs to

Implements HF::Units::IUnit.

Definition at line 107 of file units.h.

Referenced by AbstractUnit().

108  {
109  return _device;
110  }
+ Here is the caller graph for this function:

◆ interfaces()

std::vector<Common::Interface> HF::Units::AbstractUnit::interfaces ( ) const
inlinevirtual

Return a vector containing a list of extra interfaces, other than the interfaces specified by the profile the unit implements)

Returns
vector containing the list of extra interfaces.

Implements HF::Units::IUnit.

Reimplemented in HF::Units::Unit< Profile, ITF >, HF::Units::Unit< HF::Profiles::SimpleOnOffSwitch >, HF::Units::Unit< HF::Profiles::GenericApplicationLogic, Alert, LevelControl, OnOff, SimplePowerMeter >, and HF::Units::Unit< HF::Profiles::SimpleLight >.

Definition at line 115 of file units.h.

116  {
117  return std::vector<Common::Interface>();
118  }

◆ notify()

void HF::Units::AbstractUnit::notify ( const HF::Attributes::IAttribute old_value,
const HF::Attributes::IAttribute new_value 
) const
protected

Notify the attribute reporting service that the given attribute has changed value.

Parameters
[in]old_valuereference to the previous value of the attribute.
[in]new_valuereference to the current value of the attribute.

Referenced by HF::Units::Unit< HF::Profiles::SimpleLight >::notify().

+ Here is the caller graph for this function:

◆ periodic()

void HF::Units::AbstractUnit::periodic ( uint32_t  time)
inlinevirtual

Handle periodic processing.

Parameters
[in]timecurrent system clock value in seconds.

Implements HF::Units::IUnit.

Reimplemented in HF::Units::Unit< Profile, ITF >, HF::Units::Unit< HF::Profiles::SimpleOnOffSwitch >, HF::Units::Unit< HF::Profiles::GenericApplicationLogic, Alert, LevelControl, OnOff, SimplePowerMeter >, and HF::Units::Unit< HF::Profiles::SimpleLight >.

Definition at line 120 of file units.h.

References UNUSED.

121  {
122  UNUSED(time);
123  }
#define UNUSED(x)
Helper macro to remove warning about unused function/method argument.

◆ send()

void HF::Units::AbstractUnit::send ( const Protocol::Address addr,
Protocol::Message message,
Transport::Link link 
)
virtual

Create and send a new packet with the given message to the given address.

Parameters
[in]addraddress to send the message to.
[in]messagemessage to send.
[in]linkpreferred link to send the message on.

Implements HF::Units::IUnit.

Referenced by HF::Core::AbstractService::send(), and HF::Units::Unit< HF::Profiles::SimpleLight >::send().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: