ModemManagerQt

objectmanager.cpp
1/*
2 SPDX-FileCopyrightText: 2015 Jan Grulich <jgrulich@redhat.com>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#include "objectmanager.h"
8#include "dbus/fakedbus.h"
9
10#include <QDBusMetaType>
11
12ObjectManager::ObjectManager(QObject *parent)
13 : QDBusAbstractAdaptor(parent)
14{
15 qDBusRegisterMetaType<QDBusObjectPath>();
16 qDBusRegisterMetaType<ModemManager::MMVariantMapMap>();
17 qDBusRegisterMetaType<ModemManager::DBUSManagerStruct>();
18}
19
20ObjectManager::~ObjectManager()
21{
22}
23
24void ObjectManager::addInterfaces(const QDBusObjectPath &object_path, const ModemManager::MMVariantMapMap &interfaces_and_properties)
25{
26 if (m_managedObjects.contains(object_path)) {
27 ModemManager::MMVariantMapMap map = m_managedObjects.value(object_path);
28 map.insert(interfaces_and_properties);
29 m_managedObjects.insert(object_path, map);
30 } else {
31 m_managedObjects.insert(object_path, interfaces_and_properties);
32 }
33
34 Q_EMIT InterfacesAdded(object_path, interfaces_and_properties);
35}
36
37void ObjectManager::removeInterfaces(const QDBusObjectPath &object_path, const QStringList &interfaces)
38{
39 if (interfaces.contains(QLatin1String(MMQT_DBUS_INTERFACE_MODEM))) {
40 m_managedObjects.remove(object_path);
41 } else {
42 ModemManager::MMVariantMapMap map = m_managedObjects.value(object_path);
43 Q_FOREACH (const QString &key, interfaces) {
44 map.remove(key);
45 }
46 m_managedObjects.insert(object_path, map);
47 }
48
49 Q_EMIT InterfacesRemoved(object_path, interfaces);
50}
51
52ModemManager::DBUSManagerStruct ObjectManager::GetManagedObjects()
53{
54 return m_managedObjects;
55}
56
57#include "moc_objectmanager.cpp"
Q_EMITQ_EMIT
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:51 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.