BluezQt

mediaendpoint.h
1 /*
2  * BluezQt - Asynchronous BlueZ wrapper library
3  *
4  * SPDX-FileCopyrightText: 2018 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 #ifndef BLUEZQT_MEDIAENDPOINT_H
10 #define BLUEZQT_MEDIAENDPOINT_H
11 
12 #include <QObject>
13 
14 #include "bluezqt_export.h"
15 #include "request.h"
16 
17 class QDBusObjectPath;
18 
19 namespace BluezQt
20 {
21 /**
22  * @class BluezQt::MediaEndpoint MediaEndpoint.h <BluezQt/MediaEndpoint>
23  *
24  * Bluetooth MediaEndpoint.
25  *
26  * This class represents a Bluetooth MediaEndpoint.
27  */
28 class BLUEZQT_EXPORT MediaEndpoint : public QObject
29 {
30  Q_OBJECT
31 
32 public:
33  /** Role which this MediaEndpoint acts as. */
34  enum class Role {
35  AudioSource,
36  AudioSink,
37  };
38 
39  // KF6 TODO: use types from mediatypes.h
40  /** Codec which this MediaEndpoint supports. */
41  enum class Codec {
42  Sbc,
43  Aac,
44  };
45 
46  /** Configuration for MediaEndpoint construction. */
47  struct Configuration {
48  Role role;
49  Codec codec;
50  };
51 
52  /**
53  * Creates a new MediaEndpoint object.
54  *
55  * @param parent
56  */
57  explicit MediaEndpoint(const Configuration &configuration, QObject *parent = nullptr);
58 
59  /**
60  * Destroys a MediaEndpoint object.
61  */
62  ~MediaEndpoint() override;
63 
64  /**
65  * D-Bus object path of the MediaEndpoint.
66  *
67  * The path where the MediaEndpoint will be registered.
68  *
69  * @note You must provide valid object path!
70  *
71  * @return object path of MediaEndpoint
72  */
73  virtual QDBusObjectPath objectPath() const;
74 
75  /**
76  * Properties of the endpoint.
77  *
78  * @return Properties of the endpoint
79  */
80  virtual const QVariantMap &properties() const;
81 
82  /**
83  * Set configuration for the transport.
84  *
85  * @param transport transport to be configured
86  * @param properties properties to be set for transport
87  */
88  virtual void setConfiguration(const QString &transportObjectPath, const QVariantMap &properties);
89 
90  /**
91  * Select preferable configuration from the supported capabilities.
92  *
93  * @note There is no need to cache the selected configuration since on success
94  * the configuration is send back as parameter of SetConfiguration.
95  *
96  * @param capabilities supported capabilities
97  * @param request request to be used for sending reply
98  */
99  virtual void selectConfiguration(const QByteArray &capabilities, const Request<QByteArray> &request);
100 
101  /**
102  * Clear transport configuration.
103  */
104  virtual void clearConfiguration(const QString &transportObjectPath);
105 
106  /**
107  * Indicates that the MediaEndpoint was unregistered.
108  *
109  * This method gets called when the Bluetooth daemon
110  * unregisters the MediaEndpoint.
111  *
112  * An MediaEndpoint can use it to do cleanup tasks. There is no need
113  * to unregister the MediaEndpoint, because when this method gets called
114  * it has already been unregistered.
115  */
116  virtual void release();
117 
118 Q_SIGNALS:
119  /**
120  * Indicates that configuration was selected.
121  */
122  void configurationSelected(const QByteArray &capabilities, const QByteArray &configuration);
123 
124  /**
125  * Indicates that configuration was set for transport.
126  */
127  void configurationSet(const QString &transportObjectPath, const QVariantMap &properties);
128 
129  /**
130  * Indicates that configuration was cleared for transport.
131  */
132  void configurationCleared(const QString &transportObjectPath);
133 
134 private:
135  class MediaEndpointPrivate *const d;
136 };
137 
138 } // namespace BluezQt
139 
140 #endif // BLUEZQT_MEDIAENDPOINT_H
Configuration for MediaEndpoint construction.
Definition: mediaendpoint.h:47
Codec
Codec which this MediaEndpoint supports.
Definition: mediaendpoint.h:41
virtual void release(quint64 objid)
Role
Role which this MediaEndpoint acts as.
Definition: mediaendpoint.h:34
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.