source: trunk/src/plugins/bearer/icd/maemo_icd.h

Last change on this file was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 5.2 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation (qt-info@nokia.com)
6**
7** This file is part of the plugins of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at qt-info@nokia.com.
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42
43#ifndef MAEMO_ICD_H
44#define MAEMO_ICD_H
45
46#include <QObject>
47#include <QStringList>
48#include <QByteArray>
49#include <QMetaType>
50#include <QtDBus>
51#include <QDBusArgument>
52
53#include <glib.h>
54#include <icd/dbus_api.h>
55#include <icd/osso-ic.h>
56#include <icd/osso-ic-dbus.h>
57#include <icd/network_api_defines.h>
58
59#define ICD_LONG_SCAN_TIMEOUT (30*1000) /* 30sec */
60#define ICD_SHORT_SCAN_TIMEOUT (10*1000) /* 10sec */
61#define ICD_SHORT_CONNECT_TIMEOUT (10*1000) /* 10sec */
62#define ICD_LONG_CONNECT_TIMEOUT (150*1000) /* 2.5min */
63
64namespace Maemo {
65
66struct CommonParams {
67 QString service_type;
68 uint service_attrs;
69 QString service_id;
70 QString network_type;
71 uint network_attrs;
72 QByteArray network_id;
73};
74
75struct IcdScanResult {
76 uint status; // see #icd_scan_status
77 uint timestamp; // when last seen
78 QString service_name;
79 uint service_priority; // within a service type
80 QString network_name;
81 uint network_priority;
82 struct CommonParams scan;
83 uint signal_strength; // quality, 0 (none) - 10 (good)
84 QString station_id; // e.g. MAC address or similar id
85 uint signal_dB; // use signal strength above unless you know what you are doing
86
87 IcdScanResult() {
88 status = timestamp = scan.service_attrs = service_priority =
89 scan.network_attrs = network_priority = signal_strength =
90 signal_dB = 0;
91 }
92};
93
94struct IcdStateResult {
95 struct CommonParams params;
96 QString error;
97 uint state;
98};
99
100struct IcdStatisticsResult {
101 struct CommonParams params;
102 uint time_active; // in seconds
103 enum icd_nw_levels signal_strength; // see network_api_defines.h in icd2-dev package
104 uint bytes_sent;
105 uint bytes_received;
106};
107
108struct IcdIPInformation {
109 QString address;
110 QString netmask;
111 QString default_gateway;
112 QString dns1;
113 QString dns2;
114 QString dns3;
115};
116
117struct IcdAddressInfoResult {
118 struct CommonParams params;
119 QList<IcdIPInformation> ip_info;
120};
121
122enum IcdDbusInterfaceVer {
123 IcdOldDbusInterface = 0, // use the old OSSO-IC interface
124 IcdNewDbusInterface // use the new Icd2 interface (default)
125};
126
127
128class IcdPrivate;
129class Icd : public QObject
130{
131 Q_OBJECT
132
133public:
134 Icd(QObject *parent = 0);
135 Icd(unsigned int timeout, QObject *parent = 0);
136 Icd(unsigned int timeout, IcdDbusInterfaceVer ver, QObject *parent = 0);
137 ~Icd();
138
139 /* Icd2 dbus API functions */
140 QStringList scan(icd_scan_request_flags flags,
141 QStringList &network_types,
142 QList<IcdScanResult>& scan_results,
143 QString& error);
144
145 uint state(QString& service_type, uint service_attrs,
146 QString& service_id, QString& network_type,
147 uint network_attrs, QByteArray& network_id,
148 IcdStateResult &state_result);
149
150 uint addrinfo(QString& service_type, uint service_attrs,
151 QString& service_id, QString& network_type,
152 uint network_attrs, QByteArray& network_id,
153 IcdAddressInfoResult& addr_result);
154
155 uint state(QList<IcdStateResult>& state_results);
156 uint statistics(QList<IcdStatisticsResult>& stats_results);
157 uint addrinfo(QList<IcdAddressInfoResult>& addr_results);
158
159private Q_SLOTS:
160 void icdSignalReceived(const QString& interface,
161 const QString& signal,
162 const QList<QVariant>& args);
163 void icdCallReply(const QString& method,
164 const QList<QVariant>& args,
165 const QString& error);
166
167private:
168 IcdPrivate *d;
169 friend class IcdPrivate;
170};
171
172} // Maemo namespace
173
174#endif
Note: See TracBrowser for help on using the repository browser.