telephonyutils/etel3rdpartyapi/ExampleApps/OutgoingCalls/CResume.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 
       
    17 #include "CResume.h"
       
    18 
       
    19 /**
       
    20 Factory constructor.
       
    21 
       
    22 @param  aController Pointer to MExecAsync object passed to constructor of 
       
    23                     CISVAPIBase
       
    24 @return             Instance of CResume class
       
    25 */
       
    26 CResume* CResume::NewL(MExecAsync* aController)
       
    27 	{
       
    28 	CResume* self = new(ELeave) CResume(aController);
       
    29 	CleanupStack::PushL(self);
       
    30 	self->ConstructL();
       
    31 	CleanupStack::Pop(self);
       
    32 	return self;
       
    33 	}
       
    34 
       
    35 /**
       
    36 Destructor.
       
    37 Cancels outstanding requests.
       
    38 */
       
    39 CResume::~CResume()
       
    40 	{
       
    41 	Cancel();
       
    42 	}
       
    43 
       
    44 /**
       
    45 Resumes the specified call if the dynamic call capabilities allow it.
       
    46 
       
    47 @param aCallId Identifier of the call to resume
       
    48 */
       
    49 void CResume::DoStartRequestL(CTelephony::TCallId aCallId)
       
    50 	{
       
    51 	_LIT(KDummyAnswerPanic, "CResume Get Method");
       
    52 	__ASSERT_ALWAYS(!IsActive(), User::Panic(KDummyAnswerPanic, 1));
       
    53    iRequestNotify = EFalse;
       
    54 	CTelephony::TCallCapsV1 callCapsV1;
       
    55    CTelephony::TCallCapsV1Pckg callCapsV1Pckg(callCapsV1);
       
    56    
       
    57    // Retrieves the dynamic call capabilities for calls you dialled or answered with CTelephony.
       
    58    iTelephony->GetCallDynamicCaps(aCallId, callCapsV1Pckg);
       
    59 
       
    60    if( callCapsV1.iControlCaps & CTelephony::KCapsResume )
       
    61       {
       
    62       // The call represented by aCallId can be resumed.
       
    63       iTelephony->Resume(iStatus, aCallId);
       
    64       SetActive();
       
    65       }
       
    66    else
       
    67       {
       
    68       // The call cannot be resumed.
       
    69       }
       
    70 	}
       
    71 
       
    72 /**
       
    73 Constructor.
       
    74 
       
    75 @param aController Pointer to an MExecAsync object passed to constructor of 
       
    76                    CISVAPIBase
       
    77 */
       
    78 CResume::CResume(MExecAsync* aController)
       
    79 	: CISVAPIAsync(aController, KResume)
       
    80 	{
       
    81 	// Empty method
       
    82 	}
       
    83 
       
    84 /**
       
    85 Second phase constructor.
       
    86 */
       
    87 void CResume::ConstructL()
       
    88 	{
       
    89 	// Empty method
       
    90 	}
       
    91 
       
    92 /**
       
    93 Checks the status of the active object and calls ExampleComplete() to notify
       
    94 the menu object that the example has finished.
       
    95 */
       
    96 void CResume::RunL()
       
    97 	{
       
    98 	if(iStatus != KErrNone)
       
    99 		{
       
   100 		iConsole->Printf(KError);
       
   101 		
       
   102 		// Print the output to console if there is no error
       
   103 		iConsole->Printf(_L("%d\n"), iStatus.Int());
       
   104 		}
       
   105 	else
       
   106 		{
       
   107 		ExampleComplete();
       
   108 		}
       
   109 	}
       
   110 
       
   111 /**
       
   112 Cancels asynchronous request to CTelephony::Resume()
       
   113 */
       
   114 void CResume::DoCancel()
       
   115 	{
       
   116 	// Cancels an outstanding asynchronous request.
       
   117 	iTelephony->CancelAsync(CTelephony::EResumeCancel);
       
   118 	}
       
   119