00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "CNetworkRegInfo.h"
00018
00026 CNetworkRegInfo* CNetworkRegInfo::NewL(MExecAsync* aController)
00027 {
00028 CNetworkRegInfo* self = new(ELeave) CNetworkRegInfo(aController);
00029 CleanupStack::PushL(self);
00030 self->ConstructL();
00031 CleanupStack::Pop(self);
00032 return self;
00033 }
00034
00038 CNetworkRegInfo::~CNetworkRegInfo()
00039 {
00040 Cancel();
00041 }
00042
00047 void CNetworkRegInfo::DoStartRequestL()
00048 {
00049 iRequestNotify = EFalse;
00050
00051
00052 iTelephony->GetNetworkRegistrationStatus(iStatus, iNetworkRegV1Pckg);
00053 SetActive();
00054 }
00055
00062 CNetworkRegInfo::CNetworkRegInfo(MExecAsync* aController)
00063 : CISVAPIAsync(aController, KNetworkRegInfo),
00064 iNetworkRegV1Pckg(iNetworkRegV1)
00065 {
00066
00067 }
00068
00072 void CNetworkRegInfo::ConstructL()
00073 {
00074 iRequestNotify = EFalse;
00075 }
00076
00081 void CNetworkRegInfo::RunL()
00082 {
00083 if(iStatus != KErrNone)
00084 {
00085 iConsole->Printf(KError);
00086
00087
00088 iConsole->Printf(_L("%d\n"), iStatus.Int());
00089 }
00090 else
00091 {
00092 TBuf<30> theStatus;
00093 iConsole->Printf(KNetworkRegMsg);
00094 switch(iNetworkRegV1.iRegStatus)
00095 {
00096 case CTelephony::ERegistrationUnknown:
00097 theStatus.Append(_L("ERegistrationUnknown\n"));
00098 break;
00099 case CTelephony::ENotRegisteredNoService:
00100 theStatus.Append(_L("ENotRegisteredNoService\n"));
00101 break;
00102 case CTelephony::ENotRegisteredEmergencyOnly:
00103 theStatus.Append(_L("ENotRegisteredEmergencyOnly\n"));
00104 break;
00105 case CTelephony::ENotRegisteredSearching:
00106 theStatus.Append(_L("ENotRegisteredSearching\n"));
00107 break;
00108 case CTelephony::ERegisteredBusy:
00109 theStatus.Append(_L("ERegisteredBusy\n"));
00110 break;
00111 case CTelephony::ERegisteredOnHomeNetwork:
00112 theStatus.Append(_L("ERegisteredOnHomeNetwork\n"));
00113 break;
00114 case CTelephony::ERegistrationDenied:
00115 theStatus.Append(_L("ERegistrationDenied\n"));
00116 break;
00117 case CTelephony::ERegisteredRoaming:
00118 theStatus.Append(_L("ERegisteredRoaming\n"));
00119 break;
00120 default:
00121 break;
00122 }
00123 iConsole->Printf(theStatus);
00124 }
00125 if (iNetworkRegV1.iRegStatus == CTelephony::ERegisteredOnHomeNetwork)
00126 {
00127 ExampleNotify();
00128 }
00129 else
00130 {
00131 RequestNotificationL();
00132 }
00133 }
00134
00139 void CNetworkRegInfo::DoRequestNotificationL()
00140 {
00141
00142
00143 _LIT( KNotifyPanic, "CNetworkReg Notify Method" );
00144 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00145 iRequestNotify = ETrue;
00146
00147
00148 iTelephony->NotifyChange( iStatus,
00149 CTelephony::ENetworkRegistrationStatusChange,
00150 iNetworkRegV1Pckg );
00151 SetActive();
00152 }
00153
00157 void CNetworkRegInfo::DoCancel()
00158 {
00159 iRequestNotify = EFalse;
00160
00161
00162 iTelephony->CancelAsync(CTelephony::ENetworkRegistrationStatusChangeCancel);
00163 }