telephonyutils/etel3rdpartyapi/ExampleApps/OutgoingCalls/CCallWaitingStatus.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 "CCallWaitingStatus.h"
       
    18 
       
    19 /**
       
    20 Factory constructor.
       
    21 
       
    22 @param  aController Pointer to MExecAsync object passed to constructor of 
       
    23                     CISVAPIBase
       
    24 @return             Instance of CCallWaitingStatus class
       
    25 */
       
    26 CCallWaitingStatus* CCallWaitingStatus::NewL(MExecAsync* aController)
       
    27 	{
       
    28 	CCallWaitingStatus* self = new(ELeave) CCallWaitingStatus(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 CCallWaitingStatus::~CCallWaitingStatus()
       
    40 	{
       
    41 	Cancel();
       
    42 	}
       
    43 
       
    44 /**
       
    45 Gets the call waiting status and stores it in the iCallWaitingStatusV1Pckg 
       
    46 package.
       
    47 */
       
    48 void CCallWaitingStatus::DoStartRequestL()
       
    49 	{
       
    50 	_LIT( KNotifyPanic, "CCallWaitingStatus Get Method" );
       
    51 	__ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
       
    52 	iRequestNotify = EFalse;
       
    53 	
       
    54 	// Interrogate the current status of the call waiting services
       
    55 	iTelephony->GetCallWaitingStatus(iStatus, iCallWaitingStatusV1Pckg);
       
    56 	SetActive();
       
    57 	}
       
    58 
       
    59 /**
       
    60 Constructor.
       
    61 
       
    62 @param aController Pointer to an MExecAsync object passed to constructor of
       
    63                    CISVAPIBase
       
    64 */
       
    65 CCallWaitingStatus::CCallWaitingStatus(MExecAsync* aController)
       
    66 	: CISVAPIAsync(aController, KCallWaitingStatus),
       
    67 	  iCallWaitingStatusV1Pckg(iCallWaitingStatusV1)
       
    68 	{
       
    69 	// Empty method
       
    70 	}
       
    71 
       
    72 /**
       
    73 Second phase constructor.
       
    74 */
       
    75 void CCallWaitingStatus::ConstructL()
       
    76 	{
       
    77 	// Empty method
       
    78 	}
       
    79 
       
    80 /**
       
    81 If the active object completed, notify the menu object of the result.
       
    82 */
       
    83 void CCallWaitingStatus::RunL()
       
    84 	{
       
    85 	if(iStatus != KErrNone)
       
    86 		{
       
    87 		iConsole->Printf(KError);
       
    88 		
       
    89 		// Print the error status code
       
    90 		iConsole->Printf(_L("%d\n"), iStatus.Int());
       
    91 		}
       
    92 	else
       
    93 		{
       
    94 		// Print the console message if no error
       
    95 		iConsole->Printf(KCallWaitingStatusMsg);
       
    96 		switch(iCallWaitingStatusV1.iCallWaiting)
       
    97 			{
       
    98 		case CTelephony::EStatusActive:
       
    99 			ExampleComplete();
       
   100 			break;
       
   101 		case CTelephony::ENotActive:
       
   102 		case CTelephony::ENotProvisioned:
       
   103 		case CTelephony::ENotAvailable:
       
   104 		case CTelephony::EUnknown:
       
   105 			ExampleNotify();
       
   106 			break;
       
   107 			}
       
   108 		}
       
   109 	}
       
   110 
       
   111 /**
       
   112 Cancels asynchronous request to CTelephony::GetCallWaitingStatus()
       
   113 */
       
   114 void CCallWaitingStatus::DoCancel()
       
   115 	{
       
   116 	// Cancels an outstanding asynchronous request.
       
   117 	iTelephony->CancelAsync(CTelephony::EGetCallWaitingStatusCancel);
       
   118 	}
       
   119