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 "CBaseMenuAsync.h" 00018 00024 void CBaseMenuAsync::CompleteOwnRequest(TInt aErr) 00025 { 00026 TRequestStatus* status = &iStatus; 00027 00028 // Complete an asynchronous request 00029 User::RequestComplete(status, aErr); 00030 } 00031 00036 void CBaseMenuAsync::Start() 00037 { 00038 PostOwnRequest(); 00039 SetActive(); 00040 CompleteOwnRequest(KErrNone); 00041 } 00042 00046 void CBaseMenuAsync::PostOwnRequest() 00047 { 00048 iStatus = KRequestPending; 00049 } 00050 00054 void CBaseMenuAsync::Terminate() 00055 { 00056 iState = EEnd; 00057 SetActive(); 00058 CompleteOwnRequest(KErrNone); 00059 } 00060 00066 CBaseMenuAsync::CBaseMenuAsync(CConsoleBase& aConsole) 00067 : CActive(EPriorityUserInput), 00068 iState(EStart), 00069 iConsole(&aConsole) 00070 { 00071 CActiveScheduler::Add(this); 00072 } 00073 00078 void CBaseMenuAsync::GetInput() 00079 { 00080 // Gets a keystroke from the console window, asynchronously. 00081 iConsole->Read(iStatus); 00082 iState = EWaitingForKeyPress; 00083 SetActive(); 00084 } 00085 00089 void CBaseMenuAsync::ConstructL() 00090 { 00091 iTelephony = CTelephony::NewL(); 00092 }