Music Hub ..
A session-wide music playback service
battery_observer.h
Go to the documentation of this file.
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Thomas Voß <thomas.voss@canonical.com>
17 */
18#ifndef CORE_UBUNTU_MEDIA_POWER_STATE_OBSERVER_H_
19#define CORE_UBUNTU_MEDIA_POWER_STATE_OBSERVER_H_
20
22
23#include <core/property.h>
24
25#include <memory>
26
27namespace core
28{
29namespace ubuntu
30{
31namespace media
32{
33namespace power
34{
35// Enumerates known power levels.
36enum class Level
37{
38 unknown,
39 ok,
40 low,
43};
44
45// Interface that enables observation of the system power state.
47{
48 // To safe us some typing.
49 typedef std::shared_ptr<BatteryObserver> Ptr;
50
51 BatteryObserver() = default;
52 virtual ~BatteryObserver() = default;
53
54 // A getable/observable property reporting the current power-level
55 // of the system.
56 virtual const core::Property<Level>& level() const = 0;
57 // A getable/observable property indicating whether a power-level
58 // warning is currently presented to the user.
59 virtual const core::Property<bool>& is_warning_active() const = 0;
60};
61
62// Creates a BatteryObserver instance that connects to the platform default
63// services to observe battery levels.
65}
66}
67}
68}
69#endif // CORE_UBUNTU_MEDIA_POWER_STATE_OBSERVER_H_
core::ubuntu::media::power::BatteryObserver::Ptr make_platform_default_battery_observer(core::ubuntu::media::helper::ExternalServices &)
Definition: player.h:34
virtual const core::Property< Level > & level() const =0
virtual const core::Property< bool > & is_warning_active() const =0
std::shared_ptr< BatteryObserver > Ptr