PDA

View Full Version : How to use ServiceRequest?



DenisL
2nd November 2007, 18:25
I'm trying to start another app on the greenphone.

I'm finding it hard to find any information, anywhere, on ServiceRequest, apart from the QT docs, maybe because it is so simple?

As a simple test, I tried the following modification to the example app:

/*
* Constructs a Example which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
Example::Example( QWidget *parent, Qt::WFlags f )
: ExampleBase( parent, f )
{
connect(quit, SIGNAL(clicked()), this, SLOT(goodBye()));

QtopiaServiceRequest req("Alert", "soundAlarm()");
req.send();
}

Unfortunately, nothing happened, or at least nothing appeared to happen.

I have a lot to learn about QT, but this looks to me like it should send a ServiceRequest to the alert service, asking it to sound an alarm. What could possibly go wrong ... ?

Is the problem the actual code making the Servicerequest, or the position of the code within the QT application?

Any help here would be gratefully received :)

Thanks,

Denis

jacek
2nd November 2007, 19:58
Shouldn't it be "soundAlert()"?

DenisL
5th November 2007, 12:37
You're right, it should be soundAlert().

However, that still doesn't appear to beep on the VM, even when corrected.

I'm actually trying to get the camera up, but went for several things that would be visible/audible on the VM system.

My logic for choosing an example ServiceRequest is:

1) Look in the services folder, for .service files.
2) Pick one that should be simple to call up, and use its Actions field.

I tried "Clock", "showClock", but there is already a clock of sorts on the screen.
I tried "Alert", "soundAlert", but there is no sound.

So, I'm wondering whether I'm just being unlucky here, or whether I'm calling it in the wrong way, or whether I'm calling it from the wrong place.

If I figure this out, I can then get further. I used the email There just doesn't seem to be any documentation on this that has examples. Googling for ServiceRequest now lists this thread as almost its top response, which isn't good :(

Thanks for your help.

jacek
6th November 2007, 01:20
What does req.send() return?

DenisL
9th November 2007, 19:13
Jacek,

I'm afraid I'm having trouble even doing this. Every time I try to debug the app, I run the runqpe, and then the debugger. But when i load the executable into the debugger, i get the message "could not start the debugger process" and "Please shut down KDbg and resolve the problem". But there is no KDbg instance running in ps -ea, apart from this one.

So I am completely stuck now. I feel a complete muppet! :)

Any ideas how to get past the debugger issue, so I can then examine the return value?

Thanks for your help on this!

jacek
13th November 2007, 01:51
I can't help you with the debugger, but you can always write debugging data to some log (file, console or even a socket) or use some widget to display it (label->setText( x? "XXX" : "YYY" )).