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