presetserver/serversrc/Psscheduler.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 04 Oct 2010 00:07:46 +0300
changeset 17 38bbf2dcd608
parent 0 09774dfdd46b
permissions -rw-r--r--
Revision: 201037 Kit: 201039

/*
* Copyright (c) 2006-2006 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:  Custom active scheduler for the preset server
*
*/


#include "psscheduler.h"
#include "psserver.h"

// ======== LOCAL FUNCTIONS ========

// ---------------------------------------------------------------------------
// ?description
// ---------------------------------------------------------------------------
//

namespace
    {

#ifdef _DEBUG
    
    void Panic( TInt aReason )
        {
        _LIT( schedulerPanic, "PSScheduler" );
        User::Panic( schedulerPanic, aReason );
        }

#endif // _DEBUG
    
    }

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

// ---------------------------------------------------------------------------
// ?description_if_needed
// ---------------------------------------------------------------------------
//
CPSScheduler::CPSScheduler()
    {
    }

// ---------------------------------------------------------------------------
// ?description_if_needed
// ---------------------------------------------------------------------------
//
CPSScheduler::~CPSScheduler()
    {
    }

// ---------------------------------------------------------------------------
// ?description_if_needed
// ---------------------------------------------------------------------------
//
void CPSScheduler::SetServer( CPSServer* aServer )
    {
    iServer = aServer;
    }

// ---------------------------------------------------------------------------
// From class ?base_class.
// ?implementation_description
// ---------------------------------------------------------------------------
//
void CPSScheduler::Error( TInt aError ) const
    {
    __ASSERT_DEBUG( iServer, Panic( KErrArgument ) );
    
    if ( iServer->IsActive() )
        {
        __DEBUGGER(); // Severe preset server error; activate a breakpoint if debugging.
        }
    else
        {
        if ( aError == KErrBadDescriptor )
            {
            iServer->PanicClient( aError );
            }

        iServer->Message().Complete( aError );
        iServer->ReStart();
        }
    }
	 
// ======== GLOBAL FUNCTIONS ========