129 if (state == media::power::SystemState::suspend) {
133 QDBusPendingCall call =
134 m_interface.asyncCall(
"requestSysState",
135 QStringLiteral(
"media-hub-playback_lock"),
136 static_cast<int32_t
>(state));
137 auto watcher =
new QDBusPendingCallWatcher(call);
138 QObject::connect(watcher, &QDBusPendingCallWatcher::finished,
139 [
this, state, cb](QDBusPendingCallWatcher *watcher) {
140 QDBusPendingReply<QString> reply = *watcher;
141 if (reply.isError()) {
142 MH_ERROR() <<
"Error requesting system state:" << reply.error().message();
144 m_cookieStore.insert(state, reply.value());
147 watcher->deleteLater();
154 if (state == media::power::SystemState::suspend) {
157 const auto i = m_cookieStore.find(state);
158 if (i == m_cookieStore.end()) {
162 QDBusPendingCall call = m_interface.asyncCall(
"clearSysState", i.value());
163 auto watcher =
new QDBusPendingCallWatcher(call);
164 QObject::connect(watcher, &QDBusPendingCallWatcher::finished,
165 [
this, state, cb](QDBusPendingCallWatcher *watcher) {
166 QDBusPendingReply<void> reply = *watcher;
167 if (reply.isError()) {
168 MH_ERROR() <<
"Error releasing system state:" << reply.error().message();
170 m_cookieStore.remove(state);
173 watcher->deleteLater();