examples/Telephony/ETel3rdPartyExample/PhoneId/CMainMenu.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 "CMainMenu.h"
00018 
00025 CMainMenu* CMainMenu::NewLC(CConsoleBase& aConsole)
00026         {
00027         CMainMenu* self = new(ELeave) CMainMenu(aConsole);
00028         CleanupStack::PushL(self);
00029         self->ConstructL();
00030         return self;
00031         }
00032 
00038 CMainMenu::CMainMenu(CConsoleBase& aConsole)
00039         : CBaseMenuSync(aConsole)
00040         {
00041         // Empty method
00042         }
00043 
00047 void CMainMenu::ConstructL()
00048         {
00049         CBaseMenuSync::ConstructL();
00050         iPhoneId = CPhoneId::NewL(this);
00051         iSubscriberId = CSubscriberId::NewL(this);
00052         }
00053 
00058 CMainMenu::~CMainMenu()
00059         {
00060         delete iPhoneId;
00061         delete iSubscriberId;
00062         }
00063 
00067 void CMainMenu::RunL()
00068         {
00069         switch(iState)
00070                 {
00071         case EStart:
00072                 iState = EGetPhoneId;
00073                 SetActive();
00074                 CompleteOwnRequest(KErrNone);
00075                 break;
00076         case EEnd:
00077                 CActiveScheduler::Stop();
00078                 break;
00079         case EGetPhoneId:
00080                 iState = EGetSubscriberId;
00081                 TRAPD(errPhone, iPhoneId->StartRequestL());
00082                 if (errPhone != KErrNone)
00083                         {
00084                         iConsole->Printf(_L("Request left with error code "));
00085                         iConsole->Printf(_L("%d\n"), errPhone);
00086                         return;
00087                         }
00088                 break;
00089         case EGetSubscriberId:
00090                 iState = EEnd;
00091                 TRAPD(errSub, iSubscriberId->StartRequestL());
00092                 if (errSub != KErrNone)
00093                         {
00094                         iConsole->Printf(_L("%d\n"), errSub);
00095                         return;
00096                         }
00097                 break;
00098         case EDummyAnswer:
00099         case EGetCallInfo:
00100         case EGetBatteryInfo:
00101         case EGetIndicator:
00102         case EGetLockInfo:
00103         case EGetSignalInfo:
00104         case EGetNetworkInfo:
00105         case EGetNetworkName:
00106         case EGetOperatorName:
00107         case EGetFlightModeInfo:
00108         case EGetNetworkRegStatus:
00109         case EGetLineStatus:
00110         case EGetCallStatus:
00111         case EAnswerIncomingCall:
00112         case EDialCall:
00113         case EGetDynamicCaps:
00114         case EHold:
00115         case EResume:
00116         case ESwap:
00117         case ESendDTMF:
00118         case EHangup:
00119         case ECallForwarding:
00120         case ECallWaiting:
00121         case ECallBarring:
00122         case EIdentityService:
00123         case EWaitingForKeyPress:
00124         case ESetNotifier:
00125         default:
00126                 break;  
00127                 }
00128         }
00129 
00133 void CMainMenu::DoCancel()
00134         {
00135         if(iState == EStart)
00136                 {
00137                 CompleteOwnRequest(KErrCancel);
00138                 }
00139         else
00140                 {
00141                 iConsole->ReadCancel();
00142                 }
00143         }

Generated by  doxygen 1.6.2