}
-int eComponentScan::start(int flags)
+int eComponentScan::start(int feid, int flags)
{
if (m_initial.empty())
return -2;
eUsePtr<iDVBChannel> channel;
- if (mgr->allocateRawChannel(channel))
+ if (mgr->allocateRawChannel(channel, feid))
{
- eDebug("scan: allocating raw channel failed!");
+ eDebug("scan: allocating raw channel (on frontend %d) failed!", feid);
return -1;
}
/* please keep the flags in sync with lib/dvb/scan.h ! */
enum { scanNetworkSearch=1 };
- int start(int flags=0);
+ int start(int feid, int flags=0);
};
#endif
}
}
-RESULT eDVBResourceManager::allocateFrontend(ePtr<iDVBFrontendParameters> &feparm, ePtr<eDVBAllocatedFrontend> &fe)
+RESULT eDVBResourceManager::allocateFrontend(ePtr<eDVBAllocatedFrontend> &fe, ePtr<iDVBFrontendParameters> &feparm)
{
ePtr<eDVBRegisteredFrontend> best;
int bestval = 0;
return -1;
}
+RESULT eDVBResourceManager::allocateFrontendByIndex(ePtr<eDVBAllocatedFrontend> &fe, int nr)
+{
+ for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i, --nr)
+ if ((!nr) && !i->m_inuse)
+ {
+ fe = new eDVBAllocatedFrontend(i);
+ return 0;
+ }
+
+ fe = 0;
+ return -1;
+}
+
RESULT eDVBResourceManager::allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBAllocatedDemux> &demux, int cap)
{
/* find first unused demux which is on same adapter as frontend (or any, if PVR)
ePtr<eDVBAllocatedFrontend> fe;
- if (allocateFrontend(feparm, fe))
+ if (allocateFrontend(fe, feparm))
return errNoFrontend;
-// will be allocated on demand:
-// ePtr<eDVBAllocatedDemux> demux;
-//
-// if (allocateDemux(*fe, demux))
-// return errNoDemux;
-
RESULT res;
ePtr<eDVBChannel> ch;
ch = new eDVBChannel(this, fe);
return 0;
}
-RESULT eDVBResourceManager::allocateRawChannel(eUsePtr<iDVBChannel> &channel)
+RESULT eDVBResourceManager::allocateRawChannel(eUsePtr<iDVBChannel> &channel, int frontend_index)
{
ePtr<eDVBAllocatedFrontend> fe;
-#warning FIXME allocateRawChannel
-
-// if (allocateFrontend(eDVBChannelID(), fe))
+ if (allocateFrontendByIndex(fe, frontend_index))
return errNoFrontend;
-// ePtr<eDVBAllocatedDemux> demux;
- //
-// if (allocateDemux(*fe, demux))
-// return errNoDemux;
-
eDVBChannel *ch;
ch = new eDVBChannel(this, fe);
{
ePtr<eDVBAllocatedDemux> demux;
-// if (allocateDemux(0, demux))
-// return errNoDemux;
-
eDVBChannel *ch;
ch = new eDVBChannel(this, 0);
void addAdapter(iDVBAdapter *adapter);
- /* allocates a frontend able to tune to channelID "chid".
+ /* allocates a frontend able to tune to frontend paramters 'feperm'.
the frontend must be tuned lateron. there is no guarante
- that tuning will suceed - it just means that if this frontend
+ that tuning will succeed - it just means that if this frontend
can't tune, no other frontend could do it.
there might be a priority given to certain frontend/chid
combinations. this will be evaluated here. */
- RESULT allocateFrontend(ePtr<iDVBFrontendParameters> &feparm, ePtr<eDVBAllocatedFrontend> &fe);
+ RESULT allocateFrontend(ePtr<eDVBAllocatedFrontend> &fe, ePtr<iDVBFrontendParameters> &feparm);
+ RESULT allocateFrontendByIndex(ePtr<eDVBAllocatedFrontend> &fe, int index);
/* allocate a demux able to filter on the selected frontend. */
RESULT allocateDemux(eDVBRegisteredFrontend *fe, ePtr<eDVBAllocatedDemux> &demux, int cap);
/* allocate channel... */
RESULT allocateChannel(const eDVBChannelID &channelid, eUsePtr<iDVBChannel> &channel);
- RESULT allocateRawChannel(eUsePtr<iDVBChannel> &channel);
+ RESULT allocateRawChannel(eUsePtr<iDVBChannel> &channel, int frontend_index);
RESULT allocatePVRChannel(eUsePtr<iDVBPVRChannel> &channel);
RESULT connectChannelAdded(const Slot1<void,eDVBChannel*> &channelAdded, ePtr<eConnection> &connection);
if self.state == self.Error:
self.text.setText("ERROR - failed to scan (%s)!" % (self.Errors[self.errorcode]) )
- def __init__(self, progressbar, text, transponders, flags):
+ def __init__(self, progressbar, text, transponders, feid, flags):
self.progressbar = progressbar
self.text = text
self.scan = eComponentScan()
self.state = self.Idle
+ self.feid = feid
self.flags = flags
self.scanStatusChanged()
def execBegin(self):
self.scan.statusChanged.get().append(self.scanStatusChanged)
self.state = self.Running
- err = self.scan.start(self.flags)
+ err = self.scan.start(self.feid, self.flags)
if err:
self.state = self.Error
self.errorcode = 0
if (config.scan.type.value == 1): # single sat scan
getInitialTransponderList(tlist, int(self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value][1]))
- flags |= eComponentScan.scanNetworkSearch
+ flags |= eComponentScan.scanNetworkSearch
if (config.scan.type.value == 2): # multi sat scan
SatList = nimmanager.getSatListForNim(config.scan.nims.value)
if x[1].parent.value == 0:
print " " + str(x[1].parent.configPath)
getInitialTransponderList(tlist, x[1].parent.configPath)
- flags |= eComponentScan.scanNetworkSearch
+ flags |= eComponentScan.scanNetworkSearch
for x in self["config"].list:
x[1].save()
-
+ feid = 0 # insert correct frontend id here (should be user-selectable)
# flags |= eComponentScan.scanSearchBAT
- self.session.openWithCallback(self.keyCancel, ServiceScan, tlist, flags)
+ self.session.openWithCallback(self.keyCancel, ServiceScan, tlist, feid, flags)
#self.close()
print " " + str(x[1].parent.configPath)
getInitialTransponderList(tlist, x[1].parent.configPath)
- self.session.openWithCallback(self.keyCancel, ServiceScan, tlist, eComponentScan.scanNetworkSearch)
+ feid = 0 # FIXME
+ self.session.openWithCallback(self.keyCancel, ServiceScan, tlist, feid, eComponentScan.scanNetworkSearch)
def keyCancel(self):
self.close()
def cancel(self):
self.close()
- def __init__(self, session, transponders, flags):
+ def __init__(self, session, transponders, feid, flags):
Screen.__init__(self, session)
self.session.nav.stopService()
self["scan_progress"] = ProgressBar()
self["scan_state"] = Label("scan state")
- self["scan"] = CScan(self["scan_progress"], self["scan_state"], transponders, flags)
+ self["scan"] = CScan(self["scan_progress"], self["scan_state"], transponders, feid, flags)
self["actions"] = ActionMap(["OkCancelActions"],
{