| 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_OBEXOBJECTPUSH_H |
| 10 | #define BLUEZQT_OBEXOBJECTPUSH_H |
| 11 | |
| 12 | #include <QObject> |
| 13 | |
| 14 | #include "bluezqt_export.h" |
| 15 | |
| 16 | #include <memory> |
| 17 | |
| 18 | class QDBusObjectPath; |
| 19 | |
| 20 | namespace BluezQt |
| 21 | { |
| 22 | class PendingCall; |
| 23 | |
| 24 | /*! |
| 25 | * \inmodule BluezQt |
| 26 | * \class BluezQt::ObexObjectPush |
| 27 | * \inheaderfile BluezQt/ObexObjectPush |
| 28 | * \brief OBEX object push. |
| 29 | * |
| 30 | * This class represents an OBEX object push interface. |
| 31 | */ |
| 32 | class BLUEZQT_EXPORT ObexObjectPush : public QObject |
| 33 | { |
| 34 | Q_OBJECT |
| 35 | |
| 36 | public: |
| 37 | /*! |
| 38 | * Creates a new ObexObjectPush object with the given session \a path as a child of \a parent. |
| 39 | * |
| 40 | * This class will be typically used with a \a path |
| 41 | * from result of ObexManager::createSession(). |
| 42 | */ |
| 43 | explicit ObexObjectPush(const QDBusObjectPath &path, QObject *parent = nullptr); |
| 44 | |
| 45 | ~ObexObjectPush() override; |
| 46 | |
| 47 | /*! |
| 48 | * Returns the D-Bus object path of the object push session. |
| 49 | */ |
| 50 | QDBusObjectPath objectPath() const; |
| 51 | |
| 52 | /*! |
| 53 | * Sends one local file \a fileName to the remote device. |
| 54 | * |
| 55 | * The returned ObexTransfer can be used to track progress of transfer. |
| 56 | * |
| 57 | * Possible errors: |
| 58 | * |
| 59 | * \list |
| 60 | * \li PendingCall::InvalidArguments |
| 61 | * \li PendingCall::Failed |
| 62 | * \endlist |
| 63 | * |
| 64 | * Returns ObexTransfer * pending call. |
| 65 | */ |
| 66 | PendingCall *sendFile(const QString &fileName); |
| 67 | |
| 68 | /*! |
| 69 | * Pulls the business card from \targetFileName within a remote device. |
| 70 | * |
| 71 | * If an empty \a targetFileName is given, a name will be |
| 72 | * automatically calculated for the temporary file. |
| 73 | * |
| 74 | * The returned ObexTransfer can be used to track progress of transfer. |
| 75 | * |
| 76 | * Possible errors: |
| 77 | * |
| 78 | * \list |
| 79 | * \li PendingCall::InvalidArguments |
| 80 | * \li PendingCall::Failed |
| 81 | * \endlist |
| 82 | * |
| 83 | * Returns ObexTransfer * pending call. |
| 84 | */ |
| 85 | PendingCall *pullBusinessCard(const QString &targetFileName); |
| 86 | |
| 87 | /*! |
| 88 | * Exchanges the business cards \a clientFileName and \a targetFileName on the remote device. |
| 89 | * |
| 90 | * This method pushes the local business card to the remote |
| 91 | * device and then retrieve the remote business card and store |
| 92 | * it in a local file. |
| 93 | * |
| 94 | * If an empty \a targetFileName is given, a name will be |
| 95 | * automatically calculated for the temporary file. |
| 96 | * |
| 97 | * The returned ObexTransfer can be used to track progress of transfer. |
| 98 | * |
| 99 | * Possible errors: |
| 100 | * |
| 101 | * \list |
| 102 | * \li PendingCall::InvalidArguments |
| 103 | * \li PendingCall::Failed |
| 104 | * \endlist |
| 105 | * |
| 106 | * Returns ObexTransfer * pending call. |
| 107 | */ |
| 108 | PendingCall *exchangeBusinessCards(const QString &clientFileName, const QString &targetFileName); |
| 109 | |
| 110 | private: |
| 111 | std::unique_ptr<class ObexObjectPushPrivate> const d; |
| 112 | |
| 113 | friend class ObexObjectPushPrivate; |
| 114 | }; |
| 115 | |
| 116 | } // namespace BluezQt |
| 117 | |
| 118 | #endif // BLUEZQT_OBEXOBJECTPUSH_H |
| 119 | |