From 10a7cf33d67b138a31df0564e3fc9267beafe366 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 7 Oct 2002 16:21:46 +0200 Subject: [PATCH] Added cDevice::DeviceNumber() --- HISTORY | 5 +++++ config.h | 4 ++-- device.c | 11 ++++++++++- device.h | 4 +++- rcu.c | 4 ++-- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/HISTORY b/HISTORY index b9140fee..e68927dc 100644 --- a/HISTORY +++ b/HISTORY @@ -1579,3 +1579,8 @@ Video Disk Recorder Revision History - Updated channels.conf.terr and channels.conf.cable (thanks to Uwe Scheffler). - Fixed a bug when pressing the "Blue" button in the main menu without having displayed it (thanks to Oliver Endriss for reporting this one). + +2002-10-06: Version 1.1.13 + +- Added cDevice::DeviceNumber() to get the number of a device, not counting any + gaps that might be in the index count. diff --git a/config.h b/config.h index 2da1420b..83ef9c00 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.131 2002/10/05 09:58:58 kls Exp $ + * $Id: config.h 1.132 2002/10/06 16:03:01 kls Exp $ */ #ifndef __CONFIG_H @@ -20,7 +20,7 @@ #include "eit.h" #include "tools.h" -#define VDRVERSION "1.1.12" +#define VDRVERSION "1.1.13" #define MAXPRIORITY 99 #define MAXLIFETIME 99 diff --git a/device.c b/device.c index 473b178e..3c94fa2e 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 1.25 2002/10/06 13:49:38 kls Exp $ + * $Id: device.c 1.26 2002/10/07 16:21:46 kls Exp $ */ #include "device.h" @@ -87,6 +87,15 @@ int cDevice::NextCardIndex(int n) return nextCardIndex; } +int cDevice::DeviceNumber(void) const +{ + for (int i = 0; i < numDevices; i++) { + if (device[i] == this) + return i; + } + return -1; +} + void cDevice::MakePrimaryDevice(bool On) { } diff --git a/device.h b/device.h index 9dcf16ce..6d79bce4 100644 --- a/device.h +++ b/device.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.h 1.21 2002/10/05 15:18:13 kls Exp $ + * $Id: device.h 1.22 2002/10/06 15:59:08 kls Exp $ */ #ifndef __DEVICE_H @@ -111,6 +111,8 @@ public: bool IsPrimaryDevice(void) const { return this == primaryDevice; } int CardIndex(void) const { return cardIndex; } // Returns the card index of this device (0 ... MAXDEVICES - 1). + int DeviceNumber(void) const; + // Returns number of this device (0 ... MAXDEVICES - 1). int ProvidesCa(int Ca) const; // Checks whether this device provides the given value in its // caCaps. Returns 0 if the value is not provided, 1 if only this diff --git a/rcu.c b/rcu.c index 6b7c4f97..6345bea7 100644 --- a/rcu.c +++ b/rcu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: rcu.c 1.1 2002/09/29 13:16:44 kls Exp $ + * $Id: rcu.c 1.2 2002/10/06 15:49:03 kls Exp $ */ #include "rcu.h" @@ -308,5 +308,5 @@ void cRcuRemote::ChannelSwitch(const cDevice *Device, int ChannelNumber) void cRcuRemote::Recording(const cDevice *Device, const char *Name) { - SetPoints(1 << Device->CardIndex(), Device->Receiving()); //XXX CardNumber()!!! + SetPoints(1 << Device->DeviceNumber(), Device->Receiving()); }