头文件
#include <Etel3rdParty.h>
引用库
Etel3rdParty.lib
类
CTelephony
以下用到的变量类型
CTelephony::TCallStatusV1 iLineStatus;
CTelephony::TCallStatusV1Pckg ilineStatusPckg;
CTelephony* iTelePhony;
监控电话的VoiceLineStatus
iLineStatus.iStatus = CTelephony::EStatusUnknown;
iTelephony->NotifyChange( iStatus, CTelephony::EVoiceLineStatusChange, ilineStatusPckg );
SetActive();
取消监控
iTelephony->CancelAsync( CTelephony::EVoiceLineStatusChangeCancel );
获到来电号码
CTelephony::TCallInfoV1 iPhonyCallInfoV1;
CTelephony::TCallInfoV1Pckg iPhonyCallInfoV1Pckg(iPhonyCallInfoV1);
CTelephony::TCallSelectionV1 iPhonyCallSelectionV1;
CTelephony::TCallSelectionV1Pckg iPhonyCallSelectionV1Pckg(iPhonyCallSelectionV1);
CTelephony::TRemotePartyInfoV1 iPhonyRemotePartyInfoV1;
CTelephony::TRemotePartyInfoV1Pckg iPhonyRemotePartyInfoV1Pckg( iPhonyRemotePartyInfoV1 );
CTelephony::TCallStatusV1 iPhonyCallStatusV1;
CTelephony::TCallStatusV1Pckg iPhonyCallStatusV1Pckg(iPhonyCallStatusV1);
iPhonyCallSelectionV1.iLine = CTelephony::EVoiceLine;
iPhonyCallSelectionV1.iSelect = CTelephony::EInProgressCall;
iTelephony->GetLineStatus(CTelephony::EVoiceLine, iPhonyCallStatusV1Pckg);
iTelephony->GetCallInfo(iPhonyCallSelectionV1Pckg, iPhonyCallInfoV1Pckg, iPhonyRemotePartyInfoV1Pckg);
TBuf<32> remoteNumber;
if (CTelephony::ERemoteIdentityAvailable == iPhonyRemotePartyInfoV1.iRemoteIdStatus)
{
if (iPhonyRemotePartyInfoV1.iRemoteNumber.iTelNumber.Length() > 0)
{
//Incoming call number
remoteNumber = iPhonyRemotePartyInfoV1.iRemoteNumber.iTelNumber;
}
}
//可在此处对remoteNumber即用户来电号码进行处理
如果在响铃时要挂断用户来电,要用模拟用户按键的方式来处理,而不能用CTelephony::Hangup(TRequestStatus &aReqStatus, const TCallId &aCallId),原因:(Hangs up a call. This is only for calls you dialled or answered with CTelephony.)
模拟用户按键挂断来电
TRawEvent aRawEvent;
RWsSession iWsSession;
iWsSession.Connect();
aRawEvent.Set(TRawEvent::EKeyDown, EStdKeyNo);
iWsSession.SimulateRawEvent(aRawEvent);
User::After(100000);
aRawEvent.Set(TRawEvent::EKeyUp, EStdKeyNo);
iWsSession.SimulateRawEvent(aRawEvent);
iWsSession.Flush();
iWsSession.Close();