-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevstatus.c
734 lines (642 loc) · 24.5 KB
/
devstatus.c
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
/*
* devstatus.c: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
*/
#include <sys/ioctl.h>
#include <linux/dvb/frontend.h>
#include <vdr/plugin.h>
#include <vdr/status.h>
#include <vdr/menu.h>
#include <vdr/i18n.h>
static const char *VERSION = "0.5.0";
static const char *DESCRIPTION = trNOOP("Status of dvb devices");
static const char *MAINMENUENTRY = trNOOP("Device status");
#undef DAYDATETIMESTRING
#if VDRVERSNUM >= 10318
#define DAYDATETIME(x) *DayDateTime(x)
#else
#define DAYDATETIME(x) DayDateTime(x)
#endif
static int showRecordings = 1;
static int showStrength = 1;
static int showChannels = 1;
static int showChProvider = 1;
static int update = 0;
//----------------Tools
const char* cardtypeAsString(int typ) {
switch (typ) {
case FE_QPSK: return tr("satellite card");
case FE_QAM: return tr("cable card"); break;
case FE_OFDM: return tr("terrestrial card"); break;
default: return tr("unknown cardtype");
};
}
int getFrequencyMHz(int value) {
int ret = value;
while (ret > 20000) ret /= 1000;
return ret;
}
#if VDRVERSNUM >= 20301
const cChannel* getTunedChannel(cDevice *d) {
#else
cChannel* getTunedChannel(cDevice *d) {
#endif
int channelNo;
#if VDRVERSNUM >= 20301
LOCK_CHANNELS_READ;
const cChannel *channel = NULL;
for (channelNo = 1; channelNo <= Channels->MaxNumber(); channelNo++) {
if( (channel = Channels->GetByNumber(channelNo)) ) {
#else
cChannel *channel = NULL;
for (channelNo = 1; channelNo <= Channels.MaxNumber(); channelNo++) {
if( (channel = Channels.GetByNumber(channelNo)) ) {
#endif
if (d->IsTunedToTransponder(channel)) {
return channel;
}
}
}
return NULL;
}
int getTunedFrequency (cDevice *device) {
#if VDRVERSNUM >= 20301
const cChannel *tunedChannel = getTunedChannel(device);
#else
cChannel *tunedChannel = getTunedChannel(device);
#endif
return tunedChannel ? tunedChannel->Frequency() : 0;
}
#if VDRVERSNUM >= 20301
const cChannel* nextTransponderChannel( cDevice *device, int direction) {
#else
cChannel* nextTransponderChannel( cDevice *device, int direction) {
#endif
// search for the next transponder (direction=1) or the previous one (-1)
int channelNo;
int oldQRG = getTunedFrequency(device);
#if VDRVERSNUM >= 20301
const cChannel *channel = NULL;
const cChannel *resChannel = NULL;
LOCK_CHANNELS_READ;
for (channelNo = 1; channelNo <= Channels->MaxNumber(); channelNo++) {
if( (channel = Channels->GetByNumber(channelNo)) ) {
#else
cChannel *channel = NULL;
cChannel *resChannel = NULL;
for (channelNo = 1; channelNo <= Channels.MaxNumber(); channelNo++) {
if( (channel = Channels.GetByNumber(channelNo)) ) {
#endif
if( device->ProvidesSource( channel->Source() ) ) { // same source (DVB-T, -S, ...)
if( !ISTRANSPONDER(channel->Frequency(),oldQRG) ) { //not the same transponder
if( channel->Frequency()*direction > oldQRG*direction ) {
if( resChannel == NULL
|| (abs(channel->Frequency() - oldQRG) < abs(resChannel->Frequency() - oldQRG))
) {
resChannel = channel;
}
}
}
}
}
}
return resChannel;
}
// --- cRecObj --------------------------------------------------------
class cRecObj : public cListObject {
public:
char* name;
const cDevice* device;
#if VDRVERSNUM >= 20301
const cTimer* timer;
public:
cRecObj(const char* Name, const cDevice* Device, const cTimer* Timer) {
#else
cTimer* timer;
public:
cRecObj(const char* Name, const cDevice* Device, cTimer* Timer) {
#endif
name = strdup(Name);
device = Device;
timer = Timer;
}
~cRecObj() {
if (name) free(name);
}
};
// --- cDevStatusMonitor ---------------------------------------------------
class cDevStatusMonitor : public cStatus {
protected:
#if VDRVERSNUM >= 10338
virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On);
#else
virtual void Recording(const cDevice *Device, const char *Name);
#endif
virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView);
};
cList<cRecObj> CurrentRecordings;
// --- cMenuRecItem ------------------------------------------------------
class cMenuRecItem : public cOsdItem {
char *Name;
public:
int ChannelNr;
int DeviceNr;
cMenuRecItem(const char* name) {
Name = NULL;
ChannelNr = 0;
DeviceNr = -1;
if (name) { Name = strdup(name); SetText(Name, false); }
}
cMenuRecItem(const cRecObj* r) {
Name = NULL;
if (r->name) {
Name = strdup(r->name);
char* itemText = NULL;
asprintf(&itemText, "%s\t%s", DAYDATETIME(r->timer->StartTime()), Name);
SetText(itemText, false);
}
}
char* RecName() { return Name; }
int GetChannelNr() { return ChannelNr; }
bool IsChannel() { return ChannelNr != 0; }
bool HasDevice() { return DeviceNr >= 0; }
#if VDRVERSNUM >= 20301
const cChannel* GetChannel() { LOCK_CHANNELS_READ; return Channels->GetByNumber(ChannelNr); }
#else
cChannel* GetChannel() { return Channels.GetByNumber(ChannelNr); }
#endif
cDevice* GetDevice() { return cDevice::GetDevice(DeviceNr); };
};
class cMenuDevStatus : public cOsdMenu {
private:
public:
void deviceinfoAsString(cDevice *d) {
struct dvb_frontend_info m_FrontendInfo;
int m_Frontend;
// fe_status_t status;
uint16_t signal = 0;
uint16_t snr = 0;
// uint32_t ber = 0;
char* output = NULL;
#define FRONTEND_DEVICE "/dev/dvb/adapter%d/frontend%d"
// cString dev = cString::sprintf(FRONTEND_DEVICE, d->CardIndex() + 1, 0);
cString dev = cString::sprintf(FRONTEND_DEVICE, d->CardIndex(), 0);
m_Frontend = open(dev, O_RDONLY | O_NONBLOCK);
if (m_Frontend < 0) {
return;
}
int rcfe = ioctl(m_Frontend, FE_GET_INFO, &m_FrontendInfo);
// CHECK(ioctl(m_Frontend, FE_READ_STATUS, &status));
// CHECK(ioctl(m_Frontend, FE_READ_BER, &ber));
close(m_Frontend);
signal = d->SignalStrength();
snr = d->SignalQuality();
// 2. line type (name) - devpath
if( rcfe == 0 ) {
asprintf(&output, "%s (%s) - %s",
cardtypeAsString(m_FrontendInfo.type),
m_FrontendInfo.name,
*dev
);
} else {
asprintf(&output, "no information available (rc=%d) - %s", rcfe, *dev);
}
cMenuRecItem* norec = new cMenuRecItem(output);
norec->SetSelectable(false);
Add(norec);
free(output);
// 3. line strength
if( showStrength ) {
if( (signal > 0) || (snr>0)) {
asprintf(&output, tr("frequency: %d MHz, signal: %d%%, s/n: %d%%"),
getFrequencyMHz (getTunedFrequency(d)) ,
signal, snr);
} else {
asprintf(&output, tr("no signal information available"));
}
norec = new cMenuRecItem(output);
norec->SetSelectable(false);
Add(norec);
free(output);
}
}
cMenuDevStatus():cOsdMenu(tr("Device status"), 15) {
Write();
}
void Write (void) { //Repaint screen
int last = Current();
Clear(); // clear OSD
for (int i = 0; i < cDevice::NumDevices(); i++) {
if (cDevice *d = cDevice::GetDevice(i)) {
char* devName = NULL;
char* devInfo = NULL;
// line --- device <n> ....
if (d->HasDecoder() || d->IsPrimaryDevice())
asprintf(&devInfo, " (%s%s%s)",
d->HasDecoder() ? tr("device with decoder") : "",
(d->HasDecoder() && d->IsPrimaryDevice()) ? ", " : "",
d->IsPrimaryDevice() ? tr("primary device") : ""
);
asprintf(&devName, "--- %s %d %s %s ---",
tr("Device"),
i+1,
(i == cDevice::ActualDevice()->CardIndex()) ? tr("-- Live"):"",
devInfo ? devInfo : ""
) ;
cMenuRecItem* DeviceHeader = new cMenuRecItem(devName);
DeviceHeader->DeviceNr = i;
DeviceHeader->SetSelectable(true);
Add(DeviceHeader);
free(devName);
if (devInfo)
free(devInfo);
// name, type
// signal
deviceinfoAsString(d);
// recordings
if( showRecordings ) {
int Count = 0;
for (cRecObj *r = CurrentRecordings.First(); r; r = CurrentRecordings.Next(r)) {
if (r && r->device == d) {
Add(new cMenuRecItem(r));
Count++;
}
}
if (Count == 0) {
cMenuRecItem* norec = new cMenuRecItem(tr("currently no recordings"));
norec->SetSelectable(false);
Add(norec);
}
}
// channels
if (showChannels) {
cMenuRecItem* norec = NULL;
char* output = NULL;
int channelNo;
#if VDRVERSNUM >= 20301
LOCK_CHANNELS_READ;
const cChannel *channel = NULL;
for (channelNo = 1; channelNo <= Channels->MaxNumber(); channelNo++) {
if( (channel = Channels->GetByNumber(channelNo)) ) {
#else
cChannel *channel = NULL;
for (channelNo = 1; channelNo <= Channels.MaxNumber(); channelNo++) {
if( (channel = Channels.GetByNumber(channelNo)) ) {
#endif
if (d->IsTunedToTransponder(channel)) {
bool currentLive = channelNo == d->CurrentChannel()
&& (i == cDevice::ActualDevice()->CardIndex());
/* TRANSLATORS: printf string for channel line */
asprintf(&output, tr("%5d %s %s %s %s%s%s"),
channelNo,
(channel->Vpid() > 0)
/* TRANSLATORS: abbr. for tv-channels */
? (channel->Apid(0) > 0) ? tr("t")
/* TRANSLATORS: abbr. for video only-channels */
: tr("v")
/* TRANSLATORS: abbr. for radio-channels */
: (channel->Apid(0) > 0) ? tr("r")
/* TRANSLATORS: abbr. for no signal-channels */
: tr("-"),
/* TRANSLATORS: abbr. for live channel */
currentLive ? tr("+")
/* TRANSLATORS: abbr. for crypted channels */
: (channel->Ca() > 4) ? tr("x")
/* TRANSLATORS: abbr. for FTA channels */
: tr(" "),
channel->Name(),
showChProvider ? "(":"",
showChProvider ? channel->Provider():"",
showChProvider ? ")":""
);
norec = new cMenuRecItem(output);
norec->ChannelNr = channelNo;
norec->DeviceNr = i;
norec->SetSelectable(true);
Add(norec);
free(output);
}
}
}
}
// Leerzeile schreiben
if (i < cDevice::NumDevices()) {
DeviceHeader = new cMenuRecItem("");
DeviceHeader->SetSelectable(false);
Add(DeviceHeader);
}
}
}
cMenuRecItem* norec = NULL;
norec = new cMenuRecItem("");
norec->SetSelectable(true); // so we can scroll to the end of the list
Add(norec);
SetHelp( showRecordings ? tr("no recordings"):tr("recordings"),
showStrength ? tr("no strength") :tr("strength"),
showChannels ? tr("no channels") :tr("channels"),
tr("Refresh display")
);
SetCurrent(Get(last));
Display();
} //Write()
eOSState Play(char* file) {
// Play the selected recording
#if VDRVERSNUM >= 20301
const cRecording* recordingFound = NULL;
LOCK_RECORDINGS_READ;
for(const cRecording* recording = Recordings->First(); recording; recording = Recordings->Next(recording))
#else
cRecording* recordingFound = NULL;
for(cRecording* recording = Recordings.First(); recording; recording = Recordings.Next(recording))
#endif
if (strstr(recording->Title(), file))
recordingFound = recording;
if (!recordingFound)
return osContinue;
cReplayControl::SetRecording(recordingFound->FileName());
return osReplay;
}
eOSState ProcessKey(eKeys Key) {
cMenuRecItem *ri;
eOSState state = osUnknown;
switch(Key) {
case kRed:
showRecordings = !showRecordings;
Write();
break;
case kGreen:
showStrength = !showStrength;
Write();
break;
case kYellow:
showChannels = !showChannels;
Write();
break;
case kBlue:
Write();
break;
case kChanUp: case k7:
case kChanDn: case k9:
// switch Transponder
ri = (cMenuRecItem*)Get(Current());
if( ri->Selectable() & ri->HasDevice() ) {
#if VDRVERSNUM >= 20301
const cChannel *newChannel = nextTransponderChannel(
#else
cChannel *newChannel = nextTransponderChannel(
#endif
ri->GetDevice(), ((Key==k9)||(Key==kChanUp)? 1:-1)
);
if( newChannel != NULL )
// Switch; no live view, so crypted
// transponder will be tuneable
ri->GetDevice()->SwitchChannel( newChannel, false );
Write(); //repaint; maybe 'Live' has changed
return osContinue;
}
break;
case kOk:
ri = (cMenuRecItem*)Get(Current());
if (ri->Selectable()) {
if (ri->IsChannel()) {
#if VDRVERSNUM >= 20301
LOCK_CHANNELS_READ;
Channels->SwitchTo(ri->GetChannelNr());
#else
Channels.SwitchTo(ri->GetChannelNr());
#endif
Write(); //repaint; maybe 'Live' has changed
return osContinue;
} else
return Play(ri->RecName());
}
break;
case kNone:
if( update ) {
update=0;
Write();
break;
}
break;
default:
state = cOsdMenu::ProcessKey(Key);
break;
}
return state;
}
}; //cMenuDevStatus
class cPluginDevstatus : public cPlugin {
private:
cDevStatusMonitor* devStatusMonitor;
public:
cPluginDevstatus(void);
virtual ~cPluginDevstatus();
virtual const char *Version(void) { return VERSION; }
virtual const char *Description(void) { return tr(DESCRIPTION); }
virtual bool ProcessArgs(int argc, char *argv[]);
virtual bool Initialize(void);
virtual bool Start(void);
virtual void Stop(void);
virtual void Housekeeping(void);
virtual const char *MainMenuEntry(void) { return tr(MAINMENUENTRY); }
virtual cOsdObject *MainMenuAction(void);
virtual cMenuSetupPage *SetupMenu(void);
virtual bool SetupParse(const char *Name, const char *Value);
virtual bool Service(const char *Id, void *Data = NULL);
virtual const char **SVDRPHelpPages(void);
virtual cString SVDRPCommand(const char *Command, const char *Option, int &ReplyCode);
};
// --- cMenuSetupDevstatus -------------------------------------------------------
class cMenuSetupDevstatus : public cMenuSetupPage {
private:
int newShowRecordings;
int newShowStrength;
int newShowChannels;
int newShowChProvider;
protected:
virtual void Store(void);
public:
cMenuSetupDevstatus(void);
};
cMenuSetupDevstatus::cMenuSetupDevstatus(void) {
newShowRecordings = showRecordings;
newShowStrength = showStrength;
newShowChannels = showChannels;
newShowChProvider = showChProvider;
Add(new cMenuEditBoolItem(tr("Show recordings" ), &newShowRecordings));
Add(new cMenuEditBoolItem(tr("Show signals" ), &newShowStrength));
Add(new cMenuEditBoolItem(tr("Show channels" ), &newShowChannels));
Add(new cMenuEditBoolItem(tr("Show channel provider" ), &newShowChProvider));
}
void cMenuSetupDevstatus::Store(void) {
SetupStore("ShowRecordings", showRecordings = newShowRecordings);
SetupStore("ShowStrength", showStrength = newShowStrength);
SetupStore("ShowChannels", showChannels = newShowChannels);
SetupStore("ShowChProvider", showChProvider = newShowChProvider);
}
bool cPluginDevstatus::SetupParse(const char *Name, const char *Value) {
// Parse your own setup parameters and store their values
if (!strcasecmp(Name, "ShowRecordings")) showRecordings = atoi(Value) % 2;
else if (!strcasecmp(Name, "ShowStrength" )) showStrength = atoi(Value) % 2;
else if (!strcasecmp(Name, "ShowChannels" )) showChannels = atoi(Value) % 2;
else if (!strcasecmp(Name, "ShowChProvider")) showChProvider = atoi(Value) % 2;
else return false;
return true;
}
cMenuSetupPage *cPluginDevstatus::SetupMenu(void) {
// Return a setup menu in case the plugin supports one.
return new cMenuSetupDevstatus;
}
//---
cPluginDevstatus::cPluginDevstatus(void) {
devStatusMonitor = NULL;
}
cPluginDevstatus::~cPluginDevstatus() {
delete devStatusMonitor;
}
bool cPluginDevstatus::ProcessArgs(int argc, char *argv[]) {
// Implement command line argument processing here if applicable.
return true;
}
bool cPluginDevstatus::Initialize(void) {
#if APIVERSNUM < 10507
RegisterI18n(Phrases);
#endif
return true;
}
bool cPluginDevstatus::Start(void) {
devStatusMonitor = new cDevStatusMonitor;
return true;
}
void cPluginDevstatus::Stop(void) {
// Stop any background activities the plugin shall perform.
}
void cPluginDevstatus::Housekeeping(void) {
// Perform any cleanup or other regular tasks.
}
cOsdObject *cPluginDevstatus::MainMenuAction(void) {
return new cMenuDevStatus();
}
bool cPluginDevstatus::Service(const char *Id, void *Data) {
// Handle custom service requests from other plugins
return false;
}
const char **cPluginDevstatus::SVDRPHelpPages(void) {
// Return help text for SVDRP commands this plugin implements
static const char *HelpPages[] = {
"DEVSTAT\n"
" Print all devices",
"RECNUMBER\n"
" Print number of concurrent recordings for all devices.",
NULL
};
return HelpPages;
}
cString cPluginDevstatus::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode) {
// Process SVDRP commands this plugin implements
if(strcasecmp(Command, "DEVSTAT") == 0) {
char* output = NULL;
asprintf(&output, "%s:\n", tr("List of DVB devices"));
for (int i = 0; i < cDevice::NumDevices(); i++) {
cDevice *d = cDevice::GetDevice(i);
char* devName = NULL;
char* devInfo = NULL;
if (d->HasDecoder() || d->IsPrimaryDevice())
asprintf(&devInfo, " (%s%s%s)", d->HasDecoder() ? tr("device with decoder") : "", (d->HasDecoder() && d->IsPrimaryDevice()) ? ", " : "", d->IsPrimaryDevice() ? tr("primary device") : "");
asprintf(&devName, "--- %s %d%s ---", tr("Device"), i+1, devInfo ? devInfo : "");
asprintf(&output, "%s %s:\n", output , devName); // add device output and there info's
free(devName);
if (devInfo)
free(devInfo);
int Count = 0;
for (cRecObj *r = CurrentRecordings.First(); r; r = CurrentRecordings.Next(r)){ // add recordings to the output
if (r && r->device == d){
char* Name = NULL;
if (r->name){
Name = strdup(r->name);
char* itemText = NULL;
asprintf(&itemText, "%s %s", DAYDATETIME(r->timer->StartTime()), Name);
asprintf(&output, "%s %s\n", output , itemText);
free(itemText);
}
Count++;
}
}
if (Count == 0)
asprintf(&output, "%s %s\n", output, tr("currently no recordings"));
if (i < cDevice::NumDevices())
asprintf(&output, "%s\n", output);
}
// we use the default reply code here
// return cString::sprintf("%s", output);
return output;
}
if(strcasecmp(Command, "RECNUMBER") == 0) {
char* output = NULL;
asprintf(&output, "%s:\n", tr("Number of concurrent recordings"));
for (int i = 0; i < cDevice::NumDevices(); i++) {
cDevice *d = cDevice::GetDevice(i);
char* devName = NULL;
asprintf(&devName, "%s %d", tr("Device"), i+1);
asprintf(&output, "%s %s:", output , devName); // add device output and there info's
free(devName);
int Count = 0;
for (cRecObj *r = CurrentRecordings.First(); r; r = CurrentRecordings.Next(r)){ // add recordings to the output
if (r && r->device == d) {
Count++;
}
}
asprintf(&output, "%s %i\n", output, Count);
if (i < cDevice::NumDevices())
asprintf(&output, "%s\n", output);
}
// we use the default reply code here
// return cString::sprintf("%s", output);
return output;
}
return NULL;
}
/*--------*/
#if VDRVERSNUM >= 10338
void cDevStatusMonitor::Recording(const cDevice *Device, const char *Name, const char *FileName, bool On) {
#else
void cDevStatusMonitor::Recording(const cDevice *Device, const char *Name) {
#endif
if (Name) {
// insert new timers currently recording in TimersRecording
#if VDRVERSNUM >= 20301
LOCK_TIMERS_READ;
for (const cTimer *ti = Timers->First(); ti; ti = Timers->Next(ti))
#else
for (cTimer *ti = Timers.First(); ti; ti = Timers.Next(ti))
#endif
if (ti->Recording()) {
// check if this is a new entry
bool bFound = false;
for (cRecObj *r = CurrentRecordings.First(); r; r = CurrentRecordings.Next(r))
if (r->timer == ti)
bFound = true;
if (bFound) continue; // already handled
CurrentRecordings.Add(new cRecObj(Name, Device, ti));
update=1;
return;
}
}
if (!Name) {
// remove timers that finished recording from TimersRecording
for (cRecObj *r = CurrentRecordings.First(); r; r = CurrentRecordings.Next(r)) {
if (!r->timer->Recording()) {
CurrentRecordings.Del(r);
update = 1;
break;
}
}
}
}
void cDevStatusMonitor::ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView) {
if (!ChannelNumber) return;
update=1;
}
VDRPLUGINCREATOR(cPluginDevstatus); // Don't touch this!