File: ofonomodeminterface.h

package info (click to toggle)
libofono-qt 1.30-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 960 kB
  • sloc: cpp: 6,663; xml: 77; makefile: 14
file content (116 lines) | stat: -rw-r--r-- 3,633 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
 * This file is part of ofono-qt
 *
 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 *
 * Contact: Alexander Kanavin <alex.kanavin@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * version 2.1 as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 *
 */

#ifndef OFONOMODEMINTERFACE_H
#define OFONOMODEMINTERFACE_H

#include <QtCore/QObject>
#include <QStringList>
#include "ofonomodem.h"
#include "ofonopropertysetting.h"
#include "libofono-qt_global.h"

class OfonoInterface;

//! This class implements a generic modem interface object
/*!
 * It provides validity checking and modem binding.
 * It should not be instantiated directly; instead you should instantiate
 * interface-specific subclasses.
 */
class OFONO_QT_EXPORT OfonoModemInterface : public QObject
{
    Q_OBJECT
    
    Q_PROPERTY(bool isValid READ isValid NOTIFY validityChanged)
    Q_PROPERTY(QString path READ path)
    Q_PROPERTY(QString errorName READ errorName)
    Q_PROPERTY(QString errorMessage READ errorMessage)
    
public:

    //! Construct a modem interface object
    /*!
     * \param modemSetting modem selection setting
     * \param modemPath path to the modem (may not be significant, depending on modemSetting)
     * \param ifname d-bus interface name
     * \param propertySetting oFono d-bus properties setting
     */
    OfonoModemInterface(OfonoModem::SelectionSetting modemSetting, const QString& modemPath, const QString& ifname, OfonoGetPropertySetting propertySetting, QObject *parent=0);
    ~OfonoModemInterface();

    //! Check that the modem interface object is valid
    /*!
     * This means that a modem d-bus object
     * exists and has the d-bus interface specified in the contstructor.
     */
    bool isValid() const;
    
    //! Get the modem object that this interface belongs to.
    /*!
     * The ownership of the modem object stays with the OfonoModemInterface object.
     */
    OfonoModem *modem() const;
    
    //! Returns the D-Bus object path of the interface
    QString path() const;
    
    //! Get the D-Bus error name of the last operation.
    /*!
     * Returns the D-Bus error name of the last operation (setting a property
     * or calling a method) if it has failed
     */
    QString errorName() const;

    //! Get the D-Bus error message of the last operation.
    /*!
     * Returns the D-Bus error message of the last operation (setting a property
     * or calling a method) if it has failed
     */
    QString errorMessage() const;

Q_SIGNALS:
    //! Interface validity has changed
    /*!
     * This may mean that modem has become unavailable
     * (or available again) or that the modem interface has become unavailable
     * (or available again)
     */
    void validityChanged(bool validity);

private:
    bool checkValidity();
    void updateValidity();

private Q_SLOTS:
    void modemValidityChanged(bool validity);
    void interfacesChanged(const QStringList &interfaces);

protected:
    OfonoInterface *m_if;

private:
    OfonoModem *m_m;
    bool m_isValid;
};
#endif