X-Git-Url: http://git.maemo.org/git/?p=confmgr;a=blobdiff_plain;f=src%2Fconfmanager.cpp;h=10fc21efedd20c7dcbb98efd382c02516c89d16d;hp=4acbe45b189f83653fab1ae91bcdedf45611eb8b;hb=4ce3be0451a1e12b091ac18b90aebf59de109a2f;hpb=fc9e638703f7b80c390289630b508499c05ca229 diff --git a/src/confmanager.cpp b/src/confmanager.cpp index 4acbe45..10fc21e 100644 --- a/src/confmanager.cpp +++ b/src/confmanager.cpp @@ -18,6 +18,7 @@ void confManager::setProfile(Profile &p) void confManager::continueSendDTMF() { + qDebug() << "In ContinueSendDTF for mInStep " << mInStep; // We have now waited for the required period of seconds // Lets send the DTMF now Steps step = mProfileInUse.mSteps.at(mInStep); @@ -26,7 +27,9 @@ void confManager::continueSendDTMF() mInStep++; QList argsToSend; + qDebug() << "DTMF = " << step.value(); argsToSend.append(step.value()); +// argsToSend.append(0); bool status = mDBusUtility.sendMethodCall(CSD_SERVICE, CSD_CALL_PATH, CSD_CALL_INTERFACE, QString("SendDTMF"),argsToSend); @@ -34,12 +37,14 @@ void confManager::continueSendDTMF() if(!status) { qDebug() << "Unable to send DTMF code."; - QString error = "DBus Error: " + mDBusUtility.getErrorMessage(); + QString error = "DBus Error (continueSendDTMF): " + mDBusUtility.getErrorMessage(); mDBusUtility.displayNotification(error); } + mDBusUtility.displayNotification(step.value()); + // Check if we are over with the sequence or we need to continue - if(mInStep > mProfileInUse.mNoOfSteps) + if(mInStep >= mProfileInUse.mNoOfSteps) { StopCallMonitors(); return; @@ -48,16 +53,17 @@ void confManager::continueSendDTMF() step = mProfileInUse.mSteps.at(mInStep); QTimer *timer = new QTimer(this); timer->setSingleShot(true); - connect(timer, SIGNAL(timeout()), this, SLOT(sendDTMF(const QDBusMessage &))); - timer->start(step.delay()); + connect(timer, SIGNAL(timeout()), this, SLOT(continueSendDTMF())); + qDebug() << "Setting delay for " << step.delay() << "seconds..."; + timer->start(step.delay()*1000); } void confManager::sendDTMF(const QDBusMessage &dBusMessage) { QList listArguments = dBusMessage.arguments(); - bool audioConnected = listArguments.first().toBool(); + bool audioConnect = listArguments.first().toBool(); - if(mInStep > mProfileInUse.mNoOfSteps) + if(mInStep >= mProfileInUse.mNoOfSteps) { StopCallMonitors(); return; @@ -65,14 +71,15 @@ void confManager::sendDTMF(const QDBusMessage &dBusMessage) Steps step = mProfileInUse.mSteps.at(mInStep); - if (audioConnected) + if (audioConnect) { - qDebug() << "Audio Connected..."; + qDebug() << "Call Active..."; //Wait for specified delay in the step QTimer *timer = new QTimer(this); timer->setSingleShot(true); connect(timer, SIGNAL(timeout()), this, SLOT(continueSendDTMF())); - timer->start(step.delay()); + qDebug() << "Setting delay for " << step.delay() << "seconds..."; + timer->start(step.delay()*1000); } } @@ -82,14 +89,15 @@ void confManager::StartCallMonitors() /* Declare the slot to be executed when a call is picked up by other party (Audio connection established). We need this to confirm whether a call went though successfully. */ - bool status = connection.connect(QString(""), CSD_CALL_INSTANCE_PATH, CSD_CALL_INSTANCE_INTERFACE, + bool status = connection.connect(CSD_CALL_SERVICE, CSD_CALL_INSTANCE_PATH, CSD_CALL_INSTANCE_INTERFACE, QString("AudioConnect"),this, SLOT(sendDTMF(const QDBusMessage&))); if(!status) { qDebug() << "Failed to connect to Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE; - QString error = "DBus Error: " + mDBusUtility.getErrorMessage(); + QString error = "DBus Error (StartCallMonitors): " + mDBusUtility.getErrorMessage(); mDBusUtility.displayNotification(error); + qDebug() << "Error is: " << error; } qDebug() << "Successfully connected to Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE; @@ -97,14 +105,15 @@ void confManager::StartCallMonitors() /* Declare the slot to be executed when the call is terminated (due to connection errors etc). We need this to avoid sending DTMF code on wrong calls. */ - status = connection.connect(QString(""), CSD_CALL_INSTANCE_PATH, CSD_CALL_INSTANCE_INTERFACE, + status = connection.connect(CSD_CALL_SERVICE, CSD_CALL_INSTANCE_PATH, CSD_CALL_INSTANCE_INTERFACE, QString("Terminated"),this, SLOT(StopCallMonitors())); if(!status) { qDebug() << "Failed to connect to Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE; - QString error = "DBus Error: " + mDBusUtility.getErrorMessage(); + QString error = "DBus Error (StartCallMonitors): " + mDBusUtility.getErrorMessage(); mDBusUtility.displayNotification(error); + qDebug() << "Error is: " << error; } qDebug() << "Successfully connected to Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE; @@ -118,64 +127,69 @@ void confManager::StartCallMonitors() then we stop sending the DTMF code even if user does not respond to the call. */ - status = connection.connect(QString(""), CSD_CALL_PATH, CSD_CALL_INTERFACE, + status = connection.connect(CSD_CALL_SERVICE, CSD_CALL_PATH, CSD_CALL_INTERFACE, QString("Coming"),this, SLOT(StopCallMonitors())); if(!status) { qDebug() << "Failed to connect to Dbus signal Coming in interface" << CSD_CALL_INTERFACE; - QString error = "DBus Error: " + mDBusUtility.getErrorMessage(); + QString error = "DBus Error (StartCallMonitors): " + mDBusUtility.getErrorMessage(); mDBusUtility.displayNotification(error); + qDebug() << "Error is: " << error; } qDebug() << "Successfully connected to Dbus signal Coming in interface" << CSD_CALL_INTERFACE; } void confManager::StopCallMonitors() { - mInStep = 0; +// mInStep = 0; mProfileSet = false; QDBusConnection connection = mDBusUtility.getConnection(); // Disconnect the slot for audio connection status - bool status = connection.disconnect(QString(""), CSD_CALL_INSTANCE_PATH, CSD_CALL_INSTANCE_INTERFACE, + bool status = connection.disconnect(CSD_CALL_BUS_NAME, CSD_CALL_INSTANCE_PATH, CSD_CALL_INSTANCE_INTERFACE, QString("AudioConnect"),this, SLOT(sendDTMF(const QDBusMessage&))); if(!status) { qDebug() << "Failed to disconnect from Dbus signal AudioConnect in interface" << CSD_CALL_INSTANCE_INTERFACE; - QString error = "DBus Error: " + mDBusUtility.getErrorMessage(); + QString error = "DBus Error (StopCallMonitors): " + mDBusUtility.getErrorMessage(); mDBusUtility.displayNotification(error); + qDebug() << "Error is: " << error; } qDebug() << "Successfully disconnected from Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE; // Disconnect the slot for monitoring terminated calls - status = connection.disconnect(QString(""), CSD_CALL_INSTANCE_PATH, CSD_CALL_INSTANCE_INTERFACE, + status = connection.disconnect(CSD_CALL_BUS_NAME, CSD_CALL_INSTANCE_PATH, CSD_CALL_INSTANCE_INTERFACE, QString("Terminated"),this, SLOT(StopCallMonitors())); if(!status) { qDebug() << "Failed to disconnect from Dbus signal Terminated in interface" << CSD_CALL_INSTANCE_INTERFACE; - QString error = "DBus Error: " + mDBusUtility.getErrorMessage(); + QString error = "DBus Error (StopCallMonitors): " + mDBusUtility.getErrorMessage(); mDBusUtility.displayNotification(error); + qDebug() << "Error is: " << error; } qDebug() << "Successfully disconnected from Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE; // Disconnect the slot for monitoring incoming calls - status = connection.disconnect(QString(""), CSD_CALL_PATH, CSD_CALL_INTERFACE, + status = connection.disconnect(CSD_CALL_BUS_NAME, CSD_CALL_PATH, CSD_CALL_INTERFACE, QString("Coming"),this, SLOT(StopCallMonitors())); if(!status) { qDebug() << "Failed to disconnect from Dbus signal Coming in interface" << CSD_CALL_INTERFACE; - QString error = "DBus Error: " + mDBusUtility.getErrorMessage(); + QString error = "DBus Error (StopCallMonitors): " + mDBusUtility.getErrorMessage(); mDBusUtility.displayNotification(error); + qDebug() << "Error is: " << error; } qDebug() << "Successfully disconnected from Dbus signal Coming in interface" << CSD_CALL_INTERFACE; } void confManager::startConference() { + mInStep = 0; if(!mProfileSet) { qDebug() << "Please set the profile to use with Conference Manager first!";