![]() |
HAN-FUN API
1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
|
Attribute Reporting - Server Role. More...
#include <attribute_reporting.h>
Public Member Functions | |
Server (Unit0 &unit) | |
Constructor. More... | |
virtual Common::Result | handle (const Report::Periodic::CreateMessage &message) |
Handle a create periodic rule command. More... | |
virtual Common::Result | handle (const Report::Periodic::AddEntryMessage &message) |
Handle an add periodic entries message. More... | |
virtual Common::Result | handle (const Report::Event::CreateMessage &message) |
Handle a create event rule command. More... | |
virtual Common::Result | handle (const Report::Event::AddEntryMessage &message) |
Handle an add event entries message. More... | |
virtual Common::Result | handle (const Report::DeleteMessage &message) |
Handle a delete rule request. More... | |
virtual Common::Result | handle (const Report::UpdateIntervalMessage &message) |
Handle a update periodic report interval request. More... | |
void | periodic (uint32_t time) |
Handle periodic processing. More... | |
void | notify (uint8_t unit, const HF::Attributes::IAttribute &old_value, const HF::Attributes::IAttribute &new_value) |
Process an attribute change from old_value to new_value for the given unit . More... | |
uint16_t | count (Type type) const |
Get the number of rules for the given type . More... | |
![]() | |
IServer (Unit0 &unit) | |
Constructor. More... | |
uint16_t | uid () const |
This method returns the interface UID. More... | |
Interface::Role | role () const |
Return the Interface::Role this interface implements. More... | |
HF::Attributes::IAttribute * | attribute (uint8_t uid) |
Return a pointer to the interface attribute with the given uid . More... | |
HF::Attributes::UIDS | attributes (uint8_t pack_id=HF::Attributes::Pack::MANDATORY) const |
Return a vector containing the attribute UIDs, for the given pack ID. More... | |
![]() | |
Unit0 & | unit () const |
The device this unit is associated with. | |
HF::Attributes::IAttribute * | attribute (uint8_t uid) |
Return a pointer to the interface attribute with the given uid . More... | |
HF::Attributes::UIDS | attributes (uint8_t pack_id=HF::Attributes::Pack::MANDATORY) const |
Return a vector containing the attribute UIDs, for the given pack ID. More... | |
![]() | |
Common::Result | handle (Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset) |
Handle incoming messages from the network. More... | |
void | periodic (uint32_t time) |
Handle periodic processing. More... | |
HF::Attributes::IAttribute * | attribute (uint8_t uid) |
Return a pointer to the interface attribute with the given uid . More... | |
Data Fields | |
Common::SimpleList< Periodic::Rule > | periodic_rules |
Periodic rules. More... | |
Common::SimpleList< Event::Rule > | event_rules |
Event rules. More... | |
Protected Member Functions | |
uint16_t | payload_size (Protocol::Message::Interface &itf) const |
Return the minimal payload size that a message should hold when addressed at the given interface. More... | |
Common::Result | handle_command (Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset) |
Handle incoming messages from the network. More... | |
![]() | |
void | response (Protocol::Packet &packet, Reference &report, Common::Result result) |
Send the response to a command with the given result . More... | |
virtual bool | authorized (uint8_t member, Protocol::Address &source) |
Check if the given command is authorized for the device with the given address. More... | |
bool | check_uid (uint16_t uid) const |
Check if the given UID matches the interface UID. More... | |
![]() | |
AbstractService (Unit0 &unit) | |
Constructor. More... | |
void | send (const Protocol::Address &addr, Protocol::Message &message) |
Send message msg to the network address given by addr . 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... | |
![]() | |
virtual void | notify (const HF::Attributes::IAttribute &old_value, const HF::Attributes::IAttribute &new_value) const |
Notify that an attribute value as changed. More... | |
Common::Result | check (Protocol::Message &message, Common::ByteArray &payload, uint16_t offset) |
Check if message has correct attributes to be processed by the interface. More... | |
Common::Result | check_payload_size (Protocol::Message &message, Common::ByteArray &payload, uint16_t offset) |
Check if payload data size if sufficient for processing the message . More... | |
virtual uint16_t | payload_size (Protocol::Message &message) const |
Return the minimal payload size that should be present for the given message. More... | |
template<typename _Message > | |
uint16_t | payload_size_helper () const |
Helper function template to retrieve minimum size required for serializing/deserializing the class given. More... | |
virtual Common::Result | handle_attribute (Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset) |
Handle incoming messages from the network. More... | |
Protected Attributes | |
uint32_t | last_time |
Last time the periodic function was called. | |
![]() | |
Unit0 & | _unit |
Reference to the unit the service belongs to. | |
Additional Inherited Members | |
![]() | |
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... | |
![]() | |
static constexpr uint8_t | MAX_CMD_ID = 0xFF |
Maximum value for command IDs in interfaces. | |
Attribute Reporting - Server Role.
Definition at line 1691 of file attribute_reporting.h.
|
inline |
Constructor.
[in] | unit | reference to the unit containing this service. |
Definition at line 1701 of file attribute_reporting.h.
|
virtual |
Get the number of rules for the given type
.
[in] | type | attribute reporting type to get the number of rules for. |
type
. Reimplemented from HF::Core::AttributeReporting::IServer.
|
virtual |
Handle a create periodic rule command.
[in] | message | create periodic rule message. |
HF::Common::Result::FAIL_RESOURCES | if the rule could not be created. |
HF::Common::Result::OK | if the rule was created. |
|
virtual |
Handle an add periodic entries message.
message | add periodic entries message with the entries to add. |
Common::Result::FAIL_ARG | if the rule cannot be found. |
Common::Result::OK | if the entries where added. |
|
virtual |
Handle a create event rule command.
[in] | message | create event rule message. |
HF::Common::Result::FAIL_RESOURCES | if the rule could not be created. |
HF::Common::Result::OK | if the rule was created. |
|
virtual |
Handle an add event entries message.
message | add event entries message with the entries to add. |
Common::Result::FAIL_ARG | if the rule cannot be found. |
Common::Result::OK | if the entries where added. |
|
virtual |
Handle a delete rule request.
[in] | message | delete rule request message. |
Common::Result::FAIL_ARG | if the rule cannot be found. |
Common::Result::OK | if the rule was deleted. |
|
virtual |
Handle a update periodic report interval request.
[in] | message | update interval request message. |
Common::Result::FAIL_ARG | if the rule cannot be found. |
Common::Result::OK | if the rule was deleted. |
|
protectedvirtual |
Handle incoming messages from the network.
[in] | packet | the packet receive from the network. |
[in] | payload | the byte array containing the data received from the network. |
[in] | offset | the offset the payload start at in the byte array. |
Handle command request/response messages, i.e. :
Reimplemented from HF::Core::AttributeReporting::IServer.
|
virtual |
Process an attribute change from old_value
to new_value
for the given unit
.
This method checks if the change in the given attribute matches the conditions present in any of the attribute reporting rules.
[in] | unit | unit ID where the attribute is present. |
[in] | old_value | old value for the attribute. |
[in] | new_value | new value for the attribute. |
Reimplemented from HF::Core::AttributeReporting::IServer.
|
protectedvirtual |
Return the minimal payload size that a message should hold when addressed at the given interface.
[in] | itf | the interface being address. |
Reimplemented from HF::Interfaces::AbstractInterface.
|
virtual |
Handle periodic processing.
[in] | time | current system clock value in seconds. |
Implements HF::Interface.
Common::SimpleList<Event::Rule> HF::Core::AttributeReporting::Server::event_rules |
Event rules.
Definition at line 1694 of file attribute_reporting.h.
Common::SimpleList<Periodic::Rule> HF::Core::AttributeReporting::Server::periodic_rules |
Periodic rules.
Definition at line 1693 of file attribute_reporting.h.