telephonyutils/etel3rdpartyapi/ExampleApps/OutgoingCalls/CHangup.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 "CHangup.h"
       
    17 
       
    18 /**
       
    19 Factory constructor.
       
    20 
       
    21 @param  aController Pointer to MExecAsync object passed to constructor of 
       
    22                     CISVAPIBase
       
    23 @return             Instance of CHangup class
       
    24 */
       
    25 CHangup* CHangup::NewL(MExecAsync* aController)
       
    26 	{
       
    27 	CHangup* self = new(ELeave) CHangup(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 CHangup::~CHangup()
       
    39 	{
       
    40 	Cancel();
       
    41 	}
       
    42 
       
    43 /**
       
    44 Hangs up the call specified in aCallId.
       
    45 
       
    46 @param aCallId Call ID of call to hang up
       
    47 */
       
    48 void CHangup::DoStartRequestL(CTelephony::TCallId aCallId)
       
    49 	{
       
    50 	// Hangs up a call. 
       
    51 	iTelephony->Hangup(iStatus, aCallId);
       
    52 	SetActive();
       
    53 	}
       
    54 
       
    55 /**
       
    56 Constructor.
       
    57 
       
    58 @param aController Pointer to MExecAsync object passed to constructor of 
       
    59                    CISVAPIBase
       
    60 */
       
    61 CHangup::CHangup(MExecAsync* aController)
       
    62 	: CISVAPIAsync(aController, KHangup)
       
    63 	{
       
    64 	// Empty method
       
    65 	}
       
    66 
       
    67 /**
       
    68 Second phase constructor.
       
    69 */
       
    70 void CHangup::ConstructL()
       
    71 	{
       
    72 	// Empty method
       
    73 	}
       
    74 
       
    75 /**
       
    76 Checks the status of the active object and if there is no error, tells the user
       
    77 via the console that the call has been hung up.
       
    78 */
       
    79 void CHangup::RunL()
       
    80 	{
       
    81 	if(iStatus != KErrNone)
       
    82 		{
       
    83 		iConsole->Printf(KError);
       
    84 		
       
    85 		// Print the error status code
       
    86 		iConsole->Printf(_L("%d\n"), iStatus.Int());
       
    87 		}
       
    88 	else
       
    89 		{
       
    90 		// Print the console output if there is no error
       
    91 		iConsole->Printf(_L("CLICK\n"));
       
    92 		ExampleComplete();
       
    93 		}
       
    94 	}
       
    95 
       
    96 /**
       
    97 Cancels asynchronous request to CTelephony::Hangup()
       
    98 */
       
    99 void CHangup::DoCancel()
       
   100 	{
       
   101 	// Cancels an outstanding asynchronous request
       
   102 	iTelephony->CancelAsync(CTelephony::EHangupCancel);
       
   103 	}
       
   104