Music Hub
..
A session-wide music playback service
output_observer.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_AUDIO_OUTPUT_OBSERVER_H
22
#define LOMIRI_MEDIAHUBSERVICE_AUDIO_OUTPUT_OBSERVER_H
23
24
#include <QObject>
25
26
#include <iosfwd>
27
28
namespace
lomiri
29
{
30
namespace
MediaHubService
31
{
32
namespace
audio
33
{
34
// All known states of an audio output.
35
enum class
OutputState
36
{
37
// The output is via a private earpiece (i.e. headphones, headset)
38
Earpiece
,
39
// The output is via the internal speaker.
40
Speaker
,
41
// The output is via an external device (a2dp, etc)
42
External
,
43
};
44
45
// Models observation of audio outputs of a device.
46
// Right now, we are only interested in monitoring the
47
// state of external outputs to react accordingly if
48
// wired or bluetooth outputs are connected/disconnected.
49
class
OutputObserverPrivate;
50
class
OutputObserver
:
public
QObject
51
{
52
Q_OBJECT
53
54
public
:
55
OutputObserver
(
QObject
*parent =
nullptr
);
56
virtual
~OutputObserver
();
57
58
OutputState
outputState
()
const
;
59
60
Q_SIGNALS:
61
void
outputStateChanged
();
62
63
protected
:
64
OutputObserver
(
const
OutputObserver
&) =
delete
;
65
OutputObserver
&
operator=
(
const
OutputObserver
&) =
delete
;
66
67
private
:
68
Q_DECLARE_PRIVATE(
OutputObserver
)
69
QScopedPointer<OutputObserverPrivate> d_ptr;
70
};
71
72
// Pretty prints the given state to the given output stream.
73
std::ostream&
operator<<
(std::ostream&,
OutputState
);
74
75
}
76
}
77
}
78
79
#endif // LOMIRI_MEDIAHUBSERVICE_AUDIO_OUTPUT_OBSERVER_H
QObject
lomiri::MediaHubService::audio::OutputState::Speaker
@ Speaker
lomiri::MediaHubService::audio
Definition:
ostream_reporter.h:33
lomiri::MediaHubService::audio::OutputObserver::operator=
OutputObserver & operator=(const OutputObserver &)=delete
lomiri::MediaHubService::audio::OutputObserver
Definition:
output_observer.h:50
lomiri::MediaHubService::audio::OutputObserver::~OutputObserver
virtual ~OutputObserver()
lomiri::MediaHubService::audio::OutputState::Earpiece
@ Earpiece
lomiri::MediaHubService::audio::OutputState
OutputState
Definition:
output_observer.h:35
lomiri::MediaHubService::audio::OutputObserver::outputStateChanged
void outputStateChanged()
lomiri::MediaHubService::audio::OutputObserver::outputState
OutputState outputState() const
Definition:
output_observer.cpp:59
lomiri
Definition:
dbus_utils.h:24
lomiri::MediaHubService::audio::OutputState::External
@ External
lomiri::MediaHubService::audio::operator<<
std::ostream & operator<<(std::ostream &, OutputState)
Definition:
output_observer.cpp:33
lomiri::MediaHubService::audio::OutputObserver::OutputObserver
OutputObserver(QObject *parent=nullptr)
Definition:
output_observer.cpp:48
src
service
audio
output_observer.h
Generated on Fri Dec 16 2022 11:18:10 for Music Hub by
1.8.17