Qt bindings for oFono cellular services  1.30
ofonomodem.h
1 /*
2  * This file is part of ofono-qt
3  *
4  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5  *
6  * Contact: Alexander Kanavin <alex.kanavin@gmail.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 
25 #ifndef OFONOMODEM_H
26 #define OFONOMODEM_H
27 
28 #include <QtCore/QObject>
29 #include <QtCore/QStringList>
30 #include "libofono-qt_global.h"
31 
32 class OfonoModemManager;
33 class OfonoInterface;
34 
36 
40 class OFONO_QT_EXPORT OfonoModem : public QObject
41 {
42 
43 Q_OBJECT
44 
45 Q_PROPERTY(bool isValid READ isValid NOTIFY validityChanged)
46 Q_PROPERTY(QString path READ path NOTIFY pathChanged)
47 Q_PROPERTY(QString errorName READ errorName)
48 Q_PROPERTY(QString errorMessage READ errorMessage)
49 
50 Q_PROPERTY(bool powered READ powered WRITE setPowered NOTIFY poweredChanged)
51 Q_PROPERTY(bool online READ online WRITE setOnline NOTIFY onlineChanged)
52 Q_PROPERTY(bool lockdown READ lockdown WRITE setLockdown NOTIFY lockdownChanged)
53 Q_PROPERTY(bool emergency READ emergency NOTIFY emergencyChanged)
54 
55 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
56 Q_PROPERTY(QString manufacturer READ manufacturer NOTIFY manufacturerChanged)
57 Q_PROPERTY(QString model READ model NOTIFY modelChanged)
58 Q_PROPERTY(QString revision READ revision NOTIFY revisionChanged)
59 Q_PROPERTY(QString serial READ serial NOTIFY serialChanged)
60 Q_PROPERTY(QString type READ type NOTIFY typeChanged)
61 
62 Q_PROPERTY(QStringList features READ features NOTIFY featuresChanged)
63 Q_PROPERTY(QStringList interfaces READ interfaces NOTIFY interfacesChanged)
64 
65 public:
66 
69  AutomaticSelect,
72  ManualSelect
76  };
77 
83  OfonoModem(SelectionSetting setting, const QString& modemPath, QObject *parent=0);
84 
85  ~OfonoModem();
86 
88  bool isValid() const;
89 
91  QString path() const;
92 
94 
98  QString errorName() const;
99 
101 
105  QString errorMessage() const;
106 
107  bool powered() const;
108  bool online() const;
109  bool lockdown() const;
110  bool emergency() const;
111 
112  QString name() const;
113  QString manufacturer() const;
114  QString model() const;
115  QString revision() const;
116  QString serial() const;
117  QString type() const;
118 
119  QStringList features() const;
120  QStringList interfaces() const;
121 
122 public Q_SLOTS:
123  void setPowered(bool powered);
124  void setOnline(bool online);
125  void setLockdown(bool lockdown);
126 
127 Q_SIGNALS:
129  void validityChanged(bool validity);
131  void pathChanged(QString modemPath);
132 
133  void poweredChanged(bool powered);
134  void setPoweredFailed();
135  void onlineChanged(bool online);
136  void setOnlineFailed();
137  void lockdownChanged(bool lockdown);
138  void setLockdownFailed();
139  void emergencyChanged(bool emergency);
140 
141  void nameChanged(const QString &name);
142  void manufacturerChanged(const QString &manufacturer);
143  void modelChanged(const QString &model);
144  void revisionChanged(const QString &revision);
145  void serialChanged(const QString &serial);
146  void typeChanged(const QString &type);
147 
148  void featuresChanged(const QStringList &features);
149  void interfacesChanged(const QStringList &interfaces);
150 
151 
152 private Q_SLOTS:
153  void propertyChanged(const QString &property, const QVariant &value);
154  void setPropertyFailed(const QString& property);
155  void modemAdded(const QString &modem);
156  void modemRemoved(const QString &modem);
157 
158 private:
159  void modemsChanged();
160 
161 private:
162  OfonoModemManager *m_mm;
163  OfonoInterface *m_if;
164  SelectionSetting m_selectionSetting;
165  bool m_isValid;
166 };
167 #endif
This class is used to access an oFono modem object and its properties.
Definition: ofonomodem.h:40
Provides access to the list of available modems and changes in that list.
Definition: ofonomodemmanager.h:34
SelectionSetting
How the modem object should select a modem.
Definition: ofonomodem.h:68