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