vdr  2.2.0
PLUGINS/src/status/status.c
Go to the documentation of this file.
1 /*
2  * status.c: A plugin for the Video Disk Recorder
3  *
4  * See the README file for copyright information and how to reach the author.
5  *
6  * $Id: status.c 3.2 2015/02/17 13:13:21 kls Exp $
7  */
8 
9 #include <vdr/plugin.h>
10 #include <vdr/status.h>
11 
12 static const char *VERSION = "2.2.0";
13 static const char *DESCRIPTION = "Status monitor test";
14 static const char *MAINMENUENTRY = NULL;
15 
16 // ---
17 
18 class cStatusTest : public cStatus {
19 protected:
20  virtual void TimerChange(const cTimer *Timer, eTimerChange Change);
21  virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView);
22  virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On);
23  virtual void Replaying(const cControl *Control, const char *Name, const char *FileName, bool On);
24  virtual void SetVolume(int Volume, bool Absolute);
25  virtual void SetAudioTrack(int Index, const char * const *Tracks);
26  virtual void SetAudioChannel(int AudioChannel);
27  virtual void SetSubtitleTrack(int Index, const char * const *Tracks);
28  virtual void OsdClear(void);
29  virtual void OsdTitle(const char *Title);
30  virtual void OsdStatusMessage(const char *Message);
31  virtual void OsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue);
32  virtual void OsdItem(const char *Text, int Index);
33  virtual void OsdCurrentItem(const char *Text);
34  virtual void OsdTextItem(const char *Text, bool Scroll);
35  virtual void OsdChannel(const char *Text);
36  virtual void OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle);
37  };
38 
39 void cStatusTest::TimerChange(const cTimer *Timer, eTimerChange Change)
40 {
41  dsyslog("status: cStatusTest::TimerChange %s %d", Timer ? *Timer->ToText(true) : "-", Change);
42 }
43 
44 void cStatusTest::ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView)
45 {
46  dsyslog("status: cStatusTest::ChannelSwitch %d %d %d", Device->CardIndex(), ChannelNumber, LiveView);
47 }
48 
49 void cStatusTest::Recording(const cDevice *Device, const char *Name, const char *FileName, bool On)
50 {
51  dsyslog("status: cStatusTest::Recording %d %s %s %d", Device->CardIndex(), Name, FileName, On);
52 }
53 
54 void cStatusTest::Replaying(const cControl *Control, const char *Name, const char *FileName, bool On)
55 {
56  dsyslog("status: cStatusTest::Replaying %s %s %d", Name, FileName, On);
57 }
58 
59 void cStatusTest::SetVolume(int Volume, bool Absolute)
60 {
61  dsyslog("status: cStatusTest::SetVolume %d %d", Volume, Absolute);
62 }
63 
64 void cStatusTest::SetAudioTrack(int Index, const char * const *Tracks)
65 {
66  dsyslog("status: cStatusTest::SetAudioTrack %d %s", Index, Tracks[Index]);
67 }
68 
69 void cStatusTest::SetAudioChannel(int AudioChannel)
70 {
71  dsyslog("status: cStatusTest::SetAudioChannel %d", AudioChannel);
72 }
73 
74 void cStatusTest::SetSubtitleTrack(int Index, const char * const *Tracks)
75 {
76  dsyslog("status: cStatusTest::SetSubtitleTrack %d %s", Index, Tracks[Index]);
77 }
78 
80 {
81  dsyslog("status: cStatusTest::OsdClear");
82 }
83 
84 void cStatusTest::OsdTitle(const char *Title)
85 {
86  dsyslog("status: cStatusTest::OsdTitle '%s'", Title);
87 }
88 
89 void cStatusTest::OsdStatusMessage(const char *Message)
90 {
91  dsyslog("status: cStatusTest::OsdStatusMessage '%s'", Message);
92 }
93 
94 void cStatusTest::OsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue)
95 {
96  dsyslog("status: cStatusTest::OsdHelpKeys %s - %s - %s - %s", Red, Green, Yellow, Blue);
97 }
98 
99 void cStatusTest::OsdItem(const char *Text, int Index)
100 {
101  //dsyslog("status: cStatusTest::OsdItem %s %d", Text, Index);
102 }
103 
104 void cStatusTest::OsdCurrentItem(const char *Text)
105 {
106  dsyslog("status: cStatusTest::OsdCurrentItem %s", Text);
107 }
108 
109 void cStatusTest::OsdTextItem(const char *Text, bool Scroll)
110 {
111  dsyslog("status: cStatusTest::OsdTextItem %s %d", Text, Scroll);
112 }
113 
114 void cStatusTest::OsdChannel(const char *Text)
115 {
116  dsyslog("status: cStatusTest::OsdChannel %s", Text);
117 }
118 
119 void cStatusTest::OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle)
120 {
121  char buffer[25];
122  struct tm tm_r;
123  dsyslog("status: cStatusTest::OsdProgramme");
124  strftime(buffer, sizeof(buffer), "%R", localtime_r(&PresentTime, &tm_r));
125  dsyslog("%5s %s", buffer, PresentTitle);
126  dsyslog("%5s %s", "", PresentSubtitle);
127  strftime(buffer, sizeof(buffer), "%R", localtime_r(&FollowingTime, &tm_r));
128  dsyslog("%5s %s", buffer, FollowingTitle);
129  dsyslog("%5s %s", "", FollowingSubtitle);
130 }
131 
132 // ---
133 
134 class cPluginStatus : public cPlugin {
135 private:
136  // Add any member variables or functions you may need here.
138 public:
139  cPluginStatus(void);
140  virtual ~cPluginStatus();
141  virtual const char *Version(void) { return VERSION; }
142  virtual const char *Description(void) { return DESCRIPTION; }
143  virtual const char *CommandLineHelp(void);
144  virtual bool ProcessArgs(int argc, char *argv[]);
145  virtual bool Start(void);
146  virtual void Housekeeping(void);
147  virtual const char *MainMenuEntry(void) { return MAINMENUENTRY; }
148  virtual cOsdObject *MainMenuAction(void);
149  virtual cMenuSetupPage *SetupMenu(void);
150  virtual bool SetupParse(const char *Name, const char *Value);
151  };
152 
154 {
155  // Initialize any member variables here.
156  // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
157  // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
158  statusTest = NULL;
159 }
160 
162 {
163  // Clean up after yourself!
164  delete statusTest;
165 }
166 
168 {
169  // Return a string that describes all known command line options.
170  return NULL;
171 }
172 
173 bool cPluginStatus::ProcessArgs(int argc, char *argv[])
174 {
175  // Implement command line argument processing here if applicable.
176  return true;
177 }
178 
180 {
181  // Start any background activities the plugin shall perform.
182  statusTest = new cStatusTest;
183  return true;
184 }
185 
187 {
188  // Perform any cleanup or other regular tasks.
189 }
190 
192 {
193  // Perform the action when selected from the main VDR menu.
194  return NULL;
195 }
196 
198 {
199  // Return a setup menu in case the plugin supports one.
200  return NULL;
201 }
202 
203 bool cPluginStatus::SetupParse(const char *Name, const char *Value)
204 {
205  // Parse your own setup parameters and store their values.
206  return false;
207 }
208 
209 VDRPLUGINCREATOR(cPluginStatus); // Don't touch this!
static const char * VERSION
virtual void TimerChange(const cTimer *Timer, eTimerChange Change)
virtual const char * CommandLineHelp(void)
#define dsyslog(a...)
Definition: tools.h:36
int Index(void) const
Definition: tools.c:1989
Definition: status.h:22
virtual void OsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue)
Definition: plugin.h:20
virtual const char * Version(void)
virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On)
virtual void OsdItem(const char *Text, int Index)
virtual bool ProcessArgs(int argc, char *argv[])
virtual void OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle)
static const char * DESCRIPTION
virtual void OsdClear(void)
virtual const char * MainMenuEntry(void)
virtual const char * Description(void)
virtual bool SetupParse(const char *Name, const char *Value)
virtual void OsdTitle(const char *Title)
virtual void Housekeeping(void)
virtual cMenuSetupPage * SetupMenu(void)
Definition: timers.h:27
virtual void Replaying(const cControl *Control, const char *Name, const char *FileName, bool On)
virtual void SetAudioTrack(int Index, const char *const *Tracks)
virtual void SetAudioChannel(int AudioChannel)
virtual void OsdStatusMessage(const char *Message)
virtual void SetVolume(int Volume, bool Absolute)
virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView)
static const char * MAINMENUENTRY
int CardIndex(void) const
Returns the card index of this device (0 ... MAXDEVICES - 1).
Definition: device.h:205
virtual void OsdCurrentItem(const char *Text)
VDRPLUGINCREATOR(cPluginStatus)
virtual cOsdObject * MainMenuAction(void)
virtual void SetSubtitleTrack(int Index, const char *const *Tracks)
virtual void OsdChannel(const char *Text)
virtual bool Start(void)
eTimerChange
Definition: status.h:18
cString ToText(bool UseChannelID=false) const
Definition: timers.c:171
virtual void OsdTextItem(const char *Text, bool Scroll)
The cDevice class is the base from which actual devices can be derived.
Definition: device.h:109