| 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 |
|
| 39 |
ObexSession::~ObexSession() = default; |
| 40 |
|
| 41 |
ObexSessionPtr ObexSession::toSharedPtr() const |
| 42 |
{ |
| 43 |
return d->q.toStrongRef(); |
| 44 |
} |
| 45 |
|
| 46 |
QDBusObjectPath ObexSession::objectPath() const |
| 47 |
{ |
| 48 |
return QDBusObjectPath(d->m_bluezSession->path()); |
| 49 |
} |
| 50 |
|
| 51 |
QString ObexSession::source() const |
| 52 |
{ |
| 53 |
return d->m_source; |
| 54 |
} |
| 55 |
|
| 56 |
QString ObexSession::destination() const |
| 57 |
{ |
| 58 |
return d->m_destination; |
| 59 |
} |
| 60 |
|
| 61 |
quint8 ObexSession::channel() const |
| 62 |
{ |
| 63 |
return d->m_channel; |
| 64 |
} |
| 65 |
|
| 66 |
QString ObexSession::target() const |
| 67 |
{ |
| 68 |
return d->m_target; |
| 69 |
} |
| 70 |
|
| 71 |
QString ObexSession::root() const |
| 72 |
{ |
| 73 |
return d->m_root; |
| 74 |
} |
| 75 |
|
| 76 |
PendingCall *ObexSession::getCapabilities() |
| 77 |
{ |
| 78 |
return new PendingCall(d->m_bluezSession->GetCapabilities(), PendingCall::ReturnString, this); |
| 79 |
} |
| 80 |
|
| 81 |
} // namespace BluezQt |
| 82 |
|
| 83 |
#include "moc_obexsession.cpp" |
| 84 |
#include "moc_obexsession_p.cpp" |