File indexing completed on 2024-04-28 03:52:05

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_OBEXSESSION_H
0010 #define BLUEZQT_OBEXSESSION_H
0011 
0012 #include <QObject>
0013 
0014 #include "bluezqt_export.h"
0015 #include "types.h"
0016 
0017 #include <memory>
0018 
0019 class QDBusObjectPath;
0020 
0021 namespace BluezQt
0022 {
0023 class PendingCall;
0024 
0025 /**
0026  * @class BluezQt::ObexSession obexsession.h <BluezQt/ObexSession>
0027  *
0028  * OBEX session.
0029  *
0030  * This class represents an OBEX session.
0031  */
0032 class BLUEZQT_EXPORT ObexSession : public QObject
0033 {
0034     Q_OBJECT
0035 
0036     Q_PROPERTY(QString source READ source)
0037     Q_PROPERTY(QString destination READ destination)
0038     Q_PROPERTY(quint8 channel READ channel)
0039     Q_PROPERTY(QString target READ target)
0040     Q_PROPERTY(QString root READ root)
0041 
0042 public:
0043     /**
0044      * Destroys an ObexSession object.
0045      */
0046     ~ObexSession() override;
0047 
0048     /**
0049      * Returns a shared pointer from this.
0050      *
0051      * @return ObexSessionPtr
0052      */
0053     ObexSessionPtr toSharedPtr() const;
0054 
0055     /**
0056      * D-Bus object path of the session.
0057      *
0058      * @return object path of session
0059      */
0060     QDBusObjectPath objectPath() const;
0061 
0062     /**
0063      * Returns address of the Bluetooth adapter.
0064      *
0065      * @see Manager::adapterForAddress() const
0066      *
0067      * @return address of adapter
0068      */
0069     QString source() const;
0070 
0071     /**
0072      * Returns address of the Bluetooth device.
0073      *
0074      * @see Manager::deviceForAddress() const
0075      *
0076      * @return address of device
0077      */
0078     QString destination() const;
0079 
0080     /**
0081      * Returns the Bluetooth channel.
0082      *
0083      * @return channel
0084      */
0085     quint8 channel() const;
0086 
0087     /**
0088      * Returns the target UUID.
0089      *
0090      * @return target UUID
0091      */
0092     QString target() const;
0093 
0094     /**
0095      * Returns the root path.
0096      *
0097      * @return root path
0098      */
0099     QString root() const;
0100 
0101     /**
0102      * Returns the remote device capabilities.
0103      *
0104      * Possible errors: PendingCall::NotSupported, PendingCall::Failed
0105      *
0106      * @return QString pending call
0107      */
0108     PendingCall *getCapabilities();
0109 
0110 private:
0111     BLUEZQT_NO_EXPORT explicit ObexSession(const QString &path, const QVariantMap &properties);
0112 
0113     std::unique_ptr<class ObexSessionPrivate> const d;
0114 
0115     friend class ObexSessionPrivate;
0116     friend class ObexManagerPrivate;
0117 };
0118 
0119 } // namespace BluezQt
0120 
0121 #endif // BLUEZQT_OBEXSESSION_H