×
Namespaces

Variants
Actions

获得已接和未接来电号码

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

文章
huwell 在 14 Sep 2007 创建
最后由 hamishwillee 在 15 Dec 2011 编辑
  • 详细描述

下列代码演示了如何使用第三版telephony API(CTelephony)来获得已接和未接来电号码。

下列代码需要使用活动对象实现完成,因此有一个派生自CActive的类。

// Class members
 
CTelephony* iTelephony;
 
CTelephony::TCallStatusV1 iLineStatus;
 
CTelephony::TCallStatus iLastInformedLineStatus;
 
Construction & initialization:
 
iTelephony = CTelephony::NewL();
 
// Initialize with 'unknown' statuses
 
iLineStatus.iStatus = CTelephony::EStatusUnknown;
 
iLastInformedLineStatus = CTelephony::EStatusUnknown;
 
CTelephony::TCallStatusV1Pckg lineStatusPckg( iLineStatus );
 
// Request notification about the changes in voice line status
 
iTelephony->NotifyChange( iStatus, CTelephony::EVoiceLineStatusChange, lineStatusPckg );
 
SetActive();
 
Implementation of CActive::RunL()
 
// Within CActive::RunL():
 
if( iLineStatus.iStatus == CTelephony::EStatusDialling )
 
{
 
GetNumber();
 
}
 
if(iLineStatus.iStatus == CTelephony::EStatusRinging)
 
{
 
if(iLastInformedLineStatus != CTelephony::EStatusDialling)
 
{
 
GetNumber();
 
}
 
}
 
iLastInformedLineStatus = iLineStatus.iStatus;
 
Implementation of CActive::DoCancel():
 
iTelephony->CancelAsync( CTelephony::EVoiceLineStatusChangeCancel );
 
Implementation of GetNumber():
 
CTelephony::TCallInfoV1 callInfoV1;
 
CTelephony::TCallInfoV1Pckg callInfoV1Pckg( callInfoV1 );
 
CTelephony::TCallSelectionV1 callSelectionV1;
 
CTelephony::TCallSelectionV1Pckg callSelectionV1Pckg( callSelectionV1 );
 
CTelephony::TRemotePartyInfoV1 remotePartyInfoV1;
 
CTelephony::TRemotePartyInfoV1Pckg remotePartyInfoV1Pckg( remotePartyInfoV1 );
 
callSelectionV1.iLine = CTelephony::EVoiceLine;
 
callSelectionV1.iSelect = CTelephony::EInProgressCall;
 
iTelephony->GetCallInfo( callSelectionV1Pckg, callInfoV1Pckg, remotePartyInfoV1Pckg );
 
if( remotePartyInfoV1.iRemoteIdStatus == CTelephony::ERemoteIdentityAvailable )
 
{
 
if( remotePartyInfoV1.iRemoteNumber.iTelNumber.Length() > 0 )
 
{
 
// Incoming call number can be read from
 
// remotePartyInfoV1.iRemoteNumber.iTelNumber;
 
}
 
}
 
if( callInfoV1.iDialledParty.iTelNumber.Length() > 0 )
 
{
 
// Outgoing call number can be read from
 
// callInfoV1.iDialledParty.iTelNumber;
 
}
This page was last modified on 15 December 2011, at 13:14.
62 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×