Added SMS support in ofono-qt
[profile/ivi/ofono-qt.git] / lib / ofonomessagemanager.h
1 /*
2  * This file is part of ofono-qt
3  *
4  * Copyright (C) 2010-2011 Nokia Corporation and/or its subsidiary(-ies).
5  *
6  * Contact: Alexander Kanavin <alexander.kanavin@nokia.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * version 2.1 as published by the Free Software Foundation.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  *
22  */
23  
24 #ifndef OFONOMESSAGEMANAGER_H
25 #define OFONOMESSAGEMANAGER_H
26
27 #include <QtCore/QObject>
28 #include <QDBusError>
29 #include <QDBusObjectPath>
30 #include "ofonomodeminterface.h"
31 #include "libofono-qt_global.h"
32
33 struct OfonoMessageManagerStruct {
34     QDBusObjectPath path;
35     QVariantMap properties;
36 };
37 typedef QList<OfonoMessageManagerStruct> OfonoMessageManagerList;
38
39 Q_DECLARE_METATYPE(OfonoMessageManagerStruct)
40 Q_DECLARE_METATYPE(OfonoMessageManagerList)
41
42 //! This class is used to access oFono message manager API
43 /*!
44  * oFono message manager API is documented in
45  * http://git.kernel.org/?p=network/ofono/ofono.git;a=blob_plain;f=doc/messagemanager-api.txt
46  */
47 class OFONO_QT_EXPORT OfonoMessageManager : public OfonoModemInterface
48 {
49     Q_OBJECT
50
51 public:
52     OfonoMessageManager(OfonoModem::SelectionSetting modemSetting, const QString &modemPath, QObject *parent=0);
53     ~OfonoMessageManager();
54
55     /* Properties */
56     void requestServiceCenterAddress();
57     void setServiceCenterAddress(QString address);
58     void requestUseDeliveryReports();
59     void setUseDeliveryReports(bool useDeliveryReports);
60     void requestBearer();
61     void setBearer(QString bearer);
62     void requestAlphabet();
63     void setAlphabet(QString alphabet);
64
65     QStringList getMessages() const;
66     void sendMessage(const QString &to, const QString &message);
67
68 signals:
69     void serviceCenterAddressChanged(const QString &address);
70     void useDeliveryReportsChanged(const bool &useDeliveryReports);
71     void bearerChanged(const QString &bearer);
72     void alphabetChanged(const QString &alphabet);
73
74     void serviceCenterAddressComplete(bool success, const QString &address);
75     void useDeliveryReportsComplete(bool success, const bool &useDeliveryReports);
76     void bearerComplete(bool success, const QString &bearer);
77     void alphabetComplete(bool success, const QString &alphabet);
78     void sendMessageComplete(bool success, const QDBusObjectPath& objectPath);
79
80     void setServiceCenterAddressFailed();
81     void setUseDeliveryReportsFailed();
82     void setBearerFailed();
83     void setAlphabetFailed();
84
85     void messageAdded(const QString &message);
86     void messageRemoved(const QString &message);
87     void immediateMessage(const QString &message, const QVariantMap &info);
88     void incomingMessage(const QString &message, const QVariantMap &info);
89
90 private slots:
91     void propertyChanged(const QString &property, const QVariant &value);
92     void setPropertyFailed(const QString &property);
93     void requestPropertyComplete(bool success, const QString &property, const QVariant &value);
94     void onMessageAdded(const QDBusObjectPath &message, const QVariantMap &properties);
95     void onMessageRemoved(const QDBusObjectPath &message);
96     void sendMessageResp(const QDBusObjectPath& objectPath);
97     void sendMessageErr(QDBusError error);
98
99 private:
100     QStringList m_messagelist;
101 };
102
103 #endif  /* !OFONOMESSAGEMANAGER_H */