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
21
#include <
core/media/external_services.h
>
22
23
#include <core/property.h>
24
25
#include <memory>
26
27
namespace
core
28
{
29
namespace
ubuntu
30
{
31
namespace
media
32
{
33
namespace
power
34
{
35
// Enumerates known power levels.
36
enum class
Level
37
{
38
unknown
,
39
ok
,
40
low
,
41
very_low
,
42
critical
43
};
44
45
// Interface that enables observation of the system power state.
46
struct
BatteryObserver
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.
64
core::ubuntu::media::power::BatteryObserver::Ptr
make_platform_default_battery_observer
(
core::ubuntu::media::helper::ExternalServices
&);
65
}
66
}
67
}
68
}
69
#endif // CORE_UBUNTU_MEDIA_POWER_STATE_OBSERVER_H_
core::ubuntu::media::power::Level::very_low
core::ubuntu::media::power::Level::ok
core::ubuntu::media::helper::ExternalServices
Definition:
external_services.h:41
core::ubuntu::media::power::BatteryObserver
Definition:
battery_observer.h:46
core
Definition:
player.h:33
core::ubuntu::media::power::Level::critical
core::ubuntu::media
Definition:
player.h:37
core::ubuntu::media::power::BatteryObserver::Ptr
std::shared_ptr< BatteryObserver > Ptr
Definition:
battery_observer.h:49
core::ubuntu::media::power::Level
Level
Definition:
battery_observer.h:36
core::ubuntu::media::power::Level::low
core::ubuntu::media::power::Level::unknown
core::ubuntu::media::power::make_platform_default_battery_observer
core::ubuntu::media::power::BatteryObserver::Ptr make_platform_default_battery_observer(core::ubuntu::media::helper::ExternalServices &)
external_services.h
src
core
media
power
battery_observer.h
Generated on Thu Oct 26 2017 17:20:08 for Music Hub by
1.8.13