vdr 2.7.7
cTimer Class Reference

#include <timers.h>

Public Member Functions

 cTimer (bool Instant=false, bool Pause=false, const cChannel *Channel=NULL)
 cTimer (const cEvent *Event, const char *FileName=NULL, const cTimer *PatternTimer=NULL)
 cTimer (const cTimer &Timer)
virtual ~cTimer () override
cTimeroperator= (const cTimer &Timer)
void CalcMargins (int &MarginStart, int &MarginStop, const cEvent *Event)
virtual int Compare (const cListObject &ListObject) const override
int Id (void) const
bool Recording (void) const
bool Pending (void) const
bool InVpsMargin (void) const
uint Flags (void) const
const cChannelChannel (void) const
time_t Day (void) const
int WeekDays (void) const
int Start (void) const
int Stop (void) const
int Priority (void) const
int Lifetime (void) const
const char * Pattern (void) const
const char * File (void) const
time_t FirstDay (void) const
const char * Aux (void) const
const char * Remote (void) const
bool Local (void) const
time_t Deferred (void) const
cString PatternAndFile (void) const
cString ToText (bool UseChannelID=false) const
cString ToDescr (void) const
const cEventEvent (void) const
bool Parse (const char *s)
bool Save (FILE *f)
bool IsSingleEvent (void) const
bool DayMatches (time_t t) const
void SetPattern (const char *Pattern)
void SetFile (const char *File)
bool IsPatternTimer (void) const
void CalcStartStopTime (time_t &startTime, time_t &stopTime, time_t t=0) const
time_t VpsTime (time_t t=0) const
bool Matches (void) const
bool Matches (time_t t) const
bool Matches (time_t t, bool Directly) const
bool Matches (time_t t, bool Directly, int Margin) const
bool Matches (time_t t, int Margin) const
eTimerMatch Matches (const cEvent *Event, int *Overlap=NULL) const
bool Expired (void) const
time_t StartTime (void) const
time_t StopTime (void) const
time_t StartTimeEvent (void) const
time_t StopTimeEvent (void) const
void SetId (int Id)
cTimerSpawnPatternTimer (const cEvent *Event, cTimers *Timers)
bool SpawnPatternTimers (const cSchedules *Schedules, cTimers *Timers)
bool AdjustSpawnedTimer (void)
void TriggerRespawn (void)
bool SetEventFromSchedule (const cSchedules *Schedules)
bool SetEvent (const cEvent *Event)
void SetRecording (bool Recording)
void SetPending (bool Pending)
void SetInVpsMargin (bool InVpsMargin)
void SetDay (time_t Day)
void SetWeekDays (int WeekDays)
void SetStart (int Start)
void SetStop (int Stop)
void SetPriority (int Priority)
void SetLifetime (int Lifetime)
void SetAux (const char *Aux)
void SetRemote (const char *Remote)
void SetDeferred (int Seconds)
void SetFlags (uint Flags)
void ClrFlags (uint Flags)
void InvFlags (uint Flags)
bool HasFlags (uint Flags) const
void Skip (void)
void OnOff (void)
cString PrintFirstDay (void) const
Public Member Functions inherited from cListObject
 cListObject (void)
virtual ~cListObject ()
void Append (cListObject *Object)
void Insert (cListObject *Object)
void Unlink (void)
int Index (void) const
cListObjectPrev (void) const
cListObjectNext (void) const

Static Public Member Functions

static int GetMDay (time_t t)
static int GetWDay (time_t t)
static time_t IncDay (time_t t, int Days)
static time_t SetTime (time_t t, int SecondsFromMidnight)
static int TimeToInt (int t)
static bool ParseDay (const char *s, time_t &Day, int &WeekDays)
static cString PrintDay (time_t Day, int WeekDays, bool SingleByteChars)

Private Attributes

cMutex mutex
int id
time_t startTime
time_t stopTime
int scheduleStateSet
int scheduleStateSpawn
int scheduleStateAdjust
time_t deferred
time_t vpsNotRunning
bool vpsActive
bool pending
bool inVpsMargin
uint flags
const cChannelchannel
time_t day
int weekdays
int start
int stop
int priority
int lifetime
char pattern [NAME_MAX *2+1]
char file [NAME_MAX *2+1]
char * aux
char * remote
const cEventevent

