examples/Telephony/ETel3rdPartyExample/IncomingCalls/CCallForwardingStatus.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 #include "CCallForwardingStatus.h"
00017 
00025 CCallForwardingStatus* CCallForwardingStatus::NewL(MExecAsync* aController)
00026         {
00027         CCallForwardingStatus* self = new(ELeave) CCallForwardingStatus(aController);
00028         CleanupStack::PushL(self);
00029         self->ConstructL();
00030         CleanupStack::Pop(self);
00031         return self;
00032         }
00033 
00037 CCallForwardingStatus::~CCallForwardingStatus()
00038         {
00039         Cancel();
00040         }
00041 
00045 void CCallForwardingStatus::ConstructL()
00046         {
00047         iSecondCondition = EFalse;
00048         }
00049 
00053 void CCallForwardingStatus::DoStartRequestL()
00054         {
00055         _LIT( KNotifyPanic, "CCallForwardingStatus Get Method" );
00056         __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00057         iRequestNotify = EFalse;
00058         if (iSecondCondition)
00059                 {
00060                 iSecondCondition = EFalse;
00061                 CTelephony::TCallForwardingCondition condition2 = CTelephony::ECallForwardingUnconditional;
00062                 
00063                 // Interrogates the current status of the call forwarding services.
00064                 iTelephony->GetCallForwardingStatus(iStatus,
00065                                                     condition2,
00066                                                     iCallForwardingStatus2V1Pckg);
00067                 }
00068         else
00069                 {
00070                 iSecondCondition = ETrue;
00071                 CTelephony::TCallForwardingCondition condition1 = CTelephony::ECallForwardingNoReply;
00072                 
00073                 // Interrogates the current status of the call forwarding services.
00074                 iTelephony->GetCallForwardingStatus(iStatus,
00075                                                     condition1,
00076                                                     iCallForwardingStatus1V1Pckg);
00077                 }
00078         SetActive();
00079         }
00080 
00087 CCallForwardingStatus::CCallForwardingStatus(MExecAsync* aController)
00088         : CISVAPIAsync(aController, KCallForwardingStatus),
00089           iCallForwardingStatus1V1Pckg(iCallForwardingStatus1V1),
00090           iCallForwardingStatus2V1Pckg(iCallForwardingStatus2V1)
00091         {
00092         // Empty method
00093         }
00094 
00099 void CCallForwardingStatus::RunL()
00100         {
00101         if(iStatus != KErrNone)
00102                 {
00103                 iConsole->Printf(KError);
00104                 
00105                 // Print the error status code
00106                 iConsole->Printf(_L("%d\n"), iStatus.Int());
00107                 }
00108         else
00109                 {
00110                 if (!iSecondCondition)
00111                         {
00112                         iConsole->Printf(KCallForwardingStatusMsg);
00113                         switch(iCallForwardingStatus1V1.iCallForwarding)
00114                                 {
00115                         case CTelephony::EStatusActive:
00116                                 // Call Forwarding is active when there is no answer!
00117                                 // Could end application here by calling Terminate().
00118                                 // Wait for 5 seconds then continue by calling ExampleComplete().
00119                                 iConsole->Printf(_L("Call Forwarding impinges on incoming calls!\n"));
00120                                 iConsole->Printf(_L("Recify this to remove this delay\n"));
00121                                 User::After(5000000);
00122                         case CTelephony::ENotActive:
00123                         case CTelephony::ENotProvisioned:
00124                         case CTelephony::ENotAvailable:
00125                         case CTelephony::EUnknown:
00126                                 break;
00127                                 }
00128                         switch(iCallForwardingStatus2V1.iCallForwarding)
00129                                 {
00130                         case CTelephony::EStatusActive:
00131                                 // Call Forwarding is active on all incoming calls!
00132                                 // Could end application here by calling Terminate().
00133                                 // Wait for 5 seconds then continue by calling ExampleComplete().
00134                                 iConsole->Printf(_L("Call Forwarding impinges on incoming calls!\n"));
00135                                 iConsole->Printf(_L("Recify this to remove this delay\n"));
00136                                 User::After(5000000);
00137                         case CTelephony::ENotActive:
00138                         case CTelephony::ENotProvisioned:
00139                         case CTelephony::ENotAvailable:
00140                         case CTelephony::EUnknown:
00141                                 ExampleComplete();
00142                                 break;
00143                                 }
00144                         }
00145                 else
00146                         {
00147                         ExampleNotify();
00148                         }
00149                 }
00150         }
00151 
00155 void CCallForwardingStatus::DoCancel()
00156         {
00157         // Cancels an outstanding asynchronous request.
00158         iTelephony->CancelAsync(CTelephony::EGetCallForwardingStatusCancel);
00159         }

Generated by  doxygen 1.6.2