Commit 47018f2d authored by Lorn Potter's avatar Lorn Potter

[connectionagent] delay setting tethering enabled after power on.

This fixes the case when wifi needs to be powered on, and there are no
known services in range. For some reason, setting the technology to be
tethering enabled does not work until it is delayed.
parent 58a09a1d
......@@ -496,13 +496,16 @@ void QConnectionAgent::setup()
void QConnectionAgent::technologyPowerChanged(bool powered)
{
NetworkTechnology *tech = static_cast<NetworkTechnology *>(sender());
qDebug() << tech->name() << powered;
if (tech->type() != "wifi")
return;
qDebug() << tetheringWifiTech->name() << powered;
if (netman && tech->type() == "wifi" && powered && delayedTethering) {
tech->setTethering(true);
if (netman && powered && delayedTethering) {
// wifi tech might not be ready, so delay this
QTimer::singleShot(1000,this,SLOT(setWifiTetheringEnabled()));
}
if (!delayedTethering && tech->type() == "wifi") {
if (!delayedTethering) {
if (!powered) {
removeAllTypes("wifi"); //dont wait for connman, he's too slow at this
QString bestService = findBestConnectableService();
......@@ -869,3 +872,11 @@ void QConnectionAgent::stopTethering()
}
Q_EMIT tetheringFinished(false);
}
void QConnectionAgent::setWifiTetheringEnabled()
{
if (tetheringWifiTech) {
qDebug() << "set tethering";
tetheringWifiTech->setTethering(delayedTethering);
}
}
......@@ -145,6 +145,7 @@ private slots:
void servicesChanged();
void openConnectionDialog(const QString &type);
void setWifiTetheringEnabled();
};
#endif // QCONNECTIONAGENT_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment