From: Naresh Mehta Date: Wed, 4 Aug 2010 16:46:49 +0000 (+0200) Subject: Everything working fine now. Tested with InterCall conferencing X-Git-Url: http://git.maemo.org/git/?p=confmgr;a=commitdiff_plain;h=98dd960ae80ce287955b1b3f0a5044e29dfc03f5 Everything working fine now. Tested with InterCall conferencing System. Only changes remaining to be done are for the UI. Make it look a bit nicer. My stupidity was to not declare slots in the header which made my dbus.connect method fail. This has been corrected in this commit. --- diff --git a/confmanager.cpp b/confmanager.cpp index 4acbe45..b8d5cb0 100644 --- a/confmanager.cpp +++ b/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() << "Sending 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,12 @@ 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); } // 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 +51,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 +69,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 +87,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 +103,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,14 +125,15 @@ 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; } @@ -138,44 +146,48 @@ void confManager::StopCallMonitors() 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!"; diff --git a/confmanager.h b/confmanager.h index 5e86bba..c8d9175 100644 --- a/confmanager.h +++ b/confmanager.h @@ -22,13 +22,15 @@ public: void setProfile(Profile &p); void startConference(); -private: +public slots: void sendDTMF(const QDBusMessage &dBusMessage); - void StartCallMonitors(); void StopCallMonitors(); void continueSendDTMF(); private: + void StartCallMonitors(); + +private: Profile mProfileInUse; bool mProfileSet; DbusUtility mDBusUtility;