00001 // Copyright (c) 2006-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 // This encapsulates both issuing a request to an asynchronous service provider 00015 // and handling the completed requests. 00016 // 00017 00018 00019 00024 #include "asyncwaiter.h" 00025 00029 CAsyncWaiter* CAsyncWaiter::NewL() 00030 { 00031 CAsyncWaiter* self = new(ELeave) CAsyncWaiter(); 00032 return self; 00033 } 00034 00038 CAsyncWaiter::CAsyncWaiter() : CActive(EPriorityStandard) 00039 { 00040 CActiveScheduler::Add(this); 00041 } 00042 00043 00044 CAsyncWaiter::~CAsyncWaiter() 00045 { 00046 Cancel(); 00047 } 00048 00053 void CAsyncWaiter::StartAndWait() 00054 { 00055 SetActive(); 00056 CActiveScheduler::Start(); 00057 } 00058 00059 00060 TInt CAsyncWaiter::Result() const 00061 { 00062 return iError; 00063 } 00064 00069 void CAsyncWaiter::RunL() 00070 { 00071 iError = iStatus.Int(); 00072 CActiveScheduler::Stop(); 00073 } 00074 00079 void CAsyncWaiter::DoCancel() 00080 { 00081 iError = KErrCancel; 00082 CActiveScheduler::Stop(); 00083 }
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.