58
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 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: Implementation of WLAN Plugin interface implementation
|
|
15 |
* for WLAN Bearer
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
#include <commdb.h>
|
|
21 |
#include <ecom/ecom.h> // For REComSession
|
|
22 |
#include <f32file.h> // for TParse
|
|
23 |
#include <StringLoader.h>
|
|
24 |
#include <data_caging_path_literals.hrh>
|
|
25 |
#include <ConnectionUiUtilities.h>
|
|
26 |
|
|
27 |
#include <cmpluginbaseeng.h>
|
|
28 |
#include <cmpluginlanbase.h>
|
|
29 |
#include <mcmdexec.h>
|
|
30 |
#include <cmpbasesettingsdlg.h>
|
|
31 |
#include <cmpluginwlan.mbg>
|
|
32 |
#include <cmwlanui.rsg>
|
|
33 |
#include <cmmanager.rsg>
|
|
34 |
#include <cmcommonui.h>
|
|
35 |
#include <wlancontainer.h>
|
|
36 |
|
|
37 |
#include <WEPSecuritySettingsUI.h>
|
|
38 |
#include <WPASecuritySettingsUI.h>
|
|
39 |
#include <featmgr.h>
|
|
40 |
#include <ConeResLoader.h>
|
|
41 |
#include <AknWaitDialog.h>
|
|
42 |
#include <uikon/eiksrvui.h>
|
|
43 |
#include <AknGlobalNote.h>
|
|
44 |
|
|
45 |
#include "cmwlancommonconstants.h"
|
|
46 |
#include "cmpluginwlan.h"
|
|
47 |
#include "cmwlancoveragecheck.h"
|
|
48 |
#include "cmlogger.h"
|
|
49 |
#include "cmpwlansettingsdlg.h"
|
|
50 |
#include <cmpluginwlandef.h>
|
|
51 |
#include <cmcommonconstants.h>
|
|
52 |
#include "cmmanagerimpl.h"
|
|
53 |
#include "cmpwlanactivewaiter.h"
|
|
54 |
|
|
55 |
#include <wifiprotuiinprocess.h>
|
|
56 |
#include <utf.h>
|
|
57 |
|
|
58 |
using namespace CMManager;
|
|
59 |
|
|
60 |
#include "wapisecuritysettingsui.h"
|
|
61 |
|
|
62 |
// CONSTANTS
|
|
63 |
const TUint32 KDefaultPriorityWLan = 0;
|
|
64 |
|
|
65 |
const TInt KWlanSingleNetwork = 1; // Number of WLAN networks is 1
|
|
66 |
const TInt KWlanMaxKeyLength = 64;
|
|
67 |
const TInt KWlanLastSocketActivityTimeout = -1;
|
|
68 |
const TInt KWlanLastSessionClosedTimeout = 1;
|
|
69 |
const TInt KWlanLastSocketClosedTimeout = -1;
|
|
70 |
const TUint32 KEndOfArray = KMaxTUint;
|
|
71 |
|
|
72 |
// Daemon manager name for Easy WLAN IAP
|
|
73 |
_LIT( KHotspotDaemonManagerName, "NetCfgExtnHotSpot" );
|
|
74 |
_LIT( KEasyWlanName, "Easy WLAN" );
|
|
75 |
|
|
76 |
// Modem bearer names for WLAN connection methods
|
|
77 |
_LIT( KModemBearerWLAN, "WLANBearer" );
|
|
78 |
|
|
79 |
_LIT( KWlanFileIcons, "z:cmpluginwlan.mbm" );
|
|
80 |
_LIT( KWlanBearerName, "WLANBearer" );
|
|
81 |
_LIT( KWlanBearerAgent, "wlanagt.agt" );
|
|
82 |
_LIT( KWlanBearerNif, "wlannif" );
|
|
83 |
|
|
84 |
_LIT( KWlanLDDName, "not used" );
|
|
85 |
_LIT( KWlanPDDName, "not used" );
|
|
86 |
|
|
87 |
static const TCmAttribConvTable SWlanConvTbl[] =
|
|
88 |
{
|
|
89 |
// iAttribId, iCommsDatId, iValidFuncL,
|
|
90 |
// iTitleId,
|
|
91 |
// iMaxLength, iAttribFlags, iDefValueResId, iEditorResId, iNotUsed1, iNotUsed2
|
|
92 |
{ EWlanServiceId, EWlanRangeMax, NULL },
|
|
93 |
{ EWlanServiceId, KCDTIdWlanServiceId, NULL },
|
|
94 |
{ EWlanConnectionMode, KCDTIdWlanConnMode, NULL,
|
|
95 |
R_QTN_WLAN_SETT_NETWORK_MODE,
|
|
96 |
},
|
|
97 |
{ EWlanSSID, KCDTIdWlanSSID, NULL,
|
|
98 |
R_QTN_WLAN_SETT_NETWORK_NAME,
|
|
99 |
KCmWlanNWNameMaxLength, EConvCompulsory | EConvNoZeroLength, R_QTN_SELEC_SETTING_COMPULSORY, R_TEXT_SETTING_PAGE_NETW_NAME, NULL, NULL },
|
|
100 |
{ EWlanUsedSSID, KCDTIdWlanUsedSSID, NULL },
|
|
101 |
{ EWlanSecurityMode, KCDTIdWlanSecMode, NULL,
|
|
102 |
R_QTN_WLAN_SETT_SECURITY_MODE,
|
|
103 |
0, 0, 0, 0, NULL, NULL },
|
|
104 |
{ EWlanAuthenticationMode, KCDTIdWlanAuthMode, NULL },
|
|
105 |
{ EWlanScanSSID, KCDTIdWlanScanSSID, NULL,
|
|
106 |
R_QTN_WLAN_SETT_HIDDEN_NETWORK,
|
|
107 |
0, 0, 0, 0, NULL, NULL },
|
|
108 |
{ EWlanChannelID, KCDTIdWlanChannelID, NULL,
|
|
109 |
R_QTN_WLAN_SETT_ADHOC_CHANNEL,
|
|
110 |
KCmAdhocChannelMaxLength, EConvNumber, R_QTN_WLAN_SETT_ADHOC_CHANNEL_AUTOMATIC, 0, NULL, NULL },
|
|
111 |
{ EWlanAllowSSIDRoaming, KCDTIdWlanAllowSSIDRoaming, NULL,
|
|
112 |
R_QTN_WLAN_SETT_SSID_ROAMING,
|
|
113 |
0, 0, 0, 0, NULL, NULL },
|
|
114 |
{ 0,0 }
|
|
115 |
};
|
|
116 |
|
|
117 |
|
|
118 |
static const TCmCommonAttrConvArrayItem SCommonConvTbl[] =
|
|
119 |
{
|
|
120 |
{ EWlanIfNetworks, ECmIFNetworks },
|
|
121 |
{ EWlanIpNetMask, ECmIPNetmask },
|
|
122 |
{ EWlanIpGateway, ECmIPGateway },
|
|
123 |
{ EWlanIpAddrFromServer, ECmIPAddFromServer },
|
|
124 |
{ EWlanIpAddr, ECmIPAddress },
|
|
125 |
{ EWlanIpDNSAddrFromServer, ECmIPDNSAddrFromServer },
|
|
126 |
{ EWlanIpNameServer1, ECmIPNameServer1 },
|
|
127 |
{ EWlanIpNameServer2, ECmIPNameServer2 },
|
|
128 |
{ EWlanIp6DNSAddrFromServer, ECmIP6DNSAddrFromServer },
|
|
129 |
{ EWlanIp6NameServer1, ECmIP6NameServer1 },
|
|
130 |
{ EWlanIp6NameServer2, ECmIP6NameServer2 },
|
|
131 |
{ EWlanIpAddrLeaseValidFrom, ECmIPAddrLeaseValidFrom },
|
|
132 |
{ EWlanIpAddrLeaseValidTo, ECmIPAddrLeaseValidTo },
|
|
133 |
{ EWlanConfigDaemonManagerName, ECmConfigDaemonManagerName },
|
|
134 |
{ EWlanConfigDaemonName, ECmConfigDaemonName },
|
|
135 |
{ 0, 0 }
|
|
136 |
};
|
|
137 |
|
|
138 |
|
|
139 |
/**
|
|
140 |
* struct for security mode conversion table
|
|
141 |
*/
|
|
142 |
typedef struct
|
|
143 |
{
|
|
144 |
TUint32 iSecurityMode;
|
|
145 |
TUint32 iNWModeSelectionDlgIndex;
|
|
146 |
TUint32 iRBSettingPageIndex;
|
|
147 |
TUint32 iResId;
|
|
148 |
} TCmSecurityModeConvTable;
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Conversion table for the correct positioning of WLAN security types
|
|
152 |
* in WLAN UI components
|
|
153 |
*/
|
|
154 |
const TCmSecurityModeConvTable KWlanSecurityModeConvTable[] =
|
|
155 |
{
|
|
156 |
{ EWlanSecModeOpen, 0, 0, R_QTN_NETW_CONSET_WLAN_SECURITY_MODE_OPEN },
|
|
157 |
{ EWlanSecModeWep, 1, 1, R_QTN_NETW_CONSET_WLAN_SECURITY_MODE_WEP },
|
|
158 |
{ EWlanSecMode802_1x, 2, 2, R_QTN_NETW_CONSET_WLAN_SECURITY_MODE_802_1X },
|
|
159 |
{ EWlanSecModeWpa, 3, 3, R_QTN_NETW_CONSET_WLAN_SECURITY_MODE_WPA },
|
|
160 |
// { EWlanSecModeWpa2, 3, 3, R_QTN_NETW_CONSET_WLAN_SECURITY_MODE_WPA2 },
|
|
161 |
{ EWlanSecModeWAPI, 4, 4, R_QTN_WLAN_SETT_SECURITY_MODE_WAPI },
|
|
162 |
{ KEndOfArray, KEndOfArray, KEndOfArray, KEndOfArray }
|
|
163 |
};
|
|
164 |
|
|
165 |
/**
|
|
166 |
* struct for the network mode conversion table
|
|
167 |
*/
|
|
168 |
typedef struct
|
|
169 |
{
|
|
170 |
TUint32 iNwMode;
|
|
171 |
TBool iHidden;
|
|
172 |
TUint32 iResId;
|
|
173 |
} TCmNetworkModeConvTable;
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Conversion table for the correct positioning of WLAN network modes
|
|
177 |
*/
|
|
178 |
const TCmNetworkModeConvTable KWlanNetworkModeConvTable[] =
|
|
179 |
{
|
|
180 |
{ EInfra, EFalse, R_QTN_WLAN_NETWORK_MODE_INFRA_PUBLIC }, // Infrastructure (public)
|
|
181 |
{ EInfra, ETrue, R_QTN_WLAN_NETWORK_MODE_INFRA_HIDDEN }, // Infrastructure (hidden)
|
|
182 |
{ EAdhoc, EFalse, R_QTN_WLAN_NETWORK_MODE_ADHOC_PUBLIC }, // Ad-hoc (public)
|
|
183 |
// { EAdhoc, ETrue, R_QTN_WLAN_NETWORK_MODE_ADHOC_HIDDEN }, // Ad-hoc (hidden)
|
|
184 |
{ KEndOfArray, EFalse, KEndOfArray }
|
|
185 |
};
|
|
186 |
|
|
187 |
// ======================= MEMBER FUNCTIONS =================================
|
|
188 |
|
|
189 |
// --------------------------------------------------------------------------
|
|
190 |
// CCmPluginWlan::NewL
|
|
191 |
// --------------------------------------------------------------------------
|
|
192 |
//
|
|
193 |
CCmPluginWlan* CCmPluginWlan::NewL( TCmPluginInitParam* aInitParam )
|
|
194 |
{
|
|
195 |
if ( !FeatureSupported( KFeatureIdProtocolWlan ) )
|
|
196 |
{
|
|
197 |
User::Leave( KErrNotSupported );
|
|
198 |
}
|
|
199 |
|
|
200 |
CCmPluginWlan* self = new( ELeave ) CCmPluginWlan( aInitParam );
|
|
201 |
CleanupStack::PushL( self );
|
|
202 |
self->ConstructL();
|
|
203 |
CleanupStack::Pop( self );
|
|
204 |
return self;
|
|
205 |
}
|
|
206 |
|
|
207 |
// --------------------------------------------------------------------------
|
|
208 |
// CCmPluginWlan::~CCmPluginWlan
|
|
209 |
// --------------------------------------------------------------------------
|
|
210 |
//
|
|
211 |
CCmPluginWlan::~CCmPluginWlan()
|
|
212 |
{
|
|
213 |
AdditionalReset();
|
|
214 |
DestroyWaitDialog();
|
|
215 |
RemoveResourceFile( KPluginWlanResDirAndFileName );
|
|
216 |
delete iConnUiUtils; iConnUiUtils = NULL;
|
|
217 |
|
|
218 |
iAdditionalCmsCreated.Close();
|
|
219 |
|
|
220 |
CLOG_CLOSE;
|
|
221 |
}
|
|
222 |
|
|
223 |
// --------------------------------------------------------------------------
|
|
224 |
// CCmPluginWlan::CreateInstanceL
|
|
225 |
// --------------------------------------------------------------------------
|
|
226 |
//
|
|
227 |
CCmPluginBaseEng* CCmPluginWlan::CreateInstanceL( TCmPluginInitParam& aInitParam ) const
|
|
228 |
{
|
|
229 |
CCmPluginWlan* self = new( ELeave ) CCmPluginWlan( &aInitParam );
|
|
230 |
CleanupStack::PushL( self );
|
|
231 |
self->ConstructL();
|
|
232 |
CleanupStack::Pop( self );
|
|
233 |
|
|
234 |
return self;
|
|
235 |
}
|
|
236 |
|
|
237 |
// --------------------------------------------------------------------------
|
|
238 |
// CCmPluginWlan::CCmPluginWlan
|
|
239 |
// --------------------------------------------------------------------------
|
|
240 |
//
|
|
241 |
CCmPluginWlan::CCmPluginWlan( TCmPluginInitParam* aInitParam )
|
|
242 |
: CCmPluginLanBase( aInitParam )
|
|
243 |
{
|
|
244 |
CLOG_CREATE;
|
|
245 |
iWlanTableId = 0;
|
|
246 |
iBearerType = KUidWlanBearerType;
|
|
247 |
}
|
|
248 |
|
|
249 |
// --------------------------------------------------------------------------
|
|
250 |
// CCmPluginWlan::ConstructL
|
|
251 |
// --------------------------------------------------------------------------
|
|
252 |
//
|
|
253 |
void CCmPluginWlan::ConstructL()
|
|
254 |
{
|
|
255 |
LOGGER_ENTERFN( "CCmPluginWlan::ConstructL" );
|
|
256 |
|
|
257 |
CCmPluginLanBase::ConstructL();
|
|
258 |
|
|
259 |
iBearerRecName = KModemBearerWLAN;
|
|
260 |
|
|
261 |
// get WLAN table id
|
|
262 |
TRAP_IGNORE( iWlanTableId = CCDWlanServiceRecord::TableIdL( Session() ) );
|
|
263 |
|
|
264 |
if( !iWlanTableId )
|
|
265 |
{
|
|
266 |
iWlanTableId = CCDWlanServiceRecord::CreateTableL( Session() );
|
|
267 |
|
|
268 |
TMDBElementId tableId = 0;
|
|
269 |
|
|
270 |
TRAP_IGNORE( tableId = CCDWlanDeviceSettingsRecord::TableIdL( Session() ) );
|
|
271 |
if( !tableId )
|
|
272 |
{
|
|
273 |
CCDWlanDeviceSettingsRecord::CreateTableL( Session() );
|
|
274 |
}
|
|
275 |
|
|
276 |
TRAP_IGNORE( tableId = CCDWLANSecSSIDTable::TableIdL( Session() ) );
|
|
277 |
if( !tableId )
|
|
278 |
{
|
|
279 |
CCDWLANSecSSIDTable::CreateTableL( Session() );
|
|
280 |
}
|
|
281 |
|
|
282 |
TRAP_IGNORE( tableId = CCDDestNWTable::TableIdL( Session() ) );
|
|
283 |
if( !tableId )
|
|
284 |
{
|
|
285 |
CCDDestNWTable::CreateTableL( Session() );
|
|
286 |
}
|
|
287 |
}
|
|
288 |
|
|
289 |
AddResourceFileL( KPluginWlanResDirAndFileName );
|
|
290 |
|
|
291 |
AddConverstionTableL( ( CCDRecordBase** )&iWlanServiceRecord,
|
|
292 |
NULL,
|
|
293 |
SWlanConvTbl );
|
|
294 |
AddCommonConversionTableL( SCommonConvTbl );
|
|
295 |
|
|
296 |
iIsWAPISupported = FeatureManager::FeatureSupported( KFeatureIdFfWlanWapi );
|
|
297 |
}
|
|
298 |
|
|
299 |
|
|
300 |
// --------------------------------------------------------------------------
|
|
301 |
// CCmPluginWlan::GetIntAttributeL
|
|
302 |
// --------------------------------------------------------------------------
|
|
303 |
//
|
|
304 |
TUint32 CCmPluginWlan::GetIntAttributeL( const TUint32 aAttribute ) const
|
|
305 |
{
|
|
306 |
LOGGER_ENTERFN( "CCmPluginWlan::GetIntAttributeL" );
|
|
307 |
|
|
308 |
TInt retval;
|
|
309 |
switch ( aAttribute )
|
|
310 |
{
|
|
311 |
case ECmExtensionLevel:
|
|
312 |
{
|
|
313 |
retval = CCmPluginLanBase::GetIntAttributeL( aAttribute );
|
|
314 |
retval++;
|
|
315 |
break;
|
|
316 |
}
|
|
317 |
case ECmBearerIcon:
|
|
318 |
{
|
|
319 |
TAknsItemID id;
|
|
320 |
MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
|
|
321 |
|
|
322 |
TParse mbmFile;
|
|
323 |
User::LeaveIfError( mbmFile.Set( KWlanFileIcons,
|
|
324 |
&KDC_BITMAP_DIR,
|
|
325 |
NULL ) );
|
|
326 |
|
|
327 |
// default - WLAN icon
|
|
328 |
TInt icon = EMbmCmpluginwlanQgn_prop_wlan_bearer;
|
|
329 |
TInt mask = EMbmCmpluginwlanQgn_prop_wlan_bearer_mask;
|
|
330 |
|
|
331 |
// Easy WLAN icon
|
|
332 |
TUint32 easyWlanId = iCmMgr.EasyWlanIdL();
|
|
333 |
if ( easyWlanId && GetIntAttributeL( ECmId ) == easyWlanId )
|
|
334 |
{
|
|
335 |
icon = EMbmCmpluginwlanQgn_prop_set_conn_wlan_easy;
|
|
336 |
mask = EMbmCmpluginwlanQgn_prop_set_conn_wlan_easy_mask;
|
|
337 |
}
|
|
338 |
|
|
339 |
retval = (TUint32)AknsUtils::CreateGulIconL(
|
|
340 |
skinInstance,
|
|
341 |
id,
|
|
342 |
mbmFile.FullName(),
|
|
343 |
icon,
|
|
344 |
mask );
|
|
345 |
break;
|
|
346 |
}
|
|
347 |
case ECmBearerAvailableIcon:
|
|
348 |
{
|
|
349 |
TAknsItemID id;
|
|
350 |
MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
|
|
351 |
|
|
352 |
TParse mbmFile;
|
|
353 |
User::LeaveIfError( mbmFile.Set( KWlanFileIcons,
|
|
354 |
&KDC_BITMAP_DIR,
|
|
355 |
NULL ) );
|
|
356 |
|
|
357 |
retval = (TUint32)AknsUtils::CreateGulIconL(
|
|
358 |
skinInstance,
|
|
359 |
id,
|
|
360 |
mbmFile.FullName(),
|
|
361 |
EMbmCmpluginwlanQgn_prop_set_conn_bearer_avail_wlan,
|
|
362 |
EMbmCmpluginwlanQgn_prop_set_conn_bearer_avail_wlan_mask );
|
|
363 |
break;
|
|
364 |
}
|
|
365 |
case ECmCommsDBBearerType:
|
|
366 |
{
|
|
367 |
retval = KCommDbBearerWLAN;
|
|
368 |
break;
|
|
369 |
}
|
|
370 |
|
|
371 |
case ECmDefaultUiPriority:
|
|
372 |
{
|
|
373 |
retval = GlobalUiBearerPriority( TPtrC(KCDTypeNameWLANServiceExt) );
|
|
374 |
|
|
375 |
if( retval == KDataMobilitySelectionPolicyPriorityWildCard )
|
|
376 |
{
|
|
377 |
retval = KDefaultPriorityWLan;
|
|
378 |
}
|
|
379 |
}
|
|
380 |
break;
|
|
381 |
case ECmDefaultPriority:
|
|
382 |
{
|
|
383 |
retval = GlobalBearerPriority( TPtrC(KCDTypeNameWLANServiceExt) );
|
|
384 |
|
|
385 |
if( retval == KDataMobilitySelectionPolicyPriorityWildCard )
|
|
386 |
{
|
|
387 |
retval = KDefaultPriorityWLan;
|
|
388 |
}
|
|
389 |
}
|
|
390 |
break;
|
|
391 |
case EWlanServiceId:
|
|
392 |
{
|
|
393 |
if ( iWlanServiceRecord )
|
|
394 |
{
|
|
395 |
retval = iWlanServiceRecord->RecordId();
|
|
396 |
break;
|
|
397 |
}
|
|
398 |
}
|
|
399 |
default:
|
|
400 |
{
|
|
401 |
retval = CCmPluginBaseEng::GetIntAttributeL( aAttribute );
|
|
402 |
break;
|
|
403 |
}
|
|
404 |
}
|
|
405 |
return retval;
|
|
406 |
}
|
|
407 |
|
|
408 |
|
|
409 |
// --------------------------------------------------------------------------
|
|
410 |
// CCmPluginWlan::GetBoolAttributeL
|
|
411 |
// --------------------------------------------------------------------------
|
|
412 |
//
|
|
413 |
TBool CCmPluginWlan::GetBoolAttributeL( const TUint32 aAttribute ) const
|
|
414 |
{
|
|
415 |
LOGGER_ENTERFN( "CCmPluginWlan::GetBoolAttributeL" );
|
|
416 |
|
|
417 |
TBool retval( EFalse );
|
|
418 |
|
|
419 |
switch ( aAttribute )
|
|
420 |
{
|
|
421 |
case ECmCoverage:
|
|
422 |
{
|
|
423 |
#ifndef __WINS__
|
|
424 |
TInt& networks = CONST_CAST( TInt&, iWlanNetworks );
|
|
425 |
networks = 0;
|
|
426 |
|
|
427 |
networks = CheckNetworkCoverageL();
|
|
428 |
|
|
429 |
// If there's at least one WLAN network around, then there IS
|
|
430 |
// coverage.
|
|
431 |
retval = ( networks ? ETrue : EFalse );
|
|
432 |
#else
|
|
433 |
|
|
434 |
TInt& networks = CONST_CAST( TInt&, iWlanNetworks );
|
|
435 |
////networks = 0;
|
|
436 |
////retval = EFalse;
|
|
437 |
|
|
438 |
networks = 1;
|
|
439 |
retval = ETrue;
|
|
440 |
|
|
441 |
|
|
442 |
|
|
443 |
#endif
|
|
444 |
}
|
|
445 |
break;
|
|
446 |
|
|
447 |
case ECmAddToAvailableList:
|
|
448 |
{
|
|
449 |
retval = ETrue;
|
|
450 |
}
|
|
451 |
break;
|
|
452 |
|
|
453 |
case ECmBearerHasUi:
|
|
454 |
{
|
|
455 |
retval = ETrue;
|
|
456 |
}
|
|
457 |
break;
|
|
458 |
|
|
459 |
default:
|
|
460 |
{
|
|
461 |
retval = CCmPluginBaseEng::GetBoolAttributeL( aAttribute );
|
|
462 |
break;
|
|
463 |
}
|
|
464 |
}
|
|
465 |
return retval;
|
|
466 |
}
|
|
467 |
|
|
468 |
|
|
469 |
// --------------------------------------------------------------------------
|
|
470 |
// CCmPluginWlan::GetStringAttributeL
|
|
471 |
// --------------------------------------------------------------------------
|
|
472 |
//
|
|
473 |
HBufC* CCmPluginWlan::GetStringAttributeL( const TUint32 aAttribute ) const
|
|
474 |
{
|
|
475 |
LOGGER_ENTERFN( "CCmPluginWlan::GetStringAttributeL" );
|
|
476 |
|
|
477 |
HBufC* retVal = NULL;
|
|
478 |
|
|
479 |
switch( aAttribute )
|
|
480 |
{
|
|
481 |
case ECmBearerAvailableName:
|
|
482 |
{
|
|
483 |
retVal = AllocReadL( R_QTN_NETW_CONSET_BEARER_AVAILABLE_WLAN );
|
|
484 |
}
|
|
485 |
break;
|
|
486 |
|
|
487 |
case ECmBearerAvailableText:
|
|
488 |
{
|
|
489 |
if ( CEikonEnv::Static() )
|
|
490 |
{
|
|
491 |
if ( iWlanNetworks == KWlanSingleNetwork )
|
|
492 |
{
|
|
493 |
retVal = AllocReadL(
|
|
494 |
R_QTN_NETW_CONSET_ONE_WLAN_NW_AVAILABLE );
|
|
495 |
}
|
|
496 |
else
|
|
497 |
{
|
|
498 |
retVal = ReadResourceL(
|
|
499 |
R_QTN_NETW_CONSET_MANY_WLAN_NW_AVAILABLE,
|
|
500 |
iWlanNetworks );
|
|
501 |
}
|
|
502 |
}
|
|
503 |
else
|
|
504 |
{ // ReadResourceL does not work without a valid EikonEnv, so
|
|
505 |
// to have a consistent behaviour when there is one or more
|
|
506 |
// wlan networks for ECmBearerAvailableText, we always
|
|
507 |
// leave when called without valid EikonEnv
|
|
508 |
User::Leave( KErrNotSupported );
|
|
509 |
}
|
|
510 |
}
|
|
511 |
break;
|
|
512 |
|
|
513 |
case ECmBearerSupportedName:
|
|
514 |
{
|
|
515 |
retVal = AllocReadL( R_QTN_NETW_CONSET_BEARER_SUPPORTED_WLAN );
|
|
516 |
}
|
|
517 |
break;
|
|
518 |
|
|
519 |
case ECmBearerNamePopupNote:
|
|
520 |
{
|
|
521 |
retVal = AllocReadL( R_QTN_NETW_CONSET_POPUP_BEARER_WLAN );
|
|
522 |
}
|
|
523 |
break;
|
|
524 |
|
|
525 |
case ECmBearerSettingName:
|
|
526 |
{
|
|
527 |
retVal = AllocReadL( R_QTN_WLAN_SETT_BEARER_WLAN );
|
|
528 |
}
|
|
529 |
break;
|
|
530 |
|
|
531 |
default:
|
|
532 |
{
|
|
533 |
retVal = CCmPluginBaseEng::GetStringAttributeL( aAttribute );
|
|
534 |
}
|
|
535 |
break;
|
|
536 |
}
|
|
537 |
return retVal;
|
|
538 |
}
|
|
539 |
|
|
540 |
|
|
541 |
// --------------------------------------------------------------------------
|
|
542 |
// CCmPluginWlan::SetIntAttributeL
|
|
543 |
// --------------------------------------------------------------------------
|
|
544 |
//
|
|
545 |
void CCmPluginWlan::SetIntAttributeL( const TUint32 aAttribute,
|
|
546 |
TUint32 aValue )
|
|
547 |
{
|
|
548 |
LOGGER_ENTERFN( "CCmPluginWlan::SetIntAttributeL" );
|
|
549 |
|
|
550 |
CCmPluginBaseEng::SetIntAttributeL( aAttribute, aValue );
|
|
551 |
if ( aAttribute == EWlanSecurityMode )
|
|
552 |
{
|
|
553 |
UpdateSecurityModeL();
|
|
554 |
}
|
|
555 |
}
|
|
556 |
|
|
557 |
|
|
558 |
|
|
559 |
// --------------------------------------------------------------------------
|
|
560 |
// CCmPluginWlan::SetBoolAttributeL
|
|
561 |
// --------------------------------------------------------------------------
|
|
562 |
//
|
|
563 |
void CCmPluginWlan::SetBoolAttributeL( const TUint32 aAttribute,
|
|
564 |
TBool aValue )
|
|
565 |
{
|
|
566 |
LOGGER_ENTERFN( "CCmPluginWlan::SetBoolAttributeL" );
|
|
567 |
|
|
568 |
CCmPluginBaseEng::SetBoolAttributeL( aAttribute, aValue );
|
|
569 |
}
|
|
570 |
|
|
571 |
|
|
572 |
|
|
573 |
// --------------------------------------------------------------------------
|
|
574 |
// CCmPluginWlan::SetStringAttributeL
|
|
575 |
// --------------------------------------------------------------------------
|
|
576 |
//
|
|
577 |
void CCmPluginWlan::SetStringAttributeL( const TUint32 aAttribute,
|
|
578 |
const TDesC16& aValue )
|
|
579 |
{
|
|
580 |
LOGGER_ENTERFN( "CCmPluginWlan::SetStringAttributeL" );
|
|
581 |
|
|
582 |
switch( aAttribute )
|
|
583 |
{
|
|
584 |
case ECmName:
|
|
585 |
{
|
|
586 |
CCmPluginLanBase::SetStringAttributeL( aAttribute, aValue );
|
|
587 |
break;
|
|
588 |
}
|
|
589 |
case EWlanIpNameServer1:
|
|
590 |
case EWlanIpNameServer2:
|
|
591 |
{
|
|
592 |
// when setting nameservers, must set EWlanIpDNSAddrFromServer
|
|
593 |
// according to current nameserver settings
|
|
594 |
CCmPluginBaseEng::SetStringAttributeL( aAttribute, aValue );
|
|
595 |
break;
|
|
596 |
}
|
|
597 |
case EWlanIp6NameServer1:
|
|
598 |
case EWlanIp6NameServer2:
|
|
599 |
{
|
|
600 |
// when setting nameservers, must set EWlanIpDNSAddrFromServer
|
|
601 |
// according to current nameserver settings
|
|
602 |
CCmPluginBaseEng::SetStringAttributeL( aAttribute, aValue );
|
|
603 |
break;
|
|
604 |
}
|
|
605 |
default:
|
|
606 |
{
|
|
607 |
CCmPluginBaseEng::SetStringAttributeL( aAttribute, aValue );
|
|
608 |
break;
|
|
609 |
}
|
|
610 |
}
|
|
611 |
}
|
|
612 |
|
|
613 |
|
|
614 |
// --------------------------------------------------------------------------
|
|
615 |
// CCmPluginWlan::UpdateAdditionalRecordsL
|
|
616 |
// --------------------------------------------------------------------------
|
|
617 |
//
|
|
618 |
void CCmPluginWlan::UpdateAdditionalRecordsL()
|
|
619 |
{
|
|
620 |
LOGGER_ENTERFN( "CCmPluginWlan::UpdateAdditionalRecordsL" );
|
|
621 |
|
|
622 |
CheckIfNameModifiedL( iWlanServiceRecord );
|
|
623 |
|
|
624 |
iWlanServiceRecord->iWlanServiceId.SetL( iIapRecord->iService );
|
|
625 |
|
|
626 |
if ( !iWlanServiceRecord->RecordId() )
|
|
627 |
{
|
|
628 |
iWlanServiceRecord->SetRecordId( KCDNewRecordRequest );
|
|
629 |
iWlanServiceRecord->StoreL( Session() );
|
|
630 |
}
|
|
631 |
else
|
|
632 |
{
|
|
633 |
iWlanServiceRecord->ModifyL( Session() );
|
|
634 |
}
|
|
635 |
UpdateSecuritySettingsL();
|
|
636 |
}
|
|
637 |
|
|
638 |
|
|
639 |
// --------------------------------------------------------------------------
|
|
640 |
// CCmPluginWlan::CanHandleIapIdL
|
|
641 |
// --------------------------------------------------------------------------
|
|
642 |
//
|
|
643 |
TBool CCmPluginWlan::CanHandleIapIdL( TUint32 aIapId ) const
|
|
644 |
{
|
|
645 |
LOGGER_ENTERFN( "CCmPluginWlan::CanHandleIapIdL1" );
|
|
646 |
CLOG_WRITE_1( "IapId: [%d]", aIapId );
|
|
647 |
|
|
648 |
TBool retVal( EFalse );
|
|
649 |
|
|
650 |
CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *>
|
|
651 |
( CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord) );
|
|
652 |
|
|
653 |
CleanupStack::PushL( iapRecord );
|
|
654 |
iapRecord->SetRecordId( aIapId );
|
|
655 |
|
|
656 |
TRAPD( err, iapRecord->LoadL( Session() ) );
|
|
657 |
|
|
658 |
if( !err )
|
|
659 |
{
|
|
660 |
CanHandleIapIdL( iapRecord );
|
|
661 |
}
|
|
662 |
|
|
663 |
CleanupStack::PopAndDestroy( iapRecord );
|
|
664 |
return retVal;
|
|
665 |
}
|
|
666 |
|
|
667 |
|
|
668 |
// --------------------------------------------------------------------------
|
|
669 |
// CCmPluginWlan::CanHandleIapIdL
|
|
670 |
// --------------------------------------------------------------------------
|
|
671 |
//
|
|
672 |
TBool CCmPluginWlan::CanHandleIapIdL( CCDIAPRecord *aIapRecord ) const
|
|
673 |
{
|
|
674 |
LOGGER_ENTERFN( "CCmPluginWlan::CanHandleIapIdL2" );
|
|
675 |
|
|
676 |
CLOG_WRITE_1( "IapId: [%d]", aIapRecord->RecordId() );
|
|
677 |
|
|
678 |
|
|
679 |
TBool retVal( EFalse );
|
|
680 |
|
|
681 |
CLOG_WRITE_2( "IAP record: [%S][%S]",
|
|
682 |
&FIELD_TO_TDESC( aIapRecord->iServiceType ),
|
|
683 |
&FIELD_TO_TDESC( aIapRecord->iBearerType )
|
|
684 |
);
|
|
685 |
|
|
686 |
if( (TPtrC(aIapRecord->iServiceType) == TPtrC(KCDTypeNameLANService) ) &&
|
|
687 |
TPtrC(aIapRecord->iBearerType) == TPtrC(KCDTypeNameLANBearer) )
|
|
688 |
{
|
|
689 |
// check if there is a WLAN record with
|
|
690 |
// an iServiceId == iIapRecord->iService;
|
|
691 |
CCDWlanServiceRecord* tmprec = new ( ELeave )
|
|
692 |
CCDWlanServiceRecord ( iWlanTableId );
|
|
693 |
CleanupStack::PushL( tmprec );
|
|
694 |
|
|
695 |
TInt service = aIapRecord->iService;
|
|
696 |
|
|
697 |
tmprec->iWlanServiceId.SetL( (TUint32)service );
|
|
698 |
if ( tmprec->FindL( Session() ) )
|
|
699 |
{
|
|
700 |
// we found at least one WLAN using this IAP,
|
|
701 |
retVal = ETrue;
|
|
702 |
tmprec->LoadL( Session() );
|
|
703 |
CLOG_WRITE( "I can." );
|
|
704 |
}
|
|
705 |
else
|
|
706 |
{
|
|
707 |
// not found -> not our
|
|
708 |
CLOG_WRITE_1( "Wlan with Service ID: [%d] NOT found ",
|
|
709 |
service );
|
|
710 |
}
|
|
711 |
CleanupStack::PopAndDestroy(tmprec);
|
|
712 |
}
|
|
713 |
return retVal;
|
|
714 |
}
|
|
715 |
|
|
716 |
|
|
717 |
// --------------------------------------------------------------------------
|
|
718 |
// CCmPluginWlan::DeleteAdditionalRecordsL
|
|
719 |
// --------------------------------------------------------------------------
|
|
720 |
//
|
|
721 |
void CCmPluginWlan::DeleteAdditionalRecordsL()
|
|
722 |
{
|
|
723 |
LOGGER_ENTERFN( "CCmPluginWlan::DeleteAdditionalRecordsL" );
|
|
724 |
|
|
725 |
// as base class deletes service record, in this case LAN,
|
|
726 |
// only WLAN related stuff needs to be deleted
|
|
727 |
// also security settings, too!
|
|
728 |
DeleteSecuritySettingsL();
|
|
729 |
iWlanServiceRecord->DeleteL( Session() );
|
|
730 |
}
|
|
731 |
|
|
732 |
|
|
733 |
// --------------------------------------------------------------------------
|
|
734 |
// CCmPluginWlan::RunSettingsL
|
|
735 |
// --------------------------------------------------------------------------
|
|
736 |
//
|
|
737 |
TInt CCmPluginWlan::RunSettingsL()
|
|
738 |
{
|
|
739 |
LOGGER_ENTERFN( "CCmPluginWlan::RunSettingsL" );
|
|
740 |
|
|
741 |
CmPluginWlanSettingsDlg* cmDlg = CmPluginWlanSettingsDlg::NewL( *this );
|
|
742 |
return cmDlg->ConstructAndRunLD( );
|
|
743 |
}
|
|
744 |
|
|
745 |
|
|
746 |
// --------------------------------------------------------------------------
|
|
747 |
// CCmPluginWlan::LoadServiceSettingL
|
|
748 |
// --------------------------------------------------------------------------
|
|
749 |
//
|
|
750 |
void CCmPluginWlan::LoadServiceSettingL()
|
|
751 |
{
|
|
752 |
LOGGER_ENTERFN( "CCmPluginWlan::LoadServiceSettingL" );
|
|
753 |
|
|
754 |
if( TPtrC(KCDTypeNameLANService) == iIapRecord->iServiceType )
|
|
755 |
{
|
|
756 |
iServiceRecord = static_cast<CCDServiceRecordBase *>
|
|
757 |
(CCDRecordBase::RecordFactoryL(KCDTIdLANServiceRecord));
|
|
758 |
iServiceRecord->SetRecordId( iIapRecord->iService );
|
|
759 |
CLOG_WRITE_1( "ID: [%d]", iServiceRecord->RecordId() );
|
|
760 |
iServiceRecord->LoadL(Session());
|
|
761 |
}
|
|
762 |
else
|
|
763 |
// this IAP service is not supported by this plugin.
|
|
764 |
{
|
|
765 |
User::Leave( KErrNotSupported );
|
|
766 |
}
|
|
767 |
}
|
|
768 |
|
|
769 |
|
|
770 |
// --------------------------------------------------------------------------
|
|
771 |
// CCmPluginWlan::LoadAdditionalRecordsL
|
|
772 |
// --------------------------------------------------------------------------
|
|
773 |
//
|
|
774 |
void CCmPluginWlan::LoadAdditionalRecordsL()
|
|
775 |
{
|
|
776 |
LOGGER_ENTERFN( "CCmPluginWlan::LoadAdditionalRecordsL" );
|
|
777 |
|
|
778 |
if (!iWlanServiceRecord)
|
|
779 |
{
|
|
780 |
iWlanServiceRecord =
|
|
781 |
new ( ELeave ) CCDWlanServiceRecord ( iWlanTableId );
|
|
782 |
}
|
|
783 |
iWlanServiceRecord->SetRecordId( 0 );
|
|
784 |
|
|
785 |
iWlanServiceRecord->iWlanServiceId.SetL( ( TUint32 )
|
|
786 |
( iIapRecord->iService ) );
|
|
787 |
|
|
788 |
if ( iWlanServiceRecord->FindL( Session() ) )
|
|
789 |
{
|
|
790 |
iWlanServiceRecord->LoadL( Session() );
|
|
791 |
LoadSecuritySettingsL();
|
|
792 |
}
|
|
793 |
else
|
|
794 |
{
|
|
795 |
// not found -> error
|
|
796 |
CLOG_WRITE_1( "Wlan with Service ID: [%d] NOT found ",
|
|
797 |
iServiceRecord->RecordId() );
|
|
798 |
User::Leave(KErrNotFound);
|
|
799 |
}
|
|
800 |
}
|
|
801 |
|
|
802 |
|
|
803 |
// --------------------------------------------------------------------------
|
|
804 |
// CCmPluginWlan::CreateNewServiceRecordL
|
|
805 |
// --------------------------------------------------------------------------
|
|
806 |
//
|
|
807 |
void CCmPluginWlan::CreateNewServiceRecordL()
|
|
808 |
{
|
|
809 |
LOGGER_ENTERFN( "CCmPluginWlan::CreateNewServiceRecordL" );
|
|
810 |
|
|
811 |
// create base (LAN) service record:
|
|
812 |
CCmPluginLanBase::CreateNewServiceRecordL();
|
|
813 |
CCDLANServiceRecord* tmp =
|
|
814 |
static_cast<CCDLANServiceRecord *>(iServiceRecord);
|
|
815 |
if( FeatureSupported( KFeatureIdIPv6 ) )
|
|
816 |
{
|
|
817 |
tmp->iIfNetworks.SetL( KDefIspIfNetworksIPv4IPv6 );
|
|
818 |
}
|
|
819 |
else
|
|
820 |
{
|
|
821 |
tmp->iIfNetworks.SetL( KDefIspIfNetworksIPv4 );
|
|
822 |
}
|
|
823 |
|
|
824 |
// create WLAN service record:
|
|
825 |
CreateWlanServiceRecordL();
|
|
826 |
|
|
827 |
// In case of WLan 'show progress' is the default value
|
|
828 |
SetIntAttributeL( ECmSeamlessnessLevel, ESeamlessnessShowprogress );
|
|
829 |
}
|
|
830 |
|
|
831 |
|
|
832 |
// --------------------------------------------------------------------------
|
|
833 |
// CCmPluginWlan::CreateWlanServiceRecordL
|
|
834 |
// --------------------------------------------------------------------------
|
|
835 |
//
|
|
836 |
void CCmPluginWlan::CreateWlanServiceRecordL()
|
|
837 |
{
|
|
838 |
LOGGER_ENTERFN( "CCmPluginWlan::CreateWlanServiceRecordL" );
|
|
839 |
|
|
840 |
delete iWlanServiceRecord;
|
|
841 |
iWlanServiceRecord = NULL;
|
|
842 |
|
|
843 |
iWlanServiceRecord = new ( ELeave ) CCDWlanServiceRecord ( iWlanTableId );
|
|
844 |
iWlanServiceRecord->SetRecordId( KCDNewRecordRequest );
|
|
845 |
|
|
846 |
iWlanServiceRecord->iRecordTag.SetL( 1 );
|
|
847 |
iWlanServiceRecord->iRecordName.SetL( iIapRecord->iRecordName );
|
|
848 |
iWlanServiceRecord->iWlanConnMode.SetL( EInfra );
|
|
849 |
iWlanServiceRecord->iWlanSecMode.SetL( EWlanSecModeOpen );
|
|
850 |
iWlanServiceRecord->iWlanScanSSID.SetL( EFalse );
|
|
851 |
}
|
|
852 |
|
|
853 |
|
|
854 |
// ----------------------------------------------------------------------------
|
|
855 |
// CCmPluginWlan::PrepareToUpdateRecordsL()
|
|
856 |
// ----------------------------------------------------------------------------
|
|
857 |
//
|
|
858 |
void CCmPluginWlan::PrepareToUpdateRecordsL()
|
|
859 |
{
|
|
860 |
CCDLANServiceRecord* tmprec = static_cast<CCDLANServiceRecord*>(iServiceRecord);
|
|
861 |
|
|
862 |
CheckDNSServerAddressL( ETrue,
|
|
863 |
tmprec->iIp6NameServer1,
|
|
864 |
tmprec->iIp6NameServer2,
|
|
865 |
tmprec->iIp6DnsAddrFromServer );
|
|
866 |
|
|
867 |
CheckDNSServerAddressL( EFalse,
|
|
868 |
tmprec->iIpNameServer1,
|
|
869 |
tmprec->iIpNameServer2,
|
|
870 |
tmprec->iIpDnsAddrFromServer );
|
|
871 |
SetDaemonNameL();
|
|
872 |
}
|
|
873 |
|
|
874 |
|
|
875 |
// --------------------------------------------------------------------------
|
|
876 |
// CCmPluginWlan::LoadSecuritySettingsL
|
|
877 |
// --------------------------------------------------------------------------
|
|
878 |
//
|
|
879 |
void CCmPluginWlan::LoadSecuritySettingsL()
|
|
880 |
{
|
|
881 |
LOGGER_ENTERFN( "CCmPluginWlan::LoadSecuritySettingsL" );
|
|
882 |
|
|
883 |
TUint32 secmode = iWlanServiceRecord->iWlanSecMode;
|
|
884 |
TUint32 iapid = iIapRecord->iService;
|
|
885 |
|
|
886 |
switch ( secmode )
|
|
887 |
{
|
|
888 |
case EWlanSecModeOpen:
|
|
889 |
{
|
|
890 |
break;
|
|
891 |
}
|
|
892 |
case EWlanSecModeWep:
|
|
893 |
{
|
|
894 |
if ( !iWepSecSettings )
|
|
895 |
{
|
|
896 |
iWepSecSettings = CWEPSecuritySettings::NewL();
|
|
897 |
}
|
|
898 |
iWepSecSettings->LoadL( iapid, Session() );
|
|
899 |
break;
|
|
900 |
}
|
|
901 |
case EWlanSecMode802_1x:
|
|
902 |
{
|
|
903 |
if ( !iWpaSecSettings )
|
|
904 |
{
|
|
905 |
iWpaSecSettings =
|
|
906 |
CWPASecuritySettings::NewL( ESecurityMode8021x );
|
|
907 |
}
|
|
908 |
iWpaSecSettings->LoadL( iapid, Session() );
|
|
909 |
break;
|
|
910 |
}
|
|
911 |
case EWlanSecModeWpa:
|
|
912 |
case EWlanSecModeWpa2:
|
|
913 |
{
|
|
914 |
if ( !iWpaSecSettings )
|
|
915 |
{
|
|
916 |
iWpaSecSettings =
|
|
917 |
CWPASecuritySettings::NewL( ESecurityModeWpa );
|
|
918 |
}
|
|
919 |
iWpaSecSettings->LoadL( iapid, Session() );
|
|
920 |
break;
|
|
921 |
}
|
|
922 |
case EWlanSecModeWAPI:
|
|
923 |
{
|
|
924 |
if ( iIsWAPISupported )
|
|
925 |
{
|
|
926 |
if ( !iWAPISecSettings )
|
|
927 |
{
|
|
928 |
iWAPISecSettings = CWAPISecuritySettings::NewL();
|
|
929 |
}
|
|
930 |
iWAPISecSettings->LoadL( iIapRecord->RecordId(), Session() );
|
|
931 |
}
|
|
932 |
else
|
|
933 |
{
|
|
934 |
User::Leave( KErrCorrupt );
|
|
935 |
}
|
|
936 |
break;
|
|
937 |
}
|
|
938 |
default:
|
|
939 |
{
|
|
940 |
User::Leave( KErrNotSupported );
|
|
941 |
// do nothing in urel
|
|
942 |
break;
|
|
943 |
}
|
|
944 |
}
|
|
945 |
}
|
|
946 |
|
|
947 |
|
|
948 |
// ----------------------------------------------------------------------------
|
|
949 |
// CCmPluginWlan::EditSecuritySettingsL
|
|
950 |
// ----------------------------------------------------------------------------
|
|
951 |
//
|
|
952 |
TInt CCmPluginWlan::EditSecuritySettingsL( CEikonEnv& aEikonEnv )
|
|
953 |
{
|
|
954 |
LOGGER_ENTERFN( "CCmPluginWlan::EditSecuritySettingsL" );
|
|
955 |
|
|
956 |
TInt ret = KErrNotFound;
|
|
957 |
|
|
958 |
TUint32 secmode = iWlanServiceRecord->iWlanSecMode;
|
|
959 |
|
|
960 |
HBufC* title = GetStringAttributeL(ECmName);
|
|
961 |
CleanupStack::PushL( title );
|
|
962 |
switch ( secmode )
|
|
963 |
{
|
|
964 |
case EWlanSecModeOpen:
|
|
965 |
{
|
|
966 |
break;
|
|
967 |
}
|
|
968 |
case EWlanSecModeWep:
|
|
969 |
{
|
|
970 |
CWEPSecuritySettingsUi* ui =
|
|
971 |
CWEPSecuritySettingsUi::NewL(aEikonEnv);
|
|
972 |
CleanupStack::PushL( ui );
|
|
973 |
if ( !iWepSecSettings )
|
|
974 |
{
|
|
975 |
iWepSecSettings = CWEPSecuritySettings::NewL();
|
|
976 |
}
|
|
977 |
ret = iWepSecSettings->EditL( *ui, *title );
|
|
978 |
CleanupStack::PopAndDestroy( ui );
|
|
979 |
break;
|
|
980 |
}
|
|
981 |
case EWlanSecMode802_1x:
|
|
982 |
{
|
|
983 |
CWPASecuritySettingsUi* ui =
|
|
984 |
CWPASecuritySettingsUi::NewL(aEikonEnv);
|
|
985 |
CleanupStack::PushL(ui);
|
|
986 |
if ( !iWpaSecSettings )
|
|
987 |
{
|
|
988 |
iWpaSecSettings =
|
|
989 |
CWPASecuritySettings::NewL( ESecurityMode8021x );
|
|
990 |
}
|
|
991 |
ret = iWpaSecSettings->EditL( *ui, *title );
|
|
992 |
CleanupStack::PopAndDestroy( ui );
|
|
993 |
break;
|
|
994 |
}
|
|
995 |
case EWlanSecModeWpa:
|
|
996 |
case EWlanSecModeWpa2:
|
|
997 |
{
|
|
998 |
CWPASecuritySettingsUi* ui =
|
|
999 |
CWPASecuritySettingsUi::NewL(aEikonEnv);
|
|
1000 |
CleanupStack::PushL( ui );
|
|
1001 |
if ( !iWpaSecSettings )
|
|
1002 |
{
|
|
1003 |
iWpaSecSettings =
|
|
1004 |
CWPASecuritySettings::NewL( ESecurityModeWpa );
|
|
1005 |
}
|
|
1006 |
ret = iWpaSecSettings->EditL( *ui, *title );
|
|
1007 |
CleanupStack::PopAndDestroy( ui );
|
|
1008 |
break;
|
|
1009 |
}
|
|
1010 |
case EWlanSecModeWAPI:
|
|
1011 |
{
|
|
1012 |
if ( iIsWAPISupported )
|
|
1013 |
{
|
|
1014 |
CWAPISecuritySettingsUi* ui =
|
|
1015 |
CWAPISecuritySettingsUi::NewL( aEikonEnv );
|
|
1016 |
CleanupStack::PushL( ui );
|
|
1017 |
if ( !iWAPISecSettings )
|
|
1018 |
{
|
|
1019 |
iWAPISecSettings = CWAPISecuritySettings::NewL();
|
|
1020 |
}
|
|
1021 |
ret = iWAPISecSettings->EditL( *ui, *title );
|
|
1022 |
CleanupStack::PopAndDestroy( ui );
|
|
1023 |
}
|
|
1024 |
else
|
|
1025 |
{
|
|
1026 |
User::Leave( KErrCorrupt );
|
|
1027 |
}
|
|
1028 |
break;
|
|
1029 |
}
|
|
1030 |
default:
|
|
1031 |
{
|
|
1032 |
// do nothing in urel
|
|
1033 |
break;
|
|
1034 |
}
|
|
1035 |
}
|
|
1036 |
CleanupStack::PopAndDestroy( title );
|
|
1037 |
return ret;
|
|
1038 |
}
|
|
1039 |
|
|
1040 |
// --------------------------------------------------------------------------
|
|
1041 |
// CCmPluginWlan::AreSecuritySettingsValidL
|
|
1042 |
// --------------------------------------------------------------------------
|
|
1043 |
//
|
|
1044 |
TBool CCmPluginWlan::AreSecuritySettingsValidL()
|
|
1045 |
{
|
|
1046 |
LOGGER_ENTERFN( "CCmPluginWlan::AreSecuritySettingsValidL" );
|
|
1047 |
|
|
1048 |
TBool ret = EFalse;
|
|
1049 |
|
|
1050 |
TUint32 secmode = iWlanServiceRecord->iWlanSecMode;
|
|
1051 |
|
|
1052 |
switch ( secmode )
|
|
1053 |
{
|
|
1054 |
case EWlanSecModeOpen:
|
|
1055 |
{
|
|
1056 |
break;
|
|
1057 |
}
|
|
1058 |
case EWlanSecModeWep:
|
|
1059 |
{
|
|
1060 |
if ( !iWepSecSettings )
|
|
1061 |
{
|
|
1062 |
iWepSecSettings = CWEPSecuritySettings::NewL();
|
|
1063 |
}
|
|
1064 |
ret = iWepSecSettings->IsValid();
|
|
1065 |
break;
|
|
1066 |
}
|
|
1067 |
case EWlanSecMode802_1x:
|
|
1068 |
{
|
|
1069 |
if ( !iWpaSecSettings )
|
|
1070 |
{
|
|
1071 |
iWpaSecSettings =
|
|
1072 |
CWPASecuritySettings::NewL( ESecurityMode8021x );
|
|
1073 |
}
|
|
1074 |
ret = iWpaSecSettings->IsValid();
|
|
1075 |
break;
|
|
1076 |
}
|
|
1077 |
case EWlanSecModeWpa:
|
|
1078 |
case EWlanSecModeWpa2:
|
|
1079 |
{
|
|
1080 |
if ( !iWpaSecSettings )
|
|
1081 |
{
|
|
1082 |
iWpaSecSettings =
|
|
1083 |
CWPASecuritySettings::NewL( ESecurityModeWpa );
|
|
1084 |
}
|
|
1085 |
ret = iWpaSecSettings->IsValid();
|
|
1086 |
break;
|
|
1087 |
}
|
|
1088 |
case EWlanSecModeWAPI:
|
|
1089 |
{
|
|
1090 |
if ( iIsWAPISupported )
|
|
1091 |
{
|
|
1092 |
if ( !iWAPISecSettings )
|
|
1093 |
{
|
|
1094 |
iWAPISecSettings = CWAPISecuritySettings::NewL();
|
|
1095 |
}
|
|
1096 |
ret = iWAPISecSettings->IsValid();
|
|
1097 |
}
|
|
1098 |
else
|
|
1099 |
{
|
|
1100 |
User::Leave( KErrCorrupt );
|
|
1101 |
}
|
|
1102 |
break;
|
|
1103 |
}
|
|
1104 |
default:
|
|
1105 |
{
|
|
1106 |
// do nothing in urel
|
|
1107 |
break;
|
|
1108 |
}
|
|
1109 |
}
|
|
1110 |
return ret;
|
|
1111 |
}
|
|
1112 |
|
|
1113 |
|
|
1114 |
// --------------------------------------------------------------------------
|
|
1115 |
// CCmPluginWlan::UpdateSecuritySettingsL()
|
|
1116 |
// --------------------------------------------------------------------------
|
|
1117 |
//
|
|
1118 |
void CCmPluginWlan::UpdateSecuritySettingsL()
|
|
1119 |
{
|
|
1120 |
LOGGER_ENTERFN( "CCmPluginWlan::UpdateSecuritySettingsL" );
|
|
1121 |
|
|
1122 |
TUint32 oldwlaniapid(0);
|
|
1123 |
TUint32 wlaniapid = iIapRecord->iService;
|
|
1124 |
|
|
1125 |
TUint32 secmode = iWlanServiceRecord->iWlanSecMode;
|
|
1126 |
CLOG_WRITE_1( "Sec mode: [%d]", secmode );
|
|
1127 |
|
|
1128 |
TTypeOfSaving savetype( ESavingBrandNewAP );
|
|
1129 |
|
|
1130 |
if (iWlanServiceRecord->RecordId())
|
|
1131 |
{
|
|
1132 |
savetype = ESavingEditedAP;
|
|
1133 |
oldwlaniapid = wlaniapid;
|
|
1134 |
}
|
|
1135 |
|
|
1136 |
if ( iIsCopy )
|
|
1137 |
{
|
|
1138 |
oldwlaniapid = iCopiedFromIapId;
|
|
1139 |
savetype = ESavingNewAPAsACopy;
|
|
1140 |
|
|
1141 |
switch ( secmode )
|
|
1142 |
{
|
|
1143 |
case EWlanSecModeOpen:
|
|
1144 |
{
|
|
1145 |
break;
|
|
1146 |
}
|
|
1147 |
case EWlanSecModeWep:
|
|
1148 |
{
|
|
1149 |
// this is a brand new copy of another CM
|
|
1150 |
// we have to load the settings for the old wlan
|
|
1151 |
// and save with the new one.
|
|
1152 |
// first delete possibly existing other settings
|
|
1153 |
if ( iWepSecSettings )
|
|
1154 |
{
|
|
1155 |
delete iWepSecSettings;
|
|
1156 |
iWepSecSettings = NULL;
|
|
1157 |
}
|
|
1158 |
break;
|
|
1159 |
}
|
|
1160 |
case EWlanSecMode802_1x:
|
|
1161 |
{
|
|
1162 |
// this is a brand new copy of another CM
|
|
1163 |
// we have to load the settings for the old wlan
|
|
1164 |
// and save with the new one.
|
|
1165 |
// first delete possibly existing other settings
|
|
1166 |
if ( iWpaSecSettings )
|
|
1167 |
{
|
|
1168 |
delete iWpaSecSettings;
|
|
1169 |
iWpaSecSettings = NULL;
|
|
1170 |
}
|
|
1171 |
break;
|
|
1172 |
}
|
|
1173 |
case EWlanSecModeWpa:
|
|
1174 |
case EWlanSecModeWpa2:
|
|
1175 |
{
|
|
1176 |
// this is a brand new copy of another CM
|
|
1177 |
// we have to load the settings for the old wlan
|
|
1178 |
// and save with the new one.
|
|
1179 |
// first delete possibly existing other settings
|
|
1180 |
if ( iWpaSecSettings )
|
|
1181 |
{
|
|
1182 |
delete iWpaSecSettings;
|
|
1183 |
iWpaSecSettings = NULL;
|
|
1184 |
}
|
|
1185 |
break;
|
|
1186 |
}
|
|
1187 |
case EWlanSecModeWAPI:
|
|
1188 |
{
|
|
1189 |
if ( iIsWAPISupported )
|
|
1190 |
{
|
|
1191 |
if ( iWAPISecSettings )
|
|
1192 |
{
|
|
1193 |
delete iWAPISecSettings;
|
|
1194 |
iWAPISecSettings = NULL;
|
|
1195 |
}
|
|
1196 |
}
|
|
1197 |
else
|
|
1198 |
{
|
|
1199 |
User::Leave( KErrCorrupt );
|
|
1200 |
}
|
|
1201 |
break;
|
|
1202 |
}
|
|
1203 |
default:
|
|
1204 |
{
|
|
1205 |
CLOG_WRITE( "Unknown secmode" );
|
|
1206 |
// do nothing in urel
|
|
1207 |
break;
|
|
1208 |
}
|
|
1209 |
}
|
|
1210 |
}
|
|
1211 |
// now save, & load if still needed
|
|
1212 |
switch ( secmode )
|
|
1213 |
{
|
|
1214 |
case EWlanSecModeOpen:
|
|
1215 |
{
|
|
1216 |
// Extra fileds are deleted from WLANServiceTable
|
|
1217 |
// when security mode is changed from WPA to Open
|
|
1218 |
if ( iWpaSecSettings )
|
|
1219 |
{
|
|
1220 |
iWpaSecSettings->DeleteL( wlaniapid );
|
|
1221 |
}
|
|
1222 |
break;
|
|
1223 |
}
|
|
1224 |
case EWlanSecModeWep:
|
|
1225 |
{
|
|
1226 |
// Extra fileds are deleted from WLANServiceTable
|
|
1227 |
// when security mode is changed from WPA to WEP
|
|
1228 |
if ( iWpaSecSettings )
|
|
1229 |
{
|
|
1230 |
iWpaSecSettings->DeleteL( wlaniapid );
|
|
1231 |
}
|
|
1232 |
|
|
1233 |
// we have to try to save if:
|
|
1234 |
// 1. it is a changed AP, it is possible that only
|
|
1235 |
// sec. settings have been changed.
|
|
1236 |
// In this case, iWepSecSettings might be NULL!!
|
|
1237 |
// 2. it's sec. settings had been edited
|
|
1238 |
|
|
1239 |
if ( !iWepSecSettings )
|
|
1240 |
{
|
|
1241 |
iWepSecSettings = CWEPSecuritySettings::NewL();
|
|
1242 |
iWepSecSettings->LoadL( oldwlaniapid, Session() );
|
|
1243 |
}
|
|
1244 |
// save WEP settings, too, into same transaction...
|
|
1245 |
iWepSecSettings->SaveL( wlaniapid, Session() );
|
|
1246 |
break;
|
|
1247 |
}
|
|
1248 |
case EWlanSecMode802_1x:
|
|
1249 |
{
|
|
1250 |
if ( !iWpaSecSettings )
|
|
1251 |
{
|
|
1252 |
iWpaSecSettings =
|
|
1253 |
CWPASecuritySettings::NewL( ESecurityMode8021x );
|
|
1254 |
iWpaSecSettings->LoadL( oldwlaniapid, Session() );
|
|
1255 |
}
|
|
1256 |
// save WPA settings, too, into same transaction...
|
|
1257 |
iWpaSecSettings->SaveL( wlaniapid, Session(), savetype, oldwlaniapid );
|
|
1258 |
break;
|
|
1259 |
}
|
|
1260 |
case EWlanSecModeWpa:
|
|
1261 |
case EWlanSecModeWpa2:
|
|
1262 |
{
|
|
1263 |
if ( !iWpaSecSettings )
|
|
1264 |
{
|
|
1265 |
iWpaSecSettings =
|
|
1266 |
CWPASecuritySettings::NewL( ESecurityModeWpa );
|
|
1267 |
iWpaSecSettings->LoadL( oldwlaniapid, Session() );
|
|
1268 |
}
|
|
1269 |
|
|
1270 |
// save WPA settings, too, into same transaction...
|
|
1271 |
iWpaSecSettings->SaveL( wlaniapid, Session(), savetype, oldwlaniapid );
|
|
1272 |
break;
|
|
1273 |
}
|
|
1274 |
case EWlanSecModeWAPI:
|
|
1275 |
{
|
|
1276 |
if ( iIsWAPISupported )
|
|
1277 |
{
|
|
1278 |
if ( !iWAPISecSettings )
|
|
1279 |
{
|
|
1280 |
iWAPISecSettings = CWAPISecuritySettings::NewL();
|
|
1281 |
iWAPISecSettings->LoadL( iIapRecord->RecordId(), Session() );
|
|
1282 |
}
|
|
1283 |
// save WAPI settings
|
|
1284 |
TRAPD( err, iWAPISecSettings->SaveL( iIapRecord->RecordId(), Session() ) );
|
|
1285 |
if ( err )
|
|
1286 |
{
|
|
1287 |
if ( err != KErrArgument )
|
|
1288 |
{
|
|
1289 |
User::Leave( err );
|
|
1290 |
}
|
|
1291 |
}
|
|
1292 |
}
|
|
1293 |
else
|
|
1294 |
{
|
|
1295 |
User::Leave( KErrCorrupt );
|
|
1296 |
}
|
|
1297 |
break;
|
|
1298 |
}
|
|
1299 |
default:
|
|
1300 |
{
|
|
1301 |
CLOG_WRITE( "Unknown secmode" );
|
|
1302 |
// do nothing in urel
|
|
1303 |
break;
|
|
1304 |
}
|
|
1305 |
}
|
|
1306 |
// clean up copy flags
|
|
1307 |
if ( iIsCopy )
|
|
1308 |
{
|
|
1309 |
iIsCopy = EFalse;
|
|
1310 |
iCopiedFromIapId = 0;
|
|
1311 |
}
|
|
1312 |
}
|
|
1313 |
|
|
1314 |
|
|
1315 |
// --------------------------------------------------------------------------
|
|
1316 |
// CCmPluginWlan::AdditionalReset()
|
|
1317 |
// --------------------------------------------------------------------------
|
|
1318 |
//
|
|
1319 |
void CCmPluginWlan::AdditionalReset()
|
|
1320 |
{
|
|
1321 |
LOGGER_ENTERFN( "CCmPluginWlan::AdditionalReset" );
|
|
1322 |
|
|
1323 |
delete iWlanServiceRecord;
|
|
1324 |
iWlanServiceRecord = NULL;
|
|
1325 |
|
|
1326 |
delete iWepSecSettings;
|
|
1327 |
iWepSecSettings = NULL;
|
|
1328 |
|
|
1329 |
delete iWpaSecSettings;
|
|
1330 |
iWpaSecSettings = NULL;
|
|
1331 |
|
|
1332 |
if ( iIsWAPISupported )
|
|
1333 |
{
|
|
1334 |
delete iWAPISecSettings;
|
|
1335 |
iWAPISecSettings = NULL;
|
|
1336 |
}
|
|
1337 |
}
|
|
1338 |
|
|
1339 |
// --------------------------------------------------------------------------
|
|
1340 |
// CCmPluginWlan::BearerRecordIdLC()
|
|
1341 |
// --------------------------------------------------------------------------
|
|
1342 |
//
|
|
1343 |
void CCmPluginWlan::BearerRecordIdLC( HBufC* &aBearerName,
|
|
1344 |
TUint32& aRecordId )
|
|
1345 |
{
|
|
1346 |
LOGGER_ENTERFN( "CCmPluginWlan::BearerRecordIdLC" );
|
|
1347 |
|
|
1348 |
CCDLANBearerRecord* tmprec = static_cast<CCDLANBearerRecord*>
|
|
1349 |
( CCDRecordBase::RecordFactoryL( KCDTIdLANBearerRecord ) );
|
|
1350 |
CleanupStack::PushL( tmprec );
|
|
1351 |
|
|
1352 |
tmprec->iRecordName.SetL( TPtrC( iBearerRecName ) );
|
|
1353 |
if ( !tmprec->FindL( Session() ) )
|
|
1354 |
{ // bearer not found -> create dummy values
|
|
1355 |
CLOG_WRITE( "No bearer found" );
|
|
1356 |
|
|
1357 |
tmprec->SetRecordId( KCDNewRecordRequest );
|
|
1358 |
|
|
1359 |
tmprec->iBearerAgent.SetL( KWlanBearerAgent );
|
|
1360 |
tmprec->iRecordName.SetL( KWlanBearerName );
|
|
1361 |
tmprec->iLanBearerNifName.SetL( KWlanBearerNif );
|
|
1362 |
tmprec->iLanBearerLddName.SetL( KWlanLDDName );
|
|
1363 |
tmprec->iLanBearerPddName.SetL( KWlanPDDName );
|
|
1364 |
tmprec->iLastSocketActivityTimeout.SetL(
|
|
1365 |
( TUint32 )KWlanLastSocketActivityTimeout );
|
|
1366 |
tmprec->iLastSessionClosedTimeout.SetL(
|
|
1367 |
(TUint32 )KWlanLastSessionClosedTimeout );
|
|
1368 |
tmprec->iLastSocketClosedTimeout.SetL(
|
|
1369 |
( TUint32 )KWlanLastSocketClosedTimeout );
|
|
1370 |
tmprec->StoreL( Session() );
|
|
1371 |
}
|
|
1372 |
|
|
1373 |
aRecordId = tmprec->RecordId();
|
|
1374 |
|
|
1375 |
CLOG_WRITE_2( "Name: [%S], id: [%d]",
|
|
1376 |
&tmprec->iRecordName.GetL(),
|
|
1377 |
aRecordId );
|
|
1378 |
|
|
1379 |
CleanupStack::PopAndDestroy( tmprec );
|
|
1380 |
|
|
1381 |
aBearerName = TPtrC(KCDTypeNameLANBearer).AllocLC();
|
|
1382 |
}
|
|
1383 |
|
|
1384 |
|
|
1385 |
// --------------------------------------------------------------------------
|
|
1386 |
// CCmPluginWlan::ReadResourceL()
|
|
1387 |
// --------------------------------------------------------------------------
|
|
1388 |
//
|
|
1389 |
HBufC* CCmPluginWlan::ReadResourceL( TInt aResId, TInt aInt ) const
|
|
1390 |
{
|
|
1391 |
LOGGER_ENTERFN( "CCmPluginWlan::ReadResourceL" );
|
|
1392 |
|
|
1393 |
HBufC* retval = NULL;
|
|
1394 |
|
|
1395 |
RConeResourceLoader resourceLoader( *CEikonEnv::Static() );
|
|
1396 |
LoadResourceLC( resourceLoader );
|
|
1397 |
retval = StringLoader::LoadL( aResId, aInt );
|
|
1398 |
|
|
1399 |
// Clean-up
|
|
1400 |
CleanupStack::PopAndDestroy();
|
|
1401 |
|
|
1402 |
return retval;
|
|
1403 |
}
|
|
1404 |
|
|
1405 |
|
|
1406 |
// --------------------------------------------------------------------------
|
|
1407 |
// CCmPluginWlan::LoadResourceL()
|
|
1408 |
// --------------------------------------------------------------------------
|
|
1409 |
//
|
|
1410 |
void CCmPluginWlan::LoadResourceLC(
|
|
1411 |
RConeResourceLoader& aResourceLoader ) const
|
|
1412 |
{
|
|
1413 |
LOGGER_ENTERFN( "CCmPluginWlan::LoadResourceLC" );
|
|
1414 |
|
|
1415 |
// Add resource file.
|
|
1416 |
TParse fp;
|
|
1417 |
User::LeaveIfError( fp.Set( KPluginWlanResDirAndFileName,
|
|
1418 |
&KDC_RESOURCE_FILES_DIR,
|
|
1419 |
NULL ) );
|
|
1420 |
TFileName resourceFileNameBuf = fp.FullName();
|
|
1421 |
|
|
1422 |
CleanupClosePushL( aResourceLoader );
|
|
1423 |
aResourceLoader.OpenL( resourceFileNameBuf );
|
|
1424 |
}
|
|
1425 |
|
|
1426 |
|
|
1427 |
// --------------------------------------------------------------------------
|
|
1428 |
// CCmPluginWlan::InitializeWithUiL
|
|
1429 |
// --------------------------------------------------------------------------
|
|
1430 |
//
|
|
1431 |
TBool CCmPluginWlan::InitializeWithUiL( TBool aManuallyConfigure )
|
|
1432 |
{
|
|
1433 |
LOGGER_ENTERFN( "CCmPluginWlan::InitializeWithUiL" );
|
|
1434 |
|
|
1435 |
TBool retVal ( EFalse );
|
|
1436 |
RConeResourceLoader resourceLoader( *CEikonEnv::Static() );
|
|
1437 |
LoadResourceLC( resourceLoader );
|
|
1438 |
if ( aManuallyConfigure )
|
|
1439 |
{
|
|
1440 |
retVal = ManuallyConfigureL();
|
|
1441 |
}
|
|
1442 |
else
|
|
1443 |
{
|
|
1444 |
retVal = AutomaticallyConfigureL();
|
|
1445 |
}
|
|
1446 |
// Clean-up
|
|
1447 |
CleanupStack::PopAndDestroy();
|
|
1448 |
return retVal;
|
|
1449 |
}
|
|
1450 |
|
|
1451 |
// --------------------------------------------------------------------------
|
|
1452 |
// CCmPluginWlan::ProtectedSetupL
|
|
1453 |
// --------------------------------------------------------------------------
|
|
1454 |
//
|
|
1455 |
WiFiProt::TWiFiReturn CCmPluginWlan::ProtectedSetupL( TWlanSsid& aSsid )
|
|
1456 |
{
|
|
1457 |
RCmManagerExt packedCmManager;
|
|
1458 |
iCmMgr.WrapCmManager( packedCmManager );
|
|
1459 |
CWifiProtUiInProcess* wifi = CWifiProtUiInProcess::NewL(
|
|
1460 |
&packedCmManager );
|
|
1461 |
CleanupStack::PushL( wifi );
|
|
1462 |
WiFiProt::TWiFiReturn wifiret = wifi->StartFromUiL( aSsid, EFalse, iAdditionalCmsCreated);
|
|
1463 |
CleanupStack::PopAndDestroy( wifi );
|
|
1464 |
switch ( wifiret )
|
|
1465 |
{
|
|
1466 |
case WiFiProt::EWiFiCancel:
|
|
1467 |
{
|
|
1468 |
break;
|
|
1469 |
}
|
|
1470 |
case WiFiProt::EWiFiOK:
|
|
1471 |
{
|
|
1472 |
if (iAdditionalCmsCreated.Count())
|
|
1473 |
{
|
|
1474 |
// Loading the first item in the array
|
|
1475 |
// to the actual plugin
|
|
1476 |
Reset();
|
|
1477 |
AdditionalReset();
|
|
1478 |
LoadL( iAdditionalCmsCreated[0] );
|
|
1479 |
iAdditionalCmsCreated.Remove(0);
|
|
1480 |
}
|
|
1481 |
else
|
|
1482 |
{//no settings configured, do the same as cancel case
|
|
1483 |
return WiFiProt::EWiFiCancel;
|
|
1484 |
}
|
|
1485 |
|
|
1486 |
break;
|
|
1487 |
}
|
|
1488 |
case WiFiProt::EWifiNoAuto:
|
|
1489 |
{
|
|
1490 |
break;
|
|
1491 |
}
|
|
1492 |
default:
|
|
1493 |
{
|
|
1494 |
User::Leave( KErrNotSupported );
|
|
1495 |
break;
|
|
1496 |
}
|
|
1497 |
}
|
|
1498 |
return wifiret;
|
|
1499 |
}
|
|
1500 |
|
|
1501 |
// --------------------------------------------------------------------------
|
|
1502 |
// CCmPluginWlan::AutomaticallyConfigureL
|
|
1503 |
// --------------------------------------------------------------------------
|
|
1504 |
//
|
|
1505 |
TBool CCmPluginWlan::AutomaticallyConfigureL()
|
|
1506 |
{
|
|
1507 |
LOGGER_ENTERFN( "CCmPluginWlan::AutomaticallyConfigureL" );
|
|
1508 |
|
|
1509 |
TBool retval ( ETrue );
|
|
1510 |
|
|
1511 |
if ( !iConnUiUtils )
|
|
1512 |
{
|
|
1513 |
iConnUiUtils = CConnectionUiUtilities::NewL();
|
|
1514 |
}
|
|
1515 |
|
|
1516 |
// Let's search for a WLAN network
|
|
1517 |
TWlanSsid ssid;
|
|
1518 |
TWlanConnectionMode connectionMode;
|
|
1519 |
TWlanConnectionExtentedSecurityMode securityMode;
|
|
1520 |
|
|
1521 |
TUint32 secmode( EWlanSecModeOpen );
|
|
1522 |
|
|
1523 |
// Fortunately user will not see WLAN networks with empty ssid in the list
|
|
1524 |
// shown by next call.
|
|
1525 |
CCmPluginWlanActiveWaiter* waiter = CCmPluginWlanActiveWaiter::NewL();
|
|
1526 |
CleanupStack::PushL( waiter );
|
|
1527 |
|
|
1528 |
TBool isProtectedSetupSupported;
|
|
1529 |
iConnUiUtils->SearchWLANNetworkAsync( waiter->iStatus, ssid, connectionMode, securityMode, isProtectedSetupSupported );
|
|
1530 |
|
|
1531 |
TInt searchWlanReturn = waiter->WaitForRequest();
|
|
1532 |
CleanupStack::PopAndDestroy( waiter );
|
|
1533 |
|
|
1534 |
if ( searchWlanReturn == KErrNone)
|
|
1535 |
{
|
|
1536 |
if ( isProtectedSetupSupported )
|
|
1537 |
{
|
|
1538 |
TBool wifiret = ProtectedSetupL( ssid );
|
|
1539 |
switch ( wifiret )
|
|
1540 |
{
|
|
1541 |
case WiFiProt::EWiFiCancel: //cancel pressed, cancel process
|
|
1542 |
{
|
|
1543 |
return EFalse;
|
|
1544 |
//break;
|
|
1545 |
}
|
|
1546 |
case WiFiProt::EWiFiOK: //settings configured already, we can return
|
|
1547 |
{
|
|
1548 |
return ETrue;
|
|
1549 |
//break;
|
|
1550 |
}
|
|
1551 |
case WiFiProt::EWifiNoAuto://proceed with normal setup
|
|
1552 |
{
|
|
1553 |
break;
|
|
1554 |
}
|
|
1555 |
default:
|
|
1556 |
{
|
|
1557 |
User::Leave( KErrNotSupported );
|
|
1558 |
break;
|
|
1559 |
}
|
|
1560 |
}
|
|
1561 |
}
|
|
1562 |
switch( securityMode )
|
|
1563 |
{
|
|
1564 |
case EWlanConnectionExtentedSecurityModeOpen:
|
|
1565 |
{
|
|
1566 |
secmode = EWlanSecModeOpen;
|
|
1567 |
}
|
|
1568 |
break;
|
|
1569 |
|
|
1570 |
case EWlanConnectionExtentedSecurityModeWepOpen:
|
|
1571 |
case EWlanConnectionExtentedSecurityModeWepShared:
|
|
1572 |
{
|
|
1573 |
secmode = EWlanSecModeWep;
|
|
1574 |
}
|
|
1575 |
break;
|
|
1576 |
|
|
1577 |
case EWlanConnectionExtentedSecurityMode802d1x:
|
|
1578 |
{
|
|
1579 |
secmode = EWlanSecMode802_1x;
|
|
1580 |
}
|
|
1581 |
break;
|
|
1582 |
|
|
1583 |
case EWlanConnectionExtentedSecurityModeWpa:
|
|
1584 |
case EWlanConnectionExtentedSecurityModeWpaPsk:
|
|
1585 |
{
|
|
1586 |
secmode = EWlanSecModeWpa;
|
|
1587 |
}
|
|
1588 |
break;
|
|
1589 |
|
|
1590 |
case EWlanConnectionExtentedSecurityModeWpa2:
|
|
1591 |
case EWlanConnectionExtentedSecurityModeWpa2Psk:
|
|
1592 |
{
|
|
1593 |
secmode = EWlanSecModeWpa2;
|
|
1594 |
}
|
|
1595 |
break;
|
|
1596 |
case EWlanConnectionExtentedSecurityModeWapi:
|
|
1597 |
case EWlanConnectionExtentedSecurityModeWapiPsk:
|
|
1598 |
{
|
|
1599 |
if ( iIsWAPISupported )
|
|
1600 |
{
|
|
1601 |
secmode = EWlanSecModeWAPI;
|
|
1602 |
}
|
|
1603 |
else
|
|
1604 |
{
|
|
1605 |
User::Leave( KErrCorrupt );
|
|
1606 |
}
|
|
1607 |
}
|
|
1608 |
break;
|
|
1609 |
default:
|
|
1610 |
{
|
|
1611 |
User::Leave( KErrNotSupported );
|
|
1612 |
}
|
|
1613 |
}
|
|
1614 |
|
|
1615 |
// Let's check the security mode and if it's other than "none", then
|
|
1616 |
// ask for the key.
|
|
1617 |
HBufC* key = HBufC::NewLC( KWlanMaxKeyLength ); // security key
|
|
1618 |
TPtr keyPtr( key->Des() );
|
|
1619 |
TBool wepKeyInAsciiFormat;
|
|
1620 |
switch( securityMode )
|
|
1621 |
{
|
|
1622 |
case EWlanConnectionExtentedSecurityModeWepOpen:
|
|
1623 |
case EWlanConnectionExtentedSecurityModeWepShared:
|
|
1624 |
{
|
|
1625 |
retval = iConnUiUtils->EasyWepDlg( &keyPtr, wepKeyInAsciiFormat );
|
|
1626 |
break;
|
|
1627 |
}
|
|
1628 |
case EWlanConnectionExtentedSecurityModeWpaPsk:
|
|
1629 |
case EWlanConnectionExtentedSecurityModeWpa2Psk:
|
|
1630 |
{
|
|
1631 |
retval = iConnUiUtils->EasyWpaDlg( &keyPtr );
|
|
1632 |
break;
|
|
1633 |
}
|
|
1634 |
case EWlanConnectionExtentedSecurityModeWapiPsk:
|
|
1635 |
{
|
|
1636 |
retval = iConnUiUtils->EasyWapiDlg( &keyPtr );
|
|
1637 |
break;
|
|
1638 |
}
|
|
1639 |
case EWlanConnectionExtentedSecurityModeOpen:
|
|
1640 |
case EWlanConnectionExtentedSecurityMode802d1x:
|
|
1641 |
case EWlanConnectionExtentedSecurityModeWpa:
|
|
1642 |
case EWlanConnectionExtentedSecurityModeWpa2:
|
|
1643 |
case EWlanConnectionExtentedSecurityModeWapi:
|
|
1644 |
default:
|
|
1645 |
{
|
|
1646 |
break;
|
|
1647 |
}
|
|
1648 |
}
|
|
1649 |
|
|
1650 |
// If retval is not ETrue here, then most probably the user has
|
|
1651 |
// cancelled the password dialog ==> she has cancelled the whole
|
|
1652 |
// process.
|
|
1653 |
if ( retval )
|
|
1654 |
{
|
|
1655 |
// We have to convert the 8-bit SSID to 16-bit for CommsDat.
|
|
1656 |
HBufC* ssid16 = HBufC::NewLC( ssid.Length() );
|
|
1657 |
TPtr ssid16Ptr( ssid16->Des() );
|
|
1658 |
|
|
1659 |
// save iap name as unicode
|
|
1660 |
TInt error = CnvUtfConverter::ConvertToUnicodeFromUtf8( ssid16Ptr, ssid );
|
|
1661 |
if ( error )
|
|
1662 |
{
|
|
1663 |
ssid16Ptr.Copy( ssid );
|
|
1664 |
}
|
|
1665 |
SetStringAttributeL( ECmName, *ssid16 );
|
|
1666 |
|
|
1667 |
// save ssid as UTF8
|
|
1668 |
ssid16Ptr.Zero();
|
|
1669 |
ssid16Ptr.FillZ();
|
|
1670 |
ssid16Ptr.Copy( ssid );
|
|
1671 |
SetStringAttributeL( EWlanSSID, *ssid16 );
|
|
1672 |
// ConvertWLANConnectionStatesL( )converts WLAN connection state
|
|
1673 |
// (TWlanConnectionMode) into EInfra or EAdhoc (TWlanNetMode)
|
|
1674 |
SetIntAttributeL( EWlanConnectionMode,
|
|
1675 |
(TUint32) ConvertWLANConnectionStatesL( connectionMode ) );
|
|
1676 |
SetIntAttributeL( EWlanSecurityMode, secmode );
|
|
1677 |
|
|
1678 |
// Check if the network is hidden
|
|
1679 |
TBool hidden( EFalse );
|
|
1680 |
|
|
1681 |
// These values we already have so we are not interested of
|
|
1682 |
// them
|
|
1683 |
TWlanNetMode tempNetworkMode;
|
|
1684 |
TWlanConnectionExtentedSecurityMode tempSecurityMode;
|
|
1685 |
|
|
1686 |
TBool tempProtectedSetupSupported;
|
|
1687 |
|
|
1688 |
TInt retVal( KErrNone );
|
|
1689 |
|
|
1690 |
CCmWlanCoverageCheck* coverage = new( ELeave )CCmWlanCoverageCheck;
|
|
1691 |
CleanupStack::PushL( coverage );
|
|
1692 |
|
|
1693 |
// We need to catch leave value of Wlan scanning
|
|
1694 |
TRAPD( err, retVal = coverage->ScanForPromptedSsidL( ssid, ETrue,
|
|
1695 |
tempNetworkMode,
|
|
1696 |
tempSecurityMode,
|
|
1697 |
tempProtectedSetupSupported ) );
|
|
1698 |
if ( !retVal || err != KErrNone)
|
|
1699 |
{
|
|
1700 |
TRAPD( err, retVal = coverage->ScanForPromptedSsidL( ssid,
|
|
1701 |
EFalse,
|
|
1702 |
tempNetworkMode,
|
|
1703 |
tempSecurityMode,
|
|
1704 |
tempProtectedSetupSupported ) );
|
|
1705 |
if ( err == KErrNone && retVal )
|
|
1706 |
{
|
|
1707 |
hidden = ETrue;
|
|
1708 |
}
|
|
1709 |
else // direct scan is ok, but network could not found with given ssid
|
|
1710 |
{
|
|
1711 |
CleanupStack::PopAndDestroy( coverage ); // coverage
|
|
1712 |
CleanupStack::PopAndDestroy( ssid16 );
|
|
1713 |
CleanupStack::PopAndDestroy( key );
|
|
1714 |
|
|
1715 |
TCmCommonUi::ShowNoteL( R_QTN_NETW_QUEST_IAP_INCOMPLETE_DELETE, TCmCommonUi::ECmOkNote );
|
|
1716 |
return EFalse;
|
|
1717 |
}
|
|
1718 |
}
|
|
1719 |
|
|
1720 |
CleanupStack::PopAndDestroy( coverage ); // coverage
|
|
1721 |
|
|
1722 |
SetBoolAttributeL( EWlanScanSSID, hidden );
|
|
1723 |
CLOG_WRITE_1( "Is hidden[%d]", (TInt) hidden );
|
|
1724 |
|
|
1725 |
// We have to store the security key as well.
|
|
1726 |
if ( securityMode == EWlanConnectionExtentedSecurityModeWepOpen )
|
|
1727 |
{
|
|
1728 |
if ( !iWepSecSettings )
|
|
1729 |
{
|
|
1730 |
iWepSecSettings = CWEPSecuritySettings::NewL();
|
|
1731 |
}
|
|
1732 |
iWepSecSettings->SetKeyDataL( 0, *key,
|
|
1733 |
wepKeyInAsciiFormat );
|
|
1734 |
// Note that the key will NOT be persisted at this very
|
|
1735 |
// point, but only after SaveL, which will be called
|
|
1736 |
// later on.
|
|
1737 |
}
|
|
1738 |
else if ( securityMode == EWlanConnectionExtentedSecurityModeWpaPsk
|
|
1739 |
|| securityMode == EWlanConnectionExtentedSecurityModeWpa2Psk )
|
|
1740 |
{
|
|
1741 |
if ( !iWpaSecSettings )
|
|
1742 |
{
|
|
1743 |
iWpaSecSettings = CWPASecuritySettings::NewL( ESecurityModeWpa );
|
|
1744 |
}
|
|
1745 |
iWpaSecSettings->SetWPAPreSharedKey( *key );
|
|
1746 |
|
|
1747 |
// Note that the key will NOT be persisted at this very
|
|
1748 |
// point, but only after SaveL, which will be called
|
|
1749 |
// later on.
|
|
1750 |
}
|
|
1751 |
else if ( securityMode == EWlanConnectionExtentedSecurityModeWapiPsk )
|
|
1752 |
{
|
|
1753 |
if ( !iWAPISecSettings )
|
|
1754 |
{
|
|
1755 |
iWAPISecSettings = CWAPISecuritySettings::NewL();
|
|
1756 |
}
|
|
1757 |
|
|
1758 |
iWAPISecSettings->SetPreSharedKeyL( CWAPISecuritySettings::EWapiKeyAscii, *key );
|
|
1759 |
// Note that the key will NOT be persisted at this very
|
|
1760 |
// point, but only after SaveL, which will be called
|
|
1761 |
// later on.
|
|
1762 |
}
|
|
1763 |
|
|
1764 |
CLOG_WRITE( "InitializeWithUiL stored everything successfully" );
|
|
1765 |
|
|
1766 |
CleanupStack::PopAndDestroy( ssid16 );
|
|
1767 |
}
|
|
1768 |
CleanupStack::PopAndDestroy( key );
|
|
1769 |
}
|
|
1770 |
else
|
|
1771 |
{
|
|
1772 |
if ( searchWlanReturn == KErrNotFound )
|
|
1773 |
{
|
|
1774 |
// no Wlan network found, continuing process...
|
|
1775 |
HBufC* ssid16 = HBufC::NewLC( ssid.Length() );
|
|
1776 |
TPtr ssid16Ptr( ssid16->Des() );
|
|
1777 |
|
|
1778 |
// save iap name as unicode
|
|
1779 |
TInt error = CnvUtfConverter::ConvertToUnicodeFromUtf8( ssid16Ptr, ssid );
|
|
1780 |
if ( error )
|
|
1781 |
{
|
|
1782 |
ssid16Ptr.Copy( ssid );
|
|
1783 |
}
|
|
1784 |
SetStringAttributeL( ECmName, *ssid16 );
|
|
1785 |
|
|
1786 |
// save ssid as UTF8
|
|
1787 |
ssid16Ptr.Zero();
|
|
1788 |
ssid16Ptr.FillZ();
|
|
1789 |
ssid16Ptr.Copy( ssid );
|
|
1790 |
|
|
1791 |
// write ssid and go on...
|
|
1792 |
SetStringAttributeL( EWlanSSID, *ssid16 );
|
|
1793 |
CleanupStack::PopAndDestroy( ssid16 );
|
|
1794 |
retval = ProceedWithManualL( ETrue ); // revert to fully manual...
|
|
1795 |
}
|
|
1796 |
else
|
|
1797 |
{
|
|
1798 |
retval = EFalse;
|
|
1799 |
}
|
|
1800 |
}
|
|
1801 |
return retval;
|
|
1802 |
}
|
|
1803 |
|
|
1804 |
|
|
1805 |
// --------------------------------------------------------------------------
|
|
1806 |
// CCmPluginWlan::ManuallyConfigureL
|
|
1807 |
// --------------------------------------------------------------------------
|
|
1808 |
//
|
|
1809 |
TBool CCmPluginWlan::ManuallyConfigureL()
|
|
1810 |
{
|
|
1811 |
LOGGER_ENTERFN( "CCmPluginWlan::ManuallyConfigureL" );
|
|
1812 |
|
|
1813 |
TBool proceed ( EFalse );
|
|
1814 |
|
|
1815 |
// Step 1 - WLAN Network Name query (SSID)
|
|
1816 |
// sets: ECmName, EWlanSSID
|
|
1817 |
RBuf nwName;
|
|
1818 |
nwName.CreateL( KCmWlanNWNameMaxLength );
|
|
1819 |
CleanupClosePushL( nwName );
|
|
1820 |
|
|
1821 |
proceed = ShowNWNameQueryL( nwName );
|
|
1822 |
|
|
1823 |
if ( proceed )
|
|
1824 |
{
|
|
1825 |
TWlanNetMode nwMode( EInfra );
|
|
1826 |
|
|
1827 |
TWlanConnectionExtentedSecurityMode securityMode =
|
|
1828 |
EWlanConnectionExtentedSecurityModeOpen;
|
|
1829 |
|
|
1830 |
TWpaMode wpaMode = EWpaModeUndefined;
|
|
1831 |
|
|
1832 |
proceed = ProceedWithManualL ( ETrue, nwMode, securityMode, wpaMode );
|
|
1833 |
}
|
|
1834 |
CleanupStack::PopAndDestroy( &nwName );
|
|
1835 |
|
|
1836 |
return proceed;
|
|
1837 |
}
|
|
1838 |
|
|
1839 |
|
|
1840 |
// --------------------------------------------------------------------------
|
|
1841 |
// CCmPluginWlan::ProceedWithManualL
|
|
1842 |
// --------------------------------------------------------------------------
|
|
1843 |
//
|
|
1844 |
TBool CCmPluginWlan::ProceedWithManualL( TBool aAskNWModeAndSec,
|
|
1845 |
TWlanNetMode aNwMode,
|
|
1846 |
TWlanConnectionExtentedSecurityMode aSecurityMode,
|
|
1847 |
TWpaMode aWpaMode )
|
|
1848 |
{
|
|
1849 |
LOGGER_ENTERFN( "CCmPluginWlan::ProceedWithManualL" );
|
|
1850 |
|
|
1851 |
TInt proceed = ETrue;
|
|
1852 |
if ( aAskNWModeAndSec )
|
|
1853 |
{
|
|
1854 |
// Step 3 - Network Mode
|
|
1855 |
// sets: EWlanConnectionMode
|
|
1856 |
// EWlanScanSSID
|
|
1857 |
proceed = SelectNWModeL( aNwMode );
|
|
1858 |
|
|
1859 |
// Step 4 - Network security
|
|
1860 |
// sets: EWlanSecurityMode
|
|
1861 |
// Open - finished
|
|
1862 |
// WEP - go to step 5
|
|
1863 |
// WPA/802.1x - go to step 6
|
|
1864 |
// WAPI - go to step 9
|
|
1865 |
if ( proceed )
|
|
1866 |
{
|
|
1867 |
proceed = ShowNWSecurityDlgL( aNwMode, aSecurityMode );
|
|
1868 |
}
|
|
1869 |
}
|
|
1870 |
|
|
1871 |
// Security settings - Steps 5-8
|
|
1872 |
if ( proceed && aSecurityMode != EWlanConnectionExtentedSecurityModeOpen )
|
|
1873 |
{
|
|
1874 |
switch ( aSecurityMode )
|
|
1875 |
{
|
|
1876 |
// Step 5 - Enter WEP key
|
|
1877 |
// sets: wep key
|
|
1878 |
// finished
|
|
1879 |
case EWlanConnectionExtentedSecurityModeWepOpen:
|
|
1880 |
case EWlanConnectionExtentedSecurityModeWepShared:
|
|
1881 |
{
|
|
1882 |
proceed = EnterWEPKeyL();
|
|
1883 |
break;
|
|
1884 |
}
|
|
1885 |
// Step 6 - WPA/WPA2 mode
|
|
1886 |
// sets: wpa/802.1x keys
|
|
1887 |
// Pre-shared - go to step 7
|
|
1888 |
// EAP - go to step 8
|
|
1889 |
case EWlanConnectionExtentedSecurityMode802d1x:
|
|
1890 |
TCmCommonUi::ShowNoteL( *( StringLoader::LoadLC(
|
|
1891 |
R_QTN_NETW_CONSET_INFO_EAP_SETTINGS_DEFAULT ) ),
|
|
1892 |
TCmCommonUi::ECmInfoNote );
|
|
1893 |
CleanupStack::PopAndDestroy();
|
|
1894 |
break;
|
|
1895 |
|
|
1896 |
case EWlanConnectionExtentedSecurityModeWpa:
|
|
1897 |
case EWlanConnectionExtentedSecurityModeWpaPsk:
|
|
1898 |
case EWlanConnectionExtentedSecurityModeWpa2:
|
|
1899 |
case EWlanConnectionExtentedSecurityModeWpa2Psk:
|
|
1900 |
{
|
|
1901 |
if ( aWpaMode == EWpaModeUndefined )
|
|
1902 |
{
|
|
1903 |
proceed = SelectWpaModeDialogL( aWpaMode );
|
|
1904 |
}
|
|
1905 |
|
|
1906 |
if ( proceed )
|
|
1907 |
{
|
|
1908 |
// Step 7 - Pre-shared key
|
|
1909 |
// sets: pre-shared key
|
|
1910 |
// finished
|
|
1911 |
if ( aWpaMode == EWpaModePreSharedKey )
|
|
1912 |
{
|
|
1913 |
proceed = EnterWpaPreSharedKeyL();
|
|
1914 |
}
|
|
1915 |
// Step 8 - EAP selection note
|
|
1916 |
else
|
|
1917 |
{
|
|
1918 |
TCmCommonUi::ShowNoteL( *( StringLoader::LoadLC(
|
|
1919 |
R_QTN_NETW_CONSET_INFO_EAP_SETTINGS_DEFAULT ) ),
|
|
1920 |
TCmCommonUi::ECmInfoNote );
|
|
1921 |
CleanupStack::PopAndDestroy();
|
|
1922 |
}
|
|
1923 |
}
|
|
1924 |
break;
|
|
1925 |
}
|
|
1926 |
// Step 9
|
|
1927 |
case EWlanConnectionExtentedSecurityModeWapi:
|
|
1928 |
case EWlanConnectionExtentedSecurityModeWapiPsk:
|
|
1929 |
{
|
|
1930 |
if ( iIsWAPISupported )
|
|
1931 |
{
|
|
1932 |
if ( aSecurityMode == EWlanConnectionExtentedSecurityModeWapiPsk )
|
|
1933 |
{
|
|
1934 |
proceed = EnterWAPIPreSharedKeyL();
|
|
1935 |
}
|
|
1936 |
}
|
|
1937 |
else
|
|
1938 |
{
|
|
1939 |
User::Leave( KErrCorrupt );
|
|
1940 |
}
|
|
1941 |
break;
|
|
1942 |
}
|
|
1943 |
default:
|
|
1944 |
{
|
|
1945 |
User::Leave( KErrNotSupported );
|
|
1946 |
break;
|
|
1947 |
}
|
|
1948 |
}
|
|
1949 |
}
|
|
1950 |
|
|
1951 |
// Store all the unsaved settings
|
|
1952 |
/* if ( proceed )
|
|
1953 |
{
|
|
1954 |
UpdateSecuritySettingsL();
|
|
1955 |
}*/
|
|
1956 |
return proceed;
|
|
1957 |
}
|
|
1958 |
|
|
1959 |
// --------------------------------------------------------------------------
|
|
1960 |
// CCmPluginWlan::ShowNWNameQueryL
|
|
1961 |
// --------------------------------------------------------------------------
|
|
1962 |
//
|
|
1963 |
TBool CCmPluginWlan::ShowNWNameQueryL( TDes& aNwName )
|
|
1964 |
{
|
|
1965 |
LOGGER_ENTERFN( "CCmPluginWlan::ShowNWNameQueryL" );
|
|
1966 |
|
|
1967 |
TBool retVal ( EFalse );
|
|
1968 |
|
|
1969 |
retVal = TCmCommonUi::ShowConfirmationQueryWithInputL(
|
|
1970 |
R_QTN_WLAN_PRMPT_NETWORK_NAME,
|
|
1971 |
aNwName );
|
|
1972 |
if ( retVal )
|
|
1973 |
{
|
|
1974 |
// save iap name as unicode
|
|
1975 |
SetStringAttributeL( ECmName, aNwName );
|
|
1976 |
|
|
1977 |
// save ssid as UTF8
|
|
1978 |
TWlanSsid ssid;
|
|
1979 |
TInt err = CnvUtfConverter::ConvertFromUnicodeToUtf8( ssid, aNwName );
|
|
1980 |
if ( err == KErrNone )
|
|
1981 |
{
|
|
1982 |
aNwName.Copy( ssid );
|
|
1983 |
}
|
|
1984 |
SetStringAttributeL( EWlanSSID, aNwName );
|
|
1985 |
|
|
1986 |
retVal = ETrue;
|
|
1987 |
}
|
|
1988 |
return retVal;
|
|
1989 |
}
|
|
1990 |
|
|
1991 |
|
|
1992 |
// --------------------------------------------------------------------------
|
|
1993 |
// CCmPluginWlan::ScanForWlanNwL
|
|
1994 |
// --------------------------------------------------------------------------
|
|
1995 |
//
|
|
1996 |
TBool CCmPluginWlan::ScanForWlanNwL(
|
|
1997 |
#ifdef __WINS__
|
|
1998 |
TWlanSsid& /*aSsid*/, TWlanNetMode& /*aNetworkMode*/,
|
|
1999 |
TWlanConnectionExtentedSecurityMode& /*aSecurityMode*/,
|
|
2000 |
TBool& /*aProtectedSetupSupported*/ )
|
|
2001 |
#else
|
|
2002 |
TWlanSsid& aSsid, TWlanNetMode& aNetworkMode,
|
|
2003 |
TWlanConnectionExtentedSecurityMode& aSecurityMode,
|
|
2004 |
TBool& aProtectedSetupSupported )
|
|
2005 |
#endif // __WINS__
|
|
2006 |
{
|
|
2007 |
LOGGER_ENTERFN( "CCmPluginWlan::ScanForWlanNwL" );
|
|
2008 |
|
|
2009 |
TBool retVal ( EFalse );
|
|
2010 |
|
|
2011 |
DestroyWaitDialog();
|
|
2012 |
|
|
2013 |
iWaitDialog = new( ELeave )CAknWaitDialog
|
|
2014 |
( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ), ETrue );
|
|
2015 |
iWaitDialog->ExecuteLD( R_SEARCHING_WLAN_WAIT_NOTE );
|
|
2016 |
|
|
2017 |
#ifndef __WINS__
|
|
2018 |
TBool hidden ( EFalse );
|
|
2019 |
|
|
2020 |
CCmWlanCoverageCheck* coverage = new( ELeave )CCmWlanCoverageCheck;
|
|
2021 |
CleanupStack::PushL( coverage );
|
|
2022 |
|
|
2023 |
CLOG_WRITE( "Coverage created, calling ScanForPromptedSsidL, broadcast" );
|
|
2024 |
retVal = coverage->ScanForPromptedSsidL( aSsid, ETrue, aNetworkMode,
|
|
2025 |
aSecurityMode,
|
|
2026 |
aProtectedSetupSupported );
|
|
2027 |
CLOG_WRITE( "ScanForPromptedSsidL returned" );
|
|
2028 |
|
|
2029 |
if ( !retVal )
|
|
2030 |
{
|
|
2031 |
CLOG_WRITE( "Calling ScanForPromptedSsidL, direct" );
|
|
2032 |
retVal = coverage->ScanForPromptedSsidL( aSsid, EFalse, aNetworkMode,
|
|
2033 |
aSecurityMode,
|
|
2034 |
aProtectedSetupSupported );
|
|
2035 |
CLOG_WRITE( "ScanForPromptedSsidL returned" );
|
|
2036 |
|
|
2037 |
if ( retVal )
|
|
2038 |
{
|
|
2039 |
hidden = ETrue;
|
|
2040 |
}
|
|
2041 |
}
|
|
2042 |
|
|
2043 |
CleanupStack::PopAndDestroy( coverage );
|
|
2044 |
|
|
2045 |
if ( retVal )
|
|
2046 |
{
|
|
2047 |
CLOG_WRITE( "Ssid has been found" );
|
|
2048 |
|
|
2049 |
// Network mode
|
|
2050 |
SetIntAttributeL( EWlanConnectionMode, aNetworkMode );
|
|
2051 |
// Security mode
|
|
2052 |
SetIntAttributeL( EWlanSecurityMode,
|
|
2053 |
ConvertConnectionSecurityModeToSecModeL(
|
|
2054 |
aSecurityMode ) );
|
|
2055 |
// Hidden
|
|
2056 |
SetBoolAttributeL( EWlanScanSSID, hidden );
|
|
2057 |
}
|
|
2058 |
else
|
|
2059 |
#else // __WINS
|
|
2060 |
if ( !retVal )
|
|
2061 |
#endif // __WINS
|
|
2062 |
{
|
|
2063 |
HBufC* stringLabel = StringLoader::LoadLC(
|
|
2064 |
R_INFO_NO_NETWORKS_FOUND );
|
|
2065 |
|
|
2066 |
CAknGlobalNote * note = CAknGlobalNote::NewL();
|
|
2067 |
CleanupStack::PushL(note);
|
|
2068 |
note->ShowNoteL(EAknGlobalInformationNote, *stringLabel);
|
|
2069 |
CleanupStack::PopAndDestroy(note);
|
|
2070 |
CleanupStack::PopAndDestroy( stringLabel );
|
|
2071 |
}
|
|
2072 |
|
|
2073 |
|
|
2074 |
DestroyWaitDialog();
|
|
2075 |
|
|
2076 |
return retVal;
|
|
2077 |
}
|
|
2078 |
|
|
2079 |
|
|
2080 |
// --------------------------------------------------------------------------
|
|
2081 |
// CCmPluginWlan::SelectNWModeL
|
|
2082 |
// --------------------------------------------------------------------------
|
|
2083 |
//
|
|
2084 |
TBool CCmPluginWlan::SelectNWModeL( TWlanNetMode& aNwMode )
|
|
2085 |
{
|
|
2086 |
LOGGER_ENTERFN( "CCmPluginWlan::SelectNWModeL" );
|
|
2087 |
|
|
2088 |
TBool retVal ( EFalse );
|
|
2089 |
|
|
2090 |
// Title
|
|
2091 |
HBufC* title = StringLoader::LoadLC(
|
|
2092 |
R_QTN_NETW_CONSET_PRMPT_WLAN_NW_MODE_AND_STATUS );
|
|
2093 |
TPtr ptrTitle ( title->Des() );
|
|
2094 |
|
|
2095 |
// Items
|
|
2096 |
CDesCArrayFlat* items =
|
|
2097 |
new ( ELeave ) CDesCArrayFlat( KCmArrayMediumGranularity );
|
|
2098 |
CleanupStack::PushL( items );
|
|
2099 |
|
|
2100 |
TInt i = 0;
|
|
2101 |
while ( KWlanNetworkModeConvTable[i].iResId != KEndOfArray )
|
|
2102 |
{
|
|
2103 |
items->AppendL(
|
|
2104 |
*StringLoader::LoadLC( KWlanNetworkModeConvTable[i].iResId ) );
|
|
2105 |
CleanupStack::PopAndDestroy();
|
|
2106 |
i++;
|
|
2107 |
}
|
|
2108 |
|
|
2109 |
// Show the dialog
|
|
2110 |
TInt selection(0);
|
|
2111 |
if ( TCmCommonUi::ShowPopupListL( ptrTitle ,
|
|
2112 |
items,
|
|
2113 |
NULL,
|
|
2114 |
R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT,
|
|
2115 |
selection ) )
|
|
2116 |
{
|
|
2117 |
// result:
|
|
2118 |
i = 0;
|
|
2119 |
|
|
2120 |
aNwMode =
|
|
2121 |
( TWlanNetMode ) KWlanNetworkModeConvTable[selection].iNwMode;
|
|
2122 |
|
|
2123 |
// Network mode
|
|
2124 |
SetIntAttributeL( EWlanConnectionMode, aNwMode );
|
|
2125 |
|
|
2126 |
// Network status
|
|
2127 |
SetBoolAttributeL( EWlanScanSSID,
|
|
2128 |
KWlanNetworkModeConvTable[selection].iHidden );
|
|
2129 |
|
|
2130 |
retVal = ETrue;
|
|
2131 |
}
|
|
2132 |
|
|
2133 |
CleanupStack::Pop( items );
|
|
2134 |
CleanupStack::PopAndDestroy( title );
|
|
2135 |
return retVal;
|
|
2136 |
}
|
|
2137 |
|
|
2138 |
|
|
2139 |
// --------------------------------------------------------------------------
|
|
2140 |
// CCmPluginWlan::ShowNWSecurityDlgL
|
|
2141 |
// --------------------------------------------------------------------------
|
|
2142 |
//
|
|
2143 |
TBool CCmPluginWlan::ShowNWSecurityDlgL( TWlanNetMode aNwMode,
|
|
2144 |
TWlanConnectionExtentedSecurityMode& aSecurityMode )
|
|
2145 |
{
|
|
2146 |
LOGGER_ENTERFN( "CCmPluginWlan::ShowNWSecurityDlgL" );
|
|
2147 |
|
|
2148 |
TBool retVal ( EFalse );
|
|
2149 |
|
|
2150 |
// Collect NW Security Mode items
|
|
2151 |
CDesCArrayFlat* items =
|
|
2152 |
new ( ELeave ) CDesCArrayFlat( KCmArrayMediumGranularity );
|
|
2153 |
|
|
2154 |
TInt i = 0;
|
|
2155 |
while ( KWlanSecurityModeConvTable[i].iResId != KEndOfArray )
|
|
2156 |
{
|
|
2157 |
TWlanSecMode secMode =
|
|
2158 |
( TWlanSecMode ) KWlanSecurityModeConvTable[i].iSecurityMode;
|
|
2159 |
|
|
2160 |
if ( ( secMode == EWlanSecModeOpen || secMode == EWlanSecModeWep )
|
|
2161 |
|| aNwMode == EInfra )
|
|
2162 |
{
|
|
2163 |
items->AppendL( *StringLoader::LoadLC(
|
|
2164 |
KWlanSecurityModeConvTable[i].iResId ) );
|
|
2165 |
CleanupStack::PopAndDestroy();
|
|
2166 |
}
|
|
2167 |
i++;
|
|
2168 |
// don't show WAPI if it's not supported
|
|
2169 |
if ( !iIsWAPISupported )
|
|
2170 |
{
|
|
2171 |
if ( KWlanSecurityModeConvTable[i].iSecurityMode == EWlanSecModeWAPI )
|
|
2172 |
{
|
|
2173 |
break;
|
|
2174 |
}
|
|
2175 |
}
|
|
2176 |
}
|
|
2177 |
|
|
2178 |
// Title
|
|
2179 |
HBufC* title = StringLoader::LoadLC(
|
|
2180 |
R_QTN_NETW_CONSET_PRMPT_WLAN_NW_SECURITY_MODE );
|
|
2181 |
TPtr ptrTitle ( title->Des() );
|
|
2182 |
|
|
2183 |
TInt selection = 0;
|
|
2184 |
|
|
2185 |
// Show the dialog
|
|
2186 |
if ( TCmCommonUi::ShowPopupListL( ptrTitle ,
|
|
2187 |
items,
|
|
2188 |
NULL,
|
|
2189 |
R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT,
|
|
2190 |
selection ) )
|
|
2191 |
{
|
|
2192 |
// result:
|
|
2193 |
aSecurityMode =
|
|
2194 |
ConvertSecModeToConnectionSecurityModeL( ( TWlanSecMode )
|
|
2195 |
KWlanSecurityModeConvTable[selection].iSecurityMode );
|
|
2196 |
SetIntAttributeL( EWlanSecurityMode,
|
|
2197 |
KWlanSecurityModeConvTable[selection].iSecurityMode );
|
|
2198 |
retVal = ETrue;
|
|
2199 |
}
|
|
2200 |
CleanupStack::PopAndDestroy( title );
|
|
2201 |
return retVal;
|
|
2202 |
}
|
|
2203 |
|
|
2204 |
|
|
2205 |
// --------------------------------------------------------------------------
|
|
2206 |
// CCmPluginWlan::EnterWEPKeyL
|
|
2207 |
// --------------------------------------------------------------------------
|
|
2208 |
//
|
|
2209 |
TBool CCmPluginWlan::EnterWEPKeyL()
|
|
2210 |
{
|
|
2211 |
LOGGER_ENTERFN( "CCmPluginWlan::EnterWEPKeyL" );
|
|
2212 |
|
|
2213 |
TBool retVal ( EFalse );
|
|
2214 |
|
|
2215 |
// Security key
|
|
2216 |
HBufC* key = HBufC::NewLC( KWlanMaxKeyLength );
|
|
2217 |
TPtr keyPtr( key->Des() );
|
|
2218 |
TBool wepKeyInAsciiFormat ( EFalse );
|
|
2219 |
|
|
2220 |
if ( !iConnUiUtils )
|
|
2221 |
{
|
|
2222 |
iConnUiUtils = CConnectionUiUtilities::NewL();
|
|
2223 |
}
|
|
2224 |
|
|
2225 |
if ( iConnUiUtils->EasyWepDlg( &keyPtr, wepKeyInAsciiFormat ) )
|
|
2226 |
{
|
|
2227 |
if ( !iWepSecSettings )
|
|
2228 |
{
|
|
2229 |
iWepSecSettings = CWEPSecuritySettings::NewL();
|
|
2230 |
}
|
|
2231 |
iWepSecSettings->SetKeyDataL( 0,
|
|
2232 |
*key,
|
|
2233 |
wepKeyInAsciiFormat );
|
|
2234 |
retVal = ETrue;
|
|
2235 |
}
|
|
2236 |
CleanupStack::PopAndDestroy( key );
|
|
2237 |
return retVal;
|
|
2238 |
}
|
|
2239 |
|
|
2240 |
|
|
2241 |
// --------------------------------------------------------------------------
|
|
2242 |
// CCmPluginWlan::EnterWpaPreSharedKeyL
|
|
2243 |
// --------------------------------------------------------------------------
|
|
2244 |
//
|
|
2245 |
TBool CCmPluginWlan::EnterWpaPreSharedKeyL()
|
|
2246 |
{
|
|
2247 |
LOGGER_ENTERFN( "CCmPluginWlan::EnterWpaPreSharedKeyL" );
|
|
2248 |
|
|
2249 |
TBool retVal ( EFalse );
|
|
2250 |
|
|
2251 |
HBufC* key = HBufC::NewLC( KWlanMaxKeyLength );
|
|
2252 |
TPtr keyPtr( key->Des() );
|
|
2253 |
|
|
2254 |
if ( !iConnUiUtils )
|
|
2255 |
{
|
|
2256 |
iConnUiUtils = CConnectionUiUtilities::NewL();
|
|
2257 |
}
|
|
2258 |
|
|
2259 |
if ( iConnUiUtils->EasyWpaDlg( &keyPtr ) )
|
|
2260 |
{
|
|
2261 |
if ( !iWpaSecSettings )
|
|
2262 |
{
|
|
2263 |
iWpaSecSettings = CWPASecuritySettings::NewL( ESecurityModeWpa );
|
|
2264 |
}
|
|
2265 |
iWpaSecSettings->SetWPAPreSharedKey( *key );
|
|
2266 |
retVal = ETrue;
|
|
2267 |
}
|
|
2268 |
CleanupStack::PopAndDestroy( key );
|
|
2269 |
return retVal;
|
|
2270 |
}
|
|
2271 |
|
|
2272 |
|
|
2273 |
// --------------------------------------------------------------------------
|
|
2274 |
// CCmPluginWlan::SelectWpaModeDialogL
|
|
2275 |
// --------------------------------------------------------------------------
|
|
2276 |
//
|
|
2277 |
TBool CCmPluginWlan::SelectWpaModeDialogL( TWpaMode& aWpaMode )
|
|
2278 |
{
|
|
2279 |
LOGGER_ENTERFN( "CCmPluginWlan::SelectWpaModeDialogL" );
|
|
2280 |
|
|
2281 |
TBool retVal ( EFalse );
|
|
2282 |
|
|
2283 |
// Collect NW Security Mode items
|
|
2284 |
CDesCArrayFlat* items =
|
|
2285 |
new ( ELeave ) CDesCArrayFlat( KCmArrayMediumGranularity );
|
|
2286 |
|
|
2287 |
// Title
|
|
2288 |
HBufC* title =
|
|
2289 |
StringLoader::LoadLC( R_QTN_NETW_CONSET_PRMPT_WLAN_WPA_MODE );
|
|
2290 |
TPtr ptrTitle ( title->Des() );
|
|
2291 |
|
|
2292 |
TInt selection = 0;
|
|
2293 |
|
|
2294 |
// EWpaModeEap
|
|
2295 |
items->AppendL( *StringLoader::LoadLC(
|
|
2296 |
R_QTN_NETW_CONSET_PRMPT_WPA_MODE_EAP ) );
|
|
2297 |
CleanupStack::PopAndDestroy();
|
|
2298 |
|
|
2299 |
// EWpaModePreSharedKey
|
|
2300 |
items->AppendL( *StringLoader::LoadLC(
|
|
2301 |
R_QTN_NETW_CONSET_PRMPT_WPA_MODE_PSK ) );
|
|
2302 |
CleanupStack::PopAndDestroy();
|
|
2303 |
|
|
2304 |
// Show the dialog
|
|
2305 |
if( TCmCommonUi::ShowPopupListL( ptrTitle,
|
|
2306 |
items,
|
|
2307 |
NULL,
|
|
2308 |
R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT,
|
|
2309 |
selection ) )
|
|
2310 |
{
|
|
2311 |
aWpaMode = ( TWpaMode ) selection;
|
|
2312 |
retVal = ETrue;
|
|
2313 |
}
|
|
2314 |
|
|
2315 |
CleanupStack::PopAndDestroy( title );
|
|
2316 |
|
|
2317 |
return retVal;
|
|
2318 |
}
|
|
2319 |
|
|
2320 |
|
|
2321 |
// --------------------------------------------------------------------------
|
|
2322 |
// CCmPluginWlan::UpdateSecurityModeL
|
|
2323 |
// --------------------------------------------------------------------------
|
|
2324 |
//
|
|
2325 |
void CCmPluginWlan::UpdateSecurityModeL( )
|
|
2326 |
{
|
|
2327 |
LOGGER_ENTERFN( "CCmPluginWlan::UpdateSecurityModeL" );
|
|
2328 |
|
|
2329 |
TUint32 secmode = GetIntAttributeL( EWlanSecurityMode );
|
|
2330 |
|
|
2331 |
TUint32 wlaniapid = iIapRecord->iService;
|
|
2332 |
|
|
2333 |
switch ( secmode )
|
|
2334 |
{
|
|
2335 |
case EWlanSecModeOpen:
|
|
2336 |
{
|
|
2337 |
break;
|
|
2338 |
}
|
|
2339 |
case EWlanSecModeWep:
|
|
2340 |
{
|
|
2341 |
if ( iWepSecSettings )
|
|
2342 |
{
|
|
2343 |
delete iWepSecSettings;
|
|
2344 |
iWepSecSettings = NULL;
|
|
2345 |
}
|
|
2346 |
iWepSecSettings = CWEPSecuritySettings::NewL();
|
|
2347 |
iWepSecSettings->LoadL( wlaniapid, Session() );
|
|
2348 |
break;
|
|
2349 |
}
|
|
2350 |
case EWlanSecMode802_1x:
|
|
2351 |
{
|
|
2352 |
if ( iWpaSecSettings )
|
|
2353 |
{
|
|
2354 |
delete iWpaSecSettings;
|
|
2355 |
iWpaSecSettings = NULL;
|
|
2356 |
}
|
|
2357 |
iWpaSecSettings =
|
|
2358 |
CWPASecuritySettings::NewL( ESecurityMode8021x );
|
|
2359 |
iWpaSecSettings->LoadL( wlaniapid, Session() );
|
|
2360 |
break;
|
|
2361 |
}
|
|
2362 |
case EWlanSecModeWpa:
|
|
2363 |
case EWlanSecModeWpa2:
|
|
2364 |
{
|
|
2365 |
if ( iWpaSecSettings )
|
|
2366 |
{
|
|
2367 |
delete iWpaSecSettings;
|
|
2368 |
iWpaSecSettings = NULL;
|
|
2369 |
}
|
|
2370 |
iWpaSecSettings =
|
|
2371 |
CWPASecuritySettings::NewL( ESecurityModeWpa );
|
|
2372 |
iWpaSecSettings->LoadL( wlaniapid, Session() );
|
|
2373 |
break;
|
|
2374 |
}
|
|
2375 |
case EWlanSecModeWAPI:
|
|
2376 |
{
|
|
2377 |
if ( iIsWAPISupported )
|
|
2378 |
{
|
|
2379 |
if ( iWAPISecSettings )
|
|
2380 |
{
|
|
2381 |
delete iWAPISecSettings;
|
|
2382 |
iWAPISecSettings = NULL;
|
|
2383 |
}
|
|
2384 |
iWAPISecSettings = CWAPISecuritySettings::NewL();
|
|
2385 |
if ( iIapRecord->RecordId() )
|
|
2386 |
{
|
|
2387 |
iWAPISecSettings->LoadL( iIapRecord->RecordId(), Session() );
|
|
2388 |
}
|
|
2389 |
}
|
|
2390 |
else
|
|
2391 |
{
|
|
2392 |
User::Leave( KErrCorrupt );
|
|
2393 |
}
|
|
2394 |
break;
|
|
2395 |
}
|
|
2396 |
default:
|
|
2397 |
{
|
|
2398 |
User::Leave( KErrNotSupported );
|
|
2399 |
break;
|
|
2400 |
}
|
|
2401 |
}
|
|
2402 |
}
|
|
2403 |
|
|
2404 |
// --------------------------------------------------------------------------
|
|
2405 |
// CCmPluginWlan::CopyAdditionalDataL
|
|
2406 |
// --------------------------------------------------------------------------
|
|
2407 |
//
|
|
2408 |
void CCmPluginWlan::CopyAdditionalDataL( CCmPluginBaseEng& aDestInst ) const
|
|
2409 |
{
|
|
2410 |
LOGGER_ENTERFN( "CCmPluginWlan::CopyAdditionalDataL" );
|
|
2411 |
|
|
2412 |
STATIC_CAST( CCmPluginWlan*, &aDestInst )->
|
|
2413 |
SetAsCopyOf( iIapRecord->iService );
|
|
2414 |
}
|
|
2415 |
|
|
2416 |
|
|
2417 |
// --------------------------------------------------------------------------
|
|
2418 |
// CCmPluginWlan::SetAsCopyOf
|
|
2419 |
// --------------------------------------------------------------------------
|
|
2420 |
//
|
|
2421 |
void CCmPluginWlan::SetAsCopyOf( TUint32 aBaseIapID )
|
|
2422 |
{
|
|
2423 |
LOGGER_ENTERFN( "CCmPluginWlan::SetAsCopyOf" );
|
|
2424 |
|
|
2425 |
iIsCopy = ETrue;
|
|
2426 |
|
|
2427 |
iCopiedFromIapId = aBaseIapID;
|
|
2428 |
}
|
|
2429 |
|
|
2430 |
// ---------------------------------------------------------
|
|
2431 |
// CCmPluginWlan::DeleteSecuritySettingsL
|
|
2432 |
// ---------------------------------------------------------
|
|
2433 |
//
|
|
2434 |
void CCmPluginWlan::DeleteSecuritySettingsL()
|
|
2435 |
{
|
|
2436 |
LOGGER_ENTERFN( "CCmPluginWlan::DeleteSecuritySettingsL" );
|
|
2437 |
|
|
2438 |
TUint32 wlaniapid = iIapRecord->iService;
|
|
2439 |
|
|
2440 |
// check security mode and existence of sec.settings
|
|
2441 |
if (iWlanServiceRecord->RecordId() )
|
|
2442 |
{// ha sat least WLAN service record, may start to wonder...
|
|
2443 |
// wlan service record will be deleted separatelly!
|
|
2444 |
// get current security mode
|
|
2445 |
TUint32 secmode = iWlanServiceRecord->iWlanSecMode;
|
|
2446 |
|
|
2447 |
switch ( secmode )
|
|
2448 |
{
|
|
2449 |
case EWlanSecModeOpen:
|
|
2450 |
case EWlanSecModeWep:
|
|
2451 |
{
|
|
2452 |
// nothing to do here
|
|
2453 |
break;
|
|
2454 |
}
|
|
2455 |
case EWlanSecMode802_1x:
|
|
2456 |
{
|
|
2457 |
if ( !iWpaSecSettings )
|
|
2458 |
{
|
|
2459 |
iWpaSecSettings =
|
|
2460 |
CWPASecuritySettings::NewL( ESecurityMode8021x );
|
|
2461 |
}
|
|
2462 |
iWpaSecSettings->DeleteL( wlaniapid );
|
|
2463 |
break;
|
|
2464 |
}
|
|
2465 |
case EWlanSecModeWpa:
|
|
2466 |
case EWlanSecModeWpa2:
|
|
2467 |
{
|
|
2468 |
if ( !iWpaSecSettings )
|
|
2469 |
{
|
|
2470 |
iWpaSecSettings =
|
|
2471 |
CWPASecuritySettings::NewL( ESecurityModeWpa );
|
|
2472 |
}
|
|
2473 |
iWpaSecSettings->DeleteL( wlaniapid );
|
|
2474 |
break;
|
|
2475 |
}
|
|
2476 |
case EWlanSecModeWAPI:
|
|
2477 |
if ( iIsWAPISupported )
|
|
2478 |
{
|
|
2479 |
if ( !iWAPISecSettings )
|
|
2480 |
{
|
|
2481 |
iWAPISecSettings = CWAPISecuritySettings::NewL();
|
|
2482 |
}
|
|
2483 |
TUint32 serviceId = iWlanServiceRecord->RecordId();
|
|
2484 |
iWAPISecSettings->DeleteAPSpecificDataL( serviceId );
|
|
2485 |
}
|
|
2486 |
else
|
|
2487 |
{
|
|
2488 |
User::Leave( KErrCorrupt );
|
|
2489 |
}
|
|
2490 |
break;
|
|
2491 |
default:
|
|
2492 |
{
|
|
2493 |
User::Leave( KErrNotSupported );
|
|
2494 |
// do nothing in urel
|
|
2495 |
break;
|
|
2496 |
}
|
|
2497 |
}
|
|
2498 |
}
|
|
2499 |
// if there is no wlan service record,
|
|
2500 |
// then there can be no security settings, skipping...
|
|
2501 |
}
|
|
2502 |
|
|
2503 |
|
|
2504 |
// ---------------------------------------------------------
|
|
2505 |
// CCmPluginWlan::SetDnsIpFromServer
|
|
2506 |
// ---------------------------------------------------------
|
|
2507 |
//
|
|
2508 |
void CCmPluginWlan::SetDnsIpFromServerL()
|
|
2509 |
{
|
|
2510 |
LOGGER_ENTERFN( "CCmPluginWlan::SetDnsIpFromServer" );
|
|
2511 |
|
|
2512 |
HBufC* ip1 = GetStringAttributeL( EWlanIpNameServer1 );
|
|
2513 |
CleanupStack::PushL( ip1 );
|
|
2514 |
|
|
2515 |
HBufC* ip2 = GetStringAttributeL( EWlanIpNameServer2 );
|
|
2516 |
CleanupStack::PushL( ip2 );
|
|
2517 |
|
|
2518 |
|
|
2519 |
if ( ( ip1->Compare( KDynIpAddress ) == 0 ) &&
|
|
2520 |
( ip2->Compare( KDynIpAddress ) == 0 ) )
|
|
2521 |
{
|
|
2522 |
SetBoolAttributeL( EWlanIpDNSAddrFromServer, ETrue );
|
|
2523 |
}
|
|
2524 |
else
|
|
2525 |
{
|
|
2526 |
SetBoolAttributeL( EWlanIpDNSAddrFromServer, EFalse );
|
|
2527 |
}
|
|
2528 |
CleanupStack::PopAndDestroy( 2,ip1 );
|
|
2529 |
}
|
|
2530 |
|
|
2531 |
|
|
2532 |
// ---------------------------------------------------------
|
|
2533 |
// CCmPluginWlan::SetDns6IpFromServer
|
|
2534 |
// ---------------------------------------------------------
|
|
2535 |
//
|
|
2536 |
void CCmPluginWlan::SetDns6IpFromServerL()
|
|
2537 |
{
|
|
2538 |
LOGGER_ENTERFN( "CCmPluginWlan::SetDns6IpFromServer" );
|
|
2539 |
|
|
2540 |
HBufC* ip1 = GetStringAttributeL( EWlanIp6NameServer1 );
|
|
2541 |
CleanupStack::PushL( ip1 );
|
|
2542 |
|
|
2543 |
HBufC* ip2 = GetStringAttributeL( EWlanIp6NameServer2 );
|
|
2544 |
CleanupStack::PushL( ip2 );
|
|
2545 |
|
|
2546 |
if ( ( ip1->Compare( KDynIpv6Address ) == 0 ) &&
|
|
2547 |
( ip2->Compare( KDynIpv6Address ) == 0 ) )
|
|
2548 |
{
|
|
2549 |
SetBoolAttributeL( EWlanIp6DNSAddrFromServer, ETrue );
|
|
2550 |
}
|
|
2551 |
else
|
|
2552 |
{
|
|
2553 |
SetBoolAttributeL( EWlanIp6DNSAddrFromServer, EFalse );
|
|
2554 |
}
|
|
2555 |
CleanupStack::PopAndDestroy( 2,ip1 );
|
|
2556 |
}
|
|
2557 |
|
|
2558 |
|
|
2559 |
// ----------------------------------------------------------------------------
|
|
2560 |
// CCmPluginWlan::CheckNetworkCoverageL()
|
|
2561 |
// ----------------------------------------------------------------------------
|
|
2562 |
//
|
|
2563 |
TInt CCmPluginWlan::CheckNetworkCoverageL() const
|
|
2564 |
{
|
|
2565 |
LOGGER_ENTERFN("CCmPluginWlan::CheckNetworkCoverageL");
|
|
2566 |
|
|
2567 |
TInt retVal( 0 );
|
|
2568 |
|
|
2569 |
#ifdef __WINS__
|
|
2570 |
retVal = 1;
|
|
2571 |
#else
|
|
2572 |
CCmWlanCoverageCheck* coverage = new (ELeave) CCmWlanCoverageCheck;
|
|
2573 |
CleanupStack::PushL( coverage );
|
|
2574 |
|
|
2575 |
CLOG_WRITE( "Coverage created, calling GetCoverageL" );
|
|
2576 |
retVal = coverage->GetCoverageL();
|
|
2577 |
CLOG_WRITE( "GetCoverageL returned" );
|
|
2578 |
|
|
2579 |
CleanupStack::PopAndDestroy( coverage );
|
|
2580 |
#endif // __WINS
|
|
2581 |
return retVal;
|
|
2582 |
}
|
|
2583 |
|
|
2584 |
|
|
2585 |
// ----------------------------------------------------------------------------
|
|
2586 |
// CCmPluginWlan::ConvertConnectionSecurityModeToSecModeL()
|
|
2587 |
// ----------------------------------------------------------------------------
|
|
2588 |
//
|
|
2589 |
TWlanSecMode CCmPluginWlan::ConvertConnectionSecurityModeToSecModeL(
|
|
2590 |
TWlanConnectionExtentedSecurityMode aSecurityMode )
|
|
2591 |
{
|
|
2592 |
LOGGER_ENTERFN( "CCmPluginWlan::ConvertConnectionSecurityModeToSecModeL " );
|
|
2593 |
|
|
2594 |
switch( aSecurityMode )
|
|
2595 |
{
|
|
2596 |
case EWlanConnectionExtentedSecurityModeOpen:
|
|
2597 |
{
|
|
2598 |
return EWlanSecModeOpen;
|
|
2599 |
}
|
|
2600 |
|
|
2601 |
case EWlanConnectionExtentedSecurityModeWepOpen:
|
|
2602 |
case EWlanConnectionExtentedSecurityModeWepShared:
|
|
2603 |
{
|
|
2604 |
return EWlanSecModeWep;
|
|
2605 |
}
|
|
2606 |
|
|
2607 |
case EWlanConnectionExtentedSecurityMode802d1x:
|
|
2608 |
{
|
|
2609 |
return EWlanSecMode802_1x;
|
|
2610 |
}
|
|
2611 |
|
|
2612 |
case EWlanConnectionExtentedSecurityModeWpa:
|
|
2613 |
case EWlanConnectionExtentedSecurityModeWpaPsk:
|
|
2614 |
case EWlanConnectionExtentedSecurityModeWpa2:
|
|
2615 |
case EWlanConnectionExtentedSecurityModeWpa2Psk:
|
|
2616 |
{
|
|
2617 |
return EWlanSecModeWpa;
|
|
2618 |
}
|
|
2619 |
case EWlanConnectionExtentedSecurityModeWapi:
|
|
2620 |
case EWlanConnectionExtentedSecurityModeWapiPsk:
|
|
2621 |
{
|
|
2622 |
if ( iIsWAPISupported )
|
|
2623 |
{
|
|
2624 |
return EWlanSecModeWAPI;
|
|
2625 |
}
|
|
2626 |
else
|
|
2627 |
{
|
|
2628 |
User::Leave( KErrCorrupt );
|
|
2629 |
}
|
|
2630 |
}
|
|
2631 |
default:
|
|
2632 |
{
|
|
2633 |
User::Leave( KErrNotSupported );
|
|
2634 |
}
|
|
2635 |
}
|
|
2636 |
|
|
2637 |
return EWlanSecModeOpen;
|
|
2638 |
}
|
|
2639 |
|
|
2640 |
|
|
2641 |
// ----------------------------------------------------------------------------
|
|
2642 |
// CCmPluginWlan::ConvertSecModeToConnectionSecurityModeL()
|
|
2643 |
// ----------------------------------------------------------------------------
|
|
2644 |
//
|
|
2645 |
TWlanConnectionExtentedSecurityMode
|
|
2646 |
CCmPluginWlan::ConvertSecModeToConnectionSecurityModeL(
|
|
2647 |
TWlanSecMode aSecMode )
|
|
2648 |
{
|
|
2649 |
LOGGER_ENTERFN( "CCmPluginWlan::ConvertSecModeToConnectionSecurityModeL " );
|
|
2650 |
|
|
2651 |
switch( aSecMode )
|
|
2652 |
{
|
|
2653 |
case EWlanSecModeOpen:
|
|
2654 |
{
|
|
2655 |
return EWlanConnectionExtentedSecurityModeOpen;
|
|
2656 |
}
|
|
2657 |
|
|
2658 |
case EWlanSecModeWep:
|
|
2659 |
{
|
|
2660 |
return EWlanConnectionExtentedSecurityModeWepOpen;
|
|
2661 |
}
|
|
2662 |
|
|
2663 |
case EWlanSecMode802_1x:
|
|
2664 |
{
|
|
2665 |
return EWlanConnectionExtentedSecurityMode802d1x;
|
|
2666 |
}
|
|
2667 |
|
|
2668 |
case EWlanSecModeWpa:
|
|
2669 |
case EWlanSecModeWpa2:
|
|
2670 |
{
|
|
2671 |
return EWlanConnectionExtentedSecurityModeWpa;
|
|
2672 |
}
|
|
2673 |
case EWlanSecModeWAPI:
|
|
2674 |
{
|
|
2675 |
if ( iIsWAPISupported )
|
|
2676 |
{
|
|
2677 |
return EWlanConnectionExtentedSecurityModeWapi;
|
|
2678 |
}
|
|
2679 |
else
|
|
2680 |
{
|
|
2681 |
User::Leave( KErrCorrupt );
|
|
2682 |
}
|
|
2683 |
}
|
|
2684 |
|
|
2685 |
default:
|
|
2686 |
{
|
|
2687 |
User::Leave( KErrNotSupported );
|
|
2688 |
}
|
|
2689 |
}
|
|
2690 |
|
|
2691 |
return EWlanConnectionExtentedSecurityModeOpen;
|
|
2692 |
}
|
|
2693 |
|
|
2694 |
|
|
2695 |
// ---------------------------------------------------------
|
|
2696 |
// CCmPluginWlan::DestroyWaitDialog()
|
|
2697 |
// ---------------------------------------------------------
|
|
2698 |
//
|
|
2699 |
void CCmPluginWlan::DestroyWaitDialog()
|
|
2700 |
{
|
|
2701 |
LOGGER_ENTERFN( "CCmPluginWlan::DestroyWaitDialog " );
|
|
2702 |
|
|
2703 |
delete iWaitDialog;
|
|
2704 |
iWaitDialog = NULL;
|
|
2705 |
}
|
|
2706 |
|
|
2707 |
// ---------------------------------------------------------------------------
|
|
2708 |
// CCmPluginWlan::SetDaemonNameL
|
|
2709 |
// ---------------------------------------------------------------------------
|
|
2710 |
//
|
|
2711 |
void CCmPluginWlan::SetDaemonNameL()
|
|
2712 |
{
|
|
2713 |
LOGGER_ENTERFN( "CCmPluginWlan::SetDaemonNameL" );
|
|
2714 |
|
|
2715 |
// we have to check first that these values has not been
|
|
2716 |
// set(or changed) by any 3rd party sw to ensure that
|
|
2717 |
// we don't break their settings
|
|
2718 |
HBufC* daemonName = GetStringAttributeL( ECmConfigDaemonManagerName );
|
|
2719 |
if ( daemonName )
|
|
2720 |
{
|
|
2721 |
if ( daemonName->Compare( KDaemonManagerName ) != 0 )
|
|
2722 |
{
|
|
2723 |
delete daemonName;
|
|
2724 |
return;
|
|
2725 |
}
|
|
2726 |
delete daemonName;
|
|
2727 |
}
|
|
2728 |
|
|
2729 |
// check if Easy WLAN IAP since it has different config daemon
|
|
2730 |
// manager name
|
|
2731 |
HBufC* iapName = GetStringAttributeL( ECmName );
|
|
2732 |
if ( iapName )
|
|
2733 |
{
|
|
2734 |
CleanupStack::PushL( iapName );
|
|
2735 |
if ( iapName->Compare( KEasyWlanName ) == 0 )
|
|
2736 |
{
|
|
2737 |
SetStringAttributeL( ECmConfigDaemonManagerName,
|
|
2738 |
KHotspotDaemonManagerName );
|
|
2739 |
SetStringAttributeL( ECmConfigDaemonName,
|
|
2740 |
KConfigDaemonName );
|
|
2741 |
CleanupStack::PopAndDestroy( iapName );
|
|
2742 |
return;
|
|
2743 |
}
|
|
2744 |
CleanupStack::PopAndDestroy( iapName );
|
|
2745 |
}
|
|
2746 |
|
|
2747 |
// use DHCP if we can
|
|
2748 |
TBool ipfromSrv = GetBoolAttributeL( ECmIPAddFromServer );
|
|
2749 |
if ( ipfromSrv )
|
|
2750 |
{
|
|
2751 |
SetStringAttributeL( ECmConfigDaemonManagerName,
|
|
2752 |
KDaemonManagerName );
|
|
2753 |
SetStringAttributeL( ECmConfigDaemonName,
|
|
2754 |
KConfigDaemonName );
|
|
2755 |
}
|
|
2756 |
else
|
|
2757 |
{
|
|
2758 |
if ( FeatureSupported( KFeatureIdIPv6 ) )
|
|
2759 |
{
|
|
2760 |
SetStringAttributeL( ECmConfigDaemonManagerName,
|
|
2761 |
KDaemonManagerName );
|
|
2762 |
SetStringAttributeL( ECmConfigDaemonName,
|
|
2763 |
KConfigDaemonName );
|
|
2764 |
}
|
|
2765 |
else
|
|
2766 |
{
|
|
2767 |
SetStringAttributeL( ECmConfigDaemonManagerName,
|
|
2768 |
KNullDesC() );
|
|
2769 |
SetStringAttributeL( ECmConfigDaemonName,
|
|
2770 |
KNullDesC() );
|
|
2771 |
}
|
|
2772 |
}
|
|
2773 |
}
|
|
2774 |
|
|
2775 |
|
|
2776 |
// --------------------------------------------------------------------------
|
|
2777 |
// CCmPluginWlan::ConvertWLANConnectionStatesL
|
|
2778 |
// --------------------------------------------------------------------------
|
|
2779 |
//
|
|
2780 |
TWlanNetMode CCmPluginWlan::ConvertWLANConnectionStatesL(
|
|
2781 |
TWlanConnectionMode aConnectionMode )
|
|
2782 |
{
|
|
2783 |
LOGGER_ENTERFN( "CCmPluginWlan::ConvertWLANConnectionStatesL " );
|
|
2784 |
|
|
2785 |
switch ( aConnectionMode )
|
|
2786 |
{
|
|
2787 |
/** Values for possible WLAN connection states. */
|
|
2788 |
/** Connection to an infrastructure network is active. */
|
|
2789 |
case EWlanConnectionModeInfrastructure:
|
|
2790 |
{
|
|
2791 |
return EInfra;
|
|
2792 |
}
|
|
2793 |
/** Connection to an ad-hoc network is active. */
|
|
2794 |
case EWlanConnectionModeAdhoc:
|
|
2795 |
{
|
|
2796 |
return EAdhoc;
|
|
2797 |
}
|
|
2798 |
default:
|
|
2799 |
/**
|
|
2800 |
* The connection mode. This can be either Ad-hoc or infrastructure.
|
|
2801 |
* TWlanNetMode enum is to be used.
|
|
2802 |
* ( TUint32 - default: EInfra )
|
|
2803 |
*/
|
|
2804 |
{
|
|
2805 |
return EInfra;
|
|
2806 |
}
|
|
2807 |
}
|
|
2808 |
}
|
|
2809 |
|
|
2810 |
// ---------------------------------------------------------------------------
|
|
2811 |
// CCmPluginWlan::GetAdditionalUids
|
|
2812 |
// ---------------------------------------------------------------------------
|
|
2813 |
//
|
|
2814 |
void CCmPluginWlan::GetAdditionalUids( RArray<TUint32>& aIapIds )
|
|
2815 |
{
|
|
2816 |
for (TInt i = 0; i<iAdditionalCmsCreated.Count(); i++ )
|
|
2817 |
{
|
|
2818 |
aIapIds.Append(iAdditionalCmsCreated[i]);
|
|
2819 |
}
|
|
2820 |
}
|
|
2821 |
|
|
2822 |
// --------------------------------------------------------------------------
|
|
2823 |
// CCmPluginWlan::EnterWAPIPreSharedKeyL
|
|
2824 |
// --------------------------------------------------------------------------
|
|
2825 |
//
|
|
2826 |
TBool CCmPluginWlan::EnterWAPIPreSharedKeyL()
|
|
2827 |
{
|
|
2828 |
LOGGER_ENTERFN( "CCmPluginWlan::EnterWAPIPreSharedKeyL" );
|
|
2829 |
|
|
2830 |
TBool retVal ( EFalse );
|
|
2831 |
|
|
2832 |
HBufC* key = HBufC::NewLC( KWlanMaxKeyLength );
|
|
2833 |
TPtr keyPtr( key->Des() );
|
|
2834 |
|
|
2835 |
if ( !iConnUiUtils )
|
|
2836 |
{
|
|
2837 |
iConnUiUtils = CConnectionUiUtilities::NewL();
|
|
2838 |
}
|
|
2839 |
|
|
2840 |
if ( iConnUiUtils->EasyWapiDlg( &keyPtr ) )
|
|
2841 |
{
|
|
2842 |
if ( !iWAPISecSettings )
|
|
2843 |
{
|
|
2844 |
iWAPISecSettings = CWAPISecuritySettings::NewL();
|
|
2845 |
}
|
|
2846 |
iWAPISecSettings->SetPreSharedKeyL( CWAPISecuritySettings::EWapiKeyAscii, *key );
|
|
2847 |
retVal = ETrue;
|
|
2848 |
}
|
|
2849 |
CleanupStack::PopAndDestroy( key );
|
|
2850 |
|
|
2851 |
return retVal;
|
|
2852 |
}
|
|
2853 |
|