1 #ifndef MAFWGSTRENDERERVOLUME_H
2 #define MAFWGSTRENDERERVOLUME_H
10 class DBusPendingCall;
13 * Provides volume setting, getting and listening functionality using
14 * PulseAudioMainVolume DBus API.
16 class MafwGstRendererVolume : public QObject
23 MafwGstRendererVolume();
24 ~MafwGstRendererVolume();
27 * Get the volume level. Initial volume level is always got via volumeChanged signal.
28 * Before that signal returns always 0.
29 * @return The current volume level. Value is between 0 to 99.
34 * Set the volume level to pulse audio.
35 * @note Volume setting happens asynchronously
36 * and may wait until dbus connection to pulse audio is ready.
37 * @param The volume level to be set. Valid value range is between 0 to 99.
38 * @return true on success.
40 bool setVolume (uint value);
44 * Signal telling that volume level has been changed.
46 void volumeChanged(uint newLevel);
49 /** Makes p2p dbus connection to pulse audio. */
50 void connectToPulseAudio();
54 * Starts to listen signal from PulseAudioMainVolume DBus API
56 void listenVolumeSignals();
59 * Get the step configuration asynchronously from PulseAudioMainVolume
61 void getRestoreEntryForMediaRole();
64 * Catch signals from PulseAudioMainVolume telling that volume step configuration has been changed
66 static void handleIncomingMessages( DBusConnection* conn,
68 MafwGstRendererVolume* self);
71 * Catch reply callback for step configuration request from PulseAudioMainVolume.
73 static void getEntryReply(DBusPendingCall *pending, MafwGstRendererVolume *self);
75 static void volumeReply(DBusPendingCall *pending, MafwGstRendererVolume *self);
77 bool readVolumeFromStruct(DBusMessageIter *iterator);
80 /** The current volume step, values are between 0, used maximum volume level */
83 /** The volume step which is pending to be set. */
84 uint m_pendingVolumeValue;
86 /** The dbus connection object */
87 DBusConnection* m_dbusConnection;
91 /** The pending call. */
92 DBusPendingCall* m_pendingCall;
97 #endif // MAFWGSTRENDERERVOLUME_H