Ejemplo n.º 1
0
/*!
  Sends a busy signal to an incoming call.
*/
void DialerControl::sendBusy()
{
    if ( hasIncomingCall() )
    {
        incomingCall().hangup();
    }
}
Ejemplo n.º 2
0
/*!
  Ends the current call(s).  The current call(s) is searched for in this order:

  1. Currently dialing call
  2. Active calls
  3. Incoming call
  4. Calls on Hold
*/
void DialerControl::endCall()
{
    QList<QPhoneCall> calls = activeCalls();
    if ( active().dialing() ) {
        active().hangup();
    } else if ( calls.count() ) {
        QList<QPhoneCall>::Iterator iter;
        for ( iter = calls.begin(); iter != calls.end(); ++iter ) {
            if ((*iter).state() == QPhoneCall::Connected ||
                (*iter).state() == QPhoneCall::Dialing ||
                (*iter).state() == QPhoneCall::Alerting) {
                (*iter).hangup();
            }
        }
    } else if ( hasIncomingCall() ) {
        incomingCall().hangup();
    } else if ( hasCallsOnHold() ) {
        calls = callsOnHold();
        QList<QPhoneCall>::Iterator iter;
        for ( iter = calls.begin(); iter != calls.end(); ++iter ) {
            if ((*iter).state() == QPhoneCall::Hold)
                (*iter).hangup();
        }
    }
}
Ejemplo n.º 3
0
/*!
    Deflect the incoming call to a new \a number.
*/
void DialerControl::deflect( const QString& number )
{
    if ( hasIncomingCall() )
    {
        incomingCall().transfer( number );
    }
}
Ejemplo n.º 4
0
void HtcuniversalCallProvider::htcdisSlot(const QString &str)
{
  QModemCall *call;
  if ((call = incomingCall()) != 0)
    missedTimeout(call);
  else
    hangupRemote(0);
}
Ejemplo n.º 5
0
void NeoCallProvider::clcc(bool, const QAtResult & result)
{
    QModemCall *ic = incomingCall();
    bool icMissing = true;

    int count = 0;

    // Find the current state of the call in the AT+CLCC results.
    QAtResultParser parser(result);
    while (parser.next("+CLCC:")) {
        uint id = parser.readNumeric();
        parser.readNumeric();   // dir
        uint state = parser.readNumeric();
        uint mode = parser.readNumeric();
        parser.readNumeric();   // mpty
        QString number = QAtUtils::decodeNumber(parser);
        QString callType = resolveCallMode(mode);
        //qDebug() << "=============== CLCC id=" << id << ", state =" << state <<
        //    ", mode=" << mode << ", number=" << number << "callType=" << callType;

        if (state == 4) {       // incoming
            if (ic && ic->number() == number) {
                icMissing = false;  // still ringing
            } else {            // new incoming call
                QModemCallProvider::ringing(number, callType, id);
                announceCall();
                clccTimer.start(CLCC_POLL_INTERVAL);
                return;
            }
        }
        count++;
    }

    // We still have call in incoming state
    if (ic) {
        if (icMissing) {
            qLog(Modem) << "Reporting missed call.";    // but it's missing in CLCC list
            ic->setState(QPhoneCall::Missed);   // make the call missed
            return;
        }
        clccTimer.start(CLCC_POLL_INTERVAL);    // continue with polling
        return;
    }
    // We still have some connected calls
    if (count > 0) {
        clccTimer.start(CLCC_POLL_INTERVAL);    // continue with polling
        return;
    }

    qLog(Modem) << "No more calls left";

    QList < QPhoneCallImpl * >list = calls();
    QList < QPhoneCallImpl * >::ConstIterator it;
    for (it = list.begin(); it != list.end(); ++it) {
        (*it)->setState(QPhoneCall::HangupRemote);
    }
}
Ejemplo n.º 6
0
void PhoneManager::connectToNcidServer()
{
    if (m_ncidClient) {
        m_ncidClient->close();
        m_ncidClient->deleteLater();
        m_connected = false;
    }

    m_ncidClient = new NcidClient;
    m_ncidClient->connectToHost (m_ncidHostIP, m_ncidHostPort, QIODevice::ReadOnly );
    connect(m_ncidClient, SIGNAL(newCallInfo(NcidClient::CallInfo)), this, SLOT(loggedCall(NcidClient::CallInfo)));
    connect(m_ncidClient, SIGNAL(incomingCall(NcidClient::CallInfo)), this, SLOT(incomingCall(NcidClient::CallInfo)));

    if (!m_ncidClient->waitForConnected(1000)) {
        qDebug() << "NCID Client Connection Error";
        m_ncidClient->deleteLater();
    }
}
Ejemplo n.º 7
0
void NeoCallProvider::cnapNotification( const QString& msg )
{
    // Calling name presentation from the network.
    uint posn = 6;
    QAtUtils::skipField( msg, posn );	    // pres_mode
    QAtUtils::skipField( msg, posn );	    // dcs
    QAtUtils::skipField( msg, posn );	    // name_length
    QString name = QAtUtils::nextString( msg, posn );
    QModemCall *call = incomingCall();
    if ( call )
        call->emitNotification( QPhoneCall::CallingName, name );
}
Ejemplo n.º 8
0
void MDeviceState::callPropChanged()
{
    QString val = call_prop->value().toString();
    incoming_call = false;
    if (val == "active") {
        ongoing_call = true;
        emit callStateChange(true);
    } else if (val == "alerting") {
        incoming_call = true;
        ongoing_call = false;
        emit incomingCall();
    } else {
        ongoing_call = false;
        emit callStateChange(false);
    }
}
Ejemplo n.º 9
0
int CardDevice::at_response_clip(char* str, size_t len)
{
    if (m_initialized && m_needring == 0)
    {
	m_incoming = 1;
	String clip = at_parse_clip(str, len);
	if (clip.null())
	    Debug(DebugAll, "[%s] Error parsing CLIP: %s", c_str(), str);
	if(incomingCall(clip) == false)
	{
	    Debug(DebugAll, "[%s] Unable to allocate channel for incoming call", c_str());
	    m_commandQueue.append(new ATCommand("AT+CHUP", CMD_AT_CHUP));
	    return -1;
	}
	m_needchup = 1;
	m_needring = 1;
    }
    return 0;
}
Ejemplo n.º 10
0
void SailfishPlatform::onActiveVoiceCallStatusChanged()
{
    VoiceCallHandler* handler = m_voiceCallManager->activeVoiceCall();

    if (!handler || handler->handlerId().isNull()) {
        return;
    }

    switch ((VoiceCallHandler::VoiceCallStatus)handler->status()) {
    case VoiceCallHandler::STATUS_ALERTING:
    case VoiceCallHandler::STATUS_DIALING:
        qDebug() << "Tell outgoing:" << handler->lineId();
        //emit outgoingCall(handlerId, handler->lineId(), m_voiceCallManager->findPersonByNumber(handler->lineId()));
        break;
    case VoiceCallHandler::STATUS_INCOMING:
    case VoiceCallHandler::STATUS_WAITING:
        qDebug() << "Tell incoming:" << handler->lineId();
        if(handler->getState() < VoiceCallHandler::StateRinging) {
            handler->setState(VoiceCallHandler::StateRinging);
            emit incomingCall(qHash(handler->handlerId()), handler->lineId(), m_voiceCallManager->findPersonByNumber(handler->lineId()));
        }
        break;
    case VoiceCallHandler::STATUS_NULL:
    case VoiceCallHandler::STATUS_DISCONNECTED:
        qDebug() << "Endphone " << handler->handlerId();
        if(handler->getState() < VoiceCallHandler::StateCleanedUp) {
            handler->setState(VoiceCallHandler::StateCleanedUp);
            emit callEnded(qHash(handler->handlerId()), false);
        }
        break;
    case VoiceCallHandler::STATUS_ACTIVE:
        qDebug() << "Startphone" << handler->handlerId();
        if(handler->getState() < VoiceCallHandler::StateAnswered) {
            handler->setState(VoiceCallHandler::StateAnswered);
            emit callStarted(qHash(handler->handlerId()));
        }
        break;
    case VoiceCallHandler::STATUS_HELD:
        qDebug() << "OnHold" << handler->handlerId();
        break;
    }
}
Ejemplo n.º 11
0
void Ofono::propertyChanged(const QString &_name, const QDBusVariant &_value)
{
    qDebug() << "inside propertyChanged()";
    if(_name == "Calls")
    {
        const QVariant var = _value.variant();
        QDBusArgument dbusArgument = var.value<QDBusArgument>();
        //qDebug()<<var;
        dbusArgument.beginArray();
        while(!dbusArgument.atEnd())
        {
            QDBusObjectPath opath;
            dbusArgument >> opath;
            m_path = opath.path();
            OrgOfonoVoiceCallInterface *call = new OrgOfonoVoiceCallInterface ("org.ofono", m_path, QDBusConnection::systemBus());
            QVariantMap properties=call->GetProperties();
            QVariant property=properties.value("State");

            QString value=property.value<QString>();
            if(value=="dialing")
            {
                qDebug()<<"dialing";
            }
            else if(value=="incoming")
            {
                QVariant callIDProperty= properties.value("LineIdentification");
                QString callerID =callIDProperty.value<QString>();
                qDebug() << "incoming";
                emit incomingCall(callerID);
            }else if(value == ""){
                //what to do when phonecall is aborted?
                emit phoneCallAborted();
            }
        }
    }
}
Ejemplo n.º 12
0
void DialerControl::callStateChanged( const QPhoneCall& call )
{
    // Set value space appropriately
    // XXX Optimize for redundancy!
    if(hasIncomingCall()) {
        QPhoneCall icall = incomingCall();
        QString number = icall.number();
        QString name;
        QUniqueId contact = icall.contact();
        QContactModel *m = ServerContactModel::instance();
        if(!contact.isNull()) {
            QContact cnt = m->contact(contact);
            if (!cnt.uid().isNull())
                name = cnt.label();
        } else if(!number.isEmpty()) {
            QContact cnt = m->matchPhoneNumber(number);
            if (!cnt.uid().isNull())
                name = cnt.label();
        } else {
            number = tr("Unknown", "Unknown caller");
        }
        phoneValueSpace.setAttribute("Incoming/Number", QVariant(number.trimmed()));
        phoneValueSpace.setAttribute("Incoming/Name", QVariant(name));

        if(!aaTid && mProfiles->activeProfile().autoAnswer())
            aaTid = startTimer(auto_answer_gap);
    } else {
        if(aaTid)
            killTimer(aaTid);
        phoneValueSpace.removeAttribute("Incoming");
    }

    // emit useful signals
    if( call.state() == QPhoneCall::Connected )
    {
        emit callConnected( call );
        // update cached call info.
        updateCachedCall( call );
    }
    else if( call.state() == QPhoneCall::Hold )
    {
        emit callPutOnHold( call );
    }
    else if( call.dialing() )
    {
        emit callDialing( call );
    }
    else if( call.incoming() )
    {
        // Turn off screen saver so the incoming call will be visible.
        QtopiaPowerManager::setActive(false);

        emit callIncoming( call );
    }
    else if ( call.dropped()  )
    {
        emit callDropped( call );
    }
    doActiveCalls();

    // Disable screen saver if in a call
    if (hasIncomingCall() || hasActiveCalls() || hasCallsOnHold())
        QtopiaApplication::setPowerConstraint(QtopiaApplication::DisableLightOff);
    else
        QtopiaApplication::setPowerConstraint(QtopiaApplication::Enable);

    emit stateChanged();
}
Ejemplo n.º 13
0
/**
*@brief The main function that intializes the system and communicates with the BT module
*@retval None
*@note The blueToothConfig function needs only be called once to setup the module.
*/
void main(void)
{
	init_comms(); 	//Setup UART
	init(); 		//Setup IO, Interupts, and Special UART

	RINGER_HARDWARE = 0; // make sure we are in low power mode
	
	DelayMs(500);
	
//	blueToothConfig(); //Configure BT Module
	CREN = 0;
	while(1)
	{		
	//	sendString("PIC ON\r\n");			
		while(!connected)
		{
			//Clear message & setup for recieve
			for(i = 0; i<MAX_MESSAGE_SIZE; i++)
			{
				message[i] = 0;
			}
			messageIndex = 0;
			messageComplete = 0;
		//	sendString("Waiting for Phone to Connect\r\n");			
			DelayMs(500);
			CREN = 1; //Enable UART interupt for message recieve
			RCIE = 1;
			while(!messageComplete); //wait to recieve message
			RCIE = 0;
			CREN  = 0; //Process message

			if( strnicmp(message, "RING 0",6) == 0 )
			{
				connected = 1; //We are connected so change flag
				ring(SHORT_RING); //Signals User
			}
		
			//Prep ISR for next read	
			for(i = 0; i<MAX_MESSAGE_SIZE; i++)
			{
				message[i] = 0;
			}
			messageIndex = 0;
			messageComplete = 0;
		}

		//	sendString("CONNECTED TO PHONE\r\n");
			DelayMs(500);
			DelayMs(500);
			DelayMs(500);
			DelayMs(500);

			
		while(connected)
		{

			while( HOOK == 0)
			{
				for(i = 0; i<MAX_MESSAGE_SIZE; i++)
				{
					message[i] = 0;
				}
				messageIndex = 0;
				messageComplete = 0;
				
				CREN = 1;
				RCIE = 1;			
				while(!messageComplete && HOOK == 0); //check if the ISR is finished
				RCIE = 0; //Process Message
				CREN = 0;
				
				//Check if there is an incoming call
				if(strnicmp(message, "HFP 0 RING", 10) == 0 )
				{
					DelayMs(500);
					incomingCall();
				}
				//check if we disconnected aswell
				/*
				else if(strnicmp(message, "NO CARRIER 0", 12) == 0)
				{
					connected = 0;
					break; //Leave the loop so we can restablish a connection
				}
				*/

			}
			call();
		}
			
	}

}	
Ejemplo n.º 14
0
/* Wrappers for proper thread handling */
void QVDoorcom::onIncomingCall_wrapper(int call_id) {
    emit incomingCall(call_id);
}