/*!
    \reimp
*/
QAbstractCallPolicyManager::CallHandling AsteriskManager::handling
        (const QString& number)
{
    // Cannot handle URI's that contain '@' or ':'.
    if (number.contains(QChar('@')) || number.contains(QChar(':')))
        return CannotHandle;

    // If no network registration, then cannot handle at this time.
    if (registrationState() != QTelephony::RegistrationHome)
        return CannotHandle;

    // Assume that this is a number that we can dial.
    return CanHandle;
}
/*!
    Update the registration \a state and notify all interested clients
    if it is different than the previous value.  The locationAreaCode()
    and cellId() will be set to -1.

    \sa registrationState(), registrationStateChanged()
    \sa locationAreaCode(), cellId()
*/
void QNetworkRegistrationServer::updateRegistrationState
        ( QTelephony::RegistrationState state )
{
    if ( locationAreaCode() != -1 || cellId() != -1 ) {
        if ( state != registrationState() ) {
            // Update everything.
            setValue( "state", (int)state, Delayed );
            setValue( "locationAreaCode", -1, Delayed );
            setValue( "cellId", -1 );
            emit registrationStateChanged();
            emit locationChanged();
        } else {
            // Update only the location.
            setValue( "locationAreaCode", -1, Delayed );
            setValue( "cellId", -1 );
            emit locationChanged();
        }
    } else if ( state != registrationState() ) {
        // Update only registration.
        setValue( "state", (int)state );
        emit registrationStateChanged();
    }
}
Exemple #3
0
/*!
    \reimp
*/
QString CellModemManager::registrationIcon() const
{
    QString pix(":image/antenna");

    switch (registrationState()) {
        case QTelephony::RegistrationNone:
            if (cellModemAvailable() && planeModeEnabled())
                pix = ":image/aeroplane";
            break;
        default:
            break;
    }

    return pix;
}
Exemple #4
0
void CellModemManager::updateStatus()
{
    QString registrationText;
    switch(registrationState()) {
        case QTelephony::RegistrationNone:
            registrationText = "None";
            break;
        case QTelephony::RegistrationHome:
            registrationText = "Home";
            break;
        case QTelephony::RegistrationSearching:
            registrationText = "Searching";
            break;
        case QTelephony::RegistrationDenied:
            registrationText = "Denied";
            break;
        case QTelephony::RegistrationUnknown:
            registrationText = "Unknown";
            break;
        case QTelephony::RegistrationRoaming:
            registrationText = "Roaming";
            break;
    }
    d->m_status->setAttribute("RegistrationState", registrationText);
    d->m_status->setAttribute("NetworkRegistered",
                              registrationState() == QTelephony::RegistrationHome ||
                              registrationState() == QTelephony::RegistrationRoaming);
    d->m_status->setAttribute("Roaming",
                              registrationState() == QTelephony::RegistrationRoaming);
    d->m_status->setAttribute("OperatorName", networkOperator());
    d->m_status->setAttribute("OperatorCountry", networkOperatorCountry());
    d->m_status->setAttribute("CallDivert", callForwardingEnabled());
    d->m_status->setAttribute("PlaneModeAvailable", planeModeSupported()?"Yes":"No");
    d->m_status->setAttribute("CellModem/Available", cellModemAvailable());
    d->m_status->setAttribute("ModemStatus", stateToString(state()));
}
Exemple #5
0
/*!
    \reimp
*/
QAbstractCallPolicyManager::CallHandling VoIPManager::handling
        (const QString& number)
{
    // If no network registration, then cannot use this to dial.
    if ( registrationState() != QTelephony::RegistrationHome )
        return CannotHandle;

    // If at least one '@' sign, then assume that it is a VoIP URI.
    if ( number.contains(QChar('@')) )
        return CanHandle;

    // Probably an ordinary number, which may be gatewayable via VoIP.
    // TODO: may want to user to be able to choose to turn this on/off.
    return CanHandle;
}
Exemple #6
0
/*!
    \reimp
*/
QString VoIPManager::registrationMessage() const
{
    // Don't display anything if we do not have a VoIP service active yet.
    if ( !d->netReg )
        return QString();

    QString voipMsg;
    QTelephony::RegistrationState v = registrationState();

    switch (v) {
    case QTelephony::RegistrationNone:
        if(!d->voipHideMsg)
            voipMsg = tr("No VoIP network");
        break;
    case QTelephony::RegistrationHome:
    case QTelephony::RegistrationUnknown:
    case QTelephony::RegistrationRoaming:
        break;
    case QTelephony::RegistrationSearching:
        voipMsg = tr("Searching VoIP network");
        break;
    case QTelephony::RegistrationDenied:
        voipMsg += tr("VoIP Authentication Failed");
        break;
    }

    // If no registration, we want to hide the message after
    // some time, because the VoIP service may not be configured.
    if(v == QTelephony::RegistrationNone) {
        if(!d->voipHideMsg && !d->voipHideMsgTimer->isActive())
            d->voipHideMsgTimer->start(7000);
    } else {
        d->voipHideMsgTimer->stop();
        d->voipHideMsg = false;
    }

    return voipMsg;
}
Exemple #7
0
/*!
    \reimp
*/
QString CellModemManager::registrationMessage() const
{
    QString cellMsg;

    switch (registrationState()) {
        case QTelephony::RegistrationNone:
            if (!cellModemAvailable()) {
                cellMsg = tr("No modem");
            } else if (planeModeEnabled()) {
                cellMsg = tr("Airplane safe mode");
            } else if (state() == SIMMissing) {
                cellMsg = tr("Missing SIM");
            } else {
                cellMsg = tr("No network");
            }
            break;
        case QTelephony::RegistrationHome:
            // Nothing - this is the normal state
            break;
        case QTelephony::RegistrationSearching:
            cellMsg = tr("Searching for network");
            break;
        case QTelephony::RegistrationDenied:
            cellMsg = tr("Network registration denied");
            break;
        case QTelephony::RegistrationUnknown:
            //We can't do calls anyway
            cellMsg = tr("No network");
            break;
        case QTelephony::RegistrationRoaming:
            // ### probably want to beep/show message to let user know.
            break;
    }

    return cellMsg;
}
Exemple #8
0
/*!
  Returns true if a network is registered, false otherwise.  A network is
  registered if registrationState() is either QTelephony::RegistrationHome or
  QTelephony::RegistrationRoaming.
 */
bool CellModemManager::networkRegistered() const
{
    return registrationState() == QTelephony::RegistrationHome ||
           registrationState() == QTelephony::RegistrationRoaming;
}