examples/Telephony/ETel3rdPartyExample/SuppleServices/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 
00017 #include "CCallForwardingStatus.h"
00018 
00026 CCallForwardingStatus* CCallForwardingStatus::NewL(MExecAsync* aController)
00027         {
00028         CCallForwardingStatus* self = new(ELeave) CCallForwardingStatus(aController);
00029         CleanupStack::PushL(self);
00030         self->ConstructL();
00031         CleanupStack::Pop(self);
00032         return self;
00033         }
00034 
00038 CCallForwardingStatus::~CCallForwardingStatus()
00039         {
00040         Cancel();
00041         }
00042 
00046 void CCallForwardingStatus::DoStartRequestL()
00047         {
00048         _LIT( KNotifyPanic, "CCallForwardingStatus Get Method" );
00049         __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00050         iRequestNotify = EFalse;
00051         if (iSecondCondition)
00052                 {
00053                 iSecondCondition = EFalse;
00054                 CTelephony::TCallForwardingCondition condition2;
00055                 condition2 = CTelephony::ECallForwardingUnconditional;
00056                 
00057                 // Interrogates the current status of the call forwarding services for first condition.
00058                 iTelephony->GetCallForwardingStatus(iStatus,
00059                                                                                         condition2,
00060                                                                                         iCallForwardingStatus2V1Pckg);
00061                 }
00062         else
00063                 {
00064                 iSecondCondition = ETrue;
00065                 CTelephony::TCallForwardingCondition condition1;
00066                 condition1 = CTelephony::ECallForwardingNoReply;
00067                 
00068                 // Interrogates the current status of the call forwarding services for second condition
00069                 iTelephony->GetCallForwardingStatus(iStatus,
00070                                                                                         condition1,
00071                                                                                         iCallForwardingStatus1V1Pckg);
00072                 }
00073         SetActive();
00074         }
00075 
00082 CCallForwardingStatus::CCallForwardingStatus(MExecAsync* aController)
00083         : CISVAPIAsync(aController, KCallForwardingStatus),
00084           iCallForwardingStatus1V1Pckg(iCallForwardingStatus1V1),
00085           iCallForwardingStatus2V1Pckg(iCallForwardingStatus2V1)
00086         {
00087         // Empty method
00088         }
00089 
00093 void CCallForwardingStatus::ConstructL()
00094         {
00095         iSecondCondition = EFalse;
00096         }
00097 
00102 void CCallForwardingStatus::RunL()
00103         {
00104         if(iStatus != KErrNone)
00105                 {
00106                 iConsole->Printf(KError);
00107                 
00108                 // Print the error status code
00109                 iConsole->Printf(_L("%d\n"), iStatus.Int());
00110                 }
00111         else
00112                 {
00113                 if (!iSecondCondition)
00114                         {
00115                         iConsole->Printf(KCallForwardingStatusMsg);
00116                         switch(iCallForwardingStatus1V1.iCallForwarding)
00117                                 {
00118                         case CTelephony::EStatusActive:
00119                                 iConsole->Printf(_L("Call forwarding status 1 is active.\n"));
00120                                 break;
00121                         case CTelephony::ENotActive:
00122                                 iConsole->Printf(_L("Call forwarding status 2 is not active.\n"));
00123                                 break;
00124                         case CTelephony::ENotProvisioned:
00125                                 iConsole->Printf(_L("Call forwarding status 3 is not provisioned.\n"));
00126                                 break;
00127                         case CTelephony::ENotAvailable:
00128                                 iConsole->Printf(_L("Call forwarding status 4 is not available.\n"));
00129                                 break;
00130                         case CTelephony::EUnknown:
00131                         default:
00132                                 iConsole->Printf(_L("Call forwarding status 5 is unknown.\n"));
00133                                 break;
00134                                 }
00135                         switch(iCallForwardingStatus2V1.iCallForwarding)
00136                                 {
00137                         case CTelephony::EStatusActive:
00138                                 iConsole->Printf(_L("Call forwarding status 2 is active.\n"));
00139                                 break;
00140                         case CTelephony::ENotActive:
00141                                 iConsole->Printf(_L("Call forwarding status 2 is not active.\n"));
00142                                 break;
00143                         case CTelephony::ENotProvisioned:
00144                                 iConsole->Printf(_L("Call forwarding status 2 is not provisioned.\n"));
00145                                 break;
00146                         case CTelephony::ENotAvailable:
00147                                 iConsole->Printf(_L("Call forwarding status 2 is not available.\n"));
00148                                 break;
00149                         case CTelephony::EUnknown:
00150                         default:
00151                                 iConsole->Printf(_L("Call forwarding status 2 is unknown.\n"));
00152                                 break;
00153                                 }
00154                         ExampleComplete();
00155                         }
00156                 else
00157                         {
00158                         ExampleNotify();
00159                         }
00160                 }
00161         }
00162 
00166 void CCallForwardingStatus::DoCancel()
00167         {
00168         // Cancels an outstanding asynchronous request.
00169         iTelephony->CancelAsync(CTelephony::EGetCallForwardingStatusCancel);
00170         }
00171 

Generated by  doxygen 1.6.2