vdr 2.7.7
|
#include <timers.h>
Public Member Functions | |
cTimers (void) | |
const cTimer * | GetById (int Id, const char *Remote=NULL) const |
cTimer * | GetById (int Id, const char *Remote=NULL) |
const cTimer * | GetTimer (const cTimer *Timer) const |
cTimer * | GetTimer (const cTimer *Timer) |
const cTimer * | GetMatch (time_t t) const |
cTimer * | GetMatch (time_t t) |
const cTimer * | GetMatch (const cEvent *Event, eTimerMatch *Match=NULL) const |
cTimer * | GetMatch (const cEvent *Event, eTimerMatch *Match=NULL) |
const cTimer * | GetTimerForEvent (const cEvent *Event, eTimerFlags Flags=tfNone) const |
int | GetMaxPriority (void) const |
const cTimer * | GetNextActiveTimer (void) const |
const cTimer * | UsesChannel (const cChannel *Channel) const |
bool | SetEvents (const cSchedules *Schedules) |
bool | SpawnPatternTimers (const cSchedules *Schedules) |
bool | AdjustSpawnedTimers (void) |
bool | DeleteExpired (bool Force) |
void | Add (cTimer *Timer, cTimer *After=NULL) |
void | Ins (cTimer *Timer, cTimer *Before=NULL) |
void | Del (cTimer *Timer, bool DeleteObject=true) |
bool | StoreRemoteTimers (const char *ServerName=NULL, const cStringList *RemoteTimers=NULL) |
Public Member Functions inherited from cConfig< cTimer > | |
cConfig (const char *NeedsLocking=NULL) | |
virtual | ~cConfig () override |
const char * | FileName (void) |
bool | Load (const char *FileName=NULL, bool AllowComments=false, bool MustExist=false) |
bool | Save (void) const |
Public Member Functions inherited from cList< cTimer > | |
cList (const char *NeedsLocking=NULL) | |
const cTimer * | Get (int Index) const |
const cTimer * | First (void) const |
const cTimer * | Last (void) const |
const cTimer * | Prev (const cTimer *Object) const |
const cTimer * | Next (const cTimer *Object) const |
Public Member Functions inherited from cListBase | |
virtual | ~cListBase () |
bool | Lock (cStateKey &StateKey, bool Write=false, int TimeoutMs=0) const |
void | SetSyncStateKey (cStateKey &StateKey) |
void | SetUseGarbageCollector (void) |
void | SetExplicitModify (void) |
void | SetModified (void) |
void | Add (cListObject *Object, cListObject *After=NULL) |
void | Ins (cListObject *Object, cListObject *Before=NULL) |
void | Del (cListObject *Object, bool DeleteObject=true) |
virtual void | Move (int From, int To) |
void | Move (cListObject *From, cListObject *To) |
bool | Contains (const cListObject *Object) const |
const cListObject * | Get (int Index) const |
cListObject * | Get (int Index) |
int | Count (void) const |
void | Sort (void) |
Static Public Member Functions | |
static const cTimers * | GetTimersRead (cStateKey &StateKey, int TimeoutMs=0) |
static cTimers * | GetTimersWrite (cStateKey &StateKey, int TimeoutMs=0) |
static bool | Load (const char *FileName) |
static int | NewTimerId (void) |
Private Attributes | |
time_t | lastDeleteExpired |
Static Private Attributes | |
static cTimers | timers |
static int | lastTimerId = 0 |
Additional Inherited Members | |
Protected Member Functions inherited from cListBase | |
cListBase (const char *NeedsLocking=NULL) | |
Protected Attributes inherited from cListBase | |
cListObject * | objects |
cListObject * | lastObject |
int | count |
cStateLock | stateLock |
const char * | needsLocking |
bool | useGarbageCollector |
cTimers::cTimers | ( | void | ) |
Definition at line 1171 of file timers.c.
References cConfig< cTimer >::cConfig(), and lastDeleteExpired.
Referenced by GetById(), GetMatch(), GetMatch(), GetTimer(), GetTimersRead(), and GetTimersWrite().
Definition at line 1305 of file timers.c.
References cListBase::Add(), cStatus::MsgTimerChange(), NewTimerId(), cTimer::Remote(), cTimer::SetId(), and tcAdd.
Referenced by cRecordControl::cRecordControl(), cTimer::SpawnPatternTimer(), and StoreRemoteTimers().
bool cTimers::AdjustSpawnedTimers | ( | void | ) |
Definition at line 1356 of file timers.c.
References cList< cTimer >::First(), cList< cTimer >::Next(), tfSpawned, and tfVps.
Referenced by main().
void cTimers::Del | ( | cTimer * | Timer, |
bool | DeleteObject = true ) |
Definition at line 1319 of file timers.c.
References cListBase::Del(), cStatus::MsgTimerChange(), and tcDel.
Referenced by cRecordControl::cRecordControl(), cMenuTimers::Delete(), DeleteExpired(), and StoreRemoteTimers().
bool cTimers::DeleteExpired | ( | bool | Force | ) |
Definition at line 1370 of file timers.c.
References Del(), DELETE_EXPIRED_TIMEOUT, cTimer::Expired(), cList< cTimer >::First(), isyslog, lastDeleteExpired, cList< cTimer >::Next(), cTimer::Remote(), cTimer::SetEvent(), cTimer::ToDescr(), and cTimer::TriggerRespawn().
Referenced by main().
|
inline |
const cTimer * cTimers::GetById | ( | int | Id, |
const char * | Remote = NULL ) const |
Definition at line 1197 of file timers.c.
References cList< cTimer >::First(), and cList< cTimer >::Next().
Referenced by StoreRemoteTimers().
|
inline |
const cTimer * cTimers::GetMatch | ( | const cEvent * | Event, |
eTimerMatch * | Match = NULL ) const |
Definition at line 1245 of file timers.c.
References cList< cTimer >::First(), cTimer::IsPatternTimer(), cList< cTimer >::Next(), cTimer::Remote(), tfSpawned, tmFull, and tmNone.
|
inline |
const cTimer * cTimers::GetMatch | ( | time_t | t | ) | const |
Definition at line 1221 of file timers.c.
References cList< cTimer >::First(), LOCK_SCHEDULES_READ, cList< cTimer >::Next(), and cTimer::Priority().
Referenced by cMenuEvent::cMenuEvent(), main(), and cMenuScheduleItem::Update().
int cTimers::GetMaxPriority | ( | void | ) | const |
Returns the maximum priority of all local timers that are currently recording.
If there is no local timer currently recording, -1 is returned.
Definition at line 1272 of file timers.c.
References cList< cTimer >::First(), max(), and cList< cTimer >::Next().
Referenced by main().
const cTimer * cTimers::GetNextActiveTimer | ( | void | ) | const |
Definition at line 1282 of file timers.c.
References cList< cTimer >::First(), cList< cTimer >::Next(), cTimer::StopTime(), and tfActive.
Definition at line 1208 of file timers.c.
References cTimer::Channel(), cTimer::Day(), cList< cTimer >::First(), cList< cTimer >::Next(), cTimer::Start(), cTimer::Stop(), and cTimer::WeekDays().
const cTimer * cTimers::GetTimerForEvent | ( | const cEvent * | Event, |
eTimerFlags | Flags = tfNone ) const |
Definition at line 1261 of file timers.c.
References cList< cTimer >::First(), cEvent::HasTimer(), and cList< cTimer >::Next().
Referenced by cTimer::SpawnPatternTimers().
Gets the list of timers for read access.
If TimeoutMs is given, it will wait that long to get a read lock before giving up. Otherwise it will wait indefinitely. If no read lock can be obtained within the given timeout, NULL will be returned. The list is locked and a pointer to it is returned if the state of the list is different than the state of the given StateKey. If both states are equal, the list of timers has not been modified since the last call with the same StateKey, and NULL will be returned (and the list is not locked). After the returned list of timers is no longer needed, the StateKey's Remove() function must be called to release the list. The time between calling cTimers::GetTimersRead() and StateKey.Remove() should be as short as possible. After calling StateKey.Remove() the list returned from this call must not be accessed any more. If you need to access the timers again later, a new call to GetTimersRead() must be made. A typical code sequence would look like this: cStateKey StateKey; if (const cTimers *Timers = cTimers::GetTimersRead(StateKey)) { // access the timers StateKey.Remove(); }
Definition at line 1295 of file timers.c.
References cTimers(), and timers.
Referenced by cSkinLCARSDisplayMenu::DrawTimers(), main(), cSVDRPClientHandler::ProcessConnections(), cMenuTimers::Set(), cMenuSchedule::Update(), and cMenuWhatsOn::Update().
Gets the list of timers for write access.
If TimeoutMs is given, it will wait that long to get a write lock before giving up. Otherwise it will wait indefinitely. If no write lock can be obtained within the given timeout, NULL will be returned. If a write lock can be obtained, the list of timers will be returned, regardless of the state values of the timers or the given StateKey. After the returned list of timers is no longer needed, the StateKey's Remove() function must be called to release the list. The time between calling cTimers::GetTimersWrite() and StateKey.Remove() should be as short as possible. After calling StateKey.Remove() the list returned from this call must not be accessed any more. If you need to access the timers again later, a new call to GetTimersWrite() must be made. The call to StateKey.Remove() will increment the state of the list of timers and will copy the new state value to the StateKey. You can suppress this by using 'false' as the parameter to the call, in which case the state values are left untouched. A typical code sequence would look like this: cStateKey StateKey; if (cTimers *Timers = cTimers::GetTimersWrite(StateKey)) { // access the timers StateKey.Remove(); }
Definition at line 1300 of file timers.c.
References cTimers(), and timers.
Referenced by cMenuTimers::Delete(), main(), cMenuTimers::OnOff(), and cSVDRPClientHandler::ProcessConnections().
Definition at line 1313 of file timers.c.
References cListBase::Ins(), cStatus::MsgTimerChange(), and tcAdd.
|
static |
Definition at line 1177 of file timers.c.
References cConfig< cTimer >::FileName(), LOCK_TIMERS_WRITE, NewTimerId(), tfRecording, and timers.
Referenced by main().
|
static |
Definition at line 1192 of file timers.c.
References lastTimerId.
Referenced by Add(), HandleRemoteTimerModifications(), and Load().
bool cTimers::SetEvents | ( | const cSchedules * | Schedules | ) |
Definition at line 1334 of file timers.c.
References cList< cTimer >::First(), and cList< cTimer >::Next().
Referenced by main().
bool cTimers::SpawnPatternTimers | ( | const cSchedules * | Schedules | ) |
Definition at line 1344 of file timers.c.
References cList< cTimer >::First(), cList< cTimer >::Next(), and tfActive.
Referenced by main().
bool cTimers::StoreRemoteTimers | ( | const char * | ServerName = NULL, |
const cStringList * | RemoteTimers = NULL ) |
Stores the given list of RemoteTimers, which come from the VDR ServerName, in this list.
If no ServerName is given, all remote timers from all peer machines will be removed from this list. If no RemoteTimers are given, only the remote timers from ServerName will be removed from this list. The given list of RemoteTimers must be sorted numerically (by a call to its SortNumerically() function). Returns true if any remote timers have been added, deleted or modified.
Definition at line 1391 of file timers.c.
References Add(), cVector< T >::Append(), Del(), esyslog, cList< cTimer >::First(), GetById(), cList< cTimer >::Next(), cTimer::Parse(), cTimer::Remote(), cTimer::SetId(), cTimer::SetRemote(), cVector< T >::Size(), cStringList::SortNumerically(), and cString::sprintf().
Referenced by cSVDRPClientHandler::ProcessConnections().
Definition at line 1325 of file timers.c.
References cList< cTimer >::First(), and cList< cTimer >::Next().
|
private |
Definition at line 169 of file timers.h.
Referenced by cTimers(), and DeleteExpired().
|
staticprivate |
Definition at line 168 of file timers.h.
Referenced by NewTimerId().
|
staticprivate |
Definition at line 167 of file timers.h.
Referenced by GetTimersRead(), GetTimersWrite(), and Load().