hueplusplus  1.0.0
Public Member Functions | List of all members
hueplusplus::time::RecurringTime Class Reference

Time repeated weekly to daily, with possible random variation. More...

#include <hueplusplus/TimePattern.h>

Public Member Functions

 RecurringTime (clock::duration daytime, Weekdays days, clock::duration variation=std::chrono::seconds(0))
 Create recurring time. More...
 
clock::duration getDaytime () const
 Get time of day. More...
 
clock::duration getRandomVariation () const
 Get random variation. More...
 
Weekdays getWeekdays () const
 Get days on which the repetition will happen. More...
 
std::string toString () const
 Get formatted string as expected by Hue API. More...
 

Detailed Description

Time repeated weekly to daily, with possible random variation.

Can be used to represent a time on one or multiple days per week. It can also have a random variation of up to 12 hours.

Constructor & Destructor Documentation

◆ RecurringTime()

hueplusplus::time::RecurringTime::RecurringTime ( clock::duration  daytime,
Weekdays  days,
clock::duration  variation = std::chrono::seconds(0) 
)
explicit

Create recurring time.

Parameters
daytimeTime of day, duration from the start of the day.
daysDays to repeat on, should not be Weekdays::none()
variationRandom variation, optional. Must be less than 12 hours. When not zero, the time is randomly chosen between daytime - variation and daytime + variation

Member Function Documentation

◆ getDaytime()

system_clock::duration hueplusplus::time::RecurringTime::getDaytime ( ) const

Get time of day.

◆ getRandomVariation()

system_clock::duration hueplusplus::time::RecurringTime::getRandomVariation ( ) const

Get random variation.

The time can vary up to this amount in both directions.

◆ getWeekdays()

Weekdays hueplusplus::time::RecurringTime::getWeekdays ( ) const

Get days on which the repetition will happen.

◆ toString()

std::string hueplusplus::time::RecurringTime::toString ( ) const

Get formatted string as expected by Hue API.

Returns
with no variation: Wbbb/Thh:mm:ss
with variation: Wbbb/Thh:mm:ssAhh:mm:ss, where daytime is first and variation is second.

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