File indexing completed on 2024-04-28 15:17:55

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 class QDBusObjectPath;
0018 
0019 namespace BluezQt
0020 {
0021 class PendingCall;
0022 
0023 /**
0024  * @class BluezQt::ObexFileTransfer obexfiletransfer.h <BluezQt/ObexFileTransfer>
0025  *
0026  * OBEX file transfer.
0027  *
0028  * This class represents an OBEX file transfer interface.
0029  */
0030 class BLUEZQT_EXPORT ObexFileTransfer : public QObject
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035     /**
0036      * Creates a new ObexFileTransfer object.
0037      *
0038      * This class will be typically used with a @p path
0039      * from result of ObexManager::createSession().
0040      *
0041      * @param path path of session
0042      * @param parent
0043      */
0044     explicit ObexFileTransfer(const QDBusObjectPath &path, QObject *parent = nullptr);
0045 
0046     /**
0047      * Destroys an ObexFileTransfer object.
0048      */
0049     ~ObexFileTransfer() override;
0050 
0051     /**
0052      * D-Bus object path of the file transfer session.
0053      *
0054      * @return object path of session
0055      */
0056     QDBusObjectPath objectPath() const;
0057 
0058     /**
0059      * Changes the current folder.
0060      *
0061      * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed
0062      *
0063      * @param folder folder to be changed
0064      * @return void pending call
0065      */
0066     PendingCall *changeFolder(const QString &folder);
0067 
0068     /**
0069      * Creates a new folder.
0070      *
0071      * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed
0072      *
0073      * @param folder name of new folder
0074      * @return void pending call
0075      */
0076     PendingCall *createFolder(const QString &folder);
0077 
0078     /**
0079      * Lists a current folder.
0080      *
0081      * Possible errors: PendingCall::Failed
0082      *
0083      * @return QList<ObexFileTransferEntry> pending call
0084      */
0085     PendingCall *listFolder();
0086 
0087     /**
0088      * Gets the file from the remote device.
0089      *
0090      * If an empty @p targetFileName is given, a name will be
0091      * automatically calculated for the temporary file.
0092      *
0093      * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed
0094      *
0095      * @param targetFileName full local path where the file will be saved
0096      * @param sourceFileName file within the remote device
0097      * @return ObexTransferPtr pending call
0098      */
0099     PendingCall *getFile(const QString &targetFileName, const QString &sourceFileName);
0100 
0101     /**
0102      * Puts the file to the remote device.
0103      *
0104      * If an empty @p targetFileName is given, a name will be
0105      * automatically calculated for the temporary file.
0106      *
0107      * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed
0108      *
0109      * @param sourceFileName full path of the local file
0110      * @param targetFileName file to be saved within the remote device
0111      * @return ObexTransferPtr pending call
0112      */
0113     PendingCall *putFile(const QString &sourceFileName, const QString &targetFileName);
0114 
0115     /**
0116      * Copies a file within the remote device.
0117      *
0118      * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed
0119      *
0120      * @param sourceFileName source within the remote device
0121      * @param targetFileName target file within the remote device
0122      * @return void pending call
0123      */
0124     PendingCall *copyFile(const QString &sourceFileName, const QString &targetFileName);
0125 
0126     /**
0127      * Moves a file within the remote device.
0128      *
0129      * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed
0130      *
0131      * @param sourceFileName source file within the remote device
0132      * @param targetFileName target file within the remote device
0133      * @return void pending call
0134      */
0135     PendingCall *moveFile(const QString &sourceFileName, const QString &targetFileName);
0136 
0137     /**
0138      * Deletes a file/folder within the remote device.
0139      *
0140      * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed
0141      *
0142      * @param fileName file within the remote device
0143      * @return void pending call
0144      */
0145     PendingCall *deleteFile(const QString &fileName);
0146 
0147 private:
0148     class ObexFileTransferPrivate *const d;
0149 
0150     friend class ObexFileTransferPrivate;
0151 };
0152 
0153 } // namespace BluezQt
0154 
0155 #endif // BLUEZQT_OBEXFILETRANSFER_H