examples/Telephony/ETel3rdPartyExample/IncomingCalls/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 
00047 void CIdentityServiceStatus::DoStartRequestL()
00048         {
00049         _LIT(KDummyAnswerPanic, "CIdentityServiceStatus Get Method");
00050         __ASSERT_ALWAYS(!IsActive(), User::Panic(KDummyAnswerPanic, 1));
00051         iRequestNotify = EFalse;
00052         CTelephony::TIdentityService condition = CTelephony::EIdServiceCallerPresentation;
00053         
00054         // Interrogate the current status of the identity services.
00055         iTelephony->GetIdentityServiceStatus(   iStatus,
00056                                                                                         condition,
00057                                                                                         iIdentityServiceStatusV1Pckg);
00058         SetActive();
00059         }
00060 
00067 CIdentityServiceStatus::CIdentityServiceStatus(MExecAsync* aController)
00068         : CISVAPIAsync(aController, KIdentityServiceStatus),
00069           iIdentityServiceStatusV1Pckg(iIdentityServiceStatusV1)
00070         {
00071         //
00072         }
00073 
00077 void CIdentityServiceStatus::ConstructL()
00078         {
00079         // Empty method
00080         }
00081 
00086 void CIdentityServiceStatus::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(KIdentityServiceStatusMsg);
00099                 switch(iIdentityServiceStatusV1.iIdentityStatus)
00100                         {
00101                 case CTelephony::EIdServiceActivePermanent:
00102                 case CTelephony::EIdServiceActiveDefaultAllowed:
00103                         iConsole->Printf(_L("Incoming Callers number Displayed\n"));
00104                         break;
00105                 case CTelephony::EIdServiceActiveDefaultRestricted:
00106                 case CTelephony::EIdServiceNotProvisioned:
00107                 case CTelephony::EIdServiceUnknown:
00108                         iConsole->Printf(_L("Incoming Caller's number NOT Displayed\n"));
00109                         break;
00110                         }
00111                 }
00112         ExampleComplete();
00113         }
00114 
00118 void CIdentityServiceStatus::DoCancel()
00119         {
00120         // Cancels an outstanding asynchronous request.
00121         iTelephony->CancelAsync(CTelephony::EGetIdentityServiceStatusCancel);
00122         }

Generated by  doxygen 1.6.2