14#include "dbus/fakedbus.h"
19#include <ModemManager/ModemManager.h>
21ModemManager::SmsPrivate::SmsPrivate(
const QString &path, Sms *q)
29 if (smsIface.isValid()) {
31 state = (MMSmsState)smsIface.state();
32 pduType = (MMSmsPduType)smsIface.pduType();
34 text = smsIface.text();
35 smsc = smsIface.SMSC();
36 data = smsIface.
data();
37 validity = smsIface.validity();
38 smsClass = smsIface.smsClass();
39 deliveryReportRequest = smsIface.deliveryReportRequest();
40 messageReference = smsIface.messageReference();
43 deliveryState = (MMSmsDeliveryState)smsIface.deliveryState();
44 storage = (MMSmsStorage)smsIface.storage();
45#if MM_CHECK_VERSION(1, 2, 0)
46 serviceCategory = (MMSmsCdmaServiceCategory)smsIface.serviceCategory();
47 teleserviceId = (MMSmsCdmaTeleserviceId)smsIface.teleserviceId();
54 , d_ptr(new SmsPrivate(
path, this))
58 qRegisterMetaType<MMSmsDeliveryState>();
59 qRegisterMetaType<MMSmsPduType>();
60 qRegisterMetaType<MMSmsState>();
61 qRegisterMetaType<MMSmsStorage>();
62#if MM_CHECK_VERSION(1, 2, 0)
63 qRegisterMetaType<MMSmsCdmaServiceCategory>();
64 qRegisterMetaType<MMSmsCdmaTeleserviceId>();
71 QStringLiteral(
"PropertiesChanged"),
78 QStringLiteral(
"PropertiesChanged"),
84ModemManager::Sms::~Sms()
89QString ModemManager::Sms::uni()
const
98 return d->smsIface.Send();
104 return d->smsIface.Store(storage);
158 return d->deliveryReportRequest;
164 return d->messageReference;
176 return d->dischargeTimestamp;
182 return d->deliveryState;
190#if MM_CHECK_VERSION(1, 2, 0)
191MMSmsCdmaServiceCategory ModemManager::Sms::serviceCategory()
const
194 return d->serviceCategory;
197MMSmsCdmaTeleserviceId ModemManager::Sms::teleserviceId()
const
200 return d->teleserviceId;
207 d->smsIface.setTimeout(timeout);
213 return d->smsIface.timeout();
216void ModemManager::SmsPrivate::onPropertiesChanged(
const QString &interfaceName,
const QVariantMap &changedProperties,
const QStringList &invalidatedProperties)
218 Q_UNUSED(invalidatedProperties);
221 if (interfaceName ==
QLatin1String(MMQT_DBUS_INTERFACE_SMS)) {
222 QVariantMap::const_iterator it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_STATE));
223 if (it != changedProperties.constEnd()) {
224 state = (MMSmsState)it->toUInt();
225 qCDebug(MMQT) << state;
226 Q_EMIT q->stateChanged(state);
228 it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_PDUTYPE));
229 if (it != changedProperties.constEnd()) {
230 pduType = (MMSmsPduType)it->toUInt();
231 Q_EMIT q->pduTypeChanged(pduType);
233 it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_NUMBER));
234 if (it != changedProperties.constEnd()) {
236 Q_EMIT q->numberChanged(number);
238 it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_SMSC));
239 if (it != changedProperties.constEnd()) {
240 smsc = it->toString();
241 Q_EMIT q->SMSCChanged(smsc);
243 it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_DATA));
244 if (it != changedProperties.constEnd()) {
245 data = it->toByteArray();
246 Q_EMIT q->dataChanged(data);
248 it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_TEXT));
249 if (it != changedProperties.constEnd()) {
250 text = it->toString();
251 Q_EMIT q->textChanged(text);
253 it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_VALIDITY));
254 if (it != changedProperties.constEnd()) {
255 validity = it->value<ValidityPair>();
256 Q_EMIT q->validityChanged(validity);
258 it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_CLASS));
259 if (it != changedProperties.constEnd()) {
260 smsClass = it->toInt();
261 Q_EMIT q->smsClassChanged(smsClass);
263 it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_DELIVERYREPORTREQUEST));
264 if (it != changedProperties.constEnd()) {
265 deliveryReportRequest = it->toBool();
266 Q_EMIT q->deliveryReportRequestChanged(deliveryReportRequest);
268 it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_MESSAGEREFERENCE));
269 if (it != changedProperties.constEnd()) {
270 messageReference = it->toUInt();
271 Q_EMIT q->messageReferenceChanged(messageReference);
273 it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_TIMESTAMP));
274 if (it != changedProperties.constEnd()) {
276 Q_EMIT q->timestampChanged(timestamp);
278 it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_DISCHARGETIMESTAMP));
279 if (it != changedProperties.constEnd()) {
281 Q_EMIT q->dischargeTimestampChanged(dischargeTimestamp);
283 it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_DELIVERYSTATE));
284 if (it != changedProperties.constEnd()) {
285 deliveryState = (MMSmsDeliveryState)it->toUInt();
286 Q_EMIT q->deliveryStateChanged(deliveryState);
288 it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_STORAGE));
289 if (it != changedProperties.constEnd()) {
290 storage = (MMSmsStorage)it->toUInt();
291 Q_EMIT q->storageChanged(storage);
293#if MM_CHECK_VERSION(1, 2, 0)
294 it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_SERVICECATEGORY));
295 if (it != changedProperties.constEnd()) {
296 serviceCategory = (MMSmsCdmaServiceCategory)it->toUInt();
297 Q_EMIT q->serviceCategoryChanged(serviceCategory);
299 it = changedProperties.constFind(
QLatin1String(MM_SMS_PROPERTY_TELESERVICEID));
300 if (it != changedProperties.constEnd()) {
301 teleserviceId = (MMSmsCdmaTeleserviceId)it->toUInt();
302 Q_EMIT q->teleserviceIdChanged(teleserviceId);
308#include "moc_sms.cpp"
309#include "moc_sms_p.cpp"
Provides an interface to manipulate and control an SMS.
MMSmsDeliveryState deliveryState() const
This method returns the delivery state of the SMS.
QDateTime dischargeTimestamp() const
Time when the SMS left the SMSC.
uint messageReference() const
This method returns the message reference of the last PDU sent/received in the SMS.
QDBusPendingReply send()
Send the SMS.
MMSmsPduType pduType() const
This method returns the Protocol Data Unit (PDU) type of the SMS.
void setTimeout(int timeout)
Sets the timeout in milliseconds for all async method DBus calls.
QDateTime timestamp() const
Time when the SMS arrived at the SMSC.
QString SMSC() const
This method returns the SMS service center number.
int smsClass() const
This method returns the 3GPP class of the SMS.
ValidityPair validity() const
This method returns the validity of the SMS.
int timeout() const
Returns the current value of the DBus timeout in milliseconds.
QString number() const
This method returns the phone number to which the SMS is addressed to.
MMSmsStorage storage() const
This method returns the storage area/location of the SMS.
QDBusPendingReply store(MMSmsStorage storage=MM_SMS_STORAGE_UNKNOWN)
Store the SMS.
QByteArray data() const
This method returns the SMS message data.
QString text() const
This method returns the text of the SMS.
MMSmsState state() const
This method returns the state of the SMS.
bool deliveryReportRequest() const
KIOCORE_EXPORT QString number(KIO::filesize_t size)
QString path(const QString &relativePath)
QDateTime fromString(QStringView string, QStringView format, QCalendar cal)
bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
QDBusConnection sessionBus()
QDBusConnection systemBus()
QString number(double n, char format, int precision)