HAN-FUN API  1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
DeviceManagement::Server Struct Reference

Custom Device Management class. More...

#include <base.h>

+ Inheritance diagram for DeviceManagement::Server:
+ Collaboration diagram for DeviceManagement::Server:

Public Member Functions

uint16_t next_address (uint16_t addr)
 Set the device address for the next registration message. More...
 
bool available (uint16_t address)
 Check if the given address is available for registration. More...
 
bool deregister (uint16_t address)
 De-register the device with the given address. More...
 
void save (Json::Value &root)
 Save the device entries into the JSON database. More...
 
void restore (Json::Value root)
 Restore the device entries from the JSON database. More...
 
- Public Member Functions inherited from HF::Core::DeviceManagement::Server< Entries >
 Server (Unit0 &unit)
 Constructor. More...
 
- Public Member Functions inherited from HF::Core::DeviceManagement::IServer
HF::Devices::Concentrator::IUnit0unit0 () const
 Return a reference to the unit that this service belongs to. More...
 
DevicePtr entry (uint16_t address) const
 Return the Device entry for the given address. More...
 
DevicePtr entry (const HF::UID::UID &uid) const
 Return the Device entry for the given UID. More...
 
virtual void registered (DevicePtr &device)
 Indicate that a device has been registered. More...
 
virtual void deregistered (DevicePtr &device)
 Indicate that a device has been de-registered. More...
 
- Public Member Functions inherited from HF::Core::ServiceRole< Base, HF::Interface::SERVER_ROLE >
Interface::Role role () const
 Return the Interface::Role this interface implements. More...
 
- Public Member Functions inherited from Base
void receive (HF::Protocol::Packet &packet, HF::Common::ByteArray &payload, uint16_t offset)
 Callback to deliver a packet received from the transport layer. More...
 
bool has_bind (uint16_t dev_addr_1, uint16_t dev_addr_2)
 Check if bind exists. More...
 
uint8_t bind (uint16_t dev_addr_1, uint16_t dev_addr_2)
 Create a new bind entry. More...
 
bool unbind (uint16_t dev_addr_1, uint16_t dev_addr_2)
 Remove the binding entry for the given devices. More...
 
- Public Member Functions inherited from HF::Devices::Concentrator::Abstract< CoreServices >
CoreServices * unit0 () const
 Get the unit 0 used by this concentrator device. More...
 
- Public Member Functions inherited from HF::Devices::Concentrator::AbstractBase
uint16_t address () const
 Return the device address on the HAN-FUN network, when the device is registered, or HF_BROADCAST_ADDR otherwise. More...
 
void connected (HF::Transport::Link *link)
 Callback to report that a new transport link was been created to a remote device. More...
 
void disconnected (HF::Transport::Link *link)
 Callback to the report that the given transport link no longer is valid and MUST not be used to send messages to the corresponding end-point. More...
 
- Public Member Functions inherited from HF::Devices::AbstractDevice
const IUnitsunits () const
 Return the list of units registered in this device. More...
 
void add (Units::IUnit *unit)
 Add unit to devices unit lists. More...
 
void remove (Units::IUnit *unit)
 Remove unit from device's unit list. More...
 
Units::IUnitunit (uint8_t id) const
 Return pointer to the unit with the given id. More...
 
void send (Protocol::Packet &packet)
 Send given packet into the HAN-FUN network. More...
 
void periodic (uint32_t time)
 Handle periodic processing. More...
 
Events
- Public Member Functions inherited from HF::Core::SessionManagement::Server< Entries >
Container & entries () const
 Return the container for the service entries. More...
 
- Public Member Functions inherited from HF::Core::SessionManagement::AbstractServer
 AbstractServer ()
 Constructor.
 
void start_session (uint16_t address)
 Start a session for the device with the given address. More...
 
void end_session (uint16_t address)
 Terminate the session associated with the device with the given address. More...
 
bool exists (uint16_t address) const
 Check if a session for the device with the given address exists. More...
 
bool is_valid (uint16_t address) const
 Check if the session for the device with the given address is valid, i.e., the underling entries have not been modified since the start of the session. More...
 
void invalidate ()
 Invalidate all sessions.
 

Protected Member Functions

uint16_t next_address ()
 Return next available address for registering a device. More...
 
- Protected Member Functions inherited from HF::Core::DeviceManagement::Server< Entries >
Container & entries () const
 Return the container for the service entries. More...
 
- Protected Member Functions inherited from HF::Core::DeviceManagement::AbstractServer
 AbstractServer (Unit0 &unit)
 Constructor. More...
 
virtual Common::Result register_device (Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset)
 This method is called when a registration message is received.
 
virtual Common::Result deregister_device (Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset)
 This method is called when a de-registration message is received.
 
virtual bool authorized (uint8_t member, DevicePtr &source, DevicePtr &destination)
 This method serves to indicate if a given member of the interface can be used by the source device affecting the destination device configuration on the system. More...
 
virtual Common::Result deregister (DevicePtr &device)
 De-register the device that corresponds to the given Device entry. More...
 
- Protected Member Functions inherited from HF::Core::DeviceManagement::IServer
 IServer (Unit0 &unit)
 Constructor. More...
 
- Protected Member Functions inherited from HF::Core::ServiceRole< Base, HF::Interface::SERVER_ROLE >
 ServiceRole (Unit0 &unit)
 Constructor. More...
 
- Protected Member Functions inherited from HF::Devices::Concentrator::AbstractBase
HF::Transport::Linklink (uint16_t addr) const
 Return the link that can be used to send a packet to the device with the given address. More...
 
virtual void route_packet (Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset)
 Route the given packet to the corresponding device. More...
 
- Protected Member Functions inherited from HF::Devices::AbstractDevice
virtual bool to_local (const Protocol::Packet &packet) const
 Check if the given packet is for this device. More...
 
bool from_local (const Protocol::Packet &packet) const
 Check if the given packet is from the local device. More...
 
bool from_remote (const Protocol::Packet &packet)
 Check if the given packet is from the a remote device. More...
 
bool is_registered ()
 Check if the device has a valid, i.e. More...
 
- Protected Member Functions inherited from HF::Core::SessionManagement::Server< Entries >
 Server (const Server &other)
 Copy-Constructor. More...
 
- Protected Member Functions inherited from HF::Core::SessionManagement::AbstractServer
Common::Result handle_command (CMD cmd, Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset=0)
 Handle command request/response messages. More...
 
iterator find (uint16_t address)
 Find the session associated with the given device address. More...
 
const_iterator find (uint16_t address) const
 Find the session associated with the given device address. More...
 
uint16_t payload_size (CMD cmd) const
 Get the minimum number of bytes necessary to pack/unpack a message of the given command. More...
 
Common::Result check_offset (uint16_t offset, uint8_t &count, uint16_t size) const
 Check if the given offset is valid and adjust the count value if necessary. More...
 
Common::Result check_session (uint16_t address, Common::ByteArray &payload) const
 Check if a session for the given device address exists and if it is valid. More...
 

Protected Attributes

uint16_t _next_address
 The address the next registering device will be assigned.
 
- Protected Attributes inherited from HF::Devices::Concentrator::AbstractBase
Common::SimpleList< Transport::Link * > _links
 List of links present in this concentrator.
 
- Protected Attributes inherited from HF::Devices::AbstractDevice
uint8_t next_reference
 Last reference number used to send a packet.
 
IUnits _units
 List containing pointers to the units present in the device.
 
Protocol::Filters::ResponseRequired response_filter
 Support for generating missing responses for messages.
 
- Protected Attributes inherited from HF::Core::SessionManagement::AbstractServer
Container sessions
 Session's database.
 

Detailed Description

Custom Device Management class.

This class allows for the application to select the address to be given to next device that registers.

Definition at line 68 of file base.h.

Member Function Documentation

◆ next_address()

uint16_t DeviceManagement::Server::next_address ( uint16_t  addr)
inline

Set the device address for the next registration message.

Parameters
[in]addraddress to use in the next registration.
Returns
the address that was set.

Definition at line 84 of file base.h.

References _next_address.

85  {
86  _next_address = addr;
87  return _next_address;
88  }
uint16_t _next_address
The address the next registering device will be assigned.
Definition: base.h:129

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