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_OBEXAGENT_H
10#define BLUEZQT_OBEXAGENT_H
11
12#include <QObject>
13
14#include "bluezqt_export.h"
15#include "request.h"
16#include "types.h"
17
18class QDBusObjectPath;
19
20namespace BluezQt
21{
22class ObexTransfer;
23
24/**
25 * @class BluezQt::ObexAgent obexagent.h <BluezQt/ObexAgent>
26 *
27 * Bluetooth OBEX agent.
28 *
29 * This class represents a Bluetooth OBEX agent.
30 *
31 * The agent is used to authorize an incoming object push requests.
32 *
33 * @note The return value of request will be sent asynchronously with Request class.
34 * It is also possible to cancel/reject the request.
35 */
36class BLUEZQT_EXPORT ObexAgent : public QObject
37{
38 Q_OBJECT
39
40public:
41 /**
42 * Creates a new ObexAgent object.
43 *
44 * @param parent
45 */
46 explicit ObexAgent(QObject *parent = nullptr);
47
48 /**
49 * D-Bus object path of the agent.
50 *
51 * The path where the agent will be registered.
52 *
53 * @note You must provide valid object path!
54 *
55 * @return object path of agent
56 */
57 virtual QDBusObjectPath objectPath() const = 0;
58
59 /**
60 * Requests the agent to authorize an incoming object push request.
61 *
62 * This method gets called when the Bluetooth daemon
63 * needs to accept/reject a Bluetooth object push request.
64 *
65 * The return value should be full path where the incoming object
66 * will be saved.
67 *
68 * The ObexTransfer::fileName() contains the default location
69 * and name that can be returned.
70 *
71 * You can use @p session to get device and adapter this transfer
72 * belongs to.
73 *
74 * @param transfer transfer object
75 * @param session transfer session
76 * @param request request to be used for sending reply
77 */
78 virtual void authorizePush(ObexTransferPtr transfer, ObexSessionPtr session, const Request<QString> &request);
79
80 /**
81 * Indicate that the agent request failed before receiving reply.
82 *
83 * This method gets called to indicate that the agent
84 * request failed before a reply was returned.
85 *
86 * It cancels the previous request.
87 */
88 virtual void cancel();
89
90 /**
91 * Indicates that the agent was unregistered.
92 *
93 * This method gets called when the Bluetooth daemon
94 * unregisters the agent.
95 *
96 * An agent can use it to do cleanup tasks. There is no need
97 * to unregister the agent, because when this method gets called
98 * it has already been unregistered.
99 */
100 virtual void release();
101};
102
103} // namespace BluezQt
104
105#endif // BLUEZQT_OBEXAGENT_H
106

source code of bluez-qt/src/obexagent.h