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 "CCallBarringStatus.h" 00017 00025 CCallBarringStatus* CCallBarringStatus::NewL(MExecAsync* aController) 00026 { 00027 CCallBarringStatus* self = new(ELeave) CCallBarringStatus(aController); 00028 CleanupStack::PushL(self); 00029 self->ConstructL(); 00030 CleanupStack::Pop(self); 00031 return self; 00032 } 00033 00038 CCallBarringStatus::~CCallBarringStatus() 00039 { 00040 Cancel(); 00041 } 00042 00047 void CCallBarringStatus::DoStartRequestL() 00048 { 00049 _LIT( KNotifyPanic, "CCallBarringStatus Get Method" ); 00050 __ASSERT_ALWAYS( !IsActive(), User::Panic( KNotifyPanic, 1 )); 00051 iRequestNotify = EFalse; 00052 CTelephony::TCallBarringCondition condition = CTelephony::EBarAllIncoming; 00053 00054 // Interrogate the current status of the call barring services 00055 iTelephony->GetCallBarringStatus( iStatus, 00056 condition, 00057 iCallBarringStatusV1Pckg); 00058 SetActive(); 00059 } 00060 00067 CCallBarringStatus::CCallBarringStatus(MExecAsync* aController) 00068 : CISVAPIAsync(aController, KCallBarringStatus) 00069 , iCallBarringStatusV1Pckg(iCallBarringStatusV1) 00070 { 00071 // 00072 } 00073 00077 void CCallBarringStatus::ConstructL() 00078 { 00079 // Empty method 00080 } 00081 00086 void CCallBarringStatus::RunL() 00087 { 00088 if(iStatus != KErrNone) 00089 { 00090 iConsole->Printf(KError); 00091 00092 // Print the error status code 00093 iConsole->Printf(_L("%d\n"), iStatus.Int()); 00094 } 00095 else 00096 { 00097 // Print the console output message if there is no error 00098 iConsole->Printf(KCallBarringStatusMsg); 00099 switch(iCallBarringStatusV1.iCallBarring) 00100 { 00101 case CTelephony::EStatusActive: 00102 // Call barring is active and restricts all incoming calls! 00103 // Could end application here by calling Terminate(). 00104 // Wait for 5 seconds then continue by calling ExampleComplete() 00105 iConsole->Printf(_L("Call Barring Restricts incoming calls!\n")); 00106 iConsole->Printf(_L("Recify this to remove this delay\n")); 00107 User::After(5000000); 00108 ExampleComplete(); 00109 break; 00110 case CTelephony::ENotActive: 00111 case CTelephony::ENotProvisioned: 00112 case CTelephony::ENotAvailable: 00113 case CTelephony::EUnknown: 00114 ExampleComplete(); 00115 break; 00116 } 00117 } 00118 } 00119 00123 void CCallBarringStatus::DoCancel() 00124 { 00125 // Cancels an outstanding asynchronous request 00126 iTelephony->CancelAsync(CTelephony::EGetCallBarringStatusCancel); 00127 }
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.