BluezQt

input.cpp
1/*
2 * BluezQt - Asynchronous Bluez wrapper library
3 *
4 * SPDX-FileCopyrightText: 2015 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 "input.h"
10#include "input_p.h"
11#include "macros.h"
12#include "utils.h"
13
14#include <QVariantMap>
15
16namespace BluezQt
17{
18static Input::ReconnectMode stringToReconnectMode(const QString &mode)
19{
20 if (mode == QLatin1String("none")) {
21 return Input::NoReconnect;
22 } else if (mode == QLatin1String("host")) {
24 } else if (mode == QLatin1String("device")) {
26 }
28}
29
30InputPrivate::InputPrivate(const QString &path, const QVariantMap &properties)
31 : QObject()
32 , m_path(path)
33{
34 // Init properties
35 m_reconnectMode = stringToReconnectMode(properties.value(QStringLiteral("ReconnectMode")).toString());
36}
37
38void InputPrivate::propertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalidated)
39{
40 Q_UNUSED(invalidated)
41
42 if (interface != Strings::orgBluezInput1()) {
43 return;
44 }
45
46 QVariantMap::const_iterator i;
47 for (i = changed.constBegin(); i != changed.constEnd(); ++i) {
48 const QVariant &value = i.value();
49 const QString &property = i.key();
50
51 if (property == QLatin1String("ReconnectMode")) {
52 PROPERTY_CHANGED2(m_reconnectMode, stringToReconnectMode(value.toString()), reconnectModeChanged);
53 }
54 }
55}
56
57Input::Input(const QString &path, const QVariantMap &properties)
58 : d(new InputPrivate(path, properties))
59{
60}
61
62Input::~Input() = default;
63
64InputPtr Input::toSharedPtr() const
65{
66 return d->q.toStrongRef();
67}
68
69Input::ReconnectMode Input::reconnectMode() const
70{
71 return d->m_reconnectMode;
72}
73
74} // namespace BluezQt
75
76#include "moc_input.cpp"
77#include "moc_input_p.cpp"
ReconnectMode
Reconnect mode.
Definition input.h:35
@ DeviceReconnect
Device restores the connection.
Definition input.h:41
@ NoReconnect
Device and host are not required to automatically restore the connection.
Definition input.h:37
@ HostReconnect
Host restores the connection.
Definition input.h:39
@ AnyReconnect
Device shall attempt to restore the lost connection, but host may also restore the connection.
Definition input.h:43
char * toString(const EngineQuery &query)
QString path(const QString &relativePath)
KGuiItem properties()
QString toString() const const
T value() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 13 2024 11:49:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.