ModemManagerQt

fakemodem/sms.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 "sms.h"
8
9#include <QDBusConnection>
10#include <QDBusMessage>
11
12Sms::Sms(QObject *parent)
13 : QObject(parent)
14 , m_enabledNotifications(false)
15 , m_smsClass(0)
16 , m_deliveryReportRequest(false)
17 , m_deliveryState(0)
18 , m_messageReference(0)
19 , m_pduType(0)
20 , m_serviceCategory(0)
21 , m_state(0)
22 , m_storage(0)
23 , m_teleserviceId(0)
24 , m_validity({MM_SMS_VALIDITY_TYPE_RELATIVE, MM_SMS_VALIDITY_TYPE_ENHANCED})
25{
26}
27
28Sms::~Sms()
29{
30}
31
32int Sms::smsClass() const
33{
34 return m_smsClass;
35}
36
37QByteArray Sms::data() const
38{
39 return m_data;
40}
41
42bool Sms::deliveryReportRequest() const
43{
44 return m_deliveryReportRequest;
45}
46
47uint Sms::deliveryState() const
48{
49 return m_deliveryState;
50}
51
52QString Sms::dischargeTimestamp() const
53{
54 return m_dischargeTimestamp;
55}
56
57uint Sms::messageReference() const
58{
59 return m_messageReference;
60}
61
62QString Sms::number() const
63{
64 return m_number;
65}
66
67uint Sms::pduType() const
68{
69 return m_pduType;
70}
71
72QString Sms::SMSC() const
73{
74 return m_SMSC;
75}
76
77uint Sms::serviceCategory() const
78{
79 return m_serviceCategory;
80}
81
82uint Sms::state() const
83{
84 return m_state;
85}
86
87uint Sms::storage() const
88{
89 return m_storage;
90}
91
92uint Sms::teleserviceId() const
93{
94 return m_teleserviceId;
95}
96
97QString Sms::text() const
98{
99 return m_text;
100}
101
102QString Sms::timestamp() const
103{
104 return m_timestamp;
105}
106
107ModemManager::ValidityPair Sms::validity() const
108{
109 return m_validity;
110}
111
112void Sms::Send()
113{
114}
115
116void Sms::Store(uint storage)
117{
118 Q_UNUSED(storage);
119}
120
121QString Sms::smsPath() const
122{
123 return m_smsPath;
124}
125
126void Sms::setSmsPath(const QString &path)
127{
128 m_smsPath = path;
129}
130
131void Sms::setEnableNotifications(bool enable)
132{
133 m_enabledNotifications = enable;
134}
135
136void Sms::setSmsClass(int smsClass)
137{
138 m_smsClass = smsClass;
139
140 if (m_enabledNotifications) {
141 QVariantMap map;
142 map.insert(QLatin1String("Class"), m_smsClass);
143 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
144 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
146 }
147}
148
149void Sms::setData(const QByteArray &data)
150{
151 m_data = data;
152
153 if (m_enabledNotifications) {
154 QVariantMap map;
155 map.insert(QLatin1String("Data"), m_data);
156 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
157 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
159 }
160}
161
162void Sms::setDeliveryReportRequest(bool deliveryReportRequest)
163{
164 m_deliveryReportRequest = deliveryReportRequest;
165
166 if (m_enabledNotifications) {
167 QVariantMap map;
168 map.insert(QLatin1String("DeliveryReportRequest"), m_deliveryReportRequest);
169 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
170 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
172 }
173}
174
175void Sms::setDeliveryState(uint state)
176{
177 m_deliveryState = state;
178
179 if (m_enabledNotifications) {
180 QVariantMap map;
181 map.insert(QLatin1String("DeliveryState"), m_deliveryState);
182 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
183 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
185 }
186}
187
188void Sms::setDischargeTimestamp(const QString &timestamp)
189{
190 m_dischargeTimestamp = timestamp;
191
192 if (m_enabledNotifications) {
193 QVariantMap map;
194 map.insert(QLatin1String("DischargeTimestamp"), m_dischargeTimestamp);
195 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
196 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
198 }
199}
200
201void Sms::setMessageReference(uint messageReference)
202{
203 m_messageReference = messageReference;
204
205 if (m_enabledNotifications) {
206 QVariantMap map;
207 map.insert(QLatin1String("MessageReference"), m_messageReference);
208 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
209 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
211 }
212}
213
214void Sms::setNumber(const QString &number)
215{
216 m_number = number;
217
218 if (m_enabledNotifications) {
219 QVariantMap map;
220 map.insert(QLatin1String("Number"), m_number);
221 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
222 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
224 }
225}
226void Sms::setPduType(uint pduType)
227{
228 m_pduType = pduType;
229
230 if (m_enabledNotifications) {
231 QVariantMap map;
232 map.insert(QLatin1String("PduType"), m_pduType);
233 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
234 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
236 }
237}
238
239void Sms::setSMSC(const QString &smsc)
240{
241 m_SMSC = smsc;
242
243 if (m_enabledNotifications) {
244 QVariantMap map;
245 map.insert(QLatin1String("SMSC"), m_SMSC);
246 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
247 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
249 }
250}
251
252void Sms::setServiceCategory(uint serviceCategory)
253{
254 m_serviceCategory = serviceCategory;
255
256 if (m_enabledNotifications) {
257 QVariantMap map;
258 map.insert(QLatin1String("ServiceCategory"), m_serviceCategory);
259 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
260 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
262 }
263}
264
265void Sms::setState(uint state)
266{
267 m_state = state;
268
269 if (m_enabledNotifications) {
270 QVariantMap map;
271 map.insert(QLatin1String("State"), m_state);
272 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
273 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
275 }
276}
277
278void Sms::setStorage(uint storage)
279{
280 m_storage = storage;
281
282 if (m_enabledNotifications) {
283 QVariantMap map;
284 map.insert(QLatin1String("Storage"), m_storage);
285 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
286 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
288 }
289}
290
291void Sms::setTeleserviceId(uint teleserviceId)
292{
293 m_teleserviceId = teleserviceId;
294
295 if (m_enabledNotifications) {
296 QVariantMap map;
297 map.insert(QLatin1String("TeleserviceId"), m_teleserviceId);
298 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
299 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
301 }
302}
303
304void Sms::setText(const QString &text)
305{
306 m_text = text;
307
308 if (m_enabledNotifications) {
309 QVariantMap map;
310 map.insert(QLatin1String("Text"), m_text);
311 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
312 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
314 }
315}
316
317void Sms::setTimestamp(const QString &timestamp)
318{
319 m_timestamp = timestamp;
320
321 if (m_enabledNotifications) {
322 QVariantMap map;
323 map.insert(QLatin1String("Timestamp"), m_timestamp);
324 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
325 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
327 }
328}
329
330void Sms::setValidity(const ModemManager::ValidityPair &validity)
331{
332 m_validity.validity = validity.validity;
333 m_validity.value = validity.value;
334
335 if (m_enabledNotifications) {
336 QVariantMap map;
338 QDBusMessage message = QDBusMessage::createSignal(m_smsPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("PropertiesChanged"));
339 message << QLatin1String("org.kde.fakemodem.Sms") << map << QStringList();
341 }
342}
343
344#include "moc_sms.cpp"
KIOCORE_EXPORT QString number(KIO::filesize_t size)
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)
QVariant fromValue(T &&value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:10 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.