00001 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 00002 // All rights reserved. 00003 // This component and the accompanying materials are made available 00004 // under the terms of "Eclipse Public License v1.0" 00005 // which accompanies this distribution, and is available 00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html". 00007 // 00008 // Initial Contributors: 00009 // Nokia Corporation - initial contribution. 00010 // 00011 // Contributors: 00012 // 00013 // Description: 00014 // 00015 00016 #include "CCallStatus.h" 00017 00026 CCallStatus* CCallStatus::NewL(MExecAsync* aController, CTelephony::TCallId aCallId) 00027 { 00028 CCallStatus* self = new(ELeave) CCallStatus(aController, aCallId); 00029 CleanupStack::PushL(self); 00030 self->ConstructL(); 00031 CleanupStack::Pop(self); 00032 return self; 00033 } 00034 00039 CCallStatus::~CCallStatus() 00040 { 00041 Cancel(); 00042 } 00043 00048 void CCallStatus::DoStartRequestL() 00049 { 00050 // Retrieves the status of the selected call specified by the argument 00051 iTelephony->GetCallStatus(iCallId, iCallStatusV1Pckg); 00052 CTelephony::TCallStatus CallStatus = iCallStatusV1.iStatus; 00053 00054 // Print the caller identification 00055 iConsole->Printf((_L("%d ")), iCallId); 00056 switch(CallStatus) 00057 { 00058 case CTelephony::EStatusRinging: 00059 iConsole->Printf(_L("RING RING RING\n")); 00060 break; 00061 case CTelephony::EStatusConnected: 00062 iConsole->Printf(_L("Call Status connected\n")); 00063 break; 00064 case CTelephony::EStatusConnecting: 00065 iConsole->Printf(_L("Call Status connecting\n")); 00066 break; 00067 case CTelephony::EStatusAnswering: 00068 iConsole->Printf(_L("Call Status Answering\n")); 00069 break; 00070 case CTelephony::EStatusIdle: 00071 iConsole->Printf(_L("Call Status Idle\n")); 00072 break; 00073 case CTelephony::EStatusDisconnecting: 00074 iConsole->Printf(_L("Call Status Disconnecting\n")); 00075 break; 00076 case CTelephony::EStatusHold: 00077 iConsole->Printf(_L("Call Status on Hold\n")); 00078 break; 00079 default: 00080 iConsole->Printf((_L("Call status changed is %d \n")), CallStatus); 00081 break; 00082 } 00083 ExampleComplete(); 00084 } 00085 00093 CCallStatus::CCallStatus(MExecAsync* aController, 00094 CTelephony::TCallId aCallId) 00095 : CISVAPIAsync(aController, KCallStatus), 00096 iCallId(aCallId), 00097 iCallStatusV1Pckg(iCallStatusV1) 00098 { 00099 // Empty method 00100 } 00101 00105 void CCallStatus::ConstructL() 00106 { 00107 // Empty method 00108 } 00109 00115 void CCallStatus::RunL() 00116 { 00117 // Print Call Info 00118 if(iStatus != KErrNone) 00119 { 00120 iConsole->Printf(KError); 00121 00122 // Print error status code 00123 iConsole->Printf(_L("%d\n"), iStatus.Int()); 00124 } 00125 else 00126 { 00127 CTelephony::TCallStatus CallStatus = iCallStatusV1.iStatus; 00128 00129 // Print the caller identification 00130 iConsole->Printf((_L("%d ")), iCallId); 00131 switch(CallStatus) 00132 { 00133 case CTelephony::EStatusRinging: 00134 iConsole->Printf(_L("RING RING RING\n")); 00135 break; 00136 case CTelephony::EStatusConnected: 00137 iConsole->Printf(_L("Call Status connected\n")); 00138 break; 00139 case CTelephony::EStatusConnecting: 00140 iConsole->Printf(_L("Call Status connecting\n")); 00141 break; 00142 case CTelephony::EStatusAnswering: 00143 iConsole->Printf(_L("Call Status Answering\n")); 00144 break; 00145 case CTelephony::EStatusIdle: 00146 iConsole->Printf(_L("Call Status Idle\n")); 00147 break; 00148 case CTelephony::EStatusDisconnecting: 00149 iConsole->Printf(_L("Call Status Disconnecting\n")); 00150 break; 00151 case CTelephony::EStatusHold: 00152 iConsole->Printf(_L("Call Status on Hold\n")); 00153 break; 00154 default: 00155 iConsole->Printf((_L("Call status is %d \n")), CallStatus); 00156 break; 00157 } 00158 if (CallStatus != CTelephony::EStatusDisconnecting) 00159 { 00160 RequestNotificationL(); 00161 } 00162 else 00163 { 00164 ExampleNotify(); 00165 } 00166 } 00167 } 00168 00173 void CCallStatus::DoRequestNotificationL() 00174 { 00175 // Panic if this object is already performing an asynchronous operation. 00176 // Application will crash if you call SetActive() on an already active object. 00177 _LIT( KNotifyPanic, "CCallStatus Notify Method" ); 00178 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 )); 00179 iRequestNotify = ETrue; 00180 CTelephony::TNotificationEvent iEvent; 00181 switch(iCallId) 00182 { 00183 case CTelephony::EISVCall1: 00184 iEvent = CTelephony::EOwnedCall1StatusChange; 00185 break; 00186 00187 case CTelephony::EISVCall2: 00188 iEvent = CTelephony::EOwnedCall2StatusChange; 00189 break; 00190 default: 00191 // We have not been given a valid call ID 00192 break; 00193 } 00194 00195 // Registers interest in receiving change notifications for events. 00196 iTelephony->NotifyChange(iStatus, iEvent, iCallStatusV1Pckg); 00197 SetActive(); 00198 } 00199 00203 void CCallStatus::DoCancel() 00204 { 00205 switch(iCallId) 00206 { 00207 case CTelephony::EISVCall1: 00208 iTelephony->CancelAsync(CTelephony::EOwnedCall1StatusChangeCancel); 00209 break; 00210 case CTelephony::EISVCall2: 00211 iTelephony->CancelAsync(CTelephony::EOwnedCall2StatusChangeCancel); 00212 break; 00213 default: 00214 // We have not been given a valid call ID 00215 break; 00216 } 00217 }
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.