summaryrefslogtreecommitdiff
path: root/patches/lcdproc-0.0.10-lcr-service.diff
blob: e298297de6eff51884a3232723fb11cfd755610b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
diff -up autopatch/lcd.c ./lcd.c
--- autopatch/lcd.c	Sun Mar  5 19:25:08 2006
+++ ./lcd.c	Tue Mar  7 20:51:22 2006
@@ -622,6 +622,9 @@ void cLcd::Action(void) { // LCD output 
   // RT
   static int rtcycle;
   
+  // LCR
+  static int lcrCycle;
+  
   // backlight init 
   if ((lastBackLight=LcdSetup.BackLight))
     sock_send_string(sock,"backlight on\n");
@@ -705,6 +708,7 @@ void cLcd::Action(void) { // LCD output 
             if ((Present = Schedule->GetFollowingEvent()) != NULL)
               nextLcdUpdate=(Present->GetTime()<nextLcdUpdate)?Present->GetTime():nextLcdUpdate;
             rtcycle = 10; // RT
+	    lcrCycle = 10; // LCR
          }
       }
      if ( nextLcdUpdate <= time(NULL) )
@@ -735,6 +739,7 @@ void cLcd::Action(void) { // LCD output 
             if ((Present = Schedule->GetFollowingEvent()) != NULL)
               nextLcdUpdate=(Present->StartTime()<nextLcdUpdate)?Present->StartTime():nextLcdUpdate;
             rtcycle = 10; // RT
+	    lcrCycle = 10; // LCR
          }
       }
      if ( nextLcdUpdate <= time(NULL) )
@@ -763,7 +768,26 @@ void cLcd::Action(void) { // LCD output 
 	    }
 	rtcycle = 0;
 	//printf("lcdproc - get Radiotext ...\n");
-	}
+    }
+    // get&display LcrData
+    if (lcrCycle++ == 10) // every 10 times
+    {
+        lcrCycle = 0;
+        cPlugin *p;
+        p = cPluginManager::CallFirstService("LcrService-v1.0", NULL);
+        if (p)
+        {
+            LcrService_v1_0 lcrData;
+            if (cPluginManager::CallFirstService("LcrService-v1.0", &lcrData))
+            {
+                if ( strstr( lcrData.destination, "---" ) == NULL )
+                {
+                  SetRunning(false, (const char *)lcrData.destination, (const char *)lcrData.price, (const char         *)lcrData.pulse);
+                  nextLcdUpdate = 0; //trigger next epg update
+                }
+            }
+        }
+    }
 #endif
 
     // replaying
diff -up autopatch/lcd.c.orig ./lcd.c.orig
--- autopatch/lcd.c.orig	Sun Feb 26 20:11:02 2006
+++ ./lcd.c.orig	Sun Mar  5 19:25:08 2006
@@ -11,6 +11,7 @@
 #include "lcd.h"
 #include "sockets.h"
 #include "i18n.h"
+#include <vdr/plugin.h>
 
 #ifdef LCD_EXT_KEY_CONF 
 #include LCD_EXT_KEY_CONF 
@@ -390,6 +391,7 @@ void cLcd::SetRunning( bool nownext, con
 void cLcd::SummaryInit(char *string) {
   SummaryText  = string;
   SummaryTextL = strlen(string);
+  dsyslog("> %i", SummaryTextL);
   SummaryCurrent=0;
 }
 
@@ -406,7 +408,7 @@ void cLcd::SummaryUp() {
 }
 
 void cLcd::SummaryDisplay() {
-  if ( (!connected) || (SummaryTextL < 1) ) return;
+  if ( (!connected) || (SummaryTextL < 1) || !SummaryText ) return;
 
   char workstring[256];
   unsigned int i, offset=0;
@@ -617,6 +619,8 @@ void cLcd::Action(void) { // LCD output 
   bool Lcddirty[LCDMAXSTATES][4];
   bool LcdShiftkeyPressed=false;
   char priostring[35];
+  // RT
+  static int rtcycle;
   
   // backlight init 
   if ((lastBackLight=LcdSetup.BackLight))
@@ -700,6 +704,7 @@ void cLcd::Action(void) { // LCD output 
                SetRunning(false,tr("No EPG info available."), NULL);
             if ((Present = Schedule->GetFollowingEvent()) != NULL)
               nextLcdUpdate=(Present->GetTime()<nextLcdUpdate)?Present->GetTime():nextLcdUpdate;
+            rtcycle = 10; // RT
          }
       }
      if ( nextLcdUpdate <= time(NULL) )
@@ -729,12 +734,36 @@ void cLcd::Action(void) { // LCD output 
                SetRunning(false,tr("No EPG info available."), NULL); 
             if ((Present = Schedule->GetFollowingEvent()) != NULL)
               nextLcdUpdate=(Present->StartTime()<nextLcdUpdate)?Present->StartTime():nextLcdUpdate;
+            rtcycle = 10; // RT
          }
       }
      if ( nextLcdUpdate <= time(NULL) )
          nextLcdUpdate=(time(NULL)/60)*60+60;
     }  
 
+#endif
+
+#if VDRVERSNUM >= 10330
+    // get&display Radiotext
+    if (++rtcycle > 10) {	// every 10 times
+        cPlugin *p;
+	p = cPluginManager::CallFirstService("RadioTextService-v1.0", NULL);
+	if (p) {
+	    RadioTextService_v1_0 rtext;
+    	    if (cPluginManager::CallFirstService("RadioTextService-v1.0", &rtext)) {
+    		if (rtext.rds_info == 2 && strstr(rtext.rds_title, "---") == NULL) {
+		    char timestr[20];
+    		    sprintf(timestr, "%02d:%02d", rtext.title_start->tm_hour, rtext.title_start->tm_min);
+        	    SetRunning(false, timestr, rtext.rds_title, rtext.rds_artist);
+		    }
+		else if (rtext.rds_info > 0) {
+        	    SetRunning(false, NULL, rtext.rds_text);
+		    }
+		}
+	    }
+	rtcycle = 0;
+	//printf("lcdproc - get Radiotext ...\n");
+	}
 #endif
 
     // replaying
diff -up autopatch/lcd.h ./lcd.h
--- autopatch/lcd.h	Sun Feb 26 20:11:01 2006
+++ ./lcd.h	Tue Mar  7 20:46:30 2006
@@ -89,4 +89,11 @@ struct RadioTextService_v1_0 {
   struct tm *title_start;
 };
 
+// LcrData
+struct LcrService_v1_0 {
+  cString destination;
+  cString price;
+  cString pulse;
+};
+
 #endif //__LCD_H
diff -up autopatch/lcd.h.orig ./lcd.h.orig
--- autopatch/lcd.h.orig	Sun Feb 26 20:11:02 2006
+++ ./lcd.h.orig	Sun Feb 26 20:11:01 2006
@@ -79,4 +79,14 @@ class cLcd : public cThread {
     bool channelSwitched;
 };
 
+// Radiotext
+struct RadioTextService_v1_0 {
+  int rds_info;
+  int rds_pty;
+  char *rds_text;
+  char *rds_title;
+  char *rds_artist;
+  struct tm *title_start;
+};
+
 #endif //__LCD_H