HAN-FUN API  1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
HF::Interface Struct Referenceabstract

Common interface for all Interfaces. More...

#include <interface.h>

+ Inheritance diagram for HF::Interface:
+ Collaboration diagram for HF::Interface:

Data Structures

struct  Any
 Helper class to match any interface. More...
 

Public Types

enum  Role { CLIENT_ROLE = 0, SERVER_ROLE = 1 }
 Interface roles. More...
 
enum  UID {
  DEVICE_MANAGEMENT = 0x0001, BIND_MANAGEMENT = 0x0002, GROUP_MANAGEMENT = 0x0003, IDENTIFY = 0x0004,
  DEVICE_INFORMATION = 0x0005, ATTRIBUTE_REPORTING = 0x0006, BATCH_PROGRAM_MANAGEMENT = 0x0007, EVENT_SCHEDULING = 0x0008,
  WEEKLY_SCHEDULING = 0x0009, GROUP_TABLE = 0x000A, TAMPER_ALERT = 0x0101, TIME = 0x0102,
  POWER = 0x0110, KEEP_ALIVE = 0x0115, RSSI = 0x0111, SUOTA = 0x0400,
  ALERT = 0x0100, ON_OFF = 0x0200, LEVEL_CONTROL = 0x0201, COLOUR_CONTROL = 0x0202,
  SIMPLE_KEYPAD = 0x0203, SIMPLE_POWER_METER = 0x0300, SIMPLE_TEMPERATURE = 0x0301, SIMPLE_HUMIDITY = 0x0302,
  SIMPLE_THERMOSTAT = 0x0303, SIMPLE_BUTTON = 0x0304, SIMPLE_VISUAL_EFFECTS = 0x0305, SIMPLE_AIR_PRESSURE = 0x0306,
  SIMPLE_LIGHT_SENSOR = 0x0307, RESERVED = 0x7F00, MAX_UID = 0x7FFE, ANY_UID = 0x7FFF
}
 Interfaces Unique Identifiers (UID). More...
 

Public Member Functions

virtual uint16_t uid () const =0
 This method returns the interface UID. More...
 
virtual Interface::Role role () const =0
 Return the Interface::Role this interface implements. More...
 
virtual Common::Result handle (Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset)=0
 Handle incoming messages from the network. More...
 
virtual void periodic (uint32_t time)=0
 Handle periodic processing. More...
 
virtual HF::Attributes::IAttributeattribute (uint8_t uid)=0
 Return a pointer to the interface attribute with the given uid. More...
 
virtual HF::Attributes::UIDS attributes (uint8_t pack_id=HF::Attributes::Pack::MANDATORY) const =0
 Return a vector containing the attribute UIDs, for the given pack ID. More...
 

Static Public Attributes

static constexpr uint8_t MAX_CMD_ID = 0xFF
 Maximum value for command IDs in interfaces.
 

Detailed Description

Common interface for all Interfaces.

Definition at line 43 of file interface.h.

Member Enumeration Documentation

◆ Role

Interface roles.

Enumerator
CLIENT_ROLE 

Client Role.

SERVER_ROLE 

Server Role.

Definition at line 48 of file interface.h.

49  {
50  CLIENT_ROLE = 0,
51  SERVER_ROLE = 1,
52  } Role;
Role
Interface roles.
Definition: interface.h:48

◆ UID

Interfaces Unique Identifiers (UID).

Enumerator
DEVICE_MANAGEMENT 

Device Management interface UID.

BIND_MANAGEMENT 

Bind Management interface UID.

GROUP_MANAGEMENT 

Group Management interface UID.

IDENTIFY 

Identify interface UID.

Not implemented

DEVICE_INFORMATION 

Device information interface UID.

ATTRIBUTE_REPORTING 

Attribute Reporting interface UID.

BATCH_PROGRAM_MANAGEMENT 

Batch Program Management interface UID.

EVENT_SCHEDULING 

Event Scheduling interface UID.

Not implemented

WEEKLY_SCHEDULING 

Weekly Scheduling interface UID.

Not implemented

GROUP_TABLE 

Group Table interface UID.

TAMPER_ALERT 

Tamper Alert interface UID.

Not implemented

TIME 

Time interface UID.

Not implemented

POWER 

Power interface UID.

Not implemented

KEEP_ALIVE 

Keep Alive interface UID.

Not implemented

RSSI 

RSSI interface UID.

SUOTA 

SUOTA interface UID.

ALERT 

Alert interface UID.

ON_OFF 

ON-OFF interface UID.

LEVEL_CONTROL 

Level Control interface UID.

