Music Hub ..
A session-wide music playback service
 
Loading...
Searching...
No Matches
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
28namespace lomiri
29{
30namespace MediaHubService
31{
32namespace audio
33{
34// All known states of an audio output.
35enum class OutputState
36{
37 // The output is via a private earpiece (i.e. headphones, headset)
39 // The output is via the internal speaker.
40 Speaker,
41 // The output is via an external device (a2dp, etc)
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.
49class OutputObserverPrivate;
51{
52 Q_OBJECT
53
54public:
55 OutputObserver(QObject *parent = nullptr);
56 virtual ~OutputObserver();
57
59
60Q_SIGNALS:
62
63protected:
66
67private:
68 Q_DECLARE_PRIVATE(OutputObserver)
69 QScopedPointer<OutputObserverPrivate> d_ptr;
70};
71
72// Pretty prints the given state to the given output stream.
73std::ostream& operator<<(std::ostream&, OutputState);
74
75}
76}
77}
78
79#endif // LOMIRI_MEDIAHUBSERVICE_AUDIO_OUTPUT_OBSERVER_H
OutputObserver & operator=(const OutputObserver &)=delete
OutputObserver(const OutputObserver &)=delete
std::ostream & operator<<(std::ostream &, OutputState)