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

Colour Control Interface : Server side implementation. More...

#include <colour_control.h>

+ Inheritance diagram for HF::Interfaces::ColourControl::Server:
+ Collaboration diagram for HF::Interfaces::ColourControl::Server:

Public Types

typedef std::vector< ITransition * > Container
 Container for the transitions.
 
- 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...
 

Public Member Functions

 Server ()
 Constructor.
 
virtual ~Server ()
 Destructor.
 
Events
virtual void changed (void)
 Inform the APP that a new transition was added.
 
Common::Result move_to_hue (const Protocol::Address &addr, const MoveToHueMessage &message)
 Callback that is called when a ColourControl::MOVE_TO_HUE_CMD, is received. More...
 
Common::Result move_hue (const Protocol::Address &addr, const MoveHueMessage &message)
 Callback that is called when a ColourControl::MOVE_HUE_CMD, is received. More...
 
Common::Result step_hue (const Protocol::Address &addr, const StepHueMessage &message)
 Callback that is called when a ColourControl::STEP_HUE_CMD, is received. More...
 
Common::Result move_to_saturation (const Protocol::Address &addr, const MoveToSaturationMessage &message)
 Callback that is called when a ColourControl::MOVE_TO_SATURATION_CMD, is received. More...
 
Common::Result move_saturation (const Protocol::Address &addr, const MoveSaturationMessage &message)
 Callback that is called when a ColourControl::MOVE_SATURATION_CMD, is received. More...
 
Common::Result step_saturation (const Protocol::Address &addr, const StepSaturationMessage &message)
 Callback that is called when a ColourControl::STEP_SATURATION_CMD, is received. More...
 
Common::Result move_to_hue_and_saturation (const Protocol::Address &addr, const MoveToHueSaturationMessage &message)
 Callback that is called when a ColourControl::MOVE_TO_HUE_AND_SATURATION_CMD, is received. More...
 
Common::Result move_to_xy (const Protocol::Address &addr, const MoveToXYMessage &message)
 Callback that is called when a ColourControl::MOVE_TO_XY_CMD, is received. More...
 
Common::Result move_xy (const Protocol::Address &addr, const MoveXYMessage &message)
 Callback that is called when a ColourControl::MOVE_XY_CMD, is received. More...
 
Common::Result step_xy (const Protocol::Address &addr, const StepXYMessage &message)
 Callback that is called when a ColourControl::STEP_XY_CMD, is received. More...
 
Common::Result move_to_colour_temperature (const Protocol::Address &addr, const MoveToTemperatureMessage &message)
 Callback that is called when a ColourControl::MOVE_TO_COLOUR_TEMPERATURE_CMD, is received. More...
 
- Public Member Functions inherited from HF::Interfaces::ColourControl::IServer
 IServer ()
 Constructor.
 
virtual ~IServer ()
 Destructor.
 
uint8_t supported () const
 Get the supported modes bitmask for the Colour Control server. More...
 
void supported (uint8_t __value)
 Set the supported modes bitmask for the Colour Control server. More...
 
uint8_t mode () const
 Get the current active mode for the Colour Control server. More...
 
void mode (uint8_t __value)
 Set the current mode for the Colour Control 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...
 
- Public Member Functions inherited from HF::Interfaces::InterfaceRole< ColourControl::Base, HF::Interface::SERVER_ROLE >
HF::Interface::Role role () const
 Return the Interface::Role this interface implements. More...
 
- Public Member Functions inherited from HF::Interfaces::Interface< HF::Interface::COLOUR_CONTROL >
uint16_t uid () const
 This method returns the interface UID. 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...
 

Static Public Member Functions

static uint16_t has_transitions ()
 Check if there are transitions to run. More...
 
static uint16_t transition (void)
 Method responsible for updating the all the transitions. More...
 

Protected Member Functions

void add_transition (ITransition *t)
 Add a transition to the list. More...
 
void remove (IServer const &itf)
 Remove a transition from the list. More...
 
- Protected Member Functions inherited from HF::Interfaces::ColourControl::IServer
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::Interfaces::ColourControl::Base
 Base ()
 Constructor.
 
- Protected Member Functions inherited from HF::Interfaces::Interface< HF::Interface::COLOUR_CONTROL >
bool check_uid (uint16_t uid) const
 
