vdr 2.6.1
Public Member Functions | Public Attributes | Private Attributes | List of all members
cShutdownHandler Class Reference

#include <shutdown.h>

Public Member Functions

 cShutdownHandler (void)
 
 ~cShutdownHandler ()
 
void Exit (int ExitCode)
 
bool DoExit (void)
 
int GetExitCode (void)
 
bool EmergencyExitRequested (void)
 
void RequestEmergencyExit (void)
 
void CheckManualStart (int ManualStart)
 
void SetShutdownCommand (const char *ShutdownCommand)
 
void CallShutdownCommand (time_t WakeupTime, int Channel, const char *File, bool UserShutdown)
 
bool IsUserInactive (time_t AtTime=0)
 
time_t GetUserInactiveTime (void)
 
void SetUserInactiveTimeout (int Seconds=-1, bool Force=false)
 
void SetUserInactive (void)
 
bool Retry (time_t AtTime=0)
 
time_t GetRetry (void)
 
void SetRetry (int Seconds)
 
bool ConfirmShutdown (bool Ask)
 
bool ConfirmRestart (bool Ask)
 
bool DoShutdown (bool Force)
 
 cShutdownHandler (void)
 
 ~cShutdownHandler ()
 
void Exit (int ExitCode)
 
bool DoExit (void)
 
int GetExitCode (void)
 
bool EmergencyExitRequested (void)
 
void RequestEmergencyExit (void)
 
void CheckManualStart (int ManualStart)
 
void SetShutdownCommand (const char *ShutdownCommand)
 
void CallShutdownCommand (time_t WakeupTime, int Channel, const char *File, bool UserShutdown)
 
bool IsUserInactive (time_t AtTime=0)
 
time_t GetUserInactiveTime (void)
 
void SetUserInactiveTimeout (int Seconds=-1, bool Force=false)
 
void SetUserInactive (void)
 
bool Retry (time_t AtTime=0)
 
time_t GetRetry (void)
 
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_t retry
 
char * shutdownCommand
 
int exitCode
 
bool emergencyExitRequested
 

Detailed Description

Definition at line 38 of file include/vdr/shutdown.h.

Constructor & Destructor Documentation

◆ cShutdownHandler() [1/2]

cShutdownHandler::cShutdownHandler ( void  )

Definition at line 79 of file shutdown.c.

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

◆ ~cShutdownHandler() [1/2]

cShutdownHandler::~cShutdownHandler ( )

Definition at line 88 of file shutdown.c.

References shutdownCommand.

◆ cShutdownHandler() [2/2]

cShutdownHandler::cShutdownHandler ( void  )

◆ ~cShutdownHandler() [2/2]

cShutdownHandler::~cShutdownHandler ( )

Member Function Documentation

◆ CallShutdownCommand() [1/2]

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

Call the shutdown command with the given parameters.

Definition at line 127 of file shutdown.c.

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

Referenced by DoShutdown().

◆ CallShutdownCommand() [2/2]

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

Call the shutdown command with the given parameters.

◆ CheckManualStart() [1/2]

void cShutdownHandler::CheckManualStart ( int  ManualStart)

Check whether the next timer is in ManualStart time window.

If yes, assume non-interactive use.

Definition at line 104 of file shutdown.c.

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

Referenced by main().

◆ CheckManualStart() [2/2]

void cShutdownHandler::CheckManualStart ( int  ManualStart)

Check whether the next timer is in ManualStart time window.

If yes, assume non-interactive use.

◆ ConfirmRestart() [1/2]

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 209 of file shutdown.c.

References cPluginManager::Active(), cRecordControls::Active(), cThread::Active(), cInterface::Confirm(), Interface, LOCK_TIMERS_READ, RecordingsHandler, cTimer::StartTime(), and tr.

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

◆ ConfirmRestart() [2/2]

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.

◆ ConfirmShutdown() [1/2]

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 157 of file shutdown.c.

References cPluginManager::Active(), cRecordControls::Active(), cThread::Active(), cInterface::Confirm(), cRemote::Enabled(), cPluginManager::GetNextWakeupPlugin(), Interface, LOCK_TIMERS_READ, cSkins::Message(), cSetup::MinEventTimeout, mtError, cPlugin::Name(), RecordingsHandler, Setup, shutdownCommand, Skins, cString::sprintf(), cTimer::StartTime(), tr, and cPlugin::WakeupTime().

Referenced by main().

◆ ConfirmShutdown() [2/2]

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.

◆ DoExit() [1/2]

bool cShutdownHandler::DoExit ( void  )
inline

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

Definition at line 57 of file include/vdr/shutdown.h.

References exitCode.

Referenced by main().

◆ DoExit() [2/2]

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.

◆ DoShutdown() [1/2]

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 233 of file shutdown.c.

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

Referenced by main().

◆ DoShutdown() [2/2]

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.

◆ EmergencyExitRequested() [1/2]

bool cShutdownHandler::EmergencyExitRequested ( void  )
inline

Returns true if an emergency exit was requested.

Definition at line 61 of file include/vdr/shutdown.h.

References emergencyExitRequested.

Referenced by main().

◆ EmergencyExitRequested() [2/2]

bool cShutdownHandler::EmergencyExitRequested ( void  )
inline

Returns true if an emergency exit was requested.

Definition at line 61 of file shutdown.h.

References emergencyExitRequested.

◆ Exit() [1/2]

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 include/vdr/shutdown.h.

References exitCode.

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

◆ Exit() [2/2]

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.

◆ GetExitCode() [1/2]

int cShutdownHandler::GetExitCode ( void  )
inline

Get the currently set exit code of VDR.

