I have been listening this one (but it requires dbus still)

    /* Nokia MCE display_status_ind
     * No actual use with this, just make log entry. Display status returns 
string: "on", "dimmed" or "off"  */

    static QDBusConnection mceSignalconn = QDBusConnection::systemBus();
    mceSignalconn.connect("com.nokia.mce", "/com/nokia/mce/signal", 
"com.nokia.mce.signal", "display_status_ind",
                          &toholed, SLOT(handleDisplayStatus(const 
QDBusMessage&)));


In the signal handler I just log it... have no use for it atm.

void Toholed::handleDisplayStatus(const QDBusMessage& msg)
{
    char buf[MAXBUF];

    QList<QVariant> args = msg.arguments();

    sprintf(buf, "Display status changed to ""%s""", 
qPrintable(args.at(0).toString()));
    writeToLog(buf);
}


-kimmo


-----Original Message-----
From: devel-boun...@lists.sailfishos.org 
[mailto:devel-boun...@lists.sailfishos.org] On Behalf Of Arvid Fahlström Myrman
Sent: 20. helmikuuta 2014 20:17
To: devel@lists.sailfishos.org
Subject: Re: [SailfishDevel] Preventing auto sleep and detecting sleep mode

Well, I've at least solved the first problem by implementing a timer similar to 
the one used by ScreenBlank in Sailfish.Media (see 
/usr/lib/qt5/qml/Sailfish/Media/ScreenBlank.qml for reference), and it seems to 
work properly. I wonder though, how are we developers supposed to know about 
these DBus services? Are they documented somewhere? I also suspect that the 
org.nemomobile.dbus import won't be allowed in Harbour, though I assume that it 
should be possible to just ship the module along with my application.

I'm still looking for a way to detect when the screen goes blank, i.e. when the 
device enters sleep mode. Any ideas?

Regards,
Arvid

On Monday 17 February 2014 00:52:22 you wrote:
> Hi,
> 
> I have two questions relating to sleep mode:
> 
> First, is it possible for an application to prevent the Jolla from 
> automatically entering sleep mode e.g. while on a specific page? An 
> example use case would be when using navigation apps while driving, 
> where you need the screen to be on at all times, and you don't want to 
> have to use your hands to prevent the screen from going black.
> 
> Second, is it possible to detect when the device enters sleep mode? So 
> far I've been checking if either ApplicationWindow.applicationActive 
> is true, or if Cover.status is either Active, Activating or 
> Deactivating, to see if the application is currently "visible", but it 
> seems that sometimes when entering sleep mode while an application is 
> active, ApplicationWindow.applicationActive will remain true during 
> sleep mode (and when unlocking the device I'll be met by the 
> application rather than the lock screen).
> 
> Regards,
> Arvid

_______________________________________________
SailfishOS.org Devel mailing list
_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to