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