17 #ifndef HF_ITF_COLOUR_CONTROL_H 18 #define HF_ITF_COLOUR_CONTROL_H 28 namespace ColourControl
52 namespace ColourControl
82 typedef enum _Attributes
93 typedef enum _Mask : uint8_t
102 typedef enum _Direction : uint8_t
108 __LAST_DIRECTION_ = LONGEST
131 saturation(_saturation)
133 hue = _hue < HUE ? _hue : HUE - 1;
136 static constexpr
int HUE = 360;
137 static constexpr
int SATURATION = 0x100;
154 static int32_t
invert_angle(int32_t angle, uint16_t max_value);
171 uint16_t
final, uint16_t max);
175 +
sizeof(saturation);
192 if (this->hue != other.hue)
194 return (this->hue - other.hue);
198 if (this->hue != other.hue)
200 return (this->hue - other.hue);
212 if (this->hue != other.hue)
214 return (100 * (this->hue - other.hue) / static_cast<float>(this->hue));
218 if (this->hue != other.hue)
220 return (100 * (this->hue - other.hue) / static_cast<float>(this->hue));
232 return (hue == other.hue && saturation == other.saturation);
283 if (this->X != other.X)
285 return (this->X - other.X);
289 if (this->Y != other.Y)
291 return (this->Y - other.Y);
303 if (this->X != other.X)
305 return (100 * (this->X - other.X) / static_cast<float>(this->X));
309 if (this->Y != other.Y)
311 return (100 * (this->Y - other.Y) / static_cast<float>(this->Y));
323 return (X == other.X && Y == other.Y);
345 static constexpr uint8_t get_suport(
void)
348 #ifdef HF_ITF_COLOUR_CONTROL_HUE_AND_SATURATION_ATTR 351 #ifdef HF_ITF_COLOUR_CONTROL_XY_ATTR 354 #ifdef HF_ITF_COLOUR_CONTROL_HUE_AND_SATURATION_ATTR 454 this->hue =
hue < HS_Colour::HUE ?
hue : HS_Colour::HUE - 1;
494 this->rate = (
rate < HS_Colour::HUE ?
rate : HS_Colour::HUE - 1);
498 static constexpr uint16_t
min_size =
sizeof(uint8_t)
618 static constexpr uint16_t
min_size =
sizeof(uint8_t)
739 static constexpr uint16_t
min_size =
sizeof(XY_Colour::X)
740 +
sizeof(XY_Colour::Y)
854 static constexpr uint16_t
min_size =
sizeof(colour)
919 virtual bool run(uint16_t time)
938 virtual bool next() = 0;
970 bool run(uint16_t time);
974 return (
period != 0 ?
true :
false);
978 struct Hue_Transition_Continuous:
public ITransition
989 Hue_Transition_Continuous(IServer &_server, uint16_t period, int32_t step = 0):
990 ITransition(_server, period), step(step)
994 Hue_Transition_Continuous() =
default;
997 ~Hue_Transition_Continuous()
1001 bool run(uint16_t time);
1006 return (period != 0 ?
true :
false);
1039 bool run(uint16_t time);
1043 return (
period != 0 ?
true :
false);
1047 struct Saturation_Transition_Continuous:
public ITransition
1058 Saturation_Transition_Continuous(IServer &_server, uint16_t period, int32_t step = 0):
1059 ITransition(_server, period), step(step)
1063 Saturation_Transition_Continuous() =
default;
1066 ~Saturation_Transition_Continuous()
1069 bool run(uint16_t time);
1073 return (period != 0 ?
true :
false);
1109 bool run(uint16_t time);
1113 return (
period != 0 ?
true :
false);
1150 bool run(uint16_t time);
1154 return (
period != 0 ?
true :
false);
1184 bool run(uint16_t time);
1188 return (
period != 0 ?
true :
false);
1223 bool run(uint16_t time);
1227 return (
period != 0 ?
true :
false);
1243 #ifdef HF_ITF_COLOUR_CONTROL_HUE_AND_SATURATION_ATTR 1249 #ifdef HF_ITF_COLOUR_CONTROL_XY_ATTR 1255 #ifdef HF_ITF_COLOUR_CONTROL_COLOUR_TEMPERATURE_ATTR 1257 uint16_t _colour_temperature;
1418 #ifdef HF_ITF_COLOUR_CONTROL_STOP_CMD 1459 uint8_t
mode()
const;
1466 void mode(uint8_t __value);
1468 #ifdef HF_ITF_COLOUR_CONTROL_HUE_AND_SATURATION_ATTR 1482 void hue_and_saturation(
HS_Colour __value);
1486 #ifdef HF_ITF_COLOUR_CONTROL_XY_ATTR 1504 #ifdef HF_ITF_COLOUR_CONTROL_COLOUR_TEMPERATURE_ATTR 1511 uint16_t colour_temperature()
const;
1518 void colour_temperature(uint16_t __value);
1564 return transitions.empty() ? 0 : transitions.front()->remaining_time;
1622 #ifdef HF_ITF_COLOUR_CONTROL_STOP_CMD 1638 transitions.push_back(t);
1651 if (&(entry->server) == &(itf))
1660 transitions.erase(std::remove_if(transitions.begin(), transitions.end(),
1661 compare), transitions.end());
1692 Direction direction, uint16_t transition);
1726 Direction direction, uint16_t transition);
1792 int16_t Y_step, uint8_t time);
1803 uint16_t colour, uint16_t time);
1852 std::ostream &
operator<<(std::ostream &stream,
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
int16_t X_rate
The rate of change of X in units per seconds.
uint16_t size() const
Number bytes needed to serialize the message.
Hue and Saturation Transition.
uint16_t period
Time period for the transition (in 100 msec units).
virtual Common::Result move_xy(const Protocol::Address &addr, const MoveXYMessage &message)
Callback that is called when a ColourControl::MOVE_XY_CMD, is received.
Move Saturation Message class.
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
~XY_Transition_Continuous()
Empty destructor.
void move_saturation(const Protocol::Address &addr, Direction direction, uint8_t rate)
Send a HAN-FUN message containing a ColourControl::MOVE_SATURATION_CMD, to the given network address...
Move to XY Message class.
Move to Hue message class.
Common::Result move_hue(const Protocol::Address &addr, const MoveHueMessage &message)
Callback that is called when a ColourControl::MOVE_HUE_CMD, is received.
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
Common::Result step_xy(const Protocol::Address &addr, const StepXYMessage &message)
Callback that is called when a ColourControl::STEP_XY_CMD, is received.
MoveToXYMessage(XY_Colour colour=XY_Colour(0, 0), uint16_t time=0)
Constructor.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
Direction direction
Direction of movement.
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
uint16_t end
End value to stop the iteration.
MoveToSaturationMessage(uint8_t saturation=0, Direction dir=Direction::UP, uint16_t time=0)
Constructor.
static constexpr uint8_t ID
Attribute UID.
~Hue_Transition()
Empty destructor.
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.
static constexpr bool WRITABLE
Attribute Read/Write.
uint16_t time
Time of a single step transition in units of 100msec.
Colour Control Interface : Server side implementation.
ITransition(IServer &_server, uint16_t period)
Constructor.
virtual ~Server()
Destructor.
XY_Transition()=default
Default constructor.
uint16_t size() const
Number bytes needed to serialize the message.
virtual Common::Result move_saturation(const Protocol::Address &addr, const MoveSaturationMessage &message)
Callback that is called when a ColourControl::MOVE_SATURATION_CMD, is received.
Temperature_Transition()=default
Default constructor.
virtual bool run(uint16_t time)
Run the transition.
virtual Common::Result move_hue(const Protocol::Address &addr, const MoveHueMessage &message)
Callback that is called when a ColourControl::MOVE_HUE_CMD, is received.
Colour Control Interface : Server side implementation.
MoveXYMessage(int16_t X_rate=0, int16_t Y_rate=0)
Constructor.
uint16_t size() const
Number bytes needed to serialize the message.
Direction direction
Direction of movement.
static constexpr bool WRITABLE
Attribute Read/Write.
XY_Transition(IServer &_server, uint16_t period, int32_t X_step=0, int32_t Y_step=0, uint16_t n_steps=0, XY_Colour end=XY_Colour(0, 0))
Constructor.
int16_t X_step
The step size for X.
Saturation_Transition(IServer &_server, uint16_t period, int32_t step=0, uint16_t n_steps=0, uint16_t end=0)
Constructor.
static uint16_t has_transitions()
Check if there are transitions to run.
uint8_t supported() const
Get the supported modes bitmask for the Colour Control server.
XY_Transition_Continuous()=default
Default constructor.
int32_t sat_step
Saturation step.
void stop(const Protocol::Address &addr)
Send a HAN-FUN message containing a ColourControl::STOP_CMD, to the given network address...
uint16_t size() const
Number bytes needed to serialize the message.
Hue And Saturation attribute UID.
void move_to_hue(const Protocol::Address &addr, uint16_t hue, Direction direction, uint16_t transition)
Send a HAN-FUN message containing a ColourControl::MOVE_TO_HUE_CMD, to the given network address...
XY_Colour(uint16_t X, uint16_t Y)
Constructor.
Helper class to handle the Colour Temperature attribute for the Colour Control interface.
Move To Colour Temperature command UID.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
int compare(const XY_Colour &other) const
Compare this attribute with the given attribute in other.
uint16_t n_steps
Counter for the steps needed.
Colour Temperature attribute UID.
Move to Saturation Message class.
Colour Control interface UID.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
Return all mandatory attributes for the interface.
int32_t step
Hue or Saturation step.
Direction direction
Direction of movement.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
uint16_t size() const
Number bytes needed to serialize the message.
bool run(uint16_t time)
Run the transition.
Helper class template for parent class implementation of the interfaces.
Mask
Mask elements for Colour Modes.
Step Saturation Message class.
HS_Transition(IServer &_server, uint16_t period, int32_t hue_step=0, int32_t sat_step=0, uint16_t n_steps=0, HS_Colour end=HS_Colour(0, 0))
Constructor.
uint16_t end
End value to stop the iteration.
Helper class to add optional interfaces to other classes.
int32_t step
Temperature step.
Common::Result step_saturation(const Protocol::Address &addr, const StepSaturationMessage &message)
Callback that is called when a ColourControl::STEP_SATURATION_CMD, is received.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
bool operator!=(const XY_Colour &other) const
Operator not equal.
virtual 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.
virtual Common::Result step_xy(const Protocol::Address &addr, const StepXYMessage &message)
Callback that is called when a ColourControl::STEP_XY_CMD, is received.
uint16_t size() const
Number bytes needed to serialize the message.
This file contains the definitions for the HAN-FUN protocol messages.
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
Interface API for the Transitions.
Temperature_Transition(IServer &_server, uint16_t period, int32_t step=0, uint16_t n_steps=0, uint16_t end=0)
Constructor.
uint16_t remaining_time
Remaining time until the transition is ran.
uint16_t time
Time of transition in units of 100msec.
int compare(const HS_Colour &other) const
Compare this attribute with the given attribute in other.
uint16_t n_steps
Counter for the steps needed.
uint16_t size() const
Number bytes needed to serialize the message.
Move To Saturation command UID.
float changed(const XY_Colour &other) const
This method is used to get the percentage of change that the attribute has in relation to the value p...
int32_t hue_step
Hue step.
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.
std::vector< ITransition * > Container
Container for the transitions.
uint8_t time
Time of a single step transition (units of 100msec).
bool run(uint16_t time)
Run the transition.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
bool operator==(const HS_Colour &other) const
Operator equal.
Direction direction
Direction of movement.
MoveToHueSaturationMessage(HS_Colour colour=HS_Colour(0, 0), Direction dir=Direction::UP, uint16_t time=0)
Constructor.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
void move_to_saturation(const Protocol::Address &addr, uint8_t saturation, Direction direction, uint16_t transition)
Send a HAN-FUN message containing a ColourControl::MOVE_TO_SATURATION_CMD, to the given network addre...
float changed(const HS_Colour &other) const
This method is used to get the percentage of change that the attribute has in relation to the value p...
bool run(uint16_t time)
Run the transition.
static constexpr bool WRITABLE
Attribute Read/Write.
bool next()
Check if the transition should continue.
HS_Colour colour
New Hue and Saturation Colour.
Helper class to handle the XY attribute for the Colour Control interface.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
This file contains the definitions common to all interfaces.
virtual Common::Result step_hue(const Protocol::Address &addr, const StepHueMessage &message)
Callback that is called when a ColourControl::STEP_HUE_CMD, is received.
~Saturation_Transition()
Empty destructor.
Common::Result handle_command(Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset)
Handle incoming messages from the network.
uint16_t size() const
Number bytes needed to serialize the message.
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
int16_t Y_step
The step size for Y.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
uint16_t size() const
Number bytes needed to serialize the message.
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
Helper class to handle the Mode attribute for the Colour Control interface.
~XY_Transition()
Empty destructor.
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.
uint8_t _mode
Current Active Mode.
Move Saturation command UID.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
uint16_t size() const
Number bytes needed to serialize the message.
Helper class that supports the XY colour mode.
static constexpr uint8_t ID
Attribute UID.
Saturation_Transition()=default
Default constructor.
void move_hue(const Protocol::Address &addr, Direction direction, uint16_t rate)
Send a HAN-FUN message containing a ColourControl::MOVE_HUE_CMD, to the given network address...
uint8_t rate
Rate of change in degrees per second.
bool operator!=(const HS_Colour &other) const
Operator not equal.
HF::Interface const * owner() const
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
uint16_t rate
Rate of change in degrees per second.
Common::Result move_xy(const Protocol::Address &addr, const MoveXYMessage &message)
Callback that is called when a ColourControl::MOVE_XY_CMD, is received.
uint8_t step_size
Step size in degrees.
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
Helper class to handle the Supported attribute for the Colour Control interface.
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
virtual ~IServer()
Destructor.
uint16_t time
time of a single step transition (units of 100msec).
Hue_Transition(IServer &_server, uint16_t period, int32_t step=0, uint16_t n_steps=0, uint16_t end=0)
Constructor.
XY_Colour end
End value to stop the iteration.
bool next()
Check if the transition should continue.
static constexpr uint8_t ID
Attribute UID.
This class represents a byte array.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
HS_Colour(uint16_t _hue, uint8_t _saturation)
Constructor.
Direction
Direction of movement.
virtual bool next()=0
Check if the transition should continue.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
uint8_t mode() const
Get the current active mode for the Colour Control server.
bool operator==(const XY_Colour &other) const
Operator equal.
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.
MoveToTemperatureMessage(uint16_t colour=0, uint16_t time=0)
Constructor.
uint16_t uid() const
This method returns the interface UID.
uint16_t size() const
Number bytes needed to serialize the message.
uint16_t time
Time of a single step transition (units of 100msec).
Move to Hue and Saturation Message class.
MoveHueMessage(Direction dir=Direction::UP, uint16_t rate=0)
Constructor.
void move_xy(const Protocol::Address &addr, int16_t X_rate, int16_t Y_rate)
Send a HAN-FUN message containing a ColourControl::MOVE_XY_CMD, to the given network address...
static int32_t get_travel_distance(const Direction dir, uint16_t initial, uint16_t final, uint16_t max)
Helper method to get the angle between two hue/saturation values.
uint16_t hue
The value of the new Hue.
virtual Common::Result step_saturation(const Protocol::Address &addr, const StepSaturationMessage &message)
Callback that is called when a ColourControl::STEP_SATURATION_CMD, is received.
bool next()
Check if the transition should continue.
Common::Result move_saturation(const Protocol::Address &addr, const MoveSaturationMessage &message)
Callback that is called when a ColourControl::MOVE_SATURATION_CMD, is received.
static constexpr uint8_t ID
Attribute UID.
Direction direction
Direction of movement.
uint16_t size() const
Number bytes needed to serialize the message.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
static uint16_t transition(void)
Method responsible for updating the all the transitions.
void step_saturation(const Protocol::Address &addr, uint8_t step, Direction direction, uint8_t time)
Send a HAN-FUN message containing a ColourControl::STEP_SATURATION_CMD, to the given network address...
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
Helper class that supports the Hue and Saturation colour mode.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
Direction direction
Direction of movement.
HS_Transition()=default
Default constructor.
Common::Result step_hue(const Protocol::Address &addr, const StepHueMessage &message)
Callback that is called when a ColourControl::STEP_HUE_CMD, is received.
void move_to_hue_and_saturation(const Protocol::Address &addr, HS_Colour colour, Direction direction, uint16_t time)
Send a HAN-FUN message containing a ColourControl::MOVE_TO_HUE_AND_SATURATION_CMD, to the given network address.
Colour Control Interface : Parent.
static int32_t invert_angle(int32_t angle, uint16_t max_value)
Helper method to invert a traveling angle.
HF::Attributes::IAttribute * create_attribute(HF::Interfaces::Alert::Server *server, uint8_t uid)
Create an attribute object that can hold the attribute with the given uid.
Interface/Service Attribute API.
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
uint16_t n_steps
Counter for the steps needed.
int32_t step
Hue or Saturation step.
bool run(uint16_t time)
Run the transition.
IServer & server
The server instance.
StepHueMessage(uint8_t step_size=0, Direction dir=Direction::UP, uint8_t time=0)
Constructor.
void move_to_colour_temperature(const Protocol::Address &addr, uint16_t colour, uint16_t time)
Send a HAN-FUN message containing a ColourControl::MOVE_TO_COLOUR_TEMPERATURE_CMD, to the given network address.
void add_transition(ITransition *t)
Add a transition to the list.
uint16_t n_steps
Counter for the steps needed.
uint8_t saturation
The value of new saturation.
uint8_t _supported
Supported modes.
Colour Temperature Transition.
uint16_t time
Time of a single step transition in units of 100msec.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
XY_Transition_Continuous(IServer &_server, uint16_t period, int16_t X_step=0, int16_t Y_step=0)
Constructor.
bool run(uint16_t time)
Run the transition.
Move To Hue And Saturation command UID.
StepXYMessage(int16_t X_step=0, int16_t Y_step=0, uint8_t time=0)
Constructor.
virtual 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.
int16_t Y_rate
The rate of change of Y in units per seconds.
Direction direction
Direction of movement.
void step_xy(const Protocol::Address &addr, int16_t X_step, int16_t Y_step, uint8_t time)
Send a HAN-FUN message containing a ColourControl::STEP_XY_CMD, to the given network address...
uint8_t time
Time of a single step transition in units of 100msec.
uint16_t size() const
Number bytes needed to serialize the message.
virtual 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.
bool next()
Check if the transition should continue.
Helper class template for implementing a given interface role.
Colour Control Interface : Client side implementation.
bool run(uint16_t time)
Run the transition.
static constexpr bool WRITABLE
Attribute Read/Write.
Step Saturation command UID.
virtual 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.
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.
Helper template class to declare an attribute with the given T type.
HF::Attributes::IAttribute * attribute(uint8_t uid)
Return a pointer to the interface attribute with the given uid.
StepSaturationMessage(uint8_t step_size=0, Direction dir=Direction::UP, uint8_t time=0)
Constructor.
Attribute(const uint16_t interface, const uint8_t uid, const HF::Interface *__owner, uint8_t data, bool writable=false)
Attribute template constructor.
Helper class to handle the Hue And Saturation attribute for the Colour Control interface.
uint8_t time
Time of a single step transition in units of 100msec.
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
HS_Colour end
End value to stop the iteration.
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
std::ostream & operator<<(std::ostream &stream, const HF::Interfaces::ColourControl::CMD command)
Convert the given command into a string and write it to the given stream.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
HF::Attributes::IAttribute * create_attribute(uint8_t uid)
Create an attribute object that can hold the attribute with the given uid. (HF::Interfaces::ColourCon...
MoveSaturationMessage(Direction dir=Direction::UP, uint8_t rate=0)
Constructor.
uint8_t step_size
Step size in degrees.
Common interface for all Interfaces.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
virtual 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.
MoveToHueMessage(uint16_t hue=0, Direction direction=Direction::SHORTEST, uint16_t time=0)
Constructor.
~HS_Transition()
Empty destructor.
uint16_t pack(Common::ByteArray &array, uint16_t offset=0) const
Write the object on to a ByteArray so it can be sent over the network.
Move to Colour Temperature Message class.
bool next()
Check if the transition should continue.
bool next()
Check if the transition should continue.
void step_hue(const Protocol::Address &addr, uint8_t step, Direction direction, uint8_t time)
Send a HAN-FUN message containing a ColourControl::STEP_HUE_CMD, to the given network address...
static constexpr bool WRITABLE
Attribute Read/Write.
virtual void changed(void)
Inform the APP that a new transition was added.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
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.
Result
Commands result codes.
uint16_t n_steps
Counter for the steps needed.
Hue_Transition()=default
Default constructor.
uint16_t end
End value to stop the iteration.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
~Temperature_Transition()
Empty destructor.
static constexpr uint8_t ID
Attribute UID.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
Top-level namespace for the HAN-FUN library.
void move_to_xy(const Protocol::Address &addr, XY_Colour colour, uint16_t time)
Send a HAN-FUN message containing a ColourControl::MOVE_TO_XY_CMD, to the given network address...