COLOUR_CONTROL 

Colour Control interface UID.

SIMPLE_KEYPAD 

Simple Keypad interface UID.

SIMPLE_POWER_METER 

Simple Power Meter interface UID.

SIMPLE_TEMPERATURE 

Simple Temperature interface UID.

SIMPLE_HUMIDITY 

Simple Humidity interface UID.

SIMPLE_THERMOSTAT 

Simple Thermostat interface UID.

SIMPLE_BUTTON 

Simple Button interface UID.

SIMPLE_VISUAL_EFFECTS 

Simple Visual Effects interface UID.

SIMPLE_AIR_PRESSURE 

Simple Air Pressure interface UID.

SIMPLE_LIGHT_SENSOR 

Simple Light Sensor interface UID.

RESERVED 

Proprietary interfaces.

MAX_UID 

Max interface UID value.

ANY_UID 

Any interface UID value.

Definition at line 57 of file interface.h.

58  {
59  /* Core Services */
60  DEVICE_MANAGEMENT = 0x0001,
61  BIND_MANAGEMENT = 0x0002,
62  GROUP_MANAGEMENT = 0x0003,
63  IDENTIFY = 0x0004,
64  DEVICE_INFORMATION = 0x0005,
65  ATTRIBUTE_REPORTING = 0x0006,
66  BATCH_PROGRAM_MANAGEMENT = 0x0007,
67  EVENT_SCHEDULING = 0x0008,
68  WEEKLY_SCHEDULING = 0x0009,
69  GROUP_TABLE = 0x000A,
70  TAMPER_ALERT = 0x0101,
71  TIME = 0x0102,
72  POWER = 0x0110,
73  KEEP_ALIVE = 0x0115,
74  RSSI = 0x0111,
75  SUOTA = 0x0400,
76 
77  /* Functional Interfaces. */
78  ALERT = 0x0100,
79  ON_OFF = 0x0200,
80  LEVEL_CONTROL = 0x0201,
81  COLOUR_CONTROL = 0x0202,
82  SIMPLE_KEYPAD = 0x0203,
83  SIMPLE_POWER_METER = 0x0300,
84  SIMPLE_TEMPERATURE = 0x0301,
85  SIMPLE_HUMIDITY = 0x0302,
86  SIMPLE_THERMOSTAT = 0x0303,
87  SIMPLE_BUTTON = 0x0304,
88  SIMPLE_VISUAL_EFFECTS = 0x0305,
89  SIMPLE_AIR_PRESSURE = 0x0306,
90  SIMPLE_LIGHT_SENSOR = 0x0307,
91 
92  /* Reserved */
93  RESERVED = 0x7F00,
94  MAX_UID = 0x7FFE,
95  ANY_UID = 0x7FFF,
96  } UID;
UID
Interfaces Unique Identifiers (UID).
Definition: interface.h:57
Group Management interface UID.
Definition: interface.h:62
Attribute Reporting interface UID.
Definition: interface.h:65
Weekly Scheduling interface UID.
Definition: interface.h:68
Colour Control interface UID.
Definition: interface.h:81
Simple Temperature interface UID.
Definition: interface.h:84
Simple Keypad interface UID.
Definition: interface.h:82
SUOTA interface UID.
Definition: interface.h:75
Alert interface UID.
Definition: interface.h:78
Simple Button interface UID.
Definition: interface.h:87
Time interface UID.
Definition: interface.h:71
Device Management interface UID.
Definition: interface.h:60
Max interface UID value.
Definition: interface.h:94
Identify interface UID.
Definition: interface.h:63
Simple Power Meter interface UID.
Definition: interface.h:83
Simple Light Sensor interface UID.
Definition: interface.h:90
Group Table interface UID.
Definition: interface.h:69
Simple Visual Effects interface UID.
Definition: interface.h:88
Level Control interface UID.
Definition: interface.h:80
Simple Humidity interface UID.
Definition: interface.h:85
Event Scheduling interface UID.
Definition: interface.h:67
Any interface UID value.
Definition: interface.h:95
Simple Air Pressure interface UID.
Definition: interface.h:89
Tamper Alert interface UID.
Definition: interface.h:70
ON-OFF interface UID.
Definition: interface.h:79
Bind Management interface UID.
Definition: interface.h:61
Power interface UID.
Definition: interface.h:72
RSSI interface UID.
Definition: interface.h:74
Device information interface UID.
Definition: interface.h:64
Proprietary interfaces.
Definition: interface.h:93
Simple Thermostat interface UID.
Definition: interface.h:86
Batch Program Management interface UID.
Definition: interface.h:66
Keep Alive interface UID.
Definition: interface.h:73

