2002-10-20 12:28:55 +02:00
|
|
|
/*
|
|
|
|
* timers.h: Timer handling
|
|
|
|
*
|
|
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
|
|
* how to reach the author.
|
|
|
|
*
|
2004-02-29 14:21:22 +01:00
|
|
|
* $Id: timers.h 1.7 2004/02/29 14:18:17 kls Exp $
|
2002-10-20 12:28:55 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __TIMERS_H
|
|
|
|
#define __TIMERS_H
|
|
|
|
|
|
|
|
#include "channels.h"
|
|
|
|
#include "config.h"
|
2003-12-22 13:29:24 +01:00
|
|
|
#include "epg.h"
|
2002-10-20 12:28:55 +02:00
|
|
|
#include "tools.h"
|
|
|
|
|
2004-02-29 14:21:22 +01:00
|
|
|
enum eTimerFlags { tfNone = 0x0000,
|
|
|
|
tfActive = 0x0001,
|
|
|
|
tfInstant = 0x0002,
|
|
|
|
tfVps = 0x0004,
|
|
|
|
tfAll = 0xFFFF,
|
|
|
|
};
|
|
|
|
enum eTimerMatch { tmNone, tmPartial, tmFull };
|
2002-10-20 12:28:55 +02:00
|
|
|
|
|
|
|
class cTimer : public cListObject {
|
|
|
|
friend class cMenuEditTimer;
|
|
|
|
private:
|
|
|
|
time_t startTime, stopTime;
|
|
|
|
static char *buffer;
|
2004-02-29 14:21:22 +01:00
|
|
|
bool recording, pending, inVpsMargin;
|
|
|
|
int flags;
|
2002-10-20 12:28:55 +02:00
|
|
|
cChannel *channel;
|
|
|
|
int day;
|
|
|
|
int start;
|
|
|
|
int stop;
|
|
|
|
int priority;
|
|
|
|
int lifetime;
|
|
|
|
char file[MaxFileName];
|
|
|
|
time_t firstday;
|
|
|
|
char *summary;
|
2004-02-29 14:21:22 +01:00
|
|
|
const cEvent *event;
|
2002-10-20 12:28:55 +02:00
|
|
|
public:
|
2003-05-11 14:10:00 +02:00
|
|
|
cTimer(bool Instant = false, bool Pause = false);
|
2003-12-22 13:29:24 +01:00
|
|
|
cTimer(const cEvent *Event);
|
2002-10-20 12:28:55 +02:00
|
|
|
virtual ~cTimer();
|
|
|
|
cTimer& operator= (const cTimer &Timer);
|
|
|
|
virtual bool operator< (const cListObject &ListObject);
|
|
|
|
bool Recording(void) { return recording; }
|
|
|
|
bool Pending(void) { return pending; }
|
2004-02-29 14:21:22 +01:00
|
|
|
bool InVpsMargin(void) { return inVpsMargin; }
|
|
|
|
int Flags(void) { return flags; }
|
2002-10-20 12:28:55 +02:00
|
|
|
const cChannel *Channel(void) { return channel; }
|
|
|
|
int Day(void) { return day; }
|
|
|
|
int Start(void) { return start; }
|
|
|
|
int Stop(void) { return stop; }
|
|
|
|
int Priority(void) { return priority; }
|
|
|
|
int Lifetime(void) { return lifetime; }
|
|
|
|
const char *File(void) { return file; }
|
|
|
|
time_t FirstDay(void) { return firstday; }
|
|
|
|
const char *Summary(void) { return summary; }
|
2002-11-10 15:50:21 +01:00
|
|
|
const char *ToText(bool UseChannelID = false);
|
2004-02-29 14:21:22 +01:00
|
|
|
const cEvent *Event(void) { return event; }
|
2002-10-20 12:28:55 +02:00
|
|
|
bool Parse(const char *s);
|
|
|
|
bool Save(FILE *f);
|
|
|
|
bool IsSingleEvent(void);
|
|
|
|
int GetMDay(time_t t);
|
|
|
|
int GetWDay(time_t t);
|
|
|
|
bool DayMatches(time_t t);
|
|
|
|
static time_t IncDay(time_t t, int Days);
|
|
|
|
static time_t SetTime(time_t t, int SecondsFromMidnight);
|
|
|
|
char *SetFile(const char *File);
|
2004-02-29 14:21:22 +01:00
|
|
|
bool Matches(time_t t = 0, bool Directly = false);
|
|
|
|
int Matches(const cEvent *Event);
|
2002-10-20 12:28:55 +02:00
|
|
|
time_t StartTime(void);
|
|
|
|
time_t StopTime(void);
|
2004-02-29 14:21:22 +01:00
|
|
|
void SetEvent(const cEvent *Event);
|
2002-10-20 12:28:55 +02:00
|
|
|
void SetRecording(bool Recording);
|
|
|
|
void SetPending(bool Pending);
|
2004-02-29 14:21:22 +01:00
|
|
|
void SetInVpsMargin(bool InVpsMargin);
|
|
|
|
void SetFlags(int Flags);
|
|
|
|
void ClrFlags(int Flags);
|
|
|
|
void InvFlags(int Flags);
|
|
|
|
bool HasFlags(int Flags);
|
2002-10-20 12:28:55 +02:00
|
|
|
void Skip(void);
|
|
|
|
void OnOff(void);
|
|
|
|
const char *PrintFirstDay(void);
|
|
|
|
static int TimeToInt(int t);
|
|
|
|
static int ParseDay(const char *s, time_t *FirstDay = NULL);
|
|
|
|
static const char *PrintDay(int d, time_t FirstDay = 0);
|
|
|
|
};
|
|
|
|
|
|
|
|
class cTimers : public cConfig<cTimer> {
|
2003-02-09 13:14:44 +01:00
|
|
|
private:
|
|
|
|
int beingEdited;
|
2002-10-20 12:28:55 +02:00
|
|
|
public:
|
|
|
|
cTimer *GetTimer(cTimer *Timer);
|
|
|
|
cTimer *GetMatch(time_t t);
|
2004-02-29 14:21:22 +01:00
|
|
|
cTimer *GetMatch(const cEvent *Event, int *Match = NULL);
|
2002-10-20 12:28:55 +02:00
|
|
|
cTimer *GetNextActiveTimer(void);
|
2003-02-09 13:14:44 +01:00
|
|
|
int BeingEdited(void) { return beingEdited; }
|
|
|
|
void IncBeingEdited(void) { beingEdited++; }
|
|
|
|
void DecBeingEdited(void) { beingEdited--; }
|
2004-02-29 14:21:22 +01:00
|
|
|
void SetEvents(void);
|
2002-10-20 12:28:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern cTimers Timers;
|
|
|
|
|
|
|
|
#endif //__TIMERS_H
|