maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   How to create Qt service? (https://talk.maemo.org/showthread.php?t=67039)

uvatbc 2010-12-16 02:35

Re: How to create Qt service?
 
Quote:

Originally Posted by smandava (Post 897800)
I am noob to the Qt Programming. I would love to get the GData parser if you have available.

This file has the code that logs into the contacts API and sends the requests to fetch the contacts - either all of them or from a specific date.
The function onGotContacts is the one which begins the parsing of the XML data returned by the Google Contacts API.

This file has the XML parser for the contacts data that you get from the previous file.

uvatbc 2010-12-16 02:41

Re: How to create Qt service?
 
Quote:

Originally Posted by smandava (Post 897813)
Great. I wish there is a Qt API for alarmd.

Almost all QT classes that might be long running have signals to indicate completion. So if you use signals intelligently, there should be no CPU usage by your app while "waiting" for a QTimer to fire.

tl;dr: Use a QTimer and quickly get to the more interesting bits :p

javispedro 2010-12-16 02:46

Re: How to create Qt service?
 
Quote:

Originally Posted by smandava (Post 897813)
Great. I wish there is a Qt API for alarmd.

You do not need it, the C API will work.

Note thought that it is Maemo-specific.

MohammadAG 2010-12-16 11:04

Re: How to create Qt service?
 
A QTimer of 1000ms didn't affect my CPU much, so I guess it's light on processing/battery power :P

kif 2010-12-16 21:11

Re: How to create Qt service?
 
Quote:

Originally Posted by smandava (Post 897800)
I guess what Kim mentioned above is QtMobilty Contacts Api opens the address book for the user who started the process. For instance QContactManager.contacts() calls gives different results for user account and developer account even tho its the same binary is making the call.

You are mostly right, but it was very late ;)

What I meant is that a daemon (QtService application) started from event.d (used in maemo) while booting will try to access for instance QContactManager.contacts() as root and not as user, resulting in many interesting errors.

The solution is to start the daemon as user (what I in the sleep deprived state I was in, called for user space), this is done by starting the daemon with the following command in event.d :

Code:

su -c '<path and name of your daemon>' -l user
After that everything should work as usual, with the exception of the missing GUI.

Kim

smandava 2010-12-17 04:11

Re: How to create Qt service?
 
Code:

su -c '<path and name of your daemon>' -l user
Thanks for the clarification and the event.d info.


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

vBulletin® Version 3.8.8