return;
}
- if(status != ICD_SCAN_NEW)
+ if(status != ICD_SCAN_NEW && status != ICD_SCAN_NOTIFY)
{
return;
}
connection.name = args.value(8).toString();
connection.strength = args.value(11).toInt();
+ for(int i = 0; i < connections_->size(); i++)
+ {
+ if(connections_->at(i).id == connection.id)
+ {
+ if(status == ICD_SCAN_NEW)
+ {
+ connections_->insert(i, connection);
+ }
+
+ return;
+ }
+ }
+
connections_->push_back(connection);
}
Source::SearchDetails const& details,
bool error)
{
+ if(closeConnection_)
+ {
+ closeConnection_ = false;
+ ConnectionManager cm;
+ cm.disconnect(true);
+ }
+
// If box is not visible, the call must have been terminated already
if(!initialized_ || !box_->isVisible())
{
retries_ = -1;
currentSearch_ = "";
-
- if(closeConnection_)
- {
- closeConnection_ = false;
- ConnectionManager cm;
- cm.disconnect(true);
- }
}
QString CallListener::createResult(QString const& name, QString const& street, QString const& city)
{
if(box_ && box_->isVisible())
{
- box_->hide();
- }
-
- if(closeConnection_)
- {
- closeConnection_ = false;
- ConnectionManager cm;
- cm.disconnect(true);
+ box_->close();
}
searchClose();
delete box_;
box_ = 0;
label_ = 0;
+
+ if(closeConnection_)
+ {
+ closeConnection_ = false;
+ ConnectionManager cm;
+ cm.disconnect(true);
+ }
}
bool CallListener::handleConnection()
bool found = false;
int maxScans = GPRS_SCANS;
- if(lookupType == ConnectionManager::WLAN)
+ if(lookupType != ConnectionManager::GPRS)
{
maxScans = WLAN_SCANS;
}
return false;
}
- sleep(WAIT_BETWEEN_RETRIES);
+ retries++;
qDebug() << "Unable to connect, retrying...";
- retries++;
+
+ if(retries < CONNECT_RETRIES)
+ {
+ sendRetrySignal(best.id, initialized_);
+ }
}
- if(initialized_ && retries >= CONNECT_RETRIES)
+ if(retries >= CONNECT_RETRIES)
{
- showError(tr("Unable to connect to network."));
+ sendRetrySignal(best.id, false);
+
+ if(initialized_)
+ {
+ showError(tr("Unable to connect to network."));
+ }
+
return false;
}
uint status = rep.arguments().value(6).toUInt();
- if(status & 0x10) // 3.5G (HSUPA)
- {
- return true;
- }
- else if(status & 0x08) // 3G (HSDPA)
+ if(status & 0x10 || status & 0x08)
{
return true;
}
- // Something else
return false;
}
+void CallListener::sendRetrySignal(QString const& iap, bool retry)
+{
+ QDBusMessage msg = QDBusMessage::createSignal("/com/nokia/icd_ui",
+ "com.nokia.icd_ui",
+ "retry");
+
+ QList<QVariant> arguments;
+ arguments.append(QVariant(iap));
+ arguments.append(QVariant(retry));
+ msg.setArguments(arguments);
+
+ QDBusConnection::systemBus().send(msg);
+
+ qDebug() << "Retry signal sent";
+}
+
void CallListener::timerEvent(QTimerEvent* event)
{
Q_UNUSED(event);
static const int REQUEST_TIMEOUT = 10000;
static const int BANNER_DELAY = 350;
static const int SEARCH_RETRIES = 2;
- static const int CONNECT_RETRIES = 3;
- static const int CONNECTION_LOOKUP_RETRIES = 10;
+ static const int CONNECT_RETRIES = 2;
+ static const int CONNECTION_LOOKUP_RETRIES = 8;
static const int GPRS_SCANS = 2;
static const int WLAN_SCANS = 5;
static const int WAIT_BETWEEN_RETRIES = 500;
void showError(QString const& msg, int delay = 0);
bool is3g();
void sleep(int ms);
+ void sendRetrySignal(QString const& iap, bool retry);
QString createResult(QString const& name, QString const& street, QString const& city);
QString timedMessage_;
Source* source_;