[SailfishDevel] Preventing auto sleep and detecting sleep mode
Arvid Fahlström Myrman
behold at behold.se
Thu Mar 20 13:09:02 UTC 2014
I've been using nemo-keepalive's DisplayBlanking
(https://github.com/nemomobile/nemo-keepalive) as per Ove's recommendation
earlier in this thread. I did have to write my own qmake project file to be
able to compile nemo-keepalive and place it in the correct directory without
having to make any changes to the actual nemo-keepalive repository, but that
was a relatively painless task. If you're interested, here's the project file:
If you want to use it (I'm going to assume that you're already using git here,
if not just replace 'submodule add' with 'clone'), just run the following
somewhere in your repository:
git submodule add https://github.com/nemomobile/nemo-keepalive.git
git submodule add https://github.com/nemomobile/libiphb.git
Then place nemo-keepalive.pro and the qmldir file to the same directory. Make
sure that you replace "PROJECT_NAME_HERE" with your actual project name (sans
'harbour-') on line 8 and 14 in nemo-keepalive.pro and on the first line in the
qmldir file. Then make sure that your main project file has the 'subdirs'
template, and add nemo-keepalive.pro to the SUBDIRS variable. Once compiled
and installed, you should be able to import the plugin using "import
harbour.PROJECT_NAME_HERE.keepalive 1.0", after which you can set
DisplayBlanking.preventBlanking to true whenever you want to prevent the
device from sleeping.
You may need to have libiphb-devel installed in order for the iphb-related
files to compile, as the include paths are probably off.
On Thursday 20 March 2014 06:35:52 frances frederic wrote:
> hi all
> I've used dbus package to prevent jolla from sleeping using same code as
> /usr/lib/qt5/qml/Sailfish/Media/ScreenBlank.qml but it seems to be not
> allwed by jolla validation team when submitting to harbour. ERROR
> [/usr/share/harbour-upnpplayer/qml/pages/FirstPage.qml] Import
> 'org.nemomobile.dbus 1.0' is not allowed
> is there a qml alternative to prevent jolla from sleeping?
> Le Vendredi 21 février 2014 0h29, Ove Kåven <ovek at arcticnet.no> a écrit :
> Den 20. feb. 2014 19:16, skrev Arvid Fahlström Myrman:
> > 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?
> Similar questions have already been answered in the past on this list,
> at least. From the answers I got earlier, I understand that
> - all the MCE D-Bus calls are documented in
> - there's a more friendly API under development at
> https://github.com/nemomobile/nemo-keepalive, which seems to have both
> C++ and QML interfaces (which both does exactly what you're asking for,
> including telling you when the screen goes blank). Presumably, when it's
> ready and deployed, that is what Jolla will tell developers about, and
> allow imports of.
> In the meantime, you may just have to write some C++ code that you can
> use from your QML (or copy what you need of that nemo-keepalive into
> your C++ code).
> SailfishOS.org Devel mailing list
More information about the Devel