author | hgs |
Thu, 27 May 2010 10:28:52 +0300 | |
changeset 32 | 5bbf13e885a0 |
parent 31 | e8f4211554fb |
child 39 | 7b3e49e4608a |
permissions | -rw-r--r-- |
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
31 | 2 |
* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
31 | 15 |
* WLAN Qt Utilities implementation. |
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
31 | 18 |
// System includes |
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
|
31 | 20 |
// User includes |
21 |
||
22 |
#include "wlanqtutilsap.h" |
|
23 |
#include "wlanqtutilsiap.h" |
|
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include "wlanqtutils_p.h" |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include "wlanqtutils.h" |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
|
31 | 27 |
/*! |
28 |
\class WlanQtUtils |
|
29 |
\brief Wlan Qt Utilities. This class provides a Qt API for UI components |
|
30 |
for retrieving different kind of information related to WLAN |
|
31 |
functionality. |
|
32 |
*/ |
|
33 |
||
34 |
||
35 |
// External function prototypes |
|
36 |
||
37 |
// Local constants |
|
38 |
||
39 |
// ======== LOCAL FUNCTIONS ======== |
|
40 |
||
41 |
// ======== MEMBER FUNCTIONS ======== |
|
42 |
||
43 |
/*! |
|
44 |
Constructor. |
|
45 |
*/ |
|
46 |
||
47 |
WlanQtUtils::WlanQtUtils() : |
|
48 |
d_ptr(new WlanQtUtilsPrivate(this)) |
|
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
49 |
{ |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
} |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
|
31 | 52 |
/*! |
53 |
Destructor. |
|
54 |
*/ |
|
55 |
||
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
56 |
WlanQtUtils::~WlanQtUtils() |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
{ |
31 | 58 |
} |
59 |
||
60 |
/*! |
|
61 |
Function for requesting a single WLAN scan to be triggered. |
|
62 |
Signal wlanScanReady() is emitted when new scan results are available. |
|
63 |
*/ |
|
64 |
||
65 |
void WlanQtUtils::scanWlans() |
|
66 |
{ |
|
67 |
d_ptr->scanWlans(); |
|
68 |
} |
|
69 |
||
70 |
/*! |
|
71 |
Function for requesting a WLAN AP scan to be triggered. |
|
72 |
Signal availableWlanAps() is emitted when new scan results are available. |
|
73 |
*/ |
|
74 |
||
75 |
void WlanQtUtils::scanWlanAps() |
|
76 |
{ |
|
77 |
d_ptr->scanWlanAps(); |
|
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
78 |
} |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
|
31 | 80 |
/*! |
81 |
Function for requesting a direct WLAN scan with given SSID. |
|
82 |
||
83 |
Signal wlanScanDirectReady() is emitted when new scan results are |
|
84 |
available. |
|
85 |
||
86 |
@param [in] ssid Network name to be found |
|
87 |
*/ |
|
88 |
||
89 |
void WlanQtUtils::scanWlanDirect(const QString &ssid) |
|
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
90 |
{ |
31 | 91 |
d_ptr->scanWlanDirect(ssid); |
92 |
} |
|
93 |
||
94 |
/*! |
|
95 |
Function for stopping a (possibly) ongoing WLAN scan. No scan result |
|
96 |
signal will be sent before a new scan request is made. |
|
97 |
*/ |
|
98 |
||
99 |
void WlanQtUtils::stopWlanScan() |
|
100 |
{ |
|
101 |
d_ptr->stopWlanScan(); |
|
102 |
} |
|
103 |
||
104 |
/*! |
|
105 |
Function to request details of available WLAN networks. Can be called |
|
106 |
at any time. Calling right after wlanScanReady() signal ensures you get |
|
107 |
the most recent results. |
|
108 |
||
109 |
@param [out] wlanIapList List of available WLAN IAPs. |
|
110 |
@param [out] wlanApList List of unknown WLAN APs. |
|
111 |
*/ |
|
112 |
||
113 |
void WlanQtUtils::availableWlans( |
|
114 |
QList< QSharedPointer<WlanQtUtilsIap> > &wlanIapList, |
|
115 |
QList< QSharedPointer<WlanQtUtilsAp> > &wlanApList) const |
|
116 |
{ |
|
117 |
d_ptr->availableWlans(wlanIapList, wlanApList); |
|
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
118 |
} |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
119 |
|
31 | 120 |
/*! |
121 |
Function to request details of available WLAN networks. This function is |
|
122 |
used to get the results that are informed by following signals: |
|
123 |
-wlanScanApReady() |
|
124 |
-wlanScanDirectReady() |
|
125 |
||
126 |
@param [out] wlanApList List of unknown WLAN APs. |
|
127 |
*/ |
|
128 |
||
129 |
void WlanQtUtils::availableWlanAps( |
|
130 |
QList< QSharedPointer<WlanQtUtilsAp> > &wlanApList) const |
|
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
131 |
{ |
31 | 132 |
d_ptr->availableWlanAps(wlanApList); |
133 |
} |
|
134 |
||
135 |
/*! |
|
136 |
Function to create an IAP from the given WLAN access point. |
|
137 |
||
138 |
@param [in] wlanAp Access point containing parameters to include in the new IAP. |
|
139 |
||
140 |
@return IAP ID if creation succeeds, IapIdNone otherwise. |
|
141 |
*/ |
|
142 |
||
143 |
int WlanQtUtils::createIap(const WlanQtUtilsAp *wlanAp) |
|
144 |
{ |
|
145 |
return d_ptr->createIap(wlanAp); |
|
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
146 |
} |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
147 |
|
31 | 148 |
/*! |
149 |
Function to update an IAP from the given WLAN access point. |
|
150 |
||
151 |
@param [in] iapId ID of the IAP to be updated. |
|
152 |
@param [in] wlanAp Access point containing parameters to update in the IAP. |
|
153 |
||
154 |
@return Was update successful? |
|
155 |
*/ |
|
156 |
||
157 |
bool WlanQtUtils::updateIap(int iapId, const WlanQtUtilsAp *wlanAp) |
|
158 |
{ |
|
159 |
return d_ptr->updateIap(iapId, wlanAp); |
|
160 |
} |
|
161 |
||
162 |
/*! |
|
163 |
Function to delete an IAP. |
|
164 |
||
165 |
@param [in] iapId ID of the IAP to be deleted. |
|
166 |
*/ |
|
167 |
||
168 |
void WlanQtUtils::deleteIap(int iapId) |
|
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
169 |
{ |
31 | 170 |
d_ptr->deleteIap(iapId); |
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
171 |
} |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
172 |
|
31 | 173 |
/*! |
174 |
Function to start connection creation for the given IAP. Runs also |
|
175 |
Internet Connectivity Test (ICT), if requested with the optional |
|
176 |
parameter. |
|
177 |
||
178 |
Connecting while there is already a connection is also supported. |
|
179 |
||
180 |
wlanNetworkOpened() or wlanNetworkClosed() signal will be emitted |
|
181 |
when connection status changes. |
|
182 |
||
183 |
ictResult() signal will be emitted when (possible) ICT result is |
|
184 |
available. |
|
185 |
||
186 |
@param [in] iapId ID of the IAP to be connected. |
|
187 |
@param [in] runIct Should ICT be run or not? |
|
188 |
*/ |
|
189 |
||
190 |
void WlanQtUtils::connectIap(int iapId, bool runIct) |
|
191 |
{ |
|
192 |
d_ptr->connectIap(iapId, runIct); |
|
193 |
} |
|
194 |
||
195 |
/*! |
|
196 |
Function to disconnect the given IAP. |
|
197 |
Disconnecting when there is no connection is also supported. |
|
198 |
||
199 |
@param [in] iapId ID of the IAP to be disconnected. |
|
200 |
*/ |
|
201 |
||
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
202 |
void WlanQtUtils::disconnectIap(int iapId) |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
203 |
{ |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
204 |
d_ptr->disconnectIap(iapId); |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
205 |
} |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
206 |
|
31 | 207 |
/*! |
208 |
Function to retrieve the name of the IAP with the given ID. |
|
209 |
||
210 |
@param [in] iapId ID of the requested IAP. |
|
211 |
||
212 |
@return Name of the IAP or empty QString if IAP is not found. |
|
213 |
*/ |
|
214 |
||
215 |
QString WlanQtUtils::iapName(int iapId) const |
|
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
216 |
{ |
31 | 217 |
return d_ptr->iapName(iapId); |
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
218 |
} |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
219 |
|
31 | 220 |
/*! |
221 |
Connection status getter. |
|
222 |
||
223 |
@return Current WLAN connection status. |
|
224 |
*/ |
|
225 |
||
226 |
WlanQtUtils::ConnStatus WlanQtUtils::connectionStatus() const |
|
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
227 |
{ |
31 | 228 |
return d_ptr->connectionStatus(); |
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
229 |
} |
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
230 |
|
31 | 231 |
/*! |
232 |
Function for getting the ID of the (possibly) active WLAN IAP. |
|
233 |
Active here means non-disconnected. |
|
234 |
Use connectionStatus() for retrieving the actual status. |
|
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
235 |
|
31 | 236 |
@return ID of the active IAP, IapIdNone if not valid. |
237 |
*/ |
|
238 |
||
239 |
int WlanQtUtils::activeIap() const |
|
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
240 |
{ |
31 | 241 |
return d_ptr->activeIap(); |
19
10810c91db26
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
242 |
} |