examples/Telephony/ETel3rdPartyExample/OutgoingCalls/CHold.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 "CHold.h"
00018 
00026 CHold* CHold::NewL(MExecAsync* aController)
00027         {
00028         CHold* self = new(ELeave) CHold(aController);
00029         CleanupStack::PushL(self);
00030         self->ConstructL();
00031         CleanupStack::Pop(self);
00032         return self;
00033         }
00034 
00039 CHold::~CHold()
00040         {
00041         Cancel();
00042         }
00043 
00049 void CHold::DoStartRequestL(CTelephony::TCallId aCallId)
00050         {
00051         _LIT(KDummyAnswerPanic, "CHold Get Method");
00052         __ASSERT_ALWAYS(!IsActive(), User::Panic(KDummyAnswerPanic, 1));
00053         iRequestNotify = EFalse;
00054         CTelephony::TCallCapsV1 callCapsV1;
00055         CTelephony::TCallCapsV1Pckg callCapsV1Pckg(callCapsV1);
00056         
00057         // Retrieves the dynamic call capabilities for calls you dialled 
00058         iTelephony->GetCallDynamicCaps(aCallId, callCapsV1Pckg);
00059 
00060         if( callCapsV1.iControlCaps & CTelephony::KCapsHold )
00061                 {
00062                 // The call represented by aCallId can be put on hold.
00063                 iTelephony->Hold(iStatus, aCallId);
00064                 SetActive();
00065                 }
00066         else if (callCapsV1.iControlCaps & CTelephony::KCapsSwap)
00067                 {
00068                 // Can't hold the active call.
00069                 }
00070         }
00071 
00078 CHold::CHold(MExecAsync* aController)
00079         : CISVAPIAsync(aController, KHold)
00080         {
00081         // Empty method
00082         }
00083 
00087 void CHold::ConstructL()
00088         {
00089         // Empty method
00090         }
00091 
00096 void CHold::RunL()
00097         {
00098         if(iStatus != KErrNone)
00099                 {
00100                 iConsole->Printf(KError);
00101                 
00102                 // Print the error status code
00103                 iConsole->Printf(_L("%d\n"), iStatus.Int());
00104                 }
00105         else
00106                 {
00107                 ExampleComplete();
00108                 }
00109         }
00110 
00114 void CHold::DoCancel()
00115         {
00116         // Cancels an outstanding asynchronous request.
00117         iTelephony->CancelAsync(CTelephony::EHoldCancel);
00118         }
00119 

Generated by  doxygen 1.6.2