Qt 4.8
maemo_icd.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the plugins of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
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 
64 namespace Maemo {
65 
66 struct CommonParams {
73 };
74 
75 struct IcdScanResult {
76  uint status; // see #icd_scan_status
77  uint timestamp; // when last seen
79  uint service_priority; // within a service type
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 
88  status = timestamp = scan.service_attrs = service_priority =
89  scan.network_attrs = network_priority = signal_strength =
90  signal_dB = 0;
91  }
92 };
93 
95  struct CommonParams params;
98 };
99 
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
106 };
107 
115 };
116 
118  struct CommonParams params;
120 };
121 
123  IcdOldDbusInterface = 0, // use the old OSSO-IC interface
124  IcdNewDbusInterface // use the new Icd2 interface (default)
125 };
126 
127 
128 class IcdPrivate;
129 class Icd : public QObject
130 {
131  Q_OBJECT
132 
133 public:
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 
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 
159 private 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 
167 private:
169  friend class IcdPrivate;
170 };
171 
172 } // Maemo namespace
173 
174 #endif
QString network_name
Definition: maemo_icd.h:80
#define error(msg)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QString service_id
Definition: maemo_icd.h:69
QByteArray network_id
Definition: maemo_icd.h:72
IcdPrivate * d
Definition: maemo_icd.h:168
#define Q_SLOTS
Definition: qobjectdefs.h:71
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
IcdDbusInterfaceVer
Definition: maemo_icd.h:122
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
unsigned int uint
Definition: qglobal.h:996
QString service_name
Definition: maemo_icd.h:78
#define Q_OBJECT
Definition: qobjectdefs.h:157
QList< IcdIPInformation > ip_info
Definition: maemo_icd.h:119
QString service_type
Definition: maemo_icd.h:67
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
QString network_type
Definition: maemo_icd.h:70