ModemManagerQt

sms.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_SMS_H
10#define MODEMMANAGERQT_SMS_H
11
12#include <modemmanagerqt_export.h>
13
14#include <QDBusPendingReply>
15#include <QObject>
16#include <QSharedPointer>
17
18#include "generictypes.h"
19
20namespace ModemManager
21{
22class SmsPrivate;
23
24/**
25 * Provides an interface to manipulate and control an SMS
26 *
27 * Note: MMSmsStorage, MMSmsState, MMSmsPduType and MMSmsDeliveryState enums are defined in <ModemManager/ModemManager-enums.h>
28 * See http://www.freedesktop.org/software/ModemManager/api/1.0.0/ModemManager-Flags-and-Enumerations.html
29 */
30class MODEMMANAGERQT_EXPORT Sms : public QObject
31{
32 Q_OBJECT
33 Q_DECLARE_PRIVATE(Sms)
34
35public:
37 typedef QList<Ptr> List;
38
39 explicit Sms(const QString &path, QObject *parent = nullptr);
40 ~Sms() override;
41
42 QString uni() const;
43
44 /**
45 * Send the SMS
46 */
48
49 /**
50 * Store the SMS
51 *
52 * @param storage the storage location of the SMS (empty for default storage)
53 */
54 QDBusPendingReply<> store(MMSmsStorage storage = MM_SMS_STORAGE_UNKNOWN);
55
56 /**
57 * This method returns the state of the SMS
58 */
59 MMSmsState state() const;
60
61 /**
62 * This method returns the Protocol Data Unit (PDU) type of the SMS
63 */
64 MMSmsPduType pduType() const;
65
66 /**
67 * This method returns the phone number to which the SMS is addressed to
68 */
69 QString number() const;
70
71 /**
72 * This method returns the text of the SMS. text() and data() are not valid at the same time
73 */
74 QString text() const;
75
76 /**
77 * This method returns the SMS service center number
78 */
79 QString SMSC() const;
80
81 /**
82 * This method returns the SMS message data. text() and data() are not valid at the same time
83 */
84 QByteArray data() const;
85
86 /**
87 * This method returns the validity of the SMS
88 *
89 * @return A ValidityPair struct composed of a MMSmsValidityType type and a value indicating the validity of the SMS
90 */
91 ValidityPair validity() const;
92
93 /**
94 * This method returns the 3GPP class of the SMS
95 */
96 int smsClass() const;
97
98 /**
99 * @return @c true if a delivery report is requested, @c false otherwise
100 */
101 bool deliveryReportRequest() const;
102
103 /**
104 * This method returns the message reference of the last PDU sent/received in the SMS.
105 * The message reference is the number used to identify the SMS in the SMSC.
106 * If the PDU type is MM_SMS_PDU_TYPE_STATUS_REPORT, this field identifies the Message Reference of the PDU associated to the status report
107 */
108 uint messageReference() const;
109
110 /**
111 * Time when the SMS arrived at the SMSC
112 */
113 QDateTime timestamp() const;
114
115 /**
116 * Time when the SMS left the SMSC
117 */
118 QDateTime dischargeTimestamp() const;
119
120 /**
121 * This method returns the delivery state of the SMS
122 */
123 MMSmsDeliveryState deliveryState() const;
124
125 /**
126 * This method returns the storage area/location of the SMS
127 */
128 MMSmsStorage storage() const;
129#if MM_CHECK_VERSION(1, 2, 0)
130 /**
131 * @return service category for CDMA SMS, as defined in 3GPP2 C.R1001-D (section 9.3).
132 * @since 1.1.91
133 */
134 MMSmsCdmaServiceCategory serviceCategory() const;
135
136 /**
137 * @return teleservice IDs supported for CDMA SMS, as defined in 3GPP2 X.S0004-550-E
138 * (section 2.256) and 3GPP2 C.S0015-B (section 3.4.3.1)
139 * @since 1.1.91
140 */
141 MMSmsCdmaTeleserviceId teleserviceId() const;
142#endif
143
144 /**
145 * Sets the timeout in milliseconds for all async method DBus calls.
146 * -1 means the default DBus timeout (usually 25 seconds).
147 */
148 void setTimeout(int timeout);
149
150 /**
151 * Returns the current value of the DBus timeout in milliseconds.
152 * -1 means the default DBus timeout (usually 25 seconds).
153 */
154 int timeout() const;
155
156Q_SIGNALS:
157 /**
158 * This signal is emitted when the state of the SMS has changed
159 *
160 * @param newState the new state of the SMS
161 */
162 void stateChanged(MMSmsState newState);
163 void pduTypeChanged(MMSmsPduType pduType);
164 void numberChanged(const QString &number);
165 void SMSCChanged(const QString &smsc);
166 void dataChanged(const QByteArray &data);
167 void textChanged(const QString &text);
168 void validityChanged(const ModemManager::ValidityPair &validity);
169 void smsClassChanged(int smsClass);
170 void deliveryReportRequestChanged(bool deliveryReportRequest);
171 void messageReferenceChanged(uint messageReference);
172 void timestampChanged(const QDateTime &timestamp);
173 void dischargeTimestampChanged(const QDateTime &dischargeTimestamp);
174 /**
175 * This signal is emitted when the delivery state of the SMS has changed
176 *
177 * @param newDeliveryState the new delivery state of the SMS
178 */
179 void deliveryStateChanged(MMSmsDeliveryState newDeliveryState);
180 void storageChanged(MMSmsStorage storage);
181 void serviceCategoryChanged(MMSmsCdmaServiceCategory serviceCategory);
182 void teleserviceIdChanged(MMSmsCdmaTeleserviceId teleserviceId);
183
184private:
185 SmsPrivate *const d_ptr;
186};
187
188} // namespace ModemManager
189
190#endif
Provides an interface to manipulate and control an SMS.
Definition sms.h:31
void stateChanged(MMSmsState newState)
This signal is emitted when the state of the SMS has changed.
void deliveryStateChanged(MMSmsDeliveryState newDeliveryState)
This signal is emitted when the delivery state of the SMS has changed.
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.