File indexing completed on 2024-12-01 12:29:50
0001 /* 0002 * BluezQt - Asynchronous Bluez wrapper library 0003 * 0004 * SPDX-FileCopyrightText: 2014 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 #include "obexsession.h" 0010 #include "obexsession_p.h" 0011 #include "pendingcall.h" 0012 #include "utils.h" 0013 0014 namespace BluezQt 0015 { 0016 ObexSessionPrivate::ObexSessionPrivate(const QString &path, const QVariantMap &properties) 0017 : QObject() 0018 { 0019 m_bluezSession = new BluezSession(Strings::orgBluezObex(), path, DBusConnection::orgBluezObex(), this); 0020 0021 init(properties); 0022 } 0023 0024 void ObexSessionPrivate::init(const QVariantMap &properties) 0025 { 0026 m_source = properties.value(QStringLiteral("Source")).toString(); 0027 m_destination = properties.value(QStringLiteral("Destination")).toString(); 0028 m_channel = properties.value(QStringLiteral("Channel")).toUInt(); 0029 m_target = properties.value(QStringLiteral("Target")).toString().toUpper(); 0030 m_root = properties.value(QStringLiteral("Root")).toString(); 0031 } 0032 0033 ObexSession::ObexSession(const QString &path, const QVariantMap &properties) 0034 : QObject() 0035 , d(new ObexSessionPrivate(path, properties)) 0036 { 0037 } 0038 0039 ObexSession::~ObexSession() 0040 { 0041 delete d; 0042 } 0043 0044 ObexSessionPtr ObexSession::toSharedPtr() const 0045 { 0046 return d->q.toStrongRef(); 0047 } 0048 0049 QDBusObjectPath ObexSession::objectPath() const 0050 { 0051 return QDBusObjectPath(d->m_bluezSession->path()); 0052 } 0053 0054 QString ObexSession::source() const 0055 { 0056 return d->m_source; 0057 } 0058 0059 QString ObexSession::destination() const 0060 { 0061 return d->m_destination; 0062 } 0063 0064 quint8 ObexSession::channel() const 0065 { 0066 return d->m_channel; 0067 } 0068 0069 QString ObexSession::target() const 0070 { 0071 return d->m_target; 0072 } 0073 0074 QString ObexSession::root() const 0075 { 0076 return d->m_root; 0077 } 0078 0079 PendingCall *ObexSession::getCapabilities() 0080 { 0081 return new PendingCall(d->m_bluezSession->GetCapabilities(), PendingCall::ReturnString, this); 0082 } 0083 0084 } // namespace BluezQt 0085 0086 #include "moc_obexsession.cpp" 0087 #include "moc_obexsession_p.cpp"