BluezQt

obexsession.cpp
1 /*
2  * BluezQt - Asynchronous Bluez wrapper library
3  *
4  * SPDX-FileCopyrightText: 2014 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 #include "obexsession.h"
10 #include "obexsession_p.h"
11 #include "pendingcall.h"
12 #include "utils.h"
13 
14 namespace BluezQt
15 {
16 ObexSessionPrivate::ObexSessionPrivate(const QString &path, const QVariantMap &properties)
17  : QObject()
18 {
19  m_bluezSession = new BluezSession(Strings::orgBluezObex(), path, DBusConnection::orgBluezObex(), this);
20 
21  init(properties);
22 }
23 
24 void ObexSessionPrivate::init(const QVariantMap &properties)
25 {
26  m_source = properties.value(QStringLiteral("Source")).toString();
27  m_destination = properties.value(QStringLiteral("Destination")).toString();
28  m_channel = properties.value(QStringLiteral("Channel")).toUInt();
29  m_target = properties.value(QStringLiteral("Target")).toString().toUpper();
30  m_root = properties.value(QStringLiteral("Root")).toString();
31 }
32 
33 ObexSession::ObexSession(const QString &path, const QVariantMap &properties)
34  : QObject()
35  , d(new ObexSessionPrivate(path, properties))
36 {
37 }
38 
40 {
41  delete d;
42 }
43 
45 {
46  return d->q.toStrongRef();
47 }
48 
50 {
51  return QDBusObjectPath(d->m_bluezSession->path());
52 }
53 
54 QString ObexSession::source() const
55 {
56  return d->m_source;
57 }
58 
59 QString ObexSession::destination() const
60 {
61  return d->m_destination;
62 }
63 
64 quint8 ObexSession::channel() const
65 {
66  return d->m_channel;
67 }
68 
69 QString ObexSession::target() const
70 {
71  return d->m_target;
72 }
73 
74 QString ObexSession::root() const
75 {
76  return d->m_root;
77 }
78 
80 {
81  return new PendingCall(d->m_bluezSession->GetCapabilities(), PendingCall::ReturnString, this);
82 }
83 
84 } // namespace BluezQt
QDBusObjectPath objectPath() const
D-Bus object path of the session.
Definition: obexsession.cpp:49
QCA_EXPORT void init()
KGuiItem properties()
PendingCall * getCapabilities()
Returns the remote device capabilities.
Definition: obexsession.cpp:79
ObexSessionPtr toSharedPtr() const
Returns a shared pointer from this.
Definition: obexsession.cpp:44
~ObexSession() override
Destroys an ObexSession object.
Definition: obexsession.cpp:39
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Sep 25 2022 04:19:10 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.