File indexing completed on 2025-01-19 06:44:38
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() = default; 0040 0041 ObexSessionPtr ObexSession::toSharedPtr() const 0042 { 0043 return d->q.toStrongRef(); 0044 } 0045 0046 QDBusObjectPath ObexSession::objectPath() const 0047 { 0048 return QDBusObjectPath(d->m_bluezSession->path()); 0049 } 0050 0051 QString ObexSession::source() const 0052 { 0053 return d->m_source; 0054 } 0055 0056 QString ObexSession::destination() const 0057 { 0058 return d->m_destination; 0059 } 0060 0061 quint8 ObexSession::channel() const 0062 { 0063 return d->m_channel; 0064 } 0065 0066 QString ObexSession::target() const 0067 { 0068 return d->m_target; 0069 } 0070 0071 QString ObexSession::root() const 0072 { 0073 return d->m_root; 0074 } 0075 0076 PendingCall *ObexSession::getCapabilities() 0077 { 0078 return new PendingCall(d->m_bluezSession->GetCapabilities(), PendingCall::ReturnString, this); 0079 } 0080 0081 } // namespace BluezQt 0082 0083 #include "moc_obexsession.cpp" 0084 #include "moc_obexsession_p.cpp"