示例#1
0
void QConnmanEngine::initialize()
{
    QMutexLocker locker(&mutex);
    connect(ofonoManager,SIGNAL(modemChanged()),this,SLOT(changedModem()));

    ofonoNetwork = new QOfonoNetworkRegistrationInterface(ofonoManager->currentModem(),this);
    ofonoContextManager = new QOfonoDataConnectionManagerInterface(ofonoManager->currentModem(),this);
    connect(ofonoContextManager,SIGNAL(roamingAllowedChanged(bool)),this,SLOT(reEvaluateCellular()));

    connect(connmanManager,SIGNAL(servicesChanged(ConnmanMapList, QList<QDBusObjectPath>)),
            this, SLOT(updateServices(ConnmanMapList, QList<QDBusObjectPath>)));

    connect(connmanManager,SIGNAL(servicesReady(QStringList)),this,SLOT(servicesReady(QStringList)));
    connect(connmanManager,SIGNAL(scanFinished()),this,SLOT(finishedScan()));

    foreach (const QString &servPath, connmanManager->getServices()) {
        addServiceConfiguration(servPath);
    }
    Q_EMIT updateCompleted();
    QSettings confFile(QStringLiteral("nemomobile"),QStringLiteral("connectionagent"));

    inotifyFileDescriptor = ::inotify_init();
    inotifyWatcher = ::inotify_add_watch(inotifyFileDescriptor, QFile::encodeName(confFile.fileName()), IN_MODIFY);
    if (inotifyWatcher > 0) {
        QSocketNotifier *notifier = new QSocketNotifier(inotifyFileDescriptor, QSocketNotifier::Read, this);
        connect(notifier, SIGNAL(activated(int)), this, SLOT(inotifyActivated()));
    }
void NetworkManager::disconnectServices()
{
    if (m_manager) {
        disconnect(m_manager, SIGNAL(ServicesChanged(ConnmanObjectList,QList<QDBusObjectPath>)),
                   this, SLOT(updateServices(ConnmanObjectList,QList<QDBusObjectPath>)));
        disconnect(m_manager, SIGNAL(SavedServicesChanged(ConnmanObjectList)),
                   this, SLOT(updateSavedServices(ConnmanObjectList)));
    }

    Q_FOREACH (NetworkService *service, m_servicesCache)
        service->deleteLater();

    m_servicesCache.clear();

    if (m_defaultRoute != m_invalidDefaultRoute) {
        m_defaultRoute = m_invalidDefaultRoute;
        Q_EMIT defaultRouteChanged(m_defaultRoute);
    }

    if (!m_servicesOrder.isEmpty()) {
        m_servicesOrder.clear();
        Q_EMIT servicesChanged();
    }

    if (!m_savedServicesOrder.isEmpty()) {
        m_savedServicesOrder.clear();
        Q_EMIT savedServicesChanged();
    }
}
示例#3
0
/*!
    Create a new Asterisk telephony service manager and attach it to \a parent.
*/
AsteriskManager::AsteriskManager( QObject *parent )
    : QAbstractCallPolicyManager( parent )
{
    d = new AsteriskManagerPrivate;
    d->status = new QValueSpaceObject("/Telephony/Status/Asterisk", this);
#ifdef QTOPIA_VOIP
    // The "asterisk" telephony handler may not have started yet.
    // Hook onto QCommServiceManager to watch for it.
    d->serviceManager = new QCommServiceManager( this );
    connect( d->serviceManager, SIGNAL(servicesChanged()),
             this, SLOT(servicesChanged()) );

    // Just in case it has already started.
    servicesChanged();
#endif
}
TechnologyModel::TechnologyModel(QAbstractListModel* parent)
  : QAbstractListModel(parent),
    m_manager(NULL),
    m_tech(NULL),
    m_scanning(false),
    m_changesInhibited(false),
    m_uneffectedChanges(false),
    m_scanResultsReady(false)
{
    m_manager = NetworkManagerFactory::createInstance();

#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    setRoleNames(roleNames());
#endif
    connect(m_manager, SIGNAL(availabilityChanged(bool)),
            this, SLOT(managerAvailabilityChanged(bool)));

    connect(m_manager,
            SIGNAL(technologiesChanged()),
            this,
            SLOT(updateTechnologies()));

    connect(m_manager,
            SIGNAL(servicesChanged()),
            this,
            SLOT(updateServiceList()));
}
示例#5
0
void QConnmanEngine::initialize()
{
    QMutexLocker locker(&mutex);
    connect(ofonoManager,SIGNAL(modemChanged()),this,SLOT(changedModem()));

    ofonoNetwork = new QOfonoNetworkRegistrationInterface(ofonoManager->currentModem(),this);
    ofonoContextManager = new QOfonoDataConnectionManagerInterface(ofonoManager->currentModem(),this);
    connect(ofonoContextManager,SIGNAL(roamingAllowedChanged(bool)),this,SLOT(reEvaluateCellular()));

    connect(connmanManager,SIGNAL(servicesChanged(ConnmanMapList,QList<QDBusObjectPath>)),
            this, SLOT(updateServices(ConnmanMapList,QList<QDBusObjectPath>)));

    connect(connmanManager,SIGNAL(servicesReady(QStringList)),this,SLOT(servicesReady(QStringList)));
    connect(connmanManager,SIGNAL(scanFinished()),this,SLOT(finishedScan()));

    foreach (const QString &servPath, connmanManager->getServices()) {
        addServiceConfiguration(servPath);
    }
    Q_EMIT updateCompleted();
}
示例#6
0
WiredPage::WiredPage(const QModelIndex &technology, ConnMan *manager, QWidget *parent):
    QWidget(parent),
    m_technology(technology),
    m_manager(manager),
    m_service(NULL)
{
    ui.setupUi(this);

    m_wiredTechnology = static_cast<ManagerNode*>(technology.internalPointer())->object<Technology *>();

    ui.icon->setPixmap(QIcon::fromTheme("network-wired").pixmap(QSize(48, 48)));
    ui.enabled->setChecked(m_wiredTechnology->isPowered());

    connect(manager, SIGNAL(servicesChanged()), SLOT(configureService()));
    connect(m_wiredTechnology, SIGNAL(dataChanged()), SLOT(updateUi()));
    connect(m_wiredTechnology, SIGNAL(poweredChanged(bool)), ui.enabled, SLOT(setChecked(bool)));
    connect(ui.enabled, SIGNAL(toggled(bool)), SLOT(toggleTechnology(bool)));

    ui.ipv4Widget->hide();

    configureService();
    updateUi();
}
TechnologyModel::TechnologyModel(QAbstractListModel* parent)
  : QAbstractListModel(parent),
    m_manager(NULL),
    m_tech(NULL),
    m_scanning(false),
    m_changesInhibited(false),
    m_uneffectedChanges(false)
{
    m_manager = NetworkManagerFactory::createInstance();

    connect(m_manager, SIGNAL(availabilityChanged(bool)),
            this, SLOT(managerAvailabilityChanged(bool)));

    connect(m_manager,
            SIGNAL(technologiesChanged()),
            this,
            SLOT(updateTechnologies()));

    connect(m_manager,
            SIGNAL(servicesChanged()),
            this,
            SLOT(updateServiceList()));
}
示例#8
0
void QConnmanEngine::initialize()
{
    connect(connmanManager,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
            this,SLOT(propertyChangedContext(QString,QString,QDBusVariant)));

    connect(connmanManager,SIGNAL(servicesChanged(ConnmanMapList, QList<QDBusObjectPath>)),
            this, SLOT(updateServices(ConnmanMapList, QList<QDBusObjectPath>)));

    foreach (const QString &techPath, connmanManager->getTechnologies()) {
        QConnmanTechnologyInterface *tech;
        tech = new QConnmanTechnologyInterface(techPath, this);

        connect(tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)),
                this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant)));
    }

    foreach (const QString &servPath, connmanManager->getServices()) {
        addServiceConfiguration(servPath);
    }

    // Get current list of access points.
    getConfigurations();
}
示例#9
0
/*! \internal */
MessageControl::MessageControl() :
    phoneValueSpace("/Communications/Messages"),
    smsMemFull("/Telephony/Status/SMSMemoryFull"),