Friends

class cMenuEditTimer

Detailed Description

Definition at line 31 of file timers.h.

Constructor & Destructor Documentation

◆ cTimer() [1/3]

◆ cTimer() [2/3]

◆ cTimer() [3/3]

cTimer::cTimer ( const cTimer & Timer)

Definition at line 230 of file timers.c.

References aux, channel, cTimer(), flags, remote, and tfNone.

◆ ~cTimer()

cTimer::~cTimer ( )
overridevirtual

Definition at line 240 of file timers.c.

References aux, event, and remote.

Member Function Documentation

◆ AdjustSpawnedTimer()

◆ Aux()

const char * cTimer::Aux ( void ) const
inline

Definition at line 80 of file timers.h.

References aux.

Referenced by cRecording::cRecording(), and SetAux().

◆ CalcMargins()

void cTimer::CalcMargins ( int & MarginStart,
int & MarginStop,
const cEvent * Event )

Definition at line 283 of file timers.c.

References Event(), HasFlags(), max(), min(), Setup, and tfSpawned.

Referenced by AdjustSpawnedTimer(), cTimer(), and cTimer().

◆ CalcStartStopTime()

void cTimer::CalcStartStopTime ( time_t & startTime,
time_t & stopTime,
time_t t = 0 ) const

Calculates the raw start and stop time of this timer, as given by the user in the timer definition.

If t is given, and this is a repeating timer, the start and stop times on that day are returned (default is "today"). t can be any time_t value on the given day.

Definition at line 573 of file timers.c.

References day, DayMatches(), IncDay(), IsSingleEvent(), max(), SECSINDAY, SetTime(), start, startTime, stop, stopTime, and TimeToInt().

Referenced by Matches(), Matches(), Matches(), Matches(), SetEventFromSchedule(), and VpsTime().

◆ Channel()

◆ ClrFlags()

void cTimer::ClrFlags ( uint Flags)

◆ Compare()

int cTimer::Compare ( const cListObject & ListObject) const
overridevirtual

Must return 0 if this object is equal to ListObject, a positive value if it is "greater", and a negative value if it is "smaller".

Reimplemented from cListObject.

Definition at line 297 of file timers.c.

References cListObject::cListObject(), cTimer(), IsPatternTimer(), Pattern(), priority, and StartTime().

◆ Day()

time_t cTimer::Day ( void ) const
inline

Definition at line 71 of file timers.h.

References day.

Referenced by cTimers::GetTimer(), ParseDay(), PrintDay(), and SetDay().

◆ DayMatches()

bool cTimer::DayMatches ( time_t t) const

Definition at line 531 of file timers.c.

References day, GetWDay(), IsSingleEvent(), SetTime(), and weekdays.

Referenced by CalcStartStopTime().

◆ Deferred()

time_t cTimer::Deferred ( void ) const
inline

Definition at line 83 of file timers.h.

References deferred.

◆ Event()

const cEvent * cTimer::Event ( void ) const
inline

◆ Expired()

◆ File()

const char * cTimer::File ( void ) const
inline

Definition at line 78 of file timers.h.

References file.

Referenced by cRecording::cRecording(), cShutdownHandler::DoShutdown(), Matches(), SetFile(), and SpawnPatternTimer().

◆ FirstDay()

time_t cTimer::FirstDay ( void ) const
inline

Definition at line 79 of file timers.h.

References day, and weekdays.

Referenced by cMenuTimers::OnOff().

◆ Flags()

uint cTimer::Flags ( void ) const
inline

Definition at line 69 of file timers.h.

References flags.

Referenced by ClrFlags(), cSkinLCARSDisplayMenu::DrawTimer(), HasFlags(), InvFlags(), and SetFlags().

◆ GetMDay()

int cTimer::GetMDay ( time_t t)
static

Definition at line 518 of file timers.c.

Referenced by ParseDay().

◆ GetWDay()

int cTimer::GetWDay ( time_t t)
static

