00001 // Copyright (c) 2008-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 // Encapsulates both issuing a request to an asynchronous service provider 00015 // and handling the completed requests. 00016 // 00017 00018 00019 00024 #include "mAsyncWaiter.h" 00025 00029 CMessAsyncWaiter* CMessAsyncWaiter::NewL() 00030 { 00031 CMessAsyncWaiter* self = new(ELeave) CMessAsyncWaiter(); 00032 return self; 00033 } 00034 00038 CMessAsyncWaiter::CMessAsyncWaiter() : CActive(EPriorityStandard) 00039 { 00040 CActiveScheduler::Add(this); 00041 } 00042 00043 00044 CMessAsyncWaiter::~CMessAsyncWaiter() 00045 { 00046 Cancel(); 00047 } 00048 00053 void CMessAsyncWaiter::StartAndWait() 00054 { 00055 SetActive(); 00056 CActiveScheduler::Start(); 00057 } 00058 00059 00060 TInt CMessAsyncWaiter::Result() const 00061 { 00062 return iError; 00063 } 00064 00069 void CMessAsyncWaiter::RunL() 00070 { 00071 iError = iStatus.Int(); 00072 CActiveScheduler::Stop(); 00073 } 00074 00079 void CMessAsyncWaiter::DoCancel() 00080 { 00081 iError = KErrCancel; 00082 CActiveScheduler::Stop(); 00083 } 00084
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.