~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to libs/solid/control/modeminterface.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  This file is part of the KDE project
 
2
    Copyright (C) 2010 Lamarque Souza <lamarque@gmail.com>
 
3
 
 
4
    This library is free software; you can redistribute it and/or
 
5
    modify it under the terms of the GNU Library General Public
 
6
    License version 2 as published by the Free Software Foundation.
 
7
 
 
8
    This library is distributed in the hope that it will be useful,
 
9
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
    Library General Public License for more details.
 
12
 
 
13
    You should have received a copy of the GNU Library General Public License
 
14
    along with this library; see the file COPYING.LIB.  If not, write to
 
15
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
16
    Boston, MA 02110-1301, USA.
 
17
 
 
18
*/
 
19
 
 
20
#ifndef SOLID_CONTROL_MODEMINTERFACE_H
 
21
#define SOLID_CONTROL_MODEMINTERFACE_H
 
22
 
 
23
#include <QtCore/QObject>
 
24
#include <QtCore/QVariant>
 
25
#include <QtDBus/QtDBus>
 
26
 
 
27
#include <solid/networking.h>
 
28
#include "solid_control_export.h"
 
29
#include "networkipv4config.h"
 
30
 
 
31
namespace Solid
 
32
{
 
33
namespace Control
 
34
{
 
35
    class ModemInterfacePrivate;
 
36
 
 
37
    class SOLIDCONTROL_EXPORT ModemInterface: public QObject
 
38
    {
 
39
    Q_OBJECT
 
40
    Q_ENUMS(Type Method AllowedMode AccessTechnology Mode Band)
 
41
    Q_DECLARE_PRIVATE(ModemInterface)
 
42
 
 
43
    public:
 
44
        enum Type {
 
45
            UnknownType = 0, /* MM specification does not include this type though. */
 
46
            GsmType = 1,
 
47
            CdmaType = 2
 
48
        };
 
49
 
 
50
        enum Method {
 
51
            Ppp = 0, /* Use PPP to get the address. */
 
52
            Static = 1, /* Static configuration, the modem will provide IP information. */
 
53
            Dhcp = 2, /*Use DHCP */
 
54
            UnknownMethod = 0xff
 
55
        };
 
56
 
 
57
        /* Describes the device's current access mode preference;
 
58
         * ie the specific technology preferences the device is allowed to use
 
59
         * when connecting to a mobile network. */
 
60
        enum AllowedMode {
 
61
             AnyModeAllowed = 0x0, /* Any mode can be used */
 
62
             Prefer2g, /* Prefer 2G (GPRS or EDGE) */
 
63
             Prefer3g, /* Prefer 3G (UMTS or HSxPA) */
 
64
             UseOnly2g, /* Use only 2G (GPRS or EDGE) */
 
65
             UseOnly3g /* Use only 3G (UMTS or HSxPA) */
 
66
        };
 
67
 
 
68
        /* Describes various access technologies that a device uses when connected to a mobile network. */
 
69
        enum AccessTechnology {
 
70
            UnknownTechnology = 0x0, /* The access technology used is unknown */
 
71
            Gsm, /* GSM */
 
72
            GsmCompact, /* Compact GSM */
 
73
            Gprs, /* GPRS */
 
74
            Edge, /* EDGE (ETSI 27.007: "GSM w/EGPRS") */
 
75
            Umts, /* UMTS (ETSI 27.007: "UTRAN") */
 
76
            Hsdpa, /* HSDPA (ETSI 27.007: "UTRAN w/HSDPA") */
 
77
            Hsupa, /* HSUPA (ETSI 27.007: "UTRAN w/HSUPA") */
 
78
            Hspa /* HSPA (ETSI 27.007: "UTRAN w/HSDPA and HSUPA") */
 
79
        };
 
80
 
 
81
        /* A bitfield describing the specifc access modes and technologies supported by a device
 
82
         * and the access technology in-use when connected to a mobile network. */
 
83
        enum Mode {
 
84
            UnknownMode = 0x0, /* Unknown or invalid mode. */
 
85
            AnyMode = 0x1, /* For certain operations, allow the modem to pick any available mode. */
 
86
            GprsMode = 0x2, /* GPRS */
 
87
            EdgeMode = 0x4, /* EDGE */
 
88
            UmtsMode = 0x8, /* UMTS (3G) */
 
89
            HsdpaMode = 0x10, /* HSDPA (3G) */
 
90
            Prefer2gMode = 0x20, /* Prefer 2G (GPRS or EDGE) */
 
91
            Prefer3gMode = 0x40, /* Prefer 3G (UMTS/HSDPA/HSUPA/HSPA) */
 
92
            UseOnly2gMode = 0x80, /* Use only 2G (GPRS or EDGE) */
 
93
            UseOnly3gMode = 0x100, /* Use only 3G (UMTS/HSDPA/HSUPA/HSPA) */
 
94
            HsupaMode = 0x200, /* HSUPA (3G) */
 
95
            HspaMode = 0x400, /* HSPA (3G) */
 
96
            GsmMode = 0x800, /* GSM */
 
97
            GsmCompactMode = 0x1000 /* GSM Compact */
 
98
        };
 
99
 
 
100
        /* A bitfield describing the specific radio bands supported by the device
 
101
         * and the radio bands the device is allowed to use when connecting to a mobile network. */
 
102
        enum Band {
 
103
            UnknownBand = 0x0, /* Unknown or invalid band */
 
104
            AnyBand = 0x1, /* For certain operations allow the modem to select a band automatically. */
 
105
            Egsm = 0x2, /* GSM/GPRS/EDGE 900 MHz */
 
106
            Dcs = 0x4, /* GSM/GPRS/EDGE 1800 MHz */
 
107
            Pcs = 0x8, /* GSM/GPRS/EDGE 1900 MHz */
 
108
            G850 = 0x10, /* GSM/GPRS/EDGE 850 MHz */
 
109
            U2100 = 0x20, /* WCDMA 2100 MHz (Class I) */
 
110
            U1800 = 0x40, /* WCDMA 3GPP 1800 MHz (Class III) */
 
111
            U17IV = 0x80, /* WCDMA 3GPP AWS 1700/2100 MHz (Class IV) */
 
112
            U800 = 0x100, /* WCDMA 3GPP UMTS 800 MHz (Class VI) */
 
113
            U850 = 0x200, /* WCDMA 3GPP UMTS 850 MHz (Class V) */
 
114
            U900 = 0x400, /* WCDMA 3GPP UMTS 900 MHz (Class VIII) */
 
115
            U17IX = 0x800, /* WCDMA 3GPP UMTS 1700 MHz (Class IX) */
 
116
            U19IX = 0x1000 /* WCDMA 3GPP UMTS 1900 MHz (Class II) */
 
117
        };
 
118
 
 
119
        enum GsmInterfaceType {
 
120
            NotGsm,
 
121
            GsmCard,
 
122
            GsmContacts,
 
123
            GsmNetwork,
 
124
            GsmSms,
 
125
            GsmHso,
 
126
            GsmUssd
 
127
        };
 
128
 
 
129
        class Ip4ConfigType
 
130
        {
 
131
        public:
 
132
            QString ip4Address,
 
133
                    dns1,
 
134
                    dns2,
 
135
                    dns3;
 
136
        };
 
137
 
 
138
        class InfoType
 
139
        {
 
140
        public:
 
141
            QString manufacturer,
 
142
                    model,
 
143
                    version;
 
144
        };
 
145
 
 
146
        /**
 
147
         * Creates a new ModemInterface object.
 
148
         *
 
149
         * @param backendObject the modem object provided by the backend
 
150
         */
 
151
        explicit ModemInterface(QObject *backendObject);
 
152
 
 
153
        /**
 
154
         * Constructs a copy of a modem.
 
155
         *
 
156
         * @param modem the modem to copy
 
157
         */
 
158
        ModemInterface(const ModemInterface &modem);
 
159
 
 
160
        /**
 
161
         * Destroys a ModemInterface object.
 
162
         */
 
163
        virtual ~ModemInterface();
 
164
 
 
165
        QString udi() const;
 
166
 
 
167
        void enable(const bool enable) const;
 
168
 
 
169
        void connectModem(const QString & number) const;
 
170
 
 
171
        void connectModem(const QVariantMap & properties) const;
 
172
 
 
173
        void disconnectModem() const;
 
174
 
 
175
        Ip4ConfigType getIp4Config() const;
 
176
 
 
177
        InfoType getInfo() const;
 
178
 
 
179
        QVariantMap getStatus() const;
 
180
 
 
181
        /*
 
182
         * Properties
 
183
         */
 
184
        QString device() const;
 
185
 
 
186
        QString masterDevice() const;
 
187
 
 
188
        QString driver() const;
 
189
 
 
190
        Type type() const;
 
191
 
 
192
        bool enabled() const;
 
193
 
 
194
        QString unlockRequired() const;
 
195
 
 
196
        Method ipMethod() const;
 
197
 
 
198
        static QString convertTypeToString(const Type type);
 
199
 
 
200
        /**
 
201
         * Return a description of the band id.
 
202
         *
 
203
         * @param band the band id
 
204
         */
 
205
        static QString convertBandToString(const Band band);
 
206
 
 
207
        static QString convertAllowedModeToString(const AllowedMode mode);
 
208
 
 
209
        /**
 
210
         * Return a description of the access technology used.
 
211
         *
 
212
         * @param tech the access technology.
 
213
         */
 
214
        static QString convertAccessTechnologyToString(const AccessTechnology tech);
 
215
 
 
216
    public Q_SLOTS:
 
217
        void slotDeviceChanged(const QString & device);
 
218
 
 
219
        void slotMasterDeviceChanged(const QString & masterDevice);
 
220
 
 
221
        void slotDriverChanged(const QString & driver);
 
222
 
 
223
        void slotUnlockRequiredChanged(const QString & codeRequired);
 
224
    Q_SIGNALS:
 
225
        void deviceChanged(const QString & device);
 
226
 
 
227
        void masterDeviceChanged(const QString & masterDevice);
 
228
 
 
229
        void driverChanged(const QString & driver);
 
230
 
 
231
        void typeChanged(const Solid::Control::ModemInterface::Type type);
 
232
 
 
233
        void enabledChanged(const bool enabled);
 
234
 
 
235
        void unlockRequiredChanged(const QString & codeRequired);
 
236
 
 
237
        void ipMethodChanged(const Solid::Control::ModemInterface::Method ipMethod);
 
238
 
 
239
    protected:
 
240
        /**
 
241
         * @internal
 
242
         */
 
243
        ModemInterface(ModemInterfacePrivate &dd, QObject *backendObject);
 
244
 
 
245
        /**
 
246
         * @internal
 
247
         */
 
248
        ModemInterface(ModemInterfacePrivate &dd, const ModemInterface &modem);
 
249
 
 
250
        ModemInterfacePrivate *d_ptr;
 
251
    };
 
252
 
 
253
} // Control
 
254
} // Solid
 
255
 
 
256
#endif