![]() |
Problem: QDBus and connect to com.nokia.csd.Call
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 |
Re: Problem: QDBus and connect to com.nokia.csd.Call
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. |
Re: QDBus and connect to com.nokia.csd.Call
Hi,
I'm try it, but not help :( . |
Re: QDBus and connect to com.nokia.csd.Call
quick idea: your label doesn't have a parent. where is it supposed to appear?
|
Re: QDBus and connect to com.nokia.csd.Call
I want display call number, but if I'm add QLabel created in main function, to MyClass, doesn't work.
|
Re: QDBus and connect to com.nokia.csd.Call
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(); } |
Re: QDBus and connect to com.nokia.csd.Call
Does not work. I think, that the signal "Coming" is processed via maemo application and don't next.
|
Re: QDBus and connect to com.nokia.csd.Call
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. |
Re: QDBus and connect to com.nokia.csd.Call
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.
|
Re: QDBus and connect to com.nokia.csd.Call
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&))); |
Re: QDBus and connect to com.nokia.csd.Call
Ι tested the above code and it works. Of course the question is how can we obtain the call number? :D
|
Re: QDBus and connect to com.nokia.csd.Call
Thanks for the kind. It works :). You can use for get the callnumber:
QList<QVariant> lst = msg.arguments(); QVAriant var; foreach(var, lst) { SetText(var.toString()); } |
Re: QDBus and connect to com.nokia.csd.Call
prklic (or anyone else) do you know how can I check other things regarding phone? I mean how can I count the time of each of my calls for example? I am not satisfied from the call timer of N900
|
Re: QDBus and connect to com.nokia.csd.Call
I try to catch a signal when someone answers my call. When I executed dbus-monitor during such call I got this
Code:
signal sender=:1.17 -> dest=(null destination) serial=1824 path=/com/nokia/csd/call/1; interface=com.nokia.csd.Call.Instance; member=AudioConnect Code:
bus.connect("com.nokia.csd.Call.Instance", "/com/nokia/csd/call/1", "com.nokia.csd.Call.Instance", "AudioConnect", this, SLOT(handleCall(const QDBusMessage&))); |
Re: QDBus and connect to com.nokia.csd.Call
You try use:
bus.connect("com.nokia.csd.Call", "/com/nokia/csd/call/1", "com.nokia.csd.Call.Instance", "AudioConnect", this, SLOT(handleCall(const QDBusMessage&))); |
All times are GMT. The time now is 18:21. |
vBulletin® Version 3.8.8