HAN-FUN API  1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
HF::Core::BatchProgramManagement::IServer Class Referenceabstract

Batch Program Management Interfaces::Interface : Server side implementation. More...

#include <batch_program_management.h>

+ Inheritance diagram for HF::Core::BatchProgramManagement::IServer:
+ Collaboration diagram for HF::Core::BatchProgramManagement::IServer:

Public Member Functions

 IServer (Unit0 &unit)
 Constructor.
 
virtual ~IServer ()
 Destructor.
 
virtual IEntriesentries () const =0
 Get a reference to the current object implementing the persistence API, for the device information. More...
 
EntryPtr entry (const uint8_t pid) const
 Get the program entry given by pid. More...
 
EntryPtr entry (const std::string &name) const
 Get the program entry given by name. More...
 
uint8_t next_pid () const
 Return next available PID for the program. More...
 
uint8_t maximum_number_of_entries () const
 Get the Maximum Number Of Entries for the Batch Program Management server. More...
 
void maximum_number_of_entries (uint8_t __value)
 Set the Maximum Number Of Entries for the Batch Program Management server. More...
 
uint8_t number_of_entries () const
 Get the Number Of Entries for the Batch Program Management server. More...
 
HF::Attributes::IAttributeattribute (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...
 
Events
virtual Common::Result define_program (const Protocol::Packet &packet, DefineProgram &msg)
 Callback that is called when a BatchProgramManagement::DEFINE_PROGRAM_CMD, is received. More...
 
virtual Common::Result invoke_program (const Protocol::Packet &packet, InvokeProgram &msg)
 Callback that is called when a BatchProgramManagement::INVOKE_PROGRAM_CMD, is received. More...
 
virtual Common::Result delete_program (const Protocol::Packet &packet, DeleteProgram &msg)
 Callback that is called when a BatchProgramManagement::DELETE_PROGRAM_CMD, is received. More...
 
virtual Common::Result delete_all_programs (const Protocol::Packet &packet)
 Callback that is called when a BatchProgramManagement::DELETE_ALL_PROGRAMS_CMD, is received. More...
 
virtual Common::Result get_program_actions (const Protocol::Packet &packet, GetProgramActions &msg)
 Callback that is called when a BatchProgramManagement::GET_PROGRAM_ACTIONS_CMD, is received. More...
 
- Public Member Functions inherited from HF::Core::ServiceRole< BatchProgramManagement::Base, HF::Interface::SERVER_ROLE >
Interface::Role role () const
 Return the Interface::Role this interface implements. More...
 
- Public Member Functions inherited from HF::Core::Service< HF::Interface::BATCH_PROGRAM_MANAGEMENT >
uint16_t uid () const
 This method returns the interface UID. More...
 
- Public Member Functions inherited from HF::Core::AbstractService
Unit0unit () const
 The device this unit is associated with.
 
HF::Attributes::IAttributeattribute (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...
 
- Public Member Functions inherited from HF::Interfaces::AbstractInterface
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::IAttributeattribute (uint8_t uid)
 Return a pointer to the interface attribute with the given uid. More...
 

Protected Member Functions

Common::Result handle_command (Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset)
 Handle incoming messages from the network. More...
 
- Protected Member Functions inherited from HF::Core::ServiceRole< BatchProgramManagement::Base, HF::Interface::SERVER_ROLE >
 ServiceRole (Unit0 &unit)
 Constructor. More...
 
- Protected Member Functions inherited from HF::Core::BatchProgramManagement::Base
 Base (Unit0 &unit)
 Constructor.
 
- Protected Member Functions inherited from HF::Core::Service< HF::Interface::BATCH_PROGRAM_MANAGEMENT >
 Service (Unit0 &unit)
 Constructor. More...
 
bool check_uid (uint16_t uid) const
 Check if the given uid value matches the service's UID value. More...
 
- Protected Member Functions inherited from HF::Core::AbstractService
 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...
 
- Protected Member Functions inherited from HF::Interfaces::AbstractInterface
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...
 
virtual 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...
 
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

uint8_t _maximum_number_of_entries
 Maximum Number Of Entries.
 
- Protected Attributes inherited from HF::Core::AbstractService
Unit0_unit
 Reference to the unit the service belongs to.
 

Additional Inherited Members

- Public Types inherited from HF::Interface
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 Public Attributes inherited from HF::Interface
static constexpr uint8_t MAX_CMD_ID = 0xFF
 Maximum value for command IDs in interfaces.
 

Detailed Description

Batch Program Management Interfaces::Interface : Server side implementation.

This class provides the server side of the Batch Program Management interface.

Definition at line 512 of file batch_program_management.h.

Member Function Documentation

◆ attribute()

HF::Attributes::IAttribute* HF::Core::BatchProgramManagement::IServer::attribute ( uint8_t  uid)
virtual

Return a pointer to the interface attribute with the given uid.

Parameters
[in]uididentifier of the attribute in the interface.
Returns
a pointer to the attribute if it exists, nullptr otherwise.

Implements HF::Interface.

◆ attributes()

HF::Attributes::UIDS HF::Core::BatchProgramManagement::IServer::attributes ( uint8_t  pack_id = HF::Attributes::Pack::MANDATORY) const
virtual

Return a vector containing the attribute UIDs, for the given pack ID.

Parameters
[in]pack_idthe Attribute pack ID to get the attributes UIDs for.
Returns
vector containing the attributes UIDs.

Reimplemented from HF::Interfaces::AbstractInterface.

◆ define_program()

virtual Common::Result HF::Core::BatchProgramManagement::IServer::define_program ( const Protocol::Packet packet,
DefineProgram &  msg 
)
virtual

Callback that is called when a BatchProgramManagement::DEFINE_PROGRAM_CMD, is received.

Parameters
[in]packetthe network packet received.
[in]msgthe DefineProgram message received.
Return values
Result::OKif the request was processed,
Result::FAIL_ARGif the message contains invalid arguments to the request,
Result::FAIL_RESOURCESif the new entry could not be created,
Result::FAIL_UNKNOWNotherwise.

◆ delete_all_programs()

virtual Common::Result HF::Core::BatchProgramManagement::IServer::delete_all_programs ( const Protocol::Packet packet)
virtual

Callback that is called when a BatchProgramManagement::DELETE_ALL_PROGRAMS_CMD, is received.

Parameters
[in]packetthe network packet received.
Return values
Result::OK

◆ delete_program()

virtual Common::Result HF::Core::BatchProgramManagement::IServer::delete_program ( const Protocol::Packet packet,
DeleteProgram &  msg 
)
virtual

Callback that is called when a BatchProgramManagement::DELETE_PROGRAM_CMD, is received.

Parameters
[in]packetthe network packet received.
[in]msgthe DeleteProgram message received.
Return values
Result::OKif the request was processed,
Result::FAIL_ARGif the message contains invalid arguments to the request.

◆ entries()

virtual IEntries& HF::Core::BatchProgramManagement::IServer::entries ( ) const
pure virtual

Get a reference to the current object implementing the persistence API, for the device information.

Returns
reference to the current object for the persistence API.

Implemented in HF::Core::BatchProgramManagement::Server< _Entries >.

Referenced by entry(), and next_pid().

+ Here is the caller graph for this function:

◆ entry() [1/2]

EntryPtr HF::Core::BatchProgramManagement::IServer::entry ( const uint8_t  pid) const
inline

Get the program entry given by pid.

Parameters
[in]pidProgram ID for the program to retrieve.
Returns
a pointer to the program entry if it exists, nullptr otherwise.

Definition at line 625 of file batch_program_management.h.

References entries(), and HF::Core::BatchProgramManagement::IEntries::find().

626  {
627  return entries().find(pid);
628  }
virtual EntryPtr find(const uint8_t pid) const =0
Find the program with the given pid.
virtual IEntries & entries() const =0
Get a reference to the current object implementing the persistence API, for the device information...
+ Here is the call graph for this function:

◆ entry() [2/2]

EntryPtr HF::Core::BatchProgramManagement::IServer::entry ( const std::string &  name) const
inline

Get the program entry given by name.

Parameters
[in]nameprogram name of the program to retrieve.
Returns
a pointer to the program entry if it exists, nullptr otherwise.

Definition at line 638 of file batch_program_management.h.

References entries(), and HF::Core::BatchProgramManagement::IEntries::find().

639  {
640  return entries().find(name);
641  }
virtual EntryPtr find(const uint8_t pid) const =0
Find the program with the given pid.
virtual IEntries & entries() const =0
Get a reference to the current object implementing the persistence API, for the device information...
+ Here is the call graph for this function:

◆ get_program_actions()

virtual Common::Result HF::Core::BatchProgramManagement::IServer::get_program_actions ( const Protocol::Packet packet,
GetProgramActions &  msg 
)
virtual

Callback that is called when a BatchProgramManagement::GET_PROGRAM_ACTIONS_CMD, is received.

Parameters
[in]packetthe network packet received.
[in]msgthe get program actions message received.
Return values
Result::OKif the request was processed,
Result::FAIL_ARGif the message contains invalid arguments to the request.

◆ handle_command()

Common::Result HF::Core::BatchProgramManagement::IServer::handle_command ( Protocol::Packet packet,
Common::ByteArray payload,
uint16_t  offset 
)
protectedvirtual

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.

Handle command request/response messages, i.e. :

  • Protocol::Message:Type::COMMAND_REQ;
  • Protocol::Message:Type::COMMAND_RESP_REQ;
  • Protocol::Message:Type::COMMAND_RES;

Reimplemented from HF::Interfaces::AbstractInterface.

◆ invoke_program()

virtual Common::Result HF::Core::BatchProgramManagement::IServer::invoke_program ( const Protocol::Packet packet,
InvokeProgram &  msg 
)
virtual

Callback that is called when a BatchProgramManagement::INVOKE_PROGRAM_CMD, is received.

Parameters
[in]packetthe network packet received.
[in]msgthe InvokeProgram message received.
Return values
Result::OKif the request was processed,
Result::FAIL_ARGif the message contains invalid arguments to the request.

◆ maximum_number_of_entries() [1/2]

uint8_t HF::Core::BatchProgramManagement::IServer::maximum_number_of_entries ( ) const

Get the Maximum Number Of Entries for the Batch Program Management server.

Returns
the current Maximum Number Of Entries.

◆ maximum_number_of_entries() [2/2]

void HF::Core::BatchProgramManagement::IServer::maximum_number_of_entries ( uint8_t  __value)

Set the Maximum Number Of Entries for the Batch Program Management server.

Parameters
[in]__valuethe Maximum Number Of Entries value to set the server to.

◆ next_pid()

uint8_t HF::Core::BatchProgramManagement::IServer::next_pid ( ) const
inline

Return next available PID for the program.

Returns
the PID to use in the program entry, or Entry::AVAILABLE_PID if no PID is available.

Definition at line 646 of file batch_program_management.h.

References entries(), and HF::Core::BatchProgramManagement::IEntries::next_pid().

647  {
648  return entries().next_pid();
649  }
virtual IEntries & entries() const =0
Get a reference to the current object implementing the persistence API, for the device information...
virtual uint8_t next_pid() const =0
Return next available PID for the program.
+ Here is the call graph for this function:

◆ number_of_entries()

uint8_t HF::Core::BatchProgramManagement::IServer::number_of_entries ( ) const

Get the Number Of Entries for the Batch Program Management server.

Returns
the current Number Of Entries.

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