Definition at line 524 of file timers.c.

Referenced by DayMatches(), and cMenuEditDateItem::ToggleRepeating().

◆ HasFlags()

◆ Id()

◆ IncDay()

time_t cTimer::IncDay ( time_t t,
int Days )
static

Definition at line 536 of file timers.c.

Referenced by CalcStartStopTime(), ParseDay(), and Skip().

◆ InvFlags()

void cTimer::InvFlags ( uint Flags)

Definition at line 1130 of file timers.c.

References Flags(), and flags.

Referenced by OnOff().

◆ InVpsMargin()

bool cTimer::InVpsMargin ( void ) const
inline

Definition at line 68 of file timers.h.

References inVpsMargin.

Referenced by SetInVpsMargin().

◆ IsPatternTimer()

bool cTimer::IsPatternTimer ( void ) const
inline

◆ IsSingleEvent()

bool cTimer::IsSingleEvent ( void ) const

Definition at line 513 of file timers.c.

References weekdays.

Referenced by CalcStartStopTime(), cRecording::cRecording(), DayMatches(), Expired(), Matches(), and OnOff().

◆ Lifetime()

int cTimer::Lifetime ( void ) const
inline

Definition at line 76 of file timers.h.

References lifetime.

Referenced by cRecording::cRecording(), cTimer(), and SetLifetime().

◆ Local()

bool cTimer::Local ( void ) const
inline

Definition at line 82 of file timers.h.

References remote.

Referenced by HandleRemoteTimerModifications(), and TriggerRespawn().

◆ Matches() [1/6]

◆ Matches() [2/6]

bool cTimer::Matches ( time_t t) const
inline

Definition at line 110 of file timers.h.

References Matches().

Referenced by Matches().

◆ Matches() [3/6]

bool cTimer::Matches ( time_t t,
bool Directly ) const

◆ Matches() [4/6]

bool cTimer::Matches ( time_t t,
bool Directly,
int Margin ) const

◆ Matches() [5/6]

◆ Matches() [6/6]

◆ OnOff()

void cTimer::OnOff ( void )

◆ operator=()

◆ Parse()

◆ ParseDay()

bool cTimer::ParseDay ( const char * s,
time_t & Day,
int & WeekDays )
static

Definition at line 343 of file timers.c.

References Day(), day, GetMDay(), IncDay(), SetTime(), skipspace(), and WeekDays().

Referenced by Parse(), and ParseWeekDays().

◆ Pattern()

const char * cTimer::Pattern ( void ) const
inline

Definition at line 77 of file timers.h.

References pattern.

Referenced by Compare(), Matches(), SetPattern(), and SpawnPatternTimer().

◆ PatternAndFile()

cString cTimer::PatternAndFile ( void ) const

Definition at line 316 of file timers.c.

References file, IsPatternTimer(), pattern, and cString::sprintf().

Referenced by ToDescr(), and ToText().

◆ Pending()

bool cTimer::Pending ( void ) const
inline

Definition at line 67 of file timers.h.

References pending.

Referenced by cSkinLCARSDisplayMenu::DrawTimer(), SetPending(), and cRecordControls::Start().

◆ PrintDay()

cString cTimer::PrintDay ( time_t Day,
int WeekDays,
bool SingleByteChars )
static

Definition at line 402 of file timers.c.

References Day(), DAYBUFFERSIZE, tr, trNOOP, Utf8CharLen(), and WeekDays().

Referenced by PrintFirstDay(), cMenuEditDateItem::Set(), and ToText().

◆ PrintFirstDay()

cString cTimer::PrintFirstDay ( void ) const

Definition at line 436 of file timers.c.

References day, PrintDay(), and weekdays.

Referenced by cMenuTimers::OnOff().

◆ Priority()

int cTimer::Priority ( void ) const
inline

Definition at line 75 of file timers.h.

References priority.

Referenced by cRecording::cRecording(), cTimer(), cTimers::GetMatch(), SetPriority(), and cRecordControls::Start().

◆ Recording()

bool cTimer::Recording ( void ) const
inline

◆ Remote()

◆ Save()

