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