ModemManagerQt

fakemodem/modem3gppussd.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 "modem3gppussd.h"
8
9#include <QDBusConnection>
10#include <QDBusMessage>
11
12Modem3gppUssd::Modem3gppUssd(QObject *parent)
13 : QDBusAbstractAdaptor(parent)
14 , m_enabledNotifications(false)
15 , m_state(0)
16{
17}
18
19Modem3gppUssd::~Modem3gppUssd()
20{
21}
22
23QString Modem3gppUssd::networkNotification() const
24{
25 return m_networkNotification;
26}
27
28QString Modem3gppUssd::networkRequest() const
29{
30 return m_networkRequest;
31}
32
33uint Modem3gppUssd::state() const
34{
35 return m_state;
36}
37
38void Modem3gppUssd::Cancel()
39{
40}
41
42QString Modem3gppUssd::Initiate(const QString &command)
43{
44 Q_UNUSED(command);
45 return QString();
46}
47
48QString Modem3gppUssd::Respond(const QString &response)
49{
50 Q_UNUSED(response);
51 return QString();
52}
53
54void Modem3gppUssd::setModemPath(const QString &path)
55{
56 m_modemPath = path;
57}
58
59void Modem3gppUssd::setEnableNotifications(bool enable)
60{
61 m_enabledNotifications = enable;
62}
63
64void Modem3gppUssd::setNetworkNotification(const QString &networkNotification)
65{
66 m_networkNotification = networkNotification;
67
68 if (m_enabledNotifications) {
69 QVariantMap map;
70 map.insert(QLatin1String("NetworkNotification"), m_networkNotification);
71 QDBusMessage message = QDBusMessage::createSignal(m_modemPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
72 message << QLatin1String("org.kde.fakemodem.Modem.Modem3gpp.Ussd") << map << QStringList();
74 }
75}
76
77void Modem3gppUssd::setNetworkRequest(const QString &networkRequest)
78{
79 m_networkRequest = networkRequest;
80
81 if (m_enabledNotifications) {
82 QVariantMap map;
83 map.insert(QLatin1String("NetworkRequest"), m_networkRequest);
84 QDBusMessage message = QDBusMessage::createSignal(m_modemPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
85 message << QLatin1String("org.kde.fakemodem.Modem.Modem3gpp.Ussd") << map << QStringList();
87 }
88}
89
90void Modem3gppUssd::setState(uint state)
91{
92 m_state = state;
93
94 if (m_enabledNotifications) {
95 QVariantMap map;
96 map.insert(QLatin1String("State"), m_state);
97 QDBusMessage message = QDBusMessage::createSignal(m_modemPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
98 message << QLatin1String("org.kde.fakemodem.Modem.Modem3gpp.Ussd") << map << QStringList();
100 }
101}
102
103QVariantMap Modem3gppUssd::toMap() const
104{
105 QVariantMap map;
106 map.insert(QLatin1String(MM_MODEM_MODEM3GPP_USSD_PROPERTY_STATE), m_state);
107 map.insert(QLatin1String(MM_MODEM_MODEM3GPP_USSD_PROPERTY_NETWORKNOTIFICATION), m_networkNotification);
108 map.insert(QLatin1String(MM_MODEM_MODEM3GPP_USSD_PROPERTY_NETWORKREQUEST), m_networkRequest);
109 return map;
110}
111
112#include "moc_modem3gppussd.cpp"
QString path(const QString &relativePath)
bool send(const QDBusMessage &message) const const
QDBusConnection sessionBus()
QDBusMessage createSignal(const QString &path, const QString &interface, const QString &name)
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 Sat Dec 21 2024 16:59:51 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.