Music Hub
..
A session-wide music playback service
state_controller.h
Go to the documentation of this file.
1
/*
2
* Copyright © 2014 Canonical Ltd.
3
* Copyright © 2022 UBports Foundation.
4
*
5
* Contact: Alberto Mardegan <mardy@users.sourceforge.net>
6
*
7
* This program is free software: you can redistribute it and/or modify it
8
* under the terms of the GNU Lesser General Public License version 3,
9
* as published by the Free Software Foundation.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*
19
* Authored by: Thomas Voß <thomas.voss@canonical.com>
20
*/
21
#ifndef LOMIRI_MEDIAHUBSERVICE_POWER_STATE_CONTROLLER_H
22
#define LOMIRI_MEDIAHUBSERVICE_POWER_STATE_CONTROLLER_H
23
24
#include <QObject>
25
#include <QScopedPointer>
26
#include <QSharedPointer>
27
28
namespace
lomiri
29
{
30
namespace
MediaHubService
31
{
32
namespace
power
33
{
34
Q_NAMESPACE
35
36
// Enumerates known power states of the system.
37
enum class
SystemState
38
{
39
// Note that callers will be notified of suspend state changes
40
// but may not request this state.
41
suspend
= 0,
42
// The Active state will prevent system suspend
43
active
= 1,
44
// Substate of Active with disabled proximity based blanking
45
blank_on_proximity
= 2
46
};
47
Q_ENUM_NS(
SystemState
)
48
49
// Interface that enables observation of the system power state.
50
class
StateControllerPrivate;
51
class
StateController
:
public
QObject
52
{
53
Q_OBJECT
54
55
public
:
56
typedef
QSharedPointer<StateController>
Ptr
;
57
static
QSharedPointer<StateController>
instance
();
58
~StateController
();
59
60
void
requestDisplayOn
();
61
void
releaseDisplayOn
();
62
63
void
requestSystemState
(
SystemState
state);
64
void
releaseSystemState
(
SystemState
state);
65
66
Q_SIGNALS:
67
void
displayOnAcquired
();
68
void
displayOnReleased
();
69
70
void
systemStateAcquired
(
SystemState
state);
71
void
systemStateReleased
(
SystemState
state);
72
73
protected
:
74
StateController
();
75
76
private
:
77
Q_DECLARE_PRIVATE(
StateController
)
78
QScopedPointer<StateControllerPrivate> d_ptr;
79
};
80
81
}
82
}
83
}
84
85
#endif // LOMIRI_MEDIAHUBSERVICE_POWER_STATE_CONTROLLER_H
QObject
lomiri::MediaHubService::power::SystemState::blank_on_proximity
@ blank_on_proximity
lomiri::MediaHubService::power::StateController::systemStateReleased
void systemStateReleased(SystemState state)
lomiri::MediaHubService::power::StateController::Ptr
QSharedPointer< StateController > Ptr
Definition:
state_controller.h:56
lomiri::MediaHubService::power::StateController
Definition:
state_controller.h:51
lomiri::MediaHubService::power::SystemState::suspend
@ suspend
lomiri::MediaHubService::power::StateController::displayOnAcquired
void displayOnAcquired()
lomiri::MediaHubService::power::StateController::requestDisplayOn
void requestDisplayOn()
Definition:
state_controller.cpp:235
lomiri::MediaHubService::power::StateController::releaseDisplayOn
void releaseDisplayOn()
Definition:
state_controller.cpp:246
lomiri::MediaHubService::power::StateController::instance
static QSharedPointer< StateController > instance()
Definition:
state_controller.cpp:223
lomiri::MediaHubService::power::StateController::~StateController
~StateController()
lomiri::MediaHubService::power::SystemState
SystemState
Definition:
state_controller.h:37
lomiri::MediaHubService::power::StateController::releaseSystemState
void releaseSystemState(SystemState state)
Definition:
state_controller.cpp:266
lomiri::MediaHubService::power::SystemState::active
@ active
lomiri::MediaHubService::power::StateController::requestSystemState
void requestSystemState(SystemState state)
Definition:
state_controller.cpp:255
lomiri::MediaHubService::power::StateController::displayOnReleased
void displayOnReleased()
lomiri::MediaHubService::power::StateController::StateController
StateController()
Definition:
state_controller.cpp:215
lomiri
Definition:
dbus_utils.h:24
lomiri::MediaHubService::power::StateController::systemStateAcquired
void systemStateAcquired(SystemState state)
src
service
power
state_controller.h
Generated on Fri Dec 16 2022 11:18:10 for Music Hub by
1.8.17