summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/gwps-common.c8
-rw-r--r--apps/gui/gwps.h2
-rw-r--r--apps/gui/wps_parser.c1
-rw-r--r--manual/appendix/wps_tags.tex23
4 files changed, 30 insertions, 4 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 1fef9e0..9a69c74 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -1037,6 +1037,14 @@ static const char *get_token_value(struct gui_wps *gwps,
*intval = global_settings.repeat_mode + 1;
snprintf(buf, buf_size, "%d", global_settings.repeat_mode);
return buf;
+
+ case WPS_TOKEN_RTC_PRESENT:
+#if CONFIG_RTC
+ return "c";
+#else
+ return NULL;
+#endif
+
#if CONFIG_RTC
case WPS_TOKEN_RTC_12HOUR_CFG:
if (intval)
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h
index 935e015..f356221 100644
--- a/apps/gui/gwps.h
+++ b/apps/gui/gwps.h
@@ -173,6 +173,8 @@ enum wps_token_type {
/* Time */
+ WPS_TOKEN_RTC_PRESENT,
+
/* The begin/end values allow us to know if a token is an RTC one.
New RTC tokens should be added between the markers. */
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index 70e13e7..7211e6c 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -193,6 +193,7 @@ static const struct wps_tag all_tags[] = {
{ WPS_TOKEN_BATTERY_CHARGER_CONNECTED,"bp", WPS_REFRESH_DYNAMIC, NULL },
#endif
+ { WPS_TOKEN_RTC_PRESENT , "cc", WPS_REFRESH_STATIC, NULL },
{ WPS_TOKEN_RTC_DAY_OF_MONTH, "cd", WPS_RTC_REFRESH, NULL },
{ WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED,"ce", WPS_RTC_REFRESH, NULL },
{ WPS_TOKEN_RTC_12HOUR_CFG, "cf", WPS_RTC_REFRESH, NULL },
diff --git a/manual/appendix/wps_tags.tex b/manual/appendix/wps_tags.tex
index 3e8846d..a7c1822 100644
--- a/manual/appendix/wps_tags.tex
+++ b/manual/appendix/wps_tags.tex
@@ -355,10 +355,11 @@ Allows grouping of several items (sublines) onto one line, with the
display cycling round the defined sublines. See
\reference{ref:AlternatingSublines} for details.
-\opt{rtc}{
- \section{Real Time Clock}
+
+\section{Time and Date}
\begin{table}
\begin{tagmap}{}{}
+ \opt{rtc}{
\config{\%cd} & Day of month\\
\config{\%ce} & Zero padded day of month\\
\config{\%cH} & Zero padded hour from 00 to 23 (24 hour format)\\
@@ -368,7 +369,7 @@ display cycling round the defined sublines. See
\config{\%cm} & Month\\
\config{\%cM} & Minutes\\
\config{\%cS} & Seconds\\
- \config{\%cy} & 2-digit year\\
+ \config{\%cy} & 2-digit year\\
\config{\%cY} & 4-digit year\\
\config{\%cP} & Capital AM/PM\\
\config{\%cp} & Lowercase am/pm\\
@@ -376,9 +377,23 @@ display cycling round the defined sublines. See
\config{\%cb} & Month name\\
\config{\%cu} & Day of week from 1 to 7, 1 is Monday\\
\config{\%cw} & Day of week from 0 to 6, 0 is Sunday\\
+ }
+ \config{\%cc} & Check for presence of the clock hardware\\
\end{tagmap}
\end{table}
-}
+The \%cc tag returns ``c'' if the necessary hardware is present and can also be
+used as a conditional. This can be very useful for designing a WPS that works on
+multiple targets, some with and some without a clock. By using this tag as a
+conditional it is possible to display current date and time on those targets that
+support this
+\opt{rtc}{ (like the \playertype)},
+or alternate information on those that do not
+\nopt{rtc}{ (like the \playertype)}%
+.
+
+Example:
+\config{\%?cc{\textless}\%cH:\%cM{\textbar}No clock detected{\textgreater}}
+
\section{Other Tags}
\begin{table}