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 "CCallStatus.h"
00033
00042 CCallStatus* CCallStatus::NewL(MExecAsync* aController, CTelephony::TCallId aCallId)
00043 {
00044 CCallStatus* self = new(ELeave) CCallStatus(aController, aCallId);
00045 CleanupStack::PushL(self);
00046 self->ConstructL();
00047 CleanupStack::Pop(self);
00048 return self;
00049 }
00050
00054 CCallStatus::~CCallStatus()
00055 {
00056 Cancel();
00057 }
00058
00063 void CCallStatus::DoStartRequestL()
00064 {
00065 iTelephony->GetCallStatus(iCallId, iCallStatusV1Pckg);
00066 iConsole->Printf((_L("%d ")), iCallId);
00067 CTelephony::TCallStatus callStatus = iCallStatusV1.iStatus;
00068 switch(callStatus)
00069 {
00070 case CTelephony::EStatusRinging:
00071 iConsole->Printf(_L("RING RING RING\n"));
00072 break;
00073 case CTelephony::EStatusConnected:
00074 iConsole->Printf(_L("Call Status connected\n"));
00075 break;
00076 case CTelephony::EStatusConnecting:
00077 iConsole->Printf(_L("Call Status connecting\n"));
00078 break;
00079 case CTelephony::EStatusAnswering:
00080 iConsole->Printf(_L("Call Status Answering\n"));
00081 break;
00082 case CTelephony::EStatusIdle:
00083 iConsole->Printf(_L("Call Status Idle\n"));
00084 break;
00085 case CTelephony::EStatusDisconnecting:
00086 iConsole->Printf(_L("Call Status Disconnecting\n"));
00087 break;
00088 case CTelephony::EStatusHold:
00089 iConsole->Printf(_L("Call Status on Hold\n"));
00090 break;
00091 default:
00092 iConsole->Printf((_L("Call status changed is %d \n")), callStatus);
00093 break;
00094 }
00095
00096 if(callStatus == CTelephony::EStatusConnected)
00097 {
00098 ExampleComplete();
00099 }
00100 else
00101 {
00102 RequestNotificationL();
00103 }
00104 }
00105
00113 CCallStatus::CCallStatus(MExecAsync* aController, CTelephony::TCallId aCallId)
00114 : CISVAPIAsync(aController, KCallStatus),
00115 iCallId(aCallId),
00116 iCallStatusV1Pckg(iCallStatusV1)
00117 {
00118
00119 }
00120
00124 void CCallStatus::ConstructL()
00125 {
00126
00127 }
00128
00132 void CCallStatus::RunL()
00133 {
00134
00135 if(iStatus != KErrNone)
00136 {
00137
00138 iConsole->Printf(KError);
00139
00140
00141 iConsole->Printf(_L("%d\n"), iStatus.Int());
00142 }
00143 else
00144 {
00145
00146 iConsole->Printf((_L("%d ")), iCallId);
00147 CTelephony::TCallStatus CallStatus = iCallStatusV1.iStatus;
00148 switch(CallStatus)
00149 {
00150 case CTelephony::EStatusRinging:
00151 iConsole->Printf(_L("RING RING RING\n"));
00152 break;
00153 case CTelephony::EStatusConnected:
00154 iConsole->Printf(_L("Call Status connected\n"));
00155 break;
00156 case CTelephony::EStatusConnecting:
00157 iConsole->Printf(_L("Call Status connecting\n"));
00158 break;
00159 case CTelephony::EStatusAnswering:
00160 iConsole->Printf(_L("Call Status Answering\n"));
00161 break;
00162 case CTelephony::EStatusIdle:
00163 iConsole->Printf(_L("Call Status Idle\n"));
00164 break;
00165 case CTelephony::EStatusDisconnecting:
00166 iConsole->Printf(_L("Call Status Disconnecting\n"));
00167 break;
00168 case CTelephony::EStatusHold:
00169 iConsole->Printf(_L("Call Status on Hold\n"));
00170 break;
00171 default:
00172 iConsole->Printf((_L("Call status is %d \n")), CallStatus);
00173 break;
00174 }
00175 if (CallStatus == CTelephony::EStatusDisconnecting)
00176 {
00177 ExampleNotify();
00178 }
00179 else if(CallStatus == CTelephony::EStatusConnected)
00180 {
00181 ExampleComplete();
00182 }
00183 else
00184 {
00185 RequestNotificationL();
00186 }
00187 }
00188 }
00189
00194 void CCallStatus::DoRequestNotificationL()
00195 {
00196
00197
00198
00199 _LIT( KNotifyPanic, "CCallStatus Notify Method" );
00200 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00201 iRequestNotify = ETrue;
00202 CTelephony::TNotificationEvent iEvent;
00203
00204 switch(iCallId)
00205 {
00206 case CTelephony::EISVCall1:
00207 iEvent = CTelephony::EOwnedCall1StatusChange;
00208 break;
00209 case CTelephony::EISVCall2:
00210 iEvent = CTelephony::EOwnedCall2StatusChange;
00211 break;
00212 default:
00213
00214 break;
00215 }
00216
00217
00218 iTelephony->NotifyChange(iStatus, iEvent, iCallStatusV1Pckg);
00219 SetActive();
00220 }
00221
00225 void CCallStatus::DoCancel()
00226 {
00227 switch(iCallId)
00228 {
00229 case CTelephony::EISVCall1:
00230 iTelephony->CancelAsync(CTelephony::EOwnedCall1StatusChangeCancel);
00231 break;
00232 case CTelephony::EISVCall2:
00233 iTelephony->CancelAsync(CTelephony::EOwnedCall2StatusChangeCancel);
00234 break;
00235 default:
00236
00237 break;
00238 }
00239 }