00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "CGetLockInfo.h"
00017
00025 CGetLockInfo* CGetLockInfo::NewL(MExecAsync* aController)
00026 {
00027 CGetLockInfo* self = new(ELeave) CGetLockInfo(aController);
00028 CleanupStack::PushL(self);
00029 self->ConstructL();
00030 CleanupStack::Pop(self);
00031 return self;
00032 }
00033
00038 CGetLockInfo::~CGetLockInfo()
00039 {
00040 Cancel();
00041 }
00042
00046 void CGetLockInfo::DoStartRequestL()
00047 {
00048 _LIT(KDummyAnswerPanic, "CGetLockInfo Get Method");
00049 __ASSERT_ALWAYS(!IsActive(), User::Panic(KDummyAnswerPanic, 1));
00050 iRequestNotify = EFalse;
00051 CTelephony::TIccLock lockSelect = CTelephony::ELockPin2;
00052
00053
00054 iTelephony->GetLockInfo(iStatus, lockSelect, iIccLockInfoV1Pckg);
00055 SetActive();
00056 }
00057
00064 CGetLockInfo::CGetLockInfo(MExecAsync* aController)
00065 : CISVAPIAsync(aController, KLockInfo),
00066 iIccLockInfoV1Pckg(iIccLockInfoV1)
00067 {
00068
00069 }
00070
00074 void CGetLockInfo::ConstructL()
00075 {
00076
00077 }
00078
00083 void CGetLockInfo::RunL()
00084 {
00085 if(iStatus != KErrNone)
00086 {
00087 iConsole->Printf(KError);
00088
00089
00090 iConsole->Printf(_L("%d\n"), iStatus.Int());
00091 }
00092 else
00093 {
00094 if( iIccLockInfoV1.iSetting == CTelephony::ELockSetEnabled)
00095 {
00096 iConsole->Printf(_L("Lock 2 is available for the phone to use\n"));
00097 switch (iIccLockInfoV1.iStatus)
00098 {
00099 case CTelephony::EStatusUnlocked:
00100 iConsole->Printf(_L("Its current status is Unlocked\n"));
00101 break;
00102 case CTelephony::EStatusBlocked:
00103 iConsole->Printf(_L("Its current status is blocked\n"));
00104 break;
00105 case CTelephony::EStatusLocked:
00106 iConsole->Printf(_L("Its current status is locked\n"));
00107 break;
00108 case CTelephony::EStatusUnknown:
00109 iConsole->Printf(_L("Its current status is unknown\n"));
00110 break;
00111 }
00112 if (iIccLockInfoV1.iStatus == CTelephony::EStatusUnlocked)
00113 {
00114
00115 ExampleComplete();
00116 }
00117 else
00118 {
00119 DoRequestNotificationL();
00120
00121
00122 }
00123 }
00124 else
00125 {
00126
00127 ExampleComplete();
00128 }
00129 }
00130 }
00131
00135 void CGetLockInfo::DoRequestNotificationL()
00136 {
00137
00138
00139 _LIT( KNotifyPanic, "CGetLockInfo Notify Method" );
00140 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00141 iRequestNotify = ETrue;
00142
00143
00144 iTelephony->NotifyChange( iStatus,
00145 CTelephony::EPin2LockInfoChange,
00146 iIccLockInfoV1Pckg );
00147 SetActive();
00148 }
00149
00153 void CGetLockInfo::DoCancel()
00154 {
00155
00156 iTelephony->CancelAsync(CTelephony::EPin2LockInfoChangeCancel);
00157 }
00158