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