cShutdownHandler Class Reference

#include <shutdown.h>

Collaboration diagram for cShutdownHandler:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 cShutdownHandler (void)
 ~cShutdownHandler ()
void Exit (int ExitCode)
bool DoExit (void)
 Check if an exit code was set, and VDR should exit.
int GetExitCode (void)
 Get the currently set exit code of VDR.
bool EmergencyExitRequested (void)
 Returns true if an emergency exit was requested.
void RequestEmergencyExit (void)
 Requests an emergency exit of the VDR main loop.
void CheckManualStart (int ManualStart)
void SetShutdownCommand (const char *ShutdownCommand)
 Set the command string for shutdown command.
void CallShutdownCommand (time_t WakeupTime, int Channel, const char *File, bool UserShutdown)
 Call the shutdown command with the given parameters.
bool IsUserInactive (time_t AtTime=0)
time_t GetUserInactiveTime (void)
 Time when user will become non-inactive, or 0 if never.
void SetUserInactiveTimeout (int Seconds=-1, bool Force=false)
void SetUserInactive (void)
 Set VDR manually into non-interactive mode.
bool Retry (time_t AtTime=0)
time_t GetRetry (void)
 Time when shutdown retry block ends.
void SetRetry (int Seconds)
bool ConfirmShutdown (bool Ask)
bool ConfirmRestart (bool Ask)
bool DoShutdown (bool Force)

Public Attributes

cCountdown countdown

Private Attributes

time_t activeTimeout
 Time when VDR will become non-interactive. 0 means never.
time_t retry
 Time for retrying the shutdown.
char * shutdownCommand
 Command for shutting down VDR.
int exitCode
 Exit code, if VDR exit was requested, or -1 if not requested.
bool emergencyExitRequested
 The requested exit is an emergency exit.


Detailed Description

Definition at line 38 of file shutdown.h.


Constructor & Destructor Documentation

cShutdownHandler::cShutdownHandler ( void   ) 

Definition at line 82 of file shutdown.c.

References activeTimeout, emergencyExitRequested, exitCode, retry, and shutdownCommand.

cShutdownHandler::~cShutdownHandler (  ) 

Definition at line 91 of file shutdown.c.

References shutdownCommand.


Member Function Documentation

void cShutdownHandler::Exit ( int  ExitCode  )  [inline]

Set VDR exit code and initiate end of VDR main loop. This will exit VDR without any confirmation.

Definition at line 54 of file shutdown.h.

References exitCode.

Referenced by RequestEmergencyExit(), cMenuSetup::Restart(), and SignalHandler().

bool cShutdownHandler::DoExit ( void   )  [inline]

Check if an exit code was set, and VDR should exit.

Definition at line 57 of file shutdown.h.

References exitCode.

Referenced by main().

int cShutdownHandler::GetExitCode ( void   )  [inline]

Get the currently set exit code of VDR.

Definition at line 59 of file shutdown.h.

References exitCode.

Referenced by main().

bool cShutdownHandler::EmergencyExitRequested ( void   )  [inline]

Returns true if an emergency exit was requested.

Definition at line 61 of file shutdown.h.

References emergencyExitRequested.

Referenced by main().

void cShutdownHandler::RequestEmergencyExit ( void   ) 

Requests an emergency exit of the VDR main loop.

Definition at line 96 of file shutdown.c.

References dsyslog, cSetup::EmergencyExit, emergencyExitRequested, esyslog, Exit(), and Setup.

Referenced by cRecorder::Action(), and cRecordControls::Start().

Here is the call graph for this function:

void cShutdownHandler::CheckManualStart ( int  ManualStart  ) 

Check whether the next timer is in ManualStart time window. If yes, assume non-interactive use.

Definition at line 107 of file shutdown.c.

References dsyslog, cSetup::NextWakeupTime, Setup, SetUserInactive(), and SetUserInactiveTimeout().

Referenced by main().

Here is the call graph for this function:

void cShutdownHandler::SetShutdownCommand ( const char *  ShutdownCommand  ) 

Set the command string for shutdown command.

Definition at line 124 of file shutdown.c.

References shutdownCommand.

Referenced by main().

void cShutdownHandler::CallShutdownCommand ( time_t  WakeupTime,
int  Channel,
const char *  File,
bool  UserShutdown 
)

Call the shutdown command with the given parameters.

Definition at line 130 of file shutdown.c.

References esyslog, isyslog, cSetup::NextWakeupTime, cSetup::Save(), Setup, shutdownCommand, cString::sprintf(), strescape(), and SystemExec().

Referenced by DoShutdown().

Here is the call graph for this function:

bool cShutdownHandler::IsUserInactive ( time_t  AtTime = 0  )  [inline]

Check whether VDR is in interactive mode or non-interactive mode (waiting for shutdown). AtTime checks whether VDR will probably be inactive at that time.

Definition at line 72 of file shutdown.h.

References activeTimeout.

Referenced by main().

time_t cShutdownHandler::GetUserInactiveTime ( void   )  [inline]

