15 #include <sys/types.h> 67 int NewCounter = (
timeout - time(NULL) + 9) / 10;
86 shutdownCommand = NULL;
88 emergencyExitRequested =
false;
93 free(shutdownCommand);
99 esyslog(
"initiating emergency exit");
100 emergencyExitRequested =
true;
104 dsyslog(
"emergency exit request ignored according to setup");
113 dsyslog(
"assuming manual start of VDR");
115 SetUserInactiveTimeout();
119 dsyslog(
"scheduled wakeup time in %ld minutes, assuming automatic start of VDR", Delta / 60);
120 SetUserInactiveTimeout(-3,
true);
126 free(shutdownCommand);
127 shutdownCommand = ShutdownCommand ? strdup(ShutdownCommand) : NULL;
132 time_t Delta = WakeupTime ? WakeupTime - time(NULL) : 0;
134 isyslog(
"executing '%s'", *cmd);
136 if (!WIFEXITED(Status) || WEXITSTATUS(Status))
137 esyslog(
"SystemExec() failed with status %d", Status);
151 activeTimeout = time(NULL) + Seconds;
152 else if (Seconds == -1)
154 else if (Seconds == -2)
156 else if (Seconds == -3)
165 if (!shutdownCommand) {
176 time_t Next = timer ? timer->
StartTime() : 0;
177 time_t Delta = timer ? Next - time(NULL) : 0;
198 Delta = Next ? Next - time(NULL) : 0;
219 time_t Next = timer ? timer->
StartTime() : 0;
220 time_t Delta = timer ? Next - time(NULL) : 0;
236 time_t Now = time(NULL);
240 time_t Next = timer ? timer->
StartTime() : 0;
241 time_t NextPlugin = Plugin ? Plugin->
WakeupTime() : 0;
242 if (NextPlugin && (!Next || Next > NextPlugin)) {
246 time_t Delta = Next ? Next - Now : 0;
261 else if (Next && Plugin) {
262 CallShutdownCommand(Next, 0, Plugin->
Name(), Force);
266 CallShutdownCommand(Next, 0,
"", Force);
void CallShutdownCommand(time_t WakeupTime, int Channel, const char *File, bool UserShutdown)
Call the shutdown command with the given parameters.
void CheckManualStart(int ManualStart)
Check whether the next timer is in ManualStart time window.
bool Confirm(const char *s, int Seconds=10, bool WaitForTimeout=false)
int counter
last shown time in 10s units
static cString sprintf(const char *fmt,...) __attribute__((format(printf
bool timedOut
countdown did run down to 0 and was not canceled
bool Update(void)
Update status display of the countdown.
bool DoShutdown(bool Force)
Call the shutdown script with data of the next pending timer.
time_t StartTime(void) const
cTimer * GetNextActiveTimer(void)
const cChannel * Channel(void) const
static bool Active(const char *Prompt=NULL)
void Start(const char *Message, int Seconds)
Start the 5 minute shutdown warning countdown.
const char * message
message to display, s is placeholder for time
bool ConfirmShutdown(bool Ask)
Check for background activity that blocks shutdown.
cShutdownHandler ShutdownHandler
cRecordingsHandler RecordingsHandler
int SystemExec(const char *Command, bool Detached)
eKeys Message(eMessageType Type, const char *s, int Seconds=0)
Displays the given message, either through a currently visible display object that is capable of doin...
static bool Enabled(void)
static cPlugin * GetNextWakeupPlugin(void)
void SetUserInactiveTimeout(int Seconds=-1, bool Force=false)
Set the time in the future when VDR will switch into non-interactive mode or power down...
const char * File(void) const
bool ConfirmRestart(bool Ask)
Check for background activity that blocks restart.
bool Active(void)
Checks whether there is currently any operation running and starts the next one form the list if the ...
virtual time_t WakeupTime(void)
void SetShutdownCommand(const char *ShutdownCommand)
Set the command string for shutdown command.
time_t timeout
5-minute countdown timer
void RequestEmergencyExit(void)
Requests an emergency exit of the VDR main loop.
void Cancel(void)
Cancel the 5 minute shutdown warning countdown.
bool Done(void)
Check if countdown timer has run out without canceling.