Tuesday, May 18, 2010

How to disable Blank display on Mameo from Qt application

I have created a game for N900 which take input from accelerometer and move game object around. In this case user don't have to touch on screen and platform was assuming that user it idle and is making display off.

To avoid display off, Maemo is providing DBUS API using which you can disable display off.

Following is Qt code to send dbus call to disable display off. You need to call this method at least once in every 60 seconds to avoid display off.

QDBusConnection::systemBus().call(QDBusMessage::createMethodCall(MCE_SERVICE, 
MCE_REQUEST_PATH,MCE_REQUEST_IF, MCE_PREVENT_BLANK_REQ));

You will also need to include "mce/mode-names.h","mce/dbus-names.h" and "QtDBus" headers and add dbus support in Qt's pro file.

I hope this will help to someone facing similar problem.

No comments:

Post a Comment