20 #include "ctelerecoverysystem.h" |
20 #include "ctelerecoverysystem.h" |
21 #include <e32svr.h> |
21 #include <e32svr.h> |
22 #include <startupdomainpskeys.h> |
22 #include <startupdomainpskeys.h> |
23 |
23 |
24 #include "phonelogger.h" |
24 #include "phonelogger.h" |
25 #include "phoneui.pan" |
25 #include "phoneui.pan" |
26 #include "cphonetimer.h" |
26 #include "cphonetimer.h" |
27 #include "ctelewaitingidle.h" |
27 #include "ctelewaitingidle.h" |
28 |
28 |
29 |
29 |
30 // CONSTANTS |
30 // CONSTANTS |
152 // |
152 // |
153 TPhoneRecoveryId CTeleRecoverySystem::AddL( TCallBack aCallBack, |
153 TPhoneRecoveryId CTeleRecoverySystem::AddL( TCallBack aCallBack, |
154 TPhoneRecoveryPriority aPriority, TRecoveryState aState ) |
154 TPhoneRecoveryPriority aPriority, TRecoveryState aState ) |
155 { |
155 { |
156 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::AddL()" ); |
156 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::AddL()" ); |
157 __ASSERT_DEBUG( !iIsCallBack, Panic( EPhoneUtilsNoCallBack ) ); |
157 __ASSERT_DEBUG( !iIsCallBack, Panic( EPhoneUtilsNoCallBack ) ); |
158 |
158 |
159 CheckStateForPrecondition( aState ); |
159 CheckStateForPrecondition( aState ); |
160 |
160 |
161 iIdCounter++; |
161 iIdCounter++; |
162 TInt count = iRecoveryItems->Count(); |
162 TInt count = iRecoveryItems->Count(); |
190 // ----------------------------------------------------------------------------- |
190 // ----------------------------------------------------------------------------- |
191 // |
191 // |
192 TPhoneRecoveryId CTeleRecoverySystem::Add( TCallBack aCallBack, |
192 TPhoneRecoveryId CTeleRecoverySystem::Add( TCallBack aCallBack, |
193 TPhoneRecoveryPriority aPriority, TRecoveryState aState ) |
193 TPhoneRecoveryPriority aPriority, TRecoveryState aState ) |
194 { |
194 { |
195 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::AddL()" ); |
195 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::AddL()" ); |
196 TPhoneRecoveryId id = KNullId; |
196 TPhoneRecoveryId id = KNullId; |
197 TRAP_IGNORE( id = AddL( aCallBack, aPriority, aState ) ); |
197 TRAP_IGNORE( id = AddL( aCallBack, aPriority, aState ) ); |
198 return id; |
198 return id; |
199 } |
199 } |
200 |
200 |
202 // CTeleRecoverySystem::Remove |
202 // CTeleRecoverySystem::Remove |
203 // ----------------------------------------------------------------------------- |
203 // ----------------------------------------------------------------------------- |
204 // |
204 // |
205 void CTeleRecoverySystem::Remove( TPhoneRecoveryId aId ) |
205 void CTeleRecoverySystem::Remove( TPhoneRecoveryId aId ) |
206 { |
206 { |
207 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::Remove()" ); |
207 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::Remove()" ); |
208 __ASSERT_DEBUG( !iIsCallBack, Panic( EPhoneUtilsNoCallBack ) ); |
208 __ASSERT_DEBUG( !iIsCallBack, Panic( EPhoneUtilsNoCallBack ) ); |
209 |
209 |
210 TInt count = iRecoveryItems->Count(); |
210 TInt count = iRecoveryItems->Count(); |
211 |
211 |
212 __PHONELOG1( |
212 __PHONELOG1( |
213 EBasic, |
213 EBasic, |
244 TRecoveryItem& item = iRecoveryItems->At( i ); |
244 TRecoveryItem& item = iRecoveryItems->At( i ); |
245 if( item.iId == aId ) |
245 if( item.iId == aId ) |
246 { |
246 { |
247 item.iState = aState; |
247 item.iState = aState; |
248 StartTimerIfRequired( aState ); |
248 StartTimerIfRequired( aState ); |
249 __PHONELOG1( |
249 __PHONELOG1( |
250 EBasic, |
250 EBasic, |
251 EPhoneUIUtils, |
251 EPhoneUIUtils, |
252 "CTeleRecoverySystem::SetState itemIdx= %d:", item.iId ); |
252 "CTeleRecoverySystem::SetState itemIdx= %d:", item.iId ); |
253 return; |
253 return; |
254 } |
254 } |
255 } |
255 } |
256 } |
256 } |
257 |
257 |
317 // CTeleRecoverySystem::RecoverAllNow |
317 // CTeleRecoverySystem::RecoverAllNow |
318 // |
318 // |
319 // ----------------------------------------------------------------------------- |
319 // ----------------------------------------------------------------------------- |
320 // |
320 // |
321 void CTeleRecoverySystem::RecoverAllNow() |
321 void CTeleRecoverySystem::RecoverAllNow() |
322 { |
322 { |
323 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::RecoverAllNow()" ); |
323 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::RecoverAllNow()" ); |
324 StartTimerIfIdle(); |
324 StartTimerIfIdle(); |
325 StartAllStepsTimer(); |
325 StartAllStepsTimer(); |
326 } |
326 } |
327 |
327 |
328 // ----------------------------------------------------------------------------- |
328 // ----------------------------------------------------------------------------- |
329 // CTeleRecoverySystem::EnablePrecondition |
329 // CTeleRecoverySystem::EnablePrecondition |
330 // |
330 // |
331 // ----------------------------------------------------------------------------- |
331 // ----------------------------------------------------------------------------- |
386 { |
386 { |
387 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::RunL()" ); |
387 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::RunL()" ); |
388 if ( iStatus != KErrNone ) |
388 if ( iStatus != KErrNone ) |
389 { |
389 { |
390 // If SIM is already available, just listen for SIM status. |
390 // If SIM is already available, just listen for SIM status. |
391 if ( iSimAvailable == ESimUsable ) |
391 if ( iSimAvailable == ESimUsable ) |
392 { |
392 { |
393 iRequest = EPhoneSIMStatus; |
393 iRequest = EPhoneSIMStatus; |
394 } |
394 } |
395 else |
395 else |
396 { |
396 { |
397 iRequest = EPhoneSIMPresent; |
397 iRequest = EPhoneSIMPresent; |
398 } |
398 } |
399 |
399 |
400 __PHONELOG1( |
400 __PHONELOG1( |
401 EBasic, |
401 EBasic, |
402 EPhoneUIUtils, |
402 EPhoneUIUtils, |
403 "CTeleRecoverySystem::RunL NewRq = %d ", (TInt) iRequest ); |
403 "CTeleRecoverySystem::RunL NewRq = %d ", (TInt) iRequest ); |
404 |
404 |
405 IssueRequest(); |
405 IssueRequest(); |
406 return; |
406 return; |
407 } |
407 } |
408 |
408 |
416 |
416 |
417 if ( iSimAvailable == ESimUsable ) |
417 if ( iSimAvailable == ESimUsable ) |
418 { |
418 { |
419 iRequest = EPhoneSIMStatus; |
419 iRequest = EPhoneSIMStatus; |
420 |
420 |
421 __PHONELOG1( |
421 __PHONELOG1( |
422 EBasic, |
422 EBasic, |
423 EPhoneUIUtils, |
423 EPhoneUIUtils, |
424 "CTeleRecoverySystem::RunL NewRq = %d ", (TInt) iRequest ); |
424 "CTeleRecoverySystem::RunL NewRq = %d ", (TInt) iRequest ); |
425 } |
425 } |
426 else |
426 else |
427 { |
427 { |
428 // SIM is not yet available, start listening again. |
428 // SIM is not yet available, start listening again. |
429 IssueRequest(); |
429 IssueRequest(); |
711 void CTeleRecoverySystem::StartTimerIfRequired( TRecoveryState aNewState ) |
711 void CTeleRecoverySystem::StartTimerIfRequired( TRecoveryState aNewState ) |
712 { |
712 { |
713 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::StartTimerIfRequired()"); |
713 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::StartTimerIfRequired()"); |
714 |
714 |
715 if ( IsIdle() ) |
715 if ( IsIdle() ) |
716 { |
716 { |
717 if ( aNewState == EPhoneStateWaiting ) |
717 if ( aNewState == EPhoneStateWaiting ) |
718 { |
718 { |
719 StartTimerIfIdle(); |
719 StartTimerIfIdle(); |
720 } |
720 } |
721 else if ( aNewState == EPhoneStateStarting ) |
721 else if ( aNewState == EPhoneStateStarting ) |
722 { |
722 { |
723 StartAllStepsTimer(); |
723 StartAllStepsTimer(); |
724 } |
724 } |
725 } |
725 } |
726 } |
726 } |
727 |
727 |
728 // ----------------------------------------------------------------------------- |
728 // ----------------------------------------------------------------------------- |
729 // CTeleRecoverySystem::IsIdle() |
729 // CTeleRecoverySystem::IsIdle() |
730 // ----------------------------------------------------------------------------- |
730 // ----------------------------------------------------------------------------- |
731 // |
731 // |
732 TBool CTeleRecoverySystem::IsIdle() |
732 TBool CTeleRecoverySystem::IsIdle() |
733 { |
733 { |
734 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::IsIdle()"); |
734 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::IsIdle()"); |
735 TBool retVal(EFalse); |
735 TBool retVal(EFalse); |
736 TInt error(0); |
736 TInt error(0); |
737 TInt state(0); |
737 TInt state(0); |
738 |
738 |
739 error = iIdleActive.Get( |
739 error = iIdleActive.Get( |
740 KPSUidStartup, |
740 KPSUidStartup, |
741 KPSIdlePhase1Ok, |
741 KPSIdlePhase1Ok, |
742 state ); |
742 state ); |
743 |
743 |
782 if ( !iTimer->IsActive() ) |
782 if ( !iTimer->IsActive() ) |
783 { |
783 { |
784 iTickCounter = KPhoneRecoveryCounterStart; |
784 iTickCounter = KPhoneRecoveryCounterStart; |
785 iTimer->After( KPhoneRecoveryTickInterval, |
785 iTimer->After( KPhoneRecoveryTickInterval, |
786 TCallBack( HandleTimer, this ) ); |
786 TCallBack( HandleTimer, this ) ); |
787 } |
787 } |
788 } |
788 } |
789 |
789 |
790 // ----------------------------------------------------------------------------- |
790 // ----------------------------------------------------------------------------- |
791 // CTeleRecoverySystem::StartAllStepsTimer |
791 // CTeleRecoverySystem::StartAllStepsTimer |
792 // ----------------------------------------------------------------------------- |
792 // ----------------------------------------------------------------------------- |
793 // |
793 // |
794 void CTeleRecoverySystem::StartAllStepsTimer() |
794 void CTeleRecoverySystem::StartAllStepsTimer() |
795 { |
795 { |
796 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::StartAllStepsTimer()"); |
796 __LOGMETHODSTARTEND( EPhoneUIUtils, "CTeleRecoverySystem::StartAllStepsTimer()"); |
797 if ( !iAllStepsTimer->IsActive() ) |
797 if ( !iAllStepsTimer->IsActive() ) |
798 { |
798 { |
799 iAllStepsTimer->After( 1, TCallBack( HandleAllStepsTimer, this ) ); |
799 iAllStepsTimer->After( 1, TCallBack( HandleAllStepsTimer, this ) ); |
800 } |
800 } |
801 } |
801 } |
802 |
802 |
803 // ----------------------------------------------------------------------------- |
803 // ----------------------------------------------------------------------------- |
804 // CTeleRecoverySystem::StartNext |
804 // CTeleRecoverySystem::StartNext |
805 // ----------------------------------------------------------------------------- |
805 // ----------------------------------------------------------------------------- |
943 { |
943 { |
944 if ( iRequest == EPhoneSIMPresent ) |
944 if ( iRequest == EPhoneSIMPresent ) |
945 { |
945 { |
946 iSimPresentProperty.Subscribe( iStatus ); |
946 iSimPresentProperty.Subscribe( iStatus ); |
947 |
947 |
948 __PHONELOG( |
948 __PHONELOG( |
949 EBasic, |
949 EBasic, |
950 EPhoneUIUtils, |
950 EPhoneUIUtils, |
951 "CTeleRecoverySystem::DoItemCallBack IssueReq.2"); |
951 "CTeleRecoverySystem::DoItemCallBack IssueReq.2"); |
952 } |
952 } |
953 else |
953 else |
954 { |
954 { |
955 __PHONELOG( |
955 __PHONELOG( |
956 EBasic, |
956 EBasic, |
957 EPhoneUIUtils, |
957 EPhoneUIUtils, |
958 "CTeleRecoverySystem::DoItemCallBack IssueReq.3"); |
958 "CTeleRecoverySystem::DoItemCallBack IssueReq.3"); |
959 |
959 |
960 __ASSERT_DEBUG( iRequest == EPhoneSIMStatus, Panic( EPhoneUtilsNoCallBack ) ); |
960 __ASSERT_DEBUG( iRequest == EPhoneSIMStatus, Panic( EPhoneUtilsNoCallBack ) ); |
961 |
961 |
962 iSimStatusProperty.Subscribe( iStatus ); |
962 iSimStatusProperty.Subscribe( iStatus ); |
963 } |
963 } |
964 |
964 |
965 SetActive(); |
965 SetActive(); |
979 TInt value = KErrNotFound; |
979 TInt value = KErrNotFound; |
980 TBool simOk = EFalse; |
980 TBool simOk = EFalse; |
981 |
981 |
982 if ( iSimAvailable != ESimUsable ) |
982 if ( iSimAvailable != ESimUsable ) |
983 { |
983 { |
984 __PHONELOG( |
984 __PHONELOG( |
985 EBasic, |
985 EBasic, |
986 EPhoneUIUtils, |
986 EPhoneUIUtils, |
987 "CTeleRecoverySystem::IsSIMOk Ret 0"); |
987 "CTeleRecoverySystem::IsSIMOk Ret 0"); |
988 // SIM is not yet available. |
988 // SIM is not yet available. |
989 return EFalse; |
989 return EFalse; |
990 } |
990 } |
991 |
991 |
992 // Get current status. |
992 // Get current status. |
1017 // Check current SIM present state. |
1017 // Check current SIM present state. |
1018 if ( iSimStatusProperty.Handle() ) |
1018 if ( iSimStatusProperty.Handle() ) |
1019 { |
1019 { |
1020 iSimStatusProperty.Get( iSimAvailable ); |
1020 iSimStatusProperty.Get( iSimAvailable ); |
1021 |
1021 |
1022 __PHONELOG1( |
1022 __PHONELOG1( |
1023 EBasic, |
1023 EBasic, |
1024 EPhoneUIUtils, |
1024 EPhoneUIUtils, |
1025 "CTeleRecoverySystem::CheckSIMAvailable %d ", iSimAvailable ); |
1025 "CTeleRecoverySystem::CheckSIMAvailable %d ", iSimAvailable ); |
1026 |
1026 |
1027 if ( iSimAvailable != ESimUsable ) |
1027 if ( iSimAvailable != ESimUsable ) |
1028 |
1028 |
1029 { |
1029 { |
1030 // Since SIM is not yet present, wait for availability. |
1030 // Since SIM is not yet present, wait for availability. |
1033 else |
1033 else |
1034 { |
1034 { |
1035 // SIM is now available, start listening for SIM status. |
1035 // SIM is now available, start listening for SIM status. |
1036 iRequest = EPhoneSIMStatus; |
1036 iRequest = EPhoneSIMStatus; |
1037 |
1037 |
1038 __PHONELOG1( |
1038 __PHONELOG1( |
1039 EBasic, |
1039 EBasic, |
1040 EPhoneUIUtils, |
1040 EPhoneUIUtils, |
1041 "CTeleRecoverySystem::CheckSIMAvailable new rq %d ", (TInt) iRequest ); |
1041 "CTeleRecoverySystem::CheckSIMAvailable new rq %d ", (TInt) iRequest ); |
1042 |
1042 |
1043 |
1043 |
1044 if ( iSimStatusProperty.Handle() ) |
1044 if ( iSimStatusProperty.Handle() ) |
1045 { |
1045 { |
1046 TInt value = ESimStatusUninitialized; |
1046 TInt value = ESimStatusUninitialized; |