2394 tmp.count ); |
2394 tmp.count ); |
2395 |
2395 |
2396 if( IsSessionActive( completedMapEntry ) ) |
2396 if( IsSessionActive( completedMapEntry ) ) |
2397 { |
2397 { |
2398 TPckg<TWlmProtectedSetupCredentials> outPckg( tmp ); |
2398 TPckg<TWlmProtectedSetupCredentials> outPckg( tmp ); |
2399 completedMapEntry.iMessage.Write( 1, outPckg ); |
2399 completedMapEntry.iMessage.Write( 2, outPckg ); |
2400 } |
2400 } |
2401 |
2401 |
2402 if( status == core_error_ok && IsSessionActive( completedMapEntry ) ) |
2402 if( status == core_error_ok && IsSessionActive( completedMapEntry ) ) |
2403 { |
2403 { |
2404 DEBUG2("PROTECTED SETUP COMPLETED WITH status == %u -> adapt == %d", |
2404 DEBUG2("PROTECTED SETUP COMPLETED WITH status == %u -> adapt == %d", |
4392 wlanState ); |
4392 wlanState ); |
4393 // WLAN states map one to one to WLAN error codes. |
4393 // WLAN states map one to one to WLAN error codes. |
4394 aMessage.Complete( wlanState ); |
4394 aMessage.Complete( wlanState ); |
4395 return; |
4395 return; |
4396 } |
4396 } |
4397 |
4397 |
4398 // Get WlanSettings and secondarySSID list |
4398 TPckgBuf<TWlanSsid> ssidPckg; |
4399 // (lanServiceId specifies the table row in wlansettings) |
4399 TInt ret( aMessage.Read( 0, ssidPckg ) ); |
4400 SWLANSettings iapData; |
4400 if( ret != KErrNone ) |
4401 RArray<TWlanSecondarySsid> secondarySsidList; |
4401 { |
4402 TInt lanServiceId = aMessage.Int0(); |
4402 aMessage.Complete( ret ); |
4403 TRAPD( err, GetIapSettingsL( lanServiceId, iapData, secondarySsidList ) ) ; |
|
4404 if( err != KErrNone ) |
|
4405 { |
|
4406 DEBUG1( "CWlmServer::RunProtectedSetup() - GetIapSettingsL leaved with %d", |
|
4407 err ); |
|
4408 secondarySsidList.Close(); |
|
4409 aMessage.Complete( err ); |
|
4410 return; |
4403 return; |
4411 } |
4404 } |
4412 secondarySsidList.Close(); |
4405 |
4413 |
4406 TPckgBuf<TWlanWpsPin> wpsPinPckg; |
4414 // Type conversion |
4407 ret = aMessage.Read( 1, wpsPinPckg ); |
|
4408 if( ret != KErrNone ) |
|
4409 { |
|
4410 aMessage.Complete( ret ); |
|
4411 return; |
|
4412 } |
|
4413 |
4415 core_iap_data_s* coreIapData = new core_iap_data_s; |
4414 core_iap_data_s* coreIapData = new core_iap_data_s; |
4416 if( !coreIapData ) |
4415 if( !coreIapData ) |
4417 { |
4416 { |
4418 aMessage.Complete( KErrNoMemory ); |
4417 aMessage.Complete( KErrNoMemory ); |
4419 return; |
4418 return; |
4420 } |
4419 } |
4421 |
4420 |
4422 TWLMOverrideSettings override = { 0 }; |
4421 coreIapData->id = 0; |
4423 TWlanConversionUtil::ConvertIapSettings( |
4422 coreIapData->op_mode = core_operating_mode_infrastructure; |
4424 *coreIapData, |
4423 coreIapData->security_mode = core_security_mode_protected_setup; |
4425 iapData, |
4424 coreIapData->wpa_preshared_key_in_use = ETrue; |
4426 ETrue, // dhcp usage is not important here |
4425 coreIapData->is_wpa_overriden = ETrue; |
4427 override ); |
4426 |
4428 |
4427 // Type conversion |
4429 |
4428 TWlanConversionUtil::ConvertSSID( |
4430 // Create a list for the results. |
4429 coreIapData->ssid, |
|
4430 ssidPckg() ); |
|
4431 |
|
4432 // Type conversion |
|
4433 TWlanConversionUtil::ConvertWpaPreSharedKey( |
|
4434 coreIapData->wpa_preshared_key, |
|
4435 wpsPinPckg() ); |
|
4436 |
|
4437 // Create a list for the results. |
4431 core_type_list_c<core_iap_data_s>* iapDataList = new core_type_list_c<core_iap_data_s>; |
4438 core_type_list_c<core_iap_data_s>* iapDataList = new core_type_list_c<core_iap_data_s>; |
4432 if( iapDataList == NULL ) |
4439 if( iapDataList == NULL ) |
4433 { |
4440 { |
4434 DEBUG( "CWlmServer::RunProtectedSetup() - unable to create iapDataList" ); |
4441 DEBUG( "CWlmServer::RunProtectedSetup() - unable to create iapDataList" ); |
4435 delete coreIapData; |
4442 delete coreIapData; |