this,
SLOT(callTerminate()));
- findGprsId();
-
qDebug() << "Starting...";
return true;
}
searchClose();
-
- if(gprsId_.isEmpty())
- {
- findGprsId();
- }
}
void CallListener::showDelayedResult(QString const& text, int delay)
}
int cretries = 0;
+ int scans = 0;
+ bool found = false;
+ int maxScans = GPRS_SCANS;
- bool tryGprs = (!gprsId_.isEmpty() &&
- (configType == Settings::ANY || configType == Settings::GPRS));
+ if(lookupType == ConnectionManager::WLAN)
+ {
+ maxScans = WLAN_SCANS;
+ }
while(cretries < CONNECTION_LOOKUP_RETRIES)
{
return false;
}
- if(cm.getBestConnection(best, lookupType))
+ if(scans < maxScans)
{
- break;
+ if(cm.getBestConnection(best, lookupType))
+ {
+ found = true;
+ }
+
+ scans++;
}
- // ICD doesn't always find gprs connection during call, so
- // try to use gprs anyway.
- if(tryGprs && is3g())
+ // If there is only gprs connection available,
+ // make sure that we are on 3g network
+ if(found && (best.type != ConnectionManager::GPRS || is3g()))
{
- best.id = gprsId_;
- qDebug() << "Trying gprs";
break;
}
+ if(found)
+ {
+ sleep(WAIT_BETWEEN_RETRIES);
+ }
+
qDebug() << "No connections found, retrying...";
cretries++;
- sleep(WAIT_BETWEEN_RETRIES);
-
}
if(cretries >= CONNECTION_LOOKUP_RETRIES)
return false;
}
+ qDebug() << "Connecting to " << best.name;
+
if(cm.connect(best.id))
{
break;
void CallListener::showError(QString const& msg, int timeout)
{
qDebug() << "Error: " << msg;
+
+ if(!initialized_ || !box_)
+ {
+ return;
+ }
+
box_->setTimeout(ERROR_BANNER_TIMEOUT);
if(timeout)
}
}
-void CallListener::timerEvent(QTimerEvent* event)
-{
- Q_UNUSED(event);
- killTimer(timer_);
- timer_ = 0;
-}
-
-void CallListener::sleep(int ms)
-{
- if(timer_)
- {
- killTimer(timer_);
- }
-
- timer_ = startTimer(ms);
-
- while(timer_)
- {
- QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents);
- }
-}
-
-void CallListener::findGprsId()
-{
- ConnectionManager cm;
-
- QList<ConnectionManager::Connection> connections;
-
- if(cm.scanConnections(connections, ConnectionManager::GPRS) &&
- connections.size() > 0)
- {
- gprsId_ = connections.at(0).id;
- }
-}
-
bool CallListener::is3g()
{
QDBusMessage msg = QDBusMessage::createMethodCall("com.nokia.phone.net",
// Something else
return false;
}
+
+void CallListener::timerEvent(QTimerEvent* event)
+{
+ Q_UNUSED(event);
+ killTimer(timer_);
+ timer_ = 0;
+}
+
+void CallListener::sleep(int ms)
+{
+ if(timer_)
+ {
+ killTimer(timer_);
+ }
+
+ timer_ = startTimer(ms);
+
+ while(timer_)
+ {
+ QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents);
+ }
+}