You need following: https://github.com/CODeRUS/harbour-lgremote-webos/blob/master/qml/main.qml#L58

------ Исходное сообщение ------
От: "jerome levreau" <levreau.jer...@vostoksystem.eu>
Кому: "Sailfish OS Developers" <devel@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-unsubscr...@lists.sailfishos.org

Reply via email to