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