#ifdef QTOPIA_CELL
    smsreq(0),
#endif
    messageCountUpdate(0),
    channel("QPE/System"),
    smsCount(0), mmsCount(0), systemCount(0),
    smsIsFull(false), prevSmsMemoryFull(0)
{
    QSettings setting("Trolltech", "qpe");
    setting.beginGroup("Messages");
    smsCount = setting.value("MissedSMSMessages", 0).toInt();
    mmsCount = setting.value("MissedMMSMessages", 0).toInt();
    systemCount = setting.value("MissedSystemMessages", 0).toInt();

    mgr = new QCommServiceManager( this );
    connect( mgr, SIGNAL(servicesChanged()), this,
             SLOT(telephonyServicesChanged()) );
    telephonyServicesChanged(); // Check to see if we already have SMS.

    connect(&channel, SIGNAL(received(QString,QByteArray)),
            this, SLOT(sysMessage(QString,QByteArray)) );

    connect(&smsMemFull, SIGNAL(contentsChanged()),
            this, SLOT(smsMemoryFullChanged()) );
    prevSmsMemoryFull = smsMemFull.value().toInt();

    // React to changes in incoming message count
    messageCountUpdate = new QtopiaIpcAdaptor("QPE/Messages/MessageCountUpdated");
    QtopiaIpcAdaptor::connect(messageCountUpdate, MESSAGE(changeValue()), 
                              this, SLOT(messageCountChanged()));

    doNewCount(false);
    messageCountChanged();
}
示例#10
0
文件: dialup.cpp 项目: Fale/qtmoko
void DialupImpl::initialize()
{
    if ( !netSpace ) {
        const uint ident = qHash( configIface->configFile() );
        QString path = QString("/Network/Interfaces/%1").arg(ident);
        netSpace = new QValueSpaceObject( path, this );
        netSpace->setAttribute( "Config", configIface->configFile() );
        netSpace->setAttribute( "State", QtopiaNetworkInterface::Unknown );
        netSpace->setAttribute( "Error", QtopiaNetworkInterface::NotInitialized );
        netSpace->setAttribute( "ErrorString", tr("Interface hasn't been initialized yet.") );
        netSpace->setAttribute( "NetDevice", QVariant() );
        netSpace->setAttribute( "UpdateTrigger", 0 );
    }

    if ( isAvailable() ) {
        ifaceStatus = QtopiaNetworkInterface::Down;
        qLog(Network) << "DialupImpl: Using serial device: " << device();
    } else {
        ifaceStatus = QtopiaNetworkInterface::Unavailable;
        qLog(Network) << "DialupImpl: interface not available";
    }

    netSpace->setAttribute( "State", ifaceStatus );
    updateTrigger();
#ifdef QTOPIA_CELL
    QtopiaNetwork::Type t = type();
    if ( t & QtopiaNetwork::PhoneModem ) {
        //we cannot start an internal GPRS connection if we don't have a registered network
        //initiate monitoring of registration changes
        commManager = new QCommServiceManager( this );
        connect( commManager, SIGNAL(servicesChanged()), this, SLOT(registrationStateChanged()) );
        registrationStateChanged(); //ask for first update
    }
#endif

}
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()));

}