14 #include <linux/dvb/dmx.h>
15 #include <linux/dvb/frontend.h>
16 #include <sys/ioctl.h>
26 #define DVBS_TUNE_TIMEOUT 9000 //ms
27 #define DVBS_LOCK_TIMEOUT 2000 //ms
28 #define DVBC_TUNE_TIMEOUT 9000 //ms
29 #define DVBC_LOCK_TIMEOUT 2000 //ms
30 #define DVBT_TUNE_TIMEOUT 9000 //ms
31 #define DVBT_LOCK_TIMEOUT 2000 //ms
32 #define ATSC_TUNE_TIMEOUT 9000 //ms
33 #define ATSC_LOCK_TIMEOUT 2000 //ms
35 #define SCR_RANDOM_TIMEOUT 500 // ms (add random value up to this when tuning SCR device to avoid lockups)
40 { 0, PILOT_OFF,
trNOOP(
"off") },
41 { 1, PILOT_ON,
trNOOP(
"on") },
42 { 999, PILOT_AUTO,
trNOOP(
"auto") },
47 { 0, INVERSION_OFF,
trNOOP(
"off") },
48 { 1, INVERSION_ON,
trNOOP(
"on") },
49 { 999, INVERSION_AUTO,
trNOOP(
"auto") },
54 { 5, 5000000,
"5 MHz" },
55 { 6, 6000000,
"6 MHz" },
56 { 7, 7000000,
"7 MHz" },
57 { 8, 8000000,
"8 MHz" },
58 { 10, 10000000,
"10 MHz" },
59 { 1712, 1712000,
"1.712 MHz" },
64 { 0, FEC_NONE,
trNOOP(
"none") },
65 { 12, FEC_1_2,
"1/2" },
66 { 23, FEC_2_3,
"2/3" },
67 { 34, FEC_3_4,
"3/4" },
68 { 35, FEC_3_5,
"3/5" },
69 { 45, FEC_4_5,
"4/5" },
70 { 56, FEC_5_6,
"5/6" },
71 { 67, FEC_6_7,
"6/7" },
72 { 78, FEC_7_8,
"7/8" },
73 { 89, FEC_8_9,
"8/9" },
74 { 910, FEC_9_10,
"9/10" },
75 { 999, FEC_AUTO,
trNOOP(
"auto") },
80 { 16, QAM_16,
"QAM16" },
81 { 32, QAM_32,
"QAM32" },
82 { 64, QAM_64,
"QAM64" },
83 { 128, QAM_128,
"QAM128" },
84 { 256, QAM_256,
"QAM256" },
87 { 6, APSK_16,
"16APSK" },
88 { 7, APSK_32,
"32APSK" },
89 { 10, VSB_8,
"VSB8" },
90 { 11, VSB_16,
"VSB16" },
91 { 12, DQPSK,
"DQPSK" },
92 { 999, QAM_AUTO,
trNOOP(
"auto") },
96 #define DVB_SYSTEM_1 0 // see also nit.c
97 #define DVB_SYSTEM_2 1
113 { 2, TRANSMISSION_MODE_2K,
"2K" },
115 { 8, TRANSMISSION_MODE_8K,
"8K" },
118 { 999, TRANSMISSION_MODE_AUTO,
trNOOP(
"auto") },
123 { 4, GUARD_INTERVAL_1_4,
"1/4" },
124 { 8, GUARD_INTERVAL_1_8,
"1/8" },
125 { 16, GUARD_INTERVAL_1_16,
"1/16" },
126 { 32, GUARD_INTERVAL_1_32,
"1/32" },
130 { 999, GUARD_INTERVAL_AUTO,
trNOOP(
"auto") },
135 { 0, HIERARCHY_NONE,
trNOOP(
"none") },
136 { 1, HIERARCHY_1,
"1" },
137 { 2, HIERARCHY_2,
"2" },
138 { 4, HIERARCHY_4,
"4" },
139 { 999, HIERARCHY_AUTO,
trNOOP(
"auto") },
144 { 0, ROLLOFF_AUTO,
trNOOP(
"auto") },
145 { 20, ROLLOFF_20,
"0.20" },
146 { 25, ROLLOFF_25,
"0.25" },
147 { 35, ROLLOFF_35,
"0.35" },
178 *String =
tr(Map[n].userString);
212 guard = GUARD_INTERVAL_AUTO;
224 return Value >= 0 && Value != 999 ? sprintf(p,
"%c%d", Name, Value) : 0;
229 #define ST(s) if (strchr(s, Type) && (strchr(s, '0' + system + 1) || strchr(s, '*')))
256 int n = strtol(s, &p, 10);
257 if (!errno && p != s) {
263 esyslog(
"ERROR: invalid value for parameter '%c'", *(s - 1));
270 switch (toupper(*s)) {
289 default:
esyslog(
"ERROR: unknown parameter key '%c'", *s);
298 #define TUNER_POLL_TIMEOUT 10 // ms
335 virtual void Action(
void);
351 bool Locked(
int TimeoutMs = 0);
424 while (t->bondedTuner !=
this)
427 t->bondedTuner = NULL;
442 return diseqc->Commands();
446 bool VoltOff = dtp.Polarization() ==
'V' || dtp.Polarization() ==
'R';
458 if (t->device->Priority() >
IDLEPRIORITY || ConsiderOccupied && t->device->Occupied()) {
459 if (strcmp(BondingParams, t->GetBondedMaster()->GetBondingParams()) != 0)
505 if (BondedMaster ==
this) {
535 if (isLocked || !TimeoutMs)
550 dvb_frontend_event Event;
551 while (ioctl(
fd_frontend, FE_GET_EVENT, &Event) == 0)
560 if (ioctl(
fd_frontend, FE_READ_STATUS, &Status) != -1)
576 if (ioctl(
fd_frontend, FE_READ_SIGNAL_STRENGTH, &Signal) != -1)
581 uint16_t MaxSignal = 0xFFFF;
587 MaxSignal = 670;
break;
589 int s = int(Signal) * 100 / MaxSignal;
592 #ifdef DEBUG_SIGNALSTRENGTH
598 #define LOCK_THRESHOLD 5 // indicates that all 5 FE_HAS_* flags are set
605 if ((Status & FE_HAS_LOCK) == 0) {
606 if ((Status & FE_HAS_SIGNAL) == 0)
608 if ((Status & FE_HAS_CARRIER) == 0)
610 if ((Status & FE_HAS_VITERBI) == 0)
612 if ((Status & FE_HAS_SYNC) == 0)
616 #ifdef DEBUG_SIGNALQUALITY
623 if (errno != EINTR) {
625 #ifdef DEBUG_SIGNALQUALITY
631 #ifdef DEBUG_SIGNALQUALITY
638 if (errno != EINTR) {
640 #ifdef DEBUG_SIGNALQUALITY
646 #ifdef DEBUG_SIGNALQUALITY
651 if (ioctl(
fd_frontend, FE_READ_UNCORRECTED_BLOCKS, &Unc) != -1)
653 if (errno != EINTR) {
655 #ifdef DEBUG_SIGNALQUALITY
661 uint16_t MinSnr = 0x0000;
662 uint16_t MaxSnr = 0xFFFF;
679 int a = int(
constrain(Snr, MinSnr, MaxSnr)) * 100 / (MaxSnr - MinSnr);
680 int b = 100 - (Unc * 10 + (Ber / 256) * 5);
686 #ifdef DEBUG_SIGNALQUALITY
687 fprintf(stderr,
"FE %d/%d: %08X Q = %04X %04X %d %5d %5d %3d%%\n",
adapter,
frontend,
subsystemId, MaxSnr, Snr, HasSnr, HasBer ?
int(Ber) : -1, HasUnc ?
int(Unc) : -1, q);
696 while (f && f < 1000000)
719 struct dvb_diseqc_master_cmd cmd;
720 const char *CurrentAction = NULL;
723 for (
int i = 0; !Break; i++) {
724 cmd.msg_len =
sizeof(cmd.msg);
755 default:
esyslog(
"ERROR: unknown diseqc command %d", da);
775 int ds = SYS_UNDEFINED;
779 ds = SYS_DVBC_ANNEX_AC;
780 else if (Channel->
IsSat())
782 else if (Channel->
IsTerr())
785 esyslog(
"ERROR: can't determine frontend type for channel %d (%s)", Channel->
Number(), Channel->
Name());
793 #define MAXFRONTENDCMDS 16
794 #define SETCMD(c, d) { Frontend[CmdSeq.num].cmd = (c);\
795 Frontend[CmdSeq.num].u.data = (d);\
796 if (CmdSeq.num++ > MAXFRONTENDCMDS) {\
797 esyslog("ERROR: too many tuning commands on frontend %d/%d", adapter, frontend);\
802 memset(&Frontend, 0,
sizeof(Frontend));
803 dtv_properties CmdSeq;
804 memset(&CmdSeq, 0,
sizeof(CmdSeq));
805 CmdSeq.props = Frontend;
807 if (ioctl(
fd_frontend, FE_SET_PROPERTY, &CmdSeq) < 0) {
817 if (frontendType == SYS_UNDEFINED)
820 SETCMD(DTV_DELIVERY_SYSTEM, frontendType);
821 if (frontendType == SYS_DVBS || frontendType == SYS_DVBS2) {
825 frequency -= diseqc->Lof();
844 int tone = SEC_TONE_OFF;
853 int volt = (dtp.Polarization() ==
'V' || dtp.Polarization() ==
'R') ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18;
856 volt = SEC_VOLTAGE_13;
861 frequency = abs(frequency);
864 SETCMD(DTV_FREQUENCY, frequency * 1000UL);
865 SETCMD(DTV_MODULATION, dtp.Modulation());
867 SETCMD(DTV_INNER_FEC, dtp.CoderateH());
868 SETCMD(DTV_INVERSION, dtp.Inversion());
869 if (frontendType == SYS_DVBS2) {
871 SETCMD(DTV_PILOT, dtp.Pilot());
872 SETCMD(DTV_ROLLOFF, dtp.RollOff());
878 SETCMD(DTV_ROLLOFF, ROLLOFF_35);
884 else if (frontendType == SYS_DVBC_ANNEX_AC || frontendType == SYS_DVBC_ANNEX_B) {
887 SETCMD(DTV_INVERSION, dtp.Inversion());
889 SETCMD(DTV_INNER_FEC, dtp.CoderateH());
890 SETCMD(DTV_MODULATION, dtp.Modulation());
895 else if (frontendType == SYS_DVBT || frontendType ==
SYS_DVBT2) {
898 SETCMD(DTV_INVERSION, dtp.Inversion());
899 SETCMD(DTV_BANDWIDTH_HZ, dtp.Bandwidth());
900 SETCMD(DTV_CODE_RATE_HP, dtp.CoderateH());
901 SETCMD(DTV_CODE_RATE_LP, dtp.CoderateL());
902 SETCMD(DTV_MODULATION, dtp.Modulation());
903 SETCMD(DTV_TRANSMISSION_MODE, dtp.Transmission());
904 SETCMD(DTV_GUARD_INTERVAL, dtp.Guard());
905 SETCMD(DTV_HIERARCHY, dtp.Hierarchy());
918 else if (frontendType == SYS_ATSC) {
921 SETCMD(DTV_INVERSION, dtp.Inversion());
922 SETCMD(DTV_MODULATION, dtp.Modulation());
928 esyslog(
"ERROR: attempt to set channel with unknown DVB frontend type");
932 if (ioctl(
fd_frontend, FE_SET_PROPERTY, &CmdSeq) < 0) {
942 bool LostLock =
false;
943 fe_status_t Status = (fe_status_t)0;
946 fe_status_t NewStatus;
987 if (Status & FE_REINIT) {
995 else if (Status & FE_HAS_LOCK) {
1091 #define ST(s) if (strchr(s, type))
1109 default:
return NULL;
1170 if (fd_frontend >= 0) {
1198 int fd = open(FileName, Mode);
1199 if (fd < 0 && ReportError)
1207 if (access(FileName, F_OK) == 0) {
1208 int f = open(FileName, O_RDONLY);
1213 else if (errno != ENODEV && errno != EINVAL)
1216 else if (errno != ENOENT)
1224 dsyslog(
"probing %s", *FileName);
1226 if (dp->Probe(Adapter, Frontend))
1229 dsyslog(
"creating cDvbDevice");
1260 while ((a = DvbDir.
Next()) != NULL) {
1264 if (AdapterDir.
Ok()) {
1266 while ((f = AdapterDir.
Next()) != NULL) {
1278 if (Nodes.
Size() > 0) {
1280 for (
int i = 0; i < Nodes.
Size(); i++) {
1283 if (2 == sscanf(Nodes[i],
"%d %d", &Adapter, &Frontend)) {
1284 if (
Exists(Adapter, Frontend)) {
1288 if (
Probe(Adapter, Frontend))
1299 isyslog(
"found %d DVB device%s", Found, Found > 1 ?
"s" :
"");
1301 isyslog(
"using only %d DVB device%s", Used, Used > 1 ?
"s" :
"");
1304 isyslog(
"no DVB device found");
1311 if (ioctl(fd_frontend, FE_GET_INFO, &
frontendInfo) < 0) {
1316 dtv_properties CmdSeq;
1319 memset(&Frontend, 0,
sizeof(Frontend));
1320 memset(&CmdSeq, 0,
sizeof(CmdSeq));
1322 SETCMD(DTV_API_VERSION, 0);
1323 if (ioctl(fd_frontend, FE_GET_PROPERTY, &CmdSeq) != 0) {
1331 bool LegacyMode =
true;
1333 memset(&Frontend, 0,
sizeof(Frontend));
1334 memset(&CmdSeq, 0,
sizeof(CmdSeq));
1337 int Result = ioctl(fd_frontend, FE_GET_PROPERTY, &CmdSeq);
1339 for (uint i = 0; i < Frontend[0].u.buffer.len; i++) {
1349 esyslog(
"ERROR: can't query delivery systems on frontend %d/%d - falling back to legacy mode",
adapter,
frontend);
1383 ms =
"unknown modulations";
1400 int ErrorDevice = 0;
1402 if (Device1->HasSubDevice())
1403 Device1 = Device1->SubDevice();
1405 if (Device2->HasSubDevice())
1406 Device2 = Device2->SubDevice();
1407 if (
cDvbDevice *DvbDevice1 = dynamic_cast<cDvbDevice *>(Device1)) {
1408 if (
cDvbDevice *DvbDevice2 = dynamic_cast<cDvbDevice *>(Device2)) {
1409 if (!DvbDevice1->Bond(DvbDevice2))
1413 ErrorDevice = d + 1;
1416 ErrorDevice = i + 1;
1418 esyslog(
"ERROR: device '%d' in device bondings '%s' is not a cDvbDevice", ErrorDevice, Bondings);
1423 ErrorDevice = d + 1;
1426 ErrorDevice = i + 1;
1428 esyslog(
"ERROR: unknown device '%d' in device bondings '%s'", ErrorDevice, Bondings);
1443 if (
cDvbDevice *d = dynamic_cast<cDvbDevice *>(dev))
1452 if (Device !=
this) {
1462 esyslog(
"ERROR: can't bond device %d with device %d (only DVB-S(2) devices can be bonded)",
CardIndex() + 1, Device->
CardIndex() + 1);
1479 while (d->bondedDevice !=
this)
1480 d = d->bondedDevice;
1482 d->bondedDevice = NULL;
1525 dmx_pes_filter_params pesFilterParams;
1526 memset(&pesFilterParams, 0,
sizeof(pesFilterParams));
1528 if (Handle->
handle < 0) {
1530 if (Handle->
handle < 0) {
1535 pesFilterParams.pid = Handle->
pid;
1536 pesFilterParams.input = DMX_IN_FRONTEND;
1537 pesFilterParams.output = DMX_OUT_TS_TAP;
1538 pesFilterParams.pes_type= DMX_PES_OTHER;
1539 pesFilterParams.flags = DMX_IMMEDIATE_START;
1540 if (ioctl(Handle->
handle, DMX_SET_PES_FILTER, &pesFilterParams) < 0) {
1545 else if (!Handle->
used) {
1548 pesFilterParams.pid = 0x1FFF;
1549 pesFilterParams.input = DMX_IN_FRONTEND;
1550 pesFilterParams.output = DMX_OUT_DECODER;
1551 pesFilterParams.pes_type= DMX_PES_OTHER;
1552 pesFilterParams.flags = DMX_IMMEDIATE_START;
1553 CHECK(ioctl(Handle->
handle, DMX_SET_PES_FILTER, &pesFilterParams));
1565 int f = open(FileName, O_RDWR | O_NONBLOCK);
1567 dmx_sct_filter_params sctFilterParams;
1568 memset(&sctFilterParams, 0,
sizeof(sctFilterParams));
1569 sctFilterParams.pid = Pid;
1570 sctFilterParams.timeout = 0;
1571 sctFilterParams.flags = DMX_IMMEDIATE_START;
1572 sctFilterParams.filter.filter[0] = Tid;
1573 sctFilterParams.filter.mask[0] = Mask;
1574 if (ioctl(f, DMX_SET_FILTER, &sctFilterParams) >= 0)
1577 esyslog(
"ERROR: can't set filter (pid=%d, tid=%02X, mask=%02X): %m", Pid, Tid, Mask);
1582 esyslog(
"ERROR: can't open filter handle on '%s'", *FileName);
1617 dtp.Modulation() == QPSK && !(
frontendInfo.caps & FE_CAN_QPSK) ||
1618 dtp.Modulation() == QAM_16 && !(
frontendInfo.caps & FE_CAN_QAM_16) ||
1619 dtp.Modulation() == QAM_32 && !(
frontendInfo.caps & FE_CAN_QAM_32) ||
1620 dtp.Modulation() == QAM_64 && !(
frontendInfo.caps & FE_CAN_QAM_64) ||
1621 dtp.Modulation() == QAM_128 && !(
frontendInfo.caps & FE_CAN_QAM_128) ||
1622 dtp.Modulation() == QAM_256 && !(
frontendInfo.caps & FE_CAN_QAM_256) ||
1623 dtp.Modulation() == QAM_AUTO && !(
frontendInfo.caps & FE_CAN_QAM_AUTO) ||
1624 dtp.Modulation() == VSB_8 && !(
frontendInfo.caps & FE_CAN_8VSB) ||
1625 dtp.Modulation() == VSB_16 && !(
frontendInfo.caps & FE_CAN_16VSB) ||
1636 bool result =
false;
1638 bool needsDetachReceivers =
false;
1642 result = hasPriority;
1651 needsDetachReceivers =
true;
1671 needsDetachReceivers |= d->Receiving();
1679 if (NeedsDetachReceivers)
1680 *NeedsDetachReceivers = needsDetachReceivers;
1764 if (cs->WantsTsData()) {
1768 Data = cs->Decrypt(Data, Available);
1785 d->cDevice::DetachAllReceivers();
1797 DvbDeviceProbes.
Add(
this);
1802 DvbDeviceProbes.
Del(
this,
false);
1807 uint32_t SubsystemId = 0;
1810 if (stat(FileName, &st) == 0) {
1814 while ((e = d.
Next()) != NULL) {
1815 if (strstr(e->d_name,
"frontend")) {
1817 if (FILE *f = fopen(FileName,
"r")) {
1819 char *s = ReadLine.
Read(f);
1823 if (s && 2 == sscanf(s,
"%u:%u", &Major, &Minor)) {
1824 if (((Major << 8) | Minor) == st.st_rdev) {
1825 FileName =
cString::sprintf(
"/sys/class/dvb/%s/device/subsystem_vendor", e->d_name);
1826 if ((f = fopen(FileName,
"r")) != NULL) {
1827 if (
char *s = ReadLine.
Read(f))
1828 SubsystemId = strtoul(s, NULL, 0) << 16;
1832 FileName =
cString::sprintf(
"/sys/class/dvb/%s/device/idVendor", e->d_name);
1833 if ((f = fopen(FileName,
"r")) != NULL) {
1834 if (
char *s = ReadLine.
Read(f))
1835 SubsystemId = strtoul(s, NULL, 16) << 16;
1839 FileName =
cString::sprintf(
"/sys/class/dvb/%s/device/subsystem_device", e->d_name);
1840 if ((f = fopen(FileName,
"r")) != NULL) {
1841 if (
char *s = ReadLine.
Read(f))
1842 SubsystemId |= strtoul(s, NULL, 0);
1846 FileName =
cString::sprintf(
"/sys/class/dvb/%s/device/idProduct", e->d_name);
1847 if ((f = fopen(FileName,
"r")) != NULL) {
1848 if (
char *s = ReadLine.
Read(f))
1849 SubsystemId |= strtoul(s, NULL, 16);
static unsigned int FrequencyToHz(unsigned int f)
struct dirent * Next(void)
virtual ~cDvbDeviceProbe()
static bool UseDevice(int n)
Tells whether the device with the given card index shall be used in this instance of VDR...
const char * DeliverySystemNames[]
cDvbTransponderParameters(const char *Parameters=NULL)
virtual bool ProvidesSource(int Source) const
Returns true if this device can provide the given source.
int PrintParameter(char *p, char Name, int Value) const
virtual cString DeviceType(void) const
Returns a string identifying the type of this device (like "DVB-S").
bool IsBondedMaster(void) const
uchar * Get(int *Available=NULL)
Returns a pointer to the first TS packet in the buffer.
virtual bool SetIdle(bool Idle, bool TestOnly)
static bool Exists(int Adapter, int Frontend)
Checks whether the given adapter/frontend exists.
bool IsScr(void) const
Returns true if this DiSEqC sequence uses Satellite Channel Routing.
void ResetToneAndVoltage(void)
#define SCR_RANDOM_TIMEOUT
bool Receiving(bool Dummy=false) const
Returns true if we are currently receiving. The parameter has no meaning (for backwards compatibility...
const char * ParseParameter(const char *s, int &Value, const tDvbParameterMap *Map=NULL)
virtual bool IsTunedToTransponder(const cChannel *Channel) const
Returns true if this device is currently tuned to the given Channel's transponder.
int Position(void) const
Indicates which positioning mode to use in order to move the dish to a given satellite position...
static bool Initialize(void)
Initializes the DVB devices.
void SetDescription(const char *Description,...) __attribute__((format(printf
virtual bool GetTSPacket(uchar *&Data)
Gets exactly one TS packet from the DVR of this device and returns a pointer to it in Data...
#define DVBT_TUNE_TIMEOUT
int UserIndex(int Value, const tDvbParameterMap *Map)
void Add(cListObject *Object, cListObject *After=NULL)
virtual const cPositioner * Positioner(void) const
Returns a pointer to the positioner (if any) this device has used to move the satellite dish to the r...
void UnBond(void)
Removes this device from any bonding it might have with other devices.
cTSBuffer * tsBuffer
< Controls how the DVB device handles Transfer Mode when replaying Dolby Digital audio.
#define DVBC_TUNE_TIMEOUT
int Ca(int Index=0) const
void ClearEventQueue(void) const
bool DeviceHooksProvidesTransponder(const cChannel *Channel) const
virtual int SignalQuality(void) const
Returns the "quality" of the currently received signal.
virtual cOsdItem * GetOsdItem(void)
Returns all the OSD items necessary for editing the source specific parameters of the channel that wa...
#define DVBS_LOCK_TIMEOUT
virtual void GotoPosition(uint Number, int Longitude)
Move the dish to the satellite position stored under the given Number.
void ExecuteDiseqc(const cDiseqc *Diseqc, unsigned int *Frequency)
static cString sprintf(const char *fmt,...) __attribute__((format(printf
#define DVBC_LOCK_TIMEOUT
const tDvbParameterMap SystemValuesSat[]
virtual void Append(T Data)
void SetFrontend(int Frontend)
This function is called whenever the positioner is connected to a DVB frontend.
#define DVBT_LOCK_TIMEOUT
static uint32_t GetSubsystemId(int Adapter, int Frontend)
const tDvbParameterMap InversionValues[]
bool Parse(const char *s)
static cDevice * GetDevice(int Index)
Gets the device with the given Index.
virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView)
Sets the device to the given channel (actual physical setup).
eDiseqcActions Execute(const char **CurrentAction, uchar *Codes, uint8_t *MaxCodes, const cScr *Scr, uint *Frequency) const
Parses the DiSEqC commands and returns the appropriate action code with every call.
static int NumDevices(void)
Returns the total number of devices.
bool IsTunedTo(const cChannel *Channel) const
#define TUNER_POLL_TIMEOUT
void DelLivePids(void)
Deletes the live viewing PIDs.
int GetSignalStrength(void) const
int Transponder(void) const
Returns the transponder frequency in MHz, plus the polarization in case of sat.
cDvbTuner * GetBondedMaster(void)
cString ToString(char Type) const
bool Poll(int TimeoutMs=0)
int MapToDriver(int Value, const tDvbParameterMap *Map)
bool QueryDeliverySystems(int fd_frontend)
cPositioner * GetPositioner(void)
const char * Parameters(void) const
bool needsDetachBondedReceivers
static int NextCardIndex(int n=0)
Calculates the next card index.
bool SetTransponderData(int Source, int Frequency, int Srate, const char *Parameters, bool Quiet=false)
static cPositioner * GetPositioner(void)
Returns a previously created positioner.
bool IsPrimaryDevice(void) const
A steerable satellite dish generally points to the south on the northern hemisphere, and to the north on the southern hemisphere (unless you're located directly on the equator, in which case the general direction is "up").
virtual void GotoAngle(int Longitude)
Move the dish to the given angular position.
cCamSlot * CamSlot(void) const
Returns the CAM slot that is currently used with this device, or NULL if no CAM slot is in use...
virtual bool MaySwitchTransponder(const cChannel *Channel) const
Returns true if it is ok to switch to the Channel's transponder on this device, without disturbing an...
cDvbDevice(int Adapter, int Frontend, cDevice *ParentDevice=NULL)
const tDvbParameterMap HierarchyValues[]
const char * Name(void) const
void StartSectionHandler(void)
A derived device that provides section data must call this function (typically in its constructor) to...
static bool BondDevices(const char *Bondings)
Bonds the devices as defined in the given Bondings string.
static bool Probe(int Adapter, int Frontend)
Probes for existing DVB devices.
virtual bool SetPid(cPidHandle *Handle, int Type, bool On)
Does the actual PID setting on this device.
uint32_t SubsystemId(void) const
void StopSectionHandler(void)
A device that has called StartSectionHandler() must call this function (typically in its destructor) ...
#define MAXDELIVERYSYSTEMS
virtual bool CanDecrypt(const cChannel *Channel)
Returns true if there is a CAM in this slot that is able to decrypt the given Channel (or at least cl...
virtual void SetData(cChannel *Channel)
Sets all source specific parameters to those of the given Channel.
cDvbDevice * bondedDevice
cDvbSourceParam(char Source, const char *Description)
int MapToUser(int Value, const tDvbParameterMap *Map, const char **String)
bool TimedOut(void) const
virtual bool IsMoving(void) const
Returns true if the dish is currently moving as a result of a call to GotoPosition() or GotoAngle()...
cList< cDvbDeviceProbe > DvbDeviceProbes
virtual cString DeviceName(void) const
Returns a string identifying the name of this device.
void bool Start(void)
Sets the description of this thread, which will be used when logging starting or stopping of the thre...
virtual void CloseDvr(void)
Shuts down the DVR.
#define DVBS_TUNE_TIMEOUT
virtual void CloseFilter(int Handle)
Closes a file handle that has previously been opened by OpenFilter().
static bool IsSat(int Code)
bool HasSubDevice(void) const
int DriverIndex(int Value, const tDvbParameterMap *Map)
#define ATSC_LOCK_TIMEOUT
bool OpenFrontend(void) const
const tDvbParameterMap ModulationValues[]
bool Running(void)
Returns false if a derived cThread object shall leave its Action() function.
int deliverySystems[MAXDELIVERYSYSTEMS]
bool TimedWait(cMutex &Mutex, int TimeoutMs)
bool Locked(int TimeoutMs=0)
static cDvbCiAdapter * CreateCiAdapter(cDevice *Device, int Fd, int Adapter=-1, int Frontend=-1)
int Frequency(void) const
Returns the actual frequency, as given in 'channels.conf'.
void Skip(int Count)
If after a call to Get() more or less than TS_SIZE of the available data has been processed...
virtual bool OpenDvr(void)
Opens the DVR of this device and prepares it to deliver a Transport Stream for use in a cReceiver...
int GetSignalQuality(void) const
bool Bond(cDvbTuner *Tuner)
virtual void DetachAllReceivers(void)
Detaches all receivers from this device.
static void UnBondDevices(void)
Unbonds all devices.
const char * MapToUserString(int Value, const tDvbParameterMap *Map)
virtual const cChannel * GetCurrentlyTunedTransponder(void) const
Returns a pointer to the currently tuned transponder.
virtual bool HasCi(void)
Returns true if this device has a Common Interface.
int CardIndex(void) const
Returns the card index of this device (0 ... MAXDEVICES - 1).
const tDvbParameterMap PilotValues[]
int Priority(void) const
Returns the priority of the current receiving session (-MAXPRIORITY..MAXPRIORITY), or IDLEPRIORITY if no receiver is currently active.
virtual bool HasLock(int TimeoutMs=0) const
Returns true if the device has a lock on the requested transponder.
virtual int NumProvidedSystems(void) const
Returns the number of individual "delivery systems" this device provides.
dvb_frontend_info frontendInfo
int FrontendType(void) const
virtual bool IsIdle(void) const
const cDiseqc * lastDiseqc
static int GetRequiredDeliverySystem(const cChannel *Channel, const cDvbTransponderParameters *Dtp)
void Del(cListObject *Object, bool DeleteObject=true)
cDvbTuner(const cDvbDevice *Device, int Fd_Frontend, int Adapter, int Frontend)
int FirstDeviceIndex(int DeviceIndex) const
Returns the first device index (starting at 0) that uses the same sat cable number as the device with...
virtual bool ProvidesDeliverySystem(int DeliverySystem) const
const tDvbParameterMap RollOffValues[]
static cDevice * PrimaryDevice(void)
Returns the primary device.
static int setTransferModeForDolbyDigital
const tDvbParameterMap CoderateValues[]
bool IsSubDevice(void) const
bool Bond(cDvbDevice *Device)
Bonds this device with the given Device, making both of them use the same satellite cable and LNB...
const cPositioner * Positioner(void) const
const cChannel * GetTransponder(void) const
virtual bool ProvidesTransponder(const cChannel *Channel) const
Returns true if this device can provide the transponder of the given Channel (which implies that it c...
const cDiseqc * Get(int Device, int Source, int Frequency, char Polarization, const cScr **Scr) const
Selects a DiSEqC entry suitable for the given Device and tuning parameters.
virtual bool ProvidesChannel(const cChannel *Channel, int Priority=IDLEPRIORITY, bool *NeedsDetachReceivers=NULL) const
Returns true if this device can provide the given channel.
void Sort(bool IgnoreCase=false)
bool BondingOk(const cChannel *Channel, bool ConsiderOccupied=false) const
The cDvbDevice implements a DVB device which can be accessed through the Linux DVB driver API...
virtual bool SetIdleDevice(bool Idle, bool TestOnly)
Called by SetIdle if TestOnly, don't do anything, just return, if the device can be set to the new id...
void SetChannel(const cChannel *Channel)
int Position(void)
Returns the orbital position of the satellite in case this is a DVB-S source (zero otherwise)...
bool HasPid(int Pid) const
Returns true if this device is currently receiving the given PID.
bool GetFrontendStatus(fe_status_t &Status) const
#define DTV_DVBT2_PLP_ID_LEGACY
const tDvbParameterMap SystemValuesTerr[]
virtual void Action(void)
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
cDevice * SubDevice(void) const
const tDvbParameterMap BandwidthValues[]
bool BondingOk(const cChannel *Channel, bool ConsiderOccupied=false) const
Returns true if this device is either not bonded to any other device, or the given Channel is on the ...
Derived cDevice classes that can receive channels will have to provide Transport Stream (TS) packets ...
virtual int OpenFilter(u_short Pid, u_char Tid, u_char Mask)
Opens a file handle for the given filter data.
void Cancel(int WaitSeconds=0)
Cancels the thread by first setting 'running' to false, so that the Action() loop can finish in an or...
virtual int SignalStrength(void) const
Returns the "strength" of the currently received signal.
cString GetBondingParams(const cChannel *Channel=NULL) const
bool SetFrontendType(const cChannel *Channel)
#define ATSC_TUNE_TIMEOUT
virtual bool MaySwitchTransponder(const cChannel *Channel) const
Returns true if it is ok to switch to the Channel's transponder on this device, without disturbing an...
cDvbTransponderParameters dtp
static cString DvbName(const char *Name, int Adapter, int Frontend)
The cDevice class is the base from which actual devices can be derived.
static int DvbOpen(const char *Name, int Adapter, int Frontend, int Mode, bool ReportError=false)
const cDvbDevice * device
const tDvbParameterMap GuardValues[]
virtual void GetData(cChannel *Channel)
Copies all source specific parameters to the given Channel.
const tDvbParameterMap TransmissionValues[]
static void SetTransferModeForDolbyDigital(int Mode)
virtual bool ProvidesEIT(void) const
Returns true if this device provides EIT data and thus wants to be tuned to the channels it can recei...