examples/Telephony/ETel3rdPartyExample/SuppleServices/CIdentityServiceStatus.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 "CIdentityServiceStatus.h"
00018 
00026 CIdentityServiceStatus* CIdentityServiceStatus::NewL(MExecAsync* aController)
00027         {
00028         CIdentityServiceStatus* self = new(ELeave) CIdentityServiceStatus(aController);
00029         CleanupStack::PushL(self);
00030         self->ConstructL();
00031         CleanupStack::Pop(self);
00032         return self;
00033         }
00034 
00039 CIdentityServiceStatus::~CIdentityServiceStatus()
00040         {
00041         Cancel();
00042         }
00043 
00048 void CIdentityServiceStatus::DoStartRequestL()
00049         {
00050         _LIT(KDummyAnswerPanic, "CIdentityServiceStatus Get Method");
00051         __ASSERT_ALWAYS(!IsActive(), User::Panic(KDummyAnswerPanic, 1));
00052         iRequestNotify = EFalse;
00053         CTelephony::TIdentityService condition = CTelephony::EIdServiceCallerPresentation;
00054         
00055         // Interrogate the current status of the identity services.
00056         iTelephony->GetIdentityServiceStatus(iStatus,
00057                                                                                                          condition,
00058                                                                                                          iIdentityServiceStatusV1Pckg);
00059         SetActive();
00060         }
00061 
00068 CIdentityServiceStatus::CIdentityServiceStatus(MExecAsync* aController)
00069         : CISVAPIAsync(aController, KIdentityServiceStatus),
00070           iIdentityServiceStatusV1Pckg(iIdentityServiceStatusV1)
00071         {
00072         // Empty method
00073         }
00074 
00078 void CIdentityServiceStatus::ConstructL()
00079         {
00080         // Empty method
00081         }
00082 
00087 void CIdentityServiceStatus::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 call identity service status.
00099                 iConsole->Printf(KIdentityServiceStatusMsg);
00100                 switch(iIdentityServiceStatusV1.iIdentityStatus)
00101                         {
00102                 case CTelephony::EIdServiceActivePermanent:
00103                         iConsole->Printf(_L("Provisioned and permanently active.\n"));
00104                         break;
00105                 case CTelephony::EIdServiceActiveDefaultRestricted:
00106                         iConsole->Printf(_L("Provisioned and active. By default, the number is restricted unless overridden by the user.\n"));
00107                         break;
00108                 case CTelephony::EIdServiceActiveDefaultAllowed :
00109                         iConsole->Printf(_L("Provisioned and active. By default, the number is displayed unless specifically restricted by the user.\n"));
00110                         break;
00111                 case CTelephony::EIdServiceNotProvisioned:
00112                         iConsole->Printf(_L("Not provisioned.\n"));
00113                         break;
00114                 case CTelephony::EIdServiceUnknown:
00115                         iConsole->Printf(_L("Unknown.\n"));
00116                         break;
00117                         }
00118                 }
00119         ExampleComplete();
00120         }
00121 
00125 void CIdentityServiceStatus::DoCancel()
00126         {
00127         // Cancels an outstanding asynchronous request.
00128         iTelephony->CancelAsync(CTelephony::EGetIdentityServiceStatusCancel);
00129         }
00130 

Generated by  doxygen 1.6.2