BluezQt

mediatransport.h
1/*
2 * BluezQt - Asynchronous BlueZ wrapper library
3 *
4 * SPDX-FileCopyrightText: 2019 Manuel Weichselbaumer <mincequi@web.de>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#ifndef BLUEZQT_MEDIATRANSPORT_H
10#define BLUEZQT_MEDIATRANSPORT_H
11
12#include <QObject>
13
14#include "bluezqt_export.h"
15#include "mediatypes.h"
16#include "tpendingcall.h"
17
18#include <memory>
19
20namespace BluezQt
21{
22class PendingCall;
23
24/**
25 * @class BluezQt::MediaTransport mediatransport.h <BluezQt/MediaTransport>
26 *
27 * Media transport.
28 *
29 * This class represents a media transport interface.
30 */
31class BLUEZQT_EXPORT MediaTransport : public QObject
32{
33 Q_OBJECT
34 Q_PROPERTY(State state READ state NOTIFY stateChanged)
35 Q_PROPERTY(quint16 volume READ volume NOTIFY volumeChanged)
36
37public:
38 /** Indicates the state of the transport. */
39 enum class State {
40 Idle,
41 Pending,
42 Active,
43 };
44 Q_ENUM(State)
45
46 /**
47 * Destroys a MediaTransport object.
48 */
49 ~MediaTransport() override;
50
51 /**
52 * Returns the (audio) configuration of the transport.
53 *
54 * @return configuration of transport
55 */
56 AudioConfiguration audioConfiguration() const;
57
58 /**
59 * Returns the state of the transport.
60 *
61 * @return state of transport
62 */
63 State state() const;
64
65 /**
66 * Returns the volume of the transport.
67 *
68 * The volume is a percentage of the maximum. The value 0x00 corresponds to 0%.
69 * The value 0x7F corresponds to 100%. Scaling should be applied to achieve
70 * values between these two. The existence of this scale does not impose any
71 * restriction on the granularity of the volume control scale on the target.
72 * As this command specifies a percentage rather than an absolute dB level
73 * the controller should exercise caution when sending this command.
74 *
75 * @return volume of transport
76 */
77 quint16 volume() const;
78
79 /**
80 * Sets the volume of the transport.
81 *
82 * Only works when the transport was acquired by the sender.
83 *
84 * @param quint16 volume of the transport in the range [0x00..0x7F] (0-127)
85 *
86 * @return void pending call
87 * @since 6.6
88 */
89 PendingCall *setVolume(quint16 volume);
90
91public Q_SLOTS:
92 /**
93 * Acquire transport file descriptor and the MTU for read
94 * and write respectively.
95 *
96 * Possible errors: PendingCall::NotAuthorized, PendingCall::Failed
97 *
98 * @return <fd, uint16, uint16> pending call
99 */
101
102 /**
103 * Acquire transport file descriptor only if the transport
104 * is in "pending" state at the time the message is
105 * received by BlueZ. Otherwise no request will be sent
106 * to the remote device and the function will just fail
107 * with org.bluez.Error.NotAvailable.
108 *
109 * Possible errors: PendingCall::NotAuthorized, PendingCall::Failed, PendingCall::NotAvailable
110 *
111 * @return <fd, uint16, uint16> pending call
112 */
114
115 /**
116 * Releases file descriptor.
117 *
118 * @return void pending call
119 */
120 TPendingCall<void> *release();
121
122Q_SIGNALS:
123 /**
124 * Indicates that transport's state have changed.
125 */
126 void stateChanged(State state);
127
128 /**
129 * Indicates that transport's volume have changed.
130 */
131 void volumeChanged(quint16 volume);
132
133private:
134 BLUEZQT_NO_EXPORT explicit MediaTransport(const QString &path, const QVariantMap &properties);
135
136 std::unique_ptr<class MediaTransportPrivate> const d;
137
138 friend class MediaTransportPrivate;
139 friend class DevicePrivate;
140};
141
142} // namespace BluezQt
143
144#endif
Media transport.
~MediaTransport() override
Destroys a MediaTransport object.
void volumeChanged(quint16 volume)
Indicates that transport's volume have changed.
void stateChanged(State state)
Indicates that transport's state have changed.
Pending method call.
Pending method call (template version).
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.