Active Topics

 


Reply
Thread Tools
Posts: 9 | Thanked: 2 times | Joined on Apr 2010 @ Brno, Czech republic
#1
Hello all,
I'm started develop one application which use Qt, QDBus for display incoming call. I try connect to com.nokia.csd.Call via QDBusConnection. This connection is OK, I receive TRUE. But if I call to my phone from other phone, incomming call isn't displayed!

See below for my code.

My class is:

class MyClass : public QObject
{
Q_OBJECT

public:
MyClass(QObject *parent = 0);
~MyClass(){}

public slots:
void receiveCall(QString path, QString callNum);
}


method "receiveCall" is implemented as:

void MyClass::receiveCall(QString path, QString callNum)
{
QLabel label;
...
label.show();
label.setText("Incoming call: " + path + " " + callNum);
}


In main.cpp:

static QDBusConnection conn = QDBusConnection::systemBus();

int main(int argc, char *argv[])
{
QApplication a(argc, argv);

QLabel label;
....

MyClass *mycall = new MyClass();
bool result = conn.connect("com.nokia.csd.Call", "/com/nokia/csd/call", "com.nokia.csd.Call", "Coming", mycall, SLOT(receiveCall(QString,QString)));

if(result)
{
label.setText("DBus connected OK!");
}
else
{
label.setText("DBus connected ERROR!");
}

return a.exec();
}


After start application I see text "DBus connected OK!". When I call to phone with application, so no label with text "Incoming call: ..." isn't see. Where is problem? Where do I error?

Thanks all

Last edited by prklic; 2010-04-22 at 11:02.
 
Posts: 6 | Thanked: 3 times | Joined on Apr 2010
#2
Hi,
I have used QT but not on maemo, so my answer would not be maemo specific.
Looks like the problem is that your QLabel object is created on the stack and destroyed after the slot returns. so what you should do is create the QLabel as a datamember of MyClass and create it in the MyClass contructor. Use the same QLabel in main and in the MyClass::receiveCall() slot.

hope this helps.
 
Posts: 9 | Thanked: 2 times | Joined on Apr 2010 @ Brno, Czech republic
#3
Hi,
I'm try it, but not help .
 
Posts: 198 | Thanked: 76 times | Joined on Mar 2010
#4
quick idea: your label doesn't have a parent. where is it supposed to appear?
 
Posts: 9 | Thanked: 2 times | Joined on Apr 2010 @ Brno, Czech republic
#5
I want display call number, but if I'm add QLabel created in main function, to MyClass, doesn't work.
 
Posts: 6 | Thanked: 3 times | Joined on Apr 2010
#6
Try something in these lines. I haven't compiled it, so there may be some errors.

class MyClass : public QObject
{
Q_OBJECT

private:
QLabel *label;
public:
MyClass(QObject *parent = 0)
{
label = new QLabel();
}
~MyClass(){}
void setText(QString s)
{
label->setText(s);
}


public slots:
void receiveCall(QString path, QString callNum);
}

method "receiveCall" is implemented as:

void MyClass::receiveCall(QString path, QString callNum)
{
setText("Incoming call: " + path + " " + callNum);
}

In main.cpp:

static QDBusConnection conn = QDBusConnection::systemBus();

int main(int argc, char *argv[])
{
QApplication a(argc, argv);



MyClass *mycall = new MyClass();
bool result = conn.connect("com.nokia.csd.Call", "/com/nokia/csd/call", "com.nokia.csd.Call", "Coming", mycall, SLOT(receiveCall(QString,QString)));

if(result)
{
mycall->setText("DBus connected OK!");
}
else
{
mycall->setText("DBus connected ERROR!");
}

return a.exec();
}
 
Posts: 9 | Thanked: 2 times | Joined on Apr 2010 @ Brno, Czech republic
#7
Does not work. I think, that the signal "Coming" is processed via maemo application and don't next.
 
Posts: 6 | Thanked: 3 times | Joined on Apr 2010
#8
If your conn.connect() returns true then the signal is definitely connected and if the signal is ever emitted your slot would get called.
If conn.connect returns true then the issues would be one of these:
>You are not connected to the right signal
>The signal is not getting emitted.
 
Posts: 9 | Thanked: 2 times | Joined on Apr 2010 @ Brno, Czech republic
#9
I want something like http://maemocentral.com/2010/02/22/h...s-on-the-n900/ in Python but in Qt. Accordingly connect to signal "Comit". I think that signal name is OK, but maybe not work in Qt.
 
crabsody's Avatar
Posts: 63 | Thanked: 12 times | Joined on Feb 2010 @ Thessaloniki Greece
#10
I don't know much about Qt or QDbus but I have a question that might help. Who sets in your slot receiveCall that its arguments are the path and the callNum? Maybe you should create a QDBusMessage and have a connection like this

bool result = conn.connect("com.nokia.csd.Call", "/com/nokia/csd/call", "com.nokia.csd.Call", "Coming", mycall, SLOT(receiveCall(const QDBusMessage&)));
 

The Following User Says Thank You to crabsody For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 09:03.