Time when user will become non-inactive, or 0 if never.

Definition at line 75 of file shutdown.h.

References activeTimeout.

void cShutdownHandler::SetUserInactiveTimeout ( int  Seconds = -1,
bool  Force = false 
)

Set the time when VDR will switch into non-interactive mode or power down. -1 means Setup.MinUserInactivity in the future. Otherwise, seconds in the future. If MinUserInactivity = 0 and Force = false, Seconds is ignored and VDR will stay interactive forever.

Definition at line 144 of file shutdown.c.

References activeTimeout, cSetup::MinUserInactivity, and Setup.

Referenced by CheckManualStart(), main(), and SetUserInactive().

void cShutdownHandler::SetUserInactive ( void   )  [inline]

Set VDR manually into non-interactive mode.

Definition at line 83 of file shutdown.h.

References SetUserInactiveTimeout().

Referenced by CheckManualStart(), and main().

Here is the call graph for this function:

bool cShutdownHandler::Retry ( time_t  AtTime = 0  )  [inline]

Check whether its time to re-try the shutdown. AtTime checks whether VDR will probably be inactive at that time.

Definition at line 85 of file shutdown.h.

References retry.

Referenced by main().

time_t cShutdownHandler::GetRetry ( void   )  [inline]

Time when shutdown retry block ends.

Definition at line 88 of file shutdown.h.

References retry.

void cShutdownHandler::SetRetry ( int  Seconds  )  [inline]

Set shutdown retry so that VDR will not try to automatically shut down within Seconds.

Definition at line 90 of file shutdown.h.

References retry.

Referenced by main().

bool cShutdownHandler::ConfirmShutdown ( bool  Ask  ) 

Check for background activity that blocks shutdown. Returns immediately and without user interaction if Ask = false. Asks for confirmation if Ask = true. Returns true if ready for shutdown.

Definition at line 155 of file shutdown.c.

References cPluginManager::Active(), cRecordControls::Active(), cCutter::Active(), cInterface::Confirm(), cRemote::Enabled(), cTimers::GetNextActiveTimer(), cPluginManager::GetNextWakeupPlugin(), Interface, cSkins::Message(), cSetup::MinEventTimeout, mtError, cPlugin::Name(), cListObject::Next(), Setup, shutdownCommand, Skins, cString::sprintf(), cTimer::StartTime(), Timers, tr, and cPlugin::WakeupTime().

Referenced by main().

Here is the call graph for this function:

bool cShutdownHandler::ConfirmRestart ( bool  Ask  ) 

Check for background activity that blocks restart. Returns immediately and without user interaction if Ask = false. Asks for confirmation if Ask = true. Returns true if ready for restart.

Definition at line 206 of file shutdown.c.

References cPluginManager::Active(), cRecordControls::Active(), cCutter::Active(), cInterface::Confirm(), cTimers::GetNextActiveTimer(), Interface, cListObject::Next(), cTimer::StartTime(), Timers, and tr.

Referenced by main(), and cMenuSetup::Restart().

Here is the call graph for this function:

bool cShutdownHandler::DoShutdown ( bool  Force  ) 

Call the shutdown script with data of the next pending timer. Fails if Force = false and a timer is running or within MinEventTimeout. Always calls shutdown on Force = true. Returns true on success.

Definition at line 229 of file shutdown.c.

References CallShutdownCommand(), cTimer::Channel(), dsyslog, cTimer::File(), cTimers::GetNextActiveTimer(), cPluginManager::GetNextWakeupPlugin(), cSetup::MinEventTimeout, cPlugin::Name(), cListObject::Next(), cChannel::Number(), Setup, cTimer::StartTime(), Timers, TimeToString(), and cPlugin::WakeupTime().

Referenced by main().

Here is the call graph for this function:


Member Data Documentation

Time when VDR will become non-interactive. 0 means never.

Definition at line 41 of file shutdown.h.

Referenced by cShutdownHandler(), GetUserInactiveTime(), IsUserInactive(), and SetUserInactiveTimeout().

time_t cShutdownHandler::retry [private]

Time for retrying the shutdown.

Definition at line 43 of file shutdown.h.

Referenced by cShutdownHandler(), GetRetry(), Retry(), and SetRetry().

Command for shutting down VDR.

Definition at line 45 of file shutdown.h.

Referenced by CallShutdownCommand(), ConfirmShutdown(), cShutdownHandler(), SetShutdownCommand(), and ~cShutdownHandler().

Exit code, if VDR exit was requested, or -1 if not requested.

Definition at line 47 of file shutdown.h.

Referenced by cShutdownHandler(), DoExit(), Exit(), and GetExitCode().

The requested exit is an emergency exit.

Definition at line 49 of file shutdown.h.

Referenced by cShutdownHandler(), EmergencyExitRequested(), and RequestEmergencyExit().

Definition at line 51 of file shutdown.h.

Referenced by main().


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

Generated on Tue Jan 13 14:32:05 2009 for VDR by  doxygen 1.5.6