00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "CNetworkRegInfo.h"
00033
00040 CNetworkRegInfo* CNetworkRegInfo::NewL(MExecAsync* aController)
00041 {
00042 CNetworkRegInfo* self = new(ELeave) CNetworkRegInfo(aController);
00043 CleanupStack::PushL(self);
00044 self->ConstructL();
00045 CleanupStack::Pop(self);
00046 return self;
00047 }
00048
00053 CNetworkRegInfo::~CNetworkRegInfo()
00054 {
00055 Cancel();
00056 delete iTelephony;
00057 }
00058
00063 void CNetworkRegInfo::StartRequestL()
00064 {
00065 iRequestNotify = EFalse;
00066 iTelephony->GetNetworkRegistrationStatus(iStatus, iNetworkRegV1Pckg);
00067 SetActive();
00068 }
00069
00075 CNetworkRegInfo::CNetworkRegInfo(MExecAsync* aController)
00076 : CISVAPIAsync(aController)
00077 , iNetworkRegV1Pckg(iNetworkRegV1)
00078 {
00079 iExtensionId = KNetworkRegInfo;
00080 }
00081
00085 void CNetworkRegInfo::ConstructL()
00086 {
00087 CActiveScheduler::Add(this);
00088 iTelephony = CTelephony::NewL();
00089 iRequestNotify = EFalse;
00090 }
00091
00097 void CNetworkRegInfo::RunL()
00098 {
00099 TBool isNotification = iRequestNotify;
00100 if(iStatus != KErrNone)
00101 {
00102 gConsole->Printf(KErrorRom);
00103 }
00104 else
00105 {
00106 TBuf<30> theStatus;
00107 gConsole->Printf(KNetworkRegMsgRom);
00108 switch(iNetworkRegV1.iRegStatus)
00109 {
00110 case CTelephony::ERegistrationUnknown:
00111 theStatus.Append(_L("ERegistrationUnknown\n"));
00112 break;
00113 case CTelephony::ENotRegisteredNoService:
00114 theStatus.Append(_L("ENotRegisteredNoService\n"));
00115 break;
00116 case CTelephony::ENotRegisteredEmergencyOnly:
00117 theStatus.Append(_L("ENotRegisteredEmergencyOnly\n"));
00118 break;
00119 case CTelephony::ENotRegisteredSearching:
00120 theStatus.Append(_L("ENotRegisteredSearching\n"));
00121 break;
00122 case CTelephony::ERegisteredBusy:
00123 theStatus.Append(_L("ERegisteredBusy\n"));
00124 break;
00125 case CTelephony::ERegisteredOnHomeNetwork:
00126 theStatus.Append(_L("ERegisteredOnHomeNetwork\n"));
00127 break;
00128 case CTelephony::ERegistrationDenied:
00129 theStatus.Append(_L("ERegistrationDenied\n"));
00130 break;
00131 case CTelephony::ERegisteredRoaming:
00132 theStatus.Append(_L("ERegisteredRoaming\n"));
00133 break;
00134 default:
00135 break;
00136 }
00137 gConsole->Printf(theStatus);
00138 }
00139 iRequestNotify = EFalse;
00140 if (isNotification)
00141 {
00142 ExampleNotify();
00143 }
00144 else
00145 {
00146 ExampleComplete();
00147 }
00148 }
00149
00154 void CNetworkRegInfo::RequestNotificationL()
00155 {
00156
00157
00158
00159
00160
00161 _LIT( KNotifyPanic, "CNetworkReg Notify Method" );
00162 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00163 iRequestNotify = ETrue;
00164 iTelephony->NotifyChange( iStatus,
00165 CTelephony::ENetworkRegistrationStatusChange,
00166 iNetworkRegV1Pckg );
00167 SetActive();
00168 }
00169
00173 void CNetworkRegInfo::DoCancel()
00174 {
00175 iRequestNotify = EFalse;
00176 iTelephony->CancelAsync(CTelephony::ENetworkRegistrationStatusChangeCancel);
00177 }