File indexing completed on 2025-01-19 03:38:32
0001 /* 0002 * BluezQt - Asynchronous BlueZ wrapper library 0003 * 0004 * SPDX-FileCopyrightText: 2014-2015 David Rosca <nowrep@gmail.com> 0005 * 0006 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #ifndef BLUEZQT_OBEXFILETRANSFER_H 0010 #define BLUEZQT_OBEXFILETRANSFER_H 0011 0012 #include <QObject> 0013 0014 #include "bluezqt_export.h" 0015 #include "obexfiletransferentry.h" 0016 0017 #include <memory> 0018 0019 class QDBusObjectPath; 0020 0021 namespace BluezQt 0022 { 0023 class PendingCall; 0024 0025 /** 0026 * @class BluezQt::ObexFileTransfer obexfiletransfer.h <BluezQt/ObexFileTransfer> 0027 * 0028 * OBEX file transfer. 0029 * 0030 * This class represents an OBEX file transfer interface. 0031 */ 0032 class BLUEZQT_EXPORT ObexFileTransfer : public QObject 0033 { 0034 Q_OBJECT 0035 0036 public: 0037 /** 0038 * Creates a new ObexFileTransfer object. 0039 * 0040 * This class will be typically used with a @p path 0041 * from result of ObexManager::createSession(). 0042 * 0043 * @param path path of session 0044 * @param parent 0045 */ 0046 explicit ObexFileTransfer(const QDBusObjectPath &path, QObject *parent = nullptr); 0047 0048 /** 0049 * Destroys an ObexFileTransfer object. 0050 */ 0051 ~ObexFileTransfer() override; 0052 0053 /** 0054 * D-Bus object path of the file transfer session. 0055 * 0056 * @return object path of session 0057 */ 0058 QDBusObjectPath objectPath() const; 0059 0060 /** 0061 * Changes the current folder. 0062 * 0063 * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed 0064 * 0065 * @param folder folder to be changed 0066 * @return void pending call 0067 */ 0068 PendingCall *changeFolder(const QString &folder); 0069 0070 /** 0071 * Creates a new folder. 0072 * 0073 * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed 0074 * 0075 * @param folder name of new folder 0076 * @return void pending call 0077 */ 0078 PendingCall *createFolder(const QString &folder); 0079 0080 /** 0081 * Lists a current folder. 0082 * 0083 * Possible errors: PendingCall::Failed 0084 * 0085 * @return QList<ObexFileTransferEntry> pending call 0086 */ 0087 PendingCall *listFolder(); 0088 0089 /** 0090 * Gets the file from the remote device. 0091 * 0092 * If an empty @p targetFileName is given, a name will be 0093 * automatically calculated for the temporary file. 0094 * 0095 * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed 0096 * 0097 * @param targetFileName full local path where the file will be saved 0098 * @param sourceFileName file within the remote device 0099 * @return ObexTransferPtr pending call 0100 */ 0101 PendingCall *getFile(const QString &targetFileName, const QString &sourceFileName); 0102 0103 /** 0104 * Puts the file to the remote device. 0105 * 0106 * If an empty @p targetFileName is given, a name will be 0107 * automatically calculated for the temporary file. 0108 * 0109 * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed 0110 * 0111 * @param sourceFileName full path of the local file 0112 * @param targetFileName file to be saved within the remote device 0113 * @return ObexTransferPtr pending call 0114 */ 0115 PendingCall *putFile(const QString &sourceFileName, const QString &targetFileName); 0116 0117 /** 0118 * Copies a file within the remote device. 0119 * 0120 * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed 0121 * 0122 * @param sourceFileName source within the remote device 0123 * @param targetFileName target file within the remote device 0124 * @return void pending call 0125 */ 0126 PendingCall *copyFile(const QString &sourceFileName, const QString &targetFileName); 0127 0128 /** 0129 * Moves a file within the remote device. 0130 * 0131 * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed 0132 * 0133 * @param sourceFileName source file within the remote device 0134 * @param targetFileName target file within the remote device 0135 * @return void pending call 0136 */ 0137 PendingCall *moveFile(const QString &sourceFileName, const QString &targetFileName); 0138 0139 /** 0140 * Deletes a file/folder within the remote device. 0141 * 0142 * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed 0143 * 0144 * @param fileName file within the remote device 0145 * @return void pending call 0146 */ 0147 PendingCall *deleteFile(const QString &fileName); 0148 0149 private: 0150 std::unique_ptr<class ObexFileTransferPrivate> const d; 0151 0152 friend class ObexFileTransferPrivate; 0153 }; 0154 0155 } // namespace BluezQt 0156 0157 #endif // BLUEZQT_OBEXFILETRANSFER_H