void AsteriskManager::registrationStateChanged()
{
    if ( d->netReg ) {
        emit registrationChanged( d->netReg->registrationState() );
        d->status->setAttribute("Registered", d->netReg->registrationState() == QTelephony::RegistrationHome);
    } else {
        emit registrationChanged( QTelephony::RegistrationNone );
        d->status->setAttribute("Registered", false);
    }
}
/*!
  Constructs a new CellBroadcastControl instance with the specified \a parent.
  */
CellBroadcastControl::CellBroadcastControl(QObject *parent)
: QObject(parent), infoMsgId(-1)
{
    cb = new QCellBroadcast(QString(), this);
    QObject::connect(cb, SIGNAL(broadcast(QCBSMessage)),
                    this, SLOT(cellBroadcast(QCBSMessage)));
    QObject::connect(cb, SIGNAL(setChannelsResult(QTelephony::Result)),
                    this, SLOT(cellBroadcastResult(QTelephony::Result)));

    firstSubscribe = false;
    QAbstractCallPolicyManager *cellModem = QAbstractCallPolicyManager::managerForCallType("Voice");
    if (cellModem)
        connect(cellModem,
            SIGNAL(registrationStateChanged(QTelephony::RegistrationState)),
            this,
            SLOT(registrationChanged(QTelephony::RegistrationState)));
    else 
        qLog(Component) << "CellBroadcastControl: No Cellmodem manager component available";
}
Exemple #3
0
/*!
  \internal

  Construct a new CellModemManager with the appropriate \a parent.  Only one
  instance of CellModemManager may be constructed.
 */
CellModemManager::CellModemManager(QObject *parent)
: QAbstractCallPolicyManager(parent), d(new CellModemManagerPrivate)
{
    Q_ASSERT(!cellModemManagerInstance);
    cellModemManagerInstance = true;

    d->m_status = new QValueSpaceObject("/Telephony/Status", this);
    d->m_status->setAttribute("ModemStatus", "Initializing");

    QValueSpaceItem *simToolkitAvailable;
    simToolkitAvailable = new QValueSpaceItem
            ("/Telephony/Status/SimToolkit/Available", this);
    connect(simToolkitAvailable, SIGNAL(contentsChanged()),
            this, SLOT(simToolkitAvailableChange()));

    // Check for modem
    QServiceChecker checker("modem");
    if(!checker.isValid()) {
        d->m_aerialOn = false;
        d->m_state = NoCellModem;
        updateStatus();
        return;
    }

    d->m_netReg = new QNetworkRegistration("modem", this);
    d->m_regState = d->m_netReg->registrationState();
    d->m_operator = d->m_netReg->currentOperatorName();

    QObject::connect(d->m_netReg, SIGNAL(registrationStateChanged()),
                     this, SLOT(registrationStateChanged()));
    QObject::connect(d->m_netReg, SIGNAL(currentOperatorChanged()),
                     this, SLOT(currentOperatorChanged()));

    // Rename signal for QAbstractCallPolicyManager.
    QObject::connect(this, SIGNAL(registrationStateChanged(QTelephony::RegistrationState)),
                     this, SIGNAL(registrationChanged(QTelephony::RegistrationState)));

    d->m_pinManager = new QPinManager("modem", this);
    QObject::connect(d->m_pinManager,
                     SIGNAL(pinStatus(QString,QPinManager::Status,QPinOptions)),
                     this,
                     SLOT(pinStatus(QString,QPinManager::Status,QPinOptions)) );

    d->m_rfFunc = new QPhoneRfFunctionality("modem", this);
    QObject::connect(d->m_rfFunc,
                     SIGNAL(levelChanged()), this, SLOT(rfLevelChanged()));

    d->m_callForwarding = new QCallForwarding("modem", this);
    QObject::connect(d->m_callForwarding,
                     SIGNAL(forwardingStatus(QCallForwarding::Reason,QList<QCallForwarding::Status>)),
                     this,
                     SLOT(forwardingStatus(QCallForwarding::Reason,QList<QCallForwarding::Status>)));

    QSimInfo *simInfo = new QSimInfo( "modem", this );
    connect( simInfo, SIGNAL(removed()), this, SLOT(simRemoved()) );
    connect( simInfo, SIGNAL(inserted()), this, SLOT(simInserted()) );

    if(::profilesControlModem) {
        d->m_profiles = new QPhoneProfileManager(this);
        d->m_aerialOn = !d->m_profiles->planeMode();
        QObject::connect(d->m_profiles, SIGNAL(planeModeChanged(bool)),
                         this, SLOT(planeModeChanged(bool)));
    }

    // If plane mode isn't an option, then we have to fully initialize the modem
    // each time
    if(!planeModeSupported())
        d->m_aerialOn = true;

    setAerialEnabled(d->m_aerialOn);
    updateStatus();

    doInitialize();
}