129 User::LeaveIfError( ret ); |
129 User::LeaveIfError( ret ); |
130 } |
130 } |
131 User::LeaveIfError( iPsOnOffState.Attach( KPSUidWlan, |
131 User::LeaveIfError( iPsOnOffState.Attach( KPSUidWlan, |
132 KPSWlanOnOffState, EOwnerThread ) ); |
132 KPSWlanOnOffState, EOwnerThread ) ); |
133 |
133 |
|
134 // Publish initial value for WLAN on/off as WLAN OFF |
|
135 PublishWlanOnOff( EPSWlanOff ); |
134 } |
136 } |
135 |
137 |
136 // --------------------------------------------------------- |
138 // --------------------------------------------------------- |
137 // CWlmPlatformData::NewL |
139 // CWlmPlatformData::NewL |
138 // --------------------------------------------------------- |
140 // --------------------------------------------------------- |
158 RProperty::Delete( KPSUidWlan, KPSWlanIndicator ); |
160 RProperty::Delete( KPSUidWlan, KPSWlanIndicator ); |
159 iPsMacAddress.Close(); |
161 iPsMacAddress.Close(); |
160 RProperty::Delete( KPSUidWlan, KPSWlanMacAddress ); |
162 RProperty::Delete( KPSUidWlan, KPSWlanMacAddress ); |
161 iPsBgScanInterval.Close(); |
163 iPsBgScanInterval.Close(); |
162 RProperty::Delete( KPSUidWlan, KPSWlanBgScanInterval ); |
164 RProperty::Delete( KPSUidWlan, KPSWlanBgScanInterval ); |
|
165 iPsOnOffState.Close(); |
|
166 RProperty::Delete( KPSUidWlan, KPSWlanOnOffState ); |
163 delete iPropertySystemState; |
167 delete iPropertySystemState; |
164 delete iBtConnections; |
168 delete iBtConnections; |
165 delete iEmergencyCall; |
169 delete iEmergencyCall; |
166 delete iWlanOnOff; |
170 delete iWlanOnOff; |
167 delete iWlanForceDisable; |
171 delete iWlanForceDisable; |
489 // Status : Draft |
493 // Status : Draft |
490 // --------------------------------------------------------- |
494 // --------------------------------------------------------- |
491 // |
495 // |
492 void CWlmPlatformData::NotifyWlanOnOffObserver() |
496 void CWlmPlatformData::NotifyWlanOnOffObserver() |
493 { |
497 { |
494 DEBUG( "CWlmPlatformData::NotifyWlanOnOffObserver()" ); |
498 DEBUG1( "CWlmPlatformData::NotifyWlanOnOffObserver() - last notified state=%d", |
495 |
499 iNotifiedWlanState ); |
496 // Read WLAN master switch |
|
497 TInt wlanOn( EFalse ); |
|
498 iWlanOnOff->Get( wlanOn ); |
|
499 |
|
500 // Read WLAN force disable switch |
|
501 TInt wlanForceDisable( EFalse ); |
|
502 iWlanForceDisable->Get( wlanForceDisable ); |
|
503 |
|
504 DEBUG3( " WlanOnOff: %d, WlanForceDisable: %d, NotifiedToObserver: %d", |
|
505 wlanOn, wlanForceDisable, iNotifiedWlanState ); |
|
506 |
500 |
507 // Note that the observer is only notified if the |
501 // Note that the observer is only notified if the |
508 // state really changes |
502 // state really changes |
509 |
503 |
510 // If WLAN is set ON and it is not forcibly disabled |
504 // If WLAN is set ON |
511 if( wlanOn && // WLAN set ON |
505 if( GetWlanOnOffState() == EWlanOn && // WLAN set ON |
512 wlanForceDisable == EFalse && // WLAN force disable not set |
|
513 iNotifiedWlanState != CWlmPlatformData::EWlanNotifiedOn ) // WLAN ON not notified yet |
506 iNotifiedWlanState != CWlmPlatformData::EWlanNotifiedOn ) // WLAN ON not notified yet |
514 { |
507 { |
515 // Notify observer that WLAN is set ON |
508 // Notify observer that WLAN is set ON |
516 iCallback.WlanOn(); |
509 iCallback.WlanOn(); |
517 iNotifiedWlanState = CWlmPlatformData::EWlanNotifiedOn; |
510 iNotifiedWlanState = CWlmPlatformData::EWlanNotifiedOn; |
518 (void)PublishWlanOnOff( EPSWlanOn ); |
511 PublishWlanOnOff( EPSWlanOn ); |
519 // Note! P&S write operation return value is not checked |
512 // Note! P&S write operation return value is not checked |
520 DEBUG( "CWlmPlatformData::NotifyWlanOnOffObserver() - WLAN ON notified, P&S updated" ); |
513 DEBUG( "CWlmPlatformData::NotifyWlanOnOffObserver() - WLAN ON notified, P&S updated" ); |
521 } |
514 } |
522 // WLAN is set OFF |
515 // WLAN is set OFF |
523 else if( iNotifiedWlanState != CWlmPlatformData::EWlanNotifiedOff ) // WLAN OFF not notified yet |
516 else if( iNotifiedWlanState != CWlmPlatformData::EWlanNotifiedOff ) // WLAN OFF not notified yet |
524 { |
517 { |
525 // Notify observer that WLAN is set OFF |
518 // Notify observer that WLAN is set OFF |
526 iCallback.WlanOff(); |
519 iCallback.WlanOff(); |
527 iNotifiedWlanState = CWlmPlatformData::EWlanNotifiedOff; |
520 iNotifiedWlanState = CWlmPlatformData::EWlanNotifiedOff; |
528 (void)PublishWlanOnOff( EPSWlanOff ); |
521 PublishWlanOnOff( EPSWlanOff ); |
529 // Note! P&S write operation return value is not checked |
522 // Note! P&S write operation return value is not checked |
530 DEBUG( "CWlmPlatformData::NotifyWlanOnOffObserver() - WLAN OFF notified, P&S updated" ); |
523 DEBUG( "CWlmPlatformData::NotifyWlanOnOffObserver() - WLAN OFF notified, P&S updated" ); |
531 } |
524 } |
532 } |
525 } |
533 |
526 |
534 // --------------------------------------------------------- |
527 // --------------------------------------------------------- |
535 // CWlmPlatformData::PublishWlanOnOff |
528 // CWlmPlatformData::PublishWlanOnOff |
536 // Status : Draft |
529 // Status : Draft |
537 // --------------------------------------------------------- |
530 // --------------------------------------------------------- |
538 // |
531 // |
539 TInt CWlmPlatformData::PublishWlanOnOff( TPSWlanOnOff aWlanState ) |
532 void CWlmPlatformData::PublishWlanOnOff( TPSWlanOnOff aWlanState ) |
540 { |
533 { |
541 DEBUG1( "CWlmPlatformData::PublishWlanOnOff( wlanState = %d )", |
534 DEBUG1( "CWlmPlatformData::PublishWlanOnOff( wlanState = %d )", |
542 aWlanState ); |
535 aWlanState ); |
543 |
536 |
544 return iPsOnOffState.Set( aWlanState ); |
537 TInt err( KErrNone ); |
545 } |
538 err = iPsOnOffState.Set( aWlanState ); |
|
539 |
|
540 if( err != KErrNone ) |
|
541 { |
|
542 DEBUG1( "CWlmPlatformData::PublishWlanOnOff() - ERROR: update failed, err=%d", |
|
543 err ); |
|
544 } |
|
545 } |