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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
/*
* status.c: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id: status.c 3.2 2015/02/17 13:13:21 kls Exp $
*/
#include <vdr/plugin.h>
#include <vdr/status.h>
static const char *VERSION = "2.2.0";
static const char *DESCRIPTION = "Status monitor test";
static const char *MAINMENUENTRY = NULL;
// ---
class cStatusTest : public cStatus {
protected:
virtual void TimerChange(const cTimer *Timer, eTimerChange Change);
virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView);
virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On);
virtual void Replaying(const cControl *Control, const char *Name, const char *FileName, bool On);
virtual void SetVolume(int Volume, bool Absolute);
virtual void SetAudioTrack(int Index, const char * const *Tracks);
virtual void SetAudioChannel(int AudioChannel);
virtual void SetSubtitleTrack(int Index, const char * const *Tracks);
virtual void OsdClear(void);
virtual void OsdTitle(const char *Title);
virtual void OsdStatusMessage(const char *Message);
virtual void OsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue);
virtual void OsdItem(const char *Text, int Index);
virtual void OsdCurrentItem(const char *Text);
virtual void OsdTextItem(const char *Text, bool Scroll);
virtual void OsdChannel(const char *Text);
virtual void OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle);
};
void cStatusTest::TimerChange(const cTimer *Timer, eTimerChange Change)
{
dsyslog("status: cStatusTest::TimerChange %s %d", Timer ? *Timer->ToText(true) : "-", Change);
}
void cStatusTest::ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView)
{
dsyslog("status: cStatusTest::ChannelSwitch %d %d %d", Device->CardIndex(), ChannelNumber, LiveView);
}
void cStatusTest::Recording(const cDevice *Device, const char *Name, const char *FileName, bool On)
{
dsyslog("status: cStatusTest::Recording %d %s %s %d", Device->CardIndex(), Name, FileName, On);
}
void cStatusTest::Replaying(const cControl *Control, const char *Name, const char *FileName, bool On)
{
dsyslog("status: cStatusTest::Replaying %s %s %d", Name, FileName, On);
}
void cStatusTest::SetVolume(int Volume, bool Absolute)
{
dsyslog("status: cStatusTest::SetVolume %d %d", Volume, Absolute);
}
void cStatusTest::SetAudioTrack(int Index, const char * const *Tracks)
{
dsyslog("status: cStatusTest::SetAudioTrack %d %s", Index, Tracks[Index]);
}
void cStatusTest::SetAudioChannel(int AudioChannel)
{
dsyslog("status: cStatusTest::SetAudioChannel %d", AudioChannel);
}
void cStatusTest::SetSubtitleTrack(int Index, const char * const *Tracks)
{
dsyslog("status: cStatusTest::SetSubtitleTrack %d %s", Index, Tracks[Index]);
}
void cStatusTest::OsdClear(void)
{
dsyslog("status: cStatusTest::OsdClear");
}
void cStatusTest::OsdTitle(const char *Title)
{
dsyslog("status: cStatusTest::OsdTitle '%s'", Title);
}
void cStatusTest::OsdStatusMessage(const char *Message)
{
dsyslog("status: cStatusTest::OsdStatusMessage '%s'", Message);
}
void cStatusTest::OsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue)
{
dsyslog("status: cStatusTest::OsdHelpKeys %s - %s - %s - %s", Red, Green, Yellow, Blue);
}
void cStatusTest::OsdItem(const char *Text, int Index)
{
//dsyslog("status: cStatusTest::OsdItem %s %d", Text, Index);
}
void cStatusTest::OsdCurrentItem(const char *Text)
{
dsyslog("status: cStatusTest::OsdCurrentItem %s", Text);
}
void cStatusTest::OsdTextItem(const char *Text, bool Scroll)
{
dsyslog("status: cStatusTest::OsdTextItem %s %d", Text, Scroll);
}
void cStatusTest::OsdChannel(const char *Text)
{
dsyslog("status: cStatusTest::OsdChannel %s", Text);
}
void cStatusTest::OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle)
{
char buffer[25];
struct tm tm_r;
dsyslog("status: cStatusTest::OsdProgramme");
strftime(buffer, sizeof(buffer), "%R", localtime_r(&PresentTime, &tm_r));
dsyslog("%5s %s", buffer, PresentTitle);
dsyslog("%5s %s", "", PresentSubtitle);
strftime(buffer, sizeof(buffer), "%R", localtime_r(&FollowingTime, &tm_r));
dsyslog("%5s %s", buffer, FollowingTitle);
dsyslog("%5s %s", "", FollowingSubtitle);
}
// ---
class cPluginStatus : public cPlugin {
private:
// Add any member variables or functions you may need here.
cStatusTest *statusTest;
public:
cPluginStatus(void);
virtual ~cPluginStatus();
virtual const char *Version(void) { return VERSION; }
virtual const char *Description(void) { return DESCRIPTION; }
virtual const char *CommandLineHelp(void);
virtual bool ProcessArgs(int argc, char *argv[]);
virtual bool Start(void);
virtual void Housekeeping(void);
virtual const char *MainMenuEntry(void) { return MAINMENUENTRY; }
virtual cOsdObject *MainMenuAction(void);
virtual cMenuSetupPage *SetupMenu(void);
virtual bool SetupParse(const char *Name, const char *Value);
};
cPluginStatus::cPluginStatus(void)
{
// Initialize any member variables here.
// DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
// VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
statusTest = NULL;
}
cPluginStatus::~cPluginStatus()
{
// Clean up after yourself!
delete statusTest;
}
const char *cPluginStatus::CommandLineHelp(void)
{
// Return a string that describes all known command line options.
return NULL;
}
bool cPluginStatus::ProcessArgs(int argc, char *argv[])
{
// Implement command line argument processing here if applicable.
return true;
}
bool cPluginStatus::Start(void)
{
// Start any background activities the plugin shall perform.
statusTest = new cStatusTest;
return true;
}
void cPluginStatus::Housekeeping(void)
{
// Perform any cleanup or other regular tasks.
}
cOsdObject *cPluginStatus::MainMenuAction(void)
{
// Perform the action when selected from the main VDR menu.
return NULL;
}
cMenuSetupPage *cPluginStatus::SetupMenu(void)
{
// Return a setup menu in case the plugin supports one.
return NULL;
}
bool cPluginStatus::SetupParse(const char *Name, const char *Value)
{
// Parse your own setup parameters and store their values.
return false;
}
VDRPLUGINCREATOR(cPluginStatus); // Don't touch this!
|