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 "CLineStatus.h"
00032
00040 CLineStatus* CLineStatus::NewL(MExecAsync* aController)
00041 {
00042 CLineStatus* self = new(ELeave) CLineStatus(aController);
00043 CleanupStack::PushL(self);
00044 self->ConstructL();
00045 CleanupStack::Pop(self);
00046 return self;
00047 }
00048
00053 CLineStatus::~CLineStatus()
00054 {
00055 Cancel();
00056 }
00057
00062 void CLineStatus::DoStartRequestL()
00063 {
00064 iRequestNotify = EFalse;
00065 CTelephony::TPhoneLine line = CTelephony::EVoiceLine;
00066
00067
00068 iTelephony->GetLineStatus(line, iLineStatusV1Pckg);
00069 CTelephony::TCallStatus voiceLineStatus = iLineStatusV1.iStatus;
00070 switch (voiceLineStatus)
00071 {
00072 case CTelephony::EStatusRinging:
00073 iConsole->Printf(_L("RING RING RING\n"));
00074 break;
00075 case CTelephony::EStatusConnected:
00076 iConsole->Printf(_L("Line Status: Connected\n"));
00077 break;
00078 case CTelephony::EStatusConnecting:
00079 iConsole->Printf(_L("Line Status: Connecting\n"));
00080 break;
00081 case CTelephony::EStatusAnswering:
00082 iConsole->Printf(_L("Line Status: Answering\n"));
00083 break;
00084 case CTelephony::EStatusIdle:
00085 iConsole->Printf(_L("Line Status: Idle\n"));
00086 break;
00087 case CTelephony::EStatusDisconnecting:
00088 iConsole->Printf(_L("Line Status: Disconnecting\n"));
00089 break;
00090 default:
00091 iConsole->Printf(_L("Line status changed.\n"));
00092 break;
00093 }
00094 if (voiceLineStatus == CTelephony::EStatusRinging)
00095 {
00096 ExampleNotify();
00097 }
00098 else
00099 {
00100 ExampleComplete();
00101 }
00102 }
00103
00110 CLineStatus::CLineStatus(MExecAsync* aController)
00111 : CISVAPIAsync(aController, KLineStatus),
00112 iLineStatusV1Pckg(iLineStatusV1)
00113 {
00114
00115 }
00116
00120 void CLineStatus::ConstructL()
00121 {
00122
00123 }
00124
00129 void CLineStatus::RunL()
00130 {
00131 CTelephony::TCallStatus voiceLineStatus = iLineStatusV1.iStatus;
00132 if(iStatus != KErrNone)
00133 {
00134 iConsole->Printf(KError);
00135
00136
00137 iConsole->Printf(_L("%d\n"), iStatus.Int());
00138 }
00139 else
00140 {
00141 switch (voiceLineStatus)
00142 {
00143 case CTelephony::EStatusRinging:
00144 iConsole->Printf(_L("RING RING RING\n"));
00145 break;
00146 case CTelephony::EStatusConnected:
00147 iConsole->Printf(_L("Line Status: Connected\n"));
00148 break;
00149 case CTelephony::EStatusConnecting:
00150 iConsole->Printf(_L("Line Status: Connecting\n"));
00151 break;
00152 case CTelephony::EStatusAnswering:
00153 iConsole->Printf(_L("Line Status: Answering\n"));
00154 break;
00155 case CTelephony::EStatusIdle:
00156 iConsole->Printf(_L("Line Status: Idle\n"));
00157 break;
00158 case CTelephony::EStatusDisconnecting:
00159 iConsole->Printf(_L("Line Status: Disconnecting\n"));
00160 break;
00161 default:
00162 iConsole->Printf(_L("Line status changed.\n"));
00163 break;
00164 }
00165 if (voiceLineStatus == CTelephony::EStatusRinging)
00166 {
00167 ExampleNotify();
00168 }
00169 else
00170 {
00171 RequestNotificationL();
00172 }
00173 }
00174 }
00175
00179 void CLineStatus::DoRequestNotificationL()
00180 {
00181
00182
00183 _LIT( KNotifyPanic, "CLineStatus Notify Method" );
00184 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00185 iRequestNotify = ETrue;
00186
00187
00188 iTelephony->NotifyChange( iStatus,
00189 CTelephony::EVoiceLineStatusChange,
00190 iLineStatusV1Pckg );
00191 SetActive();
00192 }
00193
00197 void CLineStatus::DoCancel()
00198 {
00199
00200 iTelephony->CancelAsync(CTelephony::EVoiceLineStatusChangeCancel);
00201 }