The new function cDevice::DeviceType() returns a string identifying the type of the given device

This commit is contained in:
Klaus Schmidinger 2012-04-04 09:52:15 +02:00
parent 0ac4d23cab
commit d5aa5f7294
5 changed files with 35 additions and 7 deletions

View File

@ -7052,8 +7052,10 @@ Video Disk Recorder Revision History
- Fixed handling IDLEPRIORITY in cDvbDevice::ProvidesChannel() (thanks to Frank
Schmirler).
2012-04-01: Version 1.7.28
2012-04-04: Version 1.7.28
- Fixed cPixmapMemory::DrawEllipse() for quadrants -1 and -4.
- Fixed getting the maximum short channel name length in case there are no short names
at all (reported by Derek Kelly).
- The new function cDevice::DeviceType() returns a string identifying the type of
the given device.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: device.c 2.58 2012/03/13 09:48:14 kls Exp $
* $Id: device.c 2.59 2012/04/04 09:48:00 kls Exp $
*/
#include "device.h"
@ -162,6 +162,11 @@ int cDevice::DeviceNumber(void) const
return -1;
}
cString cDevice::DeviceType(void) const
{
return "";
}
cString cDevice::DeviceName(void) const
{
return "";

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: device.h 2.38 2012/03/13 10:17:16 kls Exp $
* $Id: device.h 2.39 2012/04/04 09:48:21 kls Exp $
*/
#ifndef __DEVICE_H
@ -201,6 +201,12 @@ public:
///< Returns the card index of this device (0 ... MAXDEVICES - 1).
int DeviceNumber(void) const;
///< Returns the number of this device (0 ... numDevices).
virtual cString DeviceType(void) const;
///< Returns a string identifying the type of this device (like "DVB-S").
///< If this device can receive different delivery systems, the returned
///< string shall be that of the currently used system.
///< The length of the returned string should not exceed 6 characters.
///< The default implementation returns an empty string.
virtual cString DeviceName(void) const;
///< Returns a string identifying the name of this device.
///< The default implementation returns an empty string.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbdevice.c 2.69 2012/03/25 10:41:45 kls Exp $
* $Id: dvbdevice.c 2.70 2012/04/04 09:49:12 kls Exp $
*/
#include "dvbdevice.h"
@ -285,6 +285,7 @@ class cDvbTuner : public cThread {
private:
static cMutex bondMutex;
enum eTunerStatus { tsIdle, tsSet, tsTuned, tsLocked };
int frontendType;
const cDvbDevice *device;
int fd_frontend;
int adapter, frontend;
@ -314,6 +315,7 @@ private:
public:
cDvbTuner(const cDvbDevice *Device, int Fd_Frontend, int Adapter, int Frontend);
virtual ~cDvbTuner();
int FrontendType(void) const { return frontendType; }
bool Bond(cDvbTuner *Tuner);
void UnBond(void);
bool BondingOk(const cChannel *Channel, bool ConsiderOccupied = false) const;
@ -331,6 +333,7 @@ cMutex cDvbTuner::bondMutex;
cDvbTuner::cDvbTuner(const cDvbDevice *Device, int Fd_Frontend, int Adapter, int Frontend)
{
frontendType = SYS_UNDEFINED;
device = Device;
fd_frontend = Fd_Frontend;
adapter = Adapter;
@ -733,7 +736,7 @@ bool cDvbTuner::SetFrontend(void)
cDvbTransponderParameters dtp(channel.Parameters());
// Determine the required frontend type:
int frontendType = GetRequiredDeliverySystem(&channel, &dtp);
frontendType = GetRequiredDeliverySystem(&channel, &dtp);
if (frontendType == SYS_UNDEFINED)
return false;
@ -977,7 +980,7 @@ int cDvbDevice::setTransferModeForDolbyDigital = 1;
cMutex cDvbDevice::bondMutex;
const char *DeliverySystemNames[] = {
"UNDEFINED",
"",
"DVB-C",
"DVB-C",
"DVB-T",
@ -1090,6 +1093,17 @@ bool cDvbDevice::Probe(int Adapter, int Frontend)
return true;
}
cString cDvbDevice::DeviceType(void) const
{
if (dvbTuner) {
if (dvbTuner->FrontendType() != SYS_UNDEFINED)
return DeliverySystemNames[dvbTuner->FrontendType()];
if (numDeliverySystems)
return DeliverySystemNames[deliverySystems[0]]; // to have some reasonable default
}
return "";
}
cString cDvbDevice::DeviceName(void) const
{
return frontendInfo.name;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbdevice.h 2.25 2012/03/13 10:11:15 kls Exp $
* $Id: dvbdevice.h 2.26 2012/04/04 09:48:00 kls Exp $
*/
#ifndef __DVBDEVICE_H
@ -138,6 +138,7 @@ public:
int Adapter(void) const { return adapter; }
int Frontend(void) const { return frontend; }
virtual bool Ready(void);
virtual cString DeviceType(void) const;
virtual cString DeviceName(void) const;
static bool BondDevices(const char *Bondings);
///< Bonds the devices as defined in the given Bondings string.