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 "CLineStatus.h" 00017 00025 CLineStatus* CLineStatus::NewL(MExecAsync* aController) 00026 { 00027 CLineStatus* self = new(ELeave) CLineStatus(aController); 00028 CleanupStack::PushL(self); 00029 self->ConstructL(); 00030 CleanupStack::Pop(self); 00031 return self; 00032 } 00033 00038 CLineStatus::~CLineStatus() 00039 { 00040 Cancel(); 00041 } 00042 00047 void CLineStatus::DoStartRequestL() 00048 { 00049 iRequestNotify = EFalse; 00050 CTelephony::TPhoneLine line = CTelephony::EVoiceLine; 00051 00052 // Retrieves the status of the line selected by the argument 00053 iTelephony->GetLineStatus(line, iLineStatusV1Pckg); 00054 CTelephony::TCallStatus voiceLineStatus = iLineStatusV1.iStatus; 00055 switch (voiceLineStatus) 00056 { 00057 case CTelephony::EStatusRinging: 00058 iConsole->Printf(_L("RING RING RING\n")); 00059 break; 00060 case CTelephony::EStatusConnected: 00061 iConsole->Printf(_L("Line Status: Connected\n")); 00062 break; 00063 case CTelephony::EStatusConnecting: 00064 iConsole->Printf(_L("Line Status: Connecting\n")); 00065 break; 00066 case CTelephony::EStatusAnswering: 00067 iConsole->Printf(_L("Line Status: Answering\n")); 00068 break; 00069 case CTelephony::EStatusIdle: 00070 iConsole->Printf(_L("Line Status: Idle\n")); 00071 break; 00072 case CTelephony::EStatusDisconnecting: 00073 iConsole->Printf(_L("Line Status: Disconnecting\n")); 00074 break; 00075 default: 00076 iConsole->Printf(_L("Line status changed.\n")); 00077 break; 00078 } 00079 if (voiceLineStatus == CTelephony::EStatusRinging) 00080 { 00081 ExampleNotify(); 00082 } 00083 else 00084 { 00085 ExampleComplete(); 00086 } 00087 } 00088 00095 CLineStatus::CLineStatus(MExecAsync* aController) 00096 : CISVAPIAsync(aController, KLineStatus), 00097 iLineStatusV1Pckg(iLineStatusV1) 00098 { 00099 // Empty method 00100 } 00101 00105 void CLineStatus::ConstructL() 00106 { 00107 // Empty method 00108 } 00109 00114 void CLineStatus::RunL() 00115 { 00116 CTelephony::TCallStatus voiceLineStatus = iLineStatusV1.iStatus; 00117 if(iStatus != KErrNone) 00118 { 00119 iConsole->Printf(KError); 00120 00121 // Print the error status code 00122 iConsole->Printf(_L("%d\n"), iStatus.Int()); 00123 } 00124 else 00125 { 00126 switch (voiceLineStatus) 00127 { 00128 case CTelephony::EStatusRinging: 00129 iConsole->Printf(_L("RING RING RING\n")); 00130 break; 00131 case CTelephony::EStatusConnected: 00132 iConsole->Printf(_L("Line Status: Connected\n")); 00133 break; 00134 case CTelephony::EStatusConnecting: 00135 iConsole->Printf(_L("Line Status: Connecting\n")); 00136 break; 00137 case CTelephony::EStatusAnswering: 00138 iConsole->Printf(_L("Line Status: Answering\n")); 00139 break; 00140 case CTelephony::EStatusIdle: 00141 iConsole->Printf(_L("Line Status: Idle\n")); 00142 break; 00143 case CTelephony::EStatusDisconnecting: 00144 iConsole->Printf(_L("Line Status: Disconnecting\n")); 00145 break; 00146 default: 00147 iConsole->Printf(_L("Line status changed.\n")); 00148 break; 00149 } 00150 if (voiceLineStatus == CTelephony::EStatusRinging) 00151 { 00152 ExampleNotify(); 00153 } 00154 else 00155 { 00156 RequestNotificationL(); 00157 } 00158 } 00159 } 00160 00164 void CLineStatus::DoRequestNotificationL() 00165 { 00166 // Panic if this object is already performing an asynchronous operation. 00167 // Application will panic if you call SetActive() on an already active object. 00168 _LIT( KNotifyPanic, "CLineStatus Notify Method" ); 00169 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 )); 00170 iRequestNotify = ETrue; 00171 00172 // Registers interest in receiving change notifications for events. 00173 iTelephony->NotifyChange( iStatus, 00174 CTelephony::EVoiceLineStatusChange, 00175 iLineStatusV1Pckg ); 00176 SetActive(); 00177 } 00178 00182 void CLineStatus::DoCancel() 00183 { 00184 // Cancels an outstanding asynchronous request. 00185 iTelephony->CancelAsync(CTelephony::EVoiceLineStatusChangeCancel); 00186 }
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.