bluetoothengine/bteng/inc/btengactive.inl
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 31 Aug 2010 15:25:10 +0300
branchRCL_3
changeset 22 613943a21004
parent 8 0707dd69d236
child 23 9386f31cc85b
permissions -rw-r--r--
Revision: 201033 Kit: 201035

/*
* Copyright (c) 2006-2010 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:  Active object helper class inline function definitions.
*
*/


// ======== MEMBER FUNCTIONS ========

// ---------------------------------------------------------------------------
// C++ default constructor
// ---------------------------------------------------------------------------
//
inline CBTEngActive::CBTEngActive(  MBTEngActiveObserver& aObserver, TInt aId, 
    TInt aPriority )
:   CActive( aPriority ),
    iRequestId( aId ),
    iObserver( aObserver )
    {
    CActiveScheduler::Add( this );
    }


// ---------------------------------------------------------------------------
// Symbian 2nd-phase constructor
// ---------------------------------------------------------------------------
//
inline void CBTEngActive::ConstructL()
    {
    }


// ---------------------------------------------------------------------------
// NewLC
// ---------------------------------------------------------------------------
//
inline CBTEngActive* CBTEngActive::NewL( MBTEngActiveObserver& aObserver, 
    TInt aId, TInt aPriority )
    {
    CBTEngActive* self = new( ELeave ) CBTEngActive( aObserver, aId, aPriority );
    CleanupStack::PushL( self );
    self->ConstructL();
    CleanupStack::Pop( self );
    return self;
    }


// ---------------------------------------------------------------------------
// Destructor
// ---------------------------------------------------------------------------
//
inline CBTEngActive::~CBTEngActive()
    {
    Cancel();
    }


// ---------------------------------------------------------------------------
// From class CActive.
// Called by the active scheduler when the request has been cancelled.
// ---------------------------------------------------------------------------
//
inline void CBTEngActive::DoCancel()
    {
    iObserver.CancelRequest( iRequestId );
    }

// -----------------------------------------------------------------------------
// Get the identifier of this instance.
// -----------------------------------------------------------------------------
//
inline TInt CBTEngActive::RequestId()
    {
    return iRequestId;
    }


// -----------------------------------------------------------------------------
// Set the identifier of this instance.
// -----------------------------------------------------------------------------
//
inline void CBTEngActive::SetRequestId( TInt aId )
    {
    iRequestId = aId;
    }


// -----------------------------------------------------------------------------
// Activate the active object.
// -----------------------------------------------------------------------------
//
inline void CBTEngActive::GoActive()
    {
    SetActive();
    }

// -----------------------------------------------------------------------------
// Get a reference to the active object request status.
// -----------------------------------------------------------------------------
//
inline TRequestStatus& CBTEngActive::RequestStatus()
    {
    return iStatus;
    }

// ---------------------------------------------------------------------------
// From class CActive.
// Called by the active scheduler when the request has been completed.
// ---------------------------------------------------------------------------
//
inline void CBTEngActive::RunL()
    {
    iObserver.RequestCompletedL( this, iStatus.Int() );
    }


// ---------------------------------------------------------------------------
// From class CActive.
// Called by the active scheduler when an error in RunL has occurred.
// ---------------------------------------------------------------------------
//
inline TInt CBTEngActive::RunError( TInt aError )
    {
    iObserver.HandleError( this, aError );
    return KErrNone;
    }