telephonyutils/etel3rdpartyapi/ExampleApps/IncomingCalls/CCallInfo.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "CCallInfo.h"
       
    17 
       
    18 /**
       
    19 Factory constructor.
       
    20 
       
    21 @param  aController Pointer to MExecAsync object passed to constructor of 
       
    22                     CISVAPIBase
       
    23 @return             Instance of CCallInfo class
       
    24 */
       
    25 CCallInfo* CCallInfo::NewL(MExecAsync* aController)
       
    26 	{
       
    27 	CCallInfo* self = new(ELeave) CCallInfo(aController);
       
    28 	CleanupStack::PushL(self);
       
    29 	self->ConstructL();
       
    30 	CleanupStack::Pop(self);
       
    31 	return self;
       
    32 	}
       
    33 
       
    34 /**
       
    35 Destructor.
       
    36 Cancels outstanding requests.
       
    37 */
       
    38 CCallInfo::~CCallInfo()
       
    39 	{
       
    40 	Cancel();
       
    41 	}
       
    42 
       
    43 /**
       
    44 Gets the current call's information, stores the details in the iCallInfoV1Pckg
       
    45 and iRemoteInfoV1Pckg packages and displays the details to the console.
       
    46 */
       
    47 void CCallInfo::DoStartRequestL()
       
    48 	{
       
    49 	CTelephony::TCallSelectionV1 callSelectionV1;
       
    50 	CTelephony::TCallSelectionV1Pckg callSelectionV1Pckg( callSelectionV1 );
       
    51 
       
    52 	callSelectionV1.iLine = CTelephony::EVoiceLine;
       
    53 	callSelectionV1.iSelect = CTelephony::EInProgressCall;
       
    54 	
       
    55 	// Retrieves information about the call selected by the aCallSelect argument.
       
    56 	iTelephony->GetCallInfo(callSelectionV1Pckg,
       
    57 	                        iCallInfoV1Pckg,
       
    58 	                        iRemoteInfoV1Pckg);
       
    59 
       
    60 	switch(iCallInfoV1.iStatus)
       
    61 		{
       
    62 	case CTelephony::EStatusRinging:
       
    63 		iConsole->Printf(_L("RING RING RING\n"));
       
    64 		break;
       
    65 	case CTelephony::EStatusConnected:
       
    66 		iConsole->Printf(_L("Call Status: Connected\n"));
       
    67 		break;
       
    68 	case CTelephony::EStatusConnecting:
       
    69 		iConsole->Printf(_L("Call Status: Connecting\n"));
       
    70 		break;
       
    71 	case CTelephony::EStatusAnswering:
       
    72 		iConsole->Printf(_L("Call Status: Answering\n"));
       
    73 		break;
       
    74 	case CTelephony::EStatusIdle:
       
    75 		iConsole->Printf(_L("Call Status: Idle\n"));
       
    76 		break;
       
    77 	case CTelephony::EStatusDisconnecting:
       
    78 		iConsole->Printf(_L("Call Status: Disconnecting\n"));
       
    79 		break;
       
    80 	default:
       
    81 		iConsole->Printf(_L("Call status: Changed\n"));
       
    82 		break;
       
    83 		}
       
    84 	TDateTime time = iCallInfoV1.iStartTime;
       
    85 	
       
    86 	// Print the received call information
       
    87 	iConsole->Printf(_L("Call recieved at %d:%d:%d\n"),
       
    88 	                     time.Hour(),
       
    89 	                     time.Minute(),
       
    90 	                     time.Second());
       
    91 	iConsole->Printf(_L("on %d.%d.%d\n"),
       
    92 	                     time.Day(),
       
    93 	                     time.Month(),
       
    94 	                     time.Year());
       
    95 
       
    96 	if (iRemoteInfoV1.iRemoteIdStatus == CTelephony::ERemoteIdentityAvailable)
       
    97 		{
       
    98 		iConsole->Printf(iRemoteInfoV1.iRemoteNumber.iTelNumber);
       
    99 		}
       
   100 	else
       
   101 		{
       
   102 		iConsole->Printf(_L("Private Number Dialling\n"));
       
   103 		}
       
   104 	ExampleComplete();
       
   105 	}
       
   106 
       
   107 /**
       
   108 Constructor.
       
   109 
       
   110 @param aController Pointer to an MExecAsync object passed to constructor of 
       
   111                    CISVAPIBase
       
   112 */
       
   113 CCallInfo::CCallInfo(MExecAsync* aController)
       
   114 	: CISVAPIAsync(aController, KCallInfo),
       
   115 	  iCallInfoV1Pckg(iCallInfoV1),
       
   116 	  iRemoteInfoV1Pckg(iRemoteInfoV1)
       
   117 	{
       
   118 	// Empty method
       
   119 	}
       
   120 
       
   121 /**
       
   122 Second phase constructor.
       
   123 */
       
   124 void CCallInfo::ConstructL()
       
   125 	{
       
   126 	// Empty method
       
   127 	}
       
   128 
       
   129 /**
       
   130 Does nothing.
       
   131 */
       
   132 void CCallInfo::RunL()
       
   133 	{
       
   134  	// Empty method
       
   135 	}
       
   136 
       
   137 /**
       
   138 Does nothing.
       
   139 */
       
   140 void CCallInfo::DoCancel()
       
   141 	{
       
   142 	// Empty method
       
   143 	}