vdr  1.7.27
status.c
Go to the documentation of this file.
00001 /*
00002  * status.c: A plugin for the Video Disk Recorder
00003  *
00004  * See the README file for copyright information and how to reach the author.
00005  *
00006  * $Id: status.c 2.1 2012/03/11 14:48:37 kls Exp $
00007  */
00008 
00009 #include <vdr/plugin.h>
00010 #include <vdr/status.h>
00011 
00012 static const char *VERSION        = "0.3.1";
00013 static const char *DESCRIPTION    = "Status monitor test";
00014 static const char *MAINMENUENTRY  = NULL;
00015 
00016 // ---
00017 
00018 class cStatusTest : public cStatus {
00019 protected:
00020   virtual void TimerChange(const cTimer *Timer, eTimerChange Change);
00021   virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView);
00022   virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On);
00023   virtual void Replaying(const cControl *Control, const char *Name, const char *FileName, bool On);
00024   virtual void SetVolume(int Volume, bool Absolute);
00025   virtual void SetAudioTrack(int Index, const char * const *Tracks);
00026   virtual void SetAudioChannel(int AudioChannel);
00027   virtual void SetSubtitleTrack(int Index, const char * const *Tracks);
00028   virtual void OsdClear(void);
00029   virtual void OsdTitle(const char *Title);
00030   virtual void OsdStatusMessage(const char *Message);
00031   virtual void OsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue);
00032   virtual void OsdItem(const char *Text, int Index);
00033   virtual void OsdCurrentItem(const char *Text);
00034   virtual void OsdTextItem(const char *Text, bool Scroll);
00035   virtual void OsdChannel(const char *Text);
00036   virtual void OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle);
00037   };
00038 
00039 void cStatusTest::TimerChange(const cTimer *Timer, eTimerChange Change)
00040 {
00041   dsyslog("status: cStatusTest::TimerChange  %s %d", Timer ? *Timer->ToText(true) : "-", Change);
00042 }
00043 
00044 void cStatusTest::ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView)
00045 {
00046   dsyslog("status: cStatusTest::ChannelSwitch  %d %d %d", Device->CardIndex(), ChannelNumber, LiveView);
00047 }
00048 
00049 void cStatusTest::Recording(const cDevice *Device, const char *Name, const char *FileName, bool On)
00050 {
00051   dsyslog("status: cStatusTest::Recording  %d %s %s %d", Device->CardIndex(), Name, FileName, On);
00052 }
00053 
00054 void cStatusTest::Replaying(const cControl *Control, const char *Name, const char *FileName, bool On)
00055 {
00056   dsyslog("status: cStatusTest::Replaying  %s %s %d", Name, FileName, On);
00057 }
00058 
00059 void cStatusTest::SetVolume(int Volume, bool Absolute)
00060 {
00061   dsyslog("status: cStatusTest::SetVolume  %d %d", Volume, Absolute);
00062 }
00063 
00064 void cStatusTest::SetAudioTrack(int Index, const char * const *Tracks)
00065 {
00066   dsyslog("status: cStatusTest::SetAudioTrack  %d %s", Index, Tracks[Index]);
00067 }
00068 
00069 void cStatusTest::SetAudioChannel(int AudioChannel)
00070 {
00071   dsyslog("status: cStatusTest::SetAudioChannel  %d", AudioChannel);
00072 }
00073 
00074 void cStatusTest::SetSubtitleTrack(int Index, const char * const *Tracks)
00075 {
00076   dsyslog("status: cStatusTest::SetSubtitleTrack  %d %s", Index, Tracks[Index]);
00077 }
00078 
00079 void cStatusTest::OsdClear(void)
00080 {
00081   dsyslog("status: cStatusTest::OsdClear");
00082 }
00083 
00084 void cStatusTest::OsdTitle(const char *Title)
00085 {
00086   dsyslog("status: cStatusTest::OsdTitle '%s'", Title);
00087 }
00088 
00089 void cStatusTest::OsdStatusMessage(const char *Message)
00090 {
00091   dsyslog("status: cStatusTest::OsdStatusMessage '%s'", Message);
00092 }
00093 
00094 void cStatusTest::OsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue)
00095 {
00096   dsyslog("status: cStatusTest::OsdHelpKeys %s - %s - %s - %s", Red, Green, Yellow, Blue);
00097 }
00098 
00099 void cStatusTest::OsdItem(const char *Text, int Index)
00100 {
00101   //dsyslog("status: cStatusTest::OsdItem  %s %d", Text, Index);
00102 }
00103 
00104 void cStatusTest::OsdCurrentItem(const char *Text)
00105 {
00106   dsyslog("status: cStatusTest::OsdCurrentItem %s", Text);
00107 }
00108 
00109 void cStatusTest::OsdTextItem(const char *Text, bool Scroll)
00110 {
00111   dsyslog("status: cStatusTest::OsdTextItem %s %d", Text, Scroll);
00112 }
00113 
00114 void cStatusTest::OsdChannel(const char *Text)
00115 {
00116   dsyslog("status: cStatusTest::OsdChannel %s", Text);
00117 }
00118 
00119 void cStatusTest::OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle)
00120 {
00121   char buffer[25];
00122   struct tm tm_r;
00123   dsyslog("status: cStatusTest::OsdProgramme");
00124   strftime(buffer, sizeof(buffer), "%R", localtime_r(&PresentTime, &tm_r));
00125   dsyslog("%5s %s", buffer, PresentTitle);
00126   dsyslog("%5s %s", "", PresentSubtitle);
00127   strftime(buffer, sizeof(buffer), "%R", localtime_r(&FollowingTime, &tm_r));
00128   dsyslog("%5s %s", buffer, FollowingTitle);
00129   dsyslog("%5s %s", "", FollowingSubtitle);
00130 }
00131 
00132 // ---
00133 
00134 class cPluginStatus : public cPlugin {
00135 private:
00136   // Add any member variables or functions you may need here.
00137   cStatusTest *statusTest;
00138 public:
00139   cPluginStatus(void);
00140   virtual ~cPluginStatus();
00141   virtual const char *Version(void) { return VERSION; }
00142   virtual const char *Description(void) { return DESCRIPTION; }
00143   virtual const char *CommandLineHelp(void);
00144   virtual bool ProcessArgs(int argc, char *argv[]);
00145   virtual bool Start(void);
00146   virtual void Housekeeping(void);
00147   virtual const char *MainMenuEntry(void) { return MAINMENUENTRY; }
00148   virtual cOsdObject *MainMenuAction(void);
00149   virtual cMenuSetupPage *SetupMenu(void);
00150   virtual bool SetupParse(const char *Name, const char *Value);
00151   };
00152 
00153 cPluginStatus::cPluginStatus(void)
00154 {
00155   // Initialize any member variables here.
00156   // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
00157   // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
00158   statusTest = NULL;
00159 }
00160 
00161 cPluginStatus::~cPluginStatus()
00162 {
00163   // Clean up after yourself!
00164   delete statusTest;
00165 }
00166 
00167 const char *cPluginStatus::CommandLineHelp(void)
00168 {
00169   // Return a string that describes all known command line options.
00170   return NULL;
00171 }
00172 
00173 bool cPluginStatus::ProcessArgs(int argc, char *argv[])
00174 {
00175   // Implement command line argument processing here if applicable.
00176   return true;
00177 }
00178 
00179 bool cPluginStatus::Start(void)
00180 {
00181   // Start any background activities the plugin shall perform.
00182   statusTest = new cStatusTest;
00183   return true;
00184 }
00185 
00186 void cPluginStatus::Housekeeping(void)
00187 {
00188   // Perform any cleanup or other regular tasks.
00189 }
00190 
00191 cOsdObject *cPluginStatus::MainMenuAction(void)
00192 {
00193   // Perform the action when selected from the main VDR menu.
00194   return NULL;
00195 }
00196 
00197 cMenuSetupPage *cPluginStatus::SetupMenu(void)
00198 {
00199   // Return a setup menu in case the plugin supports one.
00200   return NULL;
00201 }
00202 
00203 bool cPluginStatus::SetupParse(const char *Name, const char *Value)
00204 {
00205   // Parse your own setup parameters and store their values.
00206   return false;
00207 }
00208 
00209 VDRPLUGINCREATOR(cPluginStatus); // Don't touch this!