summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--imon.c79
-rw-r--r--imon.h8
-rw-r--r--po/de_DE.po11
-rw-r--r--po/it_IT.po9
-rw-r--r--setup.c9
-rw-r--r--setup.h9
-rw-r--r--watch.c40
7 files changed, 106 insertions, 59 deletions
diff --git a/imon.c b/imon.c
index 4808340..6f50fe0 100644
--- a/imon.c
+++ b/imon.c
@@ -205,56 +205,47 @@ int ciMonLCD::open(const char* szDevice, eProtocol pro)
return 0;
}
+/*
+ * turning backlight off (confirmed for a Silverstone LCD) (as "cybrmage" at
+ * mediaportal pointed out, his LCD is an Antec built-in one and turns completely
+ * off with this command)
+ */
+bool ciMonLCD::SendCmdShutdown() {
+ return SendCmd(this->cmd_shutdown)
+ && SendCmd(this->cmd_clear_alarm);
+}
+
+/*
+ * Show the big clock. We need to set it to the current time, then it just
+ * keeps counting automatically.
+ */
+bool ciMonLCD::SendCmdClock() {
+ time_t tt;
+ struct tm l;
+ uint64_t data;
+
+ tt = time(NULL);
+ localtime_r(&tt, &l);
+
+ data = this->cmd_display;
+ data += ((uint64_t) l.tm_sec << 48);
+ data += ((uint64_t) l.tm_min << 40);
+ data += ((uint64_t) l.tm_hour << 32);
+ data += ((uint64_t) l.tm_mday << 24);
+ data += ((uint64_t) l.tm_mon << 16);
+ data += (((uint64_t) l.tm_year) << 8);
+ data += 0x80;
+
+ return SendCmd(data)
+ && SendCmd(this->cmd_clear_alarm);
+}
+
/**
* Close the driver (do necessary clean-up).
*/
void ciMonLCD::close()
{
- time_t tt;
- struct tm *t;
- uint64_t data;
-
if (this->imon_fd >= 0) {
- if (theSetup.m_nOnExit == eOnExitMode_SHOWMSG) {
- /*
- * "show message" means "do nothing" - the
- * message is there already
- */
- isyslog("iMonLCD: closing, leaving \"last\" message.");
- } else if (theSetup.m_nOnExit == eOnExitMode_BLANKSCREEN) {
- /*
- * turning backlight off (confirmed for my
- * Silverstone LCD) (as "cybrmage" at
- * mediaportal pointed out, his LCD is an
- * Antec built-in one and turns completely
- * off with this command)
- */
- isyslog("iMonLCD: closing, turning backlight off.");
- SendCmd(this->cmd_shutdown);
- SendCmd(this->cmd_clear_alarm);
- } else {
- /*
- * by default, show the big clock. We need to
- * set it to the current time, then it just
- * keeps counting automatically.
- */
- isyslog("iMonLCD: closing, showing clock.");
-
- tt = time(NULL);
- t = localtime(&tt);
-
- data = this->cmd_display;
- data += ((uint64_t) t->tm_sec << 48);
- data += ((uint64_t) t->tm_min << 40);
- data += ((uint64_t) t->tm_hour << 32);
- data += ((uint64_t) t->tm_mday << 24);
- data += ((uint64_t) t->tm_mon << 16);
- data += (((uint64_t) t->tm_year) << 8);
- data += 0x80;
- SendCmd(data);
- SendCmd(this->cmd_clear_alarm);
- }
-
::close(this->imon_fd);
this->imon_fd = -1;
}
diff --git a/imon.h b/imon.h
index b18ff34..e9309ff 100644
--- a/imon.h
+++ b/imon.h
@@ -21,12 +21,6 @@ enum eProtocol {
ePROTOCOL_0038 = 1 /**< protocol ID for 15c2:0038 device */
};
-enum eOnExitMode {
- eOnExitMode_SHOWMSG = 0, /**< Do nothing - just leave the "last" message there */
- eOnExitMode_SHOWCLOCK = 1, /**< Show the big clock */
- eOnExitMode_BLANKSCREEN = 2 /**< Blank the device completely */
-};
-
enum eIcons {
eIconOff = 0,
eIconDiscSpin = 1 << 0,
@@ -118,6 +112,8 @@ protected:
int lengthToPixels(int length);
bool SendCmd(const uint64_t & cmdData);
+ bool SendCmdClock();
+ bool SendCmdShutdown();
bool Contrast(int nContrast);
public:
ciMonLCD();
diff --git a/po/de_DE.po b/po/de_DE.po
index 7dc1937..5a6215f 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-imonlcd-plugin 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2009-05-21 17:44+0200\n"
+"POT-Creation-Date: 2009-05-30 13:41+0200\n"
"PO-Revision-Date: 2009-05-21 17:13+0200\n"
"Last-Translator: Andreas Brachold <vdr07 AT deltab de>\n"
"Language-Team: Andreas Brachold <vdr07 AT deltab de>\n"
@@ -43,11 +43,16 @@ msgid "Showing clock"
msgstr "Uhrzeit anzeigen"
msgid "Turning backlight off"
-msgstr "Hintergrund abschalten"
+msgstr "Abschalten der Anzeige"
+
+msgid "Showing next timer"
+msgstr "Nächsten Timer anzeigen"
msgid "Exit mode"
msgstr "Ende Modus"
+msgid "None active timer"
+msgstr "Kein aktiver Timer"
+
msgid "Unknown title"
msgstr "Unbekannter Titel"
-
diff --git a/po/it_IT.po b/po/it_IT.po
index 8ef5f59..061f68d 100644
--- a/po/it_IT.po
+++ b/po/it_IT.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-imonlcd-plugin 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2009-05-21 17:44+0200\n"
+"POT-Creation-Date: 2009-05-30 13:41+0200\n"
"PO-Revision-Date: 2009-05-23 16:20+0100\n"
"Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n"
"Language-Team: \n"
@@ -48,9 +48,14 @@ msgstr "Mostra orologio"
msgid "Turning backlight off"
msgstr "Spegni retroilluminazione"
+msgid "Showing next timer"
+msgstr ""
+
msgid "Exit mode"
msgstr "Modalità d'uscita"
+msgid "None active timer"
+msgstr ""
+
msgid "Unknown title"
msgstr "Titolo sconosciuto"
-
diff --git a/setup.c b/setup.c
index 97a88e0..083fc7b 100644
--- a/setup.c
+++ b/setup.c
@@ -94,9 +94,9 @@ bool cIMonSetup::SetupParse(const char *szName, const char *szValue)
// OnExit
if(!strcasecmp(szName, "OnExit")) {
int n = atoi(szValue);
- if ((n < 0) || (n > 3)) {
- esyslog("iMonLCD: OnExit must be between 0 and 3; using default %d",
- DEFAULT_ON_EXIT);
+ if ((n < eOnExitMode_FIRSTITEM) || (n > eOnExitMode_LASTITEM)) {
+ esyslog("iMonLCD: OnExit must be between %d and %d; using default %d",
+ eOnExitMode_FIRSTITEM, eOnExitMode_LASTITEM, DEFAULT_ON_EXIT);
n = DEFAULT_ON_EXIT;
}
m_nOnExit = n;
@@ -177,10 +177,11 @@ ciMonMenuSetup::ciMonMenuSetup(ciMonWatch* pDev)
tr("Slim disc"), tr("Full disc")));
- static const char * szExitModes[3];
+ static const char * szExitModes[eOnExitMode_LASTITEM + 1];
szExitModes[eOnExitMode_SHOWMSG] = tr("Do nothing");
szExitModes[eOnExitMode_SHOWCLOCK] = tr("Showing clock");
szExitModes[eOnExitMode_BLANKSCREEN] = tr("Turning backlight off");
+ szExitModes[eOnExitMode_NEXTTIMER] = tr("Showing next timer");
Add(new cMenuEditStraItem (tr("Exit mode"),
&m_tmpSetup.m_nOnExit,
diff --git a/setup.h b/setup.h
index 92db621..00074f2 100644
--- a/setup.h
+++ b/setup.h
@@ -17,6 +17,15 @@
#include <vdr/menuitems.h>
#define memberof(x) (sizeof(x)/sizeof(*x))
+enum eOnExitMode {
+ eOnExitMode_FIRSTITEM = 0
+ ,eOnExitMode_SHOWMSG = 0 /**< Do nothing - just leave the "last" message there */
+ ,eOnExitMode_SHOWCLOCK = 1 /**< Show the big clock */
+ ,eOnExitMode_BLANKSCREEN = 2 /**< Blank the device completely */
+ ,eOnExitMode_NEXTTIMER = 3 /**< Show next active timer */
+ ,eOnExitMode_LASTITEM = 3
+};
+
struct cIMonSetup
{
int m_nOnExit;
diff --git a/watch.c b/watch.c
index 5d8a888..7441312 100644
--- a/watch.c
+++ b/watch.c
@@ -113,6 +113,46 @@ void ciMonWatch::close() {
usleep(500000);
Cancel();
}
+
+ switch(theSetup.m_nOnExit) {
+ case eOnExitMode_NEXTTIMER: {
+ isyslog("iMonLCD: closing, show next timer.");
+ cTimer* t = Timers.GetNextActiveTimer();
+ this->setLineLength(0,0,0,0);
+
+ this->clear();
+ if(t) {
+ struct tm l;
+ time_t tt = t->StartTime();
+ localtime_r(&tt, &l);
+ cString topic = cString::sprintf("%d. %02d:%02d %s", l.tm_mday, l.tm_hour, l.tm_min, t->File());
+ this->DrawText(0,0,topic);
+ this->icons(eIconALARM);
+ } else {
+ this->DrawText(0,0,tr("None active timer"));
+ this->icons(0);
+ }
+ this->flush();
+ break;
+ }
+ case eOnExitMode_SHOWMSG: {
+ isyslog("iMonLCD: closing, leaving \"last\" message.");
+ break;
+ }
+ case eOnExitMode_BLANKSCREEN: {
+ isyslog("iMonLCD: closing, turning backlight off.");
+ SendCmdShutdown();
+ break;
+ }
+ default:
+ case eOnExitMode_SHOWCLOCK: {
+ isyslog("iMonLCD: closing, showing clock.");
+ SendCmdClock();
+ break;
+ }
+ }
+
+
ciMonLCD::close();
}