examples/Telephony/ETel3rdPartyExample/SuppleServices/CCallBarringStatus.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 "CCallBarringStatus.h"
00018 
00026 CCallBarringStatus* CCallBarringStatus::NewL(MExecAsync* aController)
00027         {
00028         CCallBarringStatus* self = new(ELeave) CCallBarringStatus(aController);
00029         CleanupStack::PushL(self);
00030         self->ConstructL();
00031         CleanupStack::Pop(self);
00032         return self;
00033         }
00034 
00039 CCallBarringStatus::~CCallBarringStatus()
00040         {
00041         Cancel();
00042         }
00043 
00048 void CCallBarringStatus::DoStartRequestL()
00049         {
00050         _LIT( KNotifyPanic, "CCallBarringStatus Get Method" );
00051         __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 ));
00052         iRequestNotify = EFalse;
00053         CTelephony::TCallBarringCondition condition = CTelephony::EBarAllIncoming;
00054         
00055         // Interrogate the current status of the call barring services.
00056         iTelephony->GetCallBarringStatus(       iStatus,
00057                                                                         condition,
00058                                                                         iCallBarringStatusV1Pckg);
00059         SetActive();
00060         }
00061 
00068 CCallBarringStatus::CCallBarringStatus(MExecAsync* aController)
00069         : CISVAPIAsync(aController, KCallBarringStatus),
00070           iCallBarringStatusV1Pckg(iCallBarringStatusV1)
00071         {
00072         // Empty method
00073         }
00074 
00078 void CCallBarringStatus::ConstructL()
00079         {
00080         // Empty method
00081         }
00082 
00087 void CCallBarringStatus::RunL()
00088         {
00089         if(iStatus != KErrNone)
00090                 {
00091                 iConsole->Printf(KError);
00092                 
00093                 // Print the error status code
00094                 iConsole->Printf(_L("%d\n"), iStatus.Int());
00095                 }
00096         else
00097                 {
00098                 // Print the output to the console if there is no error.
00099                 iConsole->Printf(KCallBarringStatusMsg);
00100                 switch(iCallBarringStatusV1.iCallBarring)
00101                         {
00102                 case CTelephony::EStatusActive:
00103                         iConsole->Printf(_L("Call barring status is active.\n"));
00104                         break;
00105                 case CTelephony::ENotActive:
00106                         iConsole->Printf(_L("Call barring status is not active.\n"));
00107                         break;
00108                 case CTelephony::ENotProvisioned:
00109                         iConsole->Printf(_L("Call barring status is not provisioned.\n"));
00110                         break;
00111                 case CTelephony::ENotAvailable:
00112                         iConsole->Printf(_L("Call barring status is not available.\n"));
00113                         break;
00114                 case CTelephony::EUnknown:
00115                 default:
00116                         iConsole->Printf(_L("Call barring status is unknown.\n"));
00117                         break;
00118                         }
00119                 }
00120         ExampleComplete();
00121         }
00122 
00126 void CCallBarringStatus::DoCancel()
00127         {
00128         // Cancels an outstanding asynchronous request.
00129         iTelephony->CancelAsync(CTelephony::EGetCallBarringStatusCancel);
00130         }
00131 

Generated by  doxygen 1.6.2