RESULT eDVBResourceManager::allocateFrontend(const eDVBChannelID &chid, ePtr<eDVBAllocatedFrontend> &fe)
{
- /* find first unused frontend. we ignore compatibility for now. */
+ ePtr<eDVBRegisteredFrontend> best;
+ int bestval = 0;
+
for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i)
if (!i->m_inuse)
{
- fe = new eDVBAllocatedFrontend(i);
- return 0;
+ int c = i->m_frontend->isCompatibleWith(chid);
+ if (c > bestval)
+ {
+ c = bestval;
+ best = i;
+ }
}
+
+ if (best)
+ {
+ fe = new eDVBAllocatedFrontend(best);
+ return 0;
+ }
+
+ fe = 0;
+
return -1;
}
return -EINVAL;
}
+int eDVBFrontend::isCompatibleWith(const eDVBChannelID &chid)
+{
+ return 1;
+}
RESULT getData(int num, int &data);
RESULT setData(int num, int val);
+ int isCompatibleWith(const eDVBChannelID &chid);
+
int getID() { return m_fe; }
};
virtual RESULT setSecSequence(const eSecCommandList &list)=0;
virtual RESULT getData(int num, int &data)=0;
virtual RESULT setData(int num, int val)=0;
+
+ /* 0 means: not compatible. other values are a priority. */
+ virtual int isCompatibleWith(const eDVBChannelID &chid)=0;
};
class iDVBSatelliteEquipmentControl: public iObject