- Protected Member Functions inherited from HF::Interfaces::AbstractInterface
virtual void send (const Protocol::Address &addr, Protocol::Message &message)=0
 Send message msg to the network address given by addr. 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...
 
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...
 

Additional Inherited Members

- Static Public Attributes inherited from HF::Interface
static constexpr uint8_t MAX_CMD_ID = 0xFF
 Maximum value for command IDs in interfaces.
 
- Protected Attributes inherited from HF::Interfaces::ColourControl::IServer
uint8_t _supported
 Supported modes. More...
 
uint8_t _mode
 Current Active Mode. More...
 

Detailed Description

Colour Control Interface : Server side implementation.

This class provides the server side of the Colour Control interface.

Definition at line 1542 of file colour_control.h.

Member Function Documentation

◆ add_transition()

void HF::Interfaces::ColourControl::Server::add_transition ( ITransition t)
inlineprotected

Add a transition to the list.

Parameters
[in]tthe transition to be added.

Definition at line 1636 of file colour_control.h.

References changed().

1637  {
1638  transitions.push_back(t);
1639  changed();
1640  }
virtual void changed(void)
Inform the APP that a new transition was added.
+ Here is the call graph for this function:

◆ has_transitions()

static uint16_t HF::Interfaces::ColourControl::Server::has_transitions ( )
inlinestatic

Check if there are transitions to run.

Returns
The time left for the next transition, or 0 if there are no transitions.

Definition at line 1562 of file colour_control.h.

1563  {
1564  return transitions.empty() ? 0 : transitions.front()->remaining_time;
1565  }

◆ move_hue()

Common::Result HF::Interfaces::ColourControl::Server::move_hue ( const Protocol::Address addr,
const MoveHueMessage message 
)
virtual

Callback that is called when a ColourControl::MOVE_HUE_CMD, is received.

Parameters
[in]addrthe network address to send the message to.
[in]messagethe MoveHueMessage received.
Return values
Result::OKif the request could be processed,
Result::FAIL_ARGotherwise.

Reimplemented from HF::Interfaces::ColourControl::IServer.

◆ move_saturation()

Common::Result HF::Interfaces::ColourControl::Server::move_saturation ( const Protocol::Address addr,
const MoveSaturationMessage message 
)
virtual

Callback that is called when a ColourControl::MOVE_SATURATION_CMD, is received.

Parameters
[in]addrthe network address to send the message to.
[in]messagethe MoveSaturationMessage received.
Return values
Result::OKif the request could be processed,
Result::FAIL_ARGotherwise.

Reimplemented from HF::Interfaces::ColourControl::IServer.

◆ move_to_colour_temperature()

Common::Result HF::Interfaces::ColourControl::Server::move_to_colour_temperature ( const Protocol::Address addr,
const MoveToTemperatureMessage message 
)
virtual

Callback that is called when a ColourControl::MOVE_TO_COLOUR_TEMPERATURE_CMD, is received.

Parameters
[in]addrthe network address to send the message to.
[in]messagethe MoveToTemperatureMessage received.
Return values
Result::OKif the request could be processed,
Result::FAIL_ARGotherwise.

Reimplemented from HF::Interfaces::ColourControl::IServer.

◆ move_to_hue()

Common::Result HF::Interfaces::ColourControl::Server::move_to_hue ( const Protocol::Address addr,
const MoveToHueMessage message 
)
virtual

Callback that is called when a ColourControl::MOVE_TO_HUE_CMD, is received.

Parameters
[in]addrthe network address to send the message to.
[in]messagethe MoveToHueMessage received.
Return values
Result::OKif the request could be processed,
Result::FAIL_ARGotherwise.

Reimplemented from HF::Interfaces::ColourControl::IServer.

◆ move_to_hue_and_saturation()

Common::Result HF::Interfaces::ColourControl::Server::move_to_hue_and_saturation ( const Protocol::Address addr,
const MoveToHueSaturationMessage message 
)
virtual

Callback that is called when a ColourControl::MOVE_TO_HUE_AND_SATURATION_CMD, is received.

Parameters
[in]addrthe network address to send the message to.
[in]messagethe MoveToHueSaturationMessage received.
Return values
Result::OKif the request could be processed,
Result::FAIL_ARGotherwise.

