examples/Telephony/ETel3rdPartyExample/SuppleServices/CCallForwardingStatus.cpp

00001 /*
00002 Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003 
00004 Redistribution and use in source and binary forms, with or without
00005 modification, are permitted provided that the following conditions are met:
00006 
00007 * Redistributions of source code must retain the above copyright notice, this
00008   list of conditions and the following disclaimer.
00009 * Redistributions in binary form must reproduce the above copyright notice,
00010   this list of conditions and the following disclaimer in the documentation
00011   and/or other materials provided with the distribution.
00012 * Neither the name of Nokia Corporation nor the names of its contributors
00013   may be used to endorse or promote products derived from this software
00014   without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 
00027 Description:  
00028 */
00029 
00030 
00031 
00032 #include "CCallForwardingStatus.h"
00033 
00041 CCallForwardingStatus* CCallForwardingStatus::NewL(MExecAsync* aController)
00042         {
00043         CCallForwardingStatus* self = new(ELeave) CCallForwardingStatus(aController);
00044         CleanupStack::PushL(self);
00045         self->ConstructL();
00046         CleanupStack::Pop(self);
00047         return self;
00048         }
00049 
00053 CCallForwardingStatus::~CCallForwardingStatus()
00054         {
00055         Cancel();
00056         }
00057 
00061 void CCallForwardingStatus::DoStartRequestL()
00062         {
00063         _LIT( KNotifyPanic, "CCallForwardingStatus Get Method" );
00064         __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00065         iRequestNotify = EFalse;
00066         if (iSecondCondition)
00067                 {
00068                 iSecondCondition = EFalse;
00069                 CTelephony::TCallForwardingCondition condition2;
00070                 condition2 = CTelephony::ECallForwardingUnconditional;
00071                 
00072                 // Interrogates the current status of the call forwarding services for first condition.
00073                 iTelephony->GetCallForwardingStatus(iStatus,
00074                                                                                         condition2,
00075                                                                                         iCallForwardingStatus2V1Pckg);
00076                 }
00077         else
00078                 {
00079                 iSecondCondition = ETrue;
00080                 CTelephony::TCallForwardingCondition condition1;
00081                 condition1 = CTelephony::ECallForwardingNoReply;
00082                 
00083                 // Interrogates the current status of the call forwarding services for second condition
00084                 iTelephony->GetCallForwardingStatus(iStatus,
00085                                                                                         condition1,
00086                                                                                         iCallForwardingStatus1V1Pckg);
00087                 }
00088         SetActive();
00089         }
00090 
00097 CCallForwardingStatus::CCallForwardingStatus(MExecAsync* aController)
00098         : CISVAPIAsync(aController, KCallForwardingStatus),
00099           iCallForwardingStatus1V1Pckg(iCallForwardingStatus1V1),
00100           iCallForwardingStatus2V1Pckg(iCallForwardingStatus2V1)
00101         {
00102         // Empty method
00103         }
00104 
00108 void CCallForwardingStatus::ConstructL()
00109         {
00110         iSecondCondition = EFalse;
00111         }
00112 
00117 void CCallForwardingStatus::RunL()
00118         {
00119         if(iStatus != KErrNone)
00120                 {
00121                 iConsole->Printf(KError);
00122                 
00123                 // Print the error status code
00124                 iConsole->Printf(_L("%d\n"), iStatus.Int());
00125                 }
00126         else
00127                 {
00128                 if (!iSecondCondition)
00129                         {
00130                         iConsole->Printf(KCallForwardingStatusMsg);
00131                         switch(iCallForwardingStatus1V1.iCallForwarding)
00132                                 {
00133                         case CTelephony::EStatusActive:
00134                                 iConsole->Printf(_L("Call forwarding status 1 is active.\n"));
00135                                 break;
00136                         case CTelephony::ENotActive:
00137                                 iConsole->Printf(_L("Call forwarding status 2 is not active.\n"));
00138                                 break;
00139                         case CTelephony::ENotProvisioned:
00140                                 iConsole->Printf(_L("Call forwarding status 3 is not provisioned.\n"));
00141                                 break;
00142                         case CTelephony::ENotAvailable:
00143                                 iConsole->Printf(_L("Call forwarding status 4 is not available.\n"));
00144                                 break;
00145                         case CTelephony::EUnknown:
00146                         default:
00147                                 iConsole->Printf(_L("Call forwarding status 5 is unknown.\n"));
00148                                 break;
00149                                 }
00150                         switch(iCallForwardingStatus2V1.iCallForwarding)
00151                                 {
00152                         case CTelephony::EStatusActive:
00153                                 iConsole->Printf(_L("Call forwarding status 2 is active.\n"));
00154                                 break;
00155                         case CTelephony::ENotActive:
00156                                 iConsole->Printf(_L("Call forwarding status 2 is not active.\n"));
00157                                 break;
00158                         case CTelephony::ENotProvisioned:
00159                                 iConsole->Printf(_L("Call forwarding status 2 is not provisioned.\n"));
00160                                 break;
00161                         case CTelephony::ENotAvailable:
00162                                 iConsole->Printf(_L("Call forwarding status 2 is not available.\n"));
00163                                 break;
00164                         case CTelephony::EUnknown:
00165                         default:
00166                                 iConsole->Printf(_L("Call forwarding status 2 is unknown.\n"));
00167                                 break;
00168                                 }
00169                         ExampleComplete();
00170                         }
00171                 else
00172                         {
00173                         ExampleNotify();
00174                         }
00175                 }
00176         }
00177 
00181 void CCallForwardingStatus::DoCancel()
00182         {
00183         // Cancels an outstanding asynchronous request.
00184         iTelephony->CancelAsync(CTelephony::EGetCallForwardingStatusCancel);
00185         }
00186 

Generated by  doxygen 1.6.2