ModemManagerQt

modemmessaging.h
1/*
2 SPDX-FileCopyrightText: 2013 Anant Kamath <kamathanant@gmail.com>
3 SPDX-FileCopyrightText: 2013 Lukas Tinkl <ltinkl@redhat.com>
4 SPDX-FileCopyrightText: 2013-2015 Jan Grulich <jgrulich@redhat.com>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8
9#ifndef MODEMMANAGERQT_MODEMMESSAGING_H
10#define MODEMMANAGERQT_MODEMMESSAGING_H
11
12#include <modemmanagerqt_export.h>
13
14#include <QObject>
15#include <QSharedPointer>
16
17#include "generictypes.h"
18#include "interface.h"
19#include "sms.h"
20
21namespace ModemManager
22{
23class ModemMessagingPrivate;
24
25/**
26 * @brief The ModemMessaging class
27 *
28 * The Messaging interface handles sending SMS messages and notification of new incoming messages.
29 */
30class MODEMMANAGERQT_EXPORT ModemMessaging : public Interface
31{
32 Q_OBJECT
33 Q_DECLARE_PRIVATE(ModemMessaging)
34
35public:
36 struct Message {
37 QString number;
38 QString text;
39 QByteArray data;
40 };
41
43 typedef QList<Ptr> List;
44
45 explicit ModemMessaging(const QString &path, QObject *parent = nullptr);
46 ~ModemMessaging() override;
47
48 /**
49 * @return A list of MMSmsStorage values, specifying the storages supported by this
50 * modem for storing and receiving SMS.
51 */
52 QList<MMSmsStorage> supportedStorages() const;
53
54 /**
55 * @return A MMSmsStorage value, specifying the storage to be used when receiving or storing SMS.
56 */
57 MMSmsStorage defaultStorage() const;
58
59 /**
60 * Retrieve all SMS messages.
61 *
62 * This method should only be used once and subsequent information retrieved
63 * either by listening for the messageAdded() signal, or by
64 * querying the specific SMS object of interest using findMessage()
65 */
66 ModemManager::Sms::List messages() const;
67
68 /**
69 * Creates a new message object.
70 * @param message Message structure with the 'number' and either 'text' or 'data' properties
71 */
72 QDBusPendingReply<QDBusObjectPath> createMessage(const Message &message);
73 /**
74 * Creates a new message object.
75 * @param message QVariantMap containing message properties
76 * The 'number' and either 'text' or 'data' properties are mandatory, others are optional.
77 */
78 QDBusPendingReply<QDBusObjectPath> createMessage(const QVariantMap &message);
79
80 /**
81 * Delete an SMS message.
82 *
83 * @param uni path to the Sms object
84 */
85 QDBusPendingReply<void> deleteMessage(const QString &uni);
86
87 /**
88 * @param uni path to the Sms object
89 * @return pointer to the found Sms (may be null if not found)
90 */
91 ModemManager::Sms::Ptr findMessage(const QString &uni);
92
93 /**
94 * Sets the timeout in milliseconds for all async method DBus calls.
95 * -1 means the default DBus timeout (usually 25 seconds).
96 */
97 void setTimeout(int timeout);
98
99 /**
100 * Returns the current value of the DBus timeout in milliseconds.
101 * -1 means the default DBus timeout (usually 25 seconds).
102 */
103 int timeout() const;
104
105Q_SIGNALS:
106 /**
107 * Emitted when any part of a new SMS has been received or added (but not
108 * for subsequent parts, if any). For messages received from the network,
109 * not all parts may have been received and the message may not be
110 * complete.
111 *
112 * Check the 'State' property to determine if the message is complete.
113 *
114 * @param uni path to the Sms object
115 * @param received @p true if the message was received from the network, as opposed to being added locally.
116 */
117 void messageAdded(const QString &uni, bool received);
118
119 /**
120 * Emitted when a message has been deleted.
121 * @param uni path to the Sms object
122 */
123 void messageDeleted(const QString &uni);
124};
125
126} // namespace ModemManager
127
128#endif
The ModemMessaging class.
void messageDeleted(const QString &uni)
Emitted when a message has been deleted.
void messageAdded(const QString &uni, bool received)
Emitted when any part of a new SMS has been received or added (but not for subsequent parts,...
This namespace allows to query the underlying system to discover the available modem interfaces respo...
Definition bearer.cpp:20
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.