void ConnectionAgentPlugin::connectToConnectiond(QString) { if (connManagerInterface) { delete connManagerInterface; connManagerInterface = 0; } if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(CONND_SERVICE)) { qDebug() << Q_FUNC_INFO << QString("connection service not available").arg(CONND_SERVICE); QDBusReply<void> reply = QDBusConnection::sessionBus().interface()->startService(CONND_SERVICE); if (!reply.isValid()) { qDebug() << Q_FUNC_INFO << reply.error().message(); return; } } connManagerInterface = new com::jolla::Connectiond(CONND_SERVICE, CONND_PATH, QDBusConnection::sessionBus(), this); if (!connManagerInterface->isValid()) { qDebug() << Q_FUNC_INFO << "is not valid interface"; } connect(connManagerInterface,SIGNAL(connectionRequest()), this,SLOT(onConnectionRequested())); connect(connManagerInterface,SIGNAL(configurationNeeded(QString)), this,SIGNAL(configurationNeeded(QString))); connect(connManagerInterface,SIGNAL(userInputCanceled()), this,SIGNAL(userInputCanceled())); connect(connManagerInterface, SIGNAL(errorReported(QString, QString)), this, SLOT(onErrorReported(QString, QString))); connect(connManagerInterface,SIGNAL(connectionState(QString, QString)), this,SLOT(onConnectionState(QString, QString))); connect(connManagerInterface,SIGNAL(requestBrowser(QString)), this,SLOT(onRequestBrowser(QString))); connect(connManagerInterface,SIGNAL(userInputRequested(QString,QVariantMap)), this,SLOT(onUserInputRequested(QString,QVariantMap)), Qt::UniqueConnection); connect(connManagerInterface,SIGNAL(tetheringFinished(bool)), this,SLOT(onTetheringFinished(bool))); }
QConnectionManager::QConnectionManager(QObject *parent) : QObject(parent), netman(NetworkManagerFactory::createInstance()), currentNetworkState(QString()), currentType(QString()), currentNotification(0), askForRoaming(false), isEthernet(false), connmanAvailable(false), handoverInProgress(false), oContext(0), tetheringWifiTech(0), tetheringEnabled(false), flightModeSuppression(false) { qDebug() << Q_FUNC_INFO; manualConnnectionTimer.invalidate(); connect(netman,SIGNAL(availabilityChanged(bool)),this,SLOT(connmanAvailabilityChanged(bool))); connectionAdaptor = new ConnAdaptor(this); QDBusConnection dbus = QDBusConnection::sessionBus(); if (!dbus.registerService(CONND_SERVICE)) { qDebug() << "XXXXXXXXXXX could not register service XXXXXXXXXXXXXXXXXX"; } if (!dbus.registerObject(CONND_PATH, this)) { qDebug() << "XXXXXXXXXXX could not register object XXXXXXXXXXXXXXXXXX"; } askForRoaming = askRoaming(); connect(&clockModel,SIGNAL(timeUpdatesChanged()),this,SLOT(timeUpdatesChanged())); ua = new UserAgent(this); connect(ua,SIGNAL(userInputRequested(QString,QVariantMap)), this,SLOT(onUserInputRequested(QString,QVariantMap))); connect(ua,SIGNAL(connectionRequest()),this,SLOT(onConnectionRequest())); connect(ua,SIGNAL(errorReported(QString, QString)),this,SLOT(onErrorReported(QString, QString))); connect(ua,SIGNAL(userInputCanceled()),this,SLOT(onUserInputCanceled())); connect(ua,SIGNAL(userInputRequested(QString,QVariantMap)), this,SLOT(onUserInputRequested(QString,QVariantMap)), Qt::UniqueConnection); connect(ua,SIGNAL(browserRequested(QString,QString)), this,SLOT(browserRequest(QString,QString)), Qt::UniqueConnection); connect(netman,SIGNAL(servicesListChanged(QStringList)),this,SLOT(servicesListChanged(QStringList))); connect(netman,SIGNAL(stateChanged(QString)),this,SLOT(networkStateChanged(QString))); connect(netman,SIGNAL(servicesChanged()),this,SLOT(setup())); connect(netman,SIGNAL(offlineModeChanged(bool)),this,SLOT(offlineModeChanged(bool))); QFile connmanConf("/etc/connman/main.conf"); if (connmanConf.open(QIODevice::ReadOnly | QIODevice::Text)) { while (!connmanConf.atEnd()) { QString line = connmanConf.readLine(); if (line.startsWith("DefaultAutoConnectTechnologies")) { QString token = line.section(" = ",1,1).simplified(); techPreferenceList = token.split(","); break; } } connmanConf.close(); } if (techPreferenceList.isEmpty()) //ethernet,bluetooth,cellular,wifi is default techPreferenceList << "wifi" << "cellular" << "bluetooth" << "ethernet"; mceWatch = new WakeupWatcher(this); connect(mceWatch,SIGNAL(displayStateChanged(QString)),this,SLOT(displayStateChanged(QString))); connect(mceWatch,SIGNAL(sleepStateChanged(bool)),this,SLOT(sleepStateChanged(bool))); connmanAvailable = QDBusConnection::systemBus().interface()->isServiceRegistered("net.connman"); if (connmanAvailable) setup(); goodConnectTimer = new QTimer(this); goodConnectTimer->setSingleShot(true); goodConnectTimer->setInterval(12 * 1000); connect(goodConnectTimer,SIGNAL(timeout()),this,SLOT(connectionTimeout())); }