Definition at line 59 of file include/vdr/shutdown.h.

References exitCode.

Referenced by main().

◆ GetExitCode() [2/2]

int cShutdownHandler::GetExitCode ( void  )
inline

Get the currently set exit code of VDR.

Definition at line 59 of file shutdown.h.

References exitCode.

◆ GetRetry() [1/2]

time_t cShutdownHandler::GetRetry ( void  )
inline

Time when shutdown retry block ends.

Definition at line 91 of file include/vdr/shutdown.h.

References retry.

◆ GetRetry() [2/2]

time_t cShutdownHandler::GetRetry ( void  )
inline

Time when shutdown retry block ends.

Definition at line 91 of file shutdown.h.

References retry.

◆ GetUserInactiveTime() [1/2]

time_t cShutdownHandler::GetUserInactiveTime ( void  )
inline

Time when user will become non-inactive, or 0 if never, 1 if a long time ago.

Definition at line 75 of file include/vdr/shutdown.h.

References activeTimeout.

◆ GetUserInactiveTime() [2/2]

time_t cShutdownHandler::GetUserInactiveTime ( void  )
inline

Time when user will become non-inactive, or 0 if never, 1 if a long time ago.

Definition at line 75 of file shutdown.h.

References activeTimeout.

◆ IsUserInactive() [1/2]

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 include/vdr/shutdown.h.

References activeTimeout.

Referenced by main(), and cPluginDvbhddevice::MainThreadHook().

◆ IsUserInactive() [2/2]

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.

◆ RequestEmergencyExit() [1/2]

void cShutdownHandler::RequestEmergencyExit ( void  )

Requests an emergency exit of the VDR main loop.

Definition at line 93 of file shutdown.c.

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

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

◆ RequestEmergencyExit() [2/2]

void cShutdownHandler::RequestEmergencyExit ( void  )

Requests an emergency exit of the VDR main loop.

◆ Retry() [1/2]

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 88 of file include/vdr/shutdown.h.

References retry.

Referenced by main().

◆ Retry() [2/2]

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 88 of file shutdown.h.

References retry.

◆ SetRetry() [1/2]

void cShutdownHandler::SetRetry ( int  Seconds)
inline

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

Definition at line 93 of file include/vdr/shutdown.h.

References retry.

Referenced by main().

◆ SetRetry() [2/2]

void cShutdownHandler::SetRetry ( int  Seconds)
inline

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

Definition at line 93 of file shutdown.h.

References retry.

◆ SetShutdownCommand() [1/2]

void cShutdownHandler::SetShutdownCommand ( const char *  ShutdownCommand)

Set the command string for shutdown command.

Definition at line 121 of file shutdown.c.

References shutdownCommand.

Referenced by main().

◆ SetShutdownCommand() [2/2]

void cShutdownHandler::SetShutdownCommand ( const char *  ShutdownCommand)

Set the command string for shutdown command.

◆ SetUserInactive() [1/2]

void cShutdownHandler::SetUserInactive ( void  )
inline

Set VDR manually into non-interactive mode from now on.

Definition at line 86 of file include/vdr/shutdown.h.

References SetUserInactiveTimeout().

Referenced by main().

◆ SetUserInactive() [2/2]

void cShutdownHandler::SetUserInactive ( void  )
inline

Set VDR manually into non-interactive mode from now on.

Definition at line 86 of file shutdown.h.

References SetUserInactiveTimeout().

◆ SetUserInactiveTimeout() [1/2]

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

Set the time in the future when VDR will switch into non-interactive mode or power down.

Seconds >= 0 means that many seconds in the future. Seconds = -1 means Setup.MinUserInactivity in the future. Seconds = -2 means never. Seconds = -3 means a long, unknown time ago. Setup.MinUserInactivity = 0 will overrule this, unless Force = true is given. If Setup.MinUserInactivity = 0 and Force = false, Seconds is ignored and VDR will stay interactive forever (like Seconds = -2).

Definition at line 141 of file shutdown.c.

References activeTimeout, cSetup::MinUserInactivity, and Setup.

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

◆ SetUserInactiveTimeout() [2/2]

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

Set the time in the future when VDR will switch into non-interactive mode or power down.

Seconds >= 0 means that many seconds in the future. Seconds = -1 means Setup.MinUserInactivity in the future. Seconds = -2 means never. Seconds = -3 means a long, unknown time ago. Setup.MinUserInactivity = 0 will overrule this, unless Force = true is given. If Setup.MinUserInactivity = 0 and Force = false, Seconds is ignored and VDR will stay interactive forever (like Seconds = -2).

Member Data Documentation

◆ activeTimeout

time_t cShutdownHandler::activeTimeout
private

Time when VDR will become non-interactive. 0 means never, 1 means unknown time ago.

Definition at line 40 of file include/vdr/shutdown.h.

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

◆ countdown

cCountdown cShutdownHandler::countdown

Definition at line 51 of file include/vdr/shutdown.h.

Referenced by main().

◆ emergencyExitRequested

bool cShutdownHandler::emergencyExitRequested
private

The requested exit is an emergency exit.

Definition at line 48 of file include/vdr/shutdown.h.

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

◆ exitCode

int cShutdownHandler::exitCode
private

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

Definition at line 46 of file include/vdr/shutdown.h.

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

◆ retry

time_t cShutdownHandler::retry
private

Time for retrying the shutdown.

Definition at line 42 of file include/vdr/shutdown.h.

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

◆ shutdownCommand

char * cShutdownHandler::shutdownCommand
private

Command for shutting down VDR.

Definition at line 44 of file include/vdr/shutdown.h.

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


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