17 #ifndef HF_ITF_SIMPLE_VISUAL_EFFECTS_H 18 #define HF_ITF_SIMPLE_VISUAL_EFFECTS_H 28 namespace SimpleVisualEffects
53 namespace SimpleVisualEffects
92 static constexpr uint16_t
min_size =
sizeof(uint16_t);
137 BlinkEffect(uint16_t _duty_cycle_on = 0, uint16_t _duty_cycle_off = 0,
138 uint16_t _number_of_cycles = 1):
duty_cycle_on(_duty_cycle_on),
142 static constexpr uint16_t
min_size = 3 *
sizeof(uint16_t);
197 FadeEffect(uint8_t _start = 0, uint8_t _end = 0, uint16_t _duration = 0):
201 static constexpr uint16_t
min_size = 2 *
sizeof(uint8_t) +
sizeof(uint16_t);
227 offset += array.
read(offset,
end);
250 uint16_t _ste_duration = 0,
251 uint8_t _end = 0, uint16_t _end_hold = 0, uint16_t _ets_duration = 0,
252 uint16_t _number_of_cycles = 1):
258 static constexpr uint16_t
min_size = 2 *
sizeof(uint8_t) + 5 *
sizeof(uint16_t);
298 offset += array.
read(offset,
end);
384 #ifdef HF_ITF_SIMPLE_VISUAL_EFFECTS_BLINK_CMD 395 #ifdef HF_ITF_SIMPLE_VISUAL_EFFECTS_FADE_CMD 406 #ifdef HF_ITF_SIMPLE_VISUAL_EFFECTS_BREATHE_CMD 443 #ifdef HF_ITF_SIMPLE_VISUAL_EFFECTS_ON_CMD 459 void on(uint16_t duration)
466 #ifdef HF_ITF_SIMPLE_VISUAL_EFFECTS_OFF_CMD 486 #ifdef HF_ITF_SIMPLE_VISUAL_EFFECTS_BLINK_CMD 509 #ifdef HF_ITF_SIMPLE_VISUAL_EFFECTS_FADE_CMD 530 #ifdef HF_ITF_SIMPLE_VISUAL_EFFECTS_BREATHE_CMD 549 breathe(addr, effect);
592 std::ostream &
operator<<(std::ostream &stream,
OnEffect(uint16_t _duration=0)
Constructor.
This structure represents the parameters required for the ON_CMD effect.
uint16_t duty_cycle_off
Number of miliseconds to keep visual indicator OFF.
virtual void off(const Protocol::Address &addr)
Callback that is called when a SimpleVisualEffects::OFF_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.
Simple Visual Effects Interface : Parent.
This structure represents the parameters required for the BLICK_CMD effect.
uint16_t write(uint16_t offset, uint8_t data)
Write a byte into the array at the given offset.
uint16_t ste_duration
Number of miliseconds to go from start to end brightness.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
static constexpr uint16_t min_number_of_cycles
Minimum value for number_of_cycles parameter.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
uint16_t size() const
Number bytes needed to serialize the message.
#define HF_ASSERT(_expr, _block)
Helper macro to check for correct assumptions.
uint16_t size() const
Number bytes needed to serialize the message.
Helper class template for parent class implementation of the interfaces.
uint16_t duty_cycle_on
Number of miliseconds to keep visual indicator ON.
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.
BlinkEffect(uint16_t _duty_cycle_on=0, uint16_t _duty_cycle_off=0, uint16_t _number_of_cycles=1)
Constructor.
uint16_t unpack(const Common::ByteArray &array, uint16_t offset=0)
Read a message from a ByteArray.
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.
uint8_t start
Start brightness in percentage.
uint16_t duration
How long to keep the visual indicator ON in miliseconds.
Simple Visual Effects Interface : Server side implementation.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
uint8_t end
End brightness in percentage.
This structure represents the parameters required for the FADE_CMD effect.
#define HF_SERIALIZABLE_CHECK(__array, __offset, __size)
Helper macro to check if the given __array has enough size so __size bytes can be written/read from t...
This file contains the definitions common to all interfaces.
uint16_t number_of_cycles
Number of times to repeat the ON-OFF cycle.
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.
virtual void on(const Protocol::Address &addr, const OnEffect &effect)
Callback that is called when a SimpleVisualEffects::ON_CMD, is received.
std::ostream & operator<<(std::ostream &stream, const HF::Interfaces::SimpleVisualEffects::CMD command)
Convert the given command into a string and write it to the given stream.
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.
static constexpr uint16_t min_number_of_cycles
Minimum value for number_of_cycles parameter.
HF::Attributes::IAttribute * create_attribute(uint8_t uid)
Create an attribute object that can hold the attribute with the given uid. (HF::Interfaces::SimpleVis...
This class represents a byte array.
Simple Visual Effects Interface : Client side implementation.
Simple Visual Effects interface UID.
uint8_t end
End brightness in percentage.
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_hold
Number of miliseconds to hold end brightness.
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.
static constexpr uint16_t min_size
Minimum pack/unpack required data size.
Interface/Service Attribute API.
uint16_t read(uint16_t offset, uint8_t &data) const
Read the byte at offset into data.
This structure represents the parameters required for the BREATHE_CMD effect.
Helper class template for implementing a given interface role.
uint16_t start_hold
Number of miliseconds to hold start brightness.
uint16_t duration
Time in miliseconds to go from start to end brightness.
Common::Result handle_command(Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset)
Handle incoming messages from the network.
uint16_t ets_duration
Number of miliseconds to go from end to start brightness.
uint16_t number_of_cycles
Number of times to repeat the Start-End-Start cycle.
uint8_t start
Start brightness in percentage.
Result
Commands result codes.
virtual ~Server()
Destructor.
Top-level namespace for the HAN-FUN library.