Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #73 from lpotter/master
[connectionagent] delay setting tethering enabled after power on.
  • Loading branch information
lpotter committed Jun 12, 2014
2 parents 58a09a1 + 47018f2 commit 7862080
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
19 changes: 15 additions & 4 deletions connd/qconnectionagent.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -869,3 +872,11 @@ void QConnectionAgent::stopTethering()
}
Q_EMIT tetheringFinished(false);
}

void QConnectionAgent::setWifiTetheringEnabled()
{
if (tetheringWifiTech) {
qDebug() << "set tethering";
tetheringWifiTech->setTethering(delayedTethering);
}
}
1 change: 1 addition & 0 deletions connd/qconnectionagent.h
Expand Up @@ -145,6 +145,7 @@ private slots:
void servicesChanged();

void openConnectionDialog(const QString &type);
void setWifiTetheringEnabled();
};

#endif // QCONNECTIONAGENT_H

0 comments on commit 7862080

Please sign in to comment.