examples/Telephony/ETel3rdPartyExample/OutgoingCalls/CSwap.cpp

00001 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
00002 // All rights reserved.
00003 // This component and the accompanying materials are made available
00004 // under the terms of "Eclipse Public License v1.0"
00005 // which accompanies this distribution, and is available
00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00007 //
00008 // Initial Contributors:
00009 // Nokia Corporation - initial contribution.
00010 //
00011 // Contributors:
00012 //
00013 // Description:
00014 //
00015 
00016 
00017 #include "CSwap.h"
00018 
00026 CSwap* CSwap::NewL(MExecAsync* aController)
00027         {
00028         CSwap* self = new(ELeave) CSwap(aController);
00029         CleanupStack::PushL(self);
00030         self->ConstructL();
00031         CleanupStack::Pop(self);
00032         return self;
00033         }
00034 
00039 CSwap::~CSwap()
00040         {
00041         Cancel();
00042         }
00043 
00050 void CSwap::DoStartRequestL(CTelephony::TCallId aCallId1,
00051                                                         CTelephony::TCallId aCallId2)
00052         {
00053         _LIT(KDummyAnswerPanic, "CSignalInfo Get Method");
00054         __ASSERT_ALWAYS(!IsActive(), User::Panic(KDummyAnswerPanic, 1));
00055         iRequestNotify = EFalse;
00056         CTelephony::TCallCapsV1 callCapsV1;
00057         CTelephony::TCallCapsV1Pckg callCapsV1Pckg(callCapsV1);
00058         
00059         // Retrieves the dynamic call capabilities for calls you dialled or answered with CTelephony.
00060         iTelephony->GetCallDynamicCaps(aCallId1, callCapsV1Pckg);
00061 
00062         if( callCapsV1.iControlCaps & CTelephony::KCapsSwap)
00063                 {
00064                 // The call represented by aCallId1 can be swapped with iCallId2.
00065                 iTelephony->Swap(iStatus, aCallId1, aCallId2);
00066                 SetActive();
00067                 }
00068         else
00069                 {
00070                 // The calls cannot be swapped.
00071                 }
00072         }
00073 
00080 CSwap::CSwap(MExecAsync* aController)
00081         : CISVAPIAsync(aController, KSwap)
00082         {
00083         // Empty method
00084         }
00085 
00089 void CSwap::ConstructL()
00090         {
00091         // Empty method
00092         }
00093 
00098 void CSwap::RunL()
00099         {
00100         if(iStatus != KErrNone)
00101                 {
00102                 iConsole->Printf(KError);
00103                 
00104                 // Print the error status code
00105                 iConsole->Printf(_L("Swap %d\n"), iStatus.Int());
00106                 }
00107         else
00108                 {
00109                 ExampleComplete();
00110                 }
00111         }
00112 
00116 void CSwap::DoCancel()
00117         {
00118         // Cancels an outstanding asynchronous request.
00119         iTelephony->CancelAsync(CTelephony::ESwapCancel);
00120         }
00121 

Generated by  doxygen 1.6.2