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