summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
Diffstat (limited to 'device.c')
-rw-r--r--device.c80
1 files changed, 78 insertions, 2 deletions
diff --git a/device.c b/device.c
index 681049b..5d5f648 100644
--- a/device.c
+++ b/device.c
@@ -144,6 +144,15 @@ void cDevice::SetUseDevice(int n)
useDevice |= (1 << n);
}
+//ML
+void cDevice::SetLnbNr(void)
+{
+ for (int i = 0; i < numDevices; i++) {
+ device[i]->SetLnbNrFromSetup();
+ }
+}
+//ML-Ende
+
int cDevice::NextCardIndex(int n)
{
if (n > 0) {
@@ -283,10 +292,21 @@ cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool LiveView
imp <<= 1; imp |= device[i]->Receiving(); // avoid devices that are receiving
imp <<= 4; imp |= GetClippedNumProvidedSystems(4, device[i]) - 1; // avoid cards which support multiple delivery systems
imp <<= 1; imp |= device[i] == cTransferControl::ReceiverDevice(); // avoid the Transfer Mode receiver device
- imp <<= 8; imp |= min(max(device[i]->Priority() + MAXPRIORITY, 0), 0xFF); // use the device with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used)
+ // LNB - Sharing
+ int badPriority = device[i]->GetMaxBadPriority(Channel);
+ if (badPriority < 0 ) // a device receiving with lower priority would need to be stopped
+ {
+ imp <<= 8; imp |= min(max(device[i]->Priority() + MAXPRIORITY, 0), 0xFF); // use the device with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used)
+ } else {
+ imp <<= 8; imp |= min(max(max(device[i]->Priority(), badPriority) + MAXPRIORITY, 0), 0xFF); // use the device with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used)
+ }
+ // LNB - Sharing End
imp <<= 8; imp |= min(max((NumUsableSlots ? SlotPriority[j] : 0) + MAXPRIORITY, 0), 0xFF); // use the CAM slot with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used)
imp <<= 1; imp |= ndr; // avoid devices if we need to detach existing receivers
imp <<= 1; imp |= device[i]->IsPrimaryDevice(); // avoid the primary device
+ // LNB - Sharing
+ imp |= (badPriority == -1); // avoid cards where the actual device needs to be switched
+ // LNB - Sharing End
imp <<= 1; imp |= NumUsableSlots ? 0 : device[i]->HasCi(); // avoid cards with Common Interface for FTA channels
imp <<= 1; imp |= device[i]->HasDecoder(); // avoid full featured cards
imp <<= 1; imp |= NumUsableSlots ? !ChannelCamRelations.CamDecrypt(Channel->GetChannelID(), j + 1) : 0; // prefer CAMs that are known to decrypt this channel
@@ -602,7 +622,11 @@ bool cDevice::ProvidesTransponder(const cChannel *Channel) const
bool cDevice::ProvidesTransponderExclusively(const cChannel *Channel) const
{
for (int i = 0; i < numDevices; i++) {
- if (device[i] && device[i] != this && device[i]->ProvidesTransponder(Channel))
+
+//ML
+ if (device[i] && device[i] != this && device[i]->ProvidesTransponder(Channel) && device[i]->IsShareLnb(this) )
+//ML-Ende
+
return false;
}
return true;
@@ -684,6 +708,51 @@ bool cDevice::SwitchChannel(int Direction)
return result;
}
+// ML
+cDevice *cDevice::GetBadDevice(const cChannel *Channel)
+{
+ if(!cSource::IsSat(Channel->Source())) return NULL; // no conflict if the new channel is not on sat
+ if(!ProvidesSource(cSource::stSat)) return NULL; // no conflict if this device is not on sat
+ for (int i = 0; i < numDevices; i++) {
+ if (this != device[i] && device[i]->IsShareLnb(this) && device[i]->IsLnbConflict(Channel) ) {
+ // there is a conflict between device[i] and 'this' if we tune this to Channel
+ if (Setup.VerboseLNBlog) {
+ isyslog("LNB %d: Device check for channel %d on device %d. LNB or DiSEq conflict with device %d", LnbNr(), Channel->Number(), this->DeviceNumber() + 1, i + 1);
+ }
+ return device[i];
+ }
+ }
+ if (Setup.VerboseLNBlog) {
+ isyslog("LNB %d: Device check for channel %d on device %d. OK", LnbNr(), Channel->Number(), this->DeviceNumber() + 1);
+ }
+ return NULL;
+}
+
+int cDevice::GetMaxBadPriority(const cChannel *Channel) const
+{
+ if(!cSource::IsSat(Channel->Source())) return -2; // no conflict if the new channel is not on sat
+ if(!ProvidesSource(cSource::stSat)) return -2; // no conflict if this device is not on sat
+
+ int maxBadPriority = -2;
+ for (int i = 0; i < numDevices; i++) {
+ if (this != device[i] && device[i]->IsShareLnb(this) && device[i]->IsLnbConflict(Channel) ) {
+ // there is a conflict between device[i] and 'this' if we tune this to Channel
+ if (Setup.VerboseLNBlog) {
+ isyslog("LNB %d: Conflict for device %d, priority of conflicting device: %d", LnbNr(), i + 1, device[i]->Priority());
+ }
+ if (device[i]->Receiving() && device[i]->Priority() > maxBadPriority) maxBadPriority = device[i]->Priority();
+ if (i == ActualDevice()->CardIndex() && maxBadPriority < -1 ) maxBadPriority = -1;
+ }
+ }
+
+ if (Setup.VerboseLNBlog) {
+ isyslog("LNB %d: Request for channel %d on device %d. MaxBadPriority is %d", LnbNr(), Channel->Number(), this->DeviceNumber() + 1, maxBadPriority);
+ }
+ return maxBadPriority;
+}
+// ML Ende
+
+
eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
{
if (LiveView) {
@@ -698,6 +767,13 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
eSetChannelResult Result = scrOk;
+//ML
+ if (Setup.VerboseLNBlog) {
+ isyslog("LNB %d: Switching device %d to channel %d", LnbNr(), this->DeviceNumber() + 1, Channel->Number());
+ }
+//ML-Ende
+
+
// If this DVB card can't receive this channel, let's see if we can
// use the card that actually can receive it and transfer data from there: