summaryrefslogtreecommitdiff
path: root/state.c
diff options
context:
space:
mode:
authormrwastl <mrwastl@users.sourceforge.net>2010-05-04 23:59:24 +0200
committermrwastl <mrwastl@users.sourceforge.net>2010-05-04 23:59:24 +0200
commitf0ce22b6b9cfda828ef000d652a0f4e2dc24334d (patch)
tree8926946b8e6ac14cf97fef95486073ee4855efb9 /state.c
parent8a4168bd0d2e468604755398f18be1fba9046aa0 (diff)
downloadvdr-plugin-graphlcd-f0ce22b6b9cfda828ef000d652a0f4e2dc24334d.tar.gz
vdr-plugin-graphlcd-f0ce22b6b9cfda828ef000d652a0f4e2dc24334d.tar.bz2
changing of brightness; external service informations from plugins radiotext and lcr
Diffstat (limited to 'state.c')
-rw-r--r--state.c111
1 files changed, 110 insertions, 1 deletions
diff --git a/state.c b/state.c
index c9a05d9..d70d58e 100644
--- a/state.c
+++ b/state.c
@@ -4,6 +4,7 @@
* status.c - status monitor class
*
* (c) 2001-2004 Carsten Siebholz <c.siebholz AT t-online de>
+ * (c) 2010 Wolfgang Astleitner <mrwastl AT users sourceforge net>
**/
#include <ctype.h>
@@ -16,6 +17,7 @@
#include <vdr/eitscan.h>
#include <vdr/i18n.h>
+#include <vdr/plugin.h>
cGraphLCDState::cGraphLCDState(cGraphLCDDisplay * Display)
@@ -72,6 +74,12 @@ cGraphLCDState::cGraphLCDState(cGraphLCDDisplay * Display)
mVolume.value = -1;
mVolume.lastChange = 0;
+ /* change flags for RDS and LCR services */
+ rtsChanged = false;
+ rtsActive = false;
+ lcrChanged = false;
+ lcrActive = false;
+
SetChannel(cDevice::CurrentChannel());
}
@@ -566,6 +574,7 @@ void cGraphLCDState::OsdChannel(const char * Text)
//printf("graphlcd plugin: cGraphLCDState::OsdChannel %s\n", Text);
if (GraphLCDSetup.PluginActive)
{
+ mDisplay->ForceUpdateBrightness();
if (Text)
mDisplay->Update();
}
@@ -641,10 +650,18 @@ void cGraphLCDState::UpdateChannelInfo(void)
void cGraphLCDState::UpdateEventInfo(void)
{
+ bool ptitle = false;
+
mutex.Lock();
const cEvent * present = NULL, * following = NULL;
cSchedulesLock schedulesLock;
+ // backup current values
+ std::string currTitle = mPresent.title;
+ std::string currShortText = mPresent.shortText;
+ std::string currDescription = mPresent.description;
+
+
// reset event data to empty values
mPresent.valid = false;
mPresent.startTime = 0;
@@ -677,8 +694,10 @@ void cGraphLCDState::UpdateEventInfo(void)
mPresent.vpsTime = present->Vps();
mPresent.duration = present->Duration();
mPresent.title = "";
- if (present->Title())
+ if (present->Title()) {
mPresent.title = present->Title();
+ ptitle = true;
+ }
mPresent.shortText = "";
if (present->ShortText())
mPresent.shortText = present->ShortText();
@@ -705,6 +724,32 @@ void cGraphLCDState::UpdateEventInfo(void)
}
}
}
+
+ /* get events from add. services (if activated) */
+ if (rtsActive) {
+ if (currRTSData.rds_info == 2 && strstr(currRTSData.rds_title, "---") == NULL) {
+ char rtpinfo[2][65], rtstr[140];
+ strcpy(rtpinfo[0], currRTSData.rds_title);
+ strcpy(rtpinfo[1], currRTSData.rds_artist);
+ sprintf(rtstr, "%02d:%02d %s | %s", currRTSData.title_start->tm_hour, currRTSData.title_start->tm_min, trim(((std::string)(rtpinfo[0]))).c_str(), trim(((std::string)(rtpinfo[1]))).c_str());
+ ptitle ? mPresent.shortText = rtstr : mPresent.title = rtstr;
+ } else if (currRTSData.rds_info > 0) {
+ char rtstr[65];
+ strcpy(rtstr, currRTSData.rds_text);
+ ptitle ? mPresent.shortText = trim(rtstr) : mPresent.title = trim(rtstr);
+ }
+ } else if (lcrActive && lcrChanged) {
+ if ( strstr( currLcrData.destination, "---" ) == NULL ) {
+ char lcrStringParts[3][25], lcrString[100];
+ strcpy( lcrStringParts[0], (const char *)currLcrData.destination );
+ strcpy( lcrStringParts[1], (const char *)currLcrData.price );
+ strcpy( lcrStringParts[2], (const char *)currLcrData.pulse );
+ sprintf(lcrString, "%s | %s", trim((std::string)(lcrStringParts[1])).c_str(), trim((std::string)(lcrStringParts[2])).c_str());
+ mPresent.title = trim(lcrStringParts[0]);
+ mPresent.shortText = trim(lcrString);
+ }
+ }
+
mutex.Unlock();
}
@@ -861,3 +906,67 @@ bool cGraphLCDState::ShowMessage()
mutex.Unlock();
return ret;
}
+
+
+/* async. check event updates for services from other plugins */
+/* only sets flags but does NOT update display output */
+bool cGraphLCDState::CheckServiceEventUpdate(void)
+{
+ mutex.Lock();
+
+ rtsChanged = false;
+ lcrChanged = false;
+ rtsActive = false;
+ lcrActive = false;
+
+ // get&display Radiotext
+ cPlugin *p;
+ p = cPluginManager::CallFirstService("RadioTextService-v1.0", NULL);
+ if (p) {
+ rtsActive = true;
+ if (cPluginManager::CallFirstService("RadioTextService-v1.0", &checkRTSData)) {
+ if (
+ (currRTSData.rds_info != checkRTSData.rds_info) ||
+ (currRTSData.rds_pty != checkRTSData.rds_pty) ||
+ (strcmp(currRTSData.rds_text, checkRTSData.rds_text) != 0) ||
+ (strcmp(currRTSData.rds_title, checkRTSData.rds_title) != 0) ||
+ (strcmp(currRTSData.rds_artist, checkRTSData.rds_artist) != 0)
+ )
+ {
+ currRTSData.rds_info = checkRTSData.rds_info;
+ currRTSData.rds_pty = checkRTSData.rds_pty;
+ currRTSData.rds_text = checkRTSData.rds_text;
+ currRTSData.rds_title = checkRTSData.rds_title;
+ currRTSData.rds_artist = checkRTSData.rds_artist;
+ currRTSData.title_start= checkRTSData.title_start;
+
+ rtsChanged = true;
+ }
+ }
+ }
+
+
+ // get&display LcrData
+ p = cPluginManager::CallFirstService("LcrService-v1.0", NULL);
+ if (p) {
+ lcrActive = true;
+ if (cPluginManager::CallFirstService("LcrService-v1.0", &checkLcrData)) {
+ if (
+ (strcmp(currLcrData.destination, checkLcrData.destination) != 0) ||
+ (strcmp(currLcrData.price, checkLcrData.price) != 0) ||
+ (strcmp(currLcrData.pulse, checkLcrData.pulse) != 0)
+ )
+ {
+ currLcrData.destination = checkLcrData.destination;
+ currLcrData.price = checkLcrData.price;
+ currLcrData.pulse = checkLcrData.pulse;
+
+ lcrChanged = true;
+ }
+ }
+ }
+ mutex.Unlock();
+ return (rtsChanged || lcrChanged);
+}
+
+