Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
Behaviour Class Reference

Class to derrive behaviours from, centralizing common variables such as from and until times. More...

#include <cs_Behaviour.h>

Inheritance diagram for Behaviour:
Collaboration diagram for Behaviour:

Public Types

enum class  Type : uint8_t { Switch = 0 , Twilight = 1 , Extended = 2 , Undefined = 0xff }
 
typedef std::array< uint8_t, 1+13 > SerializedDataType
 

Public Member Functions

virtual ~Behaviour ()=default
 
 Behaviour (Type typ, uint8_t intensity, uint8_t profileid, DayOfWeekBitMask activedaysofweek, TimeOfDay from, TimeOfDay until)
 
 Behaviour (SerializedDataType arr)
 
SerializedDataType serialize ()
 
virtual uint8_t * serialize (uint8_t *outbuff, size_t max_size)
 
virtual size_t serializedSize () const
 
std::vector< uint8_t > serialized ()
 
virtual void print ()
 
virtual Type getType () const
 
bool isValid (Time currenttime)
 Does the behaviour apply to the current situation? If from() == until() the behaviour isValid all day. More...
 
virtual bool requiresPresence ()
 
virtual bool requiresAbsence ()
 
uint8_t value () const
 Returns the intended state when this behaviour is valid. More...
 
TimeOfDay from () const
 Returns from (incl.) which time on this behaviour applies. More...
 
TimeOfDay until () const
 Returns until (excl.) which time on this behaviour applies. More...
 

Protected Attributes

Type typ
 
uint8_t activeIntensity = 0
 
uint8_t profileId = 0
 
DayOfWeekBitMask activeDays
 
TimeOfDay behaviourAppliesFrom = TimeOfDay::Midnight()
 
TimeOfDay behaviourAppliesUntil = TimeOfDay::Midnight()
 

Detailed Description

Class to derrive behaviours from, centralizing common variables such as from and until times.

Member Typedef Documentation

◆ SerializedDataType

typedef std::array<uint8_t, 1 + 13> Behaviour::SerializedDataType

Member Enumeration Documentation

◆ Type

enum class Behaviour::Type : uint8_t
strong
Enumerator
Switch 
Twilight 
Extended 
Undefined 

Constructor & Destructor Documentation

◆ ~Behaviour()

virtual Behaviour::~Behaviour ( )
virtualdefault

◆ Behaviour() [1/2]

Behaviour::Behaviour ( Type  typ,
uint8_t  intensity,
uint8_t  profileid,
DayOfWeekBitMask  activedaysofweek,
TimeOfDay  from,
TimeOfDay  until 
)

◆ Behaviour() [2/2]

Member Function Documentation

◆ from()

TimeOfDay Behaviour::from ( ) const

Returns from (incl.) which time on this behaviour applies.

◆ getType()

virtual Type Behaviour::getType ( ) const
inlinevirtual

◆ isValid()

bool Behaviour::isValid ( Time  currenttime)

Does the behaviour apply to the current situation? If from() == until() the behaviour isValid all day.

Also checks the day of week bitmask.

◆ print()

virtual void Behaviour::print ( )
virtual

◆ requiresAbsence()

virtual bool Behaviour::requiresAbsence ( )
inlinevirtual

Reimplemented in ExtendedSwitchBehaviour, and SwitchBehaviour.

◆ requiresPresence()

virtual bool Behaviour::requiresPresence ( )
inlinevirtual

Reimplemented in ExtendedSwitchBehaviour, and SwitchBehaviour.

◆ serialize() [1/2]

SerializedDataType Behaviour::serialize ( )

◆ serialize() [2/2]

virtual uint8_t * Behaviour::serialize ( uint8_t *  outbuff,
size_t  max_size 
)
virtual

◆ serialized()

std::vector< uint8_t > Behaviour::serialized ( )

◆ serializedSize()

virtual size_t Behaviour::serializedSize ( ) const
virtual

◆ until()

TimeOfDay Behaviour::until ( ) const

Returns until (excl.) which time on this behaviour applies.

◆ value()

uint8_t Behaviour::value ( ) const

Returns the intended state when this behaviour is valid.

Member Data Documentation

◆ activeDays

DayOfWeekBitMask Behaviour::activeDays
protected

◆ activeIntensity

uint8_t Behaviour::activeIntensity = 0
protected

◆ behaviourAppliesFrom

TimeOfDay Behaviour::behaviourAppliesFrom = TimeOfDay::Midnight()
protected

◆ behaviourAppliesUntil

TimeOfDay Behaviour::behaviourAppliesUntil = TimeOfDay::Midnight()
protected

◆ profileId

uint8_t Behaviour::profileId = 0
protected

◆ typ

Type Behaviour::typ
protected

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