BluezQt

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

KDE's Doxygen guidelines are available online.