File indexing completed on 2024-05-05 03:52: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_OBEXOBJECTPUSH_H
0010 #define BLUEZQT_OBEXOBJECTPUSH_H
0011 
0012 #include <QObject>
0013 
0014 #include "bluezqt_export.h"
0015 
0016 #include <memory>
0017 
0018 class QDBusObjectPath;
0019 
0020 namespace BluezQt
0021 {
0022 class PendingCall;
0023 
0024 /**
0025  * @class BluezQt::ObexObjectPush obexobjectpush.h <BluezQt/ObexObjectPush>
0026  *
0027  * OBEX object push.
0028  *
0029  * This class represents an OBEX object push interface.
0030  */
0031 class BLUEZQT_EXPORT ObexObjectPush : public QObject
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036     /**
0037      * Creates a new ObexObjectPush object.
0038      *
0039      * This class will be typically used with a @p path
0040      * from result of ObexManager::createSession().
0041      *
0042      * @param path path of session
0043      * @param parent
0044      */
0045     explicit ObexObjectPush(const QDBusObjectPath &path, QObject *parent = nullptr);
0046 
0047     /**
0048      * Destroys an ObexObjectPush object.
0049      */
0050     ~ObexObjectPush() override;
0051 
0052     /**
0053      * D-Bus object path of the object push session.
0054      *
0055      * @return object path of session
0056      */
0057     QDBusObjectPath objectPath() const;
0058 
0059     /**
0060      * Sends one local file to the remote device.
0061      *
0062      * The returned ObexTransfer can be used to track progress of transfer.
0063      *
0064      * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed
0065      *
0066      * @param fileName full path of file to send
0067      * @return ObexTransfer * pending call
0068      */
0069     PendingCall *sendFile(const QString &fileName);
0070 
0071     /**
0072      * Pulls the business card from a remote device.
0073      *
0074      * If an empty @p targetFileName is given, a name will be
0075      * automatically calculated for the temporary file.
0076      *
0077      * The returned ObexTransfer can be used to track progress of transfer.
0078      *
0079      * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed
0080      *
0081      * @param targetFileName full path where the business card will be saved
0082      * @return ObexTransfer * pending call
0083      */
0084     PendingCall *pullBusinessCard(const QString &targetFileName);
0085 
0086     /**
0087      * Exchanges the business cards on the remote device.
0088      *
0089      * This method pushes the local business card to the remote
0090      * device and then retrieve the remote business card and store
0091      * it in a local file.
0092      *
0093      * If an empty @p targetFileName is given, a name will be
0094      * automatically calculated for the temporary file.
0095      *
0096      * The returned ObexTransfer can be used to track progress of transfer.
0097      *
0098      * Possible errors: PendingCall::InvalidArguments, PendingCall::Failed
0099      *
0100      * @param clientFileName full path to local business card
0101      * @param targetFileName full path where the business card will be saved
0102      * @return ObexTransfer * pending call
0103      */
0104     PendingCall *exchangeBusinessCards(const QString &clientFileName, const QString &targetFileName);
0105 
0106 private:
0107     std::unique_ptr<class ObexObjectPushPrivate> const d;
0108 
0109     friend class ObexObjectPushPrivate;
0110 };
0111 
0112 } // namespace BluezQt
0113 
0114 #endif // BLUEZQT_OBEXOBJECTPUSH_H