bool cTimer::Save ( FILE * f)

Definition at line 506 of file timers.c.

References Remote(), and ToText().

◆ SetAux()

void cTimer::SetAux ( const char * Aux)

Definition at line 1102 of file timers.c.

References Aux(), and aux.

◆ SetDay()

void cTimer::SetDay ( time_t Day)

Definition at line 1072 of file timers.c.

References Day(), and day.

Referenced by AdjustSpawnedTimer().

◆ SetDeferred()

void cTimer::SetDeferred ( int Seconds)

Definition at line 1114 of file timers.c.

References deferred, isyslog, and ToDescr().

◆ SetEvent()

bool cTimer::SetEvent ( const cEvent * Event)

◆ SetEventFromSchedule()

◆ SetFile()

void cTimer::SetFile ( const char * File)

Definition at line 564 of file timers.c.

References File(), file, isempty(), and Utf8Strn0Cpy().

Referenced by cRecording::cRecording().

◆ SetFlags()

void cTimer::SetFlags ( uint Flags)

◆ SetId()

void cTimer::SetId ( int Id)

Definition at line 869 of file timers.c.

References Id().

Referenced by cTimers::Add(), HandleRemoteTimerModifications(), and cTimers::StoreRemoteTimers().

◆ SetInVpsMargin()

void cTimer::SetInVpsMargin ( bool InVpsMargin)

Definition at line 1065 of file timers.c.

References InVpsMargin(), inVpsMargin, isyslog, and ToDescr().

◆ SetLifetime()

void cTimer::SetLifetime ( int Lifetime)

Definition at line 1097 of file timers.c.

References Lifetime(), and lifetime.

◆ SetPattern()

void cTimer::SetPattern ( const char * Pattern)

Definition at line 559 of file timers.c.

References Pattern(), pattern, and Utf8Strn0Cpy().

◆ SetPending()

void cTimer::SetPending ( bool Pending)

Definition at line 1060 of file timers.c.

References Pending(), and pending.

Referenced by cRecordControls::Start().

◆ SetPriority()

void cTimer::SetPriority ( int Priority)

Definition at line 1092 of file timers.c.

References Priority(), and priority.

◆ SetRecording()

void cTimer::SetRecording ( bool Recording)

Definition at line 1051 of file timers.c.

References ClrFlags(), isyslog, Recording(), SetFlags(), tfRecording, and ToDescr().

◆ SetRemote()

void cTimer::SetRemote ( const char * Remote)

◆ SetStart()

void cTimer::SetStart ( int Start)

Definition at line 1082 of file timers.c.

References Start(), and start.

Referenced by AdjustSpawnedTimer().

◆ SetStop()

void cTimer::SetStop ( int Stop)

Definition at line 1087 of file timers.c.

References Stop(), and stop.

Referenced by AdjustSpawnedTimer().

◆ SetTime()

time_t cTimer::SetTime ( time_t t,
int SecondsFromMidnight )
static

◆ SetWeekDays()

void cTimer::SetWeekDays ( int WeekDays)

Definition at line 1077 of file timers.c.

References WeekDays(), and weekdays.

◆ Skip()

void cTimer::Skip ( void )

Definition at line 1140 of file timers.c.

References day, IncDay(), mutex, SetEvent(), SetTime(), startTime, and VpsTime().

Referenced by cMenuTimers::Delete(), OnOff(), and TimerStillRecording().

◆ SpawnPatternTimer()

cTimer * cTimer::SpawnPatternTimer ( const cEvent * Event,
cTimers * Timers )

◆ SpawnPatternTimers()

◆ Start()

int cTimer::Start ( void ) const
inline

Definition at line 73 of file timers.h.

References start.

Referenced by cTimers::GetTimer(), and SetStart().

◆ StartTime()

time_t cTimer::StartTime ( void ) const

The start time of this timer, which is the time as given by the user (for normal timers) or the start time of the event that is assigned to this timer (for VPS timers).

Definition at line 828 of file timers.c.

References Matches(), mutex, and startTime.

Referenced by AdjustSpawnedTimer(), Compare(), cRecording::cRecording(), GetWakeupTime(), Matches(), and StartTimeEvent().

