BluezQt

obextransfer.h
1/*
2 * BluezQt - Asynchronous BlueZ wrapper library
3 *
4 * SPDX-FileCopyrightText: 2014-2015 David Rosca <nowrep@gmail.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#ifndef BLUEZQT_OBEXTRANSFER_H
10#define BLUEZQT_OBEXTRANSFER_H
11
12#include <QObject>
13
14#include "bluezqt_export.h"
15#include "types.h"
16
17#include <memory>
18
19class QDBusObjectPath;
20
21namespace BluezQt
22{
23class PendingCall;
24
25/**
26 * @class BluezQt::ObexTransfer obextransfer.h <BluezQt/ObexTransfer>
27 *
28 * OBEX transfer.
29 *
30 * This class represents transfer of one file.
31 */
32class BLUEZQT_EXPORT ObexTransfer : public QObject
33{
34 Q_OBJECT
35
36 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
37 Q_PROPERTY(QString name READ name)
38 Q_PROPERTY(QString type READ type)
39 Q_PROPERTY(quint64 time READ time)
40 Q_PROPERTY(quint64 size READ size)
41 Q_PROPERTY(quint64 transferred READ transferred NOTIFY transferredChanged)
42 Q_PROPERTY(QString fileName READ fileName NOTIFY fileNameChanged)
43 Q_PROPERTY(bool suspendable READ isSuspendable)
44
45public:
46 /**
47 * Status of transfer.
48 */
49 enum Status {
50 /** Indicates that the transfer is queued. */
52 /** Indicates that the transfer is active. */
54 /** Indicates that the transfer is suspended. */
56 /** Indicates that the transfer have completed successfully. */
58 /** Indicates that the transfer have failed with error. */
60 /** Indicates that the transfer status is unknown. */
62 };
63 Q_ENUM(Status)
64
65 /**
66 * Destroys an ObexTransfer object.
67 */
68 ~ObexTransfer() override;
69
70 /**
71 * Returns a shared pointer from this.
72 *
73 * @return ObexTransferPtr
74 */
75 ObexTransferPtr toSharedPtr() const;
76
77 /**
78 * D-Bus object path of the transfer.
79 *
80 * @return object path of transfer
81 */
82 QDBusObjectPath objectPath() const;
83
84 /**
85 * Returns the status of the transfer.
86 *
87 * @return status of transfer
88 */
89 Status status() const;
90
91 /**
92 * Returns the name of the transferred object.
93 *
94 * @return name of transferred object
95 */
96 QString name() const;
97
98 /**
99 * Returns the type of the transferred object.
100 *
101 * @return type of transferred object
102 */
103 QString type() const;
104
105 /**
106 * Returns the time of the transferred object.
107 *
108 * @return time of transferred object
109 */
110 quint64 time() const;
111
112 /**
113 * Returns the total size of the transferred object.
114 *
115 * @return size of transferred object
116 */
117 quint64 size() const;
118
119 /**
120 * Returns the number of bytes transferred.
121 *
122 * @return number of bytes transferred
123 */
124 quint64 transferred() const;
125
126 /**
127 * Returns the full name of the transferred file.
128 *
129 * @return full name of transferred file
130 */
131 QString fileName() const;
132
133 /**
134 * Returns whether the transfer is suspendable.
135 *
136 * @return true if transfer is suspendable
137 */
138 bool isSuspendable() const;
139
140 /**
141 * Stops the current transfer.
142 *
143 * Possible errors: PendingCall::NotAuthorized, PendingCall::InProgress
144 * PendingCall::Failed
145 *
146 * @return void pending call
147 */
148 PendingCall *cancel();
149
150 /**
151 * Suspends the current transfer.
152 *
153 * Only suspendable transfers can be suspended.
154 *
155 * Possible errors: PendingCall::NotAuthorized, PendingCall::NotInProgress
156 *
157 * @see isSuspendable() const
158 *
159 * @return void pending call
160 */
162
163 /**
164 * Resumes the current transfer.
165 *
166 * Possible errors: PendingCall::NotAuthorized, PendingCall::NotInProgress
167 *
168 * @return void pending call
169 */
170 PendingCall *resume();
171
172Q_SIGNALS:
173 /**
174 * Indicates that the status of transfer have changed.
175 */
177
178 /**
179 * Indicates that the number of transferred bytes have changed.
180 */
181 void transferredChanged(quint64 transferred);
182
183 /**
184 * Indicates that the name of transferred file have changed.
185 */
186 void fileNameChanged(const QString &fileName);
187
188private:
189 BLUEZQT_NO_EXPORT explicit ObexTransfer(const QString &path, const QVariantMap &properties);
190
191 std::unique_ptr<class ObexTransferPrivate> const d;
192
193 friend class ObexTransferPrivate;
194 friend class ObexAgentAdaptor;
195 friend class PendingCallPrivate;
196};
197
198} // namespace BluezQt
199
200#endif // BLUEZQT_OBEXTRANSFER_H
OBEX transfer.
void statusChanged(Status status)
Indicates that the status of transfer have changed.
~ObexTransfer() override
Destroys an ObexTransfer object.
void transferredChanged(quint64 transferred)
Indicates that the number of transferred bytes have changed.
void fileNameChanged(const QString &fileName)
Indicates that the name of transferred file have changed.
Status
Status of transfer.
@ Unknown
Indicates that the transfer status is unknown.
@ Error
Indicates that the transfer have failed with error.
@ Active
Indicates that the transfer is active.
@ Suspended
Indicates that the transfer is suspended.
@ Queued
Indicates that the transfer is queued.
@ Complete
Indicates that the transfer have completed successfully.
Pending method call.
void suspend()
Q_SCRIPTABLE CaptureState status()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:46:08 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.