Member Function Documentation

◆ attribute()

◆ attributes()

◆ handle()

virtual Common::Result HF::Interface::handle ( Protocol::Packet packet,
Common::ByteArray payload,
uint16_t  offset 
)
pure virtual

Handle incoming messages from the network.

Parameters
[in]packetthe packet receive from the network.
[in]payloadthe byte array containing the data received from the network.
[in]offsetthe offset the payload start at in the byte array.
Returns
the result of the message processing.

Implemented in HF::Core::GroupManagement::IServer, HF::Units::Unit< HF::Profiles::SimpleOnOffSwitch >, HF::Units::Unit< HF::Profiles::SimpleLight >, and HF::Interfaces::AbstractInterface.

Referenced by HF::Interfaces::Container< HF::Units::Unit< HF::Profiles::SimpleOnOffSwitch, ITF... >, Proxy< ITF, HF::Units::Unit< HF::Profiles::SimpleOnOffSwitch, ITF... > >... >::handle(), and HF::Unit0< IUnit0, ITF... >::handle().

+ Here is the caller graph for this function:

◆ periodic()

virtual void HF::Interface::periodic ( uint32_t  time)
pure virtual

◆ role()

virtual Interface::Role HF::Interface::role ( ) const
pure virtual

Return the Interface::Role this interface implements.

Returns
the Interface::Role implemented by the interface.

Implemented in HF::Core::AttributeReporting::IServer, HF::Core::AttributeReporting::Client, HF::Interfaces::InterfaceRole< SimplePowerMeter::Base, HF::Interface::CLIENT_ROLE >, HF::Interfaces::InterfaceRole< SimpleThermostat::Base, HF::Interface::SERVER_ROLE >, HF::Interfaces::InterfaceRole< SimpleLightSensor::Base, HF::Interface::CLIENT_ROLE >, HF::Interfaces::InterfaceRole< OnOff::Base, HF::Interface::CLIENT_ROLE >, HF::Interfaces::InterfaceRole< SimpleButton::Base, HF::Interface::CLIENT_ROLE >, HF::Interfaces::InterfaceRole< SimpleHumidity::Base, HF::Interface::CLIENT_ROLE >, HF::Interfaces::InterfaceRole< SimplePowerMeter::Base, HF::Interface::SERVER_ROLE >, HF::Interfaces::InterfaceRole< Interfaces::AbstractInterface, HF::Interface::CLIENT_ROLE >, HF::Interfaces::InterfaceRole< SimpleKeypad::Base, HF::Interface::SERVER_ROLE >, HF::Interfaces::InterfaceRole< SimpleHumidity::Base, HF::Interface::SERVER_ROLE >, HF::Interfaces::InterfaceRole< Alert::Base, HF::Interface::CLIENT_ROLE >, HF::Interfaces::InterfaceRole< SimpleTemperature::Base, HF::Interface::SERVER_ROLE >, HF::Interfaces::InterfaceRole< SimpleAirPressure::Base, HF::Interface::SERVER_ROLE >, HF::Interfaces::InterfaceRole< SimpleTemperature::Base, HF::Interface::CLIENT_ROLE >, HF::Interfaces::InterfaceRole< SimpleVisualEffects::Base, HF::Interface::CLIENT_ROLE >, HF::Interfaces::InterfaceRole< SimpleThermostat::Base, HF::Interface::CLIENT_ROLE >, HF::Interfaces::InterfaceRole< ColourControl::Base, HF::Interface::SERVER_ROLE >, HF::Interfaces::InterfaceRole< LevelControl::Base, HF::Interface::CLIENT_ROLE >, HF::Interfaces::InterfaceRole< SimpleButton::Base, HF::Interface::SERVER_ROLE >, HF::Interfaces::InterfaceRole< Alert::Base, HF::Interface::SERVER_ROLE >, HF::Interfaces::InterfaceRole< SimpleKeypad::Base, HF::Interface::CLIENT_ROLE >, HF::Interfaces::InterfaceRole< SimpleAirPressure::Base, HF::Interface::CLIENT_ROLE >, HF::Interfaces::InterfaceRole< OnOff::Base, HF::Interface::SERVER_ROLE >, HF::Interfaces::InterfaceRole< SimpleVisualEffects::Base, HF::Interface::SERVER_ROLE >, HF::Interfaces::InterfaceRole< SimpleLightSensor::Base, HF::Interface::SERVER_ROLE >, HF::Interfaces::InterfaceRole< LevelControl::Base, HF::Interface::SERVER_ROLE >, HF::Interfaces::InterfaceRole< ColourControl::Base, HF::Interface::CLIENT_ROLE >, HF::Core::ServiceRole< SUOTA::Base, HF::Interface::SERVER_ROLE >, HF::Core::ServiceRole< Time::Base, HF::Interface::SERVER_ROLE >, HF::Core::ServiceRole< GroupManagement::Base, HF::Interface::SERVER_ROLE >, HF::Core::ServiceRole< SUOTA::Base, HF::Interface::CLIENT_ROLE >, HF::Core::ServiceRole< GroupTable::Base, HF::Interface::CLIENT_ROLE >, HF::Core::ServiceRole< Time::Base, HF::Interface::CLIENT_ROLE >, HF::Core::ServiceRole< BatchProgramManagement::Base, HF::Interface::CLIENT_ROLE >, HF::Core::ServiceRole< BatchProgramManagement::Base, HF::Interface::SERVER_ROLE >, HF::Core::ServiceRole< GroupManagement::Base, HF::Interface::CLIENT_ROLE >, HF::Core::ServiceRole< GroupTable::Base, HF::Interface::SERVER_ROLE >, and HF::Core::ServiceRole< AbstractService, HF::Interface::SERVER_ROLE >.