◆ StartTimeEvent()

time_t cTimer::StartTimeEvent ( void ) const

the start/stop times as given by the event (for VPS timers), by event plus margins (for spawned non-VPS timers),

Definition at line 844 of file timers.c.

References event, HasFlags(), Setup, StartTime(), tfSpawned, and tfVps.

Referenced by cSkinLCARSDisplayMenu::DrawTimer().

◆ Stop()

int cTimer::Stop ( void ) const
inline

Definition at line 74 of file timers.h.

References stop.

Referenced by cTimers::GetTimer(), and SetStop().

◆ StopTime()

time_t cTimer::StopTime ( void ) const

The stop time of this timer, which is the time as given by the user (for normal timers) or the end time of the event that is assigned to this timer (for VPS timers).

Definition at line 836 of file timers.c.

References Matches(), mutex, and stopTime.

Referenced by AdjustSpawnedTimer(), cTimers::GetNextActiveTimer(), and StopTimeEvent().

◆ StopTimeEvent()

time_t cTimer::StopTimeEvent ( void ) const

or by the user (for normal timers)

Definition at line 855 of file timers.c.

References event, HasFlags(), Setup, StopTime(), tfSpawned, and tfVps.

Referenced by cSkinLCARSDisplayMenu::DrawTimer(), Expired(), and SpawnPatternTimers().

◆ TimeToInt()

int cTimer::TimeToInt ( int t)
static

Definition at line 338 of file timers.c.

Referenced by CalcStartStopTime().

◆ ToDescr()

◆ ToText()

◆ TriggerRespawn()

void cTimer::TriggerRespawn ( void )

◆ VpsTime()

time_t cTimer::VpsTime ( time_t t = 0) const

Returns the VPS time of this timer.

This is a shortcut for calling CalcStartStopTime() and using the result given in the startTime parameter. The parameter t is handed to CalcStartStopTime().

Definition at line 611 of file timers.c.

References CalcStartStopTime(), startTime, and stopTime.

Referenced by Expired(), and Skip().

◆ WeekDays()

int cTimer::WeekDays ( void ) const
inline

Definition at line 72 of file timers.h.

References weekdays.

Referenced by cTimers::GetTimer(), ParseDay(), PrintDay(), and SetWeekDays().

◆ cMenuEditTimer

friend class cMenuEditTimer
friend

Definition at line 32 of file timers.h.

References cMenuEditTimer.

Referenced by cMenuEditTimer.

Member Data Documentation

◆ aux

char* cTimer::aux
private

Definition at line 54 of file timers.h.

Referenced by Aux(), cTimer(), cTimer(), cTimer(), operator=(), Parse(), SetAux(), ToText(), and ~cTimer().

◆ channel

const cChannel* cTimer::channel
private

Definition at line 45 of file timers.h.

Referenced by Channel(), cTimer(), cTimer(), cTimer(), Matches(), operator=(), and Parse().

◆ day

time_t cTimer::day
mutableprivate

midnight of the day this timer shall hit, or of the first day it shall hit in case of a repeating timer

Definition at line 46 of file timers.h.

Referenced by CalcStartStopTime(), cTimer(), cTimer(), Day(), DayMatches(), FirstDay(), Matches(), OnOff(), operator=(), Parse(), ParseDay(), PrintFirstDay(), SetDay(), Skip(), and ToText().

◆ deferred

time_t cTimer::deferred
mutableprivate

Matches(time_t, ...) will return false if the current time is before this value.

Definition at line 40 of file timers.h.

Referenced by cTimer(), cTimer(), Deferred(), Matches(), operator=(), and SetDeferred().

◆ event

const cEvent* cTimer::event
private

Definition at line 56 of file timers.h.

Referenced by Event(), Expired(), Matches(), operator=(), SetEvent(), StartTimeEvent(), StopTimeEvent(), and ~cTimer().

◆ file

char cTimer::file[NAME_MAX *2+1]
mutableprivate

Definition at line 53 of file timers.h.

Referenced by cTimer(), cTimer(), File(), operator=(), Parse(), PatternAndFile(), SetFile(), and ToText().

