vdr
2.4.0
|
#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) |
int | GetMaxPriority (void) const |
const cTimer * | GetNextActiveTimer (void) const |
const cTimer * | UsesChannel (const cChannel *Channel) const |
bool | SetEvents (const cSchedules *Schedules) |
bool | DeleteExpired (void) |
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) |
![]() | |
cConfig (const char *NeedsLocking=NULL) | |
virtual | ~cConfig () |
const char * | FileName (void) |
bool | Load (const char *FileName=NULL, bool AllowComments=false, bool MustExist=false) |
bool | Save (void) const |
![]() | |
cList (const char *NeedsLocking=NULL) | |
const cTimer * | Get (int Index) const |
cTimer * | Get (int Index) |
const cTimer * | First (void) const |
cTimer * | First (void) |
const cTimer * | Last (void) const |
cTimer * | Last (void) |
const cTimer * | Prev (const cTimer *Object) const |
cTimer * | Prev (const cTimer *Object) |
const cTimer * | Next (const cTimer *Object) const |
cTimer * | Next (const cTimer *Object) |
![]() | |
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 | |
![]() | |
cListBase (const char *NeedsLocking=NULL) | |
![]() | |
cListObject * | objects |
cListObject * | lastObject |
int | count |
cStateLock | stateLock |
const char * | needsLocking |
bool | useGarbageCollector |
cTimers::cTimers | ( | void | ) |
Definition at line 729 of file timers.c.
References lastDeleteExpired.
Definition at line 853 of file timers.c.
References cListBase::Add(), cStatus::MsgTimerChange(), NewTimerId(), cTimer::Remote(), cTimer::SetId(), and tcAdd.
Referenced by cRecordControl::cRecordControl(), and StoreRemoteTimers().
void cTimers::Del | ( | cTimer * | Timer, |
bool | DeleteObject = true |
||
) |
Definition at line 867 of file timers.c.
References cListBase::Del(), cStatus::MsgTimerChange(), and tcDel.
Referenced by cRecordControl::cRecordControl(), cMenuTimers::Delete(), DeleteExpired(), and StoreRemoteTimers().
bool cTimers::DeleteExpired | ( | void | ) |
Definition at line 890 of file timers.c.
References Del(), cTimer::Expired(), cList< cTimer >::First(), isyslog, lastDeleteExpired, cList< cTimer >::Next(), cTimer::Remote(), and cTimer::ToDescr().
Referenced by main().
const cTimer * cTimers::GetById | ( | int | Id, |
const char * | Remote = NULL |
||
) | const |
Definition at line 755 of file timers.c.
References cList< cTimer >::First(), and cList< cTimer >::Next().
Referenced by StoreRemoteTimers().
|
inline |
const cTimer * cTimers::GetMatch | ( | time_t | t | ) | const |
Definition at line 779 of file timers.c.
References cList< cTimer >::First(), cListObject::Index(), cList< cTimer >::Next(), and cTimer::Priority().
Referenced by cMenuEvent::cMenuEvent(), main(), and cMenuScheduleItem::Update().
|
inline |
const cTimer * cTimers::GetMatch | ( | const cEvent * | Event, |
eTimerMatch * | Match = NULL |
||
) | const |
Definition at line 802 of file timers.c.
References cList< cTimer >::First(), cList< cTimer >::Next(), tmFull, and tmNone.
|
inline |
int cTimers::GetMaxPriority | ( | void | ) | const |
Returns the maximum priority of all local timers that are currently recording.
Definition at line 820 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 830 of file timers.c.
References cList< cTimer >::First(), cTimer::Matches(), cList< cTimer >::Next(), cTimer::StopTime(), and tfActive.
Definition at line 766 of file timers.c.
References cTimer::Channel(), cTimer::Day(), cList< cTimer >::First(), cList< cTimer >::Next(), cTimer::Start(), cTimer::Stop(), and cTimer::WeekDays().
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 843 of file timers.c.
References cListBase::Lock(), and timers.
Referenced by cSkinLCARSDisplayMenu::DrawTimers(), main(), cSVDRPClientHandler::ProcessConnections(), cMenuTimers::Set(), cMenuWhatsOn::Update(), and cMenuSchedule::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 848 of file timers.c.
References cListBase::Lock(), and timers.
Referenced by cMenuTimers::Delete(), main(), cMenuTimers::OnOff(), and cSVDRPClientHandler::ProcessConnections().
Definition at line 861 of file timers.c.
References cListBase::Ins(), cStatus::MsgTimerChange(), and tcAdd.
|
static |
Definition at line 735 of file timers.c.
References cConfig< cTimer >::FileName(), cList< T >::First(), LOCK_TIMERS_WRITE, NewTimerId(), cList< T >::Next(), tfRecording, and timers.
Referenced by main().
|
static |
Definition at line 750 of file timers.c.
References lastTimerId.
Referenced by Add(), HandleRemoteTimerModifications(), and Load().
bool cTimers::SetEvents | ( | const cSchedules * | Schedules | ) |
Definition at line 882 of file timers.c.
References cList< cTimer >::First(), and cList< cTimer >::Next().
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 909 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 873 of file timers.c.
References cList< cTimer >::First(), and cList< cTimer >::Next().
|
private |
Definition at line 120 of file timers.h.
Referenced by cTimers(), and DeleteExpired().
|
staticprivate |
Definition at line 119 of file timers.h.
Referenced by NewTimerId().
|
staticprivate |
Definition at line 118 of file timers.h.
Referenced by GetTimersRead(), GetTimersWrite(), and Load().