|         |      1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). | 
|         |      2 // All rights reserved. | 
|         |      3 // This component and the accompanying materials are made available | 
|         |      4 // under the terms of "Eclipse Public License v1.0" | 
|         |      5 // which accompanies this distribution, and is available | 
|         |      6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". | 
|         |      7 // | 
|         |      8 // Initial Contributors: | 
|         |      9 // Nokia Corporation - initial contribution. | 
|         |     10 // | 
|         |     11 // Contributors: | 
|         |     12 // | 
|         |     13 // Description: | 
|         |     14 // | 
|         |     15  | 
|         |     16 #include "CBaseMenuSync.h" | 
|         |     17  | 
|         |     18 /** | 
|         |     19 Completes a request so that the RunL() code of the active object is executed. | 
|         |     20  | 
|         |     21 @param aErr The error code to pass to User::RequestComplete(). | 
|         |     22 */ | 
|         |     23 void CBaseMenuSync::CompleteOwnRequest(TInt aErr) | 
|         |     24 	{ | 
|         |     25 	TRequestStatus* s = &iStatus; | 
|         |     26 	 | 
|         |     27 	// Complete an asynchronous request | 
|         |     28 	User::RequestComplete(s, aErr); | 
|         |     29 	} | 
|         |     30  | 
|         |     31 /** | 
|         |     32 Starts (this) active object making it active so it can take input and perform | 
|         |     33 required functionality. | 
|         |     34 */ | 
|         |     35 void CBaseMenuSync::Start() | 
|         |     36 	{ | 
|         |     37 	PostOwnRequest(); | 
|         |     38 	SetActive(); | 
|         |     39 	CompleteOwnRequest(KErrNone); | 
|         |     40 	} | 
|         |     41  | 
|         |     42 /** | 
|         |     43 Sets its own status to KRequestPending. | 
|         |     44 */ | 
|         |     45 void CBaseMenuSync::PostOwnRequest() | 
|         |     46 	{ | 
|         |     47 	iStatus = KRequestPending; | 
|         |     48 	} | 
|         |     49  | 
|         |     50 /** | 
|         |     51 Ends execution of the active object. | 
|         |     52 */ | 
|         |     53 void CBaseMenuSync::Terminate() | 
|         |     54 	{ | 
|         |     55 	iState = EEnd; | 
|         |     56 	CompleteOwnRequest(KErrNone); | 
|         |     57 	} | 
|         |     58  | 
|         |     59 /** | 
|         |     60 Constructor. | 
|         |     61  | 
|         |     62 @param aConsole Reference to console object to which output will be displayed | 
|         |     63 */ | 
|         |     64 CBaseMenuSync::CBaseMenuSync(CConsoleBase& aConsole) | 
|         |     65 	: CActive(EPriorityUserInput), | 
|         |     66 	  iState(EStart), | 
|         |     67 	  iConsole(&aConsole) | 
|         |     68 	{ | 
|         |     69 	CActiveScheduler::Add(this); | 
|         |     70 	} | 
|         |     71  | 
|         |     72 /** | 
|         |     73 Sets the active object state to active. | 
|         |     74 */ | 
|         |     75 void CBaseMenuSync::ExecComplete() | 
|         |     76 	{ | 
|         |     77 	SetActive(); | 
|         |     78 	CompleteOwnRequest(KErrNone); | 
|         |     79 	} | 
|         |     80  | 
|         |     81 /** | 
|         |     82 Second phase constructor. | 
|         |     83 */ | 
|         |     84 void CBaseMenuSync::ConstructL() | 
|         |     85 	{ | 
|         |     86 	iTelephony = CTelephony::NewL(); | 
|         |     87 	} | 
|         |     88  | 
|         |     89 /** | 
|         |     90 Destructor. | 
|         |     91 */ | 
|         |     92 CBaseMenuSync::~CBaseMenuSync() | 
|         |     93 	{ | 
|         |     94 	delete iTelephony; | 
|         |     95 	} |