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_OBEXFILETRANSFER_H |
10 | #define BLUEZQT_OBEXFILETRANSFER_H |
11 | |
12 | #include <QObject> |
13 | |
14 | #include "bluezqt_export.h" |
15 | #include "obexfiletransferentry.h" |
16 | |
17 | #include <memory> |
18 | |
19 | class QDBusObjectPath; |
20 | |
21 | namespace BluezQt |
22 | { |
23 | class PendingCall; |
24 | |
25 | /** |
26 | * @class BluezQt::ObexFileTransfer obexfiletransfer.h <BluezQt/ObexFileTransfer> |
27 | * |
28 | * OBEX file transfer. |
29 | * |
30 | * This class represents an OBEX file transfer interface. |
31 | */ |
32 | class BLUEZQT_EXPORT ObexFileTransfer : public QObject |
33 | { |
34 | Q_OBJECT |
35 | |
36 | public: |
37 | /** |
38 | * Creates a new ObexFileTransfer object. |
39 | * |
40 | * This class will be typically used with a @p path |
41 | * from result of ObexManager::createSession(). |
42 | * |
43 | * @param path path of session |
44 | * @param parent |
45 | */ |
46 | explicit ObexFileTransfer(const QDBusObjectPath &path, QObject *parent = nullptr); |
47 | |
48 | /** |
49 | * Destroys an ObexFileTransfer object. |
50 | */ |
51 | ~ObexFileTransfer() override; |
52 | |
53 | /** |
54 | * D-Bus object path of the file transfer session. |
55 | * |
56 | * @return object path of session |
57 | */ |
58 | QDBusObjectPath objectPath() const; |
59 | |
60 | /** |
61 | * Changes the current folder. |
62 | * |
63 | * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed |
64 | * |
65 | * @param folder folder to be changed |
66 | * @return void pending call |
67 | */ |
68 | PendingCall *changeFolder(const QString &folder); |
69 | |
70 | /** |
71 | * Creates a new folder. |
72 | * |
73 | * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed |
74 | * |
75 | * @param folder name of new folder |
76 | * @return void pending call |
77 | */ |
78 | PendingCall *createFolder(const QString &folder); |
79 | |
80 | /** |
81 | * Lists a current folder. |
82 | * |
83 | * Possible errors: PendingCall::Failed |
84 | * |
85 | * @return QList<ObexFileTransferEntry> pending call |
86 | */ |
87 | PendingCall *listFolder(); |
88 | |
89 | /** |
90 | * Gets the file from the remote device. |
91 | * |
92 | * If an empty @p targetFileName is given, a name will be |
93 | * automatically calculated for the temporary file. |
94 | * |
95 | * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed |
96 | * |
97 | * @param targetFileName full local path where the file will be saved |
98 | * @param sourceFileName file within the remote device |
99 | * @return ObexTransferPtr pending call |
100 | */ |
101 | PendingCall *getFile(const QString &targetFileName, const QString &sourceFileName); |
102 | |
103 | /** |
104 | * Puts the file to the remote device. |
105 | * |
106 | * If an empty @p targetFileName is given, a name will be |
107 | * automatically calculated for the temporary file. |
108 | * |
109 | * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed |
110 | * |
111 | * @param sourceFileName full path of the local file |
112 | * @param targetFileName file to be saved within the remote device |
113 | * @return ObexTransferPtr pending call |
114 | */ |
115 | PendingCall *putFile(const QString &sourceFileName, const QString &targetFileName); |
116 | |
117 | /** |
118 | * Copies a file within the remote device. |
119 | * |
120 | * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed |
121 | * |
122 | * @param sourceFileName source within the remote device |
123 | * @param targetFileName target file within the remote device |
124 | * @return void pending call |
125 | */ |
126 | PendingCall *copyFile(const QString &sourceFileName, const QString &targetFileName); |
127 | |
128 | /** |
129 | * Moves a file within the remote device. |
130 | * |
131 | * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed |
132 | * |
133 | * @param sourceFileName source file within the remote device |
134 | * @param targetFileName target file within the remote device |
135 | * @return void pending call |
136 | */ |
137 | PendingCall *moveFile(const QString &sourceFileName, const QString &targetFileName); |
138 | |
139 | /** |
140 | * Deletes a file/folder within the remote device. |
141 | * |
142 | * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed |
143 | * |
144 | * @param fileName file within the remote device |
145 | * @return void pending call |
146 | */ |
147 | PendingCall *deleteFile(const QString &fileName); |
148 | |
149 | private: |
150 | std::unique_ptr<class ObexFileTransferPrivate> const d; |
151 | |
152 | friend class ObexFileTransferPrivate; |
153 | }; |
154 | |
155 | } // namespace BluezQt |
156 | |
157 | #endif // BLUEZQT_OBEXFILETRANSFER_H |
158 | |