Referenced by HF::Interfaces::Container< HF::Units::Unit< HF::Profiles::SimpleOnOffSwitch, ITF... >, Proxy< ITF, HF::Units::Unit< HF::Profiles::SimpleOnOffSwitch, ITF... > >... >::interfaces().

+ Here is the caller graph for this function:

◆ uid()

virtual uint16_t HF::Interface::uid ( ) const
pure virtual

This method returns the interface UID.

Subclasses MUST override this method to provide a valid value for the interface being implemented.

This method returns a uint16_t and not a Interface::UID, to provide support for proprietary interfaces.

Returns
the UID for the interface.

Implemented in HF::Core::AttributeReporting::IServer, HF::Interfaces::Interface< HF::Interface::SIMPLE_BUTTON >, HF::Interfaces::Interface< HF::Interface::SIMPLE_TEMPERATURE >, HF::Interfaces::Interface< HF::Interface::SIMPLE_AIR_PRESSURE >, HF::Interfaces::Interface< HF::Interface::ON_OFF >, HF::Interfaces::Interface< HF::Interface::COLOUR_CONTROL >, HF::Interfaces::Interface< HF::Interface::SIMPLE_THERMOSTAT >, HF::Interfaces::Interface< HF::Interface::SIMPLE_LIGHT_SENSOR >, HF::Interfaces::Interface< HF::Interface::SIMPLE_POWER_METER >, HF::Interfaces::Interface< HF::Interface::LEVEL_CONTROL >, HF::Interfaces::Interface< HF::Interface::RSSI >, HF::Interfaces::Interface< HF::Interface::ALERT >, HF::Interfaces::Interface< HF::Interface::SIMPLE_VISUAL_EFFECTS >, HF::Interfaces::Interface< HF::Interface::SIMPLE_HUMIDITY >, HF::Interfaces::Interface< HF::Interface::SIMPLE_KEYPAD >, HF::Interfaces::Interface< HF::Interface::ATTRIBUTE_REPORTING >, HF::Units::Unit< HF::Profiles::SimpleOnOffSwitch >, HF::Units::Unit< HF::Profiles::SimpleLight >, HF::Core::Service< HF::Interface::SUOTA >, HF::Core::Service< HF::Interface::GROUP_MANAGEMENT >, HF::Core::Service< HF::Interface::BATCH_PROGRAM_MANAGEMENT >, HF::Core::Service< HF::Interface::DEVICE_MANAGEMENT >, HF::Core::Service< HF::Interface::BIND_MANAGEMENT >, HF::Core::Service< HF::Interface::GROUP_TABLE >, HF::Core::Service< HF::Interface::DEVICE_INFORMATION >, and HF::Core::Service< HF::Interface::TIME >.

Referenced by HF::Core::AbstractService::attribute(), HF::Interfaces::AbstractInterface::attribute(), HF::Profiles::Profile< SIMPLE_LIGHT_SENSOR, Interfaces::SimpleLightSensor::Server >::attributes(), and HF::Interfaces::Container< HF::Units::Unit< HF::Profiles::SimpleOnOffSwitch, ITF... >, Proxy< ITF, HF::Units::Unit< HF::Profiles::SimpleOnOffSwitch, ITF... > >... >::interfaces().

+ Here is the caller graph for this function:

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