◆ flags

uint cTimer::flags
private

◆ id

int cTimer::id
private

Definition at line 35 of file timers.h.

Referenced by Id(), and operator=().

◆ inVpsMargin

bool cTimer::inVpsMargin
private

Definition at line 43 of file timers.h.

Referenced by cTimer(), cTimer(), InVpsMargin(), operator=(), and SetInVpsMargin().

◆ lifetime

int cTimer::lifetime
private

Definition at line 51 of file timers.h.

Referenced by cTimer(), cTimer(), Lifetime(), operator=(), Parse(), SetLifetime(), and ToText().

◆ mutex

cMutex cTimer::mutex
mutableprivate

Definition at line 34 of file timers.h.

Referenced by Matches(), Matches(), Matches(), Skip(), StartTime(), and StopTime().

◆ pattern

char cTimer::pattern[NAME_MAX *2+1]
mutableprivate

◆ pending

bool cTimer::pending
private

Definition at line 43 of file timers.h.

Referenced by cTimer(), cTimer(), operator=(), Pending(), and SetPending().

◆ priority

int cTimer::priority
private

Definition at line 50 of file timers.h.

Referenced by Compare(), cTimer(), cTimer(), operator=(), Parse(), Priority(), SetPriority(), and ToText().

◆ remote

char* cTimer::remote
private

Definition at line 55 of file timers.h.

Referenced by cTimer(), cTimer(), cTimer(), Local(), operator=(), Remote(), SetRemote(), ToDescr(), and ~cTimer().

◆ scheduleStateAdjust

int cTimer::scheduleStateAdjust
private

Definition at line 39 of file timers.h.

Referenced by AdjustSpawnedTimer(), cTimer(), cTimer(), operator=(), and SetEvent().

◆ scheduleStateSet

int cTimer::scheduleStateSet
private

Definition at line 37 of file timers.h.

Referenced by cTimer(), cTimer(), operator=(), SetEvent(), and SetEventFromSchedule().

◆ scheduleStateSpawn

int cTimer::scheduleStateSpawn
private

Definition at line 38 of file timers.h.

Referenced by cTimer(), cTimer(), operator=(), SetEvent(), and SpawnPatternTimers().

◆ start

int cTimer::start
private

the start and stop time of this timer as given by the user,

Definition at line 48 of file timers.h.

Referenced by CalcStartStopTime(), cTimer(), cTimer(), operator=(), Parse(), SetStart(), Start(), ToDescr(), and ToText().

◆ startTime

time_t cTimer::startTime
mutableprivate

◆ stop

int cTimer::stop
private

in the form hhmm, with hh (00..23) and mm (00..59) added as hh*100+mm

Definition at line 49 of file timers.h.

Referenced by CalcStartStopTime(), cTimer(), cTimer(), operator=(), Parse(), SetStop(), Stop(), ToDescr(), and ToText().

◆ stopTime

time_t cTimer::stopTime
private

the time_t value calculated from 'day', 'start' and 'stop'

Definition at line 36 of file timers.h.

Referenced by CalcStartStopTime(), cTimer(), cTimer(), Matches(), Matches(), Matches(), Matches(), operator=(), SetEventFromSchedule(), StopTime(), and VpsTime().

◆ vpsActive

bool cTimer::vpsActive
mutableprivate

true if this is a VPS timer and the event is current

Definition at line 42 of file timers.h.

Referenced by cTimer(), cTimer(), Matches(), and operator=().

◆ vpsNotRunning

time_t cTimer::vpsNotRunning
mutableprivate

the time when a VPS event's running status changed to "not running"

Definition at line 41 of file timers.h.

Referenced by cTimer(), cTimer(), Matches(), and operator=().

◆ weekdays

int cTimer::weekdays
private

bitmask, lowest bits: SSFTWTM (the 'M' is the LSB)

Definition at line 47 of file timers.h.

Referenced by cTimer(), cTimer(), DayMatches(), FirstDay(), IsSingleEvent(), operator=(), Parse(), PrintFirstDay(), SetWeekDays(), ToText(), and WeekDays().


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