examples/Telephony/ETel3rdPartyExample/PhoneId/CMainMenu.cpp

00001 /*
00002 Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003 
00004 Redistribution and use in source and binary forms, with or without
00005 modification, are permitted provided that the following conditions are met:
00006 
00007 * Redistributions of source code must retain the above copyright notice, this
00008   list of conditions and the following disclaimer.
00009 * Redistributions in binary form must reproduce the above copyright notice,
00010   this list of conditions and the following disclaimer in the documentation
00011   and/or other materials provided with the distribution.
00012 * Neither the name of Nokia Corporation nor the names of its contributors
00013   may be used to endorse or promote products derived from this software
00014   without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 
00027 Description:  
00028 */
00029 
00030 
00031 
00032 #include "CMainMenu.h"
00033 
00040 CMainMenu* CMainMenu::NewLC(CConsoleBase& aConsole)
00041         {
00042         CMainMenu* self = new(ELeave) CMainMenu(aConsole);
00043         CleanupStack::PushL(self);
00044         self->ConstructL();
00045         return self;
00046         }
00047 
00053 CMainMenu::CMainMenu(CConsoleBase& aConsole)
00054         : CBaseMenuSync(aConsole)
00055         {
00056         // Empty method
00057         }
00058 
00062 void CMainMenu::ConstructL()
00063         {
00064         CBaseMenuSync::ConstructL();
00065         iPhoneId = CPhoneId::NewL(this);
00066         iSubscriberId = CSubscriberId::NewL(this);
00067         }
00068 
00073 CMainMenu::~CMainMenu()
00074         {
00075         delete iPhoneId;
00076         delete iSubscriberId;
00077         }
00078 
00082 void CMainMenu::RunL()
00083         {
00084         switch(iState)
00085                 {
00086         case EStart:
00087                 iState = EGetPhoneId;
00088                 SetActive();
00089                 CompleteOwnRequest(KErrNone);
00090                 break;
00091         case EEnd:
00092                 CActiveScheduler::Stop();
00093                 break;
00094         case EGetPhoneId:
00095                 iState = EGetSubscriberId;
00096                 TRAPD(errPhone, iPhoneId->StartRequestL());
00097                 if (errPhone != KErrNone)
00098                         {
00099                         iConsole->Printf(_L("Request left with error code "));
00100                         iConsole->Printf(_L("%d\n"), errPhone);
00101                         return;
00102                         }
00103                 break;
00104         case EGetSubscriberId:
00105                 iState = EEnd;
00106                 TRAPD(errSub, iSubscriberId->StartRequestL());
00107                 if (errSub != KErrNone)
00108                         {
00109                         iConsole->Printf(_L("%d\n"), errSub);
00110                         return;
00111                         }
00112                 break;
00113         case EDummyAnswer:
00114         case EGetCallInfo:
00115         case EGetBatteryInfo:
00116         case EGetIndicator:
00117         case EGetLockInfo:
00118         case EGetSignalInfo:
00119         case EGetNetworkInfo:
00120         case EGetNetworkName:
00121         case EGetOperatorName:
00122         case EGetFlightModeInfo:
00123         case EGetNetworkRegStatus:
00124         case EGetLineStatus:
00125         case EGetCallStatus:
00126         case EAnswerIncomingCall:
00127         case EDialCall:
00128         case EGetDynamicCaps:
00129         case EHold:
00130         case EResume:
00131         case ESwap:
00132         case ESendDTMF:
00133         case EHangup:
00134         case ECallForwarding:
00135         case ECallWaiting:
00136         case ECallBarring:
00137         case EIdentityService:
00138         case EWaitingForKeyPress:
00139         case ESetNotifier:
00140         default:
00141                 break;  
00142                 }
00143         }
00144 
00148 void CMainMenu::DoCancel()
00149         {
00150         if(iState == EStart)
00151                 {
00152                 CompleteOwnRequest(KErrCancel);
00153                 }
00154         else
00155                 {
00156                 iConsole->ReadCancel();
00157                 }
00158         }

Generated by  doxygen 1.6.2