| 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_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 |
* \inmodule BluezQt |
| 27 |
* \class BluezQt::ObexFileTransfer |
| 28 |
* \inheaderfile BluezQt/ObexFileTransfer |
| 29 |
* \brief OBEX file transfer. |
| 30 |
* |
| 31 |
* This class represents an OBEX file transfer interface. |
| 32 |
*/ |
| 33 |
class BLUEZQT_EXPORT ObexFileTransfer : public QObject |
| 34 |
{ |
| 35 |
Q_OBJECT |
| 36 |
|
| 37 |
public: |
| 38 |
/*! |
| 39 |
* Creates a new ObexFileTransfer object at the given session \a path as a child of \a parent. |
| 40 |
* |
| 41 |
* This class will be typically used with a \a path |
| 42 |
* from result of ObexManager::createSession(). |
| 43 |
*/ |
| 44 |
explicit ObexFileTransfer(const QDBusObjectPath &path, QObject *parent = nullptr); |
| 45 |
|
| 46 |
~ObexFileTransfer() override; |
| 47 |
|
| 48 |
/*! |
| 49 |
* Returns the D-Bus object path of the file transfer session. |
| 50 |
*/ |
| 51 |
QDBusObjectPath objectPath() const; |
| 52 |
|
| 53 |
/*! |
| 54 |
* Changes the current \a folder. |
| 55 |
* |
| 56 |
* Possible errors: |
| 57 |
* |
| 58 |
* \list |
| 59 |
* \li PendingCall::InvalidArguments |
| 60 |
* \li PendingCall::Failed |
| 61 |
* \endlist |
| 62 |
* |
| 63 |
* Returns void pending call. |
| 64 |
*/ |
| 65 |
PendingCall *changeFolder(const QString &folder); |
| 66 |
|
| 67 |
/*! |
| 68 |
* Creates a new \a folder. |
| 69 |
* |
| 70 |
* Possible errors: |
| 71 |
* |
| 72 |
* \list |
| 73 |
* \li PendingCall::InvalidArguments |
| 74 |
* \li PendingCall::Failed |
| 75 |
* \endlist |
| 76 |
* |
| 77 |
* Returns void pending call. |
| 78 |
*/ |
| 79 |
PendingCall *createFolder(const QString &folder); |
| 80 |
|
| 81 |
/*! |
| 82 |
* Lists a current folder. |
| 83 |
* |
| 84 |
* Possible errors: |
| 85 |
* |
| 86 |
* \list |
| 87 |
* \li PendingCall::Failed |
| 88 |
* \endlist |
| 89 |
* |
| 90 |
* Returns QList<ObexFileTransferEntry> pending call. |
| 91 |
*/ |
| 92 |
PendingCall *listFolder(); |
| 93 |
|
| 94 |
/*! |
| 95 |
* Gets the file at full path \a sourceFileName from the remote device and saves it to \a targetFileName. |
| 96 |
* |
| 97 |
* If an empty \a targetFileName is given, a name will be |
| 98 |
* automatically calculated for the temporary file. |
| 99 |
* |
| 100 |
* Possible errors: |
| 101 |
* |
| 102 |
* \list |
| 103 |
* \li PendingCall::InvalidArguments |
| 104 |
* \li PendingCall::Failed |
| 105 |
* \endlist |
| 106 |
* |
| 107 |
* Returns ObexTransferPtr pending call. |
| 108 |
*/ |
| 109 |
PendingCall *getFile(const QString &targetFileName, const QString &sourceFileName); |
| 110 |
|
| 111 |
/*! |
| 112 |
* Puts the file at full path \a sourceFileName to the remote device in \a targetFileName. |
| 113 |
* |
| 114 |
* If an empty \a targetFileName is given, a name will be |
| 115 |
* automatically calculated for the temporary file. |
| 116 |
* |
| 117 |
* Possible errors: |
| 118 |
* |
| 119 |
* \list |
| 120 |
* \li PendingCall::InvalidArguments |
| 121 |
* \li PendingCall::Failed |
| 122 |
* \endlist |
| 123 |
* |
| 124 |
* Returns ObexTransferPtr pending call. |
| 125 |
*/ |
| 126 |
PendingCall *putFile(const QString &sourceFileName, const QString &targetFileName); |
| 127 |
|
| 128 |
/*! |
| 129 |
* Copies a file at \a sourceFileName to \a targetFileName, both within the remote device. |
| 130 |
* |
| 131 |
* Possible errors: |
| 132 |
* |
| 133 |
* \list |
| 134 |
* \li PendingCall::InvalidArguments |
| 135 |
* \li PendingCall::Failed |
| 136 |
* \endlist |
| 137 |
* |
| 138 |
* Returns void pending call. |
| 139 |
*/ |
| 140 |
PendingCall *copyFile(const QString &sourceFileName, const QString &targetFileName); |
| 141 |
|
| 142 |
/*! |
| 143 |
* Moves a file \a sourceFileName to \a targetFileName, both within the remote device. |
| 144 |
* |
| 145 |
* Possible errors: |
| 146 |
* |
| 147 |
* \list |
| 148 |
* \li PendingCall::InvalidArguments |
| 149 |
* \li PendingCall::Failed |
| 150 |
* \endlist |
| 151 |
* |
| 152 |
* Returns void pending call. |
| 153 |
*/ |
| 154 |
PendingCall *moveFile(const QString &sourceFileName, const QString &targetFileName); |
| 155 |
|
| 156 |
/*! |
| 157 |
* Deletes a file/folder at \a fileName within the remote device. |
| 158 |
* |
| 159 |
* Possible errors: |
| 160 |
* |
| 161 |
* \list |
| 162 |
* \li PendingCall::InvalidArguments |
| 163 |
* \li PendingCall::Failed |
| 164 |
* \endlist |
| 165 |
* |
| 166 |
* Returns void pending call. |
| 167 |
*/ |
| 168 |
PendingCall *deleteFile(const QString &fileName); |
| 169 |
|
| 170 |
private: |
| 171 |
std::unique_ptr<class ObexFileTransferPrivate> const d; |
| 172 |
|
| 173 |
friend class ObexFileTransferPrivate; |
| 174 |
}; |
| 175 |
|
| 176 |
} // namespace BluezQt |
| 177 |
|
| 178 |
#endif // BLUEZQT_OBEXFILETRANSFER_H |