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 #include "CNetworkRegInfo.h"
00032
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
00052 CNetworkRegInfo::~CNetworkRegInfo()
00053 {
00054 Cancel();
00055 }
00056
00060 void CNetworkRegInfo::DoStartRequestL()
00061 {
00062 iRequestNotify = EFalse;
00063
00064
00065 iTelephony->GetNetworkRegistrationStatus(iStatus, iNetworkRegV1Pckg);
00066 SetActive();
00067 }
00068
00075 CNetworkRegInfo::CNetworkRegInfo(MExecAsync* aController)
00076 : CISVAPIAsync(aController, KNetworkRegInfo),
00077 iNetworkRegV1Pckg(iNetworkRegV1)
00078 {
00079
00080 }
00081
00085 void CNetworkRegInfo::ConstructL()
00086 {
00087 iRequestNotify = EFalse;
00088 }
00089
00093 void CNetworkRegInfo::RunL()
00094 {
00095 if(iStatus != KErrNone)
00096 {
00097 iConsole->Printf(KError);
00098
00099
00100 iConsole->Printf(_L("%d\n"), iStatus.Int());
00101 }
00102 else
00103 {
00104
00105
00106 TBuf<30> theStatus;
00107 if(iRequestNotify)
00108 {
00109 iConsole->ClearScreen();
00110 iConsole->Printf(_L("*~This is a notifcation\n~*"));
00111 }
00112 iConsole->Printf(KNetworkRegMsg);
00113 switch(iNetworkRegV1.iRegStatus)
00114 {
00115 case CTelephony::ERegistrationUnknown:
00116 theStatus.Append(_L("ERegistrationUnknown\n"));
00117 break;
00118 case CTelephony::ENotRegisteredNoService:
00119 theStatus.Append(_L("ENotRegisteredNoService\n"));
00120 break;
00121 case CTelephony::ENotRegisteredEmergencyOnly:
00122 theStatus.Append(_L("ENotRegisteredEmergencyOnly\n"));
00123 break;
00124 case CTelephony::ENotRegisteredSearching:
00125 theStatus.Append(_L("ENotRegisteredSearching\n"));
00126 break;
00127 case CTelephony::ERegisteredBusy:
00128 theStatus.Append(_L("ERegisteredBusy\n"));
00129 break;
00130 case CTelephony::ERegisteredOnHomeNetwork:
00131 theStatus.Append(_L("ERegisteredOnHomeNetwork\n"));
00132 break;
00133 case CTelephony::ERegistrationDenied:
00134 theStatus.Append(_L("ERegistrationDenied\n"));
00135 break;
00136 case CTelephony::ERegisteredRoaming:
00137 theStatus.Append(_L("ERegisteredRoaming\n"));
00138 break;
00139 default:
00140 break;
00141 }
00142 iConsole->Printf(theStatus);
00143 }
00144 if (iNetworkRegV1.iRegStatus == CTelephony::ERegisteredOnHomeNetwork)
00145 {
00146 ExampleNotify();
00147 }
00148 else
00149 {
00150 RequestNotificationL();
00151 }
00152 }
00153
00158 void CNetworkRegInfo::DoRequestNotificationL()
00159 {
00160
00161
00162 _LIT( KNotifyPanic, "CNetworkReg Notify Method" );
00163 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00164 iRequestNotify = ETrue;
00165
00166
00167 iTelephony->NotifyChange(iStatus,
00168 CTelephony::ENetworkRegistrationStatusChange,
00169 iNetworkRegV1Pckg );
00170 SetActive();
00171 }
00172
00176 void CNetworkRegInfo::DoCancel()
00177 {
00178 iRequestNotify = EFalse;
00179
00180
00181 iTelephony->CancelAsync(CTelephony::ENetworkRegistrationStatusChangeCancel);
00182 }