~neon/project-neon/libmm-qt

« back to all changes in this revision

Viewing changes to sms.h

  • Committer: Jan Grulich
  • Date: 2013-10-06 11:42:12 UTC
  • Revision ID: git-v1:6b330d21e12353005970209902f3e02b2786e265
Rename files to mach classes and dbus interfaces

Update README a little bit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright 2013 Anant Kamath <kamathanant@gmail.com>
 
3
Copyright 2013 Lukas Tinkl <ltinkl@redhat.com>
 
4
 
 
5
This library is free software; you can redistribute it and/or
 
6
modify it under the terms of the GNU Lesser General Public
 
7
License as published by the Free Software Foundation; either
 
8
version 2.1 of the License, or (at your option) version 3, or any
 
9
later version accepted by the membership of KDE e.V. (or its
 
10
successor approved by the membership of KDE e.V.), which shall
 
11
act as a proxy defined in Section 6 of version 3 of the license.
 
12
 
 
13
This library is distributed in the hope that it will be useful,
 
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
Lesser General Public License for more details.
 
17
 
 
18
You should have received a copy of the GNU Lesser General Public
 
19
License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
20
*/
 
21
 
 
22
#ifndef MODEMMANAGER_SMS_H
 
23
#define MODEMMANAGER_SMS_H
 
24
 
 
25
#include "ModemManagerQt-export.h"
 
26
 
 
27
#include <QObject>
 
28
#include <QSharedPointer>
 
29
#include <QDBusPendingReply>
 
30
 
 
31
#include "generic-types.h"
 
32
 
 
33
class SmsPrivate;
 
34
 
 
35
namespace ModemManager
 
36
{
 
37
/*
 
38
* Provides an interface to manipulate and control an SMS
 
39
*
 
40
* Note: MMSmsStorage, MMSmsState, MMSmsPduType and MMSmsDeliveryState enums are defined in <ModemManager/ModemManager-enums.h>
 
41
* See http://www.freedesktop.org/software/ModemManager/api/0.8.0/ModemManager-Flags-and-Enumerations.html
 
42
*/
 
43
class MODEMMANAGERQT_EXPORT Sms : public QObject
 
44
{
 
45
Q_OBJECT
 
46
Q_DECLARE_PRIVATE(Sms)
 
47
 
 
48
public:
 
49
    typedef QSharedPointer<Sms> Ptr;
 
50
    typedef QList<Ptr> List;
 
51
 
 
52
    Sms(const QString &path, QObject *parent);
 
53
    ~Sms();
 
54
 
 
55
    /**
 
56
    * Send the SMS
 
57
    */
 
58
    QDBusPendingReply<> send();
 
59
 
 
60
    /**
 
61
    * Store the SMS
 
62
    *
 
63
    * @param storage the storage location of the SMS
 
64
    */
 
65
    QDBusPendingReply<> store(MMSmsStorage storage);
 
66
 
 
67
    /**
 
68
    * This method returns the state of the SMS
 
69
    */
 
70
    MMSmsState state() const;
 
71
 
 
72
    /**
 
73
    * This method returns the Protocol Data Unit (PDU) type of the SMS
 
74
    */
 
75
    MMSmsPduType pduType() const;
 
76
 
 
77
    /**
 
78
    * This method returns the phone number to which the SMS is addressed to
 
79
    */
 
80
    QString number() const;
 
81
 
 
82
    /**
 
83
    * This method returns the text of the SMS. text() and data() are not valid at the same time
 
84
    */
 
85
    QString text() const;
 
86
 
 
87
    /**
 
88
    * This method returns the SMS service center number
 
89
    */
 
90
    QString smsc() const;
 
91
 
 
92
    /**
 
93
    * This method returns the SMS message data. text() and data() are not valid at the same time
 
94
    */
 
95
    QByteArray data() const;
 
96
 
 
97
    /**
 
98
    * This method returns the validity of the SMS
 
99
    *
 
100
    * @return A ValidityPair struct composed of a MMSmsValidityType type and a value indicating the validity of the SMS
 
101
    */
 
102
    ValidityPair validity() const;
 
103
 
 
104
    /**
 
105
    * This method returns the 3GPP class of the SMS
 
106
    */
 
107
    int smsClass() const;
 
108
 
 
109
    /**
 
110
     * @return @c true if a delivery report is requested, @c false otherwise
 
111
     */
 
112
    bool deliveryReportRequest() const;
 
113
 
 
114
    /**
 
115
    * This method returns the message reference of the last PDU sent/received in the SMS.
 
116
    * The message reference is the number used to identify the SMS in the SMSC.
 
117
    * 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
 
118
    */
 
119
    uint messageReference() const;
 
120
 
 
121
    /**
 
122
    * Time when the SMS arrived at the SMSC
 
123
    */
 
124
    QDateTime timestamp() const;
 
125
 
 
126
    /**
 
127
    * Time when the SMS left the SMSC
 
128
    */
 
129
    QDateTime dischargeTimestamp() const;
 
130
 
 
131
    /**
 
132
    * This method returns the delivery state of the SMS
 
133
    */
 
134
    MMSmsDeliveryState deliveryState() const;
 
135
 
 
136
    /**
 
137
    * This method returns the storage area/location of the SMS
 
138
    */
 
139
    MMSmsStorage storage() const;
 
140
 
 
141
Q_SIGNALS:
 
142
    /**
 
143
    * This signal is emitted when the state of the SMS has changed
 
144
    *
 
145
    * @param newState the new state of the SMS
 
146
    */
 
147
    void stateChanged(MMSmsState newState);
 
148
 
 
149
    /**
 
150
    * This signal is emitted when the delivery state of the SMS has changed
 
151
    *
 
152
    * @param newDeliveryState the new delivery state of the SMS
 
153
    */
 
154
    void deliveryStateChanged(MMSmsDeliveryState newDeliveryState);
 
155
 
 
156
private Q_SLOTS:
 
157
    void onPropertiesChanged(const QString &interface, const QVariantMap &changedProperties, const QStringList &invalidatedProps);
 
158
 
 
159
private:
 
160
    SmsPrivate *d_ptr;
 
161
};
 
162
 
 
163
} // namespace ModemManager
 
164
 
 
165
#endif