BluezQt

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