58
|
1 |
/*
|
|
2 |
* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Handles displaying wlan related dialogs
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef MPMWLANQUERYDIALOG_H
|
|
20 |
#define MPMWLANQUERYDIALOG_H
|
|
21 |
|
|
22 |
#include <e32std.h>
|
|
23 |
#include <wdbifwlansettings.h> //for struct
|
|
24 |
#include <ConnectionUiUtilities.h>
|
|
25 |
#include <wifiprotuiclient.h>
|
|
26 |
#include <wifiprotreturn.h>
|
|
27 |
|
|
28 |
#include "mpmcommsdataccess.h"
|
|
29 |
|
|
30 |
|
|
31 |
// ID of Easy Wep dialog
|
|
32 |
const TUid KUidEasyWepDlg = { 0x101FD673 };
|
|
33 |
|
|
34 |
// ID of Easy Wpa dialog
|
|
35 |
const TUid KUidEasyWpaDlg = { 0x101FD674 };
|
|
36 |
|
|
37 |
// ID of OfflineWlanNote dialog
|
|
38 |
const TUid KUidCOfflineWlanNoteDlg = { 0x101FD671 };
|
|
39 |
|
|
40 |
/**
|
|
41 |
* This structure is copied from ConnectionUiUtilitiesCommon.h,
|
|
42 |
* but given here a different name.
|
|
43 |
* Defines preferences of the Wlan Network
|
|
44 |
*/
|
|
45 |
class TMpmWlanNetworkPrefs
|
|
46 |
{
|
|
47 |
public:
|
|
48 |
TWlanSsid iSsId; ///< Ssid of Wlan network
|
|
49 |
TWlanConnectionMode iNetworkMode; ///< mode of Wlan network
|
|
50 |
TWlanConnectionSecurityMode iSecMode; ///< Security mode of Wlan network
|
|
51 |
TBool iProtectedSetupSupported;
|
|
52 |
///< Wlan network supports Protected Setup
|
|
53 |
};
|
|
54 |
|
|
55 |
const TInt KEasyWepQuery256BitMaxLength = 58;
|
|
56 |
|
|
57 |
class TWlanAgtWepKeyData
|
|
58 |
{
|
|
59 |
public:
|
|
60 |
TBuf< KEasyWepQuery256BitMaxLength > iKey;
|
|
61 |
TBool iHex;
|
|
62 |
};
|
|
63 |
|
|
64 |
class CMPMIapSelection;
|
|
65 |
/**
|
|
66 |
* Handles displaying wlan related dialogs
|
|
67 |
*
|
|
68 |
* @lib mpmserver.exe
|
|
69 |
* @since S60 v3.2
|
|
70 |
*/
|
|
71 |
class CMPMWlanQueryDialog : public CActive
|
|
72 |
{
|
|
73 |
|
|
74 |
enum TWlanQueryState
|
|
75 |
{
|
|
76 |
EOffline,
|
|
77 |
EWlanNetwork,
|
|
78 |
EWepSettings,
|
|
79 |
EWpaSettings,
|
|
80 |
EWPS,
|
|
81 |
ERetrySettingsStorage
|
|
82 |
};
|
|
83 |
|
|
84 |
public:
|
|
85 |
|
|
86 |
static CMPMWlanQueryDialog* NewL( CMPMIapSelection& aSession,
|
|
87 |
TUint32 aSelectedWlanIap );
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Destructor.
|
|
91 |
*/
|
|
92 |
virtual ~CMPMWlanQueryDialog();
|
|
93 |
|
|
94 |
public: // Functions from base classes
|
|
95 |
|
|
96 |
/**
|
|
97 |
* From CActive. Cancels UI dialogs.
|
|
98 |
* @since 3.2
|
|
99 |
*/
|
|
100 |
void DoCancel();
|
|
101 |
|
|
102 |
/**
|
|
103 |
* From CActive. Run when UI dialog finished.
|
|
104 |
* @since 3.2
|
|
105 |
*/
|
|
106 |
void RunL();
|
|
107 |
|
|
108 |
/**
|
|
109 |
* From CActive. Run if RunL leaves.
|
|
110 |
* @since 3.2
|
|
111 |
* @param aError Error that caused leave.
|
|
112 |
* @return KErrNone
|
|
113 |
*/
|
|
114 |
TInt RunError( TInt aError );
|
|
115 |
|
|
116 |
public:
|
|
117 |
|
|
118 |
/**
|
|
119 |
* Starts displaying wlan dialogs if necessary
|
|
120 |
* @since 3.2
|
|
121 |
*/
|
|
122 |
void StartWlanQueryL();
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Stores user defined easy wlan parameters to commsdat
|
|
126 |
* if easy wlan has been selected.
|
|
127 |
*
|
|
128 |
* @since 3.2
|
|
129 |
*/
|
|
130 |
void StoreEasyWlanSelectionL();
|
|
131 |
|
|
132 |
private:
|
|
133 |
|
|
134 |
/**
|
|
135 |
* Propagates wlan network selection as an initial value for the dialog,
|
|
136 |
* Used if there are several dialogs queued.
|
|
137 |
*
|
|
138 |
* @param aWlanIapId Selected WLAN IAP
|
|
139 |
* @param aDialogStatus Status of the dialog when destroyed.
|
|
140 |
* @since 3.2
|
|
141 |
*/
|
|
142 |
void OfferInformation( TUint32 aWlanIapId,
|
|
143 |
TInt aDialogStatus );
|
|
144 |
|
|
145 |
CMPMWlanQueryDialog( CMPMIapSelection& aSession,
|
|
146 |
TUint32 aSelectedWlanIap );
|
|
147 |
|
|
148 |
void ConstructL();
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Gets Easy Wlan data from member variables and stores
|
|
152 |
* it to arguments
|
|
153 |
*
|
|
154 |
* @since 9.1
|
|
155 |
* @param aSsid Wlan iap ssid, stored in used ssid field
|
|
156 |
* @param aSecMode Wlan iap security mode
|
|
157 |
* @param aConnMode Wlan iap connection mode
|
|
158 |
* @param aWepKeyData Wlan iap wep key data
|
|
159 |
* @param aEnableWpaPsk Wlan iap enable psk mode
|
|
160 |
* @param aWpaPsk Wlan iap wpa psk
|
|
161 |
* @param aWpaKeyLen Wlan iap wpa key length
|
|
162 |
*/
|
|
163 |
void GetEasyWlanDataL( TWlanSsid& aSsid,
|
|
164 |
TUint& aSecMode,
|
|
165 |
TWlanNetMode& aConnMode,
|
|
166 |
TWepKeyData& aWepKeyData,
|
|
167 |
TUint& aEnableWpaPsk,
|
|
168 |
TDes8& aWpaPsk,
|
|
169 |
TUint& aWpaKeyLen );
|
|
170 |
|
|
171 |
/**
|
|
172 |
* Maps TWlanConnectionSecurityMode to security mode stored in CommsDat
|
|
173 |
*
|
|
174 |
* @since 9.1
|
|
175 |
* @param aConnSecmode Security mode in TWlanConnectionSecurityMode format
|
|
176 |
* @param aCommsdatSecMode returned security mode value in CommsDat format
|
|
177 |
*/
|
|
178 |
TInt ConnSecModeToCommsDatSecMode( TWlanConnectionSecurityMode aConnSecmode,
|
|
179 |
TUint& aCommsdatSecMode ) const;
|
|
180 |
|
|
181 |
/**
|
|
182 |
* Maps TWlanIapSecurityMode to security mode stored in CommsDat
|
|
183 |
*
|
|
184 |
* @since 9.1
|
|
185 |
* @param aConnSecmode Security mode in TWlanIapSecurityMode format
|
|
186 |
* @param aCommsdatSecMode returned security mode value in CommsDat format
|
|
187 |
*/
|
|
188 |
TInt IapSecModeToCommsDatSecMode( TWlanIapSecurityMode aConnSecmode,
|
|
189 |
TUint& aCommsdatSecMode ) const;
|
|
190 |
|
|
191 |
/**
|
|
192 |
* Gets Easy Wlan data from member variables when WPS has been used
|
|
193 |
* and stores it to arguments
|
|
194 |
*
|
|
195 |
* @since 9.1
|
|
196 |
* @param aSsid Wlan iap ssid, stored in used ssid field
|
|
197 |
* @param aSecMode Wlan iap security mode
|
|
198 |
* @param aConnMode Wlan iap connection mode
|
|
199 |
* @param aWepKeyData WEP key data
|
|
200 |
* @param aEnableWpaPsk Wlan iap enable psk mode
|
|
201 |
* @param aWpaPsk Wlan iap wpa psk
|
|
202 |
* @param aWpaKeyLen Wlan iap wpa key length
|
|
203 |
*/
|
|
204 |
void GetEasyWlanDataForWpsL( TWlanSsid& aSsid,
|
|
205 |
TUint& aSecMode,
|
|
206 |
TWlanNetMode& aConnMode,
|
|
207 |
TWepKeyData& aWepKeyData,
|
|
208 |
TUint& aEnableWpaPsk,
|
|
209 |
TDes8& aWpaPsk,
|
|
210 |
TUint& aWpaKeyLen );
|
|
211 |
|
|
212 |
/**
|
|
213 |
* Starts WPS dialog and sets the active object active.
|
|
214 |
*
|
|
215 |
* @since 9.1
|
|
216 |
*/
|
|
217 |
void StartWpsDlgL();
|
|
218 |
|
|
219 |
/**
|
|
220 |
* Determines whether WEP key is hex format based on the length
|
|
221 |
*
|
|
222 |
* @since 9.1
|
|
223 |
* @param aLength
|
|
224 |
* @return ETrue if format is hex, otherwise EFalse
|
|
225 |
*/
|
|
226 |
TBool IsWepFormatHexL( TInt aLength ) const;
|
|
227 |
|
|
228 |
/**
|
|
229 |
* Get the network preferences using ConnectionUiUtilities API.
|
|
230 |
*
|
|
231 |
* @since 5.1
|
|
232 |
*/
|
|
233 |
void GetNetworkPrefs();
|
|
234 |
|
|
235 |
private: // data
|
|
236 |
|
|
237 |
// Reference to iap selection object
|
|
238 |
CMPMIapSelection& iIapSelection;
|
|
239 |
|
|
240 |
// Stores data for offline note
|
|
241 |
TPckgBuf<TBool> iOfflineReply;
|
|
242 |
|
|
243 |
// Stores data for wlan network guery
|
|
244 |
TPckgBuf<TMpmWlanNetworkPrefs> iNetworkPrefs;
|
|
245 |
|
|
246 |
// Stores data for wep query
|
|
247 |
TPckgBuf<TWlanAgtWepKeyData> iNotifWep;
|
|
248 |
|
|
249 |
// Stores data for wpa query
|
|
250 |
TPckgBuf< TBuf< KWLMMaxWpaPskLength > > iNotifWpaKey;
|
|
251 |
|
|
252 |
//Interfce to Notifier
|
|
253 |
RNotifier iNotifier;
|
|
254 |
|
|
255 |
//State of querying Wlan settings
|
|
256 |
TWlanQueryState iWlanQueryState;
|
|
257 |
|
|
258 |
// selected wlan iap id
|
|
259 |
TUint32 iWlanIapId;
|
|
260 |
|
|
261 |
// ETrue if user has selected easy wlan
|
|
262 |
TBool iEasyWlanSelected;
|
|
263 |
|
|
264 |
// Flag that can be used to cancel the dialog startup based on earlier dialog
|
|
265 |
TInt iOverrideStatus;
|
|
266 |
|
|
267 |
// Connection Ui Utilities pointer
|
|
268 |
CConnectionUiUtilities* iConnUiUtils;
|
|
269 |
|
|
270 |
// Contains WLAN settings received through WPS
|
|
271 |
TWlanProtectedSetupCredentialAttribute iWpsAttribute;
|
|
272 |
|
|
273 |
// WPS client pointer for displaying WPS dialogs
|
|
274 |
CWiFiProtUiClient* iWps;
|
|
275 |
|
|
276 |
// Contains WPS return value
|
|
277 |
WiFiProt::TWiFiReturn iWpsReturn;
|
|
278 |
|
|
279 |
// True if wps has been completed.
|
|
280 |
TBool iWpsCompleted;
|
|
281 |
|
|
282 |
// Retry count
|
|
283 |
TUint32 iRetryCount;
|
|
284 |
|
|
285 |
// Retry timer
|
|
286 |
RTimer iTimer;
|
|
287 |
};
|
|
288 |
|
|
289 |
#endif // MPMWLANQUERYDIALOG_H
|