38 : resume_key(
std::numeric_limits<
std::uint32_t>::max())
40 bus = std::shared_ptr<dbus::Bus>(
new dbus::Bus(core::dbus::WellKnownBus::session));
41 bus->install_executor(dbus::asio::make_executor(bus));
42 worker = std::move(std::thread([
this]()
49 auto stub_service = dbus::Service::use_service(bus,
"com.canonical.indicator.power");
50 indicator_power_session = stub_service->object_for_path(dbus::types::ObjectPath(
"/com/canonical/indicator/power/Battery"));
59 if (worker.joinable())
69 std::shared_ptr<core::dbus::Property<core::IndicatorPower::PowerLevel>>
power_level;
70 std::shared_ptr<core::dbus::Property<core::IndicatorPower::IsWarning>>
is_warning;
75 cout << __PRETTY_FUNCTION__ << endl;
81 if (level ==
"low" || level ==
"very_low")
82 pause_all_multimedia_sessions();
90 resume_multimedia_session();
99 const media::Player::Configuration& conf)
101 auto player = std::make_shared<media::PlayerImplementation>(
102 conf.identity, conf.bus, conf.session, shared_from_this(), conf.key);
105 player->on_client_disconnected().connect([
this, key]()
117 cerr <<
"Could not find Player by key: " << key << endl;
139 cout <<
"Pausing Player with key: " << other_key << endl;
140 other_player->pause();
145 void media::ServiceImplementation::pause_all_multimedia_sessions()
153 cout <<
"Will resume playback of Player with key: " << d->resume_key << endl;
159 void media::ServiceImplementation::resume_multimedia_session()
168 cout <<
"Resuming playback of Player with key: " << d->resume_key << endl;
170 d->resume_key = std::numeric_limits<std::uint32_t>::max();