1/*
2 * BluezQt - Asynchronous Bluez wrapper library
3 *
4 * SPDX-FileCopyrightText: 2014 David Rosca <nowrep@gmail.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#include "profileadaptor.h"
10#include "device.h"
11#include "manager.h"
12#include "profile.h"
13
14#include <QDBusMessage>
15#include <QDBusObjectPath>
16#include <QDBusUnixFileDescriptor>
17
18namespace BluezQt
19{
20ProfileAdaptor::ProfileAdaptor(Profile *parent, Manager *manager)
21 : QDBusAbstractAdaptor(parent)
22 , m_profile(parent)
23 , m_manager(manager)
24{
25}
26
27void ProfileAdaptor::NewConnection(const QDBusObjectPath &device, const QDBusUnixFileDescriptor &fd, const QVariantMap &properties, const QDBusMessage &msg)
28{
29 msg.setDelayedReply(true);
30 Request<> req(OrgBluezProfile, msg);
31
32 DevicePtr dev = m_manager->deviceForUbi(ubi: device.path());
33 if (!dev) {
34 req.cancel();
35 return;
36 }
37
38 m_profile->newConnection(device: dev, fd, properties, request: req);
39}
40
41void ProfileAdaptor::RequestDisconnection(const QDBusObjectPath &device, const QDBusMessage &msg)
42{
43 msg.setDelayedReply(true);
44 Request<> req(OrgBluezProfile, msg);
45
46 DevicePtr dev = m_manager->deviceForUbi(ubi: device.path());
47 if (!dev) {
48 req.cancel();
49 return;
50 }
51
52 m_profile->requestDisconnection(device: dev, request: req);
53}
54
55void ProfileAdaptor::Release()
56{
57 m_profile->release();
58}
59
60} // namespace BluezQt
61
62#include "moc_profileadaptor.cpp"
63

source code of bluez-qt/src/profileadaptor.cpp