dosservices/dosserver/src/dosasyncexecbase.cpp
author Tapani Kanerva <Tapani.Kanerva@nice.fi>
Thu, 11 Nov 2010 14:35:29 +0000
branchRCL_3
changeset 86 79105dd92dc2
parent 0 4e1aa6a622a0
permissions -rw-r--r--
Export meaningful default HWRM policy files, to fix Bug 3852

/*
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
*    Implementation of the CDosAsyncExecBase class.
*
*/


#include "dosasyncexecbase.h"

//
// ---------------------------------------------------------
// CDosAsyncExecBase Constructor
// ---------------------------------------------------------
//  

EXPORT_C CDosAsyncExecBase::CDosAsyncExecBase(const RMessagePtr2 aMessage) : CActive(EPriorityStandard), iMessage(aMessage)
{
	CActiveScheduler::Add(this);
}

//
// ---------------------------------------------------------
// CDosAsyncExecBase Desctructor
// ---------------------------------------------------------
//  

EXPORT_C  CDosAsyncExecBase::~CDosAsyncExecBase()
{
	Cancel();
}

//
// ---------------------------------------------------------
// CDosAsyncExecBase::RunL
//
// Inherited from CActive.
// ---------------------------------------------------------
//  

EXPORT_C void CDosAsyncExecBase::RunL()
{
	TBool autoDestroy = ETrue;
	TBool complete = ETrue;

	BeforeComplete(complete);
	if(complete)
	{
		iMessage.Complete(iStatus.Int());
		AfterComplete(autoDestroy);
		if(autoDestroy)
		{
			delete this;
		}
	}
}

//
// ---------------------------------------------------------
// CDosAsyncExecBase::BeforeComplete
//
// Default empty implementation. A derived class can override
// this.
// ---------------------------------------------------------
//  

EXPORT_C void CDosAsyncExecBase::BeforeComplete(TBool& /*aComplete*/)
{
}

//
// ---------------------------------------------------------
// CDosAsyncExecBase::AfterComplete
//
// Default empty implementation. A derived class can override
// this.
// ---------------------------------------------------------
//  

EXPORT_C void CDosAsyncExecBase::AfterComplete(TBool& /*aAutoDestroy*/)
{
}

//
// ---------------------------------------------------------
// CDosAsyncExecBase::DoCancel
//
// Inherited from CActive.
// ---------------------------------------------------------
//  

EXPORT_C void CDosAsyncExecBase::DoCancel()
{
	TRequestStatus* status = &iStatus;
	User::RequestComplete(status,KErrCancel);
}