[SailfishDevel] listening for volume change

jerome levreau levreau.jerome at vostoksystem.eu
Wed Oct 26 23:30:41 UTC 2016


Hi andrey,
Tested your solution and it's working perfectly. I just have to call my
service from qml, then get the raw value from dbus. I'm doing something
like that for saving on exit.

Still curious why my connect isn't working. Anyway I'm considering my
question answered.

Thanks for the solution

2016-10-26 20:32 GMT+02:00 Andrey Kozhevnikov <coderusinbox at gmail.com>:

> You need following: https://github.com/CODeRUS/harbour-lgremote-
> webos/blob/master/qml/main.qml#L58
>
> ------ Исходное сообщение ------
> От: "jerome levreau" <levreau.jerome at vostoksystem.eu>
> Кому: "Sailfish OS Developers" <devel at lists.sailfishos.org>
> Отправлено: 26.10.2016 19:58:12
> Тема: [SailfishDevel] listening for volume change
>
> hi everyone,
>
> Here where I'm stuck : In my audio app, for a new functionality I would
> like to control volume. Now I'm trying to get a response (dbus signal) when
> user is changing volume with button (physical).
> My app has mpris2 control, I monitoring a read to the volume property (of
> org.mpris.MediaPlayer2.Player ) but never a write. I tried to look for a
> propertiesChanged in org.freedesktop.DBus.Properties, I'm seeing response
> in playback status, position, metadata, etc.. but never from volume change.
>
> Right now, I'm looking into pulseaudio with com.meego.mainvolume2
> https://wiki.merproject.org/wiki/Nemo/Audio/MainVolume
>
> I connect to pulse, I read current volume (CurrentStep), I can see it's
> changing between my tests, but my slot to the StepsUpdated signal never
> been called.
>
> Here my current code :
>
> //******************************************
>
> QDBusConnection bus = QDBusConnection::sessionBus();
> QDBusMessage call = QDBusMessage::createMethodCall("org.PulseAudio1",
>
> "/org/pulseaudio/server_lookup1",
>
> "org.freedesktop.DBus.Properties",
>                                                        "Get" );
> call << "org.PulseAudio.ServerLookup1" << "Address";
> QDBusReply<QDBusVariant> r = bus.call(call);
>
> if (r.isValid()) {
>         pulse = new QDBusConnection(QDBusConnection::connectToPeer(
>                            r.value().variant().toString(),
> "org.PulseAudio1"));
>
>          //****** this is working ****
>         call = QDBusMessage::createMethodCall("",
>                                               "/com/meego/mainvolume2",
>                                               "org.freedesktop.DBus.
> Properties",
>                                               "Get");
>         call << "com.Meego.MainVolume2" << "CurrentStep";
>         qDebug() << "CurrentStep : " << pulse->call(call).value().
> variant().toUInt();
>
> //***** connect, but never raise a callback ****
> //***** doing something similar with org.nemomobile.voicecall.VoiceCall
> and it's working fine
>          pulse->connect("",
>                                    "/com/meego/mainvolume2",
>                                    "com.Meego.MainVolume2",
>                                    "StepsUpdated",
>                                    this, SLOT(StepsUpdated(uint,uint)));
> }
>
> // *** my public slot code, never getting an answer
> void modeNuitService::StepsUpdated(uint StepCount, uint CurrentStep) {
>     qDebug() << "StepsUpdated " << StepCount << " " << CurrentStep;
> }
>
> //******************************************
>
> What do you think ? bad argument, bad method signature  or just bad
> solution ?
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.
> sailfishos.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20161027/2ab7069f/attachment.html>


More information about the Devel mailing list