diff -r de27cc8389dd -r 301aeb18ae47 hotspotfw/hsclient/src/hssiaphandler.cpp --- a/hotspotfw/hsclient/src/hssiaphandler.cpp Thu Sep 02 21:36:44 2010 +0300 +++ b/hotspotfw/hsclient/src/hssiaphandler.cpp Fri Sep 17 08:35:49 2010 +0300 @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -109,14 +110,26 @@ if ( aSettings.Name.Length() > 0 ) { - plugin.SetStringAttributeL( ECmName, aSettings.Name ); - plugin.UpdateL(); + plugin.SetStringAttributeL( CMManager::ECmName, aSettings.Name ); + } + + if ( aSettings.iSSID.Length() > 0 ) + { + plugin.SetStringAttributeL( CMManager::EWlanSSID, aSettings.iSSID ); } + + plugin.SetIntAttributeL( CMManager::EWlanConnectionMode, + aSettings.iConnectionMode ); + plugin.SetIntAttributeL( CMManager::EWlanChannelID, 0 ); + plugin.SetIntAttributeL( CMManager::EWlanSecurityMode, + aSettings.iSecurityMode ); + + plugin.UpdateL(); CleanupStack::PopAndDestroy( &plugin ); CleanupStack::PopAndDestroy( &cmManager ); // CommsDat section starts - CMDBSession* dbSession = CMDBSession::NewL(CMDBSession::LatestVersion()); + CMDBSession* dbSession = CMDBSession::NewL( CMDBSession::LatestVersion() ); CleanupStack::PushL( dbSession ); iWLANRecord = static_cast ( CCDRecordBase::RecordFactoryL( 0 ) ); @@ -124,37 +137,8 @@ iWLANRecord->InitializeL( KGenericTable(),NULL ); iWLANRecord->SetRecordId( serviceId ); iWLANRecord->LoadL( *dbSession ); - - // Set Network Name - if ( aSettings.iSSID.Length() > 0 ) - { - CMDBField* textField = - (CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanSSID ); - textField->SetMaxLengthL( aSettings.iSSID.Length() ); - textField->SetL( aSettings.iSSID ); - } - // Set Connection Mode - *((CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanConnMode)) = - aSettings.iConnectionMode; - - // Set Channel Id. - *((CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanChannelID )) = 0; - - // Set Security Mode - *((CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanSecMode )) = - aSettings.iSecurityMode; - - // Check if THssIapSettings is created wrong (dynamically). - // -> Then default value is not set to security mode and it will be huge. - // -> Destination can become unusable. - TInt secMode = aSettings.iSecurityMode; - if ( secMode > EHssWpa2Only ) - { - secMode = EHssAllowUnsecure; - } - - if( secMode == EHssWep ) + if( aSettings.iSecurityMode == EHssWep ) { DEBUG("CHssIapHandler::ChangeSettingsL -> SecurityMode == EHssWep"); *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanAuthMode)) = aSettings.iAuthenticationMode; @@ -167,7 +151,7 @@ *((CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanFormatKey3 )) = aSettings.iWepKeyFormat[2]; *((CMDBField*)iWLANRecord->GetFieldByIdL( KCDTIdWlanFormatKey4 )) = aSettings.iWepKeyFormat[3]; } - else if( secMode > EHssWep ) + else if( aSettings.iSecurityMode > EHssWep ) { DEBUG("CHssIapHandler::ChangeSettingsL -> SecurityMode > EHssWep"); if ( aSettings.iEnableWpaPsk ) // Use PreSharedKey @@ -188,12 +172,13 @@ *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanWpaKeyLength)) = aSettings.iWPAKeyLength; *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.iEnableWpaPsk; } - else // Use EAP. EAP settings can be set with EAP API. + else // Use EAP. EAP settings can be set using EAP API. { DEBUG("CHssIapHandler::ChangeSettingsL -> SecurityMode > EHssWep -> EAP"); *((CMDBField*)iWLANRecord->GetFieldByIdL(KCDTIdWlanEnableWpaPsk)) = aSettings.iEnableWpaPsk; } } + // Update access point, be prepared that Commsdat might be locked TInt errCode( KErrLocked ); TInt retryCount( 0 );