Reimplemented from HF::Interfaces::ColourControl::IServer.

◆ move_to_saturation()

Common::Result HF::Interfaces::ColourControl::Server::move_to_saturation ( const Protocol::Address addr,
const MoveToSaturationMessage message 
)
virtual

Callback that is called when a ColourControl::MOVE_TO_SATURATION_CMD, is received.

Parameters
[in]addrthe network address to send the message to.
[in]messagethe MoveToSaturationMessage received.
Return values
Result::OKif the request could be processed,
Result::FAIL_ARGotherwise.

Reimplemented from HF::Interfaces::ColourControl::IServer.

◆ move_to_xy()

Common::Result HF::Interfaces::ColourControl::Server::move_to_xy ( const Protocol::Address addr,
const MoveToXYMessage message 
)
virtual

Callback that is called when a ColourControl::MOVE_TO_XY_CMD, is received.

Parameters
[in]addrthe network address to send the message to.
[in]messagethe MoveToXYMessage received.
Return values
Result::OKif the request could be processed,
Result::FAIL_ARGotherwise.

Reimplemented from HF::Interfaces::ColourControl::IServer.

◆ move_xy()

Common::Result HF::Interfaces::ColourControl::Server::move_xy ( const Protocol::Address addr,
const MoveXYMessage message 
)
virtual

Callback that is called when a ColourControl::MOVE_XY_CMD, is received.

Parameters
[in]addrthe network address to send the message to.
[in]messagethe MoveXYMessage received.
Return values
Result::OKif the request could be processed,
Result::FAIL_ARGotherwise.

Reimplemented from HF::Interfaces::ColourControl::IServer.

◆ remove()

void HF::Interfaces::ColourControl::Server::remove ( IServer const &  itf)
inlineprotected

Remove a transition from the list.

Parameters
[in]itfthe server reference to search for a transition.

Definition at line 1647 of file colour_control.h.

1648  {
1649  auto compare = [&itf](ITransition *entry)
1650  {
1651  if (&(entry->server) == &(itf))
1652  {
1653  delete entry;
1654  return true;
1655  }
1656 
1657  return false;
1658  };
1659 
1660  transitions.erase(std::remove_if(transitions.begin(), transitions.end(),
1661  compare), transitions.end());
1662  }

◆ step_hue()

Common::Result HF::Interfaces::ColourControl::Server::step_hue ( const Protocol::Address addr,
const StepHueMessage message 
)
virtual

Callback that is called when a ColourControl::STEP_HUE_CMD, is received.

Parameters
[in]addrthe network address to send the message to.
[in]messagethe StepHueMessage received.
Return values
Result::OKif the request could be processed,
Result::FAIL_ARGotherwise.

Reimplemented from HF::Interfaces::ColourControl::IServer.

◆ step_saturation()

Common::Result HF::Interfaces::ColourControl::Server::step_saturation ( const Protocol::Address addr,
const StepSaturationMessage message 
)
virtual

Callback that is called when a ColourControl::STEP_SATURATION_CMD, is received.

Parameters
[in]addrthe network address to send the message to.
[in]messagethe StepSaturationMessage received.
Return values
Result::OKif the request could be processed,
Result::FAIL_ARGotherwise.

Reimplemented from HF::Interfaces::ColourControl::IServer.

◆ step_xy()

Common::Result HF::Interfaces::ColourControl::Server::step_xy ( const Protocol::Address addr,
const StepXYMessage message 
)
virtual

Callback that is called when a ColourControl::STEP_XY_CMD, is received.

Parameters
[in]addrthe network address to send the message to.
[in]messagethe StepXYMessage received.
Return values
Result::OKif the request could be processed,
Result::FAIL_ARGotherwise.

Reimplemented from HF::Interfaces::ColourControl::IServer.

◆ transition()

static uint16_t HF::Interfaces::ColourControl::Server::transition ( void  )
static

Method responsible for updating the all the transitions.

This method updates the time remaining until a transition needs to be ran. If the remaining time is 0 then it runs the transition.

Note
This method should only be called when a transition should occur. This isn't a polling method.
Returns
period (in units of 100msec) until the next transition.

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